From owner-svn-src-all@freebsd.org Sun Nov 6 00:35:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61EE2BED8B1; Sun, 6 Nov 2016 00:35:44 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E35E83; Sun, 6 Nov 2016 00:35:44 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA60ZhoJ067977; Sun, 6 Nov 2016 00:35:43 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA60ZhQ1067976; Sun, 6 Nov 2016 00:35:43 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201611060035.uA60ZhQ1067976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 6 Nov 2016 00:35:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308357 - stable/11/usr.bin/mkcsmapper X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 00:35:44 -0000 Author: bapt Date: Sun Nov 6 00:35:43 2016 New Revision: 308357 URL: https://svnweb.freebsd.org/changeset/base/308357 Log: MFC: r302481 Revert the change from errx/strerror to errc to appease gcc 4.2 I have forgotten this part in r307794 Reported by: lidl Modified: stable/11/usr.bin/mkcsmapper/yacc.y Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/mkcsmapper/yacc.y ============================================================================== --- stable/11/usr.bin/mkcsmapper/yacc.y Sat Nov 5 23:21:30 2016 (r308356) +++ stable/11/usr.bin/mkcsmapper/yacc.y Sun Nov 6 00:35:43 2016 (r308357) @@ -664,7 +664,7 @@ do_mkpv(FILE *in) if (ret && output) unlink(output); /* dump failure */ if (ret) - errc(EXIT_FAILURE, ret, ""); + errx(EXIT_FAILURE, "%s\n", strerror(ret)); } static void From owner-svn-src-all@freebsd.org Sun Nov 6 02:33:05 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8BDBC303B9; Sun, 6 Nov 2016 02:33:05 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 882DAB29; Sun, 6 Nov 2016 02:33:05 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA62X4fC013457; Sun, 6 Nov 2016 02:33:04 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA62X4td013456; Sun, 6 Nov 2016 02:33:04 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201611060233.uA62X4td013456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 6 Nov 2016 02:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308358 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 02:33:05 -0000 Author: ae Date: Sun Nov 6 02:33:04 2016 New Revision: 308358 URL: https://svnweb.freebsd.org/changeset/base/308358 Log: Initialize ip6 pointer before use. PR: 214169 MFC after: 1 week Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Sun Nov 6 00:35:43 2016 (r308357) +++ head/sys/netinet/tcp_subr.c Sun Nov 6 02:33:04 2016 (r308358) @@ -2731,6 +2731,7 @@ tcp_signature_do_compute(struct mbuf *m, * Note: Upper-Layer Packet Length comes before Next Header. */ case (IPV6_VERSION >> 4): + ip6 = mtod(m, struct ip6_hdr *); in6 = ip6->ip6_src; in6_clearscope(&in6); MD5Update(&ctx, (char *)&in6, sizeof(struct in6_addr)); From owner-svn-src-all@freebsd.org Sun Nov 6 05:57:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04223C3327F; Sun, 6 Nov 2016 05:57:46 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4E05AA0; Sun, 6 Nov 2016 05:57:45 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA65vjHa090429; Sun, 6 Nov 2016 05:57:45 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA65vjvK090428; Sun, 6 Nov 2016 05:57:45 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201611060557.uA65vjvK090428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 6 Nov 2016 05:57:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308359 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 05:57:46 -0000 Author: alc Date: Sun Nov 6 05:57:44 2016 New Revision: 308359 URL: https://svnweb.freebsd.org/changeset/base/308359 Log: MFC r308096, r308098, r308112 With one exception, "hardfault" is used like a "bool". Change that exception and make it a "bool". The "lookup_still_valid" field is used as a "bool". Make it one. Convert vm_fault_hold()'s Boolean variables that are only used internally to "bool". Add a comment describing why the one remaining "boolean_t" was not converted. Merge and sort vm_fault_hold()'s "int" variable definitions. Modified: stable/11/sys/vm/vm_fault.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_fault.c ============================================================================== --- stable/11/sys/vm/vm_fault.c Sun Nov 6 02:33:04 2016 (r308358) +++ stable/11/sys/vm/vm_fault.c Sun Nov 6 05:57:44 2016 (r308359) @@ -122,7 +122,7 @@ struct faultstate { vm_pindex_t first_pindex; vm_map_t map; vm_map_entry_t entry; - int lookup_still_valid; + bool lookup_still_valid; struct vnode *vp; }; @@ -148,7 +148,7 @@ unlock_map(struct faultstate *fs) if (fs->lookup_still_valid) { vm_map_lookup_done(fs->map, fs->entry); - fs->lookup_still_valid = FALSE; + fs->lookup_still_valid = false; } } @@ -291,24 +291,23 @@ vm_fault_hold(vm_map_t map, vm_offset_t int fault_flags, vm_page_t *m_hold) { vm_prot_t prot; - int alloc_req, era, faultcount, nera, result; - boolean_t dead, growstack, is_first_object_locked, wired; - int map_generation; vm_object_t next_object; - int hardfault; struct faultstate fs; struct vnode *vp; vm_offset_t e_end, e_start; vm_page_t m; - int ahead, behind, cluster_offset, error, locked, rv; + int ahead, alloc_req, behind, cluster_offset, error, era, faultcount; + int locked, map_generation, nera, result, rv; u_char behavior; + boolean_t wired; /* Passed by reference. */ + bool dead, growstack, hardfault, is_first_object_locked; - hardfault = 0; - growstack = TRUE; PCPU_INC(cnt.v_vm_faults); fs.vp = NULL; faultcount = 0; nera = -1; + growstack = true; + hardfault = false; RetryFault:; @@ -325,7 +324,7 @@ RetryFault:; result = vm_map_growstack(curproc, vaddr); if (result != KERN_SUCCESS) return (KERN_FAILURE); - growstack = FALSE; + growstack = false; goto RetryFault; } unlock_vp(&fs); @@ -427,7 +426,7 @@ fast_failed: vm_object_reference_locked(fs.first_object); vm_object_pip_add(fs.first_object, 1); - fs.lookup_still_valid = TRUE; + fs.lookup_still_valid = true; fs.first_m = NULL; @@ -708,7 +707,7 @@ vnode_locked: &behind, &ahead); if (rv == VM_PAGER_OK) { faultcount = behind + 1 + ahead; - hardfault++; + hardfault = true; break; /* break to PAGE HAS BEEN FOUND */ } if (rv == VM_PAGER_ERROR) @@ -836,7 +835,7 @@ vnode_locked: * dirty in the first object so that it will go out * to swap when needed. */ - is_first_object_locked = FALSE; + is_first_object_locked = false; if ( /* * Only one shadow object @@ -941,7 +940,7 @@ vnode_locked: unlock_and_deallocate(&fs); goto RetryFault; } - fs.lookup_still_valid = TRUE; + fs.lookup_still_valid = true; if (fs.map->timestamp != map_generation) { result = vm_map_lookup_locked(&fs.map, vaddr, fault_type, &fs.entry, &retry_object, &retry_pindex, &retry_prot, &wired); From owner-svn-src-all@freebsd.org Sun Nov 6 12:45:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D696C326AA; Sun, 6 Nov 2016 12:45:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F0D1F1E; Sun, 6 Nov 2016 12:45:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6CjJ7w051175; Sun, 6 Nov 2016 12:45:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6CjJfw051174; Sun, 6 Nov 2016 12:45:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611061245.uA6CjJfw051174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 6 Nov 2016 12:45:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308360 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 12:45:20 -0000 Author: kib Date: Sun Nov 6 12:45:19 2016 New Revision: 308360 URL: https://svnweb.freebsd.org/changeset/base/308360 Log: MFC r308108: Split long line instead of unindenting it. Add KASSERT() verifying that a device object with the same handle has the same ops vector. Modified: stable/11/sys/vm/device_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/device_pager.c ============================================================================== --- stable/11/sys/vm/device_pager.c Sun Nov 6 05:57:44 2016 (r308359) +++ stable/11/sys/vm/device_pager.c Sun Nov 6 12:45:19 2016 (r308360) @@ -169,7 +169,10 @@ cdev_pager_allocate(void *handle, enum o if (pindex > object->size) object->size = pindex; KASSERT(object->type == tp, - ("Inconsistent device pager type %p %d", object, tp)); + ("Inconsistent device pager type %p %d", + object, tp)); + KASSERT(object->un_pager.devp.ops == ops, + ("Inconsistent devops %p %p", object, ops)); } else { object = object1; object1 = NULL; From owner-svn-src-all@freebsd.org Sun Nov 6 12:49:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03279C32887; Sun, 6 Nov 2016 12:49:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C58B511B; Sun, 6 Nov 2016 12:49:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6CnFYV051370; Sun, 6 Nov 2016 12:49:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6CnFjp051369; Sun, 6 Nov 2016 12:49:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611061249.uA6CnFjp051369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 6 Nov 2016 12:49:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308361 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 12:49:17 -0000 Author: kib Date: Sun Nov 6 12:49:15 2016 New Revision: 308361 URL: https://svnweb.freebsd.org/changeset/base/308361 Log: MFC r308109: Remove vnode_locked label and goto. Modified: stable/11/sys/vm/vm_fault.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_fault.c ============================================================================== --- stable/11/sys/vm/vm_fault.c Sun Nov 6 12:45:19 2016 (r308360) +++ stable/11/sys/vm/vm_fault.c Sun Nov 6 12:49:15 2016 (r308361) @@ -640,10 +640,8 @@ readrest: */ unlock_map(&fs); - if (fs.object->type == OBJT_VNODE) { - vp = fs.object->handle; - if (vp == fs.vp) - goto vnode_locked; + if (fs.object->type == OBJT_VNODE && + (vp = fs.object->handle) != fs.vp) { unlock_vp(&fs); locked = VOP_ISLOCKED(vp); @@ -666,7 +664,6 @@ readrest: } fs.vp = vp; } -vnode_locked: KASSERT(fs.vp == NULL || !fs.map->system_map, ("vm_fault: vnode-backed object mapped by system map")); From owner-svn-src-all@freebsd.org Sun Nov 6 12:52:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B8ADC32A95; Sun, 6 Nov 2016 12:52:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D7BE74B; Sun, 6 Nov 2016 12:52:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6CqDAT054883; Sun, 6 Nov 2016 12:52:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6CqDQn054882; Sun, 6 Nov 2016 12:52:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611061252.uA6CqDQn054882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 6 Nov 2016 12:52:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308362 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 12:52:14 -0000 Author: kib Date: Sun Nov 6 12:52:13 2016 New Revision: 308362 URL: https://svnweb.freebsd.org/changeset/base/308362 Log: MFC r308113: Remove vm_pager_has_page() declaration. Modified: stable/11/sys/vm/vm_pager.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_pager.h ============================================================================== --- stable/11/sys/vm/vm_pager.h Sun Nov 6 12:49:15 2016 (r308361) +++ stable/11/sys/vm/vm_pager.h Sun Nov 6 12:52:13 2016 (r308362) @@ -109,7 +109,6 @@ void vm_pager_deallocate(vm_object_t); int vm_pager_get_pages(vm_object_t, vm_page_t *, int, int *, int *); int vm_pager_get_pages_async(vm_object_t, vm_page_t *, int, int *, int *, pgo_getpages_iodone_t, void *); -static __inline boolean_t vm_pager_has_page(vm_object_t, vm_pindex_t, int *, int *); void vm_pager_init(void); vm_object_t vm_pager_object_lookup(struct pagerlst *, void *); From owner-svn-src-all@freebsd.org Sun Nov 6 12:56:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A46EEC32CE9; Sun, 6 Nov 2016 12:56:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70850A12; Sun, 6 Nov 2016 12:56:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6Cu7Pr055229; Sun, 6 Nov 2016 12:56:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6Cu7NV055228; Sun, 6 Nov 2016 12:56:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611061256.uA6Cu7NV055228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 6 Nov 2016 12:56:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308363 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 12:56:08 -0000 Author: kib Date: Sun Nov 6 12:56:07 2016 New Revision: 308363 URL: https://svnweb.freebsd.org/changeset/base/308363 Log: MFC r308114: Change remained internal uses of boolean_t to bool in vm/vm_fault.c. Modified: stable/11/sys/vm/vm_fault.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_fault.c ============================================================================== --- stable/11/sys/vm/vm_fault.c Sun Nov 6 12:52:13 2016 (r308362) +++ stable/11/sys/vm/vm_fault.c Sun Nov 6 12:56:07 2016 (r308363) @@ -184,9 +184,9 @@ unlock_and_deallocate(struct faultstate static void vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_prot_t prot, - vm_prot_t fault_type, int fault_flags, boolean_t set_wd) + vm_prot_t fault_type, int fault_flags, bool set_wd) { - boolean_t need_dirty; + bool need_dirty; if (((prot & VM_PROT_WRITE) == 0 && (fault_flags & VM_FAULT_DIRTY) == 0) || @@ -397,7 +397,7 @@ RetryFault:; vm_page_unlock(m); } vm_fault_dirty(fs.entry, m, prot, fault_type, fault_flags, - FALSE); + false); VM_OBJECT_RUNLOCK(fs.first_object); if (!wired) vm_fault_prefault(&fs, vaddr, PFBAK, PFFOR); @@ -987,7 +987,7 @@ readrest: if (hardfault) fs.entry->next_read = vaddr + ptoa(ahead) + PAGE_SIZE; - vm_fault_dirty(fs.entry, fs.m, prot, fault_type, fault_flags, TRUE); + vm_fault_dirty(fs.entry, fs.m, prot, fault_type, fault_flags, true); vm_page_assert_xbusied(fs.m); /* From owner-svn-src-all@freebsd.org Sun Nov 6 13:35:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4B62C33FCF; Sun, 6 Nov 2016 13:35:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3D5C16A; Sun, 6 Nov 2016 13:35:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6DZKle071195; Sun, 6 Nov 2016 13:35:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6DZKSB071194; Sun, 6 Nov 2016 13:35:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611061335.uA6DZKSB071194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 6 Nov 2016 13:35:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308364 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 13:35:21 -0000 Author: kib Date: Sun Nov 6 13:35:20 2016 New Revision: 308364 URL: https://svnweb.freebsd.org/changeset/base/308364 Log: MFC r308109: Remove vnode_locked label and goto. Modified: stable/10/sys/vm/vm_fault.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_fault.c ============================================================================== --- stable/10/sys/vm/vm_fault.c Sun Nov 6 12:56:07 2016 (r308363) +++ stable/10/sys/vm/vm_fault.c Sun Nov 6 13:35:20 2016 (r308364) @@ -627,10 +627,8 @@ readrest: */ unlock_map(&fs); - if (fs.object->type == OBJT_VNODE) { - vp = fs.object->handle; - if (vp == fs.vp) - goto vnode_locked; + if (fs.object->type == OBJT_VNODE && + (vp = fs.object->handle) != fs.vp) { unlock_vp(&fs); locked = VOP_ISLOCKED(vp); @@ -653,7 +651,6 @@ readrest: } fs.vp = vp; } -vnode_locked: KASSERT(fs.vp == NULL || !fs.map->system_map, ("vm_fault: vnode-backed object mapped by system map")); From owner-svn-src-all@freebsd.org Sun Nov 6 13:37:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0987C320FE; Sun, 6 Nov 2016 13:37:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8FC3A324; Sun, 6 Nov 2016 13:37:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6DbXk1071346; Sun, 6 Nov 2016 13:37:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6DbXg4071345; Sun, 6 Nov 2016 13:37:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611061337.uA6DbXg4071345@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 6 Nov 2016 13:37:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308365 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 13:37:34 -0000 Author: kib Date: Sun Nov 6 13:37:33 2016 New Revision: 308365 URL: https://svnweb.freebsd.org/changeset/base/308365 Log: MFC r308113: Remove vm_pager_has_page() declaration. Modified: stable/10/sys/vm/vm_pager.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_pager.h ============================================================================== --- stable/10/sys/vm/vm_pager.h Sun Nov 6 13:35:20 2016 (r308364) +++ stable/10/sys/vm/vm_pager.h Sun Nov 6 13:37:33 2016 (r308365) @@ -103,7 +103,6 @@ vm_object_t vm_pager_allocate(objtype_t, void vm_pager_bufferinit(void); void vm_pager_deallocate(vm_object_t); static __inline int vm_pager_get_pages(vm_object_t, vm_page_t *, int, int); -static __inline boolean_t vm_pager_has_page(vm_object_t, vm_pindex_t, int *, int *); void vm_pager_init(void); vm_object_t vm_pager_object_lookup(struct pagerlst *, void *); From owner-svn-src-all@freebsd.org Sun Nov 6 13:40:05 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1ECBEC3223A; Sun, 6 Nov 2016 13:40:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E2CC76CF; Sun, 6 Nov 2016 13:40:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6De4pR071514; Sun, 6 Nov 2016 13:40:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6De4Vh071513; Sun, 6 Nov 2016 13:40:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611061340.uA6De4Vh071513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 6 Nov 2016 13:40:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308366 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 13:40:05 -0000 Author: kib Date: Sun Nov 6 13:40:03 2016 New Revision: 308366 URL: https://svnweb.freebsd.org/changeset/base/308366 Log: MFC r308114: Change remained internal uses of boolean_t to bool in vm/vm_fault.c. Modified: stable/10/sys/vm/vm_fault.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_fault.c ============================================================================== --- stable/10/sys/vm/vm_fault.c Sun Nov 6 13:37:33 2016 (r308365) +++ stable/10/sys/vm/vm_fault.c Sun Nov 6 13:40:03 2016 (r308366) @@ -184,9 +184,9 @@ unlock_and_deallocate(struct faultstate static void vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_prot_t prot, - vm_prot_t fault_type, int fault_flags, boolean_t set_wd) + vm_prot_t fault_type, int fault_flags, bool set_wd) { - boolean_t need_dirty; + bool need_dirty; if (((prot & VM_PROT_WRITE) == 0 && (fault_flags & VM_FAULT_DIRTY) == 0) || @@ -397,7 +397,7 @@ RetryFault:; vm_page_unlock(m); } vm_fault_dirty(fs.entry, m, prot, fault_type, fault_flags, - FALSE); + false); VM_OBJECT_RUNLOCK(fs.first_object); if (!wired) vm_fault_prefault(&fs, vaddr, 0, 0); @@ -982,7 +982,7 @@ readrest: if (hardfault) fs.entry->next_read = fs.pindex + faultcount - reqpage; - vm_fault_dirty(fs.entry, fs.m, prot, fault_type, fault_flags, TRUE); + vm_fault_dirty(fs.entry, fs.m, prot, fault_type, fault_flags, true); vm_page_assert_xbusied(fs.m); /* From owner-svn-src-all@freebsd.org Sun Nov 6 13:50:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6B68C3268A; Sun, 6 Nov 2016 13:50:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE98ACEE; Sun, 6 Nov 2016 13:50:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6DotkO075439; Sun, 6 Nov 2016 13:50:55 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6DotJl075438; Sun, 6 Nov 2016 13:50:55 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611061350.uA6DotJl075438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sun, 6 Nov 2016 13:50:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308368 - stable/11/sys/dev/acpi_support X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 13:50:57 -0000 Author: avg Date: Sun Nov 6 13:50:55 2016 New Revision: 308368 URL: https://svnweb.freebsd.org/changeset/base/308368 Log: MFC r307348: aibs / atk0110: add support for querying sensors via GGRP and GITM Modified: stable/11/sys/dev/acpi_support/atk0110.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/acpi_support/atk0110.c ============================================================================== --- stable/11/sys/dev/acpi_support/atk0110.c Sun Nov 6 13:50:54 2016 (r308367) +++ stable/11/sys/dev/acpi_support/atk0110.c Sun Nov 6 13:50:55 2016 (r308368) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -51,18 +52,23 @@ ACPI_SERIAL_DECL(aibs, "aibs"); #define AIBS_MORE_SENSORS #define AIBS_VERBOSE -enum aibs_type { - AIBS_VOLT, - AIBS_TEMP, - AIBS_FAN -}; +#define AIBS_GROUP_SENSORS 0x06 + +#define AIBS_SENS_TYPE(x) (((x) >> 16) & 0xff) +#define AIBS_SENS_TYPE_VOLT 2 +#define AIBS_SENS_TYPE_TEMP 3 +#define AIBS_SENS_TYPE_FAN 4 + +#define AIBS_SENS_TYPE_VOLT_NAME "volt" +#define AIBS_SENS_TYPE_VOLT_TEMP "temp" +#define AIBS_SENS_TYPE_VOLT_FAN "fan" struct aibs_sensor { ACPI_INTEGER v; ACPI_INTEGER i; ACPI_INTEGER l; ACPI_INTEGER h; - enum aibs_type t; + int t; }; struct aibs_softc { @@ -72,14 +78,23 @@ struct aibs_softc { struct aibs_sensor *sc_asens_volt; struct aibs_sensor *sc_asens_temp; struct aibs_sensor *sc_asens_fan; + struct aibs_sensor *sc_asens_all; + + struct sysctl_oid *sc_volt_sysctl; + struct sysctl_oid *sc_temp_sysctl; + struct sysctl_oid *sc_fan_sysctl; + + bool sc_ggrp_method; }; static int aibs_probe(device_t); static int aibs_attach(device_t); static int aibs_detach(device_t); static int aibs_sysctl(SYSCTL_HANDLER_ARGS); +static int aibs_sysctl_ggrp(SYSCTL_HANDLER_ARGS); -static void aibs_attach_sif(struct aibs_softc *, enum aibs_type); +static int aibs_attach_ggrp(struct aibs_softc *); +static int aibs_attach_sif(struct aibs_softc *, int); static device_method_t aibs_methods[] = { DEVMETHOD(device_probe, aibs_probe), @@ -109,54 +124,240 @@ aibs_probe(device_t dev) { if (acpi_disabled("aibs") || ACPI_ID_PROBE(device_get_parent(dev), dev, aibs_hids) == NULL) - return ENXIO; + return (ENXIO); device_set_desc(dev, "ASUSTeK AI Booster (ACPI ASOC ATK0110)"); - return 0; + return (0); } static int aibs_attach(device_t dev) { struct aibs_softc *sc = device_get_softc(dev); + int err; sc->sc_dev = dev; sc->sc_ah = acpi_get_handle(dev); - aibs_attach_sif(sc, AIBS_VOLT); - aibs_attach_sif(sc, AIBS_TEMP); - aibs_attach_sif(sc, AIBS_FAN); + sc->sc_ggrp_method = false; + err = aibs_attach_sif(sc, AIBS_SENS_TYPE_VOLT); + if (err == 0) + err = aibs_attach_sif(sc, AIBS_SENS_TYPE_TEMP); + if (err == 0) + err = aibs_attach_sif(sc, AIBS_SENS_TYPE_FAN); + + if (err == 0) + return (0); + + /* Clean up whatever was allocated earlier. */ + if (sc->sc_volt_sysctl != NULL) + sysctl_remove_oid(sc->sc_volt_sysctl, true, true); + if (sc->sc_temp_sysctl != NULL) + sysctl_remove_oid(sc->sc_temp_sysctl, true, true); + if (sc->sc_fan_sysctl != NULL) + sysctl_remove_oid(sc->sc_fan_sysctl, true, true); + aibs_detach(dev); + + sc->sc_ggrp_method = true; + err = aibs_attach_ggrp(sc); + return (err); +} + +static int +aibs_add_sensor(struct aibs_softc *sc, ACPI_OBJECT *o, + struct aibs_sensor* sensor, const char ** descr) +{ + int off; - return 0; + /* + * Packages for the old and new methods are quite + * similar except that the new package has two + * new (unknown / unused) fields after the name field. + */ + if (sc->sc_ggrp_method) + off = 4; + else + off = 2; + + if (o->Type != ACPI_TYPE_PACKAGE) { + device_printf(sc->sc_dev, + "sensor object is not a package: %i type\n", + o->Type); + return (ENXIO); + } + if (o[0].Package.Count != (off + 3) || + o->Package.Elements[0].Type != ACPI_TYPE_INTEGER || + o->Package.Elements[1].Type != ACPI_TYPE_STRING || + o->Package.Elements[off].Type != ACPI_TYPE_INTEGER || + o->Package.Elements[off + 1].Type != ACPI_TYPE_INTEGER || + o->Package.Elements[off + 2].Type != ACPI_TYPE_INTEGER) { + device_printf(sc->sc_dev, "unexpected package content\n"); + return (ENXIO); + } + + sensor->i = o->Package.Elements[0].Integer.Value; + *descr = o->Package.Elements[1].String.Pointer; + sensor->l = o->Package.Elements[off].Integer.Value; + sensor->h = o->Package.Elements[off + 1].Integer.Value; + /* For the new method the second value is a range size. */ + if (sc->sc_ggrp_method) + sensor->h += sensor->l; + sensor->t = AIBS_SENS_TYPE(sensor->i); + + switch (sensor->t) { + case AIBS_SENS_TYPE_VOLT: + case AIBS_SENS_TYPE_TEMP: + case AIBS_SENS_TYPE_FAN: + return (0); + default: + device_printf(sc->sc_dev, "unknown sensor type 0x%x", + sensor->t); + return (ENXIO); + } } static void -aibs_attach_sif(struct aibs_softc *sc, enum aibs_type st) +aibs_sensor_added(struct aibs_softc *sc, struct sysctl_oid *so, + const char *type_name, int idx, struct aibs_sensor *sensor, + const char *descr) +{ + char sysctl_name[8]; + + snprintf(sysctl_name, sizeof(sysctl_name), "%i", idx); +#ifdef AIBS_VERBOSE + device_printf(sc->sc_dev, "%c%i: 0x%08jx %20s %5jd / %5jd\n", + type_name[0], idx, + (uintmax_t)sensor->i, descr, (intmax_t)sensor->l, + (intmax_t)sensor->h); +#endif + SYSCTL_ADD_PROC(device_get_sysctl_ctx(sc->sc_dev), + SYSCTL_CHILDREN(so), idx, sysctl_name, + CTLTYPE_INT | CTLFLAG_RD, sc, (uintptr_t)sensor, + sc->sc_ggrp_method ? aibs_sysctl_ggrp : aibs_sysctl, + sensor->t == AIBS_SENS_TYPE_TEMP ? "IK" : "I", descr); +} + +static int +aibs_attach_ggrp(struct aibs_softc *sc) +{ + ACPI_STATUS s; + ACPI_BUFFER buf; + ACPI_HANDLE h; + ACPI_OBJECT id; + ACPI_OBJECT *bp; + ACPI_OBJECT_LIST arg; + int i; + int t, v, f; + int err; + int *s_idx; + const char *name; + const char *descr; + struct aibs_sensor *sensor; + struct sysctl_oid **so; + + /* First see if GITM is available. */ + s = AcpiGetHandle(sc->sc_ah, "GITM", &h); + if (ACPI_FAILURE(s)) { + if (bootverbose) + device_printf(sc->sc_dev, "GITM not found\n"); + return (ENXIO); + } + + /* + * Now call GGRP with the appropriate argument to list sensors. + * The method lists different groups of entities depending on + * the argument. + */ + id.Integer.Value = AIBS_GROUP_SENSORS; + id.Type = ACPI_TYPE_INTEGER; + arg.Count = 1; + arg.Pointer = &id; + buf.Length = ACPI_ALLOCATE_BUFFER; + buf.Pointer = NULL; + s = AcpiEvaluateObjectTyped(sc->sc_ah, "GGRP", &arg, &buf, + ACPI_TYPE_PACKAGE); + if (ACPI_FAILURE(s)) { + device_printf(sc->sc_dev, "GGRP not found\n"); + return (ENXIO); + } + + bp = buf.Pointer; + sc->sc_asens_all = malloc(sizeof(*sc->sc_asens_all) * bp->Package.Count, + M_DEVBUF, M_WAITOK | M_ZERO); + v = t = f = 0; + for (i = 0; i < bp->Package.Count; i++) { + sensor = &sc->sc_asens_all[i]; + err = aibs_add_sensor(sc, &bp->Package.Elements[i], sensor, + &descr); + if (err != 0) + continue; + + switch (sensor->t) { + case AIBS_SENS_TYPE_VOLT: + name = "volt"; + so = &sc->sc_volt_sysctl; + s_idx = &v; + break; + case AIBS_SENS_TYPE_TEMP: + name = "temp"; + so = &sc->sc_temp_sysctl; + s_idx = &t; + break; + case AIBS_SENS_TYPE_FAN: + name = "fan"; + so = &sc->sc_fan_sysctl; + s_idx = &f; + break; + default: + panic("add_sensor succeeded for unknown sensor type %d", + sensor->t); + } + + if (*so == NULL) { + /* sysctl subtree for sensors of this type */ + *so = SYSCTL_ADD_NODE(device_get_sysctl_ctx(sc->sc_dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->sc_dev)), + sensor->t, name, CTLFLAG_RD, NULL, NULL); + } + aibs_sensor_added(sc, *so, name, *s_idx, sensor, descr); + *s_idx += 1; + } + + AcpiOsFree(buf.Pointer); + return (0); +} + +static int +aibs_attach_sif(struct aibs_softc *sc, int st) { + char name[] = "?SIF"; ACPI_STATUS s; ACPI_BUFFER b; ACPI_OBJECT *bp, *o; - int i, n; const char *node; - char name[] = "?SIF"; struct aibs_sensor *as; - struct sysctl_oid *so; + struct sysctl_oid **so; + int i, n; + int err; switch (st) { - case AIBS_VOLT: + case AIBS_SENS_TYPE_VOLT: node = "volt"; name[0] = 'V'; + so = &sc->sc_volt_sysctl; break; - case AIBS_TEMP: + case AIBS_SENS_TYPE_TEMP: node = "temp"; name[0] = 'T'; + so = &sc->sc_temp_sysctl; break; - case AIBS_FAN: + case AIBS_SENS_TYPE_FAN: node = "fan"; name[0] = 'F'; + so = &sc->sc_fan_sysctl; break; default: - return; + panic("Unsupported sensor type %d", st); } b.Length = ACPI_ALLOCATE_BUFFER; @@ -164,7 +365,7 @@ aibs_attach_sif(struct aibs_softc *sc, e ACPI_TYPE_PACKAGE); if (ACPI_FAILURE(s)) { device_printf(sc->sc_dev, "%s not found\n", name); - return; + return (ENXIO); } bp = b.Pointer; @@ -172,14 +373,14 @@ aibs_attach_sif(struct aibs_softc *sc, e if (o[0].Type != ACPI_TYPE_INTEGER) { device_printf(sc->sc_dev, "%s[0]: invalid type\n", name); AcpiOsFree(b.Pointer); - return; + return (ENXIO); } n = o[0].Integer.Value; if (bp->Package.Count - 1 < n) { device_printf(sc->sc_dev, "%s: invalid package\n", name); AcpiOsFree(b.Pointer); - return; + return (ENXIO); } else if (bp->Package.Count - 1 > n) { int on = n; @@ -193,76 +394,37 @@ aibs_attach_sif(struct aibs_softc *sc, e device_printf(sc->sc_dev, "%s: no members in the package\n", name); AcpiOsFree(b.Pointer); - return; + return (ENXIO); } - as = malloc(sizeof(*as) * n, M_DEVBUF, M_NOWAIT | M_ZERO); - if (as == NULL) { - device_printf(sc->sc_dev, "%s: malloc fail\n", name); - AcpiOsFree(b.Pointer); - return; - } + as = malloc(sizeof(*as) * n, M_DEVBUF, M_WAITOK | M_ZERO); switch (st) { - case AIBS_VOLT: + case AIBS_SENS_TYPE_VOLT: sc->sc_asens_volt = as; break; - case AIBS_TEMP: + case AIBS_SENS_TYPE_TEMP: sc->sc_asens_temp = as; break; - case AIBS_FAN: + case AIBS_SENS_TYPE_FAN: sc->sc_asens_fan = as; break; } /* sysctl subtree for sensors of this type */ - so = SYSCTL_ADD_NODE(device_get_sysctl_ctx(sc->sc_dev), + *so = SYSCTL_ADD_NODE(device_get_sysctl_ctx(sc->sc_dev), SYSCTL_CHILDREN(device_get_sysctl_tree(sc->sc_dev)), st, node, CTLFLAG_RD, NULL, NULL); for (i = 0, o++; i < n; i++, o++) { - ACPI_OBJECT *oi; - char si[3]; - const char *desc; - - /* acpica5 automatically evaluates the referenced package */ - if (o[0].Type != ACPI_TYPE_PACKAGE) { - device_printf(sc->sc_dev, - "%s: %i: not a package: %i type\n", - name, i, o[0].Type); - continue; - } - oi = o[0].Package.Elements; - if (o[0].Package.Count != 5 || - oi[0].Type != ACPI_TYPE_INTEGER || - oi[1].Type != ACPI_TYPE_STRING || - oi[2].Type != ACPI_TYPE_INTEGER || - oi[3].Type != ACPI_TYPE_INTEGER || - oi[4].Type != ACPI_TYPE_INTEGER) { - device_printf(sc->sc_dev, - "%s: %i: invalid package\n", - name, i); - continue; - } - as[i].i = oi[0].Integer.Value; - desc = oi[1].String.Pointer; - as[i].l = oi[2].Integer.Value; - as[i].h = oi[3].Integer.Value; - as[i].t = st; -#ifdef AIBS_VERBOSE - device_printf(sc->sc_dev, "%c%i: " - "0x%08"PRIx64" %20s %5"PRIi64" / %5"PRIi64" " - "0x%"PRIx64"\n", - name[0], i, - (uint64_t)as[i].i, desc, (int64_t)as[i].l, - (int64_t)as[i].h, (uint64_t)oi[4].Integer.Value); -#endif - snprintf(si, sizeof(si), "%i", i); - SYSCTL_ADD_PROC(device_get_sysctl_ctx(sc->sc_dev), - SYSCTL_CHILDREN(so), i, si, CTLTYPE_INT | CTLFLAG_RD, - sc, st, aibs_sysctl, st == AIBS_TEMP ? "IK" : "I", desc); + const char *descr; + + err = aibs_add_sensor(sc, o, &as[i], &descr); + if (err == 0) + aibs_sensor_added(sc, *so, node, i, &as[i], descr); } AcpiOsFree(b.Pointer); + return (0); } static int @@ -276,7 +438,9 @@ aibs_detach(device_t dev) free(sc->sc_asens_temp, M_DEVBUF); if (sc->sc_asens_fan != NULL) free(sc->sc_asens_fan, M_DEVBUF); - return 0; + if (sc->sc_asens_all != NULL) + free(sc->sc_asens_all, M_DEVBUF); + return (0); } #ifdef AIBS_VERBOSE @@ -289,39 +453,33 @@ static int aibs_sysctl(SYSCTL_HANDLER_ARGS) { struct aibs_softc *sc = arg1; - enum aibs_type st = arg2; + struct aibs_sensor *sensor = (void *)arg2; int i = oidp->oid_number; ACPI_STATUS rs; ACPI_OBJECT p, *bp; ACPI_OBJECT_LIST mp; ACPI_BUFFER b; char *name; - struct aibs_sensor *as; ACPI_INTEGER v, l, h; int so[3]; - switch (st) { - case AIBS_VOLT: + switch (sensor->t) { + case AIBS_SENS_TYPE_VOLT: name = "RVLT"; - as = sc->sc_asens_volt; break; - case AIBS_TEMP: + case AIBS_SENS_TYPE_TEMP: name = "RTMP"; - as = sc->sc_asens_temp; break; - case AIBS_FAN: + case AIBS_SENS_TYPE_FAN: name = "RFAN"; - as = sc->sc_asens_fan; break; default: - return ENOENT; + return (ENOENT); } - if (as == NULL) - return ENOENT; - l = as[i].l; - h = as[i].h; + l = sensor->l; + h = sensor->h; p.Type = ACPI_TYPE_INTEGER; - p.Integer.Value = as[i].i; + p.Integer.Value = sensor->i; mp.Count = 1; mp.Pointer = &p; b.Length = ACPI_ALLOCATE_BUFFER; @@ -333,26 +491,91 @@ aibs_sysctl(SYSCTL_HANDLER_ARGS) "%s: %i: evaluation failed\n", name, i); ACPI_SERIAL_END(aibs); - return EIO; + return (EIO); } bp = b.Pointer; v = bp->Integer.Value; AcpiOsFree(b.Pointer); ACPI_SERIAL_END(aibs); - switch (st) { - case AIBS_VOLT: + switch (sensor->t) { + case AIBS_SENS_TYPE_VOLT: + break; + case AIBS_SENS_TYPE_TEMP: + v += 2731; + l += 2731; + h += 2731; + break; + case AIBS_SENS_TYPE_FAN: + break; + } + so[0] = v; + so[1] = l; + so[2] = h; + return (sysctl_handle_opaque(oidp, &so, sizeof(so), req)); +} + +static int +aibs_sysctl_ggrp(SYSCTL_HANDLER_ARGS) +{ + struct aibs_softc *sc = arg1; + struct aibs_sensor *sensor = (void *)arg2; + ACPI_STATUS rs; + ACPI_OBJECT p, *bp; + ACPI_OBJECT_LIST arg; + ACPI_BUFFER buf; + ACPI_INTEGER v, l, h; + int so[3]; + uint32_t *ret; + uint32_t cmd[3]; + + cmd[0] = sensor->i; + cmd[1] = 0; + cmd[2] = 0; + p.Type = ACPI_TYPE_BUFFER; + p.Buffer.Pointer = (void *)cmd; + p.Buffer.Length = sizeof(cmd); + arg.Count = 1; + arg.Pointer = &p; + buf.Pointer = NULL; + buf.Length = ACPI_ALLOCATE_BUFFER; + ACPI_SERIAL_BEGIN(aibs); + rs = AcpiEvaluateObjectTyped(sc->sc_ah, "GITM", &arg, &buf, + ACPI_TYPE_BUFFER); + ACPI_SERIAL_END(aibs); + if (ACPI_FAILURE(rs)) { + device_printf(sc->sc_dev, "GITM evaluation failed\n"); + return (EIO); + } + bp = buf.Pointer; + if (bp->Buffer.Length < 8) { + device_printf(sc->sc_dev, "GITM returned short buffer\n"); + return (EIO); + } + ret = (uint32_t *)bp->Buffer.Pointer; + if (ret[0] == 0) { + device_printf(sc->sc_dev, "GITM returned error status\n"); + return (EINVAL); + } + v = ret[1]; + AcpiOsFree(buf.Pointer); + + l = sensor->l; + h = sensor->h; + + switch (sensor->t) { + case AIBS_SENS_TYPE_VOLT: break; - case AIBS_TEMP: + case AIBS_SENS_TYPE_TEMP: v += 2731; l += 2731; h += 2731; break; - case AIBS_FAN: + case AIBS_SENS_TYPE_FAN: break; } so[0] = v; so[1] = l; so[2] = h; - return sysctl_handle_opaque(oidp, &so, sizeof(so), req); + return (sysctl_handle_opaque(oidp, &so, sizeof(so), req)); } From owner-svn-src-all@freebsd.org Sun Nov 6 13:50:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 545DAC3267E; Sun, 6 Nov 2016 13:50:55 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CB6BCE4; Sun, 6 Nov 2016 13:50:54 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6DosAh075381; Sun, 6 Nov 2016 13:50:54 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6DosHS075380; Sun, 6 Nov 2016 13:50:54 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201611061350.uA6DosHS075380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 6 Nov 2016 13:50:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308367 - stable/10/sys/dev/bwi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 13:50:55 -0000 Author: avos Date: Sun Nov 6 13:50:54 2016 New Revision: 308367 URL: https://svnweb.freebsd.org/changeset/base/308367 Log: MFC r283636: - Don't request BUS_DMA_ALLOCNOW for dma tags, that requires enormous amount of memory. - Don't request segsize of BUS_SPACE_MAXSIZE_32BIT, when maxsize is MCLBYTES. With this change bwi_attach() can succeed on i386. PR: 214235 Submitted by: scottl Modified: stable/10/sys/dev/bwi/if_bwi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/bwi/if_bwi.c ============================================================================== --- stable/10/sys/dev/bwi/if_bwi.c Sun Nov 6 13:40:03 2016 (r308366) +++ stable/10/sys/dev/bwi/if_bwi.c Sun Nov 6 13:50:54 2016 (r308367) @@ -1918,7 +1918,7 @@ bwi_dma_alloc(struct bwi_softc *sc) BUS_SPACE_MAXSIZE, /* maxsize */ BUS_SPACE_UNRESTRICTED, /* nsegments */ BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ + 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->sc_parent_dtag); if (error) { @@ -1939,7 +1939,7 @@ bwi_dma_alloc(struct bwi_softc *sc) tx_ring_sz, 1, BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, + 0, NULL, NULL, &sc->sc_txring_dtag); if (error) { @@ -1969,7 +1969,7 @@ bwi_dma_alloc(struct bwi_softc *sc) rx_ring_sz, 1, BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, + 0, NULL, NULL, &sc->sc_rxring_dtag); if (error) { @@ -2094,7 +2094,7 @@ bwi_dma_txstats_alloc(struct bwi_softc * dma_size, 1, BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, + 0, NULL, NULL, &st->stats_ring_dtag); if (error) { @@ -2142,7 +2142,7 @@ bwi_dma_txstats_alloc(struct bwi_softc * dma_size, 1, BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, + 0, NULL, NULL, &st->stats_dtag); if (error) { @@ -2224,7 +2224,7 @@ bwi_dma_mbuf_create(struct bwi_softc *sc NULL, NULL, MCLBYTES, 1, - BUS_SPACE_MAXSIZE_32BIT, + MCLBYTES, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_buf_dtag); From owner-svn-src-all@freebsd.org Sun Nov 6 13:51:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA554C3288C; Sun, 6 Nov 2016 13:51:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A58D7A1; Sun, 6 Nov 2016 13:51:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6DpoIe076150; Sun, 6 Nov 2016 13:51:50 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6DpoOW076149; Sun, 6 Nov 2016 13:51:50 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611061351.uA6DpoOW076149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sun, 6 Nov 2016 13:51:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308369 - stable/10/sys/dev/acpi_support X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 13:51:52 -0000 Author: avg Date: Sun Nov 6 13:51:50 2016 New Revision: 308369 URL: https://svnweb.freebsd.org/changeset/base/308369 Log: MFC r307348: aibs / atk0110: add support for querying sensors via GGRP and GITM Modified: stable/10/sys/dev/acpi_support/atk0110.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/acpi_support/atk0110.c ============================================================================== --- stable/10/sys/dev/acpi_support/atk0110.c Sun Nov 6 13:50:55 2016 (r308368) +++ stable/10/sys/dev/acpi_support/atk0110.c Sun Nov 6 13:51:50 2016 (r308369) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -51,18 +52,23 @@ ACPI_SERIAL_DECL(aibs, "aibs"); #define AIBS_MORE_SENSORS #define AIBS_VERBOSE -enum aibs_type { - AIBS_VOLT, - AIBS_TEMP, - AIBS_FAN -}; +#define AIBS_GROUP_SENSORS 0x06 + +#define AIBS_SENS_TYPE(x) (((x) >> 16) & 0xff) +#define AIBS_SENS_TYPE_VOLT 2 +#define AIBS_SENS_TYPE_TEMP 3 +#define AIBS_SENS_TYPE_FAN 4 + +#define AIBS_SENS_TYPE_VOLT_NAME "volt" +#define AIBS_SENS_TYPE_VOLT_TEMP "temp" +#define AIBS_SENS_TYPE_VOLT_FAN "fan" struct aibs_sensor { ACPI_INTEGER v; ACPI_INTEGER i; ACPI_INTEGER l; ACPI_INTEGER h; - enum aibs_type t; + int t; }; struct aibs_softc { @@ -72,14 +78,23 @@ struct aibs_softc { struct aibs_sensor *sc_asens_volt; struct aibs_sensor *sc_asens_temp; struct aibs_sensor *sc_asens_fan; + struct aibs_sensor *sc_asens_all; + + struct sysctl_oid *sc_volt_sysctl; + struct sysctl_oid *sc_temp_sysctl; + struct sysctl_oid *sc_fan_sysctl; + + bool sc_ggrp_method; }; static int aibs_probe(device_t); static int aibs_attach(device_t); static int aibs_detach(device_t); static int aibs_sysctl(SYSCTL_HANDLER_ARGS); +static int aibs_sysctl_ggrp(SYSCTL_HANDLER_ARGS); -static void aibs_attach_sif(struct aibs_softc *, enum aibs_type); +static int aibs_attach_ggrp(struct aibs_softc *); +static int aibs_attach_sif(struct aibs_softc *, int); static device_method_t aibs_methods[] = { DEVMETHOD(device_probe, aibs_probe), @@ -109,54 +124,240 @@ aibs_probe(device_t dev) { if (acpi_disabled("aibs") || ACPI_ID_PROBE(device_get_parent(dev), dev, aibs_hids) == NULL) - return ENXIO; + return (ENXIO); device_set_desc(dev, "ASUSTeK AI Booster (ACPI ASOC ATK0110)"); - return 0; + return (0); } static int aibs_attach(device_t dev) { struct aibs_softc *sc = device_get_softc(dev); + int err; sc->sc_dev = dev; sc->sc_ah = acpi_get_handle(dev); - aibs_attach_sif(sc, AIBS_VOLT); - aibs_attach_sif(sc, AIBS_TEMP); - aibs_attach_sif(sc, AIBS_FAN); + sc->sc_ggrp_method = false; + err = aibs_attach_sif(sc, AIBS_SENS_TYPE_VOLT); + if (err == 0) + err = aibs_attach_sif(sc, AIBS_SENS_TYPE_TEMP); + if (err == 0) + err = aibs_attach_sif(sc, AIBS_SENS_TYPE_FAN); + + if (err == 0) + return (0); + + /* Clean up whatever was allocated earlier. */ + if (sc->sc_volt_sysctl != NULL) + sysctl_remove_oid(sc->sc_volt_sysctl, true, true); + if (sc->sc_temp_sysctl != NULL) + sysctl_remove_oid(sc->sc_temp_sysctl, true, true); + if (sc->sc_fan_sysctl != NULL) + sysctl_remove_oid(sc->sc_fan_sysctl, true, true); + aibs_detach(dev); + + sc->sc_ggrp_method = true; + err = aibs_attach_ggrp(sc); + return (err); +} - return 0; +static int +aibs_add_sensor(struct aibs_softc *sc, ACPI_OBJECT *o, + struct aibs_sensor* sensor, const char ** descr) +{ + int off; + + /* + * Packages for the old and new methods are quite + * similar except that the new package has two + * new (unknown / unused) fields after the name field. + */ + if (sc->sc_ggrp_method) + off = 4; + else + off = 2; + + if (o->Type != ACPI_TYPE_PACKAGE) { + device_printf(sc->sc_dev, + "sensor object is not a package: %i type\n", + o->Type); + return (ENXIO); + } + if (o[0].Package.Count != (off + 3) || + o->Package.Elements[0].Type != ACPI_TYPE_INTEGER || + o->Package.Elements[1].Type != ACPI_TYPE_STRING || + o->Package.Elements[off].Type != ACPI_TYPE_INTEGER || + o->Package.Elements[off + 1].Type != ACPI_TYPE_INTEGER || + o->Package.Elements[off + 2].Type != ACPI_TYPE_INTEGER) { + device_printf(sc->sc_dev, "unexpected package content\n"); + return (ENXIO); + } + + sensor->i = o->Package.Elements[0].Integer.Value; + *descr = o->Package.Elements[1].String.Pointer; + sensor->l = o->Package.Elements[off].Integer.Value; + sensor->h = o->Package.Elements[off + 1].Integer.Value; + /* For the new method the second value is a range size. */ + if (sc->sc_ggrp_method) + sensor->h += sensor->l; + sensor->t = AIBS_SENS_TYPE(sensor->i); + + switch (sensor->t) { + case AIBS_SENS_TYPE_VOLT: + case AIBS_SENS_TYPE_TEMP: + case AIBS_SENS_TYPE_FAN: + return (0); + default: + device_printf(sc->sc_dev, "unknown sensor type 0x%x", + sensor->t); + return (ENXIO); + } } static void -aibs_attach_sif(struct aibs_softc *sc, enum aibs_type st) +aibs_sensor_added(struct aibs_softc *sc, struct sysctl_oid *so, + const char *type_name, int idx, struct aibs_sensor *sensor, + const char *descr) +{ + char sysctl_name[8]; + + snprintf(sysctl_name, sizeof(sysctl_name), "%i", idx); +#ifdef AIBS_VERBOSE + device_printf(sc->sc_dev, "%c%i: 0x%08jx %20s %5jd / %5jd\n", + type_name[0], idx, + (uintmax_t)sensor->i, descr, (intmax_t)sensor->l, + (intmax_t)sensor->h); +#endif + SYSCTL_ADD_PROC(device_get_sysctl_ctx(sc->sc_dev), + SYSCTL_CHILDREN(so), idx, sysctl_name, + CTLTYPE_INT | CTLFLAG_RD, sc, (uintptr_t)sensor, + sc->sc_ggrp_method ? aibs_sysctl_ggrp : aibs_sysctl, + sensor->t == AIBS_SENS_TYPE_TEMP ? "IK" : "I", descr); +} + +static int +aibs_attach_ggrp(struct aibs_softc *sc) +{ + ACPI_STATUS s; + ACPI_BUFFER buf; + ACPI_HANDLE h; + ACPI_OBJECT id; + ACPI_OBJECT *bp; + ACPI_OBJECT_LIST arg; + int i; + int t, v, f; + int err; + int *s_idx; + const char *name; + const char *descr; + struct aibs_sensor *sensor; + struct sysctl_oid **so; + + /* First see if GITM is available. */ + s = AcpiGetHandle(sc->sc_ah, "GITM", &h); + if (ACPI_FAILURE(s)) { + if (bootverbose) + device_printf(sc->sc_dev, "GITM not found\n"); + return (ENXIO); + } + + /* + * Now call GGRP with the appropriate argument to list sensors. + * The method lists different groups of entities depending on + * the argument. + */ + id.Integer.Value = AIBS_GROUP_SENSORS; + id.Type = ACPI_TYPE_INTEGER; + arg.Count = 1; + arg.Pointer = &id; + buf.Length = ACPI_ALLOCATE_BUFFER; + buf.Pointer = NULL; + s = AcpiEvaluateObjectTyped(sc->sc_ah, "GGRP", &arg, &buf, + ACPI_TYPE_PACKAGE); + if (ACPI_FAILURE(s)) { + device_printf(sc->sc_dev, "GGRP not found\n"); + return (ENXIO); + } + + bp = buf.Pointer; + sc->sc_asens_all = malloc(sizeof(*sc->sc_asens_all) * bp->Package.Count, + M_DEVBUF, M_WAITOK | M_ZERO); + v = t = f = 0; + for (i = 0; i < bp->Package.Count; i++) { + sensor = &sc->sc_asens_all[i]; + err = aibs_add_sensor(sc, &bp->Package.Elements[i], sensor, + &descr); + if (err != 0) + continue; + + switch (sensor->t) { + case AIBS_SENS_TYPE_VOLT: + name = "volt"; + so = &sc->sc_volt_sysctl; + s_idx = &v; + break; + case AIBS_SENS_TYPE_TEMP: + name = "temp"; + so = &sc->sc_temp_sysctl; + s_idx = &t; + break; + case AIBS_SENS_TYPE_FAN: + name = "fan"; + so = &sc->sc_fan_sysctl; + s_idx = &f; + break; + default: + panic("add_sensor succeeded for unknown sensor type %d", + sensor->t); + } + + if (*so == NULL) { + /* sysctl subtree for sensors of this type */ + *so = SYSCTL_ADD_NODE(device_get_sysctl_ctx(sc->sc_dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->sc_dev)), + sensor->t, name, CTLFLAG_RD, NULL, NULL); + } + aibs_sensor_added(sc, *so, name, *s_idx, sensor, descr); + *s_idx += 1; + } + + AcpiOsFree(buf.Pointer); + return (0); +} + +static int +aibs_attach_sif(struct aibs_softc *sc, int st) { + char name[] = "?SIF"; ACPI_STATUS s; ACPI_BUFFER b; ACPI_OBJECT *bp, *o; - int i, n; const char *node; - char name[] = "?SIF"; struct aibs_sensor *as; - struct sysctl_oid *so; + struct sysctl_oid **so; + int i, n; + int err; switch (st) { - case AIBS_VOLT: + case AIBS_SENS_TYPE_VOLT: node = "volt"; name[0] = 'V'; + so = &sc->sc_volt_sysctl; break; - case AIBS_TEMP: + case AIBS_SENS_TYPE_TEMP: node = "temp"; name[0] = 'T'; + so = &sc->sc_temp_sysctl; break; - case AIBS_FAN: + case AIBS_SENS_TYPE_FAN: node = "fan"; name[0] = 'F'; + so = &sc->sc_fan_sysctl; break; default: - return; + panic("Unsupported sensor type %d", st); } b.Length = ACPI_ALLOCATE_BUFFER; @@ -164,7 +365,7 @@ aibs_attach_sif(struct aibs_softc *sc, e ACPI_TYPE_PACKAGE); if (ACPI_FAILURE(s)) { device_printf(sc->sc_dev, "%s not found\n", name); - return; + return (ENXIO); } bp = b.Pointer; @@ -172,14 +373,14 @@ aibs_attach_sif(struct aibs_softc *sc, e if (o[0].Type != ACPI_TYPE_INTEGER) { device_printf(sc->sc_dev, "%s[0]: invalid type\n", name); AcpiOsFree(b.Pointer); - return; + return (ENXIO); } n = o[0].Integer.Value; if (bp->Package.Count - 1 < n) { device_printf(sc->sc_dev, "%s: invalid package\n", name); AcpiOsFree(b.Pointer); - return; + return (ENXIO); } else if (bp->Package.Count - 1 > n) { int on = n; @@ -193,76 +394,37 @@ aibs_attach_sif(struct aibs_softc *sc, e device_printf(sc->sc_dev, "%s: no members in the package\n", name); AcpiOsFree(b.Pointer); - return; + return (ENXIO); } - as = malloc(sizeof(*as) * n, M_DEVBUF, M_NOWAIT | M_ZERO); - if (as == NULL) { - device_printf(sc->sc_dev, "%s: malloc fail\n", name); - AcpiOsFree(b.Pointer); - return; - } + as = malloc(sizeof(*as) * n, M_DEVBUF, M_WAITOK | M_ZERO); switch (st) { - case AIBS_VOLT: + case AIBS_SENS_TYPE_VOLT: sc->sc_asens_volt = as; break; - case AIBS_TEMP: + case AIBS_SENS_TYPE_TEMP: sc->sc_asens_temp = as; break; - case AIBS_FAN: + case AIBS_SENS_TYPE_FAN: sc->sc_asens_fan = as; break; } /* sysctl subtree for sensors of this type */ - so = SYSCTL_ADD_NODE(device_get_sysctl_ctx(sc->sc_dev), + *so = SYSCTL_ADD_NODE(device_get_sysctl_ctx(sc->sc_dev), SYSCTL_CHILDREN(device_get_sysctl_tree(sc->sc_dev)), st, node, CTLFLAG_RD, NULL, NULL); for (i = 0, o++; i < n; i++, o++) { - ACPI_OBJECT *oi; - char si[3]; - const char *desc; - - /* acpica5 automatically evaluates the referenced package */ - if (o[0].Type != ACPI_TYPE_PACKAGE) { - device_printf(sc->sc_dev, - "%s: %i: not a package: %i type\n", - name, i, o[0].Type); - continue; - } - oi = o[0].Package.Elements; - if (o[0].Package.Count != 5 || - oi[0].Type != ACPI_TYPE_INTEGER || - oi[1].Type != ACPI_TYPE_STRING || - oi[2].Type != ACPI_TYPE_INTEGER || - oi[3].Type != ACPI_TYPE_INTEGER || - oi[4].Type != ACPI_TYPE_INTEGER) { - device_printf(sc->sc_dev, - "%s: %i: invalid package\n", - name, i); - continue; - } - as[i].i = oi[0].Integer.Value; - desc = oi[1].String.Pointer; - as[i].l = oi[2].Integer.Value; - as[i].h = oi[3].Integer.Value; - as[i].t = st; -#ifdef AIBS_VERBOSE - device_printf(sc->sc_dev, "%c%i: " - "0x%08"PRIx64" %20s %5"PRIi64" / %5"PRIi64" " - "0x%"PRIx64"\n", - name[0], i, - (uint64_t)as[i].i, desc, (int64_t)as[i].l, - (int64_t)as[i].h, (uint64_t)oi[4].Integer.Value); -#endif - snprintf(si, sizeof(si), "%i", i); - SYSCTL_ADD_PROC(device_get_sysctl_ctx(sc->sc_dev), - SYSCTL_CHILDREN(so), i, si, CTLTYPE_INT | CTLFLAG_RD, - sc, st, aibs_sysctl, st == AIBS_TEMP ? "IK" : "I", desc); + const char *descr; + + err = aibs_add_sensor(sc, o, &as[i], &descr); + if (err == 0) + aibs_sensor_added(sc, *so, node, i, &as[i], descr); } AcpiOsFree(b.Pointer); + return (0); } static int @@ -276,7 +438,9 @@ aibs_detach(device_t dev) free(sc->sc_asens_temp, M_DEVBUF); if (sc->sc_asens_fan != NULL) free(sc->sc_asens_fan, M_DEVBUF); - return 0; + if (sc->sc_asens_all != NULL) + free(sc->sc_asens_all, M_DEVBUF); + return (0); } #ifdef AIBS_VERBOSE @@ -289,39 +453,33 @@ static int aibs_sysctl(SYSCTL_HANDLER_ARGS) { struct aibs_softc *sc = arg1; - enum aibs_type st = arg2; + struct aibs_sensor *sensor = (void *)arg2; int i = oidp->oid_number; ACPI_STATUS rs; ACPI_OBJECT p, *bp; ACPI_OBJECT_LIST mp; ACPI_BUFFER b; char *name; - struct aibs_sensor *as; ACPI_INTEGER v, l, h; int so[3]; - switch (st) { - case AIBS_VOLT: + switch (sensor->t) { + case AIBS_SENS_TYPE_VOLT: name = "RVLT"; - as = sc->sc_asens_volt; break; - case AIBS_TEMP: + case AIBS_SENS_TYPE_TEMP: name = "RTMP"; - as = sc->sc_asens_temp; break; - case AIBS_FAN: + case AIBS_SENS_TYPE_FAN: name = "RFAN"; - as = sc->sc_asens_fan; break; default: - return ENOENT; + return (ENOENT); } - if (as == NULL) - return ENOENT; - l = as[i].l; - h = as[i].h; + l = sensor->l; + h = sensor->h; p.Type = ACPI_TYPE_INTEGER; - p.Integer.Value = as[i].i; + p.Integer.Value = sensor->i; mp.Count = 1; mp.Pointer = &p; b.Length = ACPI_ALLOCATE_BUFFER; @@ -333,26 +491,91 @@ aibs_sysctl(SYSCTL_HANDLER_ARGS) "%s: %i: evaluation failed\n", name, i); ACPI_SERIAL_END(aibs); - return EIO; + return (EIO); } bp = b.Pointer; v = bp->Integer.Value; AcpiOsFree(b.Pointer); ACPI_SERIAL_END(aibs); - switch (st) { - case AIBS_VOLT: + switch (sensor->t) { + case AIBS_SENS_TYPE_VOLT: break; - case AIBS_TEMP: + case AIBS_SENS_TYPE_TEMP: v += 2732; l += 2732; h += 2732; break; - case AIBS_FAN: + case AIBS_SENS_TYPE_FAN: + break; + } + so[0] = v; + so[1] = l; + so[2] = h; + return (sysctl_handle_opaque(oidp, &so, sizeof(so), req)); +} + +static int +aibs_sysctl_ggrp(SYSCTL_HANDLER_ARGS) +{ + struct aibs_softc *sc = arg1; + struct aibs_sensor *sensor = (void *)arg2; + ACPI_STATUS rs; + ACPI_OBJECT p, *bp; + ACPI_OBJECT_LIST arg; + ACPI_BUFFER buf; + ACPI_INTEGER v, l, h; + int so[3]; + uint32_t *ret; + uint32_t cmd[3]; + + cmd[0] = sensor->i; + cmd[1] = 0; + cmd[2] = 0; + p.Type = ACPI_TYPE_BUFFER; + p.Buffer.Pointer = (void *)cmd; + p.Buffer.Length = sizeof(cmd); + arg.Count = 1; + arg.Pointer = &p; + buf.Pointer = NULL; + buf.Length = ACPI_ALLOCATE_BUFFER; + ACPI_SERIAL_BEGIN(aibs); + rs = AcpiEvaluateObjectTyped(sc->sc_ah, "GITM", &arg, &buf, + ACPI_TYPE_BUFFER); + ACPI_SERIAL_END(aibs); + if (ACPI_FAILURE(rs)) { + device_printf(sc->sc_dev, "GITM evaluation failed\n"); + return (EIO); + } + bp = buf.Pointer; + if (bp->Buffer.Length < 8) { + device_printf(sc->sc_dev, "GITM returned short buffer\n"); + return (EIO); + } + ret = (uint32_t *)bp->Buffer.Pointer; + if (ret[0] == 0) { + device_printf(sc->sc_dev, "GITM returned error status\n"); + return (EINVAL); + } + v = ret[1]; + AcpiOsFree(buf.Pointer); + + l = sensor->l; + h = sensor->h; + + switch (sensor->t) { + case AIBS_SENS_TYPE_VOLT: + break; + case AIBS_SENS_TYPE_TEMP: + v += 2731; + l += 2731; + h += 2731; + break; + case AIBS_SENS_TYPE_FAN: break; } so[0] = v; so[1] = l; so[2] = h; - return sysctl_handle_opaque(oidp, &so, sizeof(so), req); + return (sysctl_handle_opaque(oidp, &so, sizeof(so), req)); } From owner-svn-src-all@freebsd.org Sun Nov 6 13:53:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F5FAC3299C; Sun, 6 Nov 2016 13:53:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26B8B2AA; Sun, 6 Nov 2016 13:53:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6Drpee079115; Sun, 6 Nov 2016 13:53:51 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6DroI3079111; Sun, 6 Nov 2016 13:53:50 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611061353.uA6DroI3079111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sun, 6 Nov 2016 13:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308370 - in stable/11: share/man/man4 sys/conf sys/dev/jedec_ts sys/modules/i2c sys/modules/i2c/jedec_ts X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 13:53:52 -0000 Author: avg Date: Sun Nov 6 13:53:50 2016 New Revision: 308370 URL: https://svnweb.freebsd.org/changeset/base/308370 Log: MFC r307768: jedec_ts: a driver for thermal sensors on memory modules Added: stable/11/share/man/man4/jedec_ts.4 - copied unchanged from r307768, head/share/man/man4/jedec_ts.4 stable/11/sys/dev/jedec_ts/ - copied from r307768, head/sys/dev/jedec_ts/ stable/11/sys/modules/i2c/jedec_ts/ - copied from r307768, head/sys/modules/i2c/jedec_ts/ Modified: stable/11/sys/conf/NOTES stable/11/sys/conf/files stable/11/sys/modules/i2c/Makefile Directory Properties: stable/11/ (props changed) Copied: stable/11/share/man/man4/jedec_ts.4 (from r307768, head/share/man/man4/jedec_ts.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/share/man/man4/jedec_ts.4 Sun Nov 6 13:53:50 2016 (r308370, copy of r307768, head/share/man/man4/jedec_ts.4) @@ -0,0 +1,130 @@ +.\" +.\" Copyright (c) 2016 Andriy Gapon +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 13, 2016 +.Dt JEDEC_TS 4 +.Os +.Sh NAME +.Nm jedec_ts +.Nd driver for temperature sensors on memory modules +.Sh SYNOPSIS +.Bd -ragged -offset indent +.Cd "device jedec_ts" +.Cd "device smbus" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +jedec_ts_load="YES" +.Ed +.Pp +In +.Pa /boot/device.hints : +.Bd -literal -offset indent +.Cd hint.jedec_ts.0.at="smbus0" +.Cd hint.jedec_ts.0.addr="0x30" +.Cd hint.jedec_ts.1.at="smbus0" +.Cd hint.jedec_ts.1.addr="0x32" +.Cd hint.jedec_ts.2.at="smbus0" +.Cd hint.jedec_ts.2.addr="0x34" +.Cd hint.jedec_ts.3.at="smbus0" +.Cd hint.jedec_ts.3.addr="0x36" +.Cd hint.jedec_ts.4.at="smbus0" +.Cd hint.jedec_ts.4.addr="0x38" +.Cd hint.jedec_ts.5.at="smbus0" +.Cd hint.jedec_ts.5.addr="0x3A" +.Cd hint.jedec_ts.6.at="smbus0" +.Cd hint.jedec_ts.6.addr="0x3C" +.Cd hint.jedec_ts.7.at="smbus0" +.Cd hint.jedec_ts.7.addr="0x3E" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides access to sensor data over the +.Xr smbus 4 . +The driver supports temperature sensors on memory modules that conform +to JEDEC Standard 21-C, TSE2002 Specification. +.Pp +The access to +.Nm +data is made via the +.Xr sysctl 8 +interface: +.Bl -tag -width "dev.jedec_ts.%d.temp" +.It Va dev.jedec_ts.%d.temp +read-only value of the current temperature read by the sensor. +.El +.Pp +On a system using +.Xr device.hints 5 , +these values are configurable for +.Nm : +.Bl -tag -width "hint.jedec_ts.%d.addr" +.It Va hint.jedec_ts.%d.at +target +.Xr smbus 4 . +.It Va hint.jedec_ts.%d.addr +.Nm +SMBus address on the +.Xr smbus 4 . +.El +.Pp +.Nm +temperature sensors can be wired to eight different addresses, +allowing up to eight sensors on the same +.Xr smbus 4 . +.Pp +If the sensors are on an I2C bus behind an +.Xr iicbus 4 +controller, then the +.Xr iicsmb 4 +bridge driver can be used to attach the +.Xr smbus 4 . +.Sh EXAMPLES +.Ss Sensor read out for two memory modules: +.Bd -literal +dev.jedec_ts.0.temp: 40.2500C +dev.jedec_ts.1.temp: 40.7500C +.Ed +.Sh SEE ALSO +.Xr iicbus 4 , +.Xr iicsmb 4 , +.Xr smbus 4 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver and this manual page were written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . Modified: stable/11/sys/conf/NOTES ============================================================================== --- stable/11/sys/conf/NOTES Sun Nov 6 13:51:50 2016 (r308369) +++ stable/11/sys/conf/NOTES Sun Nov 6 13:53:50 2016 (r308370) @@ -2534,7 +2534,12 @@ device ismt device smb +# SMBus peripheral devices # +# jedec_ts Temperature Sensor compliant with JEDEC Standard 21-C +# +device jedec_ts + # I2C Bus # # Philips i2c bus support is provided by the `iicbus' device. Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Sun Nov 6 13:51:50 2016 (r308369) +++ stable/11/sys/conf/files Sun Nov 6 13:53:50 2016 (r308370) @@ -2017,6 +2017,7 @@ dev/ixgbe/ixgbe_dcb_82598.c optional ix compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_dcb_82599.c optional ix inet | ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" +dev/jedec_ts/jedec_ts.c optional jedec_ts smbus dev/jme/if_jme.c optional jme pci dev/joy/joy.c optional joy dev/joy/joy_isa.c optional joy isa Modified: stable/11/sys/modules/i2c/Makefile ============================================================================== --- stable/11/sys/modules/i2c/Makefile Sun Nov 6 13:51:50 2016 (r308369) +++ stable/11/sys/modules/i2c/Makefile Sun Nov 6 13:53:50 2016 (r308370) @@ -1,6 +1,6 @@ # $FreeBSD$ SUBDIR = -SUBDIR += controllers if_ic smbus iicbus iicbb iicsmb iic cyapa smb isl +SUBDIR += controllers if_ic smbus iicbus iicbb iicsmb iic cyapa smb isl jedec_ts .include From owner-svn-src-all@freebsd.org Sun Nov 6 13:56:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3CE0C32B7B; Sun, 6 Nov 2016 13:56:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBC8A696; Sun, 6 Nov 2016 13:56:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6DuZ2n079299; Sun, 6 Nov 2016 13:56:35 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6DuYcO079294; Sun, 6 Nov 2016 13:56:34 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611061356.uA6DuYcO079294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sun, 6 Nov 2016 13:56:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308371 - in stable/10: share/man/man4 sys/conf sys/dev/jedec_ts sys/modules/i2c sys/modules/i2c/jedec_ts X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 13:56:36 -0000 Author: avg Date: Sun Nov 6 13:56:34 2016 New Revision: 308371 URL: https://svnweb.freebsd.org/changeset/base/308371 Log: MFC r307768: jedec_ts: a driver for thermal sensors on memory modules Added: stable/10/share/man/man4/jedec_ts.4 - copied unchanged from r307768, head/share/man/man4/jedec_ts.4 stable/10/sys/dev/jedec_ts/ - copied from r307768, head/sys/dev/jedec_ts/ stable/10/sys/modules/i2c/jedec_ts/ - copied from r307768, head/sys/modules/i2c/jedec_ts/ Modified: stable/10/sys/conf/NOTES stable/10/sys/conf/files stable/10/sys/modules/i2c/Makefile Directory Properties: stable/10/ (props changed) Copied: stable/10/share/man/man4/jedec_ts.4 (from r307768, head/share/man/man4/jedec_ts.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/share/man/man4/jedec_ts.4 Sun Nov 6 13:56:34 2016 (r308371, copy of r307768, head/share/man/man4/jedec_ts.4) @@ -0,0 +1,130 @@ +.\" +.\" Copyright (c) 2016 Andriy Gapon +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 13, 2016 +.Dt JEDEC_TS 4 +.Os +.Sh NAME +.Nm jedec_ts +.Nd driver for temperature sensors on memory modules +.Sh SYNOPSIS +.Bd -ragged -offset indent +.Cd "device jedec_ts" +.Cd "device smbus" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +jedec_ts_load="YES" +.Ed +.Pp +In +.Pa /boot/device.hints : +.Bd -literal -offset indent +.Cd hint.jedec_ts.0.at="smbus0" +.Cd hint.jedec_ts.0.addr="0x30" +.Cd hint.jedec_ts.1.at="smbus0" +.Cd hint.jedec_ts.1.addr="0x32" +.Cd hint.jedec_ts.2.at="smbus0" +.Cd hint.jedec_ts.2.addr="0x34" +.Cd hint.jedec_ts.3.at="smbus0" +.Cd hint.jedec_ts.3.addr="0x36" +.Cd hint.jedec_ts.4.at="smbus0" +.Cd hint.jedec_ts.4.addr="0x38" +.Cd hint.jedec_ts.5.at="smbus0" +.Cd hint.jedec_ts.5.addr="0x3A" +.Cd hint.jedec_ts.6.at="smbus0" +.Cd hint.jedec_ts.6.addr="0x3C" +.Cd hint.jedec_ts.7.at="smbus0" +.Cd hint.jedec_ts.7.addr="0x3E" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides access to sensor data over the +.Xr smbus 4 . +The driver supports temperature sensors on memory modules that conform +to JEDEC Standard 21-C, TSE2002 Specification. +.Pp +The access to +.Nm +data is made via the +.Xr sysctl 8 +interface: +.Bl -tag -width "dev.jedec_ts.%d.temp" +.It Va dev.jedec_ts.%d.temp +read-only value of the current temperature read by the sensor. +.El +.Pp +On a system using +.Xr device.hints 5 , +these values are configurable for +.Nm : +.Bl -tag -width "hint.jedec_ts.%d.addr" +.It Va hint.jedec_ts.%d.at +target +.Xr smbus 4 . +.It Va hint.jedec_ts.%d.addr +.Nm +SMBus address on the +.Xr smbus 4 . +.El +.Pp +.Nm +temperature sensors can be wired to eight different addresses, +allowing up to eight sensors on the same +.Xr smbus 4 . +.Pp +If the sensors are on an I2C bus behind an +.Xr iicbus 4 +controller, then the +.Xr iicsmb 4 +bridge driver can be used to attach the +.Xr smbus 4 . +.Sh EXAMPLES +.Ss Sensor read out for two memory modules: +.Bd -literal +dev.jedec_ts.0.temp: 40.2500C +dev.jedec_ts.1.temp: 40.7500C +.Ed +.Sh SEE ALSO +.Xr iicbus 4 , +.Xr iicsmb 4 , +.Xr smbus 4 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver and this manual page were written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . Modified: stable/10/sys/conf/NOTES ============================================================================== --- stable/10/sys/conf/NOTES Sun Nov 6 13:53:50 2016 (r308370) +++ stable/10/sys/conf/NOTES Sun Nov 6 13:56:34 2016 (r308371) @@ -2515,7 +2515,12 @@ device ismt device smb +# SMBus peripheral devices # +# jedec_ts Temperature Sensor compliant with JEDEC Standard 21-C +# +device jedec_ts + # I2C Bus # # Philips i2c bus support is provided by the `iicbus' device. Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Sun Nov 6 13:53:50 2016 (r308370) +++ stable/10/sys/conf/files Sun Nov 6 13:56:34 2016 (r308371) @@ -1782,6 +1782,7 @@ dev/ixl/i40e_nvm.c optional ixl ixlv in compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/i40e_adminq.c optional ixl ixlv inet \ compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/jedec_ts/jedec_ts.c optional jedec_ts smbus dev/jme/if_jme.c optional jme pci dev/joy/joy.c optional joy dev/joy/joy_isa.c optional joy isa Modified: stable/10/sys/modules/i2c/Makefile ============================================================================== --- stable/10/sys/modules/i2c/Makefile Sun Nov 6 13:53:50 2016 (r308370) +++ stable/10/sys/modules/i2c/Makefile Sun Nov 6 13:56:34 2016 (r308371) @@ -1,6 +1,6 @@ # $FreeBSD$ SUBDIR = -SUBDIR += controllers if_ic smbus iicbus iicbb iicsmb iic smb +SUBDIR += controllers if_ic smbus iicbus iicbb iicsmb iic smb jedec_ts .include From owner-svn-src-all@freebsd.org Sun Nov 6 14:25:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB100C33919; Sun, 6 Nov 2016 14:25:53 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92AF1772; Sun, 6 Nov 2016 14:25:53 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6EPq9J090928; Sun, 6 Nov 2016 14:25:52 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6EPqnH090927; Sun, 6 Nov 2016 14:25:52 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201611061425.uA6EPqnH090927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 6 Nov 2016 14:25:52 +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: r308372 - stable/9/sys/dev/bwi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 14:25:54 -0000 Author: avos Date: Sun Nov 6 14:25:52 2016 New Revision: 308372 URL: https://svnweb.freebsd.org/changeset/base/308372 Log: MFC r283636: - Don't request BUS_DMA_ALLOCNOW for dma tags, that requires enormous amount of memory. - Don't request segsize of BUS_SPACE_MAXSIZE_32BIT, when maxsize is MCLBYTES. With this change bwi_attach() can succeed on i386. PR: 214235 Submitted by: scottl Modified: stable/9/sys/dev/bwi/if_bwi.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/bwi/if_bwi.c ============================================================================== --- stable/9/sys/dev/bwi/if_bwi.c Sun Nov 6 13:56:34 2016 (r308371) +++ stable/9/sys/dev/bwi/if_bwi.c Sun Nov 6 14:25:52 2016 (r308372) @@ -1917,7 +1917,7 @@ bwi_dma_alloc(struct bwi_softc *sc) BUS_SPACE_MAXSIZE, /* maxsize */ BUS_SPACE_UNRESTRICTED, /* nsegments */ BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ + 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->sc_parent_dtag); if (error) { @@ -1938,7 +1938,7 @@ bwi_dma_alloc(struct bwi_softc *sc) tx_ring_sz, 1, BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, + 0, NULL, NULL, &sc->sc_txring_dtag); if (error) { @@ -1968,7 +1968,7 @@ bwi_dma_alloc(struct bwi_softc *sc) rx_ring_sz, 1, BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, + 0, NULL, NULL, &sc->sc_rxring_dtag); if (error) { @@ -2093,7 +2093,7 @@ bwi_dma_txstats_alloc(struct bwi_softc * dma_size, 1, BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, + 0, NULL, NULL, &st->stats_ring_dtag); if (error) { @@ -2141,7 +2141,7 @@ bwi_dma_txstats_alloc(struct bwi_softc * dma_size, 1, BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, + 0, NULL, NULL, &st->stats_dtag); if (error) { @@ -2223,7 +2223,7 @@ bwi_dma_mbuf_create(struct bwi_softc *sc NULL, NULL, MCLBYTES, 1, - BUS_SPACE_MAXSIZE_32BIT, + MCLBYTES, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_buf_dtag); From owner-svn-src-all@freebsd.org Sun Nov 6 15:12:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77C2CC322F8; Sun, 6 Nov 2016 15:12:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52FE97FC; Sun, 6 Nov 2016 15:12:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6FC5kB009681; Sun, 6 Nov 2016 15:12:05 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6FC5ik009678; Sun, 6 Nov 2016 15:12:05 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201611061512.uA6FC5ik009678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 6 Nov 2016 15:12:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308373 - in stable/11/sys/dev: ofw uart X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 15:12:06 -0000 Author: jhibbits Date: Sun Nov 6 15:12:05 2016 New Revision: 308373 URL: https://svnweb.freebsd.org/changeset/base/308373 Log: MFC r304970: Check all compatible strings on uart devices in powerpc Summary: Some device trees put "fsl,ns16650" first in the compatible list. This causes the probe code to choke, even though the device is compatible with ns16650, and has it listed later in the tree. Reviewed by: nwhitehorn Differential Revision: https://reviews.freebsd.org/D7676 Modified: stable/11/sys/dev/ofw/ofw_bus_subr.c stable/11/sys/dev/ofw/ofw_bus_subr.h stable/11/sys/dev/uart/uart_cpu_powerpc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ofw/ofw_bus_subr.c ============================================================================== --- stable/11/sys/dev/ofw/ofw_bus_subr.c Sun Nov 6 14:25:52 2016 (r308372) +++ stable/11/sys/dev/ofw/ofw_bus_subr.c Sun Nov 6 15:12:05 2016 (r308373) @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$"); #include "ofw_bus_if.h" +#define OFW_COMPAT_LEN 255 + int ofw_bus_gen_setup_devinfo(struct ofw_bus_devinfo *obd, phandle_t node) { @@ -178,7 +180,8 @@ ofw_bus_status_okay(device_t dev) } static int -ofw_bus_node_is_compatible(const char *compat, int len, const char *onecompat) +ofw_bus_node_is_compatible_int(const char *compat, int len, + const char *onecompat) { int onelen, l, ret; @@ -203,6 +206,25 @@ ofw_bus_node_is_compatible(const char *c } int +ofw_bus_node_is_compatible(phandle_t node, const char *compatstr) +{ + char compat[OFW_COMPAT_LEN]; + int len, rv; + + if ((len = OF_getproplen(node, "compatible")) <= 0) + return (0); + + bzero(compat, OFW_COMPAT_LEN); + + if (OF_getprop(node, "compatible", compat, OFW_COMPAT_LEN) < 0) + return (0); + + rv = ofw_bus_node_is_compatible_int(compat, len, compatstr); + + return (rv); +} + +int ofw_bus_is_compatible(device_t dev, const char *onecompat) { phandle_t node; @@ -219,7 +241,7 @@ ofw_bus_is_compatible(device_t dev, cons if ((len = OF_getproplen(node, "compatible")) <= 0) return (0); - return (ofw_bus_node_is_compatible(compat, len, onecompat)); + return (ofw_bus_node_is_compatible_int(compat, len, onecompat)); } int @@ -689,7 +711,7 @@ ofw_bus_find_compatible(phandle_t node, for (child = OF_child(node); child != 0; child = OF_peer(child)) { len = OF_getprop_alloc(child, "compatible", 1, &compat); if (len >= 0) { - ret = ofw_bus_node_is_compatible(compat, len, + ret = ofw_bus_node_is_compatible_int(compat, len, onecompat); free(compat, M_OFWPROP); if (ret != 0) Modified: stable/11/sys/dev/ofw/ofw_bus_subr.h ============================================================================== --- stable/11/sys/dev/ofw/ofw_bus_subr.h Sun Nov 6 14:25:52 2016 (r308372) +++ stable/11/sys/dev/ofw/ofw_bus_subr.h Sun Nov 6 15:12:05 2016 (r308373) @@ -107,6 +107,7 @@ phandle_t ofw_bus_find_iparent(phandle_t /* Helper routine for checking compat prop */ int ofw_bus_is_compatible(device_t, const char *); int ofw_bus_is_compatible_strict(device_t, const char *); +int ofw_bus_node_is_compatible(phandle_t, const char *); /* * Helper routine to search a list of compat properties. The table is Modified: stable/11/sys/dev/uart/uart_cpu_powerpc.c ============================================================================== --- stable/11/sys/dev/uart/uart_cpu_powerpc.c Sun Nov 6 14:25:52 2016 (r308372) +++ stable/11/sys/dev/uart/uart_cpu_powerpc.c Sun Nov 6 15:12:05 2016 (r308373) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -163,14 +164,13 @@ uart_cpu_getdev(int devtype, struct uart return (ENXIO); if (strcmp(buf, "serial") != 0) return (ENXIO); - if (OF_getprop(input, "compatible", buf, sizeof(buf)) == -1) - return (ENXIO); - if (strncmp(buf, "chrp,es", 7) == 0) { + if (ofw_bus_node_is_compatible(input, "chrp,es")) { class = &uart_z8530_class; di->bas.regshft = 4; di->bas.chan = 1; - } else if (strcmp(buf,"ns16550") == 0 || strcmp(buf,"ns8250") == 0) { + } else if (ofw_bus_node_is_compatible(input,"ns16550") || + ofw_bus_node_is_compatible(input,"ns8250")) { class = &uart_ns8250_class; di->bas.regshft = 0; di->bas.chan = 0; From owner-svn-src-all@freebsd.org Sun Nov 6 15:25:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75A52C32938; Sun, 6 Nov 2016 15:25:47 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C593FD1; Sun, 6 Nov 2016 15:25:47 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6FPkb3014414; Sun, 6 Nov 2016 15:25:46 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6FPkm7014413; Sun, 6 Nov 2016 15:25:46 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201611061525.uA6FPkm7014413@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 6 Nov 2016 15:25:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308374 - stable/11/sys/arm/nvidia/tegra124 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 15:25:47 -0000 Author: mmel Date: Sun Nov 6 15:25:46 2016 New Revision: 308374 URL: https://svnweb.freebsd.org/changeset/base/308374 Log: MFC r306551,r307557: r306551: TEGRA: Fix bindings for cpufreq and coretemp drivers, it was broken in r306477. Correct a description for coretemp driver. r307557: TEGRA: Attach cpufreq and coretemp drivers only on tegra124 SoC. It's needed by GENERIC kernel. Modified: stable/11/sys/arm/nvidia/tegra124/tegra124_coretemp.c stable/11/sys/arm/nvidia/tegra124/tegra124_cpufreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/nvidia/tegra124/tegra124_coretemp.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra124/tegra124_coretemp.c Sun Nov 6 15:12:05 2016 (r308373) +++ stable/11/sys/arm/nvidia/tegra124/tegra124_coretemp.c Sun Nov 6 15:25:46 2016 (r308374) @@ -178,7 +178,11 @@ tegra124_coretemp_ofw_parse(struct tegra static void tegra124_coretemp_identify(driver_t *driver, device_t parent) { + phandle_t root; + root = OF_finddevice("/"); + if (!ofw_bus_node_is_compatible(root, "nvidia,tegra124")) + return; if (device_find_child(parent, "tegra124_coretemp", -1) != NULL) return; if (BUS_ADD_CHILD(parent, 0, "tegra124_coretemp", -1) == NULL) @@ -189,7 +193,7 @@ static int tegra124_coretemp_probe(device_t dev) { - device_set_desc(dev, "CPU Frequency Control"); + device_set_desc(dev, "CPU Thermal Sensor"); return (0); } @@ -262,7 +266,7 @@ static device_method_t tegra124_coretemp }; static devclass_t tegra124_coretemp_devclass; -static DEFINE_CLASS_0(coretemp, tegra124_coretemp_driver, +static DEFINE_CLASS_0(tegra124_coretemp, tegra124_coretemp_driver, tegra124_coretemp_methods, sizeof(struct tegra124_coretemp_softc)); DRIVER_MODULE(tegra124_coretemp, cpu, tegra124_coretemp_driver, tegra124_coretemp_devclass, NULL, NULL); Modified: stable/11/sys/arm/nvidia/tegra124/tegra124_cpufreq.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra124/tegra124_cpufreq.c Sun Nov 6 15:12:05 2016 (r308373) +++ stable/11/sys/arm/nvidia/tegra124/tegra124_cpufreq.c Sun Nov 6 15:25:46 2016 (r308374) @@ -474,7 +474,14 @@ get_fdt_resources(struct tegra124_cpufre static void tegra124_cpufreq_identify(driver_t *driver, device_t parent) { + phandle_t root; + root = OF_finddevice("/"); + if (!ofw_bus_node_is_compatible(root, "nvidia,tegra124")) + return; + + if (device_get_unit(parent) != 0) + return; if (device_find_child(parent, "tegra124_cpufreq", -1) != NULL) return; if (BUS_ADD_CHILD(parent, 0, "tegra124_cpufreq", -1) == NULL) @@ -485,8 +492,6 @@ static int tegra124_cpufreq_probe(device_t dev) { - if (device_get_unit(dev) != 0) - return (ENXIO); device_set_desc(dev, "CPU Frequency Control"); return (0); @@ -587,7 +592,7 @@ static device_method_t tegra124_cpufreq_ }; static devclass_t tegra124_cpufreq_devclass; -static DEFINE_CLASS_0(cpufreq, tegra124_cpufreq_driver, +static DEFINE_CLASS_0(tegra124_cpufreq, tegra124_cpufreq_driver, tegra124_cpufreq_methods, sizeof(struct tegra124_cpufreq_softc)); DRIVER_MODULE(tegra124_cpufreq, cpu, tegra124_cpufreq_driver, tegra124_cpufreq_devclass, NULL, NULL); From owner-svn-src-all@freebsd.org Sun Nov 6 16:27:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EEBFC30B90; Sun, 6 Nov 2016 16:27:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C83ACC31; Sun, 6 Nov 2016 16:27:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6GR9wW038026; Sun, 6 Nov 2016 16:27:09 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6GR9YS038025; Sun, 6 Nov 2016 16:27:09 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201611061627.uA6GR9YS038025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 6 Nov 2016 16:27:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308375 - head/contrib/llvm/lib/Target/AArch64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 16:27:11 -0000 Author: dim Date: Sun Nov 6 16:27:09 2016 New Revision: 308375 URL: https://svnweb.freebsd.org/changeset/base/308375 Log: Pull in r278002 from upstream llvm trunk (by Silviu Baranga): [AArch64] PR28877: Don't assume we're running after legalization when creating vcvtfp2fxs Summary: The DAG combine transformation that was generating the aarch64_neon_vcvtfp2fxs node was assuming that all inputs where legal and wasn't accounting that the input could be a v4f64 if we're trying to do the transformation before legalization. We now bail out in this case. All illegal types besides v4f64 were already rejected. Fixes https://llvm.org/bugs/show_bug.cgi?id=28877 Reviewers: jmolloy Subscribers: aemerson, rengolin, llvm-commits Differential Revision: https://reviews.llvm.org/D23261 This fixes several ports on AArch64. Requested by: andrew MFC after: 3 days Modified: head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Modified: head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Sun Nov 6 15:25:46 2016 (r308374) +++ head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Sun Nov 6 16:27:09 2016 (r308375) @@ -7562,6 +7562,7 @@ static SDValue performIntToFpCombine(SDN /// Fold a floating-point multiply by power of two into floating-point to /// fixed-point conversion. static SDValue performFpToIntCombine(SDNode *N, SelectionDAG &DAG, + TargetLowering::DAGCombinerInfo &DCI, const AArch64Subtarget *Subtarget) { if (!Subtarget->hasNEON()) return SDValue(); @@ -7604,10 +7605,16 @@ static SDValue performFpToIntCombine(SDN ResTy = FloatBits == 32 ? MVT::v2i32 : MVT::v2i64; break; case 4: - ResTy = MVT::v4i32; + ResTy = FloatBits == 32 ? MVT::v4i32 : MVT::v4i64; break; } + if (ResTy == MVT::v4i64 && DCI.isBeforeLegalizeOps()) + return SDValue(); + + assert((ResTy != MVT::v4i64 || DCI.isBeforeLegalizeOps()) && + "Illegal vector type after legalization"); + SDLoc DL(N); bool IsSigned = N->getOpcode() == ISD::FP_TO_SINT; unsigned IntrinsicOpcode = IsSigned ? Intrinsic::aarch64_neon_vcvtfp2fxs @@ -9711,7 +9718,7 @@ SDValue AArch64TargetLowering::PerformDA return performIntToFpCombine(N, DAG, Subtarget); case ISD::FP_TO_SINT: case ISD::FP_TO_UINT: - return performFpToIntCombine(N, DAG, Subtarget); + return performFpToIntCombine(N, DAG, DCI, Subtarget); case ISD::FDIV: return performFDivCombine(N, DAG, Subtarget); case ISD::OR: From owner-svn-src-all@freebsd.org Sun Nov 6 16:44:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F196C3292C; Sun, 6 Nov 2016 16:44:34 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40C8DA92; Sun, 6 Nov 2016 16:44:34 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6GiXig046472; Sun, 6 Nov 2016 16:44:33 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6GiXdP046471; Sun, 6 Nov 2016 16:44:33 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201611061644.uA6GiXdP046471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 6 Nov 2016 16:44:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308376 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 16:44:34 -0000 Author: avos Date: Sun Nov 6 16:44:33 2016 New Revision: 308376 URL: https://svnweb.freebsd.org/changeset/base/308376 Log: MFC r288990: Fix regression from r248371. We need to copy packet header to new mbuf. Unlike in the pre-r248371 code, assert that M_PKTHDR is set only on a first mbuf. PR: 195074 Modified: stable/10/sys/kern/uipc_mbuf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/uipc_mbuf.c ============================================================================== --- stable/10/sys/kern/uipc_mbuf.c Sun Nov 6 16:27:09 2016 (r308375) +++ stable/10/sys/kern/uipc_mbuf.c Sun Nov 6 16:44:33 2016 (r308376) @@ -1994,6 +1994,11 @@ m_unshare(struct mbuf *m0, int how) m_freem(m0); return (NULL); } + if (m->m_flags & M_PKTHDR) { + KASSERT(mprev == NULL, ("%s: m0 %p, m %p has M_PKTHDR", + __func__, m0, m)); + m_move_pkthdr(n, m); + } len = m->m_len; off = 0; mfirst = n; From owner-svn-src-all@freebsd.org Sun Nov 6 17:12:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E2A6C333A9; Sun, 6 Nov 2016 17:12:03 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00510920; Sun, 6 Nov 2016 17:12:02 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6HC2kh065924; Sun, 6 Nov 2016 17:12:02 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6HC2Ql065923; Sun, 6 Nov 2016 17:12:02 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201611061712.uA6HC2Ql065923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 6 Nov 2016 17:12:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308377 - head/sys/dev/rtwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 17:12:03 -0000 Author: avos Date: Sun Nov 6 17:12:02 2016 New Revision: 308377 URL: https://svnweb.freebsd.org/changeset/base/308377 Log: rtwn: reset watchdog timer on device shutdown. Modified: head/sys/dev/rtwn/if_rtwn.c Modified: head/sys/dev/rtwn/if_rtwn.c ============================================================================== --- head/sys/dev/rtwn/if_rtwn.c Sun Nov 6 16:44:33 2016 (r308376) +++ head/sys/dev/rtwn/if_rtwn.c Sun Nov 6 17:12:02 2016 (r308377) @@ -1966,6 +1966,7 @@ rtwn_stop(struct rtwn_softc *sc) #ifndef D4054 callout_stop(&sc->sc_watchdog_to); + sc->sc_tx_timer = 0; #endif sc->sc_flags &= ~(RTWN_STARTED | RTWN_RUNNING | RTWN_FW_LOADED); sc->sc_flags &= ~RTWN_TEMP_MEASURED; From owner-svn-src-all@freebsd.org Sun Nov 6 17:17:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E925FC337B8; Sun, 6 Nov 2016 17:17:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6E99F7F; Sun, 6 Nov 2016 17:17:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6HHq6T069376; Sun, 6 Nov 2016 17:17:52 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6HHqM8069375; Sun, 6 Nov 2016 17:17:52 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201611061717.uA6HHqM8069375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 6 Nov 2016 17:17:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308378 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 17:17:54 -0000 Author: alc Date: Sun Nov 6 17:17:52 2016 New Revision: 308378 URL: https://svnweb.freebsd.org/changeset/base/308378 Log: MFC r308174, r308261 Move and revise a comment about the relation between the object's paging- in-progress count and the vnode. Prior to r188331, we always acquired the vnode lock before incrementing the object's paging-in-progress count. Now, we increment it before attempting to acquire the vnode lock with LK_NOWAIT, but we never sleep acquiring the vnode lock while we have the count incremented. In vm_fault()'s loop over the shadow chain, move a comment describing our invariants to a better place. Also, add two comments concerning the relationship between the map and vnode locks. Modified: stable/11/sys/vm/vm_fault.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_fault.c ============================================================================== --- stable/11/sys/vm/vm_fault.c Sun Nov 6 17:12:02 2016 (r308377) +++ stable/11/sys/vm/vm_fault.c Sun Nov 6 17:17:52 2016 (r308378) @@ -420,8 +420,7 @@ fast_failed: * they will stay around as well. * * Bump the paging-in-progress count to prevent size changes (e.g. - * truncation operations) during I/O. This must be done after - * obtaining the vnode lock in order to avoid possible deadlocks. + * truncation operations) during I/O. */ vm_object_reference_locked(fs.first_object); vm_object_pip_add(fs.first_object, 1); @@ -565,6 +564,14 @@ fast_failed: readrest: /* + * At this point, we have either allocated a new page or found + * an existing page that is only partially valid. + * + * We hold a reference on the current object and the page is + * exclusive busied. + */ + + /* * If the pager for the current object might have the page, * then determine the number of additional pages to read and * potentially reprioritize previously read pages for earlier @@ -633,21 +640,32 @@ readrest: */ if (fs.object->type != OBJT_DEFAULT) { /* - * We have either allocated a new page or found an - * existing page that is only partially valid. We - * hold a reference on fs.object and the page is - * exclusive busied. + * Release the map lock before locking the vnode or + * sleeping in the pager. (If the current object has + * a shadow, then an earlier iteration of this loop + * may have already unlocked the map.) */ unlock_map(&fs); if (fs.object->type == OBJT_VNODE && (vp = fs.object->handle) != fs.vp) { + /* + * Perform an unlock in case the desired vnode + * changed while the map was unlocked during a + * retry. + */ unlock_vp(&fs); - locked = VOP_ISLOCKED(vp); + locked = VOP_ISLOCKED(vp); if (locked != LK_EXCLUSIVE) locked = LK_SHARED; - /* Do not sleep for vnode lock while fs.m is busy */ + + /* + * We must not sleep acquiring the vnode lock + * while we have the page exclusive busied or + * the object's paging-in-progress count + * incremented. Otherwise, we could deadlock. + */ error = vget(vp, locked | LK_CANRECURSE | LK_NOWAIT, curthread); if (error != 0) { From owner-svn-src-all@freebsd.org Sun Nov 6 17:21:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D8D4C33932; Sun, 6 Nov 2016 17:21:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C39561D; Sun, 6 Nov 2016 17:21:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6HLQGQ073383; Sun, 6 Nov 2016 17:21:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6HLQHk073382; Sun, 6 Nov 2016 17:21:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201611061721.uA6HLQHk073382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 6 Nov 2016 17:21:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308379 - head/lib/libgcc_s X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 17:21:27 -0000 Author: emaste Date: Sun Nov 6 17:21:26 2016 New Revision: 308379 URL: https://svnweb.freebsd.org/changeset/base/308379 Log: add __divdi3 and __udivdi3 to libgcc_s symbol version map After r308294 they were missing on i386 (and previously were exported only accidentally). Reported by: antoine Modified: head/lib/libgcc_s/Version.map Modified: head/lib/libgcc_s/Version.map ============================================================================== --- head/lib/libgcc_s/Version.map Sun Nov 6 17:17:52 2016 (r308378) +++ head/lib/libgcc_s/Version.map Sun Nov 6 17:21:26 2016 (r308379) @@ -15,6 +15,7 @@ global: __deregister_frame; __deregister_frame_info; __deregister_frame_info_bases; + __divdi3; __divti3; __ffsdi2; __ffsti2; @@ -47,6 +48,7 @@ global: __subvdi3; __subvsi3; __ucmpti2; + __udivdi3; __udivmodti4; __udivti3; __umodti3; From owner-svn-src-all@freebsd.org Sun Nov 6 17:24:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8FA0C33B58; Sun, 6 Nov 2016 17:24:17 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 892B9A36; Sun, 6 Nov 2016 17:24:17 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6HOGGV073957; Sun, 6 Nov 2016 17:24:16 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6HOGGd073956; Sun, 6 Nov 2016 17:24:16 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201611061724.uA6HOGGd073956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 6 Nov 2016 17:24:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308380 - head/sys/dev/rtwn/rtl8192c/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 17:24:17 -0000 Author: avos Date: Sun Nov 6 17:24:16 2016 New Revision: 308380 URL: https://svnweb.freebsd.org/changeset/base/308380 Log: rtwn: reduce shutdown time for RTL8188CE. Modified: head/sys/dev/rtwn/rtl8192c/pci/r92ce_fw.c Modified: head/sys/dev/rtwn/rtl8192c/pci/r92ce_fw.c ============================================================================== --- head/sys/dev/rtwn/rtl8192c/pci/r92ce_fw.c Sun Nov 6 17:21:26 2016 (r308379) +++ head/sys/dev/rtwn/rtl8192c/pci/r92ce_fw.c Sun Nov 6 17:24:16 2016 (r308380) @@ -69,6 +69,7 @@ r92ce_fw_reset(struct rtwn_softc *sc, in * We must sleep for one second to let the firmware settle. * Accessing registers too early will hang the whole system. */ - rtwn_delay(sc, 1000 * 1000); + if (reason == RTWN_FW_RESET_DOWNLOAD) + rtwn_delay(sc, 1000 * 1000); } #endif From owner-svn-src-all@freebsd.org Sun Nov 6 18:11:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A7FAC33F60; Sun, 6 Nov 2016 18:11:20 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D6642F7; Sun, 6 Nov 2016 18:11:20 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6IBJ4G095150; Sun, 6 Nov 2016 18:11:19 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6IBJO4095149; Sun, 6 Nov 2016 18:11:19 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201611061811.uA6IBJO4095149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 6 Nov 2016 18:11:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308381 - head/sys/dev/rtwn/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 18:11:20 -0000 Author: avos Date: Sun Nov 6 18:11:19 2016 New Revision: 308381 URL: https://svnweb.freebsd.org/changeset/base/308381 Log: rtwn: fix Tx ring cleanup. Do not try to clear stale Tx descriptor entries when there are some running vaps; just free node references - rtwn_pci_tx_done() will free mbufs without creating holes in the Tx descriptor space. Also, reset only 2 first entries in the beacon ring - other will not be used anyway. Tested with RTL8188CE, STA + STA mode. Modified: head/sys/dev/rtwn/pci/rtwn_pci_attach.c Modified: head/sys/dev/rtwn/pci/rtwn_pci_attach.c ============================================================================== --- head/sys/dev/rtwn/pci/rtwn_pci_attach.c Sun Nov 6 17:24:16 2016 (r308380) +++ head/sys/dev/rtwn/pci/rtwn_pci_attach.c Sun Nov 6 18:11:19 2016 (r308381) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -75,6 +76,8 @@ static int rtwn_pci_alloc_rx_list(struct static void rtwn_pci_reset_rx_list(struct rtwn_softc *); static void rtwn_pci_free_rx_list(struct rtwn_softc *); static int rtwn_pci_alloc_tx_list(struct rtwn_softc *, int); +static void rtwn_pci_reset_tx_ring_stopped(struct rtwn_softc *, int); +static void rtwn_pci_reset_beacon_ring(struct rtwn_softc *, int); static void rtwn_pci_reset_tx_list(struct rtwn_softc *, struct ieee80211vap *, int); static void rtwn_pci_free_tx_list(struct rtwn_softc *, int); @@ -312,48 +315,109 @@ fail: } static void -rtwn_pci_reset_tx_list(struct rtwn_softc *sc, struct ieee80211vap *vap, - int qid) +rtwn_pci_reset_tx_ring_stopped(struct rtwn_softc *sc, int qid) { - struct rtwn_vap *uvp = RTWN_VAP(vap); struct rtwn_pci_softc *pc = RTWN_PCI_SOFTC(sc); - struct rtwn_tx_ring *tx_ring = &pc->tx_ring[qid]; - int i, id; - - id = (uvp != NULL ? uvp->id : RTWN_VAP_ID_INVALID); + struct rtwn_tx_ring *ring = &pc->tx_ring[qid]; + int i; for (i = 0; i < RTWN_PCI_TX_LIST_COUNT; i++) { - struct rtwn_tx_data *tx_data = &tx_ring->tx_data[i]; + struct rtwn_tx_data *data = &ring->tx_data[i]; + void *desc = (uint8_t *)ring->desc + sc->txdesc_len * i; - if (vap == NULL || (tx_data->ni == NULL && - (tx_data->id == id || id == RTWN_VAP_ID_INVALID)) || - (tx_data->ni != NULL && tx_data->ni->ni_vap == vap)) { - void *tx_desc = - (uint8_t *)tx_ring->desc + sc->txdesc_len * i; - - rtwn_pci_copy_tx_desc(pc, tx_desc, NULL); - - if (tx_data->m != NULL) { - bus_dmamap_sync(tx_ring->data_dmat, - tx_data->map, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(tx_ring->data_dmat, - tx_data->map); - m_freem(tx_data->m); - tx_data->m = NULL; - } - if (tx_data->ni != NULL) { - ieee80211_free_node(tx_data->ni); - tx_data->ni = NULL; - } + rtwn_pci_copy_tx_desc(pc, desc, NULL); + + if (data->m != NULL) { + bus_dmamap_sync(ring->data_dmat, data->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(ring->data_dmat, data->map); + m_freem(data->m); + data->m = NULL; + } + if (data->ni != NULL) { + ieee80211_free_node(data->ni); + data->ni = NULL; } } - bus_dmamap_sync(tx_ring->desc_dmat, tx_ring->desc_map, + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, BUS_DMASYNC_POSTWRITE); sc->qfullmsk &= ~(1 << qid); - tx_ring->queued = 0; - tx_ring->last = tx_ring->cur = 0; + ring->queued = 0; + ring->last = ring->cur = 0; +} + +/* + * Clear entry 0 (or 1) in the beacon queue (other are not used). + */ +static void +rtwn_pci_reset_beacon_ring(struct rtwn_softc *sc, int id) +{ + struct rtwn_pci_softc *pc = RTWN_PCI_SOFTC(sc); + struct rtwn_tx_ring *ring = &pc->tx_ring[RTWN_PCI_BEACON_QUEUE]; + struct rtwn_tx_data *data = &ring->tx_data[id]; + struct rtwn_tx_desc_common *txd = (struct rtwn_tx_desc_common *) + ((uint8_t *)ring->desc + id * sc->txdesc_len); + + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, BUS_DMASYNC_POSTREAD); + if (txd->flags0 & RTWN_FLAGS0_OWN) { + /* Clear OWN bit. */ + txd->flags0 &= ~RTWN_FLAGS0_OWN; + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, + BUS_DMASYNC_PREWRITE); + + /* Unload mbuf. */ + bus_dmamap_sync(ring->data_dmat, data->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(ring->data_dmat, data->map); + } +} + +/* + * Drop stale entries from Tx ring before the vap will be deleted. + * In case if vap is NULL just free everything and reset cur / last pointers. + */ +static void +rtwn_pci_reset_tx_list(struct rtwn_softc *sc, struct ieee80211vap *vap, + int qid) +{ + int i; + + if (vap == NULL) { + if (qid != RTWN_PCI_BEACON_QUEUE) { + /* + * Device was stopped; just clear all entries. + */ + rtwn_pci_reset_tx_ring_stopped(sc, qid); + } else { + for (i = 0; i < RTWN_PORT_COUNT; i++) + rtwn_pci_reset_beacon_ring(sc, i); + } + } else if (qid == RTWN_PCI_BEACON_QUEUE && + (vap->iv_opmode == IEEE80211_M_HOSTAP || + vap->iv_opmode == IEEE80211_M_IBSS)) { + struct rtwn_vap *uvp = RTWN_VAP(vap); + + rtwn_pci_reset_beacon_ring(sc, uvp->id); + } else { + struct rtwn_pci_softc *pc = RTWN_PCI_SOFTC(sc); + struct rtwn_tx_ring *ring = &pc->tx_ring[qid]; + + for (i = 0; i < RTWN_PCI_TX_LIST_COUNT; i++) { + struct rtwn_tx_data *data = &ring->tx_data[i]; + if (data->ni != NULL && data->ni->ni_vap == vap) { + /* + * NB: if some vap is still running + * rtwn_pci_tx_done() will free the mbuf; + * otherwise, rtwn_stop() will reset all rings + * after device shutdown. + */ + ieee80211_free_node(data->ni); + data->ni = NULL; + } + } + } } static void From owner-svn-src-all@freebsd.org Sun Nov 6 18:40:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79F97C33DF9; Sun, 6 Nov 2016 18:40:14 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 54DE07D5; Sun, 6 Nov 2016 18:40:14 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6IeD8r004218; Sun, 6 Nov 2016 18:40:13 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6IeD3c004213; Sun, 6 Nov 2016 18:40:13 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201611061840.uA6IeD3c004213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sun, 6 Nov 2016 18:40:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308382 - in stable/11/sys: arm/arm arm64/arm64 kern mips/mips X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 18:40:14 -0000 Author: gonzo Date: Sun Nov 6 18:40:12 2016 New Revision: 308382 URL: https://svnweb.freebsd.org/changeset/base/308382 Log: MFC r306899, r307059, r307151 r306899: Fix release MSI method for ARM GIC r307059: INTRNG - fix MSI/MSIX release path Use isrc in attached MSI data structure instead of using map's isrc directly. map's isrc is set to NULL on IRQ deactivation which happens prior to pci_release_msi so MSI_RELEASE_MSI receives array of NULLs Reviewed by: mmel Differential Revision: https://reviews.freebsd.org/D8206 r307151: INTRNG: Propagate IRQ activation error to API consumer Keep resource state consistent with INTRNG state - if intr_activate_irq fails - deactivate resource and propagate error to calling function Reviewed by: mmel Modified: stable/11/sys/arm/arm/gic.c stable/11/sys/arm/arm/nexus.c stable/11/sys/arm64/arm64/nexus.c stable/11/sys/kern/subr_intr.c stable/11/sys/mips/mips/nexus.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/gic.c ============================================================================== --- stable/11/sys/arm/arm/gic.c Sun Nov 6 18:11:19 2016 (r308381) +++ stable/11/sys/arm/arm/gic.c Sun Nov 6 18:40:12 2016 (r308382) @@ -1700,15 +1700,15 @@ arm_gicv2m_release_msi(device_t dev, dev mtx_lock(&sc->sc_mutex); for (i = 0; i < count; i++) { - gi = (struct gic_irqsrc *)isrc; + gi = (struct gic_irqsrc *)isrc[i]; KASSERT((gi->gi_flags & GI_FLAG_MSI_USED) == GI_FLAG_MSI_USED, ("%s: Trying to release an unused MSI-X interrupt", __func__)); gi->gi_flags &= ~GI_FLAG_MSI_USED; - mtx_unlock(&sc->sc_mutex); } + mtx_unlock(&sc->sc_mutex); return (0); } Modified: stable/11/sys/arm/arm/nexus.c ============================================================================== --- stable/11/sys/arm/arm/nexus.c Sun Nov 6 18:11:19 2016 (r308381) +++ stable/11/sys/arm/arm/nexus.c Sun Nov 6 18:40:12 2016 (r308382) @@ -383,7 +383,11 @@ nexus_activate_resource(device_t bus, de return (0); } else if (type == SYS_RES_IRQ) { #ifdef INTRNG - intr_activate_irq(child, r); + err = intr_activate_irq(child, r); + if (err != 0) { + rman_deactivate_resource(r); + return (err); + } #endif } return (0); Modified: stable/11/sys/arm64/arm64/nexus.c ============================================================================== --- stable/11/sys/arm64/arm64/nexus.c Sun Nov 6 18:11:19 2016 (r308381) +++ stable/11/sys/arm64/arm64/nexus.c Sun Nov 6 18:40:12 2016 (r308382) @@ -346,7 +346,11 @@ nexus_activate_resource(device_t bus, de rman_set_virtual(r, (void *)vaddr); rman_set_bushandle(r, vaddr); } else if (type == SYS_RES_IRQ) { - intr_activate_irq(child, r); + err = intr_activate_irq(child, r); + if (err != 0) { + rman_deactivate_resource(r); + return (err); + } } return (0); } Modified: stable/11/sys/kern/subr_intr.c ============================================================================== --- stable/11/sys/kern/subr_intr.c Sun Nov 6 18:11:19 2016 (r308381) +++ stable/11/sys/kern/subr_intr.c Sun Nov 6 18:40:12 2016 (r308382) @@ -145,6 +145,7 @@ static u_int intrcnt_index; static struct intr_irqsrc *intr_map_get_isrc(u_int res_id); static void intr_map_set_isrc(u_int res_id, struct intr_irqsrc *isrc); +static struct intr_map_data * intr_map_get_map_data(u_int res_id); static void intr_map_copy_map_data(u_int res_id, device_t *dev, intptr_t *xref, struct intr_map_data **data); @@ -1309,6 +1310,7 @@ intr_release_msi(device_t pci, device_t { struct intr_irqsrc **isrc; struct intr_pic *pic; + struct intr_map_data_msi *msi; int i, err; pic = pic_lookup(NULL, xref); @@ -1321,8 +1323,14 @@ intr_release_msi(device_t pci, device_t isrc = malloc(sizeof(*isrc) * count, M_INTRNG, M_WAITOK); - for (i = 0; i < count; i++) - isrc[i] = intr_map_get_isrc(irqs[i]); + for (i = 0; i < count; i++) { + msi = (struct intr_map_data_msi *) + intr_map_get_map_data(irqs[i]); + KASSERT(msi->hdr.type == INTR_MAP_DATA_MSI, + ("%s: irq %d map data is not MSI", __func__, + irqs[i])); + isrc[i] = msi->isrc; + } err = MSI_RELEASE_MSI(pic->pic_dev, child, count, isrc); @@ -1369,6 +1377,7 @@ intr_release_msix(device_t pci, device_t { struct intr_irqsrc *isrc; struct intr_pic *pic; + struct intr_map_data_msi *msi; int err; pic = pic_lookup(NULL, xref); @@ -1379,7 +1388,12 @@ intr_release_msix(device_t pci, device_t ("%s: Found a non-MSI controller: %s", __func__, device_get_name(pic->pic_dev))); - isrc = intr_map_get_isrc(irq); + msi = (struct intr_map_data_msi *) + intr_map_get_map_data(irq); + KASSERT(msi->hdr.type == INTR_MAP_DATA_MSI, + ("%s: irq %d map data is not MSI", __func__, + irq)); + isrc = msi->isrc; if (isrc == NULL) { intr_unmap_irq(irq); return (EINVAL); @@ -1516,6 +1530,24 @@ intr_map_set_isrc(u_int res_id, struct i /* * Get a copy of intr_map_entry data */ +static struct intr_map_data * +intr_map_get_map_data(u_int res_id) +{ + struct intr_map_data *data; + + data = NULL; + mtx_lock(&irq_map_lock); + if (res_id >= irq_map_count || irq_map[res_id] == NULL) + panic("Attempt to copy invalid resource id: %u\n", res_id); + data = irq_map[res_id]->map_data; + mtx_unlock(&irq_map_lock); + + return (data); +} + +/* + * Get a copy of intr_map_entry data + */ static void intr_map_copy_map_data(u_int res_id, device_t *map_dev, intptr_t *map_xref, struct intr_map_data **data) Modified: stable/11/sys/mips/mips/nexus.c ============================================================================== --- stable/11/sys/mips/mips/nexus.c Sun Nov 6 18:11:19 2016 (r308381) +++ stable/11/sys/mips/mips/nexus.c Sun Nov 6 18:40:12 2016 (r308382) @@ -433,7 +433,11 @@ nexus_activate_resource(device_t bus, de } else if (type == SYS_RES_IRQ) { #ifdef INTRNG #ifdef FDT - intr_activate_irq(child, r); + err = intr_activate_irq(child, r); + if (err != 0) { + rman_deactivate_resource(r); + return (err); + } #else /* * INTRNG without FDT needs to have the interrupt properly From owner-svn-src-all@freebsd.org Sun Nov 6 19:16:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13CA1C34130; Sun, 6 Nov 2016 19:16:48 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4731C44; Sun, 6 Nov 2016 19:16:47 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6JGkLf019565; Sun, 6 Nov 2016 19:16:46 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6JGk5V019563; Sun, 6 Nov 2016 19:16:46 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201611061916.uA6JGk5V019563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 6 Nov 2016 19:16:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308383 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 19:16:48 -0000 Author: adrian Date: Sun Nov 6 19:16:46 2016 New Revision: 308383 URL: https://svnweb.freebsd.org/changeset/base/308383 Log: [net80211] add a method to also explicitly tear down RX A-MPDU. The ath10k firmware API doesn't pass up the ADDBA/DELBA frames, only WMI firmware notifications. Tested: * ath10k (QCA9880), doing actual (ha!) 11n! Modified: head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_ht.h Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Sun Nov 6 18:40:12 2016 (r308382) +++ head/sys/net80211/ieee80211_ht.c Sun Nov 6 19:16:46 2016 (r308383) @@ -597,6 +597,19 @@ ieee80211_ampdu_rx_start_ext(struct ieee } /* + * Public function; manually stop the RX AMPDU state. + */ +void +ieee80211_ampdu_rx_stop_ext(struct ieee80211_node *ni, int tid) +{ + struct ieee80211_rx_ampdu *rap; + + /* XXX TODO: sanity check tid, seq, baw */ + rap = &ni->ni_rx_ampdu[tid]; + ampdu_rx_stop(ni, rap); +} + +/* * Stop A-MPDU rx processing for the specified TID. */ static void Modified: head/sys/net80211/ieee80211_ht.h ============================================================================== --- head/sys/net80211/ieee80211_ht.h Sun Nov 6 18:40:12 2016 (r308382) +++ head/sys/net80211/ieee80211_ht.h Sun Nov 6 19:16:46 2016 (r308383) @@ -220,6 +220,7 @@ void ieee80211_ht_update_beacon(struct i struct ieee80211_beacon_offsets *); int ieee80211_ampdu_rx_start_ext(struct ieee80211_node *ni, int tid, int seq, int baw); +void ieee80211_ampdu_rx_stop_ext(struct ieee80211_node *ni, int tid); int ieee80211_ampdu_tx_request_ext(struct ieee80211_node *ni, int tid); int ieee80211_ampdu_tx_request_active_ext(struct ieee80211_node *ni, int tid, int status); From owner-svn-src-all@freebsd.org Sun Nov 6 19:17:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8F8EC341B5; Sun, 6 Nov 2016 19:17:40 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 891BFDC4; Sun, 6 Nov 2016 19:17:40 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6JHd2B019647; Sun, 6 Nov 2016 19:17:39 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6JHdrs019645; Sun, 6 Nov 2016 19:17:39 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201611061917.uA6JHdrs019645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 6 Nov 2016 19:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308384 - in head/sys/dev/rtwn: pci usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 19:17:40 -0000 Author: avos Date: Sun Nov 6 19:17:39 2016 New Revision: 308384 URL: https://svnweb.freebsd.org/changeset/base/308384 Log: rtwn_pci: omit tx_done() stage if device is not running. rtwn_usb: drain USB transfers during device shutdown; this fixes possible panic with 'options IEEE80211_SUPPORT_SUPERG' during device detach. Tested with RTL8188CE, STA mode. Modified: head/sys/dev/rtwn/pci/rtwn_pci_rx.c head/sys/dev/rtwn/usb/rtwn_usb_attach.c Modified: head/sys/dev/rtwn/pci/rtwn_pci_rx.c ============================================================================== --- head/sys/dev/rtwn/pci/rtwn_pci_rx.c Sun Nov 6 19:16:46 2016 (r308383) +++ head/sys/dev/rtwn/pci/rtwn_pci_rx.c Sun Nov 6 19:17:39 2016 (r308384) @@ -274,13 +274,14 @@ rtwn_pci_intr(void *arg) status = rtwn_classify_intr(sc, &tx_rings, 0); RTWN_DPRINTF(sc, RTWN_DEBUG_INTR, "%s: status %08X, tx_rings %08X\n", __func__, status, tx_rings); - if (status == 0 && tx_rings == 0) { - RTWN_UNLOCK(sc); - return; - } + if (status == 0 && tx_rings == 0) + goto unlock; - if (status & RTWN_PCI_INTR_RX) + if (status & RTWN_PCI_INTR_RX) { rtwn_pci_rx_done(sc); + if (!(sc->sc_flags & RTWN_RUNNING)) + goto unlock; + } if (tx_rings != 0) for (i = 0; i < RTWN_PCI_NTXQUEUES; i++) @@ -289,5 +290,6 @@ rtwn_pci_intr(void *arg) if (sc->sc_flags & RTWN_RUNNING) rtwn_pci_enable_intr(pc); +unlock: RTWN_UNLOCK(sc); } Modified: head/sys/dev/rtwn/usb/rtwn_usb_attach.c ============================================================================== --- head/sys/dev/rtwn/usb/rtwn_usb_attach.c Sun Nov 6 19:16:46 2016 (r308383) +++ head/sys/dev/rtwn/usb/rtwn_usb_attach.c Sun Nov 6 19:17:39 2016 (r308384) @@ -273,8 +273,10 @@ rtwn_usb_abort_xfers(struct rtwn_softc * RTWN_ASSERT_LOCKED(sc); /* abort any pending transfers */ + RTWN_UNLOCK(sc); for (i = 0; i < RTWN_N_TRANSFER; i++) - usbd_transfer_stop(uc->uc_xfer[i]); + usbd_transfer_drain(uc->uc_xfer[i]); + RTWN_LOCK(sc); } static int From owner-svn-src-all@freebsd.org Sun Nov 6 19:18:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C00DFC3422A; Sun, 6 Nov 2016 19:18:26 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F9B4F2C; Sun, 6 Nov 2016 19:18:26 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6JIP5U019719; Sun, 6 Nov 2016 19:18:25 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6JIP1J019717; Sun, 6 Nov 2016 19:18:25 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201611061918.uA6JIP1J019717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 6 Nov 2016 19:18:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308385 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 19:18:26 -0000 Author: adrian Date: Sun Nov 6 19:18:25 2016 New Revision: 308385 URL: https://svnweb.freebsd.org/changeset/base/308385 Log: [net80211] extend the net80211 ALQ code to support variable payloads. Also - allow driver specific bits to be added, rather than just net80211. This still isn't as useful as it should be by default; it needs to be a standalone struct/instance so it can be done before net80211 registration occurs, and it can log per-device items. But, it's getting there. Modified: head/sys/net80211/ieee80211_alq.c head/sys/net80211/ieee80211_alq.h Modified: head/sys/net80211/ieee80211_alq.c ============================================================================== --- head/sys/net80211/ieee80211_alq.c Sun Nov 6 19:17:39 2016 (r308384) +++ head/sys/net80211/ieee80211_alq.c Sun Nov 6 19:18:25 2016 (r308385) @@ -79,14 +79,13 @@ ieee80211_alq_setlogging(int enable) ieee80211_alq_logfile, curthread->td_ucred, ALQ_DEFAULT_CMODE, - sizeof (struct ieee80211_alq_rec), - ieee80211_alq_qsize); + ieee80211_alq_qsize, 0); ieee80211_alq_lost = 0; ieee80211_alq_logged = 0; printf("net80211: logging to %s enabled; " "struct size %d bytes\n", ieee80211_alq_logfile, - sizeof(struct ieee80211_alq_rec)); + (int) sizeof(struct ieee80211_alq_rec)); } else { if (ieee80211_alq) alq_close(ieee80211_alq); @@ -113,18 +112,19 @@ sysctl_ieee80211_alq_log(SYSCTL_HANDLER_ SYSCTL_PROC(_net_wlan, OID_AUTO, alq, CTLTYPE_INT|CTLFLAG_RW, 0, 0, sysctl_ieee80211_alq_log, "I", "Enable net80211 alq logging"); SYSCTL_INT(_net_wlan, OID_AUTO, alq_size, CTLFLAG_RW, - &ieee80211_alq_qsize, 0, "In-memory log size (#records)"); + &ieee80211_alq_qsize, 0, "In-memory log size (bytes)"); SYSCTL_INT(_net_wlan, OID_AUTO, alq_lost, CTLFLAG_RW, &ieee80211_alq_lost, 0, "Debugging operations not logged"); SYSCTL_INT(_net_wlan, OID_AUTO, alq_logged, CTLFLAG_RW, &ieee80211_alq_logged, 0, "Debugging operations logged"); static struct ale * -ieee80211_alq_get(void) +ieee80211_alq_get(size_t len) { struct ale *ale; - ale = alq_get(ieee80211_alq, ALQ_NOWAIT); + ale = alq_getn(ieee80211_alq, len + sizeof(struct ieee80211_alq_rec), + ALQ_NOWAIT); if (!ale) ieee80211_alq_lost++; else @@ -132,25 +132,44 @@ ieee80211_alq_get(void) return ale; } -void -ieee80211_alq_log(struct ieee80211vap *vap, uint8_t op, u_char *p, int l) +int +ieee80211_alq_log(struct ieee80211com *ic, struct ieee80211vap *vap, + uint32_t op, uint32_t flags, uint16_t srcid, const uint8_t *src, + size_t len) { struct ale *ale; struct ieee80211_alq_rec *r; + char *dst; + /* Don't log if we're disabled */ if (ieee80211_alq == NULL) - return; + return (0); - ale = ieee80211_alq_get(); + if (len > IEEE80211_ALQ_MAX_PAYLOAD) + return (ENOMEM); + + ale = ieee80211_alq_get(len); if (! ale) - return; + return (ENOMEM); r = (struct ieee80211_alq_rec *) ale->ae_data; - r->r_timestamp = htonl(ticks); - r->r_version = 1; - r->r_wlan = htons(vap->iv_ifp->if_dunit); - r->r_op = op; - r->r_threadid = htonl((uint32_t) curthread->td_tid); - memcpy(&r->r_payload, p, MIN(l, sizeof(r->r_payload))); + dst = ((char *) r) + sizeof(struct ieee80211_alq_rec); + r->r_timestamp = htobe64(ticks); + if (vap != NULL) { + r->r_wlan = htobe16(vap->iv_ifp->if_dunit); + } else { + r->r_wlan = 0xffff; + } + r->r_src = htobe16(srcid); + r->r_flags = htobe32(flags); + r->r_op = htobe32(op); + r->r_len = htobe32(len + sizeof(struct ieee80211_alq_rec)); + r->r_threadid = htobe32((uint32_t) curthread->td_tid); + + if (src != NULL) + memcpy(dst, src, len); + alq_post(ieee80211_alq, ale); + + return (0); } Modified: head/sys/net80211/ieee80211_alq.h ============================================================================== --- head/sys/net80211/ieee80211_alq.h Sun Nov 6 19:17:39 2016 (r308384) +++ head/sys/net80211/ieee80211_alq.h Sun Nov 6 19:18:25 2016 (r308385) @@ -27,7 +27,7 @@ #ifndef __IEEE80211_ALQ_H__ #define __IEEE80211_ALQ_H__ -#define IEEE80211_ALQ_PAYLOAD_SIZE 24 +#define IEEE80211_ALQ_MAX_PAYLOAD 1024 /* * timestamp @@ -36,18 +36,24 @@ * sub-operation * rest of structure - operation specific */ + +#define IEEE80211_ALQ_SRC_NET80211 0x0001 +/* Drivers define their own numbers above 0xff */ + struct ieee80211_alq_rec { - uint32_t r_timestamp; /* XXX may wrap! */ + uint64_t r_timestamp; /* XXX may wrap! */ uint32_t r_threadid; /* current thread id */ uint16_t r_wlan; /* wlan interface number */ - uint8_t r_version; /* version */ - uint8_t r_op; /* top-level operation id */ - u_char r_payload[IEEE80211_ALQ_PAYLOAD_SIZE]; - /* operation-specific payload */ + uint16_t r_src; /* source - driver, net80211 */ + uint32_t r_flags; /* flags */ + uint32_t r_op; /* top-level operation id */ + uint32_t r_len; /* length of hdr + payload */ + /* Operation payload follows here */ }; /* General logging function */ -extern void ieee80211_alq_log(struct ieee80211vap *vap, uint8_t op, - u_char *p, int l); +extern int ieee80211_alq_log(struct ieee80211com *ic, + struct ieee80211vap *vap, uint32_t op, uint32_t flags, + uint16_t srcid, const uint8_t *src, size_t len); #endif /* __IEEE80211_ALQ_H__ */ From owner-svn-src-all@freebsd.org Sun Nov 6 19:37:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7C7DC3208B; Sun, 6 Nov 2016 19:37:23 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0D727A6; Sun, 6 Nov 2016 19:37:23 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6JbMDq027363; Sun, 6 Nov 2016 19:37:22 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6JbMBI027362; Sun, 6 Nov 2016 19:37:22 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201611061937.uA6JbMBI027362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 6 Nov 2016 19:37:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308386 - head/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 19:37:24 -0000 Author: trasz Date: Sun Nov 6 19:37:22 2016 New Revision: 308386 URL: https://svnweb.freebsd.org/changeset/base/308386 Log: Document that getfsstat(2) called with MNT_NOWAIT skips file systems that are in the process of being unmounted. Reviewed by: des@ (earlier version) MFC after: 1 month Modified: head/lib/libc/sys/getfsstat.2 Modified: head/lib/libc/sys/getfsstat.2 ============================================================================== --- head/lib/libc/sys/getfsstat.2 Sun Nov 6 19:18:25 2016 (r308385) +++ head/lib/libc/sys/getfsstat.2 Sun Nov 6 19:37:22 2016 (r308386) @@ -28,7 +28,7 @@ .\" @(#)getfsstat.2 8.3 (Berkeley) 5/25/95 .\" $FreeBSD$ .\" -.Dd November 20, 2003 +.Dd November 6, 2016 .Dt GETFSSTAT 2 .Os .Sh NAME @@ -88,6 +88,8 @@ Thus, some of the information will be ou .Fn getfsstat will not block waiting for information from a file system that is unable to respond. +It will also skip any file system that is in the process of being +unmounted, even if the unmount would eventually fail. .Sh RETURN VALUES Upon successful completion, the number of .Fa statfs From owner-svn-src-all@freebsd.org Sun Nov 6 19:51:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F24CC32F6B; Sun, 6 Nov 2016 19:51:02 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5AFA8EA3; Sun, 6 Nov 2016 19:51:02 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6Jp1Ba031642; Sun, 6 Nov 2016 19:51:01 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6Jp1CJ031641; Sun, 6 Nov 2016 19:51:01 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201611061951.uA6Jp1CJ031641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 6 Nov 2016 19:51:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308387 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 19:51:02 -0000 Author: avos Date: Sun Nov 6 19:51:01 2016 New Revision: 308387 URL: https://svnweb.freebsd.org/changeset/base/308387 Log: Fix device driver name if devd.conf + move it into appropriate place. Noticed by: Idwer Vollering Modified: head/etc/devd.conf Modified: head/etc/devd.conf ============================================================================== --- head/etc/devd.conf Sun Nov 6 19:37:22 2016 (r308386) +++ head/etc/devd.conf Sun Nov 6 19:51:01 2016 (r308387) @@ -23,8 +23,8 @@ options { esp|ida|iir|ips|isp|mlx|mly|mpt|ncr|ncv|nsp|stg|sym|trm)\ [0-9]+"; set wifi-driver-regex - "(ath|bwi|bwn|ipw|iwi|iwm|iwn|malo|mwl|ral|rsu|rum|run|uath|\ - upgt|ural|urtw|rtwn_usb|wi|wpi|wtap|zyd)[0-9]+"; + "(ath|bwi|bwn|ipw|iwi|iwm|iwn|malo|mwl|ral|rsu|rtwn|rum|run|\ + uath|upgt|ural|urtw|wi|wpi|wtap|zyd)[0-9]+"; }; # Note that the attach/detach with the highest value wins, so that one can From owner-svn-src-all@freebsd.org Sun Nov 6 21:41:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2A65C33A1A; Sun, 6 Nov 2016 21:41:27 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C966AFF; Sun, 6 Nov 2016 21:41:27 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6LfQC3076687; Sun, 6 Nov 2016 21:41:26 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6LfQgR076683; Sun, 6 Nov 2016 21:41:26 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201611062141.uA6LfQgR076683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sun, 6 Nov 2016 21:41:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308388 - in stable/11/sys/dev: evdev usb/input X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 21:41:27 -0000 Author: gonzo Date: Sun Nov 6 21:41:26 2016 New Revision: 308388 URL: https://svnweb.freebsd.org/changeset/base/308388 Log: MFC r307804-r307805 r307804: EVDEV: Add shortcut functions for event types Add wrappers around generic evdev_push_event for specific event types: EV_KEY/EV_REL/EV_ABS etc... Submitted by: Vladimir Kondratiev r307805: EVDEV: ums evdev support improvements: locking and event reporting - Use ums lock as evdev lock - Do not cap axes values to sysmouse limits for evdev reports - Do not map T-axis events to buttons for evdev reports - Use shortcuts for event reporting Submitted by: Vladimir Kondratiev MFC after: 1 week Modified: stable/11/sys/dev/evdev/evdev.c stable/11/sys/dev/evdev/evdev.h stable/11/sys/dev/evdev/evdev_utils.c stable/11/sys/dev/usb/input/ums.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/evdev/evdev.c ============================================================================== --- stable/11/sys/dev/evdev/evdev.c Sun Nov 6 19:51:01 2016 (r308387) +++ stable/11/sys/dev/evdev/evdev.c Sun Nov 6 21:41:26 2016 (r308388) @@ -822,21 +822,6 @@ push: return (ret); } -inline int -evdev_sync(struct evdev_dev *evdev) -{ - - return (evdev_push_event(evdev, EV_SYN, SYN_REPORT, 1)); -} - - -inline int -evdev_mt_sync(struct evdev_dev *evdev) -{ - - return (evdev_push_event(evdev, EV_SYN, SYN_MT_REPORT, 1)); -} - int evdev_register_client(struct evdev_dev *evdev, struct evdev_client *client) { Modified: stable/11/sys/dev/evdev/evdev.h ============================================================================== --- stable/11/sys/dev/evdev/evdev.h Sun Nov 6 19:51:01 2016 (r308387) +++ stable/11/sys/dev/evdev/evdev.h Sun Nov 6 21:41:26 2016 (r308388) @@ -97,8 +97,6 @@ int evdev_register(struct evdev_dev *); int evdev_register_mtx(struct evdev_dev *, struct mtx *); int evdev_unregister(struct evdev_dev *); int evdev_push_event(struct evdev_dev *, uint16_t, uint16_t, int32_t); -int evdev_sync(struct evdev_dev *); -int evdev_mt_sync(struct evdev_dev *); void evdev_support_prop(struct evdev_dev *, uint16_t); void evdev_support_event(struct evdev_dev *, uint16_t); void evdev_support_key(struct evdev_dev *, uint16_t); @@ -129,4 +127,68 @@ void evdev_push_leds(struct evdev_dev *, void evdev_push_repeats(struct evdev_dev *, keyboard_t *); evdev_event_t evdev_ev_kbd_event; +/* Event reporting shortcuts: */ +static __inline int +evdev_sync(struct evdev_dev *evdev) +{ + + return (evdev_push_event(evdev, EV_SYN, SYN_REPORT, 1)); +} + +static __inline int +evdev_mt_sync(struct evdev_dev *evdev) +{ + + return (evdev_push_event(evdev, EV_SYN, SYN_MT_REPORT, 1)); +} + +static __inline int +evdev_push_key(struct evdev_dev *evdev, uint16_t code, int32_t value) +{ + + return (evdev_push_event(evdev, EV_KEY, code, value != 0)); +} + +static __inline int +evdev_push_rel(struct evdev_dev *evdev, uint16_t code, int32_t value) +{ + + return (evdev_push_event(evdev, EV_REL, code, value)); +} + +static __inline int +evdev_push_abs(struct evdev_dev *evdev, uint16_t code, int32_t value) +{ + + return (evdev_push_event(evdev, EV_ABS, code, value)); +} + +static __inline int +evdev_push_msc(struct evdev_dev *evdev, uint16_t code, int32_t value) +{ + + return (evdev_push_event(evdev, EV_MSC, code, value)); +} + +static __inline int +evdev_push_led(struct evdev_dev *evdev, uint16_t code, int32_t value) +{ + + return (evdev_push_event(evdev, EV_LED, code, value != 0)); +} + +static __inline int +evdev_push_snd(struct evdev_dev *evdev, uint16_t code, int32_t value) +{ + + return (evdev_push_event(evdev, EV_SND, code, value != 0)); +} + +static __inline int +evdev_push_sw(struct evdev_dev *evdev, uint16_t code, int32_t value) +{ + + return (evdev_push_event(evdev, EV_SW, code, value != 0)); +} + #endif /* _DEV_EVDEV_EVDEV_H */ Modified: stable/11/sys/dev/evdev/evdev_utils.c ============================================================================== --- stable/11/sys/dev/evdev/evdev_utils.c Sun Nov 6 19:51:01 2016 (r308387) +++ stable/11/sys/dev/evdev/evdev_utils.c Sun Nov 6 21:41:26 2016 (r308388) @@ -271,8 +271,8 @@ evdev_push_mouse_btn(struct evdev_dev *e size_t i; for (i = 0; i < nitems(evdev_mouse_button_codes); i++) - evdev_push_event(evdev, EV_KEY, evdev_mouse_button_codes[i], - (buttons & (1 << i)) != 0); + evdev_push_key(evdev, evdev_mouse_button_codes[i], + buttons & (1 << i)); } void @@ -285,8 +285,7 @@ evdev_push_leds(struct evdev_dev *evdev, return; for (i = 0; i < nitems(evdev_led_codes); i++) - evdev_push_event(evdev, EV_LED, evdev_led_codes[i], - (leds & (1 << i)) != 0); + evdev_push_led(evdev, evdev_led_codes[i], leds & (1 << i)); } void Modified: stable/11/sys/dev/usb/input/ums.c ============================================================================== --- stable/11/sys/dev/usb/input/ums.c Sun Nov 6 19:51:01 2016 (r308387) +++ stable/11/sys/dev/usb/input/ums.c Sun Nov 6 21:41:26 2016 (r308388) @@ -173,6 +173,8 @@ static usb_fifo_ioctl_t ums_fifo_ioctl; #ifdef EVDEV_SUPPORT static evdev_open_t ums_ev_open; static evdev_close_t ums_ev_close; +static void ums_evdev_push(struct ums_softc *, int32_t, int32_t, + int32_t, int32_t, int32_t); #endif static void ums_start_rx(struct ums_softc *); @@ -205,6 +207,9 @@ ums_put_queue_timeout(void *__sc) mtx_assert(&sc->sc_mtx, MA_OWNED); ums_put_queue(sc, 0, 0, 0, 0, 0); +#ifdef EVDEV_SUPPORT + ums_evdev_push(sc, 0, 0, 0, 0, 0); +#endif } static void @@ -216,6 +221,9 @@ ums_intr_callback(struct usb_xfer *xfer, uint8_t *buf = sc->sc_temp; int32_t buttons = 0; int32_t buttons_found = 0; +#ifdef EVDEV_SUPPORT + int32_t buttons_reported = 0; +#endif int32_t dw = 0; int32_t dx = 0; int32_t dy = 0; @@ -306,6 +314,9 @@ ums_intr_callback(struct usb_xfer *xfer, if (++info != &sc->sc_info[UMS_INFO_MAX]) goto repeat; +#ifdef EVDEV_SUPPORT + buttons_reported = buttons; +#endif /* keep old button value(s) for non-detected buttons */ buttons |= sc->sc_status.button & ~buttons_found; @@ -351,6 +362,11 @@ ums_intr_callback(struct usb_xfer *xfer, usb_callout_stop(&sc->sc_callout); ums_put_queue(sc, dx, dy, dz, dt, buttons); +#ifdef EVDEV_SUPPORT + ums_evdev_push(sc, dx, dy, dz, dt, + buttons_reported); +#endif + } } case USB_ST_SETUP: @@ -720,7 +736,7 @@ ums_attach(device_t dev) for (i = 0; i < info->sc_buttons; i++) evdev_support_key(sc->sc_evdev, BTN_MOUSE + i); - err = evdev_register(sc->sc_evdev); + err = evdev_register_mtx(sc->sc_evdev, &sc->sc_mtx); if (err) goto detach; #endif @@ -891,27 +907,32 @@ ums_put_queue(struct ums_softc *sc, int3 } usb_fifo_put_data_linear(sc->sc_fifo.fp[USB_FIFO_RX], buf, sc->sc_mode.packetsize, 1); - -#ifdef EVDEV_SUPPORT - if (evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE) { - /* Push evdev event */ - evdev_push_event(sc->sc_evdev, EV_REL, REL_X, dx); - evdev_push_event(sc->sc_evdev, EV_REL, REL_Y, -dy); - evdev_push_event(sc->sc_evdev, EV_REL, REL_WHEEL, -dz); - evdev_push_event(sc->sc_evdev, EV_REL, REL_HWHEEL, dt); - evdev_push_mouse_btn(sc->sc_evdev, - (buttons & ~MOUSE_STDBUTTONS) | - (buttons & (1 << 2) ? MOUSE_BUTTON1DOWN : 0) | - (buttons & (1 << 1) ? MOUSE_BUTTON2DOWN : 0) | - (buttons & (1 << 0) ? MOUSE_BUTTON3DOWN : 0)); - evdev_sync(sc->sc_evdev); - } -#endif } else { DPRINTF("Buffer full, discarded packet\n"); } } +#ifdef EVDEV_SUPPORT +static void +ums_evdev_push(struct ums_softc *sc, int32_t dx, int32_t dy, + int32_t dz, int32_t dt, int32_t buttons) +{ + if (evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE) { + /* Push evdev event */ + evdev_push_rel(sc->sc_evdev, REL_X, dx); + evdev_push_rel(sc->sc_evdev, REL_Y, -dy); + evdev_push_rel(sc->sc_evdev, REL_WHEEL, -dz); + evdev_push_rel(sc->sc_evdev, REL_HWHEEL, dt); + evdev_push_mouse_btn(sc->sc_evdev, + (buttons & ~MOUSE_STDBUTTONS) | + (buttons & (1 << 2) ? MOUSE_BUTTON1DOWN : 0) | + (buttons & (1 << 1) ? MOUSE_BUTTON2DOWN : 0) | + (buttons & (1 << 0) ? MOUSE_BUTTON3DOWN : 0)); + evdev_sync(sc->sc_evdev); + } +} +#endif + static void ums_reset_buf(struct ums_softc *sc) { @@ -925,7 +946,7 @@ ums_ev_open(struct evdev_dev *evdev, voi { struct ums_softc *sc = (struct ums_softc *)ev_softc; - mtx_lock(&sc->sc_mtx); + mtx_assert(&sc->sc_mtx, MA_OWNED); sc->sc_evflags = UMS_EVDEV_OPENED; @@ -934,8 +955,6 @@ ums_ev_open(struct evdev_dev *evdev, voi ums_start_rx(sc); } - mtx_unlock(&sc->sc_mtx); - return (0); } @@ -944,14 +963,12 @@ ums_ev_close(struct evdev_dev *evdev, vo { struct ums_softc *sc = (struct ums_softc *)ev_softc; - mtx_lock(&sc->sc_mtx); + mtx_assert(&sc->sc_mtx, MA_OWNED); sc->sc_evflags = 0; if (sc->sc_fflags == 0) ums_stop_rx(sc); - - mtx_unlock(&sc->sc_mtx); } #endif From owner-svn-src-all@freebsd.org Sun Nov 6 23:13:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEA3AC3319C; Sun, 6 Nov 2016 23:13:15 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8FCC4E15; Sun, 6 Nov 2016 23:13:15 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA6NDEvP014257; Sun, 6 Nov 2016 23:13:14 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA6NDDdv014248; Sun, 6 Nov 2016 23:13:13 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201611062313.uA6NDDdv014248@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 6 Nov 2016 23:13:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308389 - in head/sys/dev/rtwn: . pci rtl8192c rtl8192c/pci usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 23:13:15 -0000 Author: avos Date: Sun Nov 6 23:13:13 2016 New Revision: 308389 URL: https://svnweb.freebsd.org/changeset/base/308389 Log: rtwn: add HOSTAP / IBSS mode support for RTL8188CE. NOTE: some multi-vap configurations (e.g., STA+IBSS) are not stable; that will be fixed later. Tested with: - RTL8188CE, STA + AP mode; - RTL8188CE, IBSS mode; - RTL8188CUS, IBSS mode; - RTL8188EU, IBSS mode. Relnotes: yes Modified: head/sys/dev/rtwn/if_rtwn.c head/sys/dev/rtwn/if_rtwn_beacon.c head/sys/dev/rtwn/if_rtwnvar.h head/sys/dev/rtwn/pci/rtwn_pci_attach.c head/sys/dev/rtwn/pci/rtwn_pci_tx.c head/sys/dev/rtwn/pci/rtwn_pci_var.h head/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c head/sys/dev/rtwn/rtl8192c/r92c_beacon.c head/sys/dev/rtwn/usb/rtwn_usb_attach.c Modified: head/sys/dev/rtwn/if_rtwn.c ============================================================================== --- head/sys/dev/rtwn/if_rtwn.c Sun Nov 6 21:41:26 2016 (r308388) +++ head/sys/dev/rtwn/if_rtwn.c Sun Nov 6 23:13:13 2016 (r308389) @@ -628,10 +628,10 @@ rtwn_vap_delete(struct ieee80211vap *vap ieee80211_draintask(ic, &ic->ic_parent_task); RTWN_LOCK(sc); - if (uvp->bcn_mbuf != NULL) - m_freem(uvp->bcn_mbuf); /* Cancel any unfinished Tx. */ rtwn_reset_lists(sc, vap); + if (uvp->bcn_mbuf != NULL) + m_freem(uvp->bcn_mbuf); rtwn_vap_decrement_counters(sc, vap->iv_opmode, uvp->id); rtwn_set_ic_opmode(sc); if (sc->sc_flags & RTWN_RUNNING) @@ -822,8 +822,10 @@ rtwn_push_nulldata(struct rtwn_softc *sc rtwn_setbits_1_shift(sc, R92C_FWHW_TXQ_CTRL, R92C_FWHW_TXQ_CTRL_REAL_BEACON, 0, 2); - if (uvp->bcn_mbuf != NULL) + if (uvp->bcn_mbuf != NULL) { + rtwn_beacon_unload(sc, uvp->id); m_freem(uvp->bcn_mbuf); + } m->m_pkthdr.len = m->m_len = required_size - sc->txdesc_len; uvp->bcn_mbuf = m; @@ -1268,6 +1270,9 @@ rtwn_run(struct rtwn_softc *sc, struct i } #endif + /* Enable TSF synchronization. */ + rtwn_tsf_sync_enable(sc, vap); + if (vap->iv_opmode == IEEE80211_M_HOSTAP || vap->iv_opmode == IEEE80211_M_IBSS) { error = rtwn_setup_beacon(sc, ni); @@ -1282,9 +1287,6 @@ rtwn_run(struct rtwn_softc *sc, struct i /* Set ACK preamble type. */ rtwn_set_ack_preamble(sc); - /* Enable TSF synchronization. */ - rtwn_tsf_sync_enable(sc, vap); - /* Set basic rates mask. */ rtwn_calc_basicrates(sc); Modified: head/sys/dev/rtwn/if_rtwn_beacon.c ============================================================================== --- head/sys/dev/rtwn/if_rtwn_beacon.c Sun Nov 6 21:41:26 2016 (r308388) +++ head/sys/dev/rtwn/if_rtwn_beacon.c Sun Nov 6 23:13:13 2016 (r308389) @@ -54,6 +54,7 @@ rtwn_reset_beacon_valid(struct rtwn_soft KASSERT (id == 0 || id == 1, ("wrong port id %d\n", id)); + /* XXX cannot be cleared on RTL8188CE */ rtwn_setbits_1_shift(sc, sc->bcn_status_reg[id], R92C_TDECTRL_BCN_VALID, 0, 2); @@ -79,7 +80,7 @@ rtwn_check_beacon_valid(struct rtwn_soft __func__, id); break; } - rtwn_delay(sc, 100); + rtwn_delay(sc, sc->bcn_check_interval); } if (ntries == 10) return (ETIMEDOUT); @@ -123,8 +124,10 @@ rtwn_setup_beacon(struct rtwn_softc *sc, return (ENOMEM); } - if (uvp->bcn_mbuf != NULL) + if (uvp->bcn_mbuf != NULL) { + rtwn_beacon_unload(sc, uvp->id); m_freem(uvp->bcn_mbuf); + } uvp->bcn_mbuf = m; @@ -173,6 +176,7 @@ rtwn_update_beacon(struct ieee80211vap * return; } } + rtwn_beacon_update_begin(sc, vap); RTWN_UNLOCK(sc); if (item == IEEE80211_BEACON_TIM) @@ -183,6 +187,7 @@ rtwn_update_beacon(struct ieee80211vap * RTWN_LOCK(sc); rtwn_tx_beacon(sc, uvp); + rtwn_beacon_update_end(sc, vap); RTWN_UNLOCK(sc); } Modified: head/sys/dev/rtwn/if_rtwnvar.h ============================================================================== --- head/sys/dev/rtwn/if_rtwnvar.h Sun Nov 6 21:41:26 2016 (r308388) +++ head/sys/dev/rtwn/if_rtwnvar.h Sun Nov 6 23:13:13 2016 (r308389) @@ -277,6 +277,14 @@ struct rtwn_softc { uint16_t (*sc_get_qmap)(struct rtwn_softc *); void (*sc_set_desc_addr)(struct rtwn_softc *); void (*sc_drop_incorrect_tx)(struct rtwn_softc *); + void (*sc_beacon_update_begin)(struct rtwn_softc *, + struct ieee80211vap *); + void (*sc_beacon_update_end)(struct rtwn_softc *, + struct ieee80211vap *); + void (*sc_beacon_unload)(struct rtwn_softc *, int); + + /* XXX drop checks for PCIe? */ + int bcn_check_interval; /* Device-specific. */ uint32_t (*sc_rf_read)(struct rtwn_softc *, int, uint8_t); @@ -445,6 +453,12 @@ void rtwn_suspend(struct rtwn_softc *); (((_sc)->sc_set_desc_addr)((_sc))) #define rtwn_drop_incorrect_tx(_sc) \ (((_sc)->sc_drop_incorrect_tx)((_sc))) +#define rtwn_beacon_update_begin(_sc, _vap) \ + (((_sc)->sc_beacon_update_begin)((_sc), (_vap))) +#define rtwn_beacon_update_end(_sc, _vap) \ + (((_sc)->sc_beacon_update_end)((_sc), (_vap))) +#define rtwn_beacon_unload(_sc, _id) \ + (((_sc)->sc_beacon_unload)((_sc), (_id))) /* Aliases. */ #define rtwn_bb_write rtwn_write_4 Modified: head/sys/dev/rtwn/pci/rtwn_pci_attach.c ============================================================================== --- head/sys/dev/rtwn/pci/rtwn_pci_attach.c Sun Nov 6 21:41:26 2016 (r308388) +++ head/sys/dev/rtwn/pci/rtwn_pci_attach.c Sun Nov 6 23:13:13 2016 (r308389) @@ -87,6 +87,10 @@ static int rtwn_pci_fw_write_block(struc const uint8_t *, uint16_t, int); static uint16_t rtwn_pci_get_qmap(struct rtwn_softc *); static void rtwn_pci_set_desc_addr(struct rtwn_softc *); +static void rtwn_pci_beacon_update_begin(struct rtwn_softc *, + struct ieee80211vap *); +static void rtwn_pci_beacon_update_end(struct rtwn_softc *, + struct ieee80211vap *); static void rtwn_pci_attach_methods(struct rtwn_softc *); @@ -539,6 +543,27 @@ rtwn_pci_set_desc_addr(struct rtwn_softc } static void +rtwn_pci_beacon_update_begin(struct rtwn_softc *sc, struct ieee80211vap *vap) +{ + struct rtwn_vap *rvp = RTWN_VAP(vap); + + RTWN_ASSERT_LOCKED(sc); + + rtwn_beacon_enable(sc, rvp->id, 0); +} + +static void +rtwn_pci_beacon_update_end(struct rtwn_softc *sc, struct ieee80211vap *vap) +{ + struct rtwn_vap *rvp = RTWN_VAP(vap); + + RTWN_ASSERT_LOCKED(sc); + + if (rvp->curr_mode != R92C_MSR_NOLINK) + rtwn_beacon_enable(sc, rvp->id, 1); +} + +static void rtwn_pci_attach_methods(struct rtwn_softc *sc) { sc->sc_write_1 = rtwn_pci_write_1; @@ -555,6 +580,11 @@ rtwn_pci_attach_methods(struct rtwn_soft sc->sc_get_qmap = rtwn_pci_get_qmap; sc->sc_set_desc_addr = rtwn_pci_set_desc_addr; sc->sc_drop_incorrect_tx = rtwn_nop_softc; + sc->sc_beacon_update_begin = rtwn_pci_beacon_update_begin; + sc->sc_beacon_update_end = rtwn_pci_beacon_update_end; + sc->sc_beacon_unload = rtwn_pci_reset_beacon_ring; + + sc->bcn_check_interval = 25000; } static int Modified: head/sys/dev/rtwn/pci/rtwn_pci_tx.c ============================================================================== --- head/sys/dev/rtwn/pci/rtwn_pci_tx.c Sun Nov 6 21:41:26 2016 (r308388) +++ head/sys/dev/rtwn/pci/rtwn_pci_tx.c Sun Nov 6 23:13:13 2016 (r308389) @@ -59,8 +59,8 @@ __FBSDID("$FreeBSD$"); static int -rtwn_pci_tx_start_common(struct rtwn_softc *sc, struct ieee80211_node *ni, - struct mbuf *m, uint8_t *tx_desc, uint8_t type, int id) +rtwn_pci_tx_start_frame(struct rtwn_softc *sc, struct ieee80211_node *ni, + struct mbuf *m, uint8_t *tx_desc, uint8_t type) { struct rtwn_pci_softc *pc = RTWN_PCI_SOFTC(sc); struct rtwn_tx_ring *ring; @@ -75,16 +75,13 @@ rtwn_pci_tx_start_common(struct rtwn_sof switch (type) { case IEEE80211_FC0_TYPE_CTL: case IEEE80211_FC0_TYPE_MGT: - qid = RTWN_PCI_VO_QUEUE; + qid = RTWN_PCI_MGNT_QUEUE; break; default: qid = M_WME_GETAC(m); break; } - if (ni == NULL) /* beacon frame */ - qid = RTWN_PCI_BEACON_QUEUE; - ring = &pc->tx_ring[qid]; data = &ring->tx_data[ring->cur]; if (data->m != NULL) { @@ -151,19 +148,16 @@ rtwn_pci_tx_start_common(struct rtwn_sof data->m = m; data->ni = ni; - data->id = id; ring->cur = (ring->cur + 1) % RTWN_PCI_TX_LIST_COUNT; - if (qid != RTWN_PCI_BEACON_QUEUE) { - ring->queued++; - if (ring->queued >= (RTWN_PCI_TX_LIST_COUNT - 1)) - sc->qfullmsk |= (1 << qid); + ring->queued++; + if (ring->queued >= (RTWN_PCI_TX_LIST_COUNT - 1)) + sc->qfullmsk |= (1 << qid); #ifndef D4054 - sc->sc_tx_timer = 5; + sc->sc_tx_timer = 5; #endif - } /* Kick TX. */ rtwn_write_2(sc, R92C_PCIE_CTRL_REG, (1 << qid)); @@ -171,25 +165,77 @@ rtwn_pci_tx_start_common(struct rtwn_sof return (0); } +static int +rtwn_pci_tx_start_beacon(struct rtwn_softc *sc, struct mbuf *m, + uint8_t *tx_desc, int id) +{ + struct rtwn_pci_softc *pc = RTWN_PCI_SOFTC(sc); + struct rtwn_tx_ring *ring; + struct rtwn_tx_data *data; + struct rtwn_tx_desc_common *txd; + bus_dma_segment_t segs[1]; + int nsegs, error, own; + + RTWN_ASSERT_LOCKED(sc); + + KASSERT(id == 0 || id == 1, ("bogus vap id %d\n", id)); + + ring = &pc->tx_ring[RTWN_PCI_BEACON_QUEUE]; + data = &ring->tx_data[id]; + txd = (struct rtwn_tx_desc_common *) + ((uint8_t *)ring->desc + id * sc->txdesc_len); + + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, + BUS_DMASYNC_POSTREAD); + own = !!(txd->flags0 & RTWN_FLAGS0_OWN); + error = 0; + if (!own || txd->pktlen != htole16(m->m_pkthdr.len)) { + if (!own) { + /* Copy Tx descriptor. */ + rtwn_pci_copy_tx_desc(pc, txd, tx_desc); + txd->offset = sc->txdesc_len; + } else { + /* Reload mbuf. */ + bus_dmamap_unload(ring->data_dmat, data->map); + } + + error = bus_dmamap_load_mbuf_sg(ring->data_dmat, + data->map, m, segs, &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->sc_dev, + "can't map beacon (error %d)\n", error); + txd->flags0 &= ~RTWN_FLAGS0_OWN; + goto end; + } + + txd->pktlen = htole16(m->m_pkthdr.len); + rtwn_pci_tx_postsetup(pc, txd, segs); + txd->flags0 |= RTWN_FLAGS0_OWN; +end: + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, + BUS_DMASYNC_PREWRITE); + } + + /* Dump Tx descriptor. */ + rtwn_dump_tx_desc(sc, txd); + + bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_PREWRITE); + + return (0); +} + int rtwn_pci_tx_start(struct rtwn_softc *sc, struct ieee80211_node *ni, struct mbuf *m, uint8_t *tx_desc, uint8_t type, int id) { int error = 0; - if (ni == NULL) { /* beacon frame */ - m = m_dup(m, M_NOWAIT); - if (__predict_false(m == NULL)) { - device_printf(sc->sc_dev, - "%s: could not copy beacon frame\n", __func__); - return (ENOMEM); - } + RTWN_ASSERT_LOCKED(sc); - error = rtwn_pci_tx_start_common(sc, ni, m, tx_desc, type, id); - if (error != 0) - m_freem(m); - } else - error = rtwn_pci_tx_start_common(sc, ni, m, tx_desc, type, id); + if (ni == NULL) /* beacon frame */ + error = rtwn_pci_tx_start_beacon(sc, m, tx_desc, id); + else + error = rtwn_pci_tx_start_frame(sc, ni, m, tx_desc, type); return (error); } Modified: head/sys/dev/rtwn/pci/rtwn_pci_var.h ============================================================================== --- head/sys/dev/rtwn/pci/rtwn_pci_var.h Sun Nov 6 21:41:26 2016 (r308388) +++ head/sys/dev/rtwn/pci/rtwn_pci_var.h Sun Nov 6 23:13:13 2016 (r308389) @@ -50,7 +50,6 @@ struct rtwn_tx_data { bus_dmamap_t map; struct mbuf *m; struct ieee80211_node *ni; - uint8_t id; }; struct rtwn_tx_ring { Modified: head/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c ============================================================================== --- head/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c Sun Nov 6 21:41:26 2016 (r308388) +++ head/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c Sun Nov 6 23:13:13 2016 (r308389) @@ -141,9 +141,7 @@ r92ce_adj_devcaps(struct rtwn_softc *sc) /* XXX TODO: test everything that removed here before enabling. */ /* XX do NOT enable PMGT until RSVD_PAGE command will not be fixed. */ ic->ic_caps &= ~( - IEEE80211_C_IBSS /* check beaconing / tsf */ - | IEEE80211_C_HOSTAP /* the same */ - | IEEE80211_C_PMGT /* check null frame / device usability */ + IEEE80211_C_PMGT /* check null frame / device usability */ | IEEE80211_C_SWAMSDUTX | IEEE80211_C_FF ); @@ -256,6 +254,12 @@ r92ce_attach(struct rtwn_pci_softc *pc) sc->temp_delta = R92C_CALIB_THRESHOLD; sc->bcn_status_reg[0] = R92C_TDECTRL; + /* + * TODO: some additional setup is required + * to maintain few beacons at the same time. + * + * XXX BCNQ1 mechanism is not needed here; move it to the USB module. + */ sc->bcn_status_reg[1] = R92C_TDECTRL; sc->rcr = 0; Modified: head/sys/dev/rtwn/rtl8192c/r92c_beacon.c ============================================================================== --- head/sys/dev/rtwn/rtl8192c/r92c_beacon.c Sun Nov 6 21:41:26 2016 (r308388) +++ head/sys/dev/rtwn/rtl8192c/r92c_beacon.c Sun Nov 6 23:13:13 2016 (r308389) @@ -68,6 +68,7 @@ r92c_beacon_init(struct rtwn_softc *sc, rtwn_r92c_tx_setup_macid(sc, buf, id); txd->txdw4 |= htole32(R92C_TXDW4_DRVRATE); txd->txdw4 |= htole32(SM(R92C_TXDW4_SEQ_SEL, id)); + txd->txdw4 |= htole32(SM(R92C_TXDW4_PORT_ID, id)); txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, RTWN_RIDX_CCK1)); } Modified: head/sys/dev/rtwn/usb/rtwn_usb_attach.c ============================================================================== --- head/sys/dev/rtwn/usb/rtwn_usb_attach.c Sun Nov 6 21:41:26 2016 (r308388) +++ head/sys/dev/rtwn/usb/rtwn_usb_attach.c Sun Nov 6 23:13:13 2016 (r308389) @@ -81,6 +81,7 @@ static void rtwn_usb_start_xfers(struct static void rtwn_usb_abort_xfers(struct rtwn_softc *); static int rtwn_usb_fw_write_block(struct rtwn_softc *, const uint8_t *, uint16_t, int); +static void rtwn_usb_drop_incorrect_tx(struct rtwn_softc *); static void rtwn_usb_attach_methods(struct rtwn_softc *); #define RTWN_CONFIG_INDEX 0 @@ -318,6 +319,11 @@ rtwn_usb_attach_methods(struct rtwn_soft sc->sc_get_qmap = rtwn_usb_get_qmap; sc->sc_set_desc_addr = rtwn_nop_softc; sc->sc_drop_incorrect_tx = rtwn_usb_drop_incorrect_tx; + sc->sc_beacon_update_begin = rtwn_nop_softc_vap; + sc->sc_beacon_update_end = rtwn_nop_softc_vap; + sc->sc_beacon_unload = rtwn_nop_softc_int; + + sc->bcn_check_interval = 100; } static int From owner-svn-src-all@freebsd.org Mon Nov 7 05:34:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68208C34AA4; Mon, 7 Nov 2016 05:34:45 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03812DC3; Mon, 7 Nov 2016 05:34:44 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA75Yi2d061349; Mon, 7 Nov 2016 05:34:44 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA75Yil1061348; Mon, 7 Nov 2016 05:34:44 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201611070534.uA75Yil1061348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Mon, 7 Nov 2016 05:34:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308390 - head/sys/arm/nvidia/tegra124 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 05:34:45 -0000 Author: mmel Date: Mon Nov 7 05:34:44 2016 New Revision: 308390 URL: https://svnweb.freebsd.org/changeset/base/308390 Log: Rework NVIDIA Tegra124 XUSBPAD driver. - Adapt it for new, incompatible, DT bindings introduced by r306197. - Add support for USB super speed pads/ports. MFC after: 3 weeks Modified: head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c Modified: head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c ============================================================================== --- head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c Sun Nov 6 23:13:13 2016 (r308389) +++ head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c Mon Nov 7 05:34:44 2016 (r308390) @@ -39,26 +39,57 @@ #include #include +#include #include #include #include #include #include +#include + #include #include "phy_if.h" +/* FUSE calibration data. */ +#define FUSE_XUSB_CALIB 0x0F0 +#define FUSE_XUSB_CALIB_HS_CURR_LEVEL_123(x) (((x) >> 15) & 0x3F); +#define FUSE_XUSB_CALIB_HS_IREF_CAP(x) (((x) >> 13) & 0x03); +#define FUSE_XUSB_CALIB_HS_SQUELCH_LEVEL(x) (((x) >> 11) & 0x03); +#define FUSE_XUSB_CALIB_HS_TERM_RANGE_ADJ(x) (((x) >> 7) & 0x0F); +#define FUSE_XUSB_CALIB_HS_CURR_LEVEL_0(x) (((x) >> 0) & 0x3F); + + +/* Registers. */ #define XUSB_PADCTL_USB2_PAD_MUX 0x004 +#define XUSB_PADCTL_USB2_PORT_CAP 0x008 +#define USB2_PORT_CAP_ULPI_PORT_INTERNAL (1 << 25) +#define USB2_PORT_CAP_ULPI_PORT_CAP (1 << 24) +#define USB2_PORT_CAP_PORT_REVERSE_ID(p) (1 << (3 + (p) * 4)) +#define USB2_PORT_CAP_PORT_INTERNAL(p) (1 << (2 + (p) * 4)) +#define USB2_PORT_CAP_PORT_CAP(p, x) (((x) & 3) << ((p) * 4)) +#define USB2_PORT_CAP_PORT_CAP_OTG 0x3 +#define USB2_PORT_CAP_PORT_CAP_DEVICE 0x2 +#define USB2_PORT_CAP_PORT_CAP_HOST 0x1 +#define USB2_PORT_CAP_PORT_CAP_DISABLED 0x0 + +#define XUSB_PADCTL_SS_PORT_MAP 0x014 +#define SS_PORT_MAP_PORT_INTERNAL(p) (1 << (3 + (p) * 4)) +#define SS_PORT_MAP_PORT_MAP(p, x) (((x) & 7) << ((p) * 4)) + #define XUSB_PADCTL_ELPG_PROGRAM 0x01C #define ELPG_PROGRAM_AUX_MUX_LP0_VCORE_DOWN (1 << 26) #define ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN_EARLY (1 << 25) #define ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN (1 << 24) +#define ELPG_PROGRAM_SSP_ELPG_VCORE_DOWN(x) (1 << (18 + (x) * 4)) +#define ELPG_PROGRAM_SSP_ELPG_CLAMP_EN_EARLY(x) (1 << (17 + (x) * 4)) +#define ELPG_PROGRAM_SSP_ELPG_CLAMP_EN(x) (1 << (16 + (x) * 4)) #define XUSB_PADCTL_IOPHY_PLL_P0_CTL1 0x040 #define IOPHY_PLL_P0_CTL1_PLL0_LOCKDET (1 << 19) -#define IOPHY_PLL_P0_CTL1_REFCLK_SEL_MASK (0xf<< 12) +#define IOPHY_PLL_P0_CTL1_REFCLK_SEL(x) (((x) & 0xF) << 12) #define IOPHY_PLL_P0_CTL1_PLL_RST (1 << 1) #define XUSB_PADCTL_IOPHY_PLL_P0_CTL2 0x044 @@ -66,8 +97,59 @@ #define IOPHY_PLL_P0_CTL2_TXCLKREF_EN (1 << 5) #define IOPHY_PLL_P0_CTL2_TXCLKREF_SEL (1 << 4) +#define XUSB_PADCTL_IOPHY_USB3_PAD_CTL2(x) (0x058 + (x) * 4) +#define IOPHY_USB3_PAD_CTL2_CDR_CNTL(x) (((x) & 0x00FF) << 4) +#define IOPHY_USB3_PAD_CTL2_RX_EQ(x) (((x) & 0xFFFF) << 8) +#define IOPHY_USB3_PAD_CTL2_RX_WANDER(x) (((x) & 0x000F) << 4) +#define IOPHY_USB3_PAD_CTL2_RX_TERM_CNTL(x) (((x) & 0x0003) << 2) +#define IOPHY_USB3_PAD_CTL2_TX_TERM_CNTL(x) (((x) & 0x0003) << 0) + + +#define XUSB_PADCTL_IOPHY_USB3_PAD_CTL4(x) (0x068 + (x) * 4) + +#define XUSB_PADCTL_USB2_OTG_PAD_CTL0(x) (0x0A0 + (x) * 4) +#define USB2_OTG_PAD_CTL0_LSBIAS_SEL (1 << 23) +#define USB2_OTG_PAD_CTL0_DISCON_DETECT_METHOD (1 << 22) +#define USB2_OTG_PAD_CTL0_PD_ZI (1 << 21) +#define USB2_OTG_PAD_CTL0_PD2 (1 << 20) +#define USB2_OTG_PAD_CTL0_PD (1 << 19) +#define USB2_OTG_PAD_CTL0_TERM_EN (1 << 18) +#define USB2_OTG_PAD_CTL0_LS_LS_FSLEW(x) (((x) & 0x03) << 16) +#define USB2_OTG_PAD_CTL0_LS_RSLEW(x) (((x) & 0x03) << 14) +#define USB2_OTG_PAD_CTL0_FS_SLEW(x) (((x) & 0x03) << 12) +#define USB2_OTG_PAD_CTL0_HS_SLEW(x) (((x) & 0x3F) << 6) +#define USB2_OTG_PAD_CTL0_HS_CURR_LEVEL(x) (((x) & 0x3F) << 0) + +#define XUSB_PADCTL_USB2_OTG_PAD_CTL1(x) (0x0AC + (x) * 4) +#define USB2_OTG_PAD_CTL1_RPU_RANGE_ADJ(x) (((x) & 0x3) << 11) +#define USB2_OTG_PAD_CTL1_HS_IREF_CAP(x) (((x) & 0x3) << 9) +#define USB2_OTG_PAD_CTL1_SPARE(x) (((x) & 0x3) << 7) +#define USB2_OTG_PAD_CTL1_TERM_RANGE_ADJ(x) (((x) & 0xF) << 3) +#define USB2_OTG_PAD_CTL1_PD_DR (1 << 2) +#define USB2_OTG_PAD_CTL1_PD_DISC_FORCE_POWERUP (1 << 1) +#define USB2_OTG_PAD_CTL1_PD_CHRP_FORCE_POWERUP (1 << 0) + +#define XUSB_PADCTL_USB2_BIAS_PAD_CTL0 0x0B8 +#define USB2_BIAS_PAD_CTL0_ADJRPU(x) (((x) & 0x7) << 14) +#define USB2_BIAS_PAD_CTL0_PD_TRK (1 << 13) +#define USB2_BIAS_PAD_CTL0_PD (1 << 12) +#define USB2_BIAS_PAD_CTL0_TERM_OFFSETL(x) (((x) & 0x3) << 9) +#define USB2_BIAS_PAD_CTL0_VBUS_LEVEL(x) (((x) & 0x3) << 7) +#define USB2_BIAS_PAD_CTL0_HS_CHIRP_LEVEL(x) (((x) & 0x3) << 5) +#define USB2_BIAS_PAD_CTL0_HS_DISCON_LEVEL(x) (((x) & 0x7) << 2) +#define USB2_BIAS_PAD_CTL0_HS_SQUELCH_LEVEL(x) (((x) & 0x3) << 0) + +#define XUSB_PADCTL_HSIC_PAD0_CTL0 0x0C8 +#define HSIC_PAD0_CTL0_HSIC_OPT(x) (((x) & 0xF) << 16) +#define HSIC_PAD0_CTL0_TX_SLEWN(x) (((x) & 0xF) << 12) +#define HSIC_PAD0_CTL0_TX_SLEWP(x) (((x) & 0xF) << 8) +#define HSIC_PAD0_CTL0_TX_RTUNEN(x) (((x) & 0xF) << 4) +#define HSIC_PAD0_CTL0_TX_RTUNEP(x) (((x) & 0xF) << 0) #define XUSB_PADCTL_USB3_PAD_MUX 0x134 +#define USB3_PAD_MUX_PCIE_IDDQ_DISABLE(x) (1 << (1 + (x))) +#define USB3_PAD_MUX_SATA_IDDQ_DISABLE (1 << 6) + #define XUSB_PADCTL_IOPHY_PLL_S0_CTL1 0x138 #define IOPHY_PLL_S0_CTL1_PLL1_LOCKDET (1 << 27) @@ -90,17 +172,25 @@ #define XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL5 0x158 #define XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL6 0x15C -struct lane_cfg { - char *function; - char **lanes; - int iddq; -}; -struct xusbpadctl_softc { +#define WR4(_sc, _r, _v) bus_write_4((_sc)->mem_res, (_r), (_v)) +#define RD4(_sc, _r) bus_read_4((_sc)->mem_res, (_r)) + + +struct padctl_softc { device_t dev; struct resource *mem_res; - hwreset_t rst; + hwreset_t rst; int phy_ena_cnt; + + /* Fuses calibration data */ + uint32_t hs_curr_level_0; + uint32_t hs_curr_level_123; + uint32_t hs_iref_cap; + uint32_t hs_term_range_adj; + uint32_t hs_squelch_level; + + uint32_t hs_curr_level_offset; }; static struct ofw_compat_data compat_data[] = { @@ -108,274 +198,295 @@ static struct ofw_compat_data compat_dat {NULL, 0}, }; -struct padctl_lane { - const char *name; - bus_size_t reg; - uint32_t shift; - uint32_t mask; - int iddq; - char **mux; - int nmux; +/* Ports. */ +enum padctl_port_type { + PADCTL_PORT_USB2, + PADCTL_PORT_ULPI, + PADCTL_PORT_HSIC, + PADCTL_PORT_USB3, }; -static char *otg_mux[] = {"snps", "xusb", "uart", "rsvd"}; -static char *usb_mux[] = {"snps", "xusb"}; -static char *pci_mux[] = {"pcie", "usb3", "sata", "rsvd"}; - -#define LANE(n, r, s, m, i, mx) \ -{ \ - .name = n, \ - .reg = r, \ - .shift = s, \ - .mask = m, \ - .iddq = i, \ - .mux = mx, \ - .nmux = nitems(mx), \ -} - -static const struct padctl_lane lanes_tbl[] = { - LANE("otg-0", XUSB_PADCTL_USB2_PAD_MUX, 0, 0x3, -1, otg_mux), - LANE("otg-1", XUSB_PADCTL_USB2_PAD_MUX, 2, 0x3, -1, otg_mux), - LANE("otg-2", XUSB_PADCTL_USB2_PAD_MUX, 4, 0x3, -1, otg_mux), - LANE("ulpi-0", XUSB_PADCTL_USB2_PAD_MUX, 12, 0x1, -1, usb_mux), - LANE("hsic-0", XUSB_PADCTL_USB2_PAD_MUX, 14, 0x1, -1, usb_mux), - LANE("hsic-1", XUSB_PADCTL_USB2_PAD_MUX, 15, 0x1, -1, usb_mux), - LANE("pcie-0", XUSB_PADCTL_USB3_PAD_MUX, 16, 0x3, 1, pci_mux), - LANE("pcie-1", XUSB_PADCTL_USB3_PAD_MUX, 18, 0x3, 2, pci_mux), - LANE("pcie-2", XUSB_PADCTL_USB3_PAD_MUX, 20, 0x3, 3, pci_mux), - LANE("pcie-3", XUSB_PADCTL_USB3_PAD_MUX, 22, 0x3, 4, pci_mux), - LANE("pcie-4", XUSB_PADCTL_USB3_PAD_MUX, 24, 0x3, 5, pci_mux), - LANE("sata-0", XUSB_PADCTL_USB3_PAD_MUX, 26, 0x3, 6, pci_mux), +struct padctl_lane; +struct padctl_port { + enum padctl_port_type type; + const char *name; + const char *base_name; + int idx; + int (*init)(struct padctl_softc *sc, + struct padctl_port *port); + + /* Runtime data. */ + phandle_t xref; + bool enabled; + regulator_t supply_vbus; /* USB2, USB3 */ + bool internal; /* ULPI, USB2, USB3 */ + uint32_t companion; /* USB3 */ + struct padctl_lane *lane; }; -static int -xusbpadctl_mux_function(const struct padctl_lane *lane, char *fnc_name) -{ - int i; - - for (i = 0; i < lane->nmux; i++) { - if (strcmp(fnc_name, lane->mux[i]) == 0) - return (i); - } +static int usb3_port_init(struct padctl_softc *sc, struct padctl_port *port); - return (-1); +#define PORT(t, n, p, i) { \ + .type = t, \ + .name = n "-" #p, \ + .base_name = n, \ + .idx = p, \ + .init = i, \ } +static struct padctl_port ports_tbl[] = { + PORT(PADCTL_PORT_USB2, "usb2", 0, NULL), + PORT(PADCTL_PORT_USB2, "usb2", 1, NULL), + PORT(PADCTL_PORT_USB2, "usb2", 2, NULL), + PORT(PADCTL_PORT_ULPI, "ulpi", 0, NULL), + PORT(PADCTL_PORT_HSIC, "hsic", 0, NULL), + PORT(PADCTL_PORT_HSIC, "hsic", 1, NULL), + PORT(PADCTL_PORT_USB3, "usb3", 0, usb3_port_init), + PORT(PADCTL_PORT_USB3, "usb3", 1, usb3_port_init), +}; -static int -xusbpadctl_config_lane(struct xusbpadctl_softc *sc, char *lane_name, - const struct padctl_lane *lane, struct lane_cfg *cfg) -{ - - int tmp; - uint32_t reg; +/* Pads - a group of lannes. */ +enum padctl_pad_type { + PADCTL_PAD_USB2, + PADCTL_PAD_ULPI, + PADCTL_PAD_HSIC, + PADCTL_PAD_PCIE, + PADCTL_PAD_SATA, +}; - reg = bus_read_4(sc->mem_res, lane->reg); - if (cfg->function != NULL) { - tmp = xusbpadctl_mux_function(lane, cfg->function); - if (tmp == -1) { - device_printf(sc->dev, - "Unknown function %s for lane %s\n", cfg->function, - lane_name); - return (EINVAL); - } - reg &= ~(lane->mask << lane->shift); - reg |= (tmp & lane->mask) << lane->shift; - } - if (cfg->iddq != -1) { - if (lane->iddq == -1) { - device_printf(sc->dev, "Invalid IDDQ for lane %s\n", - lane_name); - return (EINVAL); - } - if (cfg->iddq != 0) - reg &= ~(1 << lane->iddq); - else - reg |= 1 << lane->iddq; - } +struct padctl_lane; +struct padctl_pad { + const char *name; + enum padctl_pad_type type; + int (*powerup)(struct padctl_softc *sc, + struct padctl_lane *lane); + int (*powerdown)(struct padctl_softc *sc, + struct padctl_lane *lane); + /* Runtime data. */ + bool enabled; + struct padctl_lane *lanes[8]; /* Safe maximum value. */ + int nlanes; +}; - bus_write_4(sc->mem_res, lane->reg, reg); - return (0); +static int usb2_powerup(struct padctl_softc *sc, struct padctl_lane *lane); +static int usb2_powerdown(struct padctl_softc *sc, struct padctl_lane *lane); +static int pcie_powerup(struct padctl_softc *sc, struct padctl_lane *lane); +static int pcie_powerdown(struct padctl_softc *sc, struct padctl_lane *lane); +static int sata_powerup(struct padctl_softc *sc, struct padctl_lane *lane); +static int sata_powerdown(struct padctl_softc *sc, struct padctl_lane *lane); + +#define PAD(n, t, u, d) { \ + .name = n, \ + .type = t, \ + .powerup = u, \ + .powerdown = d, \ } +static struct padctl_pad pads_tbl[] = { + PAD("usb2", PADCTL_PAD_USB2, usb2_powerup, usb2_powerdown), + PAD("ulpi", PADCTL_PAD_ULPI, NULL, NULL), + PAD("hsic", PADCTL_PAD_HSIC, NULL, NULL), + PAD("pcie", PADCTL_PAD_PCIE, pcie_powerup, pcie_powerdown), + PAD("sata", PADCTL_PAD_SATA, sata_powerup, sata_powerdown), +}; -static const struct padctl_lane * -xusbpadctl_search_lane(char *lane_name) -{ - int i; - - for (i = 0; i < nitems(lanes_tbl); i++) { - if (strcmp(lane_name, lanes_tbl[i].name) == 0) - return (&lanes_tbl[i]); - } +/* Lanes. */ +static char *otg_mux[] = {"snps", "xusb", "uart", "rsvd"}; +static char *usb_mux[] = {"snps", "xusb"}; +static char *pci_mux[] = {"pcie", "usb3-ss", "sata", "rsvd"}; - return (NULL); -} +struct padctl_lane { + const char *name; + int idx; + bus_size_t reg; + uint32_t shift; + uint32_t mask; + char **mux; + int nmux; + /* Runtime data. */ + bool enabled; + phandle_t xref; + struct padctl_pad *pad; + struct padctl_port *port; + int mux_idx; -static int -xusbpadctl_config_node(struct xusbpadctl_softc *sc, char *lane_name, - struct lane_cfg *cfg) -{ - const struct padctl_lane *lane; - int rv; +}; - lane = xusbpadctl_search_lane(lane_name); - if (lane == NULL) { - device_printf(sc->dev, "Unknown lane: %s\n", lane_name); - return (ENXIO); - } - rv = xusbpadctl_config_lane(sc, lane_name, lane, cfg); - return (rv); +#define LANE(n, p, r, s, m, mx) { \ + .name = n "-" #p, \ + .idx = p, \ + .reg = r, \ + .shift = s, \ + .mask = m, \ + .mux = mx, \ + .nmux = nitems(mx), \ } +static struct padctl_lane lanes_tbl[] = { + LANE("usb2", 0, XUSB_PADCTL_USB2_PAD_MUX, 0, 0x3, otg_mux), + LANE("usb2", 1, XUSB_PADCTL_USB2_PAD_MUX, 2, 0x3, otg_mux), + LANE("usb2", 2, XUSB_PADCTL_USB2_PAD_MUX, 4, 0x3, otg_mux), + LANE("ulpi", 0, XUSB_PADCTL_USB2_PAD_MUX, 12, 0x1, usb_mux), + LANE("hsic", 0, XUSB_PADCTL_USB2_PAD_MUX, 14, 0x1, usb_mux), + LANE("hsic", 1, XUSB_PADCTL_USB2_PAD_MUX, 15, 0x1, usb_mux), + LANE("pcie", 0, XUSB_PADCTL_USB3_PAD_MUX, 16, 0x3, pci_mux), + LANE("pcie", 1, XUSB_PADCTL_USB3_PAD_MUX, 18, 0x3, pci_mux), + LANE("pcie", 2, XUSB_PADCTL_USB3_PAD_MUX, 20, 0x3, pci_mux), + LANE("pcie", 3, XUSB_PADCTL_USB3_PAD_MUX, 22, 0x3, pci_mux), + LANE("pcie", 4, XUSB_PADCTL_USB3_PAD_MUX, 24, 0x3, pci_mux), + LANE("sata", 0, XUSB_PADCTL_USB3_PAD_MUX, 26, 0x3, pci_mux), +}; -static int -xusbpadctl_read_node(struct xusbpadctl_softc *sc, phandle_t node, - struct lane_cfg *cfg, char **lanes, int *llanes) -{ - int rv; - - *llanes = OF_getprop_alloc(node, "nvidia,lanes", 1, (void **)lanes); - if (*llanes <= 0) - return (ENOENT); +/* Define all possible mappings for USB3 port lanes */ +struct padctl_lane_map { + int port_idx; + enum padctl_pad_type pad_type; + int lane_idx; +}; - /* Read function (mux) settings. */ - rv = OF_getprop_alloc(node, "nvidia,function", 1, - (void **)&cfg->function); - if (rv <= 0) - cfg->function = NULL; - /* Read numeric properties. */ - rv = OF_getencprop(node, "nvidia,iddq", &cfg->iddq, - sizeof(cfg->iddq)); - if (rv <= 0) - cfg->iddq = -1; - return (0); +#define LANE_MAP(pi, pt, li) { \ + .port_idx = pi, \ + .pad_type = pt, \ + .lane_idx = li, \ } +static struct padctl_lane_map lane_map_tbl[] = { + LANE_MAP(0, PADCTL_PAD_PCIE, 0), /* port USB3-0 -> lane PCIE-0 */ + LANE_MAP(1, PADCTL_PAD_PCIE, 1), /* port USB3-1 -> lane PCIE-1 */ + /* -- or -- */ + LANE_MAP(1, PADCTL_PAD_SATA, 0), /* port USB3-1 -> lane SATA-0 */ +}; +static struct padctl_port *search_lane_port(struct padctl_softc *sc, + struct padctl_lane *lane); +/* ------------------------------------------------------------------------- + * + * PHY functions + */ static int -xusbpadctl_process_node(struct xusbpadctl_softc *sc, phandle_t node) +usb3_port_init(struct padctl_softc *sc, struct padctl_port *port) { - struct lane_cfg cfg; - char *lanes, *lname; - int i, len, llanes, rv; - - rv = xusbpadctl_read_node(sc, node, &cfg, &lanes, &llanes); - if (rv != 0) - return (rv); - - len = 0; - lname = lanes; - do { - i = strlen(lname) + 1; - rv = xusbpadctl_config_node(sc, lname, &cfg); - if (rv != 0) - device_printf(sc->dev, - "Cannot configure lane: %s: %d\n", lname, rv); - - len += i; - lname += i; - } while (len < llanes); - - if (lanes != NULL) - OF_prop_free(lanes); - if (cfg.function != NULL) - OF_prop_free(cfg.function); - return (rv); -} - + uint32_t reg; -static int -xusbpadctl_pinctrl_cfg(device_t dev, phandle_t cfgxref) -{ - struct xusbpadctl_softc *sc; - phandle_t node, cfgnode; - int rv; + reg = RD4(sc, XUSB_PADCTL_SS_PORT_MAP); + if (port->internal) + reg &= ~SS_PORT_MAP_PORT_INTERNAL(port->idx); + else + reg |= SS_PORT_MAP_PORT_INTERNAL(port->idx); + reg &= ~SS_PORT_MAP_PORT_MAP(port->idx, ~0); + reg |= SS_PORT_MAP_PORT_MAP(port->idx, port->companion); + WR4(sc, XUSB_PADCTL_SS_PORT_MAP, reg); + + reg = RD4(sc, XUSB_PADCTL_IOPHY_USB3_PAD_CTL2(port->idx)); + reg &= ~IOPHY_USB3_PAD_CTL2_CDR_CNTL(~0); + reg &= ~IOPHY_USB3_PAD_CTL2_RX_EQ(~0); + reg &= ~IOPHY_USB3_PAD_CTL2_RX_WANDER(~0); + reg |= IOPHY_USB3_PAD_CTL2_CDR_CNTL(0x24); + reg |= IOPHY_USB3_PAD_CTL2_RX_EQ(0xF070); + reg |= IOPHY_USB3_PAD_CTL2_RX_WANDER(0xF); + WR4(sc, XUSB_PADCTL_IOPHY_USB3_PAD_CTL2(port->idx), reg); + + WR4(sc, XUSB_PADCTL_IOPHY_USB3_PAD_CTL4(port->idx), + 0x002008EE); + + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); + reg &= ~ELPG_PROGRAM_SSP_ELPG_VCORE_DOWN(port->idx); + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); + DELAY(100); - sc = device_get_softc(dev); - cfgnode = OF_node_from_xref(cfgxref); + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); + reg &= ~ELPG_PROGRAM_SSP_ELPG_CLAMP_EN_EARLY(port->idx); + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); + DELAY(100); - rv = 0; - for (node = OF_child(cfgnode); node != 0; node = OF_peer(node)) { - if (!fdt_is_enabled(node)) - continue; - rv = xusbpadctl_process_node(sc, node); - if (rv != 0) - return (rv); - } + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); + reg &= ~ELPG_PROGRAM_SSP_ELPG_CLAMP_EN(port->idx); + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); + DELAY(100); - return (rv); + return (0); } static int -xusbpadctl_phy_pcie_powerup(struct xusbpadctl_softc *sc) +pcie_powerup(struct padctl_softc *sc, struct padctl_lane *lane) { uint32_t reg; int i; - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); - reg &= ~IOPHY_PLL_P0_CTL1_REFCLK_SEL_MASK; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL1, reg); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); + reg &= ~IOPHY_PLL_P0_CTL1_REFCLK_SEL(~0); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL1, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL2); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL2); reg |= IOPHY_PLL_P0_CTL2_REFCLKBUF_EN; reg |= IOPHY_PLL_P0_CTL2_TXCLKREF_EN; reg |= IOPHY_PLL_P0_CTL2_TXCLKREF_SEL; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL2, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL2, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); reg |= IOPHY_PLL_P0_CTL1_PLL_RST; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL1, reg); DELAY(100); - for (i = 0; i < 100; i++) { - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); + for (i = 100; i > 0; i--) { + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); if (reg & IOPHY_PLL_P0_CTL1_PLL0_LOCKDET) - return (0); + break; DELAY(10); } + if (i <= 0) { + device_printf(sc->dev, "Failed to power up PCIe phy\n"); + return (ETIMEDOUT); + } + reg = RD4(sc, XUSB_PADCTL_USB3_PAD_MUX); + reg |= USB3_PAD_MUX_PCIE_IDDQ_DISABLE(lane->idx); + WR4(sc, XUSB_PADCTL_USB3_PAD_MUX, reg); - return (ETIMEDOUT); + return (0); } - static int -xusbpadctl_phy_pcie_powerdown(struct xusbpadctl_softc *sc) +pcie_powerdown(struct padctl_softc *sc, struct padctl_lane *lane) { uint32_t reg; - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); + reg = RD4(sc, XUSB_PADCTL_USB3_PAD_MUX); + reg &= ~USB3_PAD_MUX_PCIE_IDDQ_DISABLE(lane->idx); + WR4(sc, XUSB_PADCTL_USB3_PAD_MUX, reg); + + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); reg &= ~IOPHY_PLL_P0_CTL1_PLL_RST; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL1, reg); DELAY(100); + return (0); } static int -xusbpadctl_phy_sata_powerup(struct xusbpadctl_softc *sc) +sata_powerup(struct padctl_softc *sc, struct padctl_lane *lane) { uint32_t reg; int i; - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1); reg &= ~IOPHY_MISC_PAD_S0_CTL1_IDDQ_OVRD; reg &= ~IOPHY_MISC_PAD_S0_CTL1_IDDQ; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1, reg); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); reg &= ~IOPHY_PLL_S0_CTL1_PLL_PWR_OVRD; reg &= ~IOPHY_PLL_S0_CTL1_PLL_IDDQ; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); reg |= IOPHY_PLL_S0_CTL1_PLL1_MODE; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); reg |= IOPHY_PLL_S0_CTL1_PLL_RST_L; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); for (i = 100; i >= 0; i--) { - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); if (reg & IOPHY_PLL_S0_CTL1_PLL1_LOCKDET) break; DELAY(100); @@ -384,81 +495,188 @@ xusbpadctl_phy_sata_powerup(struct xusbp device_printf(sc->dev, "Failed to power up SATA phy\n"); return (ETIMEDOUT); } + reg = RD4(sc, XUSB_PADCTL_USB3_PAD_MUX); + reg |= IOPHY_PLL_S0_CTL1_PLL_RST_L; + WR4(sc, XUSB_PADCTL_USB3_PAD_MUX, reg); + + reg = RD4(sc, XUSB_PADCTL_USB3_PAD_MUX); + reg |= USB3_PAD_MUX_SATA_IDDQ_DISABLE; + WR4(sc, XUSB_PADCTL_USB3_PAD_MUX, reg); return (0); } static int -xusbpadctl_phy_sata_powerdown(struct xusbpadctl_softc *sc) +sata_powerdown(struct padctl_softc *sc, struct padctl_lane *lane) { uint32_t reg; - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_USB3_PAD_MUX); + reg &= ~USB3_PAD_MUX_SATA_IDDQ_DISABLE; + WR4(sc, XUSB_PADCTL_USB3_PAD_MUX, reg); + + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); reg &= ~IOPHY_PLL_S0_CTL1_PLL_RST_L; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); reg &= ~IOPHY_PLL_S0_CTL1_PLL1_MODE; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); reg |= IOPHY_PLL_S0_CTL1_PLL_PWR_OVRD; reg |= IOPHY_PLL_S0_CTL1_PLL_IDDQ; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1); reg |= IOPHY_MISC_PAD_S0_CTL1_IDDQ_OVRD; reg |= IOPHY_MISC_PAD_S0_CTL1_IDDQ; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1, reg); DELAY(100); return (0); } static int -xusbpadctl_phy_powerup(struct xusbpadctl_softc *sc) +usb2_powerup(struct padctl_softc *sc, struct padctl_lane *lane) { uint32_t reg; + struct padctl_port *port; + int rv; - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM); - reg &= ~ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN; - bus_write_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM, reg); + port = search_lane_port(sc, lane); + if (port == NULL) { + device_printf(sc->dev, "Cannot find port for lane: %s\n", + lane->name); + } + reg = RD4(sc, XUSB_PADCTL_USB2_BIAS_PAD_CTL0); + reg &= ~USB2_BIAS_PAD_CTL0_HS_SQUELCH_LEVEL(~0); + reg &= ~USB2_BIAS_PAD_CTL0_HS_DISCON_LEVEL(~0); + reg |= USB2_BIAS_PAD_CTL0_HS_SQUELCH_LEVEL(sc->hs_squelch_level); + reg |= USB2_BIAS_PAD_CTL0_HS_DISCON_LEVEL(5); + WR4(sc, XUSB_PADCTL_USB2_BIAS_PAD_CTL0, reg); + + reg = RD4(sc, XUSB_PADCTL_USB2_PORT_CAP); + reg &= ~USB2_PORT_CAP_PORT_CAP(lane->idx, ~0); + reg |= USB2_PORT_CAP_PORT_CAP(lane->idx, USB2_PORT_CAP_PORT_CAP_HOST); + WR4(sc, XUSB_PADCTL_USB2_PORT_CAP, reg); + + reg = RD4(sc, XUSB_PADCTL_USB2_OTG_PAD_CTL0(lane->idx)); + reg &= ~USB2_OTG_PAD_CTL0_HS_CURR_LEVEL(~0); + reg &= ~USB2_OTG_PAD_CTL0_HS_SLEW(~0); + reg &= ~USB2_OTG_PAD_CTL0_LS_RSLEW(~0); + reg &= ~USB2_OTG_PAD_CTL0_PD; + reg &= ~USB2_OTG_PAD_CTL0_PD2; + reg &= ~USB2_OTG_PAD_CTL0_PD_ZI; + + reg |= USB2_OTG_PAD_CTL0_HS_SLEW(14); + if (lane->idx == 0) { + reg |= USB2_OTG_PAD_CTL0_HS_CURR_LEVEL(sc->hs_curr_level_0); + reg |= USB2_OTG_PAD_CTL0_LS_RSLEW(3); + } else { + reg |= USB2_OTG_PAD_CTL0_HS_CURR_LEVEL(sc->hs_curr_level_123); + reg |= USB2_OTG_PAD_CTL0_LS_RSLEW(0); + } + WR4(sc, XUSB_PADCTL_USB2_OTG_PAD_CTL0(lane->idx), reg); + + reg = RD4(sc, XUSB_PADCTL_USB2_OTG_PAD_CTL1(lane->idx)); + reg &= ~USB2_OTG_PAD_CTL1_TERM_RANGE_ADJ(~0); + reg &= ~USB2_OTG_PAD_CTL1_HS_IREF_CAP(~0); + reg &= ~USB2_OTG_PAD_CTL1_PD_DR; + reg &= ~USB2_OTG_PAD_CTL1_PD_DISC_FORCE_POWERUP; + reg &= ~USB2_OTG_PAD_CTL1_PD_CHRP_FORCE_POWERUP; + + reg |= USB2_OTG_PAD_CTL1_TERM_RANGE_ADJ(sc->hs_term_range_adj); + reg |= USB2_OTG_PAD_CTL1_HS_IREF_CAP(sc->hs_iref_cap); + WR4(sc, XUSB_PADCTL_USB2_OTG_PAD_CTL1(lane->idx), reg); + + if (port != NULL && port->supply_vbus != NULL) { + rv = regulator_enable(port->supply_vbus); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable vbus regulator\n"); + return (rv); + } + } + reg = RD4(sc, XUSB_PADCTL_USB2_BIAS_PAD_CTL0); + reg &= ~USB2_BIAS_PAD_CTL0_PD; + WR4(sc, XUSB_PADCTL_USB2_BIAS_PAD_CTL0, reg); + + return (0); +} + +static int +usb2_powerdown(struct padctl_softc *sc, struct padctl_lane *lane) +{ + uint32_t reg; + struct padctl_port *port; + int rv; + + port = search_lane_port(sc, lane); + if (port == NULL) { + device_printf(sc->dev, "Cannot find port for lane: %s\n", + lane->name); + } + reg = RD4(sc, XUSB_PADCTL_USB2_BIAS_PAD_CTL0); + reg |= USB2_BIAS_PAD_CTL0_PD; + WR4(sc, XUSB_PADCTL_USB2_BIAS_PAD_CTL0, reg); + + if (port != NULL && port->supply_vbus != NULL) { + rv = regulator_enable(port->supply_vbus); + if (rv != 0) { + device_printf(sc->dev, + "Cannot disable vbus regulator\n"); + return (rv); + } + } + return (0); +} + + +static int +phy_powerup(struct padctl_softc *sc) +{ + uint32_t reg; + + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); + reg &= ~ELPG_PROGRAM_AUX_MUX_LP0_VCORE_DOWN; + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM); - reg &= ~ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN_EARLY; - bus_write_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM, reg); + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); + reg &= ~ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN; + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM); - reg &= ~ELPG_PROGRAM_AUX_MUX_LP0_VCORE_DOWN; - bus_write_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM, reg); + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); + reg &= ~ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN_EARLY; + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); DELAY(100); return (0); } static int -xusbpadctl_phy_powerdown(struct xusbpadctl_softc *sc) +phy_powerdown(struct padctl_softc *sc) { uint32_t reg; - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM); - reg |= ELPG_PROGRAM_AUX_MUX_LP0_VCORE_DOWN; - bus_write_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM, reg); - DELAY(100); - - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM); + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); reg |= ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN_EARLY; - bus_write_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM, reg); + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM); + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); reg |= ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN; - bus_write_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM, reg); + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); + DELAY(100); + + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); + reg |= ELPG_PROGRAM_AUX_MUX_LP0_VCORE_DOWN; + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); DELAY(100); return (0); @@ -467,45 +685,43 @@ xusbpadctl_phy_powerdown(struct xusbpadc static int xusbpadctl_phy_enable(device_t dev, intptr_t id, bool enable) { - struct xusbpadctl_softc *sc; + struct padctl_softc *sc; + struct padctl_lane *lane; + struct padctl_pad *pad; int rv; sc = device_get_softc(dev); - if ((id != TEGRA_XUSB_PADCTL_PCIE) && - (id != TEGRA_XUSB_PADCTL_SATA)) { + if (id < 0 || id >= nitems(lanes_tbl)) { device_printf(dev, "Unknown phy: %d\n", id); return (ENXIO); } - - rv = 0; + lane = lanes_tbl + id; + if (!lane->enabled) { + device_printf(dev, "Lane is not enabled/configured: %s\n", + lane->name); + return (ENXIO); + } + pad = lane->pad; if (enable) { if (sc->phy_ena_cnt == 0) { - rv = xusbpadctl_phy_powerup(sc); + rv = phy_powerup(sc); if (rv != 0) return (rv); } sc->phy_ena_cnt++; } - if (id == TEGRA_XUSB_PADCTL_PCIE) { - if (enable) - rv = xusbpadctl_phy_pcie_powerup(sc); - else - rv = xusbpadctl_phy_pcie_powerdown(sc); - if (rv != 0) - return (rv); - } else if (id == TEGRA_XUSB_PADCTL_SATA) { - if (enable) - rv = xusbpadctl_phy_sata_powerup(sc); - else - rv = xusbpadctl_phy_sata_powerdown(sc); - if (rv != 0) - return (rv); - } + if (enable) + rv = pad->powerup(sc, lane); + else + rv = pad->powerdown(sc, lane); + if (rv != 0) + return (rv); + if (!enable) { if (sc->phy_ena_cnt == 1) { - rv = xusbpadctl_phy_powerdown(sc); + rv = phy_powerdown(sc); if (rv != 0) return (rv); } @@ -516,6 +732,387 @@ xusbpadctl_phy_enable(device_t dev, intp } static int +xusbpadctl_phy_map(device_t provider, phandle_t xref, int ncells, + pcell_t *cells, intptr_t *id) +{ + int i; + + if (ncells != 0) + return (ERANGE); + + for (i = 0; i < nitems(lanes_tbl); i++) { + if (lanes_tbl[i].xref == xref) { + *id = i; + return (0); + } + } + return (ENXIO); +} + +/* ------------------------------------------------------------------------- + * + * FDT processing + */ +static struct padctl_port * +search_port(struct padctl_softc *sc, char *port_name) +{ + int i; + + for (i = 0; i < nitems(ports_tbl); i++) { + if (strcmp(port_name, ports_tbl[i].name) == 0) + return (&ports_tbl[i]); + } + return (NULL); +} + +static struct padctl_port * +search_lane_port(struct padctl_softc *sc, struct padctl_lane *lane) +{ + int i; + + for (i = 0; i < nitems(ports_tbl); i++) { + if (!ports_tbl[i].enabled) + continue; + if (ports_tbl[i].lane == lane) + return (ports_tbl + i); + } + return (NULL); +} + +static struct padctl_lane * +search_lane(struct padctl_softc *sc, char *lane_name) +{ + int i; + + for (i = 0; i < nitems(lanes_tbl); i++) { + if (strcmp(lane_name, lanes_tbl[i].name) == 0) + return (lanes_tbl + i); + } + return (NULL); +} + +static struct padctl_lane * +search_pad_lane(struct padctl_softc *sc, enum padctl_pad_type type, int idx) +{ + int i; + + for (i = 0; i < nitems(lanes_tbl); i++) { + if (!lanes_tbl[i].enabled) + continue; + if (type == lanes_tbl[i].pad->type && idx == lanes_tbl[i].idx) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Nov 7 05:37:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75F14C34B1C; Mon, 7 Nov 2016 05:37:12 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11F05F37; Mon, 7 Nov 2016 05:37:11 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA75bBQI061540; Mon, 7 Nov 2016 05:37:11 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA75bBRZ061536; Mon, 7 Nov 2016 05:37:11 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201611070537.uA75bBRZ061536@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Mon, 7 Nov 2016 05:37:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308391 - in head/sys: arm/conf arm/nvidia arm/nvidia/tegra124 boot/fdt/dts/arm contrib/dev/nvidia X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 05:37:12 -0000 Author: mmel Date: Mon Nov 7 05:37:10 2016 New Revision: 308391 URL: https://svnweb.freebsd.org/changeset/base/308391 Log: Add NVIDIA Tegra XHCI driver and coresponding firmware blob. MFC after: 3 weeks Approved by: core@ (NVIDIA license) Added: head/sys/arm/nvidia/tegra_xhci.c (contents, props changed) head/sys/contrib/dev/nvidia/ head/sys/contrib/dev/nvidia/LICENCE.nvidia head/sys/contrib/dev/nvidia/tegra124_xusb.bin.uu Modified: head/sys/arm/conf/TEGRA124 head/sys/arm/nvidia/tegra124/files.tegra124 head/sys/boot/fdt/dts/arm/tegra124-jetson-tk1-fbsd.dts Modified: head/sys/arm/conf/TEGRA124 ============================================================================== --- head/sys/arm/conf/TEGRA124 Mon Nov 7 05:34:44 2016 (r308390) +++ head/sys/arm/conf/TEGRA124 Mon Nov 7 05:37:10 2016 (r308391) @@ -50,7 +50,7 @@ device vlan # 802.1Q VLAN support #device tun # Packet tunnel. device md # Memory "disks" #device gif # IPv6 and IPv4 tunneling -#device firmware # firmware assist module +device firmware # firmware assist module device ether # Ethernet support device miibus # Required for ethernet device bpf # Berkeley packet filter (required for DHCP) @@ -86,6 +86,8 @@ device pass # Passthrough device (dir # USB support options USB_HOST_ALIGN=64 # Align usb buffers to cache line size. device ehci # EHCI USB interface +device xhci # XHCI USB interface +device tegra124_xusb_fw # Tegra XUSB firmware device usb # USB Bus (required) device umass # Disks/Mass storage - Requires scbus and da device uhid # "Human Interface Devices" Modified: head/sys/arm/nvidia/tegra124/files.tegra124 ============================================================================== --- head/sys/arm/nvidia/tegra124/files.tegra124 Mon Nov 7 05:34:44 2016 (r308390) +++ head/sys/arm/nvidia/tegra124/files.tegra124 Mon Nov 7 05:37:10 2016 (r308391) @@ -24,6 +24,7 @@ arm/nvidia/tegra_uart.c optional uart arm/nvidia/tegra_sdhci.c optional sdhci arm/nvidia/tegra_gpio.c optional gpio arm/nvidia/tegra_ehci.c optional ehci +arm/nvidia/tegra_xhci.c optional xhci arm/nvidia/tegra_ahci.c optional ahci arm/nvidia/tegra_pcie.c optional pci arm/nvidia/tegra_i2c.c optional iic @@ -45,11 +46,25 @@ arm/nvidia/tegra_mc.c standard #arm/nvidia/drm2/tegra_fb.c optional drm2 #arm/nvidia/drm2/tegra_bo.c optional drm2 # -# Optional devices. +# Firmware # - +tegra124_xusb_fw.c optional tegra124_xusb_fw \ + dependency "$S/arm/nvidia/tegra124/files.tegra124" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk tegra124_xusb.fw:tegra124_xusb_fw -mtegra124_xusb_fw -c${.TARGET}" \ + no-implicit-rule before-depend local \ + clean "tegra124_xusb_fw.c" +tegra124_xusb.fwo optional tegra124_xusb_fw \ + dependency "tegra124_xusb.fw" \ + compile-with "${NORMAL_FWO}" \ + no-implicit-rule \ + clean "tegra124_xusb.fwo" +tegra124_xusb.fw optional tegra124_xusb_fw \ + dependency "$S/contrib/dev/nvidia/tegra124_xusb.bin.uu" \ + compile-with "${NORMAL_FW}" \ + no-obj no-implicit-rule \ + clean "tegra124_xusb.fw" # -# Temporary/ to be moved stuff +# Temporary/to be moved stuff # arm/nvidia/as3722.c optional iic arm/nvidia/as3722_regulators.c optional iic Added: head/sys/arm/nvidia/tegra_xhci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/nvidia/tegra_xhci.c Mon Nov 7 05:37:10 2016 (r308391) @@ -0,0 +1,1160 @@ +/*- + * Copyright (c) 2016 Michal Meloun + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * XHCI driver for Tegra SoCs. + */ +#include "opt_bus.h" +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "usbdevs.h" + +/* FPCI address space */ +#define T_XUSB_CFG_0 0x000 +#define T_XUSB_CFG_1 0x004 +#define CFG_1_BUS_MASTER (1 << 2) +#define CFG_1_MEMORY_SPACE (1 << 1) +#define CFG_1_IO_SPACE (1 << 0) + +#define T_XUSB_CFG_2 0x008 +#define T_XUSB_CFG_3 0x00C +#define T_XUSB_CFG_4 0x010 +#define CFG_4_BASE_ADDRESS(x) (((x) & 0x1FFFF) << 15) + +#define T_XUSB_CFG_5 0x014 +#define T_XUSB_CFG_ARU_MAILBOX_CMD 0x0E4 +#define ARU_MAILBOX_CMD_INT_EN (1U << 31) +#define ARU_MAILBOX_CMD_DEST_XHCI (1 << 30) +#define ARU_MAILBOX_CMD_DEST_SMI (1 << 29) +#define ARU_MAILBOX_CMD_DEST_PME (1 << 28) +#define ARU_MAILBOX_CMD_DEST_FALC (1 << 27) + +#define T_XUSB_CFG_ARU_MAILBOX_DATA_IN 0x0E8 +#define ARU_MAILBOX_DATA_IN_DATA(x) (((x) & 0xFFFFFF) << 0) +#define ARU_MAILBOX_DATA_IN_TYPE(x) (((x) & 0x0000FF) << 24) + +#define T_XUSB_CFG_ARU_MAILBOX_DATA_OUT 0x0EC +#define ARU_MAILBOX_DATA_OUT_DATA(x) (((x) >> 0) & 0xFFFFFF) +#define ARU_MAILBOX_DATA_OUT_TYPE(x) (((x) >> 24) & 0x0000FF) + +#define T_XUSB_CFG_ARU_MAILBOX_OWNER 0x0F0 +#define ARU_MAILBOX_OWNER_SW 2 +#define ARU_MAILBOX_OWNER_FW 1 +#define ARU_MAILBOX_OWNER_NONE 0 + +#define XUSB_CFG_ARU_C11_CSBRANGE 0x41C /* ! UNDOCUMENTED ! */ +#define ARU_C11_CSBRANGE_PAGE(x) ((x) >> 9) +#define ARU_C11_CSBRANGE_ADDR(x) (0x800 + ((x) & 0x1FF)) +#define XUSB_CFG_ARU_SMI_INTR 0x428 /* ! UNDOCUMENTED ! */ +#define ARU_SMI_INTR_EN (1 << 3) +#define ARU_SMI_INTR_FW_HANG (1 << 1) +#define XUSB_CFG_ARU_RST 0x42C /* ! UNDOCUMENTED ! */ +#define ARU_RST_RESET (1 << 0) + +#define XUSB_HOST_CONFIGURATION 0x180 +#define CONFIGURATION_CLKEN_OVERRIDE (1U<< 31) +#define CONFIGURATION_PW_NO_DEVSEL_ERR_CYA (1 << 19) +#define CONFIGURATION_INITIATOR_READ_IDLE (1 << 18) +#define CONFIGURATION_INITIATOR_WRITE_IDLE (1 << 17) +#define CONFIGURATION_WDATA_LEAD_CYA (1 << 15) +#define CONFIGURATION_WR_INTRLV_CYA (1 << 14) +#define CONFIGURATION_TARGET_READ_IDLE (1 << 11) +#define CONFIGURATION_TARGET_WRITE_IDLE (1 << 10) +#define CONFIGURATION_MSI_VEC_EMPTY (1 << 9) +#define CONFIGURATION_UFPCI_MSIAW (1 << 7) +#define CONFIGURATION_UFPCI_PWPASSPW (1 << 6) +#define CONFIGURATION_UFPCI_PASSPW (1 << 5) +#define CONFIGURATION_UFPCI_PWPASSNPW (1 << 4) +#define CONFIGURATION_DFPCI_PWPASSNPW (1 << 3) +#define CONFIGURATION_DFPCI_RSPPASSPW (1 << 2) +#define CONFIGURATION_DFPCI_PASSPW (1 << 1) +#define CONFIGURATION_EN_FPCI (1 << 0) + +/* IPFS address space */ +#define XUSB_HOST_FPCI_ERROR_MASKS 0x184 +#define FPCI_ERROR_MASTER_ABORT (1 << 2) +#define FPCI_ERRORI_DATA_ERROR (1 << 1) +#define FPCI_ERROR_TARGET_ABORT (1 << 0) + +#define XUSB_HOST_INTR_MASK 0x188 +#define INTR_IP_INT_MASK (1 << 16) +#define INTR_MSI_MASK (1 << 8) +#define INTR_INT_MASK (1 << 0) + +#define XUSB_HOST_CLKGATE_HYSTERESIS 0x1BC + + /* CSB Falcon CPU */ +#define XUSB_FALCON_CPUCTL 0x100 +#define CPUCTL_STOPPED (1 << 5) +#define CPUCTL_HALTED (1 << 4) +#define CPUCTL_HRESET (1 << 3) +#define CPUCTL_SRESET (1 << 2) +#define CPUCTL_STARTCPU (1 << 1) +#define CPUCTL_IINVAL (1 << 0) + +#define XUSB_FALCON_BOOTVEC 0x104 +#define XUSB_FALCON_DMACTL 0x10C +#define XUSB_FALCON_IMFILLRNG1 0x154 +#define IMFILLRNG1_TAG_HI(x) (((x) & 0xFFF) << 16) +#define IMFILLRNG1_TAG_LO(x) (((x) & 0xFFF) << 0) +#define XUSB_FALCON_IMFILLCTL 0x158 + +/* CSB mempool */ +#define XUSB_CSB_MEMPOOL_APMAP 0x10181C +#define APMAP_BOOTPATH (1U << 31) + +#define XUSB_CSB_MEMPOOL_ILOAD_ATTR 0x101A00 +#define XUSB_CSB_MEMPOOL_ILOAD_BASE_LO 0x101A04 +#define XUSB_CSB_MEMPOOL_ILOAD_BASE_HI 0x101A08 +#define XUSB_CSB_MEMPOOL_L2IMEMOP_SIZE 0x101A10 +#define L2IMEMOP_SIZE_OFFSET(x) (((x) & 0x3FF) << 8) +#define L2IMEMOP_SIZE_SIZE(x) (((x) & 0x0FF) << 24) + +#define XUSB_CSB_MEMPOOL_L2IMEMOP_TRIG 0x101A14 +#define L2IMEMOP_INVALIDATE_ALL (0x40 << 24) +#define L2IMEMOP_LOAD_LOCKED_RESULT (0x11 << 24) + +#define XUSB_CSB_MEMPOOL_L2IMEMOP_RESULT 0x101A18 +#define L2IMEMOP_RESULT_VLD (1U << 31) + +#define XUSB_CSB_IMEM_BLOCK_SIZE 256 + +#define TEGRA_XHCI_SS_HIGH_SPEED 120000000 +#define TEGRA_XHCI_SS_LOW_SPEED 12000000 + +/* MBOX commands. */ +#define MBOX_CMD_MSG_ENABLED 1 +#define MBOX_CMD_INC_FALC_CLOCK 2 +#define MBOX_CMD_DEC_FALC_CLOCK 3 +#define MBOX_CMD_INC_SSPI_CLOCK 4 +#define MBOX_CMD_DEC_SSPI_CLOCK 5 +#define MBOX_CMD_SET_BW 6 +#define MBOX_CMD_SET_SS_PWR_GATING 7 +#define MBOX_CMD_SET_SS_PWR_UNGATING 8 +#define MBOX_CMD_SAVE_DFE_CTLE_CTX 9 +#define MBOX_CMD_AIRPLANE_MODE_ENABLED 10 +#define MBOX_CMD_AIRPLANE_MODE_DISABLED 11 +#define MBOX_CMD_START_HSIC_IDLE 12 +#define MBOX_CMD_STOP_HSIC_IDLE 13 +#define MBOX_CMD_DBC_WAKE_STACK 14 +#define MBOX_CMD_HSIC_PRETEND_CONNECT 15 +#define MBOX_CMD_RESET_SSPI 16 +#define MBOX_CMD_DISABLE_SS_LFPS_DETECTION 17 +#define MBOX_CMD_ENABLE_SS_LFPS_DETECTION 18 + +/* MBOX responses. */ +#define MBOX_CMD_ACK (0x80 + 0) +#define MBOX_CMD_NAK (0x80 + 1) + + +#define IPFS_WR4(_sc, _r, _v) bus_write_4((_sc)->mem_res_ipfs, (_r), (_v)) +#define IPFS_RD4(_sc, _r) bus_read_4((_sc)->mem_res_ipfs, (_r)) +#define FPCI_WR4(_sc, _r, _v) bus_write_4((_sc)->mem_res_fpci, (_r), (_v)) +#define FPCI_RD4(_sc, _r) bus_read_4((_sc)->mem_res_fpci, (_r)) + +#define LOCK(_sc) mtx_lock(&(_sc)->mtx) +#define UNLOCK(_sc) mtx_unlock(&(_sc)->mtx) +#define SLEEP(_sc, timeout) \ + mtx_sleep(sc, &sc->mtx, 0, "tegra_xhci", timeout); +#define LOCK_INIT(_sc) \ + mtx_init(&_sc->mtx, device_get_nameunit(_sc->dev), "tegra_xhci", MTX_DEF) +#define LOCK_DESTROY(_sc) mtx_destroy(&_sc->mtx) +#define ASSERT_LOCKED(_sc) mtx_assert(&_sc->mtx, MA_OWNED) +#define ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->mtx, MA_NOTOWNED) + +struct tegra_xusb_fw_hdr { + uint32_t boot_loadaddr_in_imem; + uint32_t boot_codedfi_offset; + uint32_t boot_codetag; + uint32_t boot_codesize; + + uint32_t phys_memaddr; + uint16_t reqphys_memsize; + uint16_t alloc_phys_memsize; + + uint32_t rodata_img_offset; + uint32_t rodata_section_start; + uint32_t rodata_section_end; + uint32_t main_fnaddr; + + uint32_t fwimg_cksum; + uint32_t fwimg_created_time; + + uint32_t imem_resident_start; + uint32_t imem_resident_end; + uint32_t idirect_start; + uint32_t idirect_end; + uint32_t l2_imem_start; + uint32_t l2_imem_end; + uint32_t version_id; + uint8_t init_ddirect; + uint8_t reserved[3]; + uint32_t phys_addr_log_buffer; + uint32_t total_log_entries; + uint32_t dequeue_ptr; + uint32_t dummy[2]; + uint32_t fwimg_len; + uint8_t magic[8]; + uint32_t ss_low_power_entry_timeout; + uint8_t num_hsic_port; + uint8_t ss_portmap; + uint8_t build; + uint8_t padding[137]; /* Pad to 256 bytes */ +}; + +/* Compatible devices. */ +static struct ofw_compat_data compat_data[] = { + {"nvidia,tegra124-xusb", 1}, + {NULL, 0} +}; + +struct tegra_xhci_softc { + struct xhci_softc xhci_softc; + device_t dev; + struct mtx mtx; + struct resource *mem_res_fpci; + struct resource *mem_res_ipfs; + struct resource *irq_res_mbox; + void *irq_hdl_mbox; + + clk_t clk_xusb_host; + clk_t clk_xusb_gate; + clk_t clk_xusb_falcon_src; + clk_t clk_xusb_ss; + clk_t clk_xusb_hs_src; + clk_t clk_xusb_fs_src; + hwreset_t hwreset_xusb_host; + hwreset_t hwreset_xusb_ss; + regulator_t supply_avddio_pex; + regulator_t supply_dvddio_pex; + regulator_t supply_avdd_usb; + regulator_t supply_avdd_pll_utmip; + regulator_t supply_avdd_pll_erefe; + regulator_t supply_avdd_usb_ss_pll; + regulator_t supply_hvdd_usb_ss; + regulator_t supply_hvdd_usb_ss_pll_e; + phy_t phy_usb2_0; + phy_t phy_usb2_1; + phy_t phy_usb2_2; + phy_t phy_usb3_0; + + struct intr_config_hook irq_hook; + bool xhci_inited; + char *fw_name; + vm_offset_t fw_vaddr; + vm_size_t fw_size; +}; + +static uint32_t +CSB_RD4(struct tegra_xhci_softc *sc, uint32_t addr) +{ + + FPCI_WR4(sc, XUSB_CFG_ARU_C11_CSBRANGE, ARU_C11_CSBRANGE_PAGE(addr)); + return (FPCI_RD4(sc, ARU_C11_CSBRANGE_ADDR(addr))); +} + +static void +CSB_WR4(struct tegra_xhci_softc *sc, uint32_t addr, uint32_t val) +{ + + FPCI_WR4(sc, XUSB_CFG_ARU_C11_CSBRANGE, ARU_C11_CSBRANGE_PAGE(addr)); + FPCI_WR4(sc, ARU_C11_CSBRANGE_ADDR(addr), val); +} + +static int +get_fdt_resources(struct tegra_xhci_softc *sc, phandle_t node) +{ + int rv; + + rv = regulator_get_by_ofw_property(sc->dev, 0, "avddio-pex-supply", + &sc->supply_avddio_pex); + if (rv != 0) { + device_printf(sc->dev, + "Cannot get 'avddio-pex' regulator\n"); + return (ENXIO); + } + rv = regulator_get_by_ofw_property(sc->dev, 0, "dvddio-pex-supply", + &sc->supply_dvddio_pex); + if (rv != 0) { + device_printf(sc->dev, + "Cannot get 'dvddio-pex' regulator\n"); + return (ENXIO); + } + rv = regulator_get_by_ofw_property(sc->dev, 0, "avdd-usb-supply", + &sc->supply_avdd_usb); + if (rv != 0) { + device_printf(sc->dev, + "Cannot get 'avdd-usb' regulator\n"); + return (ENXIO); + } + rv = regulator_get_by_ofw_property(sc->dev, 0, "avdd-pll-utmip-supply", + &sc->supply_avdd_pll_utmip); + if (rv != 0) { + device_printf(sc->dev, + "Cannot get 'avdd-pll-utmip' regulator\n"); + return (ENXIO); + } + rv = regulator_get_by_ofw_property(sc->dev, 0, "avdd-pll-erefe-supply", + &sc->supply_avdd_pll_erefe); + if (rv != 0) { + device_printf(sc->dev, + "Cannot get 'avdd-pll-erefe' regulator\n"); + return (ENXIO); + } + rv = regulator_get_by_ofw_property(sc->dev, 0, "avdd-usb-ss-pll-supply", + &sc->supply_avdd_usb_ss_pll); + if (rv != 0) { + device_printf(sc->dev, + "Cannot get 'avdd-usb-ss-pll' regulator\n"); + return (ENXIO); + } + rv = regulator_get_by_ofw_property(sc->dev, 0, "hvdd-usb-ss-supply", + &sc->supply_hvdd_usb_ss); + if (rv != 0) { + device_printf(sc->dev, + "Cannot get 'hvdd-usb-ss' regulator\n"); + return (ENXIO); + } + rv = regulator_get_by_ofw_property(sc->dev, 0, + "hvdd-usb-ss-pll-e-supply", &sc->supply_hvdd_usb_ss_pll_e); + if (rv != 0) { + device_printf(sc->dev, + "Cannot get 'hvdd-usb-ss-pll-e' regulator\n"); + return (ENXIO); + } + + rv = hwreset_get_by_ofw_name(sc->dev, 0, "xusb_host", + &sc->hwreset_xusb_host); + if (rv != 0) { + device_printf(sc->dev, "Cannot get 'xusb_host' reset\n"); + return (ENXIO); + } + rv = hwreset_get_by_ofw_name(sc->dev, 0, "xusb_ss", + &sc->hwreset_xusb_ss); + if (rv != 0) { + device_printf(sc->dev, "Cannot get 'xusb_ss' reset\n"); + return (ENXIO); + } + + rv = phy_get_by_ofw_name(sc->dev, 0, "usb2-0", &sc->phy_usb2_0); + if (rv != 0) { + device_printf(sc->dev, "Cannot get 'usb2-0' phy\n"); + return (ENXIO); + } + rv = phy_get_by_ofw_name(sc->dev, 0, "usb2-1", &sc->phy_usb2_1); + if (rv != 0) { + device_printf(sc->dev, "Cannot get 'usb2-1' phy\n"); + return (ENXIO); + } + rv = phy_get_by_ofw_name(sc->dev, 0, "usb2-2", &sc->phy_usb2_2); + if (rv != 0) { + device_printf(sc->dev, "Cannot get 'usb2-2' phy\n"); + return (ENXIO); + } + rv = phy_get_by_ofw_name(sc->dev, 0, "usb3-0", &sc->phy_usb3_0); + if (rv != 0) { + device_printf(sc->dev, "Cannot get 'usb3-0' phy\n"); + return (ENXIO); + } + + rv = clk_get_by_ofw_name(sc->dev, 0, "xusb_host", + &sc->clk_xusb_host); + if (rv != 0) { + device_printf(sc->dev, "Cannot get 'xusb_host' clock\n"); + return (ENXIO); + } + rv = clk_get_by_ofw_name(sc->dev, 0, "xusb_falcon_src", + &sc->clk_xusb_falcon_src); + if (rv != 0) { + device_printf(sc->dev, "Cannot get 'xusb_falcon_src' clock\n"); + return (ENXIO); + } + rv = clk_get_by_ofw_name(sc->dev, 0, "xusb_ss", + &sc->clk_xusb_ss); + if (rv != 0) { + device_printf(sc->dev, "Cannot get 'xusb_ss' clock\n"); + return (ENXIO); + } + rv = clk_get_by_ofw_name(sc->dev, 0, "xusb_hs_src", + &sc->clk_xusb_hs_src); + if (rv != 0) { + device_printf(sc->dev, "Cannot get 'xusb_hs_src' clock\n"); + return (ENXIO); + } + rv = clk_get_by_ofw_name(sc->dev, 0, "xusb_fs_src", + &sc->clk_xusb_fs_src); + if (rv != 0) { + device_printf(sc->dev, "Cannot get 'xusb_fs_src' clock\n"); + return (ENXIO); + } + rv = clk_get_by_ofw_index_prop(sc->dev, 0, "freebsd,clock-xusb-gate", 0, + &sc->clk_xusb_gate); + if (rv != 0) { + device_printf(sc->dev, "Cannot get 'xusb_gate' clock\n"); + return (ENXIO); + } + return (0); +} + +static int +enable_fdt_resources(struct tegra_xhci_softc *sc) +{ + int rv; + + rv = hwreset_assert(sc->hwreset_xusb_host); + if (rv != 0) { + device_printf(sc->dev, "Cannot reset 'xusb_host' reset\n"); + return (rv); + } + rv = hwreset_assert(sc->hwreset_xusb_ss); + if (rv != 0) { + device_printf(sc->dev, "Cannot reset 'xusb_ss' reset\n"); + return (rv); + } + + rv = regulator_enable(sc->supply_avddio_pex); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable 'avddio_pex' regulator\n"); + return (rv); + } + rv = regulator_enable(sc->supply_dvddio_pex); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable 'dvddio_pex' regulator\n"); + return (rv); + } + rv = regulator_enable(sc->supply_avdd_usb); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable 'avdd_usb' regulator\n"); + return (rv); + } + rv = regulator_enable(sc->supply_avdd_pll_utmip); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable 'avdd_pll_utmip-5v' regulator\n"); + return (rv); + } + rv = regulator_enable(sc->supply_avdd_pll_erefe); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable 'avdd_pll_erefe' regulator\n"); + return (rv); + } + rv = regulator_enable(sc->supply_avdd_usb_ss_pll); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable 'avdd_usb_ss_pll' regulator\n"); + return (rv); + } + rv = regulator_enable(sc->supply_hvdd_usb_ss); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable 'hvdd_usb_ss' regulator\n"); + return (rv); + } + rv = regulator_enable(sc->supply_hvdd_usb_ss_pll_e); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable 'hvdd_usb_ss_pll_e' regulator\n"); + return (rv); + } + + /* Power off XUSB host and XUSB SS domains. */ + rv = tegra_powergate_power_off(TEGRA_POWERGATE_XUSBA); + if (rv != 0) { + device_printf(sc->dev, "Cannot powerdown 'xusba' domain\n"); + return (rv); + } + rv = tegra_powergate_power_off(TEGRA_POWERGATE_XUSBC); + if (rv != 0) { + device_printf(sc->dev, "Cannot powerdown 'xusbc' domain\n"); + return (rv); + } + + /* Setup XUSB ss_src clock first */ + clk_set_freq(sc->clk_xusb_ss, TEGRA_XHCI_SS_HIGH_SPEED, 0); + if (rv != 0) + return (rv); + + /* The XUSB gate clock must be enabled before XUSBA can be powered. */ + rv = clk_enable(sc->clk_xusb_gate); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable 'xusb_gate' clock\n"); + return (rv); + } + + /* Power on XUSB host and XUSB SS domains. */ + rv = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_XUSBC, + sc->clk_xusb_host, sc->hwreset_xusb_host); + if (rv != 0) { + device_printf(sc->dev, "Cannot powerup 'xusbc' domain\n"); + return (rv); + } + rv = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_XUSBA, + sc->clk_xusb_ss, sc->hwreset_xusb_ss); + if (rv != 0) { + device_printf(sc->dev, "Cannot powerup 'xusba' domain\n"); + return (rv); + } + + /* Enable rest of clocks */ + rv = clk_enable(sc->clk_xusb_falcon_src); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable 'xusb_falcon_src' clock\n"); + return (rv); + } + rv = clk_enable(sc->clk_xusb_fs_src); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable 'xusb_fs_src' clock\n"); + return (rv); + } + rv = clk_enable(sc->clk_xusb_hs_src); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable 'xusb_hs_src' clock\n"); + return (rv); + } + + rv = phy_enable(sc->dev, sc->phy_usb2_0); + if (rv != 0) { + device_printf(sc->dev, "Cannot enable USB2_0 phy\n"); + return (rv); + } + rv = phy_enable(sc->dev, sc->phy_usb2_1); + if (rv != 0) { + device_printf(sc->dev, "Cannot enable USB2_1 phy\n"); + return (rv); + } + rv = phy_enable(sc->dev, sc->phy_usb2_2); + if (rv != 0) { + device_printf(sc->dev, "Cannot enable USB2_2 phy\n"); + return (rv); + } + rv = phy_enable(sc->dev, sc->phy_usb3_0); + if (rv != 0) { + device_printf(sc->dev, "Cannot enable USB3_0 phy\n"); + return (rv); + } + + return (0); +} + +/* Respond by ACK/NAK back to FW */ +static void +mbox_send_ack(struct tegra_xhci_softc *sc, uint32_t cmd, uint32_t data) +{ + uint32_t reg; + + reg = ARU_MAILBOX_DATA_IN_TYPE(cmd) | ARU_MAILBOX_DATA_IN_DATA(data); + FPCI_WR4(sc, T_XUSB_CFG_ARU_MAILBOX_DATA_IN, reg); + + reg = FPCI_RD4(sc, T_XUSB_CFG_ARU_MAILBOX_CMD); + reg |= ARU_MAILBOX_CMD_DEST_FALC | ARU_MAILBOX_CMD_INT_EN; + FPCI_WR4(sc, T_XUSB_CFG_ARU_MAILBOX_CMD, reg); +} + +/* Sent command to FW */ +static int +mbox_send_cmd(struct tegra_xhci_softc *sc, uint32_t cmd, uint32_t data) +{ + uint32_t reg; + int i; + + reg = FPCI_RD4(sc, T_XUSB_CFG_ARU_MAILBOX_OWNER); + if (reg != ARU_MAILBOX_OWNER_NONE) { + device_printf(sc->dev, + "CPU mailbox is busy: 0x%08X\n", reg); + return (EBUSY); + } + /* XXX Is this right? Retry loop? Wait before send? */ + FPCI_WR4(sc, T_XUSB_CFG_ARU_MAILBOX_OWNER, ARU_MAILBOX_OWNER_SW); + reg = FPCI_RD4(sc, T_XUSB_CFG_ARU_MAILBOX_OWNER); + if (reg != ARU_MAILBOX_OWNER_SW) { + device_printf(sc->dev, + "Cannot acquire CPU mailbox: 0x%08X\n", reg); + return (EBUSY); + } + reg = ARU_MAILBOX_DATA_IN_TYPE(cmd) | ARU_MAILBOX_DATA_IN_DATA(data); + FPCI_WR4(sc, T_XUSB_CFG_ARU_MAILBOX_DATA_IN, reg); + + reg = FPCI_RD4(sc, T_XUSB_CFG_ARU_MAILBOX_CMD); + reg |= ARU_MAILBOX_CMD_DEST_FALC | ARU_MAILBOX_CMD_INT_EN; + FPCI_WR4(sc, T_XUSB_CFG_ARU_MAILBOX_CMD, reg); + + for (i = 250; i > 0; i--) { + reg = FPCI_RD4(sc, T_XUSB_CFG_ARU_MAILBOX_OWNER); + if (reg == ARU_MAILBOX_OWNER_NONE) + break; + DELAY(100); + } + if (i <= 0) { + device_printf(sc->dev, + "Command response timeout: 0x%08X\n", reg); + return (ETIMEDOUT); + } + + return(0); +} + +static void +process_msg(struct tegra_xhci_softc *sc, uint32_t req_cmd, uint32_t req_data, + uint32_t *resp_cmd, uint32_t *resp_data) +{ + uint64_t freq; + int rv; + + /* In most cases, data are echoed back. */ + *resp_data = req_data; + switch (req_cmd) { + case MBOX_CMD_INC_FALC_CLOCK: + case MBOX_CMD_DEC_FALC_CLOCK: + rv = clk_set_freq(sc->clk_xusb_falcon_src, req_data * 1000ULL, + 0); + if (rv == 0) { + rv = clk_get_freq(sc->clk_xusb_falcon_src, &freq); + *resp_data = (uint32_t)(freq / 1000); + } + *resp_cmd = rv == 0 ? MBOX_CMD_ACK: MBOX_CMD_NAK; + break; + + case MBOX_CMD_INC_SSPI_CLOCK: + case MBOX_CMD_DEC_SSPI_CLOCK: + rv = clk_set_freq(sc->clk_xusb_ss, req_data * 1000ULL, + 0); + if (rv == 0) { + rv = clk_get_freq(sc->clk_xusb_ss, &freq); + *resp_data = (uint32_t)(freq / 1000); + } + *resp_cmd = rv == 0 ? MBOX_CMD_ACK: MBOX_CMD_NAK; + break; + + case MBOX_CMD_SET_BW: + /* No respense is expected. */ + *resp_cmd = 0; + break; + + case MBOX_CMD_SET_SS_PWR_GATING: + case MBOX_CMD_SET_SS_PWR_UNGATING: + *resp_cmd = MBOX_CMD_NAK; + break; + + case MBOX_CMD_SAVE_DFE_CTLE_CTX: + /* Not implemented yet. */ + *resp_cmd = MBOX_CMD_ACK; + break; + + + case MBOX_CMD_START_HSIC_IDLE: + case MBOX_CMD_STOP_HSIC_IDLE: + /* Not implemented yet. */ + *resp_cmd = MBOX_CMD_NAK; + break; + + case MBOX_CMD_DISABLE_SS_LFPS_DETECTION: + case MBOX_CMD_ENABLE_SS_LFPS_DETECTION: + /* Not implemented yet. */ + *resp_cmd = MBOX_CMD_NAK; + break; + + case MBOX_CMD_AIRPLANE_MODE_ENABLED: + case MBOX_CMD_AIRPLANE_MODE_DISABLED: + case MBOX_CMD_DBC_WAKE_STACK: + case MBOX_CMD_HSIC_PRETEND_CONNECT: + case MBOX_CMD_RESET_SSPI: + device_printf(sc->dev, + "Received unused/unexpected command: %u\n", req_cmd); + *resp_cmd = 0; + break; + + default: + device_printf(sc->dev, + "Received unknown command: %u\n", req_cmd); + } +} + +static void +intr_mbox(void *arg) +{ + struct tegra_xhci_softc *sc; + uint32_t reg, msg, resp_cmd, resp_data; + + sc = (struct tegra_xhci_softc *)arg; + + /* Clear interrupt first */ + reg = FPCI_RD4(sc, XUSB_CFG_ARU_SMI_INTR); + FPCI_WR4(sc, XUSB_CFG_ARU_SMI_INTR, reg); + if (reg & ARU_SMI_INTR_FW_HANG) { + device_printf(sc->dev, + "XUSB CPU firmware hang!!! CPUCTL: 0x%08X\n", + CSB_RD4(sc, XUSB_FALCON_CPUCTL)); + } + + msg = FPCI_RD4(sc, T_XUSB_CFG_ARU_MAILBOX_DATA_OUT); + resp_cmd = 0; + process_msg(sc, ARU_MAILBOX_DATA_OUT_TYPE(msg), + ARU_MAILBOX_DATA_OUT_DATA(msg), &resp_cmd, &resp_data); + if (resp_cmd != 0) + mbox_send_ack(sc, resp_cmd, resp_data); + else + FPCI_WR4(sc, T_XUSB_CFG_ARU_MAILBOX_OWNER, + ARU_MAILBOX_OWNER_NONE); + + reg = FPCI_RD4(sc, T_XUSB_CFG_ARU_MAILBOX_CMD); + reg &= ~ARU_MAILBOX_CMD_DEST_SMI; + FPCI_WR4(sc, T_XUSB_CFG_ARU_MAILBOX_CMD, reg); + +} + +static int +load_fw(struct tegra_xhci_softc *sc) +{ + const struct firmware *fw; + const struct tegra_xusb_fw_hdr *fw_hdr; + vm_paddr_t fw_paddr, fw_base; + vm_offset_t fw_vaddr; + vm_size_t fw_size; + uint32_t code_tags, code_size; + struct clocktime fw_clock; + struct timespec fw_timespec; + int i; + + /* Reset ARU */ + FPCI_WR4(sc, XUSB_CFG_ARU_RST, ARU_RST_RESET); + DELAY(3000); + + /* Check if FALCON already runs */ + if (CSB_RD4(sc, XUSB_CSB_MEMPOOL_ILOAD_BASE_LO) != 0) { + device_printf(sc->dev, + "XUSB CPU is already loaded, CPUCTL: 0x%08X\n", + CSB_RD4(sc, XUSB_FALCON_CPUCTL)); + return (0); + } + + fw = firmware_get(sc->fw_name); + if (fw == NULL) { + device_printf(sc->dev, "Cannot read xusb firmware\n"); + return (ENOENT); + } + + /* Allocate uncached memory and copy firmware into. */ + fw_hdr = (const struct tegra_xusb_fw_hdr *)fw->data; + fw_size = fw_hdr->fwimg_len; + + fw_vaddr = kmem_alloc_contig(kernel_arena, fw_size, + M_WAITOK, 0, -1UL, PAGE_SIZE, 0, VM_MEMATTR_UNCACHEABLE); + fw_paddr = vtophys(fw_vaddr); + fw_hdr = (const struct tegra_xusb_fw_hdr *)fw_vaddr; + memcpy((void *)fw_vaddr, fw->data, fw_size); + + firmware_put(fw, FIRMWARE_UNLOAD); + sc->fw_vaddr = fw_vaddr; + sc->fw_size = fw_size; + + /* Setup firmware physical address and size. */ + fw_base = fw_paddr + sizeof(*fw_hdr); + CSB_WR4(sc, XUSB_CSB_MEMPOOL_ILOAD_ATTR, fw_size); + CSB_WR4(sc, XUSB_CSB_MEMPOOL_ILOAD_BASE_LO, fw_base & 0xFFFFFFFF); + CSB_WR4(sc, XUSB_CSB_MEMPOOL_ILOAD_BASE_HI, (uint64_t)fw_base >> 32); + CSB_WR4(sc, XUSB_CSB_MEMPOOL_APMAP, APMAP_BOOTPATH); + + /* Invalidate full L2IMEM context. */ + CSB_WR4(sc, XUSB_CSB_MEMPOOL_L2IMEMOP_TRIG, + L2IMEMOP_INVALIDATE_ALL); + + /* Program load of L2IMEM by boot code. */ + code_tags = howmany(fw_hdr->boot_codetag, XUSB_CSB_IMEM_BLOCK_SIZE); + code_size = howmany(fw_hdr->boot_codesize, XUSB_CSB_IMEM_BLOCK_SIZE); + CSB_WR4(sc, XUSB_CSB_MEMPOOL_L2IMEMOP_SIZE, + L2IMEMOP_SIZE_OFFSET(code_tags) | + L2IMEMOP_SIZE_SIZE(code_size)); + + /* Execute L2IMEM boot code fetch. */ + CSB_WR4(sc, XUSB_CSB_MEMPOOL_L2IMEMOP_TRIG, + L2IMEMOP_LOAD_LOCKED_RESULT); + + /* Program FALCON auto-fill range and block count */ + CSB_WR4(sc, XUSB_FALCON_IMFILLCTL, code_size); + CSB_WR4(sc, XUSB_FALCON_IMFILLRNG1, + IMFILLRNG1_TAG_LO(code_tags) | + IMFILLRNG1_TAG_HI(code_tags + code_size)); + + CSB_WR4(sc, XUSB_FALCON_DMACTL, 0); + /* Wait for CPU */ + for (i = 500; i > 0; i--) { + if (CSB_RD4(sc, XUSB_CSB_MEMPOOL_L2IMEMOP_RESULT) & + L2IMEMOP_RESULT_VLD) + break; + DELAY(100); + } + if (i <= 0) { + device_printf(sc->dev, "Timedout while wating for DMA, " + "state: 0x%08X\n", + CSB_RD4(sc, XUSB_CSB_MEMPOOL_L2IMEMOP_RESULT)); + return (ETIMEDOUT); + } + + /* Boot FALCON cpu */ + CSB_WR4(sc, XUSB_FALCON_BOOTVEC, fw_hdr->boot_codetag); + CSB_WR4(sc, XUSB_FALCON_CPUCTL, CPUCTL_STARTCPU); + + /* Wait for CPU */ + for (i = 50; i > 0; i--) { + if (CSB_RD4(sc, XUSB_FALCON_CPUCTL) == CPUCTL_STOPPED) + break; + DELAY(100); + } + if (i <= 0) { + device_printf(sc->dev, "Timedout while wating for FALCON cpu, " + "state: 0x%08X\n", CSB_RD4(sc, XUSB_FALCON_CPUCTL)); + return (ETIMEDOUT); + } + + fw_timespec.tv_sec = fw_hdr->fwimg_created_time; + fw_timespec.tv_nsec = 0; + clock_ts_to_ct(&fw_timespec, &fw_clock); + device_printf(sc->dev, + " Falcon firmware version: %02X.%02X.%04X," + " (%d/%d/%d %d:%02d:%02d UTC)\n", + (fw_hdr->version_id >> 24) & 0xFF,(fw_hdr->version_id >> 15) & 0xFF, + fw_hdr->version_id & 0xFFFF, + fw_clock.day, fw_clock.mon, fw_clock.year, + fw_clock.hour, fw_clock.min, fw_clock.sec); + + return (0); +} + +static int +init_hw(struct tegra_xhci_softc *sc) +{ + int rv; + uint32_t reg; + rman_res_t base_addr; + + base_addr = rman_get_start(sc->xhci_softc.sc_io_res); + + /* Enable FPCI access */ + reg = IPFS_RD4(sc, XUSB_HOST_CONFIGURATION); + reg |= CONFIGURATION_EN_FPCI; + IPFS_WR4(sc, XUSB_HOST_CONFIGURATION, reg); + IPFS_RD4(sc, XUSB_HOST_CONFIGURATION); + + + /* Program bar for XHCI base address */ + reg = FPCI_RD4(sc, T_XUSB_CFG_4); + reg &= ~CFG_4_BASE_ADDRESS(~0); + reg |= CFG_4_BASE_ADDRESS((uint32_t)base_addr >> 15); + FPCI_WR4(sc, T_XUSB_CFG_4, reg); + FPCI_WR4(sc, T_XUSB_CFG_5, (uint32_t)((uint64_t)(base_addr) >> 32)); + + /* Enable bus master */ + reg = FPCI_RD4(sc, T_XUSB_CFG_1); + reg |= CFG_1_IO_SPACE; + reg |= CFG_1_MEMORY_SPACE; + reg |= CFG_1_BUS_MASTER; + FPCI_WR4(sc, T_XUSB_CFG_1, reg); + + /* Enable Interrupts */ + reg = IPFS_RD4(sc, XUSB_HOST_INTR_MASK); + reg |= INTR_IP_INT_MASK; + IPFS_WR4(sc, XUSB_HOST_INTR_MASK, reg); + + /* Set hysteresis */ + IPFS_WR4(sc, XUSB_HOST_CLKGATE_HYSTERESIS, 128); + + rv = load_fw(sc); + if (rv != 0) + return rv; + return (0); +} + +static int *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Nov 7 06:22:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54EEEC332E5; Mon, 7 Nov 2016 06:22:28 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E1E227E; Mon, 7 Nov 2016 06:22:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id D4E7310A718; Mon, 7 Nov 2016 01:22:18 -0500 (EST) From: John Baldwin To: Sean Bruno Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308345 - head/sys/dev/e1000 Date: Sat, 05 Nov 2016 16:16:58 -0700 Message-ID: <15572642.JMvQo5TC3D@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201611051630.uA5GUhtk073581@repo.freebsd.org> References: <201611051630.uA5GUhtk073581@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 07 Nov 2016 01:22:18 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 06:22:28 -0000 On Saturday, November 05, 2016 04:30:43 PM Sean Bruno wrote: > Author: sbruno > Date: Sat Nov 5 16:30:42 2016 > New Revision: 308345 > URL: https://svnweb.freebsd.org/changeset/base/308345 > > Log: > r295133 attempted to deactivate TSO in the 100Mbit link case with this > adapter to work around bugs in TSO handling at this speed. > > em_init_locked is called during first boot of the adapter and will > see that link_speed is unitialized, effectively turning off tso for > all cards at all speeds, which I believe was *not* the intent. > > Move the handling of TSO deactivation to the link handler where we can > more effectively make the decision about what to do. In addition, > completely purge the TSO capabilities instead of disabling just CSUM_TSO. > > Thanks to jhb for explanation of the hw capabilites api. > > Thanks to royger and cognet for testing the 100Mbit failure case to > ensure that their adapters do indeed still work. > > MFC after: 1 week > Sponsored by: Limelight Networks > > Modified: > head/sys/dev/e1000/if_em.c > > Modified: head/sys/dev/e1000/if_em.c > ============================================================================== > --- head/sys/dev/e1000/if_em.c Sat Nov 5 16:23:33 2016 (r308344) > +++ head/sys/dev/e1000/if_em.c Sat Nov 5 16:30:42 2016 (r308345) > @@ -369,11 +369,6 @@ MODULE_DEPEND(em, netmap, 1, 1, 1); > #define MAX_INTS_PER_SEC 8000 > #define DEFAULT_ITR (1000000000/(MAX_INTS_PER_SEC * 256)) > > -/* Allow common code without TSO */ > -#ifndef CSUM_TSO > -#define CSUM_TSO 0 > -#endif > - > #define TSO_WORKAROUND 4 > > static SYSCTL_NODE(_hw, OID_AUTO, em, CTLFLAG_RD, 0, "EM driver parameters"); > @@ -1396,15 +1391,9 @@ em_init_locked(struct adapter *adapter) > if_clearhwassist(ifp); > if (if_getcapenable(ifp) & IFCAP_TXCSUM) > if_sethwassistbits(ifp, CSUM_TCP | CSUM_UDP, 0); > - /* > - ** There have proven to be problems with TSO when not > - ** at full gigabit speed, so disable the assist automatically > - ** when at lower speeds. -jfv > - */ > - if (if_getcapenable(ifp) & IFCAP_TSO4) { > - if (adapter->link_speed == SPEED_1000) > - if_sethwassistbits(ifp, CSUM_TSO, 0); > - } > + > + if (if_getcapenable(ifp) & IFCAP_TSO4) > + if_sethwassistbits(ifp, CSUM_TSO, 0); Does this always disable TSO? Should this part be removed entirely? (That is, it seems like this would disable TSO even on Gigabit links). > /* Configure for OS presence */ > em_init_manageability(adapter); > @@ -2412,6 +2401,18 @@ em_update_link_status(struct adapter *ad > if (link_check && (adapter->link_active == 0)) { > e1000_get_speed_and_duplex(hw, &adapter->link_speed, > &adapter->link_duplex); > + /* > + ** There have proven to be problems with TSO when not > + ** at full gigabit speed, so disable the assist automatically > + ** when at lower speeds. -jfv > + */ > + if (adapter->link_speed != SPEED_1000) { > + if_sethwassistbits(ifp, 0, CSUM_TSO); > + if_setcapenablebit(ifp, 0, IFCAP_TSO4); > + if_setcapabilitiesbit(ifp, 0, IFCAP_TSO4); > + > + } Even though I suggested it, I wonder if it wouldn't be better to only modify if_capenable and not if_capabilities, that way the admin can decide to use 'ifconfig em0 tso' to force it back on (e.g. if moving an adapter from 100 to 1G). -- John Baldwin From owner-svn-src-all@freebsd.org Mon Nov 7 06:37:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99221C337CB; Mon, 7 Nov 2016 06:37:45 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: from mail-ua0-x22e.google.com (mail-ua0-x22e.google.com [IPv6:2607:f8b0:400c:c08::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E87EBB1; Mon, 7 Nov 2016 06:37:45 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: by mail-ua0-x22e.google.com with SMTP id 20so111960323uak.0; Sun, 06 Nov 2016 22:37:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sFPcs9wAlicYRZ5Wj75V2abdBy28rH+nOQlcyk/2y8A=; b=h4q+atGpXcSrM0OXjNGX195fLc2TDyP+Fm8ITeqf+fhODOjyzZ+FxdEbJNZPuK7dBr s+WsnCIocEMNZ/VdPnv76gIJuBncM/gS3Jsw9Zbs7h4ufqxRQT5I1aPRddk7CQV3PgYN 1x422FNJCz2zrMR9xzdiYXy2PmDaA7Q8uMKZO7+Xi6A6BgPbFLMSg7l2UvrtTG5KAmS/ zAHT8EZTOg2xUo8DegE17a3fYyGIpYDeacLX75YifgvsxdMf5C958Nqx6c0PoK45IM1G IebXk4tcEpQ3ZIXtL14tEEIWDMeHpYkAv47Ck+Qx25tU0TuQGzQ+DneXqhyoS5lfyJcw 5WFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sFPcs9wAlicYRZ5Wj75V2abdBy28rH+nOQlcyk/2y8A=; b=TyoqYfFFjUxhVEfmnTKLqGeHABsxV97PFoWyDY0eAjXHdE9zrayxbEzmqOPLOgynBK un1UgHiP3porogQ2dMuQQ8H5QrQNolmJB0cOOKe4oM2jM2XDwmS7l6jx2kiGcdLqRTHW Xhc/lsSc3+g972Njt4UeOVgq+GbfkGD8sMBJCQNHZqWCxoz3pW9cQVGl/KwJdzVII+So B5giARDFN+Cd+6AhJHUMDk2lWkVAPebWuE/7nwWfGAT7oahkpNV5yoxi83y3C2/7DzLF ZH5exsq5AGOdjgTBlxDQJkFkXi6jB92HFMgVRrpfoLFn8nqdLxSFI3S5TS4FprMTXyA4 Kr3Q== X-Gm-Message-State: ABUngvdt7jUC+81apvnNhg8934kfutQQHLeWssEZU+L9bOQIhCv6vx4YlGN2O6GCxfywdZXZR03kC/q56nzLXA== X-Received: by 10.176.68.103 with SMTP id m94mr2925531uam.75.1478500664140; Sun, 06 Nov 2016 22:37:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.159.36.247 with HTTP; Sun, 6 Nov 2016 22:37:43 -0800 (PST) In-Reply-To: <15572642.JMvQo5TC3D@ralph.baldwin.cx> References: <201611051630.uA5GUhtk073581@repo.freebsd.org> <15572642.JMvQo5TC3D@ralph.baldwin.cx> From: Sepherosa Ziehau Date: Mon, 7 Nov 2016 14:37:43 +0800 Message-ID: Subject: Re: svn commit: r308345 - head/sys/dev/e1000 To: John Baldwin Cc: Sean Bruno , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 06:37:45 -0000 On Sun, Nov 6, 2016 at 7:16 AM, John Baldwin wrote: > On Saturday, November 05, 2016 04:30:43 PM Sean Bruno wrote: >> Author: sbruno >> Date: Sat Nov 5 16:30:42 2016 >> New Revision: 308345 >> URL: https://svnweb.freebsd.org/changeset/base/308345 >> >> Log: >> r295133 attempted to deactivate TSO in the 100Mbit link case with this >> adapter to work around bugs in TSO handling at this speed. >> >> em_init_locked is called during first boot of the adapter and will >> see that link_speed is unitialized, effectively turning off tso for >> all cards at all speeds, which I believe was *not* the intent. >> >> Move the handling of TSO deactivation to the link handler where we can >> more effectively make the decision about what to do. In addition, >> completely purge the TSO capabilities instead of disabling just CSUM_TSO. >> >> Thanks to jhb for explanation of the hw capabilites api. >> >> Thanks to royger and cognet for testing the 100Mbit failure case to >> ensure that their adapters do indeed still work. >> >> MFC after: 1 week >> Sponsored by: Limelight Networks >> >> Modified: >> head/sys/dev/e1000/if_em.c >> >> Modified: head/sys/dev/e1000/if_em.c >> ============================================================================== >> --- head/sys/dev/e1000/if_em.c Sat Nov 5 16:23:33 2016 (r308344) >> +++ head/sys/dev/e1000/if_em.c Sat Nov 5 16:30:42 2016 (r308345) >> @@ -369,11 +369,6 @@ MODULE_DEPEND(em, netmap, 1, 1, 1); >> #define MAX_INTS_PER_SEC 8000 >> #define DEFAULT_ITR (1000000000/(MAX_INTS_PER_SEC * 256)) >> >> -/* Allow common code without TSO */ >> -#ifndef CSUM_TSO >> -#define CSUM_TSO 0 >> -#endif >> - >> #define TSO_WORKAROUND 4 >> >> static SYSCTL_NODE(_hw, OID_AUTO, em, CTLFLAG_RD, 0, "EM driver parameters"); >> @@ -1396,15 +1391,9 @@ em_init_locked(struct adapter *adapter) >> if_clearhwassist(ifp); >> if (if_getcapenable(ifp) & IFCAP_TXCSUM) >> if_sethwassistbits(ifp, CSUM_TCP | CSUM_UDP, 0); >> - /* >> - ** There have proven to be problems with TSO when not >> - ** at full gigabit speed, so disable the assist automatically >> - ** when at lower speeds. -jfv >> - */ >> - if (if_getcapenable(ifp) & IFCAP_TSO4) { >> - if (adapter->link_speed == SPEED_1000) >> - if_sethwassistbits(ifp, CSUM_TSO, 0); >> - } >> + >> + if (if_getcapenable(ifp) & IFCAP_TSO4) >> + if_sethwassistbits(ifp, CSUM_TSO, 0); > > Does this always disable TSO? Should this part be removed entirely? > (That is, it seems like this would disable TSO even on Gigabit links). > >> /* Configure for OS presence */ >> em_init_manageability(adapter); >> @@ -2412,6 +2401,18 @@ em_update_link_status(struct adapter *ad >> if (link_check && (adapter->link_active == 0)) { >> e1000_get_speed_and_duplex(hw, &adapter->link_speed, >> &adapter->link_duplex); >> + /* >> + ** There have proven to be problems with TSO when not >> + ** at full gigabit speed, so disable the assist automatically >> + ** when at lower speeds. -jfv >> + */ >> + if (adapter->link_speed != SPEED_1000) { >> + if_sethwassistbits(ifp, 0, CSUM_TSO); >> + if_setcapenablebit(ifp, 0, IFCAP_TSO4); >> + if_setcapabilitiesbit(ifp, 0, IFCAP_TSO4); >> + >> + } > > Even though I suggested it, I wonder if it wouldn't be better to only > modify if_capenable and not if_capabilities, that way the admin can > decide to use 'ifconfig em0 tso' to force it back on (e.g. if moving > an adapter from 100 to 1G). I believe simply clearing CSUM_TSO should work for the TCP stack; messing administrative like capenable and hwcaps does not sound correct to me. As for this patch, do you need to re-enable TSO once link speed becomes 1000Mbps? BTW, since the link status check/update is async w/ the TX path, does this really work, if there are TSO packets pending on the TX rings (let alone inflight TSO packets from the TCP stack) when the link speed changed to 100Mbps? Thanks, sephe -- Tomorrow Will Never Die From owner-svn-src-all@freebsd.org Mon Nov 7 07:26:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED377C34485; Mon, 7 Nov 2016 07:26:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E21E15D; Mon, 7 Nov 2016 07:26:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA77Q6CJ004041; Mon, 7 Nov 2016 07:26:06 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA77Q6tu004036; Mon, 7 Nov 2016 07:26:06 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201611070726.uA77Q6tu004036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 7 Nov 2016 07:26:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r308392 - in vendor/file/dist: . doc magic magic/Magdir python src X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 07:26:08 -0000 Author: delphij Date: Mon Nov 7 07:26:06 2016 New Revision: 308392 URL: https://svnweb.freebsd.org/changeset/base/308392 Log: Vendor import of file 5.29. Added: vendor/file/dist/magic/Magdir/algol68 vendor/file/dist/magic/Magdir/application vendor/file/dist/magic/Magdir/apt vendor/file/dist/magic/Magdir/psl Modified: vendor/file/dist/ChangeLog vendor/file/dist/TODO vendor/file/dist/config.guess vendor/file/dist/config.sub vendor/file/dist/configure vendor/file/dist/configure.ac vendor/file/dist/doc/file.man vendor/file/dist/doc/magic.man vendor/file/dist/ltmain.sh vendor/file/dist/magic/Magdir/animation vendor/file/dist/magic/Magdir/apple vendor/file/dist/magic/Magdir/bioinformatics vendor/file/dist/magic/Magdir/c-lang vendor/file/dist/magic/Magdir/claris vendor/file/dist/magic/Magdir/commands vendor/file/dist/magic/Magdir/compress vendor/file/dist/magic/Magdir/cups vendor/file/dist/magic/Magdir/editors vendor/file/dist/magic/Magdir/filesystems vendor/file/dist/magic/Magdir/fonts vendor/file/dist/magic/Magdir/gcc vendor/file/dist/magic/Magdir/gnu vendor/file/dist/magic/Magdir/images vendor/file/dist/magic/Magdir/jpeg vendor/file/dist/magic/Magdir/msdos vendor/file/dist/magic/Magdir/pgp vendor/file/dist/magic/Magdir/python vendor/file/dist/magic/Magdir/ruby vendor/file/dist/magic/Magdir/sgml vendor/file/dist/magic/Magdir/sql vendor/file/dist/magic/Makefile.am vendor/file/dist/magic/Makefile.in vendor/file/dist/python/magic.py vendor/file/dist/src/apprentice.c vendor/file/dist/src/ascmagic.c vendor/file/dist/src/cdf.c vendor/file/dist/src/cdf.h vendor/file/dist/src/compress.c vendor/file/dist/src/der.c vendor/file/dist/src/file.c vendor/file/dist/src/file.h vendor/file/dist/src/funcs.c vendor/file/dist/src/magic.c vendor/file/dist/src/readcdf.c vendor/file/dist/src/readelf.c vendor/file/dist/src/softmagic.c Modified: vendor/file/dist/ChangeLog ============================================================================== --- vendor/file/dist/ChangeLog Mon Nov 7 05:37:10 2016 (r308391) +++ vendor/file/dist/ChangeLog Mon Nov 7 07:26:06 2016 (r308392) @@ -1,3 +1,32 @@ +2016-10-25 10:40 Christos Zoulas + + * release 5.28 + +2016-10-24 11:20 Christos Zoulas + + * der getlength overflow (Jonas Wagner) + * multiple magic file load failure (Christoph Biedl) + +2016-10-17 11:26 Christos Zoulas + + * CDF parsing improvements (Guy Helmer) + +2016-07-20 7:26 Christos Zoulas + + * Add support for signed indirect offsets + +2016-07-18 7:41 Christos Zoulas + + * cat /dev/null | file - should print empty (Christoph Biedl) + +2016-07-05 15:20 Christos Zoulas + + * Bump string size from 64 to 96. + +2016-06-13 20:20 Christos Zoulas + + * PR/556: Fix separators on annotations. + 2016-06-13 19:40 Christos Zoulas * release 5.28 Modified: vendor/file/dist/TODO ============================================================================== --- vendor/file/dist/TODO Mon Nov 7 05:37:10 2016 (r308391) +++ vendor/file/dist/TODO Mon Nov 7 07:26:06 2016 (r308392) @@ -6,7 +6,6 @@ file, not here. More speculative materia listed in the BUGS section of the man page had been fixed!) --- - It would be nice to simplify file considerably. For example, reimplement the apprentice and non-pattern magic methods in Python, and compile the magic patterns to a giant regex (or something similar; @@ -15,8 +14,23 @@ small amount of C is needed (because fas required for soft magic, not the more detailed information given by hard-wired routines). In this regard, note that hplip, which is BSD-licensed, has a magic reimplementation in Python. - +--- Read the kerberos magic entry for more ideas. - +--- Write a string merger to make magic entry sizes dynamic. Strings will be converted to offsets from the string table. +--- +Programming language support, we can introduce the concept of a group +of rules where n rules need to match before the rule is positive. This +could require structural changes to the matching code :-( + +0 group 2 # require 2 matches +# rule 1 +>0 .... +... +# rule 2 +>0 .... +... + +christos + Modified: vendor/file/dist/config.guess ============================================================================== --- vendor/file/dist/config.guess Mon Nov 7 05:37:10 2016 (r308391) +++ vendor/file/dist/config.guess Mon Nov 7 07:26:06 2016 (r308392) @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2015 Free Software Foundation, Inc. -timestamp='2012-02-10' +timestamp='2015-03-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -22,19 +20,17 @@ timestamp='2012-02-10' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches to . + me=`echo "$0" | sed -e 's,.*/,,'` @@ -54,9 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -138,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` | UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -153,20 +168,27 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) + arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ @@ -182,6 +204,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -198,7 +227,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` @@ -302,7 +335,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -560,8 +593,9 @@ EOF else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -801,10 +835,13 @@ EOF i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - i*:MSYS*:*) + *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -852,21 +889,21 @@ EOF exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -879,59 +916,57 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -950,54 +985,63 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1201,6 +1245,9 @@ EOF BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1227,19 +1274,31 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1256,7 +1315,7 @@ EOF NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1330,157 +1389,6 @@ EOF exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - cat >&2 <. @@ -26,11 +20,12 @@ timestamp='2012-04-18' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -73,9 +68,7 @@ Report bugs and patches to Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9193C344F4; Mon, 7 Nov 2016 07:27:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5ED0F2E0; Mon, 7 Nov 2016 07:27:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA77RCRg004115; Mon, 7 Nov 2016 07:27:12 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA77RC2I004114; Mon, 7 Nov 2016 07:27:12 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201611070727.uA77RC2I004114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 7 Nov 2016 07:27:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r308393 - vendor/file/5.29 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 07:27:13 -0000 Author: delphij Date: Mon Nov 7 07:27:12 2016 New Revision: 308393 URL: https://svnweb.freebsd.org/changeset/base/308393 Log: Tag file 5.29. Added: vendor/file/5.29/ - copied from r308392, vendor/file/dist/ From owner-svn-src-all@freebsd.org Mon Nov 7 08:14:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 830A5C338CF; Mon, 7 Nov 2016 08:14:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 51983EC9; Mon, 7 Nov 2016 08:14:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA78ETKW023568; Mon, 7 Nov 2016 08:14:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA78ETtD023567; Mon, 7 Nov 2016 08:14:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611070814.uA78ETtD023567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 08:14:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308394 - stable/11/sys/dev/usb/input X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 08:14:30 -0000 Author: hselasky Date: Mon Nov 7 08:14:29 2016 New Revision: 308394 URL: https://svnweb.freebsd.org/changeset/base/308394 Log: MFC r308144 and r308165: Fixes for virtual T-axis buttons. Make sure the virtual T-axis buttons gets cleared for USB mice which has less than 6 buttons. Make sure the virtual T-axis buttons generate button release event(s) for continuous tilting. PR: 213919 PR: 213957 Modified: stable/11/sys/dev/usb/input/ums.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/input/ums.c ============================================================================== --- stable/11/sys/dev/usb/input/ums.c Mon Nov 7 07:27:12 2016 (r308393) +++ stable/11/sys/dev/usb/input/ums.c Mon Nov 7 08:14:29 2016 (r308394) @@ -295,8 +295,11 @@ ums_intr_callback(struct usb_xfer *xfer, } if ((info->sc_flags & UMS_FLAG_T_AXIS) && - (id == info->sc_iid_t)) + (id == info->sc_iid_t)) { dt -= hid_get_data(buf, len, &info->sc_loc_t); + /* T-axis is translated into button presses */ + buttons_found |= (1UL << 5) | (1UL << 6); + } for (i = 0; i < info->sc_buttons; i++) { uint32_t mask; @@ -327,10 +330,13 @@ ums_intr_callback(struct usb_xfer *xfer, dx, dy, dz, dt, dw, buttons); /* translate T-axis into button presses until further */ - if (dt > 0) + if (dt > 0) { + ums_put_queue(sc, 0, 0, 0, 0, buttons); buttons |= 1UL << 5; - else if (dt < 0) + } else if (dt < 0) { + ums_put_queue(sc, 0, 0, 0, 0, buttons); buttons |= 1UL << 6; + } sc->sc_status.button = buttons; sc->sc_status.dx += dx; From owner-svn-src-all@freebsd.org Mon Nov 7 08:15:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AA81C33996; Mon, 7 Nov 2016 08:15:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A3731049; Mon, 7 Nov 2016 08:15:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA78FwcC023698; Mon, 7 Nov 2016 08:15:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA78Fwf4023697; Mon, 7 Nov 2016 08:15:58 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611070815.uA78Fwf4023697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 08:15:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308395 - stable/10/sys/dev/usb/input X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 08:15:59 -0000 Author: hselasky Date: Mon Nov 7 08:15:58 2016 New Revision: 308395 URL: https://svnweb.freebsd.org/changeset/base/308395 Log: MFC r308144 and r308165: Fixes for virtual T-axis buttons. Make sure the virtual T-axis buttons gets cleared for USB mice which has less than 6 buttons. Make sure the virtual T-axis buttons generate button release event(s) for continuous tilting. PR: 213919 PR: 213957 Modified: stable/10/sys/dev/usb/input/ums.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/input/ums.c ============================================================================== --- stable/10/sys/dev/usb/input/ums.c Mon Nov 7 08:14:29 2016 (r308394) +++ stable/10/sys/dev/usb/input/ums.c Mon Nov 7 08:15:58 2016 (r308395) @@ -258,8 +258,11 @@ ums_intr_callback(struct usb_xfer *xfer, } if ((info->sc_flags & UMS_FLAG_T_AXIS) && - (id == info->sc_iid_t)) + (id == info->sc_iid_t)) { dt -= hid_get_data(buf, len, &info->sc_loc_t); + /* T-axis is translated into button presses */ + buttons_found |= (1UL << 5) | (1UL << 6); + } for (i = 0; i < info->sc_buttons; i++) { uint32_t mask; @@ -287,10 +290,13 @@ ums_intr_callback(struct usb_xfer *xfer, dx, dy, dz, dt, dw, buttons); /* translate T-axis into button presses until further */ - if (dt > 0) + if (dt > 0) { + ums_put_queue(sc, 0, 0, 0, 0, buttons); buttons |= 1UL << 5; - else if (dt < 0) + } else if (dt < 0) { + ums_put_queue(sc, 0, 0, 0, 0, buttons); buttons |= 1UL << 6; + } sc->sc_status.button = buttons; sc->sc_status.dx += dx; From owner-svn-src-all@freebsd.org Mon Nov 7 08:17:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E47DC33B65; Mon, 7 Nov 2016 08:17:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CAFAA12C5; Mon, 7 Nov 2016 08:17:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA78HNc1023832; Mon, 7 Nov 2016 08:17:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA78HNhp023831; Mon, 7 Nov 2016 08:17:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611070817.uA78HNhp023831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 08:17:23 +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: r308396 - stable/9/sys/dev/usb/input X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 08:17:25 -0000 Author: hselasky Date: Mon Nov 7 08:17:23 2016 New Revision: 308396 URL: https://svnweb.freebsd.org/changeset/base/308396 Log: MFC r308144 and r308165: Fixes for virtual T-axis buttons. Make sure the virtual T-axis buttons gets cleared for USB mice which has less than 6 buttons. Make sure the virtual T-axis buttons generate button release event(s) for continuous tilting. PR: 213919 PR: 213957 Modified: stable/9/sys/dev/usb/input/ums.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/usb/input/ums.c ============================================================================== --- stable/9/sys/dev/usb/input/ums.c Mon Nov 7 08:15:58 2016 (r308395) +++ stable/9/sys/dev/usb/input/ums.c Mon Nov 7 08:17:23 2016 (r308396) @@ -258,8 +258,11 @@ ums_intr_callback(struct usb_xfer *xfer, } if ((info->sc_flags & UMS_FLAG_T_AXIS) && - (id == info->sc_iid_t)) + (id == info->sc_iid_t)) { dt -= hid_get_data(buf, len, &info->sc_loc_t); + /* T-axis is translated into button presses */ + buttons_found |= (1UL << 5) | (1UL << 6); + } for (i = 0; i < info->sc_buttons; i++) { uint32_t mask; @@ -287,10 +290,13 @@ ums_intr_callback(struct usb_xfer *xfer, dx, dy, dz, dt, dw, buttons); /* translate T-axis into button presses until further */ - if (dt > 0) + if (dt > 0) { + ums_put_queue(sc, 0, 0, 0, 0, buttons); buttons |= 1UL << 5; - else if (dt < 0) + } else if (dt < 0) { + ums_put_queue(sc, 0, 0, 0, 0, buttons); buttons |= 1UL << 6; + } sc->sc_status.button = buttons; sc->sc_status.dx += dx; From owner-svn-src-all@freebsd.org Mon Nov 7 08:18:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61AC0C33D6C; Mon, 7 Nov 2016 08:18:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 304F01596; Mon, 7 Nov 2016 08:18:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA78Ip4J023957; Mon, 7 Nov 2016 08:18:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA78IpWv023956; Mon, 7 Nov 2016 08:18:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611070818.uA78IpWv023956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 08:18:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r308397 - stable/8/sys/dev/usb/input X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 08:18:52 -0000 Author: hselasky Date: Mon Nov 7 08:18:51 2016 New Revision: 308397 URL: https://svnweb.freebsd.org/changeset/base/308397 Log: MFC r308144 and r308165: Fixes for virtual T-axis buttons. Make sure the virtual T-axis buttons gets cleared for USB mice which has less than 6 buttons. Make sure the virtual T-axis buttons generate button release event(s) for continuous tilting. PR: 213919 PR: 213957 Modified: stable/8/sys/dev/usb/input/ums.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) Modified: stable/8/sys/dev/usb/input/ums.c ============================================================================== --- stable/8/sys/dev/usb/input/ums.c Mon Nov 7 08:17:23 2016 (r308396) +++ stable/8/sys/dev/usb/input/ums.c Mon Nov 7 08:18:51 2016 (r308397) @@ -258,8 +258,11 @@ ums_intr_callback(struct usb_xfer *xfer, } if ((info->sc_flags & UMS_FLAG_T_AXIS) && - (id == info->sc_iid_t)) + (id == info->sc_iid_t)) { dt -= hid_get_data(buf, len, &info->sc_loc_t); + /* T-axis is translated into button presses */ + buttons_found |= (1UL << 5) | (1UL << 6); + } for (i = 0; i < info->sc_buttons; i++) { uint32_t mask; @@ -287,10 +290,13 @@ ums_intr_callback(struct usb_xfer *xfer, dx, dy, dz, dt, dw, buttons); /* translate T-axis into button presses until further */ - if (dt > 0) + if (dt > 0) { + ums_put_queue(sc, 0, 0, 0, 0, buttons); buttons |= 1UL << 5; - else if (dt < 0) + } else if (dt < 0) { + ums_put_queue(sc, 0, 0, 0, 0, buttons); buttons |= 1UL << 6; + } sc->sc_status.button = buttons; sc->sc_status.dx += dx; From owner-svn-src-all@freebsd.org Mon Nov 7 08:22:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA648C3403C; Mon, 7 Nov 2016 08:22:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7670119FC; Mon, 7 Nov 2016 08:22:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA78MiDk027864; Mon, 7 Nov 2016 08:22:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA78MiC5027862; Mon, 7 Nov 2016 08:22:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611070822.uA78MiC5027862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 08:22:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308398 - stable/11/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 08:22:45 -0000 Author: hselasky Date: Mon Nov 7 08:22:44 2016 New Revision: 308398 URL: https://svnweb.freebsd.org/changeset/base/308398 Log: MFC r308031: Fix indentation and remove duplicate queue stopped stats increment. Found by: Ryan Stone Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/net/mlx4/en_tx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/en_tx.c Mon Nov 7 08:18:51 2016 (r308397) +++ stable/11/sys/ofed/drivers/net/mlx4/en_tx.c Mon Nov 7 08:22:44 2016 (r308398) @@ -707,20 +707,19 @@ static int mlx4_en_xmit(struct mlx4_en_p /* check if TX ring is full */ if (unlikely(mlx4_en_tx_ring_is_full(ring))) { - /* every full native Tx ring stops queue */ - if (ring->blocked == 0) - atomic_add_int(&priv->blocked, 1); - /* Set HW-queue-is-full flag */ - atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); - priv->port_stats.queue_stopped++; - ring->blocked = 1; + /* every full native Tx ring stops queue */ + if (ring->blocked == 0) + atomic_add_int(&priv->blocked, 1); + /* Set HW-queue-is-full flag */ + atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); priv->port_stats.queue_stopped++; + ring->blocked = 1; ring->queue_stopped++; /* Use interrupts to find out when queue opened */ mlx4_en_arm_cq(priv, priv->tx_cq[tx_ind]); return (ENOBUFS); - } + } /* sanity check we are not wrapping around */ KASSERT(((~ring->prod) & ring->size_mask) >= From owner-svn-src-all@freebsd.org Mon Nov 7 08:24:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4CA7C341D4; Mon, 7 Nov 2016 08:24:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80B7D1BA6; Mon, 7 Nov 2016 08:24:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA78OTXR027974; Mon, 7 Nov 2016 08:24:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA78OTe6027973; Mon, 7 Nov 2016 08:24:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611070824.uA78OTe6027973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 08:24:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308399 - stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 08:24:30 -0000 Author: hselasky Date: Mon Nov 7 08:24:29 2016 New Revision: 308399 URL: https://svnweb.freebsd.org/changeset/base/308399 Log: MFC r308031: Fix indentation and remove duplicate queue stopped stats increment. Found by: Ryan Stone Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Mon Nov 7 08:22:44 2016 (r308398) +++ stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Mon Nov 7 08:24:29 2016 (r308399) @@ -702,20 +702,19 @@ static int mlx4_en_xmit(struct mlx4_en_p /* check if TX ring is full */ if (unlikely(mlx4_en_tx_ring_is_full(ring))) { - /* every full native Tx ring stops queue */ - if (ring->blocked == 0) - atomic_add_int(&priv->blocked, 1); - /* Set HW-queue-is-full flag */ - atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); - priv->port_stats.queue_stopped++; - ring->blocked = 1; + /* every full native Tx ring stops queue */ + if (ring->blocked == 0) + atomic_add_int(&priv->blocked, 1); + /* Set HW-queue-is-full flag */ + atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); priv->port_stats.queue_stopped++; + ring->blocked = 1; ring->queue_stopped++; /* Use interrupts to find out when queue opened */ mlx4_en_arm_cq(priv, priv->tx_cq[tx_ind]); return (ENOBUFS); - } + } /* sanity check we are not wrapping around */ KASSERT(((~ring->prod) & ring->size_mask) >= From owner-svn-src-all@freebsd.org Mon Nov 7 08:26:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 243F5C343B6; Mon, 7 Nov 2016 08:26:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E42AB1E97; Mon, 7 Nov 2016 08:26:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA78QKkT028096; Mon, 7 Nov 2016 08:26:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA78QKNh028095; Mon, 7 Nov 2016 08:26:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611070826.uA78QKNh028095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 08:26:20 +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: r308400 - stable/9/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 08:26:21 -0000 Author: hselasky Date: Mon Nov 7 08:26:19 2016 New Revision: 308400 URL: https://svnweb.freebsd.org/changeset/base/308400 Log: MFC r308031: Fix indentation and remove duplicate queue stopped stats increment. Found by: Ryan Stone Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/drivers/net/mlx4/en_tx.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_tx.c Mon Nov 7 08:24:29 2016 (r308399) +++ stable/9/sys/ofed/drivers/net/mlx4/en_tx.c Mon Nov 7 08:26:19 2016 (r308400) @@ -703,20 +703,19 @@ static int mlx4_en_xmit(struct mlx4_en_p /* check if TX ring is full */ if (unlikely(mlx4_en_tx_ring_is_full(ring))) { - /* every full native Tx ring stops queue */ - if (ring->blocked == 0) - atomic_add_int(&priv->blocked, 1); - /* Set HW-queue-is-full flag */ - atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); - priv->port_stats.queue_stopped++; - ring->blocked = 1; + /* every full native Tx ring stops queue */ + if (ring->blocked == 0) + atomic_add_int(&priv->blocked, 1); + /* Set HW-queue-is-full flag */ + atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); priv->port_stats.queue_stopped++; + ring->blocked = 1; ring->queue_stopped++; /* Use interrupts to find out when queue opened */ mlx4_en_arm_cq(priv, priv->tx_cq[tx_ind]); return (ENOBUFS); - } + } /* sanity check we are not wrapping around */ KASSERT(((~ring->prod) & ring->size_mask) >= From owner-svn-src-all@freebsd.org Mon Nov 7 08:36:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2D14C34AF1; Mon, 7 Nov 2016 08:36:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE94F951; Mon, 7 Nov 2016 08:36:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA78aB83032045; Mon, 7 Nov 2016 08:36:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA78a6OM032001; Mon, 7 Nov 2016 08:36:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611070836.uA78a6OM032001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 08:36:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308401 - in stable/11/sys: arm/allwinner arm/at91 arm/cavium/cns11xx arm/samsung/exynos arm/ti/am335x arm/ti/usb arm/xilinx boot/kshim dev/puc dev/usb dev/usb/controller dev/usb/video ... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 08:36:12 -0000 Author: hselasky Date: Mon Nov 7 08:36:06 2016 New Revision: 308401 URL: https://svnweb.freebsd.org/changeset/base/308401 Log: MFC r307518: Fix device delete child function. When detaching device trees parent devices must be detached prior to detaching its children. This is because parent devices can have pointers to the child devices in their softcs which are not invalidated by device_delete_child(). This can cause use after free issues and panic(). Device drivers implementing trees, must ensure its detach function detaches or deletes all its children before returning. While at it remove now redundant device_detach() calls before device_delete_child() and device_delete_children(), mostly in the USB controller drivers. Tested by: Jan Henrik Sylvester Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D8070 Modified: stable/11/sys/arm/allwinner/a10_ehci.c stable/11/sys/arm/at91/at91_ohci.c stable/11/sys/arm/at91/at91_ohci_fdt.c stable/11/sys/arm/cavium/cns11xx/ehci_ebus.c stable/11/sys/arm/cavium/cns11xx/ohci_ec.c stable/11/sys/arm/samsung/exynos/exynos5_xhci.c stable/11/sys/arm/ti/am335x/am335x_musb.c stable/11/sys/arm/ti/usb/omap_ehci.c stable/11/sys/arm/xilinx/zy7_ehci.c stable/11/sys/boot/kshim/bsd_kernel.c stable/11/sys/dev/puc/puc.c stable/11/sys/dev/usb/controller/at91dci_atmelarm.c stable/11/sys/dev/usb/controller/at91dci_fdt.c stable/11/sys/dev/usb/controller/atmegadci_atmelarm.c stable/11/sys/dev/usb/controller/dwc_otg_fdt.c stable/11/sys/dev/usb/controller/ehci_ixp4xx.c stable/11/sys/dev/usb/controller/ehci_mv.c stable/11/sys/dev/usb/controller/ehci_pci.c stable/11/sys/dev/usb/controller/generic_ehci.c stable/11/sys/dev/usb/controller/generic_ohci.c stable/11/sys/dev/usb/controller/musb_otg_atmelarm.c stable/11/sys/dev/usb/controller/ohci_pci.c stable/11/sys/dev/usb/controller/ohci_s3c24x0.c stable/11/sys/dev/usb/controller/saf1761_otg_boot.c stable/11/sys/dev/usb/controller/saf1761_otg_fdt.c stable/11/sys/dev/usb/controller/uhci_pci.c stable/11/sys/dev/usb/controller/uss820dci_atmelarm.c stable/11/sys/dev/usb/controller/xhci_mv.c stable/11/sys/dev/usb/controller/xhci_pci.c stable/11/sys/dev/usb/usb_device.c stable/11/sys/dev/usb/video/udl.c stable/11/sys/kern/subr_bus.c stable/11/sys/mips/atheros/ar71xx_ehci.c stable/11/sys/mips/atheros/ar71xx_ohci.c stable/11/sys/mips/cavium/usb/octusb_octeon.c stable/11/sys/mips/mediatek/mtk_dotg.c stable/11/sys/mips/mediatek/mtk_ehci.c stable/11/sys/mips/mediatek/mtk_ohci.c stable/11/sys/mips/mediatek/mtk_xhci.c stable/11/sys/mips/rmi/xls_ehci.c stable/11/sys/mips/rt305x/rt305x_dotg.c stable/11/sys/mips/rt305x/rt305x_ehci.c stable/11/sys/mips/rt305x/rt305x_ohci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/allwinner/a10_ehci.c ============================================================================== --- stable/11/sys/arm/allwinner/a10_ehci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/arm/allwinner/a10_ehci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -278,17 +278,11 @@ a10_ehci_detach(device_t self) struct aw_ehci_softc *aw_sc = device_get_softc(self); ehci_softc_t *sc = &aw_sc->sc; const struct aw_ehci_conf *conf; - device_t bdev; int err; uint32_t reg_value = 0; conf = USB_CONF(self); - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/arm/at91/at91_ohci.c ============================================================================== --- stable/11/sys/arm/at91/at91_ohci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/arm/at91/at91_ohci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -165,14 +165,8 @@ static int ohci_atmelarm_detach(device_t dev) { struct at91_ohci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_ohci.sc_bus.bdev) { - bdev = sc->sc_ohci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/arm/at91/at91_ohci_fdt.c ============================================================================== --- stable/11/sys/arm/at91/at91_ohci_fdt.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/arm/at91/at91_ohci_fdt.c Mon Nov 7 08:36:06 2016 (r308401) @@ -171,14 +171,8 @@ static int ohci_at91_fdt_detach(device_t dev) { struct at91_ohci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_ohci.sc_bus.bdev) { - bdev = sc->sc_ohci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/arm/cavium/cns11xx/ehci_ebus.c ============================================================================== --- stable/11/sys/arm/cavium/cns11xx/ehci_ebus.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/arm/cavium/cns11xx/ehci_ebus.c Mon Nov 7 08:36:06 2016 (r308401) @@ -184,14 +184,8 @@ static int ehci_ebus_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/arm/cavium/cns11xx/ohci_ec.c ============================================================================== --- stable/11/sys/arm/cavium/cns11xx/ohci_ec.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/arm/cavium/cns11xx/ohci_ec.c Mon Nov 7 08:36:06 2016 (r308401) @@ -177,14 +177,8 @@ static int ohci_ec_detach(device_t dev) { struct ec_ohci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_ohci.sc_bus.bdev) { - bdev = sc->sc_ohci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/arm/samsung/exynos/exynos5_xhci.c ============================================================================== --- stable/11/sys/arm/samsung/exynos/exynos5_xhci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/arm/samsung/exynos/exynos5_xhci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -288,14 +288,8 @@ static int exynos_xhci_detach(device_t dev) { struct exynos_xhci_softc *esc = device_get_softc(dev); - device_t bdev; int err; - if (esc->base.sc_bus.bdev != NULL) { - bdev = esc->base.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* During module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/arm/ti/am335x/am335x_musb.c ============================================================================== --- stable/11/sys/arm/ti/am335x/am335x_musb.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/arm/ti/am335x/am335x_musb.c Mon Nov 7 08:36:06 2016 (r308401) @@ -366,14 +366,10 @@ static int musbotg_detach(device_t dev) { struct musbotg_super_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } + /* during module unload there are lots of children leftover */ + device_delete_children(dev); if (sc->sc_otg.sc_irq_res && sc->sc_otg.sc_intr_hdl) { /* @@ -397,9 +393,6 @@ musbotg_detach(device_t dev) bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, sc->sc_otg.sc_irq_res); - /* during module unload there are lots of children leftover */ - device_delete_children(dev); - return (0); } Modified: stable/11/sys/arm/ti/usb/omap_ehci.c ============================================================================== --- stable/11/sys/arm/ti/usb/omap_ehci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/arm/ti/usb/omap_ehci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -392,15 +392,8 @@ omap_ehci_detach(device_t dev) { struct omap_ehci_softc *isc = device_get_softc(dev); ehci_softc_t *sc = &isc->base; - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } - /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/arm/xilinx/zy7_ehci.c ============================================================================== --- stable/11/sys/arm/xilinx/zy7_ehci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/arm/xilinx/zy7_ehci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -323,20 +323,17 @@ zy7_ehci_detach(device_t dev) { ehci_softc_t *sc = device_get_softc(dev); + /* during module unload there are lots of children leftover */ + device_delete_children(dev); + sc->sc_flags &= ~EHCI_SCFLG_DONEINIT; - if (device_is_attached(dev)) - bus_generic_detach(dev); - if (sc->sc_irq_res && sc->sc_intr_hdl) /* call ehci_detach() after ehci_init() called after * successful bus_setup_intr(). */ ehci_detach(sc); - if (sc->sc_bus.bdev) { - device_detach(sc->sc_bus.bdev); - device_delete_child(dev, sc->sc_bus.bdev); - } + if (sc->sc_irq_res) { if (sc->sc_intr_hdl != NULL) bus_teardown_intr(dev, sc->sc_irq_res, Modified: stable/11/sys/boot/kshim/bsd_kernel.c ============================================================================== --- stable/11/sys/boot/kshim/bsd_kernel.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/boot/kshim/bsd_kernel.c Mon Nov 7 08:36:06 2016 (r308401) @@ -817,8 +817,12 @@ device_delete_child(device_t dev, device int error = 0; device_t grandchild; - /* remove children first */ + /* detach parent before deleting children, if any */ + error = device_detach(child); + if (error) + goto done; + /* remove children second */ while ((grandchild = TAILQ_FIRST(&child->dev_children))) { error = device_delete_child(child, grandchild); if (error) { @@ -827,11 +831,6 @@ device_delete_child(device_t dev, device } } - error = device_detach(child); - - if (error) - goto done; - devclass_delete_device(child->dev_module, child); if (dev != NULL) { Modified: stable/11/sys/dev/puc/puc.c ============================================================================== --- stable/11/sys/dev/puc/puc.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/puc/puc.c Mon Nov 7 08:36:06 2016 (r308401) @@ -414,8 +414,7 @@ puc_bfe_detach(device_t dev) port = &sc->sc_port[idx]; if (port->p_dev == NULL) continue; - if (device_detach(port->p_dev) == 0) { - device_delete_child(dev, port->p_dev); + if (device_delete_child(dev, port->p_dev) == 0) { if (port->p_rres != NULL) rman_release_resource(port->p_rres); if (port->p_ires != NULL) Modified: stable/11/sys/dev/usb/controller/at91dci_atmelarm.c ============================================================================== --- stable/11/sys/dev/usb/controller/at91dci_atmelarm.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/at91dci_atmelarm.c Mon Nov 7 08:36:06 2016 (r308401) @@ -243,14 +243,8 @@ static int at91_udp_detach(device_t dev) { struct at91_udp_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/dev/usb/controller/at91dci_fdt.c ============================================================================== --- stable/11/sys/dev/usb/controller/at91dci_fdt.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/at91dci_fdt.c Mon Nov 7 08:36:06 2016 (r308401) @@ -249,14 +249,8 @@ static int at91_udp_detach(device_t dev) { struct at91_udp_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/dev/usb/controller/atmegadci_atmelarm.c ============================================================================== --- stable/11/sys/dev/usb/controller/atmegadci_atmelarm.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/atmegadci_atmelarm.c Mon Nov 7 08:36:06 2016 (r308401) @@ -155,14 +155,8 @@ static int atmegadci_detach(device_t dev) { struct atmegadci_super_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/dev/usb/controller/dwc_otg_fdt.c ============================================================================== --- stable/11/sys/dev/usb/controller/dwc_otg_fdt.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/dwc_otg_fdt.c Mon Nov 7 08:36:06 2016 (r308401) @@ -163,14 +163,8 @@ static int dwc_otg_detach(device_t dev) { struct dwc_otg_fdt_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- stable/11/sys/dev/usb/controller/ehci_ixp4xx.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/ehci_ixp4xx.c Mon Nov 7 08:36:06 2016 (r308401) @@ -221,14 +221,8 @@ ehci_ixp_detach(device_t self) { struct ixp_ehci_softc *isc = device_get_softc(self); ehci_softc_t *sc = &isc->base; - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/dev/usb/controller/ehci_mv.c ============================================================================== --- stable/11/sys/dev/usb/controller/ehci_mv.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/ehci_mv.c Mon Nov 7 08:36:06 2016 (r308401) @@ -264,14 +264,8 @@ static int mv_ehci_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/11/sys/dev/usb/controller/ehci_pci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/ehci_pci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -477,13 +477,7 @@ static int ehci_pci_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/dev/usb/controller/generic_ehci.c ============================================================================== --- stable/11/sys/dev/usb/controller/generic_ehci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/generic_ehci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -156,14 +156,8 @@ static int generic_ehci_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/dev/usb/controller/generic_ohci.c ============================================================================== --- stable/11/sys/dev/usb/controller/generic_ohci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/generic_ohci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -214,18 +214,11 @@ static int generic_ohci_detach(device_t dev) { struct generic_ohci_softc *sc = device_get_softc(dev); - device_t bdev; int err; #ifdef EXT_RESOURCES struct clk_list *clk, *clk_tmp; #endif - if (sc->ohci_sc.sc_bus.bdev) { - bdev = sc->ohci_sc.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } - /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/dev/usb/controller/musb_otg_atmelarm.c ============================================================================== --- stable/11/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Nov 7 08:36:06 2016 (r308401) @@ -204,14 +204,8 @@ static int musbotg_detach(device_t dev) { struct musbotg_super_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- stable/11/sys/dev/usb/controller/ohci_pci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/ohci_pci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -335,13 +335,7 @@ static int ohci_pci_detach(device_t self) { ohci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/dev/usb/controller/ohci_s3c24x0.c ============================================================================== --- stable/11/sys/dev/usb/controller/ohci_s3c24x0.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/ohci_s3c24x0.c Mon Nov 7 08:36:06 2016 (r308401) @@ -148,14 +148,8 @@ static int ohci_s3c24x0_detach(device_t dev) { struct ohci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/dev/usb/controller/saf1761_otg_boot.c ============================================================================== --- stable/11/sys/dev/usb/controller/saf1761_otg_boot.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/saf1761_otg_boot.c Mon Nov 7 08:36:06 2016 (r308401) @@ -124,13 +124,6 @@ static int saf1761_otg_fdt_detach(device_t dev) { struct saf1761_otg_softc *sc = device_get_softc(dev); - device_t bdev; - - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/dev/usb/controller/saf1761_otg_fdt.c ============================================================================== --- stable/11/sys/dev/usb/controller/saf1761_otg_fdt.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/saf1761_otg_fdt.c Mon Nov 7 08:36:06 2016 (r308401) @@ -238,14 +238,8 @@ static int saf1761_otg_fdt_detach(device_t dev) { struct saf1761_otg_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- stable/11/sys/dev/usb/controller/uhci_pci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/uhci_pci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -393,13 +393,7 @@ int uhci_pci_detach(device_t self) { uhci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/dev/usb/controller/uss820dci_atmelarm.c ============================================================================== --- stable/11/sys/dev/usb/controller/uss820dci_atmelarm.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/uss820dci_atmelarm.c Mon Nov 7 08:36:06 2016 (r308401) @@ -164,14 +164,8 @@ static int uss820_atmelarm_detach(device_t dev) { struct uss820dci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/dev/usb/controller/xhci_mv.c ============================================================================== --- stable/11/sys/dev/usb/controller/xhci_mv.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/xhci_mv.c Mon Nov 7 08:36:06 2016 (r308401) @@ -171,15 +171,8 @@ static int xhci_detach(device_t dev) { struct xhci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev != NULL) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } - /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- stable/11/sys/dev/usb/controller/xhci_pci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/controller/xhci_pci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -340,13 +340,7 @@ static int xhci_pci_detach(device_t self) { struct xhci_softc *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev != NULL) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/dev/usb/usb_device.c ============================================================================== --- stable/11/sys/dev/usb/usb_device.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/usb_device.c Mon Nov 7 08:36:06 2016 (r308401) @@ -1103,10 +1103,8 @@ usb_detach_device_sub(struct usb_device device_printf(dev, "Resume failed\n"); } } - if (device_detach(dev)) { - goto error; - } } + /* detach and delete child */ if (device_delete_child(udev->parent_dev, dev)) { goto error; } Modified: stable/11/sys/dev/usb/video/udl.c ============================================================================== --- stable/11/sys/dev/usb/video/udl.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/dev/usb/video/udl.c Mon Nov 7 08:36:06 2016 (r308401) @@ -443,14 +443,9 @@ udl_detach(device_t dev) { struct udl_softc *sc = device_get_softc(dev); - if (sc->sc_fbdev != NULL) { - device_t bdev; + /* delete all child devices */ + device_delete_children(dev); - bdev = sc->sc_fbdev; - sc->sc_fbdev = NULL; - device_detach(bdev); - device_delete_child(dev, bdev); - } UDL_LOCK(sc); sc->sc_gone = 1; callout_stop(&sc->sc_callout); Modified: stable/11/sys/kern/subr_bus.c ============================================================================== --- stable/11/sys/kern/subr_bus.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/kern/subr_bus.c Mon Nov 7 08:36:06 2016 (r308401) @@ -1949,15 +1949,17 @@ device_delete_child(device_t dev, device PDEBUG(("%s from %s", DEVICENAME(child), DEVICENAME(dev))); - /* remove children first */ + /* detach parent before deleting children, if any */ + if ((error = device_detach(child)) != 0) + return (error); + + /* remove children second */ while ((grandchild = TAILQ_FIRST(&child->children)) != NULL) { error = device_delete_child(child, grandchild); if (error) return (error); } - if ((error = device_detach(child)) != 0) - return (error); if (child->devclass) devclass_delete_device(child->devclass, child); if (child->parent) Modified: stable/11/sys/mips/atheros/ar71xx_ehci.c ============================================================================== --- stable/11/sys/mips/atheros/ar71xx_ehci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/mips/atheros/ar71xx_ehci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -231,14 +231,8 @@ ar71xx_ehci_detach(device_t self) { struct ar71xx_ehci_softc *isc = device_get_softc(self); ehci_softc_t *sc = &isc->base; - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/mips/atheros/ar71xx_ohci.c ============================================================================== --- stable/11/sys/mips/atheros/ar71xx_ohci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/mips/atheros/ar71xx_ohci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -156,13 +156,7 @@ static int ar71xx_ohci_detach(device_t dev) { struct ar71xx_ohci_softc *sc = device_get_softc(dev); - device_t bdev; - if (sc->sc_ohci.sc_bus.bdev) { - bdev = sc->sc_ohci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/mips/cavium/usb/octusb_octeon.c ============================================================================== --- stable/11/sys/mips/cavium/usb/octusb_octeon.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/mips/cavium/usb/octusb_octeon.c Mon Nov 7 08:36:06 2016 (r308401) @@ -160,16 +160,10 @@ static int octusb_octeon_detach(device_t dev) { struct octusb_octeon_softc *sc = device_get_softc(dev); - device_t bdev; int err; int nports; int i; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/mips/mediatek/mtk_dotg.c ============================================================================== --- stable/11/sys/mips/mediatek/mtk_dotg.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/mips/mediatek/mtk_dotg.c Mon Nov 7 08:36:06 2016 (r308401) @@ -161,14 +161,8 @@ static int dotg_fdt_detach(device_t dev) { struct dwc_otg_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/mips/mediatek/mtk_ehci.c ============================================================================== --- stable/11/sys/mips/mediatek/mtk_ehci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/mips/mediatek/mtk_ehci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -162,14 +162,8 @@ static int ehci_fdt_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/mips/mediatek/mtk_ohci.c ============================================================================== --- stable/11/sys/mips/mediatek/mtk_ohci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/mips/mediatek/mtk_ohci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -162,14 +162,8 @@ static int ohci_fdt_detach(device_t self) { ohci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/mips/mediatek/mtk_xhci.c ============================================================================== --- stable/11/sys/mips/mediatek/mtk_xhci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/mips/mediatek/mtk_xhci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -161,14 +161,8 @@ static int mtk_xhci_fdt_detach(device_t self) { struct xhci_softc *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/mips/rmi/xls_ehci.c ============================================================================== --- stable/11/sys/mips/rmi/xls_ehci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/mips/rmi/xls_ehci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -164,14 +164,8 @@ static int ehci_xls_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/mips/rt305x/rt305x_dotg.c ============================================================================== --- stable/11/sys/mips/rt305x/rt305x_dotg.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/mips/rt305x/rt305x_dotg.c Mon Nov 7 08:36:06 2016 (r308401) @@ -173,14 +173,8 @@ static int dotg_obio_detach(device_t dev) { struct dwc_otg_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/11/sys/mips/rt305x/rt305x_ehci.c ============================================================================== --- stable/11/sys/mips/rt305x/rt305x_ehci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/mips/rt305x/rt305x_ehci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -175,14 +175,8 @@ static int ehci_obio_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/11/sys/mips/rt305x/rt305x_ohci.c ============================================================================== --- stable/11/sys/mips/rt305x/rt305x_ohci.c Mon Nov 7 08:26:19 2016 (r308400) +++ stable/11/sys/mips/rt305x/rt305x_ohci.c Mon Nov 7 08:36:06 2016 (r308401) @@ -175,14 +175,8 @@ static int ohci_obio_detach(device_t self) { ohci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); From owner-svn-src-all@freebsd.org Mon Nov 7 09:19:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 221CAC349C9; Mon, 7 Nov 2016 09:19:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3B5EFC0; Mon, 7 Nov 2016 09:19:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA79J7A7047530; Mon, 7 Nov 2016 09:19:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA79J49D047502; Mon, 7 Nov 2016 09:19:04 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611070919.uA79J49D047502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 09:19:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308402 - in stable/10/sys: arm/allwinner arm/cavium/cns11xx arm/ti/usb arm/xilinx dev/puc dev/usb dev/usb/controller kern mips/atheros mips/cavium/usb mips/rmi mips/rt305x X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 09:19:08 -0000 Author: hselasky Date: Mon Nov 7 09:19:04 2016 New Revision: 308402 URL: https://svnweb.freebsd.org/changeset/base/308402 Log: MFC r307518: Fix device delete child function. When detaching device trees parent devices must be detached prior to detaching its children. This is because parent devices can have pointers to the child devices in their softcs which are not invalidated by device_delete_child(). This can cause use after free issues and panic(). Device drivers implementing trees, must ensure its detach function detaches or deletes all its children before returning. While at it remove now redundant device_detach() calls before device_delete_child() and device_delete_children(), mostly in the USB controller drivers. Tested by: Jan Henrik Sylvester Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D8070 Modified: stable/10/sys/arm/allwinner/a10_ehci.c stable/10/sys/arm/cavium/cns11xx/ehci_ebus.c stable/10/sys/arm/cavium/cns11xx/ohci_ec.c stable/10/sys/arm/ti/usb/omap_ehci.c stable/10/sys/arm/xilinx/zy7_ehci.c stable/10/sys/dev/puc/puc.c stable/10/sys/dev/usb/controller/at91dci_atmelarm.c stable/10/sys/dev/usb/controller/at91dci_fdt.c stable/10/sys/dev/usb/controller/atmegadci_atmelarm.c stable/10/sys/dev/usb/controller/dwc_otg_fdt.c stable/10/sys/dev/usb/controller/ehci_ixp4xx.c stable/10/sys/dev/usb/controller/ehci_mv.c stable/10/sys/dev/usb/controller/ehci_pci.c stable/10/sys/dev/usb/controller/musb_otg_atmelarm.c stable/10/sys/dev/usb/controller/ohci_pci.c stable/10/sys/dev/usb/controller/ohci_s3c24x0.c stable/10/sys/dev/usb/controller/uhci_pci.c stable/10/sys/dev/usb/controller/uss820dci_atmelarm.c stable/10/sys/dev/usb/controller/xhci_pci.c stable/10/sys/dev/usb/usb_device.c stable/10/sys/kern/subr_bus.c stable/10/sys/mips/atheros/ar71xx_ehci.c stable/10/sys/mips/atheros/ar71xx_ohci.c stable/10/sys/mips/cavium/usb/octusb_octeon.c stable/10/sys/mips/rmi/xls_ehci.c stable/10/sys/mips/rt305x/rt305x_dotg.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/allwinner/a10_ehci.c ============================================================================== --- stable/10/sys/arm/allwinner/a10_ehci.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/arm/allwinner/a10_ehci.c Mon Nov 7 09:19:04 2016 (r308402) @@ -224,15 +224,9 @@ static int a10_ehci_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; uint32_t reg_value = 0; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/10/sys/arm/cavium/cns11xx/ehci_ebus.c ============================================================================== --- stable/10/sys/arm/cavium/cns11xx/ehci_ebus.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/arm/cavium/cns11xx/ehci_ebus.c Mon Nov 7 09:19:04 2016 (r308402) @@ -184,14 +184,8 @@ static int ehci_ebus_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/10/sys/arm/cavium/cns11xx/ohci_ec.c ============================================================================== --- stable/10/sys/arm/cavium/cns11xx/ohci_ec.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/arm/cavium/cns11xx/ohci_ec.c Mon Nov 7 09:19:04 2016 (r308402) @@ -177,14 +177,8 @@ static int ohci_ec_detach(device_t dev) { struct ec_ohci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_ohci.sc_bus.bdev) { - bdev = sc->sc_ohci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/10/sys/arm/ti/usb/omap_ehci.c ============================================================================== --- stable/10/sys/arm/ti/usb/omap_ehci.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/arm/ti/usb/omap_ehci.c Mon Nov 7 09:19:04 2016 (r308402) @@ -939,15 +939,8 @@ omap_ehci_detach(device_t dev) { struct omap_ehci_softc *isc = device_get_softc(dev); ehci_softc_t *sc = &isc->base; - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } - /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/10/sys/arm/xilinx/zy7_ehci.c ============================================================================== --- stable/10/sys/arm/xilinx/zy7_ehci.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/arm/xilinx/zy7_ehci.c Mon Nov 7 09:19:04 2016 (r308402) @@ -310,20 +310,17 @@ zy7_ehci_detach(device_t dev) { ehci_softc_t *sc = device_get_softc(dev); + /* during module unload there are lots of children leftover */ + device_delete_children(dev); + sc->sc_flags &= ~EHCI_SCFLG_DONEINIT; - if (device_is_attached(dev)) - bus_generic_detach(dev); - if (sc->sc_irq_res && sc->sc_intr_hdl) /* call ehci_detach() after ehci_init() called after * successful bus_setup_intr(). */ ehci_detach(sc); - if (sc->sc_bus.bdev) { - device_detach(sc->sc_bus.bdev); - device_delete_child(dev, sc->sc_bus.bdev); - } + if (sc->sc_irq_res) { if (sc->sc_intr_hdl != NULL) bus_teardown_intr(dev, sc->sc_irq_res, Modified: stable/10/sys/dev/puc/puc.c ============================================================================== --- stable/10/sys/dev/puc/puc.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/puc/puc.c Mon Nov 7 09:19:04 2016 (r308402) @@ -414,8 +414,7 @@ puc_bfe_detach(device_t dev) port = &sc->sc_port[idx]; if (port->p_dev == NULL) continue; - if (device_detach(port->p_dev) == 0) { - device_delete_child(dev, port->p_dev); + if (device_delete_child(dev, port->p_dev) == 0) { if (port->p_rres != NULL) rman_release_resource(port->p_rres); if (port->p_ires != NULL) Modified: stable/10/sys/dev/usb/controller/at91dci_atmelarm.c ============================================================================== --- stable/10/sys/dev/usb/controller/at91dci_atmelarm.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/usb/controller/at91dci_atmelarm.c Mon Nov 7 09:19:04 2016 (r308402) @@ -243,14 +243,8 @@ static int at91_udp_detach(device_t dev) { struct at91_udp_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/10/sys/dev/usb/controller/at91dci_fdt.c ============================================================================== --- stable/10/sys/dev/usb/controller/at91dci_fdt.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/usb/controller/at91dci_fdt.c Mon Nov 7 09:19:04 2016 (r308402) @@ -249,14 +249,8 @@ static int at91_udp_detach(device_t dev) { struct at91_udp_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/10/sys/dev/usb/controller/atmegadci_atmelarm.c ============================================================================== --- stable/10/sys/dev/usb/controller/atmegadci_atmelarm.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/usb/controller/atmegadci_atmelarm.c Mon Nov 7 09:19:04 2016 (r308402) @@ -155,14 +155,8 @@ static int atmegadci_detach(device_t dev) { struct atmegadci_super_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/10/sys/dev/usb/controller/dwc_otg_fdt.c ============================================================================== --- stable/10/sys/dev/usb/controller/dwc_otg_fdt.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/usb/controller/dwc_otg_fdt.c Mon Nov 7 09:19:04 2016 (r308402) @@ -154,14 +154,8 @@ static int dwc_otg_detach(device_t dev) { struct dwc_otg_super_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/10/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- stable/10/sys/dev/usb/controller/ehci_ixp4xx.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/usb/controller/ehci_ixp4xx.c Mon Nov 7 09:19:04 2016 (r308402) @@ -207,14 +207,8 @@ ehci_ixp_detach(device_t self) { struct ixp_ehci_softc *isc = device_get_softc(self); ehci_softc_t *sc = &isc->base; - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/10/sys/dev/usb/controller/ehci_mv.c ============================================================================== --- stable/10/sys/dev/usb/controller/ehci_mv.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/usb/controller/ehci_mv.c Mon Nov 7 09:19:04 2016 (r308402) @@ -242,14 +242,8 @@ static int mv_ehci_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/10/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/10/sys/dev/usb/controller/ehci_pci.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/usb/controller/ehci_pci.c Mon Nov 7 09:19:04 2016 (r308402) @@ -477,13 +477,7 @@ static int ehci_pci_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/10/sys/dev/usb/controller/musb_otg_atmelarm.c ============================================================================== --- stable/10/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Nov 7 09:19:04 2016 (r308402) @@ -204,14 +204,8 @@ static int musbotg_detach(device_t dev) { struct musbotg_super_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/10/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- stable/10/sys/dev/usb/controller/ohci_pci.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/usb/controller/ohci_pci.c Mon Nov 7 09:19:04 2016 (r308402) @@ -333,13 +333,7 @@ static int ohci_pci_detach(device_t self) { ohci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/10/sys/dev/usb/controller/ohci_s3c24x0.c ============================================================================== --- stable/10/sys/dev/usb/controller/ohci_s3c24x0.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/usb/controller/ohci_s3c24x0.c Mon Nov 7 09:19:04 2016 (r308402) @@ -148,14 +148,8 @@ static int ohci_s3c24x0_detach(device_t dev) { struct ohci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/10/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- stable/10/sys/dev/usb/controller/uhci_pci.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/usb/controller/uhci_pci.c Mon Nov 7 09:19:04 2016 (r308402) @@ -393,13 +393,7 @@ int uhci_pci_detach(device_t self) { uhci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/10/sys/dev/usb/controller/uss820dci_atmelarm.c ============================================================================== --- stable/10/sys/dev/usb/controller/uss820dci_atmelarm.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/usb/controller/uss820dci_atmelarm.c Mon Nov 7 09:19:04 2016 (r308402) @@ -169,14 +169,8 @@ static int uss820_atmelarm_detach(device_t dev) { struct uss820dci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/10/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- stable/10/sys/dev/usb/controller/xhci_pci.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/usb/controller/xhci_pci.c Mon Nov 7 09:19:04 2016 (r308402) @@ -318,13 +318,7 @@ static int xhci_pci_detach(device_t self) { struct xhci_softc *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev != NULL) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/10/sys/dev/usb/usb_device.c ============================================================================== --- stable/10/sys/dev/usb/usb_device.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/dev/usb/usb_device.c Mon Nov 7 09:19:04 2016 (r308402) @@ -1106,10 +1106,8 @@ usb_detach_device_sub(struct usb_device device_printf(dev, "Resume failed\n"); } } - if (device_detach(dev)) { - goto error; - } } + /* detach and delete child */ if (device_delete_child(udev->parent_dev, dev)) { goto error; } Modified: stable/10/sys/kern/subr_bus.c ============================================================================== --- stable/10/sys/kern/subr_bus.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/kern/subr_bus.c Mon Nov 7 09:19:04 2016 (r308402) @@ -1923,15 +1923,17 @@ device_delete_child(device_t dev, device PDEBUG(("%s from %s", DEVICENAME(child), DEVICENAME(dev))); - /* remove children first */ + /* detach parent before deleting children, if any */ + if ((error = device_detach(child)) != 0) + return (error); + + /* remove children second */ while ((grandchild = TAILQ_FIRST(&child->children)) != NULL) { error = device_delete_child(child, grandchild); if (error) return (error); } - if ((error = device_detach(child)) != 0) - return (error); if (child->devclass) devclass_delete_device(child->devclass, child); if (child->parent) Modified: stable/10/sys/mips/atheros/ar71xx_ehci.c ============================================================================== --- stable/10/sys/mips/atheros/ar71xx_ehci.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/mips/atheros/ar71xx_ehci.c Mon Nov 7 09:19:04 2016 (r308402) @@ -196,14 +196,8 @@ ar71xx_ehci_detach(device_t self) { struct ar71xx_ehci_softc *isc = device_get_softc(self); ehci_softc_t *sc = &isc->base; - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/10/sys/mips/atheros/ar71xx_ohci.c ============================================================================== --- stable/10/sys/mips/atheros/ar71xx_ohci.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/mips/atheros/ar71xx_ohci.c Mon Nov 7 09:19:04 2016 (r308402) @@ -143,13 +143,7 @@ static int ar71xx_ohci_detach(device_t dev) { struct ar71xx_ohci_softc *sc = device_get_softc(dev); - device_t bdev; - if (sc->sc_ohci.sc_bus.bdev) { - bdev = sc->sc_ohci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/10/sys/mips/cavium/usb/octusb_octeon.c ============================================================================== --- stable/10/sys/mips/cavium/usb/octusb_octeon.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/mips/cavium/usb/octusb_octeon.c Mon Nov 7 09:19:04 2016 (r308402) @@ -160,16 +160,10 @@ static int octusb_octeon_detach(device_t dev) { struct octusb_octeon_softc *sc = device_get_softc(dev); - device_t bdev; int err; int nports; int i; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/10/sys/mips/rmi/xls_ehci.c ============================================================================== --- stable/10/sys/mips/rmi/xls_ehci.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/mips/rmi/xls_ehci.c Mon Nov 7 09:19:04 2016 (r308402) @@ -164,14 +164,8 @@ static int ehci_xls_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/10/sys/mips/rt305x/rt305x_dotg.c ============================================================================== --- stable/10/sys/mips/rt305x/rt305x_dotg.c Mon Nov 7 08:36:06 2016 (r308401) +++ stable/10/sys/mips/rt305x/rt305x_dotg.c Mon Nov 7 09:19:04 2016 (r308402) @@ -167,14 +167,8 @@ static int dotg_obio_detach(device_t dev) { struct dotg_obio_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); From owner-svn-src-all@freebsd.org Mon Nov 7 09:23:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7386C34BF1; Mon, 7 Nov 2016 09:23:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A41CD6E4; Mon, 7 Nov 2016 09:23:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA79N9S0051208; Mon, 7 Nov 2016 09:23:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA79N7hc051188; Mon, 7 Nov 2016 09:23:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611070923.uA79N7hc051188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 09:23: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: r308403 - in stable/9/sys: dev/puc dev/usb dev/usb/controller kern mips/atheros mips/cavium/usb mips/rmi mips/rt305x X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 09:23:10 -0000 Author: hselasky Date: Mon Nov 7 09:23:07 2016 New Revision: 308403 URL: https://svnweb.freebsd.org/changeset/base/308403 Log: MFC r307518: Fix device delete child function. When detaching device trees parent devices must be detached prior to detaching its children. This is because parent devices can have pointers to the child devices in their softcs which are not invalidated by device_delete_child(). This can cause use after free issues and panic(). Device drivers implementing trees, must ensure its detach function detaches or deletes all its children before returning. While at it remove now redundant device_detach() calls before device_delete_child() and device_delete_children(), mostly in the USB controller drivers. Tested by: Jan Henrik Sylvester Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D8070 Modified: stable/9/sys/dev/puc/puc.c stable/9/sys/dev/usb/controller/at91dci_atmelarm.c stable/9/sys/dev/usb/controller/atmegadci_atmelarm.c stable/9/sys/dev/usb/controller/ehci_ixp4xx.c stable/9/sys/dev/usb/controller/ehci_mv.c stable/9/sys/dev/usb/controller/ehci_pci.c stable/9/sys/dev/usb/controller/musb_otg_atmelarm.c stable/9/sys/dev/usb/controller/ohci_pci.c stable/9/sys/dev/usb/controller/ohci_s3c24x0.c stable/9/sys/dev/usb/controller/uhci_pci.c stable/9/sys/dev/usb/controller/uss820dci_atmelarm.c stable/9/sys/dev/usb/controller/xhci_pci.c stable/9/sys/dev/usb/usb_device.c stable/9/sys/kern/subr_bus.c stable/9/sys/mips/atheros/ar71xx_ehci.c stable/9/sys/mips/atheros/ar71xx_ohci.c stable/9/sys/mips/cavium/usb/octusb_octeon.c stable/9/sys/mips/rmi/xls_ehci.c stable/9/sys/mips/rt305x/rt305x_dotg.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/dev/puc/ (props changed) Modified: stable/9/sys/dev/puc/puc.c ============================================================================== --- stable/9/sys/dev/puc/puc.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/dev/puc/puc.c Mon Nov 7 09:23:07 2016 (r308403) @@ -412,8 +412,7 @@ puc_bfe_detach(device_t dev) port = &sc->sc_port[idx]; if (port->p_dev == NULL) continue; - if (device_detach(port->p_dev) == 0) { - device_delete_child(dev, port->p_dev); + if (device_delete_child(dev, port->p_dev) == 0) { if (port->p_rres != NULL) rman_release_resource(port->p_rres); if (port->p_ires != NULL) Modified: stable/9/sys/dev/usb/controller/at91dci_atmelarm.c ============================================================================== --- stable/9/sys/dev/usb/controller/at91dci_atmelarm.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/dev/usb/controller/at91dci_atmelarm.c Mon Nov 7 09:23:07 2016 (r308403) @@ -262,14 +262,8 @@ static int at91_udp_detach(device_t dev) { struct at91_udp_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/9/sys/dev/usb/controller/atmegadci_atmelarm.c ============================================================================== --- stable/9/sys/dev/usb/controller/atmegadci_atmelarm.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/dev/usb/controller/atmegadci_atmelarm.c Mon Nov 7 09:23:07 2016 (r308403) @@ -155,14 +155,8 @@ static int atmegadci_detach(device_t dev) { struct atmegadci_super_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/9/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- stable/9/sys/dev/usb/controller/ehci_ixp4xx.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/dev/usb/controller/ehci_ixp4xx.c Mon Nov 7 09:23:07 2016 (r308403) @@ -207,14 +207,8 @@ ehci_ixp_detach(device_t self) { struct ixp_ehci_softc *isc = device_get_softc(self); ehci_softc_t *sc = &isc->base; - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/9/sys/dev/usb/controller/ehci_mv.c ============================================================================== --- stable/9/sys/dev/usb/controller/ehci_mv.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/dev/usb/controller/ehci_mv.c Mon Nov 7 09:23:07 2016 (r308403) @@ -239,14 +239,8 @@ static int mv_ehci_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/9/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/9/sys/dev/usb/controller/ehci_pci.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/dev/usb/controller/ehci_pci.c Mon Nov 7 09:23:07 2016 (r308403) @@ -467,13 +467,7 @@ static int ehci_pci_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/9/sys/dev/usb/controller/musb_otg_atmelarm.c ============================================================================== --- stable/9/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Nov 7 09:23:07 2016 (r308403) @@ -204,14 +204,8 @@ static int musbotg_detach(device_t dev) { struct musbotg_super_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/9/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- stable/9/sys/dev/usb/controller/ohci_pci.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/dev/usb/controller/ohci_pci.c Mon Nov 7 09:23:07 2016 (r308403) @@ -332,13 +332,7 @@ static int ohci_pci_detach(device_t self) { ohci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/9/sys/dev/usb/controller/ohci_s3c24x0.c ============================================================================== --- stable/9/sys/dev/usb/controller/ohci_s3c24x0.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/dev/usb/controller/ohci_s3c24x0.c Mon Nov 7 09:23:07 2016 (r308403) @@ -148,14 +148,8 @@ static int ohci_s3c24x0_detach(device_t dev) { struct ohci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/9/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- stable/9/sys/dev/usb/controller/uhci_pci.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/dev/usb/controller/uhci_pci.c Mon Nov 7 09:23:07 2016 (r308403) @@ -387,13 +387,7 @@ int uhci_pci_detach(device_t self) { uhci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/9/sys/dev/usb/controller/uss820dci_atmelarm.c ============================================================================== --- stable/9/sys/dev/usb/controller/uss820dci_atmelarm.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/dev/usb/controller/uss820dci_atmelarm.c Mon Nov 7 09:23:07 2016 (r308403) @@ -169,14 +169,8 @@ static int uss820_atmelarm_detach(device_t dev) { struct uss820dci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/9/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- stable/9/sys/dev/usb/controller/xhci_pci.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/dev/usb/controller/xhci_pci.c Mon Nov 7 09:23:07 2016 (r308403) @@ -311,13 +311,7 @@ static int xhci_pci_detach(device_t self) { struct xhci_softc *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev != NULL) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/9/sys/dev/usb/usb_device.c ============================================================================== --- stable/9/sys/dev/usb/usb_device.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/dev/usb/usb_device.c Mon Nov 7 09:23:07 2016 (r308403) @@ -1073,10 +1073,8 @@ usb_detach_device_sub(struct usb_device device_printf(dev, "Resume failed\n"); } } - if (device_detach(dev)) { - goto error; - } } + /* detach and delete child */ if (device_delete_child(udev->parent_dev, dev)) { goto error; } Modified: stable/9/sys/kern/subr_bus.c ============================================================================== --- stable/9/sys/kern/subr_bus.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/kern/subr_bus.c Mon Nov 7 09:23:07 2016 (r308403) @@ -1864,15 +1864,17 @@ device_delete_child(device_t dev, device PDEBUG(("%s from %s", DEVICENAME(child), DEVICENAME(dev))); - /* remove children first */ + /* detach parent before deleting children, if any */ + if ((error = device_detach(child)) != 0) + return (error); + + /* remove children second */ while ((grandchild = TAILQ_FIRST(&child->children)) != NULL) { error = device_delete_child(child, grandchild); if (error) return (error); } - if ((error = device_detach(child)) != 0) - return (error); if (child->devclass) devclass_delete_device(child->devclass, child); if (child->parent) Modified: stable/9/sys/mips/atheros/ar71xx_ehci.c ============================================================================== --- stable/9/sys/mips/atheros/ar71xx_ehci.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/mips/atheros/ar71xx_ehci.c Mon Nov 7 09:23:07 2016 (r308403) @@ -194,14 +194,8 @@ ar71xx_ehci_detach(device_t self) { struct ar71xx_ehci_softc *isc = device_get_softc(self); ehci_softc_t *sc = &isc->base; - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/9/sys/mips/atheros/ar71xx_ohci.c ============================================================================== --- stable/9/sys/mips/atheros/ar71xx_ohci.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/mips/atheros/ar71xx_ohci.c Mon Nov 7 09:23:07 2016 (r308403) @@ -143,13 +143,7 @@ static int ar71xx_ohci_detach(device_t dev) { struct ar71xx_ohci_softc *sc = device_get_softc(dev); - device_t bdev; - if (sc->sc_ohci.sc_bus.bdev) { - bdev = sc->sc_ohci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/9/sys/mips/cavium/usb/octusb_octeon.c ============================================================================== --- stable/9/sys/mips/cavium/usb/octusb_octeon.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/mips/cavium/usb/octusb_octeon.c Mon Nov 7 09:23:07 2016 (r308403) @@ -151,14 +151,8 @@ static int octusb_octeon_detach(device_t dev) { struct octusb_octeon_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: stable/9/sys/mips/rmi/xls_ehci.c ============================================================================== --- stable/9/sys/mips/rmi/xls_ehci.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/mips/rmi/xls_ehci.c Mon Nov 7 09:23:07 2016 (r308403) @@ -164,14 +164,8 @@ static int ehci_xls_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: stable/9/sys/mips/rt305x/rt305x_dotg.c ============================================================================== --- stable/9/sys/mips/rt305x/rt305x_dotg.c Mon Nov 7 09:19:04 2016 (r308402) +++ stable/9/sys/mips/rt305x/rt305x_dotg.c Mon Nov 7 09:23:07 2016 (r308403) @@ -167,14 +167,8 @@ static int dotg_obio_detach(device_t dev) { struct dotg_obio_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); From owner-svn-src-all@freebsd.org Mon Nov 7 09:27:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E833C34CCF; Mon, 7 Nov 2016 09:27:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9720A01; Mon, 7 Nov 2016 09:27:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA79R7W1051399; Mon, 7 Nov 2016 09:27:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA79R5GG051383; Mon, 7 Nov 2016 09:27:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611070927.uA79R5GG051383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 09:27:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r308404 - in stable/8/sys: dev/puc dev/usb dev/usb/controller kern mips/atheros mips/cavium/usb mips/rmi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 09:27:08 -0000 Author: hselasky Date: Mon Nov 7 09:27:05 2016 New Revision: 308404 URL: https://svnweb.freebsd.org/changeset/base/308404 Log: MFC r307518: Fix device delete child function. When detaching device trees parent devices must be detached prior to detaching its children. This is because parent devices can have pointers to the child devices in their softcs which are not invalidated by device_delete_child(). This can cause use after free issues and panic(). Device drivers implementing trees, must ensure its detach function detaches or deletes all its children before returning. While at it remove now redundant device_detach() calls before device_delete_child() and device_delete_children(), mostly in the USB controller drivers. Tested by: Jan Henrik Sylvester Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D8070 Modified: stable/8/sys/dev/puc/puc.c stable/8/sys/dev/usb/controller/at91dci_atmelarm.c stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c stable/8/sys/dev/usb/controller/ehci_ixp4xx.c stable/8/sys/dev/usb/controller/ehci_pci.c stable/8/sys/dev/usb/controller/musb_otg_atmelarm.c stable/8/sys/dev/usb/controller/ohci_pci.c stable/8/sys/dev/usb/controller/uhci_pci.c stable/8/sys/dev/usb/controller/uss820dci_atmelarm.c stable/8/sys/dev/usb/controller/xhci_pci.c stable/8/sys/dev/usb/usb_device.c stable/8/sys/kern/subr_bus.c stable/8/sys/mips/atheros/ar71xx_ehci.c stable/8/sys/mips/atheros/ar71xx_ohci.c stable/8/sys/mips/cavium/usb/octusb_octeon.c stable/8/sys/mips/rmi/xls_ehci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/arm/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/puc/ (props changed) stable/8/sys/dev/usb/ (props changed) stable/8/sys/kern/ (props changed) stable/8/sys/mips/ (props changed) Modified: stable/8/sys/dev/puc/puc.c ============================================================================== --- stable/8/sys/dev/puc/puc.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/dev/puc/puc.c Mon Nov 7 09:27:05 2016 (r308404) @@ -412,8 +412,7 @@ puc_bfe_detach(device_t dev) port = &sc->sc_port[idx]; if (port->p_dev == NULL) continue; - if (device_detach(port->p_dev) == 0) { - device_delete_child(dev, port->p_dev); + if (device_delete_child(dev, port->p_dev) == 0) { if (port->p_rres != NULL) rman_release_resource(port->p_rres); if (port->p_ires != NULL) Modified: stable/8/sys/dev/usb/controller/at91dci_atmelarm.c ============================================================================== --- stable/8/sys/dev/usb/controller/at91dci_atmelarm.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/dev/usb/controller/at91dci_atmelarm.c Mon Nov 7 09:27:05 2016 (r308404) @@ -261,14 +261,8 @@ static int at91_udp_detach(device_t dev) { struct at91_udp_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_all_children(dev); Modified: stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c ============================================================================== --- stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c Mon Nov 7 09:27:05 2016 (r308404) @@ -154,14 +154,8 @@ static int atmegadci_detach(device_t dev) { struct atmegadci_super_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_all_children(dev); Modified: stable/8/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci_ixp4xx.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/dev/usb/controller/ehci_ixp4xx.c Mon Nov 7 09:27:05 2016 (r308404) @@ -206,14 +206,8 @@ ehci_ixp_detach(device_t self) { struct ixp_ehci_softc *isc = device_get_softc(self); ehci_softc_t *sc = &isc->base; - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_all_children(self); Modified: stable/8/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci_pci.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/dev/usb/controller/ehci_pci.c Mon Nov 7 09:27:05 2016 (r308404) @@ -458,13 +458,7 @@ static int ehci_pci_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_all_children(self); Modified: stable/8/sys/dev/usb/controller/musb_otg_atmelarm.c ============================================================================== --- stable/8/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Nov 7 09:27:05 2016 (r308404) @@ -179,14 +179,8 @@ static int musbotg_detach(device_t dev) { struct musbotg_super_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_all_children(dev); Modified: stable/8/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ohci_pci.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/dev/usb/controller/ohci_pci.c Mon Nov 7 09:27:05 2016 (r308404) @@ -329,13 +329,7 @@ static int ohci_pci_detach(device_t self) { ohci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_all_children(self); Modified: stable/8/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- stable/8/sys/dev/usb/controller/uhci_pci.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/dev/usb/controller/uhci_pci.c Mon Nov 7 09:27:05 2016 (r308404) @@ -379,13 +379,7 @@ int uhci_pci_detach(device_t self) { uhci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_all_children(self); Modified: stable/8/sys/dev/usb/controller/uss820dci_atmelarm.c ============================================================================== --- stable/8/sys/dev/usb/controller/uss820dci_atmelarm.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/dev/usb/controller/uss820dci_atmelarm.c Mon Nov 7 09:27:05 2016 (r308404) @@ -168,14 +168,8 @@ static int uss820_atmelarm_detach(device_t dev) { struct uss820dci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_all_children(dev); Modified: stable/8/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- stable/8/sys/dev/usb/controller/xhci_pci.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/dev/usb/controller/xhci_pci.c Mon Nov 7 09:27:05 2016 (r308404) @@ -294,13 +294,7 @@ static int xhci_pci_detach(device_t self) { struct xhci_softc *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev != NULL) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_all_children(self); Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/dev/usb/usb_device.c Mon Nov 7 09:27:05 2016 (r308404) @@ -1074,10 +1074,8 @@ usb_detach_device_sub(struct usb_device device_printf(dev, "Resume failed\n"); } } - if (device_detach(dev)) { - goto error; - } } + /* detach and delete child */ if (device_delete_child(udev->parent_dev, dev)) { goto error; } Modified: stable/8/sys/kern/subr_bus.c ============================================================================== --- stable/8/sys/kern/subr_bus.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/kern/subr_bus.c Mon Nov 7 09:27:05 2016 (r308404) @@ -1896,15 +1896,17 @@ device_delete_child(device_t dev, device PDEBUG(("%s from %s", DEVICENAME(child), DEVICENAME(dev))); - /* remove children first */ + /* detach parent before deleting children, if any */ + if ((error = device_detach(child)) != 0) + return (error); + + /* remove children second */ while ((grandchild = TAILQ_FIRST(&child->children)) != NULL) { error = device_delete_child(child, grandchild); if (error) return (error); } - if ((error = device_detach(child)) != 0) - return (error); if (child->devclass) devclass_delete_device(child->devclass, child); TAILQ_REMOVE(&dev->children, child, link); Modified: stable/8/sys/mips/atheros/ar71xx_ehci.c ============================================================================== --- stable/8/sys/mips/atheros/ar71xx_ehci.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/mips/atheros/ar71xx_ehci.c Mon Nov 7 09:27:05 2016 (r308404) @@ -172,14 +172,8 @@ ar71xx_ehci_detach(device_t self) { struct ar71xx_ehci_softc *isc = device_get_softc(self); ehci_softc_t *sc = &isc->base; - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_all_children(self); Modified: stable/8/sys/mips/atheros/ar71xx_ohci.c ============================================================================== --- stable/8/sys/mips/atheros/ar71xx_ohci.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/mips/atheros/ar71xx_ohci.c Mon Nov 7 09:27:05 2016 (r308404) @@ -144,13 +144,7 @@ static int ar71xx_ohci_detach(device_t dev) { struct ar71xx_ohci_softc *sc = device_get_softc(dev); - device_t bdev; - if (sc->sc_ohci.sc_bus.bdev) { - bdev = sc->sc_ohci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_all_children(dev); Modified: stable/8/sys/mips/cavium/usb/octusb_octeon.c ============================================================================== --- stable/8/sys/mips/cavium/usb/octusb_octeon.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/mips/cavium/usb/octusb_octeon.c Mon Nov 7 09:27:05 2016 (r308404) @@ -150,14 +150,8 @@ static int octusb_octeon_detach(device_t dev) { struct octusb_octeon_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_all_children(dev); Modified: stable/8/sys/mips/rmi/xls_ehci.c ============================================================================== --- stable/8/sys/mips/rmi/xls_ehci.c Mon Nov 7 09:23:07 2016 (r308403) +++ stable/8/sys/mips/rmi/xls_ehci.c Mon Nov 7 09:27:05 2016 (r308404) @@ -170,14 +170,8 @@ static int ehci_xls_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_all_children(self); From owner-svn-src-all@freebsd.org Mon Nov 7 10:26:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2907C33114; Mon, 7 Nov 2016 10:26:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2D3BDFF; Mon, 7 Nov 2016 10:26:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7AQiAh075151; Mon, 7 Nov 2016 10:26:44 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7AQitq075149; Mon, 7 Nov 2016 10:26:44 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611071026.uA7AQitq075149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 7 Nov 2016 10:26:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308405 - head/sys/arm/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 10:26:46 -0000 Author: andrew Date: Mon Nov 7 10:26:44 2016 New Revision: 308405 URL: https://svnweb.freebsd.org/changeset/base/308405 Log: Start to deorbit the kernel configs in GENERIC by marking them with NO_UNIVERSE. This stops them from being built with the universe, tinderbox, and related targets. Sponsored by: ABT Systems Ltd Modified: head/sys/arm/conf/ALLWINNER head/sys/arm/conf/RPI2 Modified: head/sys/arm/conf/ALLWINNER ============================================================================== --- head/sys/arm/conf/ALLWINNER Mon Nov 7 09:27:05 2016 (r308404) +++ head/sys/arm/conf/ALLWINNER Mon Nov 7 10:26:44 2016 (r308405) @@ -18,6 +18,8 @@ # in NOTES. # # $FreeBSD$ +# +#NO_UNIVERSE ident ALLWINNER Modified: head/sys/arm/conf/RPI2 ============================================================================== --- head/sys/arm/conf/RPI2 Mon Nov 7 09:27:05 2016 (r308404) +++ head/sys/arm/conf/RPI2 Mon Nov 7 10:26:44 2016 (r308405) @@ -17,6 +17,8 @@ # in NOTES. # # $FreeBSD$ +# +#NO_UNIVERSE ident RPI2 From owner-svn-src-all@freebsd.org Mon Nov 7 10:54:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB455C33A42; Mon, 7 Nov 2016 10:54:57 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA56FFA2; Mon, 7 Nov 2016 10:54:57 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7AsuZb086623; Mon, 7 Nov 2016 10:54:56 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7Asu3V086622; Mon, 7 Nov 2016 10:54:56 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201611071054.uA7Asu3V086622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Mon, 7 Nov 2016 10:54:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308406 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 10:54:58 -0000 Author: sgalabov Date: Mon Nov 7 10:54:56 2016 New Revision: 308406 URL: https://svnweb.freebsd.org/changeset/base/308406 Log: Only include sys/boot.h if LINUX_BOOT_ABI is defined Only include sys/boot.h if LINUX_BOOT_ABI is defined in sys/arm/arm/machdep.c Not doing this prevents kernels that do not define LINUX_BOOT_ABI from being build with gcc (at least 4.2.1). Reviewed by: mmel Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D8459 Modified: head/sys/arm/arm/machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Mon Nov 7 10:26:44 2016 (r308405) +++ head/sys/arm/arm/machdep.c Mon Nov 7 10:54:56 2016 (r308406) @@ -76,7 +76,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#if defined(LINUX_BOOT_ABI) #include +#endif #include #include #include From owner-svn-src-all@freebsd.org Mon Nov 7 10:55:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A707C33ABC; Mon, 7 Nov 2016 10:55:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6EFC19F; Mon, 7 Nov 2016 10:55:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7AtvvU086722; Mon, 7 Nov 2016 10:55:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7AtvCD086721; Mon, 7 Nov 2016 10:55:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611071055.uA7AtvCD086721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 7 Nov 2016 10:55:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308407 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 10:55:58 -0000 Author: kib Date: Mon Nov 7 10:55:56 2016 New Revision: 308407 URL: https://svnweb.freebsd.org/changeset/base/308407 Log: vn_fullpath1() checked VV_ROOT and then unreferenced vp->v_mount->mnt_vnodecovered unlocked. This allowed unmount to race. Lock vnode after we noticed the VV_ROOT flag. See comments for explanation why unlocked check for the flag is considered safe. Reported and tested by: avg Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Nov 7 10:54:56 2016 (r308406) +++ head/sys/kern/vfs_cache.c Mon Nov 7 10:55:56 2016 (r308407) @@ -2245,17 +2245,35 @@ vn_fullpath1(struct thread *td, struct v slash_prefixed = 1; } while (vp != rdir && vp != rootvnode) { - if (vp->v_vflag & VV_ROOT) { - if (vp->v_iflag & VI_DOOMED) { /* forced unmount */ - vrele(vp); + /* + * The vp vnode must be already fully constructed, + * since it is either found in namecache or obtained + * from VOP_VPTOCNP(). We may test for VV_ROOT safely + * without obtaining the vnode lock. + */ + if ((vp->v_vflag & VV_ROOT) != 0) { + vn_lock(vp, LK_RETRY | LK_SHARED); + + /* + * With the vnode locked, check for races with + * unmount, forced or not. Note that we + * already verified that vp is not equal to + * the root vnode, which means that + * mnt_vnodecovered can be NULL only for the + * case of unmount. + */ + if ((vp->v_iflag & VI_DOOMED) != 0 || + (vp1 = vp->v_mount->mnt_vnodecovered) == NULL || + vp1->v_mountedhere != vp->v_mount) { + vput(vp); error = ENOENT; SDT_PROBE3(vfs, namecache, fullpath, return, error, vp, NULL); break; } - vp1 = vp->v_mount->mnt_vnodecovered; + vref(vp1); - vrele(vp); + vput(vp); vp = vp1; continue; } From owner-svn-src-all@freebsd.org Mon Nov 7 11:01:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7370AC33D73; Mon, 7 Nov 2016 11:01:11 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B9627B3; Mon, 7 Nov 2016 11:01:11 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7B1A1L089196; Mon, 7 Nov 2016 11:01:10 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7B19js089174; Mon, 7 Nov 2016 11:01:09 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611071101.uA7B19js089174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 7 Nov 2016 11:01:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308408 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 11:01:11 -0000 Author: andrew Date: Mon Nov 7 11:01:09 2016 New Revision: 308408 URL: https://svnweb.freebsd.org/changeset/base/308408 Log: Include machine/armreg.h after machine/asm.h to ensure __ARM_ARCH is defined. MFC after: 1 week Sponsored by: ABT Systems Ltd Modified: head/sys/arm/arm/cpufunc_asm_sheeva.S head/sys/arm/arm/cpufunc_asm_xscale.S head/sys/arm/arm/cpufunc_asm_xscale_c3.S head/sys/arm/arm/fiq_subr.S head/sys/arm/arm/setstack.s Modified: head/sys/arm/arm/cpufunc_asm_sheeva.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_sheeva.S Mon Nov 7 10:55:56 2016 (r308407) +++ head/sys/arm/arm/cpufunc_asm_sheeva.S Mon Nov 7 11:01:09 2016 (r308408) @@ -29,10 +29,10 @@ * SUCH DAMAGE. */ -#include #include __FBSDID("$FreeBSD$"); +#include #include .Lsheeva_cache_line_size: Modified: head/sys/arm/arm/cpufunc_asm_xscale.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_xscale.S Mon Nov 7 10:55:56 2016 (r308407) +++ head/sys/arm/arm/cpufunc_asm_xscale.S Mon Nov 7 11:01:09 2016 (r308408) @@ -71,10 +71,11 @@ * * XScale assembly functions for CPU / MMU / TLB specific operations */ -#include #include __FBSDID("$FreeBSD$"); +#include + /* * Size of the XScale core D-cache. */ Modified: head/sys/arm/arm/cpufunc_asm_xscale_c3.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_xscale_c3.S Mon Nov 7 10:55:56 2016 (r308407) +++ head/sys/arm/arm/cpufunc_asm_xscale_c3.S Mon Nov 7 11:01:09 2016 (r308408) @@ -73,10 +73,11 @@ * XScale core 3 assembly functions for CPU / MMU / TLB specific operations */ -#include #include __FBSDID("$FreeBSD$"); +#include + /* * Size of the XScale core D-cache. */ Modified: head/sys/arm/arm/fiq_subr.S ============================================================================== --- head/sys/arm/arm/fiq_subr.S Mon Nov 7 10:55:56 2016 (r308407) +++ head/sys/arm/arm/fiq_subr.S Mon Nov 7 11:01:09 2016 (r308408) @@ -37,10 +37,11 @@ */ -#include #include __FBSDID("$FreeBSD$"); +#include + /* * MODE_CHANGE_NOP should be inserted between a mode change and a * banked register (R8--R15) access. Modified: head/sys/arm/arm/setstack.s ============================================================================== --- head/sys/arm/arm/setstack.s Mon Nov 7 10:55:56 2016 (r308407) +++ head/sys/arm/arm/setstack.s Mon Nov 7 11:01:09 2016 (r308408) @@ -48,10 +48,11 @@ * */ -#include #include __FBSDID("$FreeBSD$"); +#include + /* To set the stack pointer for a particular mode we must switch * to that mode update the banked r13 and then switch back. * This routine provides an easy way of doing this for any mode From owner-svn-src-all@freebsd.org Mon Nov 7 11:15:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC714C34452; Mon, 7 Nov 2016 11:15:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE10116E; Mon, 7 Nov 2016 11:15:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7BFetV095037; Mon, 7 Nov 2016 11:15:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7BFe9O095036; Mon, 7 Nov 2016 11:15:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611071115.uA7BFe9O095036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 11:15:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308409 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 11:15:42 -0000 Author: hselasky Date: Mon Nov 7 11:15:40 2016 New Revision: 308409 URL: https://svnweb.freebsd.org/changeset/base/308409 Log: When a firmware command times out do not free the command structure to avoid use after free. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Nov 7 11:01:09 2016 (r308408) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Nov 7 11:15:40 2016 (r308409) @@ -1245,8 +1245,11 @@ static int cmd_exec_helper(struct mlx5_c err = mlx5_cmd_invoke(dev, inb, outb, out, out_size, callback, context, pages_queue, &status); - if (err) + if (err) { + if (err == -ETIMEDOUT) + return err; goto out_out; + } mlx5_core_dbg(dev, "err %d, status %d\n", err, status); if (status) { From owner-svn-src-all@freebsd.org Mon Nov 7 11:16:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DA43C3451B; Mon, 7 Nov 2016 11:16:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E107C327; Mon, 7 Nov 2016 11:16:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7BGOTM095105; Mon, 7 Nov 2016 11:16:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7BGOUx095104; Mon, 7 Nov 2016 11:16:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611071116.uA7BGOUx095104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 7 Nov 2016 11:16:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308410 - stable/11/share/man/man4 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 11:16:25 -0000 Author: kib Date: Mon Nov 7 11:16:23 2016 New Revision: 308410 URL: https://svnweb.freebsd.org/changeset/base/308410 Log: MFC r302797 (by markj): Document DDB's "alltrace" and "show all trace" commands. Modified: stable/11/share/man/man4/ddb.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/ddb.4 ============================================================================== --- stable/11/share/man/man4/ddb.4 Mon Nov 7 11:15:40 2016 (r308409) +++ stable/11/share/man/man4/ddb.4 Mon Nov 7 11:16:23 2016 (r308410) @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 6, 2016 +.Dd July 13, 2016 .Dt DDB 4 .Os .Sh NAME @@ -535,6 +535,11 @@ modifier will alter the display to show addresses for the process and not show other information. .\" .Pp +.It Ic show Cm all trace +.It Ic alltrace +.Xc +Show a stack trace for every thread in the system. +.Pp .It Ic show Cm all ttys Show all TTY's within the system. Output is similar to From owner-svn-src-all@freebsd.org Mon Nov 7 11:20:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA7F6C3461D; Mon, 7 Nov 2016 11:20:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6BB6760; Mon, 7 Nov 2016 11:20:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7BKDLH095288; Mon, 7 Nov 2016 11:20:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7BKD7n095287; Mon, 7 Nov 2016 11:20:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611071120.uA7BKD7n095287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 11:20:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308411 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 11:20:15 -0000 Author: hselasky Date: Mon Nov 7 11:20:13 2016 New Revision: 308411 URL: https://svnweb.freebsd.org/changeset/base/308411 Log: Ensure the firmware is notified of any host memory allocation failures. Else firmware commands may time out waiting for host memory. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Mon Nov 7 11:16:23 2016 (r308410) +++ head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Mon Nov 7 11:20:13 2016 (r308411) @@ -246,13 +246,14 @@ static int give_pages(struct mlx5_core_d int inlen; u64 addr; int err; - int i; + int i = 0; inlen = sizeof(*in) + npages * sizeof(in->pas[0]); in = mlx5_vzalloc(inlen); if (!in) { mlx5_core_warn(dev, "vzalloc failed %d\n", inlen); - return -ENOMEM; + err = -ENOMEM; + goto out_alloc; } memset(&out, 0, sizeof(out)); @@ -263,7 +264,7 @@ retry: if (err == -ENOMEM) err = alloc_system_page(dev, func_id); if (err) - goto out_4k; + goto out_alloc; goto retry; } @@ -301,12 +302,11 @@ out_alloc: memset(&out, 0, sizeof(out)); nin->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES); nin->hdr.opmod = cpu_to_be16(MLX5_PAGES_CANT_GIVE); + nin->func_id = cpu_to_be16(func_id); if (mlx5_cmd_exec(dev, nin, sizeof(*nin), &out, sizeof(out))) mlx5_core_warn(dev, "page notify failed\n"); kfree(nin); } - -out_4k: for (i--; i >= 0; i--) free_4k(dev, be64_to_cpu(in->pas[i])); out_free: From owner-svn-src-all@freebsd.org Mon Nov 7 11:22:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0D73C347E6; Mon, 7 Nov 2016 11:22:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFE02B37; Mon, 7 Nov 2016 11:22:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7BMoLD098755; Mon, 7 Nov 2016 11:22:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7BMote098754; Mon, 7 Nov 2016 11:22:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611071122.uA7BMote098754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 11:22:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308412 - head/sys/dev/mlx5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 11:22:52 -0000 Author: hselasky Date: Mon Nov 7 11:22:50 2016 New Revision: 308412 URL: https://svnweb.freebsd.org/changeset/base/308412 Log: Correct checksum fields in the "mlx5_mini_cqe8" structure. The fields in question are currently not used. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/device.h Modified: head/sys/dev/mlx5/device.h ============================================================================== --- head/sys/dev/mlx5/device.h Mon Nov 7 11:20:13 2016 (r308411) +++ head/sys/dev/mlx5/device.h Mon Nov 7 11:22:50 2016 (r308412) @@ -1348,15 +1348,16 @@ struct mlx5_ifc_mcia_reg_bits { struct mlx5_mini_cqe8 { union { - u32 rx_hash_result; - u32 checksum; + __be32 rx_hash_result; + __be16 checksum; + __be16 rsvd; struct { - u16 wqe_counter; + __be16 wqe_counter; u8 s_wqe_opcode; u8 reserved; } s_wqe_info; }; - u32 byte_cnt; + __be32 byte_cnt; }; enum { From owner-svn-src-all@freebsd.org Mon Nov 7 11:26:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18F3CC3494E; Mon, 7 Nov 2016 11:26:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DEDAFEC7; Mon, 7 Nov 2016 11:26:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7BQQwl099207; Mon, 7 Nov 2016 11:26:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7BQQBC099206; Mon, 7 Nov 2016 11:26:26 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611071126.uA7BQQBC099206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 11:26:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308413 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 11:26:27 -0000 Author: hselasky Date: Mon Nov 7 11:26:25 2016 New Revision: 308413 URL: https://svnweb.freebsd.org/changeset/base/308413 Log: Query flow table capabilities according to the correct capability bit for infiniband. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fw.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_fw.c Mon Nov 7 11:22:50 2016 (r308412) +++ head/sys/dev/mlx5/mlx5_core/mlx5_fw.c Mon Nov 7 11:26:25 2016 (r308413) @@ -167,7 +167,11 @@ int mlx5_query_hca_caps(struct mlx5_core return err; } - if (MLX5_CAP_GEN(dev, nic_flow_table)) { + if ((MLX5_CAP_GEN(dev, port_type) == + MLX5_CMD_HCA_CAP_PORT_TYPE_ETHERNET && + MLX5_CAP_GEN(dev, nic_flow_table)) || + (MLX5_CAP_GEN(dev, port_type) == MLX5_CMD_HCA_CAP_PORT_TYPE_IB && + MLX5_CAP_GEN(dev, ipoib_enhanced_offloads))) { err = mlx5_core_get_caps(dev, MLX5_CAP_FLOW_TABLE, HCA_CAP_OPMOD_GET_CUR); if (err) From owner-svn-src-all@freebsd.org Mon Nov 7 11:28:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C05CC349D2; Mon, 7 Nov 2016 11:28:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D562AD; Mon, 7 Nov 2016 11:28:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7BSpMM099333; Mon, 7 Nov 2016 11:28:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7BSpi1099328; Mon, 7 Nov 2016 11:28:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611071128.uA7BSpi1099328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 11:28:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308414 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 11:28:52 -0000 Author: hselasky Date: Mon Nov 7 11:28:50 2016 New Revision: 308414 URL: https://svnweb.freebsd.org/changeset/base/308414 Log: Add more firmware related structures and update existing ones in the MLX5 core module. Update the set and query diagnostics counter API. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/device.h head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_port.c head/sys/dev/mlx5/mlx5_ifc.h head/sys/dev/mlx5/qp.h Modified: head/sys/dev/mlx5/device.h ============================================================================== --- head/sys/dev/mlx5/device.h Mon Nov 7 11:26:25 2016 (r308413) +++ head/sys/dev/mlx5/device.h Mon Nov 7 11:28:50 2016 (r308414) @@ -1271,9 +1271,11 @@ enum { MLX5_RFC_2819_COUNTERS_GROUP = 0x2, MLX5_RFC_3635_COUNTERS_GROUP = 0x3, MLX5_ETHERNET_EXTENDED_COUNTERS_GROUP = 0x5, + MLX5_ETHERNET_DISCARD_COUNTERS_GROUP = 0x6, MLX5_PER_PRIORITY_COUNTERS_GROUP = 0x10, MLX5_PER_TRAFFIC_CLASS_COUNTERS_GROUP = 0x11, MLX5_PHYSICAL_LAYER_COUNTERS_GROUP = 0x12, + MLX5_INFINIBAND_PORT_COUNTERS_GROUP = 0x20, }; enum { Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Mon Nov 7 11:26:25 2016 (r308413) +++ head/sys/dev/mlx5/driver.h Mon Nov 7 11:28:50 2016 (r308414) @@ -120,6 +120,7 @@ enum { MLX5_REG_QETCR = 0x4005, MLX5_REG_QPDP = 0x4007, MLX5_REG_QTCT = 0x400A, + MLX5_REG_QHLL = 0x4016, MLX5_REG_DCBX_PARAM = 0x4020, MLX5_REG_DCBX_APP = 0x4021, MLX5_REG_PCAP = 0x5001, @@ -954,9 +955,11 @@ int mlx5_modify_port_cong_params(struct void *in, int in_size); int mlx5_query_port_cong_statistics(struct mlx5_core_dev *mdev, int clear, void *out, int out_size); -int mlx5_set_diagnostics(struct mlx5_core_dev *mdev, void *in, int in_size); -int mlx5_query_diagnostics(struct mlx5_core_dev *mdev, u8 num_of_samples, - u16 sample_index, void *out, int out_size); +int mlx5_set_diagnostic_params(struct mlx5_core_dev *mdev, void *in, + int in_size); +int mlx5_query_diagnostic_counters(struct mlx5_core_dev *mdev, + u8 num_of_samples, u16 sample_index, + void *out, int out_size); static inline u32 mlx5_mkey_to_idx(u32 mkey) { return mkey >> 8; Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Mon Nov 7 11:26:25 2016 (r308413) +++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Mon Nov 7 11:28:50 2016 (r308414) @@ -831,28 +831,32 @@ int mlx5_query_port_cong_statistics(stru out, out_size); } -int mlx5_set_diagnostics(struct mlx5_core_dev *mdev, void *in, int in_size) +int mlx5_set_diagnostic_params(struct mlx5_core_dev *mdev, void *in, + int in_size) { - u32 out[MLX5_ST_SZ_DW(set_diagnostics_out)]; + u32 out[MLX5_ST_SZ_DW(set_diagnostic_params_out)]; memset(out, 0, sizeof(out)); - MLX5_SET(set_diagnostics_in, in, opcode, MLX5_CMD_OP_SET_DIAGNOSTICS); + MLX5_SET(set_diagnostic_params_in, in, opcode, + MLX5_CMD_OP_SET_DIAGNOSTICS); return mlx5_cmd_exec_check_status(mdev, in, in_size, out, sizeof(out)); } -int mlx5_query_diagnostics(struct mlx5_core_dev *mdev, u8 num_of_samples, - u16 sample_index, void *out, int out_size) +int mlx5_query_diagnostic_counters(struct mlx5_core_dev *mdev, + u8 num_of_samples, u16 sample_index, + void *out, int out_size) { - u32 in[MLX5_ST_SZ_DW(query_diagnostics_in)]; + u32 in[MLX5_ST_SZ_DW(query_diagnostic_counters_in)]; memset(in, 0, sizeof(in)); - MLX5_SET(query_diagnostics_in, in, opcode, + MLX5_SET(query_diagnostic_counters_in, in, opcode, MLX5_CMD_OP_QUERY_DIAGNOSTICS); - MLX5_SET(query_diagnostics_in, in, num_of_samples, num_of_samples); - MLX5_SET(query_diagnostics_in, in, sample_index, sample_index); + MLX5_SET(query_diagnostic_counters_in, in, num_of_samples, + num_of_samples); + MLX5_SET(query_diagnostic_counters_in, in, sample_index, sample_index); return mlx5_cmd_exec_check_status(mdev, in, sizeof(in), out, out_size); } Modified: head/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- head/sys/dev/mlx5/mlx5_ifc.h Mon Nov 7 11:26:25 2016 (r308413) +++ head/sys/dev/mlx5/mlx5_ifc.h Mon Nov 7 11:28:50 2016 (r308414) @@ -149,6 +149,12 @@ enum { MLX5_CMD_OP_QUERY_Q_COUNTER = 0x773, MLX5_CMD_OP_SET_RATE_LIMIT = 0x780, MLX5_CMD_OP_QUERY_RATE_LIMIT = 0x781, + MLX5_CMD_OP_CREATE_SCHEDULING_ELEMENT = 0x782, + MLX5_CMD_OP_DESTROY_SCHEDULING_ELEMENT = 0x783, + MLX5_CMD_OP_QUERY_SCHEDULING_ELEMENT = 0x784, + MLX5_CMD_OP_MODIFY_SCHEDULING_ELEMENT = 0x785, + MLX5_CMD_OP_CREATE_QOS_PARA_VPORT = 0x786, + MLX5_CMD_OP_DESTROY_QOS_PARA_VPORT = 0x787, MLX5_CMD_OP_ALLOC_PD = 0x800, MLX5_CMD_OP_DEALLOC_PD = 0x801, MLX5_CMD_OP_ALLOC_UAR = 0x802, @@ -299,6 +305,59 @@ struct mlx5_ifc_flow_table_fields_suppor u8 reserved_7[0x20]; }; +struct mlx5_ifc_eth_discard_cntrs_grp_bits { + u8 ingress_general_high[0x20]; + + u8 ingress_general_low[0x20]; + + u8 ingress_policy_engine_high[0x20]; + + u8 ingress_policy_engine_low[0x20]; + + u8 ingress_vlan_membership_high[0x20]; + + u8 ingress_vlan_membership_low[0x20]; + + u8 ingress_tag_frame_type_high[0x20]; + + u8 ingress_tag_frame_type_low[0x20]; + + u8 egress_vlan_membership_high[0x20]; + + u8 egress_vlan_membership_low[0x20]; + + u8 loopback_filter_high[0x20]; + + u8 loopback_filter_low[0x20]; + + u8 egress_general_high[0x20]; + + u8 egress_general_low[0x20]; + + u8 reserved_at_1c0[0x40]; + + u8 egress_hoq_high[0x20]; + + u8 egress_hoq_low[0x20]; + + u8 port_isolation_high[0x20]; + + u8 port_isolation_low[0x20]; + + u8 egress_policy_engine_high[0x20]; + + u8 egress_policy_engine_low[0x20]; + + u8 ingress_tx_link_down_high[0x20]; + + u8 ingress_tx_link_down_low[0x20]; + + u8 egress_stp_filter_high[0x20]; + + u8 egress_stp_filter_low[0x20]; + + u8 reserved_at_340[0x480]; +}; struct mlx5_ifc_flow_table_prop_layout_bits { u8 ft_support[0x1]; u8 flow_tag[0x1]; @@ -421,7 +480,9 @@ struct mlx5_ifc_fte_match_set_misc_bits u8 vxlan_vni[0x18]; u8 reserved_3[0x8]; - u8 reserved_4[0x20]; + u8 geneve_vni[0x18]; + u8 reserved4[0x7]; + u8 geneve_oam[0x1]; u8 reserved_5[0xc]; u8 outer_ipv6_flow_label[0x14]; @@ -429,7 +490,9 @@ struct mlx5_ifc_fte_match_set_misc_bits u8 reserved_6[0xc]; u8 inner_ipv6_flow_label[0x14]; - u8 reserved_7[0xe0]; + u8 reserved7[0x10]; + u8 geneve_protocol_type[0x10]; + u8 reserved8[0xc0]; }; struct mlx5_ifc_cmd_pas_bits { @@ -535,6 +598,35 @@ struct mlx5_ifc_debug_cap_bits { struct mlx5_ifc_diagnostic_counter_cap_bits diagnostic_counter[0x1f0]; }; +struct mlx5_ifc_qos_cap_bits { + u8 packet_pacing[0x1]; + u8 esw_scheduling[0x1]; + u8 esw_bw_share[0x1]; + u8 esw_rate_limit[0x1]; + u8 hll[0x1]; + u8 packet_pacing_burst_bound[0x1]; + u8 reserved_at_6[0x1a]; + + u8 reserved_at_20[0x20]; + + u8 packet_pacing_max_rate[0x20]; + + u8 packet_pacing_min_rate[0x20]; + + u8 reserved_at_80[0x10]; + u8 packet_pacing_rate_table_size[0x10]; + + u8 esw_element_type[0x10]; + u8 esw_tsar_type[0x10]; + + u8 reserved_at_c0[0x10]; + u8 max_qos_para_vport[0x10]; + + u8 max_tsar_bw_share[0x20]; + + u8 reserved_at_100[0x700]; +}; + struct mlx5_ifc_snapshot_cap_bits { u8 reserved_0[0x1d]; u8 suspend_qp_uc[0x1]; @@ -599,17 +691,6 @@ struct mlx5_ifc_flow_table_nic_cap_bits u8 reserved_1[0x7200]; }; -struct mlx5_ifc_qos_cap_bits { - u8 packet_pacing[0x1]; - u8 reserved_0[0x1f]; - u8 reserved_1[0x20]; - u8 packet_pacing_max_rate[0x20]; - u8 packet_pacing_min_rate[0x20]; - u8 reserved_2[0x10]; - u8 packet_pacing_rate_table_size[0x10]; - u8 reserved_3[0x760]; -}; - struct mlx5_ifc_per_protocol_networking_offload_caps_bits { u8 csum_cap[0x1]; u8 vlan_cap[0x1]; @@ -631,7 +712,11 @@ struct mlx5_ifc_per_protocol_networking_ u8 tunnel_statless_gre[0x1]; u8 tunnel_stateless_vxlan[0x1]; - u8 reserved_2[0x20]; + u8 swp[0x1]; + u8 swp_csum[0x1]; + u8 swp_lso[0x1]; + u8 reserved_2[0x1c]; + u8 tunnel_stateless_geneve_rx[0x1]; u8 reserved_3[0x10]; u8 lro_min_mss_size[0x10]; @@ -1350,6 +1435,19 @@ struct mlx5_ifc_dcbx_param_reg_bits { u8 reserved_11[0x160]; }; +struct mlx5_ifc_qhll_bits { + u8 reserved_at_0[0x8]; + u8 local_port[0x8]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x1b]; + u8 hll_time[0x5]; + + u8 stall_en[0x1]; + u8 reserved_at_41[0x1c]; + u8 stall_cnt[0x3]; +}; + struct mlx5_ifc_qetcr_reg_bits { u8 operation_type[0x2]; u8 cap_local_admin[0x1]; @@ -2031,14 +2129,16 @@ enum { }; struct mlx5_ifc_sqc_bits { - u8 rlky[0x1]; + u8 rlkey[0x1]; u8 cd_master[0x1]; u8 fre[0x1]; u8 flush_in_error_en[0x1]; u8 allow_multi_pkt_send_wqe[0x1]; u8 min_wqe_inline_mode[0x3]; u8 state[0x4]; - u8 reserved_0[0x14]; + u8 reg_umr[0x1]; + u8 allow_swp[0x1]; + u8 reserved_0[0x12]; u8 reserved_1[0x8]; u8 user_index[0x18]; @@ -2046,7 +2146,9 @@ struct mlx5_ifc_sqc_bits { u8 reserved_2[0x8]; u8 cqn[0x18]; - u8 reserved_3[0x90]; + u8 reserved_3[0x80]; + + u8 qos_para_vport_number[0x10]; u8 packet_pacing_rate_limit_index[0x10]; u8 tis_lst_sz[0x10]; @@ -2060,6 +2162,58 @@ struct mlx5_ifc_sqc_bits { struct mlx5_ifc_wq_bits wq; }; +enum { + MLX5_TSAR_TYPE_DWRR = 0, + MLX5_TSAR_TYPE_ROUND_ROUBIN = 1, + MLX5_TSAR_TYPE_ETS = 2 +}; + +struct mlx5_ifc_tsar_element_attributes_bits { + u8 reserved_0[0x8]; + u8 tsar_type[0x8]; + u8 reserved_1[0x10]; +}; + +struct mlx5_ifc_vport_element_attributes_bits { + u8 reserved_0[0x10]; + u8 vport_number[0x10]; +}; + +struct mlx5_ifc_vport_tc_element_attributes_bits { + u8 traffic_class[0x10]; + u8 vport_number[0x10]; +}; + +struct mlx5_ifc_para_vport_tc_element_attributes_bits { + u8 reserved_0[0x0C]; + u8 traffic_class[0x04]; + u8 qos_para_vport_number[0x10]; +}; + +enum { + MLX5_SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR = 0x0, + MLX5_SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT = 0x1, + MLX5_SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT_TC = 0x2, + MLX5_SCHEDULING_CONTEXT_ELEMENT_TYPE_PARA_VPORT_TC = 0x3, +}; + +struct mlx5_ifc_scheduling_context_bits { + u8 element_type[0x8]; + u8 reserved_at_8[0x18]; + + u8 element_attributes[0x20]; + + u8 parent_element_id[0x20]; + + u8 reserved_at_60[0x40]; + + u8 bw_share[0x20]; + + u8 max_average_bw[0x20]; + + u8 reserved_at_e0[0x120]; +}; + struct mlx5_ifc_rqtc_bits { u8 reserved_0[0xa0]; @@ -3709,6 +3863,38 @@ struct mlx5_ifc_query_special_contexts_i u8 reserved_2[0x40]; }; +struct mlx5_ifc_query_scheduling_element_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0xc0]; + + struct mlx5_ifc_scheduling_context_bits scheduling_context; + + u8 reserved_at_300[0x100]; +}; + +enum { + MLX5_SCHEDULING_ELEMENT_IN_HIERARCHY_E_SWITCH = 0x2, +}; + +struct mlx5_ifc_query_scheduling_element_in_bits { + u8 opcode[0x10]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x10]; + u8 op_mod[0x10]; + + u8 scheduling_hierarchy[0x8]; + u8 reserved_at_48[0x18]; + + u8 scheduling_element_id[0x20]; + + u8 reserved_at_80[0x180]; +}; + struct mlx5_ifc_query_rqt_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; @@ -4687,6 +4873,12 @@ struct mlx5_ifc_qp_2err_in_bits { u8 reserved_3[0x20]; }; +struct mlx5_ifc_para_vport_element_bits { + u8 reserved_at_0[0xc]; + u8 traffic_class[0x4]; + u8 qos_para_vport_number[0x10]; +}; + struct mlx5_ifc_page_fault_resume_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; @@ -4806,6 +4998,12 @@ struct mlx5_ifc_modify_tir_out_bits { u8 reserved_1[0x40]; }; +enum +{ + MLX5_MODIFY_SQ_BITMASK_PACKET_PACING_RATE_LIMIT_INDEX = 0x1 << 0, + MLX5_MODIFY_SQ_BITMASK_QOS_PARA_VPORT_NUMBER = 0x1 << 1 +}; + struct mlx5_ifc_modify_tir_in_bits { u8 opcode[0x10]; u8 reserved_0[0x10]; @@ -4854,6 +5052,47 @@ struct mlx5_ifc_modify_sq_in_bits { struct mlx5_ifc_sqc_bits ctx; }; +struct mlx5_ifc_modify_scheduling_element_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0x1c0]; +}; + +enum { + MLX5_MODIFY_SCHEDULING_ELEMENT_IN_SCHEDULING_HIERARCHY_E_SWITCH = 0x2, +}; + +enum { + MLX5_MODIFY_SCHEDULING_ELEMENT_BITMASK_BW_SHARE = 0x1, + MLX5_MODIFY_SCHEDULING_ELEMENT_BITMASK_MAX_AVERAGE_BW = 0x2, +}; + +struct mlx5_ifc_modify_scheduling_element_in_bits { + u8 opcode[0x10]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x10]; + u8 op_mod[0x10]; + + u8 scheduling_hierarchy[0x8]; + u8 reserved_at_48[0x18]; + + u8 scheduling_element_id[0x20]; + + u8 reserved_at_80[0x20]; + + u8 modify_bitmask[0x20]; + + u8 reserved_at_c0[0x40]; + + struct mlx5_ifc_scheduling_context_bits scheduling_context; + + u8 reserved_at_300[0x100]; +}; + struct mlx5_ifc_modify_rqt_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; @@ -5568,6 +5807,34 @@ struct mlx5_ifc_destroy_sq_in_bits { u8 reserved_3[0x20]; }; +struct mlx5_ifc_destroy_scheduling_element_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0x1c0]; +}; + +enum { + MLX5_DESTROY_SCHEDULING_ELEMENT_IN_SCHEDULING_HIERARCHY_E_SWITCH = 0x2, +}; + +struct mlx5_ifc_destroy_scheduling_element_in_bits { + u8 opcode[0x10]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x10]; + u8 op_mod[0x10]; + + u8 scheduling_hierarchy[0x8]; + u8 reserved_at_48[0x18]; + + u8 scheduling_element_id[0x20]; + + u8 reserved_at_80[0x180]; +}; + struct mlx5_ifc_destroy_rqt_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; @@ -5656,6 +5923,30 @@ struct mlx5_ifc_destroy_qp_in_bits { u8 reserved_3[0x20]; }; +struct mlx5_ifc_destroy_qos_para_vport_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0x1c0]; +}; + +struct mlx5_ifc_destroy_qos_para_vport_in_bits { + u8 opcode[0x10]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x10]; + u8 op_mod[0x10]; + + u8 reserved_at_40[0x20]; + + u8 reserved_at_60[0x10]; + u8 qos_para_vport_number[0x10]; + + u8 reserved_at_80[0x180]; +}; + struct mlx5_ifc_destroy_psv_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; @@ -5991,13 +6282,7 @@ struct mlx5_ifc_counter_id_bits { u8 counter_id[0x10]; }; -struct mlx5_ifc_set_diagnostics_in_bits { - u8 opcode[0x10]; - u8 reserved_0[0x10]; - - u8 reserved_1[0x10]; - u8 op_mod[0x10]; - +struct mlx5_ifc_diagnostic_params_context_bits { u8 num_of_counters[0x10]; u8 reserved_2[0x8]; u8 log_num_of_samples[0x8]; @@ -6016,7 +6301,17 @@ struct mlx5_ifc_set_diagnostics_in_bits struct mlx5_ifc_counter_id_bits counter_id[0]; }; -struct mlx5_ifc_set_diagnostics_out_bits { +struct mlx5_ifc_set_diagnostic_params_in_bits { + u8 opcode[0x10]; + u8 reserved_0[0x10]; + + u8 reserved_1[0x10]; + u8 op_mod[0x10]; + + struct mlx5_ifc_diagnostic_params_context_bits diagnostic_params_ctx; +}; + +struct mlx5_ifc_set_diagnostic_params_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; @@ -6025,7 +6320,7 @@ struct mlx5_ifc_set_diagnostics_out_bits u8 reserved_1[0x40]; }; -struct mlx5_ifc_query_diagnostics_in_bits { +struct mlx5_ifc_query_diagnostic_counters_in_bits { u8 opcode[0x10]; u8 reserved_0[0x10]; @@ -6049,7 +6344,7 @@ struct mlx5_ifc_diagnostic_counter_bits u8 counter_value_l[0x20]; }; -struct mlx5_ifc_query_diagnostics_out_bits { +struct mlx5_ifc_query_diagnostic_counters_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; @@ -6266,6 +6561,40 @@ struct mlx5_ifc_create_sq_in_bits { struct mlx5_ifc_sqc_bits ctx; }; +struct mlx5_ifc_create_scheduling_element_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0x40]; + + u8 scheduling_element_id[0x20]; + + u8 reserved_at_a0[0x160]; +}; + +enum { + MLX5_CREATE_SCHEDULING_ELEMENT_IN_SCHEDULING_HIERARCHY_E_SWITCH = 0x2, +}; + +struct mlx5_ifc_create_scheduling_element_in_bits { + u8 opcode[0x10]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x10]; + u8 op_mod[0x10]; + + u8 scheduling_hierarchy[0x8]; + u8 reserved_at_48[0x18]; + + u8 reserved_at_60[0xa0]; + + struct mlx5_ifc_scheduling_context_bits scheduling_context; + + u8 reserved_at_300[0x100]; +}; + struct mlx5_ifc_create_rqt_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; @@ -6373,6 +6702,30 @@ struct mlx5_ifc_create_qp_in_bits { u8 pas[0][0x40]; }; +struct mlx5_ifc_create_qos_para_vport_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0x20]; + + u8 reserved_at_60[0x10]; + u8 qos_para_vport_number[0x10]; + + u8 reserved_at_80[0x180]; +}; + +struct mlx5_ifc_create_qos_para_vport_in_bits { + u8 opcode[0x10]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x10]; + u8 op_mod[0x10]; + + u8 reserved_at_40[0x1c0]; +}; + struct mlx5_ifc_create_psv_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; @@ -6951,6 +7304,7 @@ struct mlx5_ifc_set_rate_limit_in_bits { u8 reserved_at_60[0x20]; u8 rate_limit[0x20]; + u8 burst_upper_bound[0x20]; }; struct mlx5_ifc_access_register_out_bits { @@ -7604,6 +7958,39 @@ struct mlx5_ifc_phys_layer_cntrs_bits { u8 reserved_0[0x180]; }; +struct mlx5_ifc_infiniband_port_cntrs_bits { + u8 symbol_error_counter[0x10]; + u8 link_error_recovery_counter[0x8]; + u8 link_downed_counter[0x8]; + + u8 port_rcv_errors[0x10]; + u8 port_rcv_remote_physical_errors[0x10]; + + u8 port_rcv_switch_relay_errors[0x10]; + u8 port_xmit_discards[0x10]; + + u8 port_xmit_constraint_errors[0x8]; + u8 port_rcv_constraint_errors[0x8]; + u8 reserved_0[0x8]; + u8 local_link_integrity_errors[0x4]; + u8 excessive_buffer_overrun_errors[0x4]; + + u8 reserved_1[0x10]; + u8 vl_15_dropped[0x10]; + + u8 port_xmit_data[0x20]; + + u8 port_rcv_data[0x20]; + + u8 port_xmit_pkts[0x20]; + + u8 port_rcv_pkts[0x20]; + + u8 port_xmit_wait[0x20]; + + u8 reserved_2[0x680]; +}; + struct mlx5_ifc_phrr_reg_bits { u8 clr[0x1]; u8 reserved_0[0x7]; @@ -7692,7 +8079,10 @@ struct mlx5_ifc_pfcc_reg_bits { u8 reserved_7[0x8]; u8 cbfrx[0x8]; - u8 reserved_8[0x80]; + u8 device_stall_minor_watermark[0x10]; + u8 device_stall_critical_watermark[0x10]; + + u8 reserved_8[0x60]; }; struct mlx5_ifc_pelc_reg_bits { @@ -7885,7 +8275,19 @@ struct mlx5_ifc_eth_per_prio_grp_data_la u8 rx_pause_transition_low[0x20]; - u8 reserved_2[0x400]; + u8 rx_discards_high[0x20]; + + u8 rx_discards_low[0x20]; + + u8 device_stall_minor_watermark_cnt_high[0x20]; + + u8 device_stall_minor_watermark_cnt_low[0x20]; + + u8 device_stall_critical_watermark_cnt_high[0x20]; + + u8 device_stall_critical_watermark_cnt_low[0x20]; + + u8 reserved_2[0x340]; }; struct mlx5_ifc_eth_extended_cntrs_grp_data_layout_bits { @@ -8782,8 +9184,10 @@ union mlx5_ifc_eth_cntrs_grp_data_layout struct mlx5_ifc_eth_2819_cntrs_grp_data_layout_bits eth_2819_cntrs_grp_data_layout; struct mlx5_ifc_eth_3635_cntrs_grp_data_layout_bits eth_3635_cntrs_grp_data_layout; struct mlx5_ifc_eth_extended_cntrs_grp_data_layout_bits eth_extended_cntrs_grp_data_layout; + struct mlx5_ifc_eth_discard_cntrs_grp_bits eth_discard_cntrs_grp; struct mlx5_ifc_eth_per_prio_grp_data_layout_bits eth_per_prio_grp_data_layout; struct mlx5_ifc_phys_layer_cntrs_bits phys_layer_cntrs; + struct mlx5_ifc_infiniband_port_cntrs_bits infiniband_port_cntrs; u8 reserved_0[0x7c0]; }; @@ -8941,6 +9345,7 @@ union mlx5_ifc_ports_control_registers_d struct mlx5_ifc_eth_2863_cntrs_grp_data_layout_bits eth_2863_cntrs_grp_data_layout; struct mlx5_ifc_eth_3635_cntrs_grp_data_layout_bits eth_3635_cntrs_grp_data_layout; struct mlx5_ifc_eth_802_3_cntrs_grp_data_layout_bits eth_802_3_cntrs_grp_data_layout; + struct mlx5_ifc_eth_discard_cntrs_grp_bits eth_discard_cntrs_grp; struct mlx5_ifc_eth_extended_cntrs_grp_data_layout_bits eth_extended_cntrs_grp_data_layout; struct mlx5_ifc_eth_per_prio_grp_data_layout_bits eth_per_prio_grp_data_layout; struct mlx5_ifc_eth_per_traffic_class_cong_layout_bits eth_per_traffic_class_cong_layout; Modified: head/sys/dev/mlx5/qp.h ============================================================================== --- head/sys/dev/mlx5/qp.h Mon Nov 7 11:26:25 2016 (r308413) +++ head/sys/dev/mlx5/qp.h Mon Nov 7 11:28:50 2016 (r308414) @@ -220,10 +220,20 @@ enum { MLX5_ETH_WQE_L4_CSUM = 1 << 7, }; +enum { + MLX5_ETH_WQE_SWP_OUTER_L3_TYPE = 1 << 0, + MLX5_ETH_WQE_SWP_OUTER_L4_TYPE = 1 << 1, + MLX5_ETH_WQE_SWP_INNER_L3_TYPE = 1 << 4, + MLX5_ETH_WQE_SWP_INNER_L4_TYPE = 1 << 5, +}; + struct mlx5_wqe_eth_seg { - u8 rsvd0[4]; + u8 swp_outer_l4_offset; + u8 swp_outer_l3_offset; + u8 swp_inner_l4_offset; + u8 swp_inner_l3_offset; u8 cs_flags; - u8 rsvd1; + u8 swp_flags; __be16 mss; __be32 rsvd2; __be16 inline_hdr_sz; From owner-svn-src-all@freebsd.org Mon Nov 7 11:35:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDC20C34C9C; Mon, 7 Nov 2016 11:35:15 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C6A18F3; Mon, 7 Nov 2016 11:35:15 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7BZEnO003373; Mon, 7 Nov 2016 11:35:14 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7BZEoD003372; Mon, 7 Nov 2016 11:35:14 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201611071135.uA7BZEoD003372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Mon, 7 Nov 2016 11:35:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308415 - head/sys/arm/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 11:35:15 -0000 Author: sgalabov Date: Mon Nov 7 11:35:14 2016 New Revision: 308415 URL: https://svnweb.freebsd.org/changeset/base/308415 Log: Generate an error if machine/armreg.h is included without sys/cdefs.h machine/armreg.h requires access to the __ARM_ARCH macro, which is not always properly defined (especially by gcc 4.2.1). We should include sys/cdefs.h in order to get the definitions in machine/acle-compat.h, which would properly define the __ARM_ARCH macro in these cases. So, in cases where machine/armreg.h is included without _SYS_CDEFS_H_ being defined - generate an #error. Reviewed by: andrew Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D8460 Modified: head/sys/arm/include/armreg.h Modified: head/sys/arm/include/armreg.h ============================================================================== --- head/sys/arm/include/armreg.h Mon Nov 7 11:28:50 2016 (r308414) +++ head/sys/arm/include/armreg.h Mon Nov 7 11:35:14 2016 (r308415) @@ -41,6 +41,10 @@ #ifndef MACHINE_ARMREG_H #define MACHINE_ARMREG_H +#ifndef _SYS_CDEFS_H_ +#error Please include sys/cdefs.h before including machine/armreg.h +#endif + #define INSN_SIZE 4 #define INSN_COND_MASK 0xf0000000 /* Condition mask */ #define PSR_MODE 0x0000001f /* mode mask */ From owner-svn-src-all@freebsd.org Mon Nov 7 11:39:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A857AC34D5C; Mon, 7 Nov 2016 11:39:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50B5BAFA; Mon, 7 Nov 2016 11:39:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7BdjY2003587; Mon, 7 Nov 2016 11:39:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7BdjlP003584; Mon, 7 Nov 2016 11:39:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611071139.uA7BdjlP003584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Nov 2016 11:39:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308416 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 11:39:46 -0000 Author: hselasky Date: Mon Nov 7 11:39:45 2016 New Revision: 308416 URL: https://svnweb.freebsd.org/changeset/base/308416 Log: Add timer to watch the RQ when we are out of mbufs. The firmware/hardware does not generate additional completion events unless we post new buffers. Use a timer to try to post more buffers in case we are temporarily out of mbufs. Else the receive schedule completely stops. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Mon Nov 7 11:35:14 2016 (r308415) +++ head/sys/dev/mlx5/mlx5_en/en.h Mon Nov 7 11:39:45 2016 (r308416) @@ -478,6 +478,7 @@ struct mlx5e_rq { struct mlx5_wq_ctrl wq_ctrl; u32 rqn; struct mlx5e_channel *channel; + struct callout watchdog; } __aligned(MLX5E_CACHELINE_SIZE); struct mlx5e_sq_mbuf { Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Nov 7 11:35:14 2016 (r308415) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Nov 7 11:39:45 2016 (r308416) @@ -855,7 +855,13 @@ err_destroy_rq: static void mlx5e_close_rq(struct mlx5e_rq *rq) { + mtx_lock(&rq->mtx); rq->enabled = 0; + callout_stop(&rq->watchdog); + mtx_unlock(&rq->mtx); + + callout_drain(&rq->watchdog); + mlx5e_modify_rq(rq, MLX5_RQC_STATE_RDY, MLX5_RQC_STATE_ERR); } @@ -1439,6 +1445,8 @@ mlx5e_chan_mtx_init(struct mlx5e_channel mtx_init(&c->rq.mtx, "mlx5rx", MTX_NETWORK_LOCK, MTX_DEF); + callout_init_mtx(&c->rq.watchdog, &c->rq.mtx, 0); + for (tc = 0; tc < c->num_tc; tc++) { struct mlx5e_sq *sq = c->sq + tc; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Mon Nov 7 11:35:14 2016 (r308415) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Mon Nov 7 11:39:45 2016 (r308416) @@ -82,9 +82,10 @@ mlx5e_post_rx_wqes(struct mlx5e_rq *rq) while (!mlx5_wq_ll_is_full(&rq->wq)) { struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, rq->wq.head); - if (unlikely(mlx5e_alloc_rx_wqe(rq, wqe, rq->wq.head))) + if (unlikely(mlx5e_alloc_rx_wqe(rq, wqe, rq->wq.head))) { + callout_reset_curcpu(&rq->watchdog, 1, (void *)&mlx5e_post_rx_wqes, rq); break; - + } mlx5_wq_ll_push(&rq->wq, be16_to_cpu(wqe->next.next_wqe_index)); } From owner-svn-src-all@freebsd.org Mon Nov 7 11:56:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 697CBC3428F; Mon, 7 Nov 2016 11:56:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 354EB3E3; Mon, 7 Nov 2016 11:56:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7BuIbC011185; Mon, 7 Nov 2016 11:56:18 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7BuIAM011184; Mon, 7 Nov 2016 11:56:18 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611071156.uA7BuIAM011184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 7 Nov 2016 11:56:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308417 - head/sys/arm/ti X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 11:56:19 -0000 Author: andrew Date: Mon Nov 7 11:56:18 2016 New Revision: 308417 URL: https://svnweb.freebsd.org/changeset/base/308417 Log: Fix the order of includes so machine/asm.h is first. MFC after: 1 week Sponsored by: ABT Systems Ltd Modified: head/sys/arm/ti/ti_smc.S Modified: head/sys/arm/ti/ti_smc.S ============================================================================== --- head/sys/arm/ti/ti_smc.S Mon Nov 7 11:39:45 2016 (r308416) +++ head/sys/arm/ti/ti_smc.S Mon Nov 7 11:56:18 2016 (r308417) @@ -22,10 +22,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include __FBSDID("$FreeBSD$"); +#include + .cpu cortex-a8 .arch_extension sec From owner-svn-src-all@freebsd.org Mon Nov 7 12:10:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1896C331C1; Mon, 7 Nov 2016 12:10:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 69C4A14F; Mon, 7 Nov 2016 12:10:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7CAJcS015441; Mon, 7 Nov 2016 12:10:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7CAILf015426; Mon, 7 Nov 2016 12:10:18 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611071210.uA7CAILf015426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 7 Nov 2016 12:10:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308418 - in stable/11: share/man/man4 sys/amd64/amd64 sys/amd64/include sys/ddb sys/i386/i386 sys/i386/include sys/x86/include X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 12:10:20 -0000 Author: kib Date: Mon Nov 7 12:10:17 2016 New Revision: 308418 URL: https://svnweb.freebsd.org/changeset/base/308418 Log: Merge bde improvements for ddb on x86, mostly for single-stepping and vm86 mode. MFC r304085 (by bde): Fix the variables $esp, $ds, $es, $fs, $gs and $ss in vm86 mode. Fix PC_REGS() so that printing of instructions works in some useful cases. MFC r304962 (by bde): Expand error messages: print symbol names, parentheses and shift tokens, and negative shift counts. Fix error messages. MFC r305612 (by bde): Fix single-stepping of instructions emulated by vm86. MFC r305661 (by bde): Give the full syntax of the 'count' arg for all commmands that support it. Give the full syntax of the 'addr' arg for these commands and some others. Rename it from 'address' for the generic command. Fix description of how 'count' is supposed to work for the 'break' command. Don't (mis)describe the syntax of the comma for the 'step' command. Expand the description for the generic command. Give the full syntax for the 'examine' command. It was also missing the possible values for the modifier. MFC r305663 (by bde): Fix stopping when the specified breakpoint count is reached. MFC r305665 (by bde): Pass the trap type and code down from db_trap() to db_stop_at_pc() so that the latter can easily determine what the trap type actually is after callers are fixed to encode the type unambigously. MFC r305807 (by bde): Use the MI macro TRAPF_USERMODE() instead of open-coded checks for SEL_UPL and sometimes PSL_VM. Fix logic errors in treating vm86 bioscall mode as kernel mode. The main place checked all the necessary flags, but put the necessary parentheses for the PSL_VM and PCB_VM86CALL checks in the wrong place. MFC r305811 (by bz): Try to fix LINT builds after r305807. MFC r305840 (by bde): Abort single stepping in ddb if the trap is not for single-stepping. MFC r305862 (by bde): Ifdef the new dr6 variable for KDB. MFC r305864 (by bde): Statically initialize the run mode to the one that will become current on first entry. Don't reset to the run mode to STEP_NONE when stopping, and remove STEP_NONE. MFC r305865 (by bde): Fix decoding of tf_rsp on amd64, and move TF_HAS_STACKREGS() to the i386-only section, and fix a comment about the amd64 kernel trapframe not having stackregs. MFC r305897 (by bde): Silently ignore unexpected single-step traps. MFC r306311 (by bde): Determine the operand/address size of %cs in a new function db_segsize(). Use db_segsize() to set the default operand/address size for disassembling. Fix db_print_loc_and_inst() to ask for the normal format and not the alternate in normal operation. Use db_segsize() to avoid trying to print a garbage stack trace if %cs is 16 bits. Modified: stable/11/share/man/man4/ddb.4 stable/11/sys/amd64/amd64/trap.c stable/11/sys/amd64/include/db_machdep.h stable/11/sys/ddb/db_examine.c stable/11/sys/ddb/db_expr.c stable/11/sys/ddb/db_main.c stable/11/sys/ddb/db_run.c stable/11/sys/ddb/ddb.h stable/11/sys/i386/i386/db_disasm.c stable/11/sys/i386/i386/db_interface.c stable/11/sys/i386/i386/db_trace.c stable/11/sys/i386/i386/trap.c stable/11/sys/i386/i386/vm86.c stable/11/sys/i386/include/db_machdep.h stable/11/sys/x86/include/frame.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/ddb.4 ============================================================================== --- stable/11/share/man/man4/ddb.4 Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/share/man/man4/ddb.4 Mon Nov 7 12:10:17 2016 (r308418) @@ -146,25 +146,32 @@ to be the same as .Pp The general command syntax is: .Ar command Ns Op Li / Ns Ar modifier -.Ar address Ns Op Li , Ns Ar count +.Oo Ar addr Oc Ns Op Li , Ns Ar count .Pp A blank line repeats the previous command from the address .Va next with count 1 and no modifiers. Specifying -.Ar address +.Ar addr sets .Va dot to the address. Omitting -.Ar address +.Ar addr uses .Va dot . A missing .Ar count is taken to be 1 for printing commands or infinity for stack traces. +A +.Ar count +of -1 is equivalent to a missing +.Ar count . +Options that are supplied but not supported by the given +.Ar command +are usually ignored. .Pp The .Nm @@ -204,8 +211,14 @@ browse through the history buffer, and m current line. .Sh COMMANDS .Bl -tag -width indent -compact -.It Ic examine -.It Ic x +.It Xo +.Ic examine Ns Op Li / Ns Cm AISabcdghilmorsuxz ... +.Oo Ar addr Oc Ns Op Li , Ns Ar count +.Xc +.It Xo +.Ic x Ns Op Li / Ns Cm AISabcdghilmorsuxz ... +.Oo Ar addr Oc Ns Op Li , Ns Ar count +.Xc Display the addressed locations according to the formats in the modifier. Multiple modifier formats display multiple locations. If no format is specified, the last format specified for this command @@ -251,7 +264,9 @@ The location is also displayed in hex at display as an instruction .It Cm I display as an instruction with possible alternate formats depending on the -machine, but none of the supported architectures have an alternate format. +machine. +On i386, this selects the alternate format for the instruction decoding +(16 bits in a 32-bit code segment and vice versa). .It Cm S display a symbol name for the pointer stored at the address .El @@ -328,16 +343,17 @@ Set the named variable or register with .Ar expr . Valid variable names are described below. .Pp -.It Ic break Ns Op Li / Ns Cm u -.It Ic b Ns Op Li / Ns Cm u +.It Ic break Ns Oo Li / Ns Cm u Oc Oo Ar addr Oc Ns Op Li , Ns Ar count +.It Ic b Ns Oo Li / Ns Cm u Oc Oo Ar addr Oc Ns Op Li , Ns Ar count Set a break point at .Ar addr . If .Ar count -is supplied, continues +is supplied, the +.Ic continue +command will not stop at this break point on the first .Ar count -\- 1 times before stopping at the -break point. +\- 1 times that it is hit. If the break point is set, a break point number is printed with .Ql # . @@ -361,21 +377,24 @@ user space break points may not work cor Setting a break point at the low-level code paths may also cause strange behavior. .Pp -.It Ic delete Ar addr -.It Ic d Ar addr +.It Ic delete Op Ar addr +.It Ic d Op Ar addr .It Ic delete Li # Ns Ar number -.It Ic d Li # Ns Ar number -Delete the break point. -The target break point can be specified by a +.It Ic d Li # Ns Ar number +Delete the specified break point. +The break point can be specified by a break point number with .Ql # , or by using the same .Ar addr specified in the original .Ic break -command. +command, or by omitting +.Ar addr +to get the default address of +.Va dot . .Pp -.It Ic watch Ar addr Ns Li , Ns Ar size +.It Ic watch Oo Ar addr Oc Ns Op Li , Ns Ar size Set a watchpoint for a region. Execution stops when an attempt to modify the region occurs. The @@ -389,7 +408,7 @@ Attempts to watch wired kernel memory may cause unrecoverable error in some systems such as i386. Watchpoints on user addresses work best. .Pp -.It Ic hwatch Ar addr Ns Li , Ns Ar size +.It Ic hwatch Oo Ar addr Oc Ns Op Li , Ns Ar size Set a hardware watchpoint for a region if supported by the architecture. Execution stops when an attempt to modify the region occurs. @@ -405,14 +424,14 @@ Use for setting watchpoints on kernel address locations only, and avoid its use on user mode address spaces. .Pp -.It Ic dhwatch Ar addr Ns Li , Ns Ar size +.It Ic dhwatch Oo Ar addr Oc Ns Op Li , Ns Ar size Delete specified hardware watchpoint. .Pp -.It Ic step Ns Op Li / Ns Cm p -.It Ic s Ns Op Li / Ns Cm p +.It Ic step Ns Oo Li / Ns Cm p Oc Ns Op Li , Ns Ar count +.It Ic s Ns Oo Li / Ns Cm p Oc Ns Op Li , Ns Ar count Single step .Ar count -times (the comma is a mandatory part of the syntax). +times. If the .Cm p modifier is specified, print each instruction at each step. @@ -458,22 +477,22 @@ Otherwise, only print when the matching .Pp .It Xo .Ic trace Ns Op Li / Ns Cm u -.Op Ar pid | tid +.Op Ar pid | tid Ns .Op Li , Ns Ar count .Xc .It Xo .Ic t Ns Op Li / Ns Cm u -.Op Ar pid | tid +.Op Ar pid | tid Ns .Op Li , Ns Ar count .Xc .It Xo .Ic where Ns Op Li / Ns Cm u -.Op Ar pid | tid +.Op Ar pid | tid Ns .Op Li , Ns Ar count .Xc .It Xo .Ic bt Ns Op Li / Ns Cm u -.Op Ar pid | tid +.Op Ar pid | tid Ns .Op Li , Ns Ar count .Xc Stack trace. @@ -498,16 +517,11 @@ only if the machine dependent code suppo .Ic search Ns Op Li / Ns Cm bhl .Ar addr .Ar value -.Op Ar mask +.Op Ar mask Ns .Op Li , Ns Ar count .Xc Search memory for .Ar value . -This command might fail in interesting -ways if it does not find the searched-for value. -This is because -.Nm -does not always recover from touching bad memory. The optional .Ar count argument limits the search. @@ -537,7 +551,6 @@ addresses for the process and not show o .Pp .It Ic show Cm all trace .It Ic alltrace -.Xc Show a stack trace for every thread in the system. .Pp .It Ic show Cm all ttys Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/sys/amd64/amd64/trap.c Mon Nov 7 12:10:17 2016 (r308418) @@ -176,7 +176,10 @@ trap(struct trapframe *frame) #endif struct thread *td = curthread; struct proc *p = td->td_proc; - int i = 0, ucode = 0, code; +#ifdef KDB + register_t dr6; +#endif + int i = 0, ucode = 0; u_int type; register_t addr = 0; ksiginfo_t ksi; @@ -236,7 +239,7 @@ trap(struct trapframe *frame) * interrupts disabled until they are accidentally * enabled later. */ - if (ISPL(frame->tf_cs) == SEL_UPL) + if (TRAPF_USERMODE(frame)) uprintf( "pid %ld (%s): trap %d with interrupts disabled\n", (long)curproc->p_pid, curthread->td_name, type); @@ -258,9 +261,7 @@ trap(struct trapframe *frame) } } - code = frame->tf_err; - - if (ISPL(frame->tf_cs) == SEL_UPL) { + if (TRAPF_USERMODE(frame)) { /* user trap */ td->td_pticks = 0; @@ -377,7 +378,7 @@ trap(struct trapframe *frame) #ifdef DEV_ISA case T_NMI: /* machine/parity/power fail/"kitchen sink" faults */ - if (isa_nmi(code) == 0) { + if (isa_nmi(frame->tf_err) == 0) { #ifdef KDB /* * NMI can be hooked up to a pushbutton @@ -540,8 +541,7 @@ trap(struct trapframe *frame) * Reset breakpoint bits because the * processor doesn't */ - /* XXX check upper bits here */ - load_dr6(rdr6() & 0xfffffff0); + load_dr6(rdr6() & ~0xf); goto out; } /* @@ -553,7 +553,10 @@ trap(struct trapframe *frame) * Otherwise, debugger traps "can't happen". */ #ifdef KDB - if (kdb_trap(type, 0, frame)) + /* XXX %dr6 is not quite reentrant. */ + dr6 = rdr6(); + load_dr6(dr6 & ~0x4000); + if (kdb_trap(type, dr6, frame)) goto out; #endif break; @@ -561,7 +564,7 @@ trap(struct trapframe *frame) #ifdef DEV_ISA case T_NMI: /* machine/parity/power fail/"kitchen sink" faults */ - if (isa_nmi(code) == 0) { + if (isa_nmi(frame->tf_err) == 0) { #ifdef KDB /* * NMI can be hooked up to a pushbutton @@ -773,7 +776,6 @@ trap_fatal(frame, eva) { int code, ss; u_int type; - long esp; struct soft_segment_descriptor softseg; char *msg; @@ -787,7 +789,7 @@ trap_fatal(frame, eva) else msg = "UNKNOWN"; printf("\n\nFatal trap %d: %s while in %s mode\n", type, msg, - ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel"); + TRAPF_USERMODE(frame) ? "user" : "kernel"); #ifdef SMP /* two separate prints in case of a trap on an unmapped page */ printf("cpuid = %d; ", PCPU_GET(cpuid)); @@ -804,14 +806,8 @@ trap_fatal(frame, eva) } printf("instruction pointer = 0x%lx:0x%lx\n", frame->tf_cs & 0xffff, frame->tf_rip); - if (ISPL(frame->tf_cs) == SEL_UPL) { - ss = frame->tf_ss & 0xffff; - esp = frame->tf_rsp; - } else { - ss = GSEL(GDATA_SEL, SEL_KPL); - esp = (long)&frame->tf_rsp; - } - printf("stack pointer = 0x%x:0x%lx\n", ss, esp); + ss = frame->tf_ss & 0xffff; + printf("stack pointer = 0x%x:0x%lx\n", ss, frame->tf_rsp); printf("frame pointer = 0x%x:0x%lx\n", ss, frame->tf_rbp); printf("code segment = base 0x%lx, limit 0x%lx, type 0x%x\n", softseg.ssd_base, softseg.ssd_limit, softseg.ssd_type); @@ -934,7 +930,7 @@ amd64_syscall(struct thread *td, int tra ksiginfo_t ksi; #ifdef DIAGNOSTIC - if (ISPL(td->td_frame->tf_cs) != SEL_UPL) { + if (!TRAPF_USERMODE(td->td_frame)) { panic("syscall"); /* NOT REACHED */ } Modified: stable/11/sys/amd64/include/db_machdep.h ============================================================================== --- stable/11/sys/amd64/include/db_machdep.h Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/sys/amd64/include/db_machdep.h Mon Nov 7 12:10:17 2016 (r308418) @@ -56,12 +56,16 @@ do { \ #define db_clear_single_step kdb_cpu_clear_singlestep #define db_set_single_step kdb_cpu_set_singlestep -#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BPTFLT) /* - * Watchpoints are not supported. The debug exception type is in %dr6 - * and not yet in the args to this macro. + * The debug exception type is copied from %dr6 to 'code' and used to + * disambiguate single step traps. Watchpoints have no special support. + * Our hardware breakpoints are not well integrated with ddb and are too + * different from watchpoints. ddb treats them as unknown traps with + * unknown addresses and doesn't turn them off while it is running. */ -#define IS_WATCHPOINT_TRAP(type, code) 0 +#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BPTFLT) +#define IS_SSTEP_TRAP(type, code) ((type) == T_TRCTRAP && (code) & 0x4000) +#define IS_WATCHPOINT_TRAP(type, code) 0 #define I_CALL 0xe8 #define I_CALLI 0xff Modified: stable/11/sys/ddb/db_examine.c ============================================================================== --- stable/11/sys/ddb/db_examine.c Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/sys/ddb/db_examine.c Mon Nov 7 12:10:17 2016 (r308418) @@ -241,7 +241,7 @@ db_print_loc_and_inst(db_addr_t loc) db_printsym(loc, DB_STGY_PROC); if (db_search_symbol(loc, DB_STGY_PROC, &off) != C_DB_SYM_NULL) { db_printf(":\t"); - (void)db_disasm(loc, true); + (void)db_disasm(loc, false); } } Modified: stable/11/sys/ddb/db_expr.c ============================================================================== --- stable/11/sys/ddb/db_expr.c Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/sys/ddb/db_expr.c Mon Nov 7 12:10:17 2016 (r308418) @@ -57,7 +57,8 @@ db_term(db_expr_t *valuep) if (!db_value_of_name(db_tok_string, valuep) && !db_value_of_name_pcpu(db_tok_string, valuep) && !db_value_of_name_vnet(db_tok_string, valuep)) { - db_error("Symbol not found\n"); + db_printf("Symbol '%s' not found\n", db_tok_string); + db_error(NULL); /*NOTREACHED*/ } return (true); @@ -89,12 +90,14 @@ db_term(db_expr_t *valuep) } if (t == tLPAREN) { if (!db_expression(valuep)) { - db_error("Syntax error\n"); + db_printf("Expression syntax error after '%c'\n", '('); + db_error(NULL); /*NOTREACHED*/ } t = db_read_token(); if (t != tRPAREN) { - db_error("Syntax error\n"); + db_printf("Expression syntax error -- expected '%c'\n", ')'); + db_error(NULL); /*NOTREACHED*/ } return (true); @@ -164,7 +167,9 @@ db_mult_expr(db_expr_t *valuep) while (t == tSTAR || t == tSLASH || t == tPCT || t == tHASH || t == tBIT_AND ) { if (!db_term(&rhs)) { - db_printf("Expression syntax error after '%c'\n", '!'); + db_printf("Expression syntax error after '%c'\n", + t == tSTAR ? '*' : t == tSLASH ? '/' : t == tPCT ? '%' : + t == tHASH ? '#' : '&'); db_error(NULL); /*NOTREACHED*/ } @@ -177,7 +182,7 @@ db_mult_expr(db_expr_t *valuep) break; default: if (rhs == 0) { - db_error("Divide by 0\n"); + db_error("Division by 0\n"); /*NOTREACHED*/ } if (t == tSLASH) @@ -199,7 +204,6 @@ db_add_expr(db_expr_t *valuep) { db_expr_t lhs, rhs; int t; - char c; if (!db_mult_expr(&lhs)) return (false); @@ -207,8 +211,8 @@ db_add_expr(db_expr_t *valuep) t = db_read_token(); while (t == tPLUS || t == tMINUS || t == tBIT_OR) { if (!db_mult_expr(&rhs)) { - c = db_tok_string[0]; - db_printf("Expression syntax error after '%c'\n", c); + db_printf("Expression syntax error after '%c'\n", + t == tPLUS ? '+' : t == tMINUS ? '-' : '|'); db_error(NULL); /*NOTREACHED*/ } @@ -243,11 +247,14 @@ db_shift_expr(db_expr_t *valuep) t = db_read_token(); while (t == tSHIFT_L || t == tSHIFT_R) { if (!db_add_expr(&rhs)) { - db_error("Syntax error\n"); + db_printf("Expression syntax error after '%s'\n", + t == tSHIFT_L ? "<<" : ">>"); + db_error(NULL); /*NOTREACHED*/ } if (rhs < 0) { - db_error("Negative shift amount\n"); + db_printf("Negative shift amount %jd\n", (intmax_t)rhs); + db_error(NULL); /*NOTREACHED*/ } if (t == tSHIFT_L) @@ -269,7 +276,6 @@ db_logical_relation_expr( { db_expr_t lhs, rhs; int t; - char op[3]; if (!db_shift_expr(&lhs)) return (false); @@ -277,11 +283,11 @@ db_logical_relation_expr( t = db_read_token(); while (t == tLOG_EQ || t == tLOG_NOT_EQ || t == tGREATER || t == tGREATER_EQ || t == tLESS || t == tLESS_EQ) { - op[0] = db_tok_string[0]; - op[1] = db_tok_string[1]; - op[2] = 0; if (!db_shift_expr(&rhs)) { - db_printf("Expression syntax error after \"%s\"\n", op); + db_printf("Expression syntax error after '%s'\n", + t == tLOG_EQ ? "==" : t == tLOG_NOT_EQ ? "!=" : + t == tGREATER ? ">" : t == tGREATER_EQ ? ">=" : + t == tLESS ? "<" : "<="); db_error(NULL); /*NOTREACHED*/ } Modified: stable/11/sys/ddb/db_main.c ============================================================================== --- stable/11/sys/ddb/db_main.c Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/sys/ddb/db_main.c Mon Nov 7 12:10:17 2016 (r308418) @@ -226,10 +226,7 @@ db_trap(int type, int code) if (cnunavailable()) return (0); - bkpt = IS_BREAKPOINT_TRAP(type, code); - watchpt = IS_WATCHPOINT_TRAP(type, code); - - if (db_stop_at_pc(&bkpt)) { + if (db_stop_at_pc(type, code, &bkpt, &watchpt)) { if (db_inst_count) { db_printf("After %d instructions (%d loads, %d stores),\n", db_inst_count, db_load_count, db_store_count); Modified: stable/11/sys/ddb/db_run.c ============================================================================== --- stable/11/sys/ddb/db_run.c Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/sys/ddb/db_run.c Mon Nov 7 12:10:17 2016 (r308418) @@ -48,15 +48,15 @@ __FBSDID("$FreeBSD$"); #include #include -static int db_run_mode; -#define STEP_NONE 0 #define STEP_ONCE 1 #define STEP_RETURN 2 #define STEP_CALLT 3 #define STEP_CONTINUE 4 #define STEP_INVISIBLE 5 #define STEP_COUNT 6 +static int db_run_mode = STEP_CONTINUE; +static bool db_sstep_multiple; static bool db_sstep_print; static int db_loop_count; static int db_call_depth; @@ -90,13 +90,14 @@ db_pc_is_singlestep(db_addr_t pc) #endif bool -db_stop_at_pc(bool *is_breakpoint) +db_stop_at_pc(int type, int code, bool *is_breakpoint, bool *is_watchpoint) { db_addr_t pc; db_breakpoint_t bkpt; + *is_breakpoint = IS_BREAKPOINT_TRAP(type, code); + *is_watchpoint = IS_WATCHPOINT_TRAP(type, code); pc = PC_REGS(); - if (db_pc_is_singlestep(pc)) *is_breakpoint = false; @@ -125,13 +126,39 @@ db_stop_at_pc(bool *is_breakpoint) *is_breakpoint = true; return (true); /* stop here */ } + return (false); /* continue the countdown */ } else if (*is_breakpoint) { #ifdef BKPT_SKIP BKPT_SKIP; #endif } - *is_breakpoint = false; + *is_breakpoint = false; /* might be a breakpoint, but not ours */ + + /* + * If not stepping, then silently ignore single-step traps + * (except for clearing the single-step-flag above). + * + * If stepping, then abort if the trap type is unexpected. + * Breakpoints owned by us are expected and were handled above. + * Single-steps are expected and are handled below. All others + * are unexpected. + * + * Only do either of these if the MD layer claims to classify + * single-step traps unambiguously (by defining IS_SSTEP_TRAP). + * Otherwise, fall through to the bad historical behaviour + * given by turning unexpected traps into expected traps: if not + * stepping, then expect only breakpoints and stop, and if + * stepping, then expect only single-steps and step. + */ +#ifdef IS_SSTEP_TRAP + if (db_run_mode == STEP_CONTINUE && IS_SSTEP_TRAP(type, code)) + return (false); + if (db_run_mode != STEP_CONTINUE && !IS_SSTEP_TRAP(type, code)) { + printf("Stepping aborted\n"); + return (true); + } +#endif if (db_run_mode == STEP_INVISIBLE) { db_run_mode = STEP_CONTINUE; @@ -184,7 +211,6 @@ db_stop_at_pc(bool *is_breakpoint) return (false); /* continue */ } } - db_run_mode = STEP_NONE; return (true); } @@ -194,6 +220,7 @@ db_restart_at_pc(bool watchpt) db_addr_t pc = PC_REGS(); if ((db_run_mode == STEP_COUNT) || + ((db_run_mode == STEP_ONCE) && db_sstep_multiple) || (db_run_mode == STEP_RETURN) || (db_run_mode == STEP_CALLT)) { /* @@ -321,6 +348,7 @@ db_single_step_cmd(db_expr_t addr, bool db_run_mode = STEP_ONCE; db_loop_count = count; + db_sstep_multiple = (count != 1); db_sstep_print = print; db_inst_count = 0; db_load_count = 0; Modified: stable/11/sys/ddb/ddb.h ============================================================================== --- stable/11/sys/ddb/ddb.h Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/sys/ddb/ddb.h Mon Nov 7 12:10:17 2016 (r308418) @@ -215,7 +215,8 @@ void db_restart_at_pc(bool watchpt); int db_set_variable(db_expr_t value); void db_set_watchpoints(void); void db_skip_to_eol(void); -bool db_stop_at_pc(bool *is_breakpoint); +bool db_stop_at_pc(int type, int code, bool *is_breakpoint, + bool *is_watchpoint); #define db_strcpy strcpy void db_trace_self(void); int db_trace_thread(struct thread *, int); Modified: stable/11/sys/i386/i386/db_disasm.c ============================================================================== --- stable/11/sys/i386/i386/db_disasm.c Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/sys/i386/i386/db_disasm.c Mon Nov 7 12:10:17 2016 (r308418) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); * Instruction disassembler. */ #include +#include #include #include @@ -1168,9 +1169,17 @@ db_disasm(db_addr_t loc, bool altfmt) int len; struct i_addr address; + if (db_segsize(kdb_frame) == 16) + altfmt = !altfmt; get_value_inc(inst, loc, 1, FALSE); - short_addr = FALSE; - size = LONG; + if (altfmt) { + short_addr = TRUE; + size = WORD; + } + else { + short_addr = FALSE; + size = LONG; + } seg = NULL; /* Modified: stable/11/sys/i386/i386/db_interface.c ============================================================================== --- stable/11/sys/i386/i386/db_interface.c Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/sys/i386/i386/db_interface.c Mon Nov 7 12:10:17 2016 (r308418) @@ -135,6 +135,30 @@ db_write_bytes(vm_offset_t addr, size_t return (ret); } +int +db_segsize(struct trapframe *tfp) +{ + struct proc_ldt *plp; + struct segment_descriptor *sdp; + int sel; + + if (tfp == NULL) + return (32); + if (tfp->tf_eflags & PSL_VM) + return (16); + sel = tfp->tf_cs & 0xffff; + if (sel == GSEL(GCODE_SEL, SEL_KPL)) + return (32); + /* Rare cases follow. User mode cases are currently unreachable. */ + if (ISLDT(sel)) { + plp = curthread->td_proc->p_md.md_ldt; + sdp = (plp != NULL) ? &plp->ldt_sd : &ldt[0].sd; + } else { + sdp = &gdt[PCPU_GET(cpuid) * NGDT].sd; + } + return (sdp[IDXSEL(sel)].sd_def32 == 0 ? 16 : 32); +} + void db_show_mdpcpu(struct pcpu *pc) { Modified: stable/11/sys/i386/i386/db_trace.c ============================================================================== --- stable/11/sys/i386/i386/db_trace.c Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/sys/i386/i386/db_trace.c Mon Nov 7 12:10:17 2016 (r308418) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -81,8 +82,7 @@ struct db_variable *db_eregs = db_regs + static __inline int get_esp(struct trapframe *tf) { - return ((ISPL(tf->tf_cs)) ? tf->tf_esp : - (db_expr_t)tf + (uintptr_t)DB_OFFSET(tf_esp)); + return (TF_HAS_STACKREGS(tf) ? tf->tf_esp : (intptr_t)&tf->tf_esp); } static int @@ -104,12 +104,32 @@ db_frame(struct db_variable *vp, db_expr static int db_frame_seg(struct db_variable *vp, db_expr_t *valuep, int op) { + struct trapframe_vm86 *tfp; + int off; uint16_t *reg; if (kdb_frame == NULL) return (0); - reg = (uint16_t *)((uintptr_t)kdb_frame + (db_expr_t)vp->valuep); + off = (intptr_t)vp->valuep; + if (kdb_frame->tf_eflags & PSL_VM) { + tfp = (void *)kdb_frame; + switch ((intptr_t)vp->valuep) { + case (intptr_t)DB_OFFSET(tf_cs): + reg = (uint16_t *)&tfp->tf_cs; + break; + case (intptr_t)DB_OFFSET(tf_ds): + reg = (uint16_t *)&tfp->tf_vm86_ds; + break; + case (intptr_t)DB_OFFSET(tf_es): + reg = (uint16_t *)&tfp->tf_vm86_es; + break; + case (intptr_t)DB_OFFSET(tf_fs): + reg = (uint16_t *)&tfp->tf_vm86_fs; + break; + } + } else + reg = (uint16_t *)((uintptr_t)kdb_frame + off); if (op == DB_VAR_GET) *valuep = *reg; else @@ -126,7 +146,7 @@ db_esp(struct db_variable *vp, db_expr_t if (op == DB_VAR_GET) *valuep = get_esp(kdb_frame); - else if (ISPL(kdb_frame->tf_cs)) + else if (TF_HAS_STACKREGS(kdb_frame)) kdb_frame->tf_esp = *valuep; return (1); } @@ -134,7 +154,16 @@ db_esp(struct db_variable *vp, db_expr_t static int db_gs(struct db_variable *vp, db_expr_t *valuep, int op) { + struct trapframe_vm86 *tfp; + if (kdb_frame != NULL && kdb_frame->tf_eflags & PSL_VM) { + tfp = (void *)kdb_frame; + if (op == DB_VAR_GET) + *valuep = tfp->tf_vm86_gs; + else + tfp->tf_vm86_gs = *valuep; + return (1); + } if (op == DB_VAR_GET) *valuep = rgs(); else @@ -150,8 +179,9 @@ db_ss(struct db_variable *vp, db_expr_t return (0); if (op == DB_VAR_GET) - *valuep = (ISPL(kdb_frame->tf_cs)) ? kdb_frame->tf_ss : rss(); - else if (ISPL(kdb_frame->tf_cs)) + *valuep = TF_HAS_STACKREGS(kdb_frame) ? kdb_frame->tf_ss : + rss(); + else if (TF_HAS_STACKREGS(kdb_frame)) kdb_frame->tf_ss = *valuep; return (1); } @@ -391,6 +421,17 @@ db_backtrace(struct thread *td, struct t int instr, narg; boolean_t first; + if (db_segsize(tf) == 16) { + db_printf( +"--- 16-bit%s, cs:eip = %#x:%#x, ss:esp = %#x:%#x, ebp = %#x, tf = %p ---\n", + (tf->tf_eflags & PSL_VM) ? " (vm86)" : "", + tf->tf_cs, tf->tf_eip, + TF_HAS_STACKREGS(tf) ? tf->tf_ss : rss(), + TF_HAS_STACKREGS(tf) ? tf->tf_esp : (intptr_t)&tf->tf_esp, + tf->tf_ebp, tf); + return (0); + } + /* * If an indirect call via an invalid pointer caused a trap, * %pc contains the invalid address while the return address @@ -408,7 +449,7 @@ db_backtrace(struct thread *td, struct t * Find where the trap frame actually ends. * It won't contain tf_esp or tf_ss unless crossing rings. */ - if (ISPL(kdb_frame->tf_cs)) + if (TF_HAS_STACKREGS(kdb_frame)) instr = (int)(kdb_frame + 1); else instr = (int)&kdb_frame->tf_esp; Modified: stable/11/sys/i386/i386/trap.c ============================================================================== --- stable/11/sys/i386/i386/trap.c Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/sys/i386/i386/trap.c Mon Nov 7 12:10:17 2016 (r308418) @@ -189,7 +189,10 @@ trap(struct trapframe *frame) #endif struct thread *td = curthread; struct proc *p = td->td_proc; - int i = 0, ucode = 0, code; +#ifdef KDB + register_t dr6; +#endif + int i = 0, ucode = 0; u_int type; register_t addr = 0; vm_offset_t eva; @@ -267,7 +270,8 @@ trap(struct trapframe *frame) * interrupts disabled until they are accidentally * enabled later. */ - if (ISPL(frame->tf_cs) == SEL_UPL || (frame->tf_eflags & PSL_VM)) + if (TRAPF_USERMODE(frame) && + (curpcb->pcb_flags & PCB_VM86CALL) == 0) uprintf( "pid %ld (%s): trap %d with interrupts disabled\n", (long)curproc->p_pid, curthread->td_name, type); @@ -291,7 +295,6 @@ trap(struct trapframe *frame) } } eva = 0; - code = frame->tf_err; if (type == T_PAGEFLT) { /* * For some Cyrix CPUs, %cr2 is clobbered by @@ -307,9 +310,7 @@ trap(struct trapframe *frame) enable_intr(); } - if ((ISPL(frame->tf_cs) == SEL_UPL) || - ((frame->tf_eflags & PSL_VM) && - !(curpcb->pcb_flags & PCB_VM86CALL))) { + if (TRAPF_USERMODE(frame) && (curpcb->pcb_flags & PCB_VM86CALL) == 0) { /* user trap */ td->td_pticks = 0; @@ -335,6 +336,7 @@ trap(struct trapframe *frame) goto out; } #endif +user_trctrap_out: frame->tf_eflags &= ~PSL_T; i = SIGTRAP; ucode = (type == T_TRCTRAP ? TRAP_TRACE : TRAP_BRKPT); @@ -360,6 +362,11 @@ trap(struct trapframe *frame) case T_STKFLT: /* stack fault */ if (frame->tf_eflags & PSL_VM) { i = vm86_emulate((struct vm86frame *)frame); + if (i == SIGTRAP) { + type = T_TRCTRAP; + load_dr6(rdr6() | 0x4000); + goto user_trctrap_out; + } if (i == 0) goto user; break; @@ -461,7 +468,7 @@ trap(struct trapframe *frame) goto userout; #else /* !POWERFAIL_NMI */ /* machine/parity/power fail/"kitchen sink" faults */ - if (isa_nmi(code) == 0) { + if (isa_nmi(frame->tf_err) == 0) { #ifdef KDB /* * NMI can be hooked up to a pushbutton @@ -566,6 +573,11 @@ trap(struct trapframe *frame) case T_STKFLT: /* stack fault */ if (frame->tf_eflags & PSL_VM) { i = vm86_emulate((struct vm86frame *)frame); + if (i == SIGTRAP) { + type = T_TRCTRAP; + load_dr6(rdr6() | 0x4000); + goto kernel_trctrap; + } if (i != 0) /* * returns to original process @@ -654,6 +666,7 @@ trap(struct trapframe *frame) break; case T_TRCTRAP: /* trace trap */ +kernel_trctrap: if (frame->tf_eip == (int)IDTVEC(lcall_syscall)) { /* * We've just entered system mode via the @@ -687,7 +700,7 @@ trap(struct trapframe *frame) * Reset breakpoint bits because the * processor doesn't */ - load_dr6(rdr6() & 0xfffffff0); + load_dr6(rdr6() & ~0xf); goto out; } /* @@ -699,7 +712,10 @@ trap(struct trapframe *frame) * Otherwise, debugger traps "can't happen". */ #ifdef KDB - if (kdb_trap(type, 0, frame)) + /* XXX %dr6 is not quite reentrant. */ + dr6 = rdr6(); + load_dr6(dr6 & ~0x4000); + if (kdb_trap(type, dr6, frame)) goto out; #endif break; @@ -715,7 +731,7 @@ trap(struct trapframe *frame) goto out; #else /* !POWERFAIL_NMI */ /* machine/parity/power fail/"kitchen sink" faults */ - if (isa_nmi(code) == 0) { + if (isa_nmi(frame->tf_err) == 0) { #ifdef KDB /* * NMI can be hooked up to a pushbutton @@ -953,7 +969,7 @@ trap_fatal(frame, eva) } printf("instruction pointer = 0x%x:0x%x\n", frame->tf_cs & 0xffff, frame->tf_eip); - if ((ISPL(frame->tf_cs) == SEL_UPL) || (frame->tf_eflags & PSL_VM)) { + if (TF_HAS_STACKREGS(frame)) { ss = frame->tf_ss & 0xffff; esp = frame->tf_esp; } else { @@ -1107,7 +1123,8 @@ syscall(struct trapframe *frame) ksiginfo_t ksi; #ifdef DIAGNOSTIC - if (ISPL(frame->tf_cs) != SEL_UPL) { + if (!(TRAPF_USERMODE(frame) && + (curpcb->pcb_flags & PCB_VM86CALL) == 0)) { panic("syscall"); /* NOT REACHED */ } Modified: stable/11/sys/i386/i386/vm86.c ============================================================================== --- stable/11/sys/i386/i386/vm86.c Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/sys/i386/i386/vm86.c Mon Nov 7 12:10:17 2016 (r308418) @@ -171,7 +171,7 @@ vm86_emulate(vmf) PUSHL((vmf->vmf_eflags & PUSH_MASK) | PSL_IOPL, vmf); vmf->vmf_ip += inc_ip; - return (0); + return (retcode); case POPF: temp_flags = POPL(vmf) & POP_MASK; @@ -185,7 +185,7 @@ vm86_emulate(vmf) } else { vmf->vmf_eflags &= ~PSL_VIF; } - return (0); + return (retcode); } break; @@ -203,7 +203,7 @@ vm86_emulate(vmf) case INTn: break; - /* VME if trying to set PSL_TF, or PSL_I when VIP is set */ + /* VME if trying to set PSL_T, or PSL_I when VIP is set */ case POPF: temp_flags = POP(vmf) & POP_MASK; vmf->vmf_flags = (vmf->vmf_flags & ~POP_MASK) @@ -218,7 +218,7 @@ vm86_emulate(vmf) } return (retcode); - /* VME if trying to set PSL_TF, or PSL_I when VIP is set */ + /* VME if trying to set PSL_T, or PSL_I when VIP is set */ case IRET: vmf->vmf_ip = POP(vmf); vmf->vmf_cs = POP(vmf); Modified: stable/11/sys/i386/include/db_machdep.h ============================================================================== --- stable/11/sys/i386/include/db_machdep.h Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/sys/i386/include/db_machdep.h Mon Nov 7 12:10:17 2016 (r308418) @@ -35,7 +35,10 @@ typedef vm_offset_t db_addr_t; /* address - unsigned */ typedef int db_expr_t; /* expression - signed */ -#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_eip) +#define PC_REGS() ((db_addr_t)(kdb_frame->tf_eflags & PSL_VM ? \ + (kdb_frame->tf_eip & 0xffff) + \ + ((kdb_frame->tf_cs & 0xffff) << 4) : \ + kdb_frame->tf_eip)) #define BKPT_INST 0xcc /* breakpoint instruction */ #define BKPT_SIZE (1) /* size of breakpoint inst */ @@ -56,12 +59,16 @@ do { \ #define db_clear_single_step kdb_cpu_clear_singlestep #define db_set_single_step kdb_cpu_set_singlestep -#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BPTFLT) /* - * Watchpoints are not supported. The debug exception type is in %dr6 - * and not yet in the args to this macro. + * The debug exception type is copied from %dr6 to 'code' and used to + * disambiguate single step traps. Watchpoints have no special support. + * Our hardware breakpoints are not well integrated with ddb and are too + * different from watchpoints. ddb treats them as unknown traps with + * unknown addresses and doesn't turn them off while it is running. */ -#define IS_WATCHPOINT_TRAP(type, code) 0 +#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BPTFLT) +#define IS_SSTEP_TRAP(type, code) ((type) == T_TRCTRAP && (code) & 0x4000) +#define IS_WATCHPOINT_TRAP(type, code) 0 #define I_CALL 0xe8 #define I_CALLI 0xff @@ -91,4 +98,6 @@ do { \ #define DB_SMALL_VALUE_MAX 0x7fffffff #define DB_SMALL_VALUE_MIN (-0x400001) +int db_segsize(struct trapframe *tfp); + #endif /* !_MACHINE_DB_MACHDEP_H_ */ Modified: stable/11/sys/x86/include/frame.h ============================================================================== --- stable/11/sys/x86/include/frame.h Mon Nov 7 11:56:18 2016 (r308417) +++ stable/11/sys/x86/include/frame.h Mon Nov 7 12:10:17 2016 (r308418) @@ -64,7 +64,7 @@ struct trapframe { int tf_eip; int tf_cs; int tf_eflags; - /* below only when crossing rings (e.g. user to kernel) */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Nov 7 14:02:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53575C33287; Mon, 7 Nov 2016 14:02:29 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3012422D; Mon, 7 Nov 2016 14:02:28 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (67-0-232-116.albq.qwest.net [67.0.232.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 4A5751928BA; Mon, 7 Nov 2016 14:02:26 +0000 (UTC) Subject: Re: svn commit: r308345 - head/sys/dev/e1000 To: John Baldwin References: <201611051630.uA5GUhtk073581@repo.freebsd.org> <15572642.JMvQo5TC3D@ralph.baldwin.cx> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Sean Bruno Message-ID: <28ef0f40-f2a3-92ea-fac6-a586c81810b0@freebsd.org> Date: Mon, 7 Nov 2016 07:02:23 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <15572642.JMvQo5TC3D@ralph.baldwin.cx> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="lotim6AVPElTpsBaFLPlfNhgHjGJmm4L8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 14:02:29 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --lotim6AVPElTpsBaFLPlfNhgHjGJmm4L8 Content-Type: multipart/mixed; boundary="ncFn9WmclKOCqEXh9Dl8KoIvLJ9KdTJse"; protected-headers="v1" From: Sean Bruno To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <28ef0f40-f2a3-92ea-fac6-a586c81810b0@freebsd.org> Subject: Re: svn commit: r308345 - head/sys/dev/e1000 References: <201611051630.uA5GUhtk073581@repo.freebsd.org> <15572642.JMvQo5TC3D@ralph.baldwin.cx> In-Reply-To: <15572642.JMvQo5TC3D@ralph.baldwin.cx> --ncFn9WmclKOCqEXh9Dl8KoIvLJ9KdTJse Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 11/05/16 17:16, John Baldwin wrote: > On Saturday, November 05, 2016 04:30:43 PM Sean Bruno wrote: >> Author: sbruno >> Date: Sat Nov 5 16:30:42 2016 >> New Revision: 308345 >> URL: https://svnweb.freebsd.org/changeset/base/308345 >> >> Log: >> r295133 attempted to deactivate TSO in the 100Mbit link case with th= is >> adapter to work around bugs in TSO handling at this speed. >> =20 >> em_init_locked is called during first boot of the adapter and will >> see that link_speed is unitialized, effectively turning off tso for >> all cards at all speeds, which I believe was *not* the intent. >> =20 >> Move the handling of TSO deactivation to the link handler where we c= an >> more effectively make the decision about what to do. In addition, >> completely purge the TSO capabilities instead of disabling just CSUM= _TSO. >> =20 >> Thanks to jhb for explanation of the hw capabilites api. >> =20 >> Thanks to royger and cognet for testing the 100Mbit failure case to >> ensure that their adapters do indeed still work. >> =20 >> MFC after: 1 week >> Sponsored by: Limelight Networks >> >> Modified: >> head/sys/dev/e1000/if_em.c >> >> Modified: head/sys/dev/e1000/if_em.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/dev/e1000/if_em.c Sat Nov 5 16:23:33 2016 (r308344) >> +++ head/sys/dev/e1000/if_em.c Sat Nov 5 16:30:42 2016 (r308345) >> @@ -369,11 +369,6 @@ MODULE_DEPEND(em, netmap, 1, 1, 1); >> #define MAX_INTS_PER_SEC 8000 >> #define DEFAULT_ITR (1000000000/(MAX_INTS_PER_SEC * 256)) >> =20 >> -/* Allow common code without TSO */ >> -#ifndef CSUM_TSO >> -#define CSUM_TSO 0 >> -#endif >> - >> #define TSO_WORKAROUND 4 >> =20 >> static SYSCTL_NODE(_hw, OID_AUTO, em, CTLFLAG_RD, 0, "EM driver param= eters"); >> @@ -1396,15 +1391,9 @@ em_init_locked(struct adapter *adapter) >> if_clearhwassist(ifp); >> if (if_getcapenable(ifp) & IFCAP_TXCSUM) >> if_sethwassistbits(ifp, CSUM_TCP | CSUM_UDP, 0); >> - /*=20 >> - ** There have proven to be problems with TSO when not >> - ** at full gigabit speed, so disable the assist automatically >> - ** when at lower speeds. -jfv >> - */ >> - if (if_getcapenable(ifp) & IFCAP_TSO4) { >> - if (adapter->link_speed =3D=3D SPEED_1000) >> - if_sethwassistbits(ifp, CSUM_TSO, 0); >> - } >> + >> + if (if_getcapenable(ifp) & IFCAP_TSO4) >> + if_sethwassistbits(ifp, CSUM_TSO, 0); >=20 > Does this always disable TSO? Should this part be removed entirely? > (That is, it seems like this would disable TSO even on Gigabit links). >=20 I was confused by this question. The old code *always* disabled TSO because link_speed was always 0 here on boot. My intention is to ensure that CSUM_TSO is set if IFCAP_TSO4 is set. >> /* Configure for OS presence */ >> em_init_manageability(adapter); >> @@ -2412,6 +2401,18 @@ em_update_link_status(struct adapter *ad >> if (link_check && (adapter->link_active =3D=3D 0)) { >> e1000_get_speed_and_duplex(hw, &adapter->link_speed, >> &adapter->link_duplex); >> + /*=20 >> + ** There have proven to be problems with TSO when not >> + ** at full gigabit speed, so disable the assist automatically >> + ** when at lower speeds. -jfv >> + */ >> + if (adapter->link_speed !=3D SPEED_1000) { >> + if_sethwassistbits(ifp, 0, CSUM_TSO); >> + if_setcapenablebit(ifp, 0, IFCAP_TSO4); >> + if_setcapabilitiesbit(ifp, 0, IFCAP_TSO4); >> + >> + } >=20 > Even though I suggested it, I wonder if it wouldn't be better to only > modify if_capenable and not if_capabilities, that way the admin can > decide to use 'ifconfig em0 tso' to force it back on (e.g. if moving > an adapter from 100 to 1G). >=20 I spent several hours trying to come up with logic that would allow me to allow the user to do this. I am open to suggestions here, but it would require quite a bit more finesse than my "big hammer" approach. sean --ncFn9WmclKOCqEXh9Dl8KoIvLJ9KdTJse-- --lotim6AVPElTpsBaFLPlfNhgHjGJmm4L8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQF8BAEBCgBmBQJYIIlvXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRCQUFENDYzMkU3MTIxREU4RDIwOTk3REQx MjAxRUZDQTFFNzI3RTY0AAoJEBIB78oecn5kTMoIAMtFj9sd1xxQxC1oxtaRSbnc NZ1qG1saA5s4olwt39U2d+kcWNsGvWWx/Mdeg5O7Zkbidu6dijdUyCVCYodiw/JF wHUXyLU+vruyIgR8gD0MEWzBiEfkjVo/Jj7bPSPF8nMNqrzUxCMpFvVHd/SdwZSR fEmKvvfFS7th50UtnxE8lCWBBbizvhvpjoTsH74bjEpzcrWgXwmXsS5WamQo5kNs tHATmjfd1QivAgtUWIUHnEYVh97pJeINsmu06Tim9PFlSY+aW0U9mFqvtj5U913J UtI6VhLsgKCeo8B8HIHYDuypiVAx4lSYs80qkTE62U0+wW5KP0yWI2VZ3D0ejcU= =cBbf -----END PGP SIGNATURE----- --lotim6AVPElTpsBaFLPlfNhgHjGJmm4L8-- From owner-svn-src-all@freebsd.org Mon Nov 7 14:06:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4519C3337C; Mon, 7 Nov 2016 14:06:01 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A437865B; Mon, 7 Nov 2016 14:06:01 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (67-0-232-116.albq.qwest.net [67.0.232.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 4053F1928BA; Mon, 7 Nov 2016 14:06:00 +0000 (UTC) Subject: Re: svn commit: r308345 - head/sys/dev/e1000 To: Sepherosa Ziehau , John Baldwin References: <201611051630.uA5GUhtk073581@repo.freebsd.org> <15572642.JMvQo5TC3D@ralph.baldwin.cx> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org From: Sean Bruno Message-ID: <075f36ce-53c8-ce58-672f-6086d8decc41@freebsd.org> Date: Mon, 7 Nov 2016 07:05:59 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7j8ti3piQR8DUwJAq8fPrfVnOOm8dSErp" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 14:06:01 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --7j8ti3piQR8DUwJAq8fPrfVnOOm8dSErp Content-Type: multipart/mixed; boundary="R9PVhDFbhknGeFBWBGSRNGBvjj516oHeu"; protected-headers="v1" From: Sean Bruno To: Sepherosa Ziehau , John Baldwin Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Message-ID: <075f36ce-53c8-ce58-672f-6086d8decc41@freebsd.org> Subject: Re: svn commit: r308345 - head/sys/dev/e1000 References: <201611051630.uA5GUhtk073581@repo.freebsd.org> <15572642.JMvQo5TC3D@ralph.baldwin.cx> In-Reply-To: --R9PVhDFbhknGeFBWBGSRNGBvjj516oHeu Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/06/16 23:37, Sepherosa Ziehau wrote: > On Sun, Nov 6, 2016 at 7:16 AM, John Baldwin wrote: >> On Saturday, November 05, 2016 04:30:43 PM Sean Bruno wrote: >>> Author: sbruno >>> Date: Sat Nov 5 16:30:42 2016 >>> New Revision: 308345 >>> URL: https://svnweb.freebsd.org/changeset/base/308345 >>> >>> Log: >>> r295133 attempted to deactivate TSO in the 100Mbit link case with t= his >>> adapter to work around bugs in TSO handling at this speed. >>> >>> em_init_locked is called during first boot of the adapter and will >>> see that link_speed is unitialized, effectively turning off tso for= >>> all cards at all speeds, which I believe was *not* the intent. >>> >>> Move the handling of TSO deactivation to the link handler where we = can >>> more effectively make the decision about what to do. In addition, >>> completely purge the TSO capabilities instead of disabling just CSU= M_TSO. >>> >>> Thanks to jhb for explanation of the hw capabilites api. >>> >>> Thanks to royger and cognet for testing the 100Mbit failure case to= >>> ensure that their adapters do indeed still work. >>> >>> MFC after: 1 week >>> Sponsored by: Limelight Networks >>> >>> Modified: >>> head/sys/dev/e1000/if_em.c >>> >>> Modified: head/sys/dev/e1000/if_em.c >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/dev/e1000/if_em.c Sat Nov 5 16:23:33 2016 = (r308344) >>> +++ head/sys/dev/e1000/if_em.c Sat Nov 5 16:30:42 2016 = (r308345) >>> @@ -369,11 +369,6 @@ MODULE_DEPEND(em, netmap, 1, 1, 1); >>> #define MAX_INTS_PER_SEC 8000 >>> #define DEFAULT_ITR (1000000000/(MAX_INTS_PER_SEC * 256)) >>> >>> -/* Allow common code without TSO */ >>> -#ifndef CSUM_TSO >>> -#define CSUM_TSO 0 >>> -#endif >>> - >>> #define TSO_WORKAROUND 4 >>> >>> static SYSCTL_NODE(_hw, OID_AUTO, em, CTLFLAG_RD, 0, "EM driver para= meters"); >>> @@ -1396,15 +1391,9 @@ em_init_locked(struct adapter *adapter) >>> if_clearhwassist(ifp); >>> if (if_getcapenable(ifp) & IFCAP_TXCSUM) >>> if_sethwassistbits(ifp, CSUM_TCP | CSUM_UDP, 0); >>> - /* >>> - ** There have proven to be problems with TSO when not >>> - ** at full gigabit speed, so disable the assist automatically >>> - ** when at lower speeds. -jfv >>> - */ >>> - if (if_getcapenable(ifp) & IFCAP_TSO4) { >>> - if (adapter->link_speed =3D=3D SPEED_1000) >>> - if_sethwassistbits(ifp, CSUM_TSO, 0); >>> - } >>> + >>> + if (if_getcapenable(ifp) & IFCAP_TSO4) >>> + if_sethwassistbits(ifp, CSUM_TSO, 0); >> >> Does this always disable TSO? Should this part be removed entirely? >> (That is, it seems like this would disable TSO even on Gigabit links).= >> >>> /* Configure for OS presence */ >>> em_init_manageability(adapter); >>> @@ -2412,6 +2401,18 @@ em_update_link_status(struct adapter *ad >>> if (link_check && (adapter->link_active =3D=3D 0)) { >>> e1000_get_speed_and_duplex(hw, &adapter->link_speed, >>> &adapter->link_duplex); >>> + /* >>> + ** There have proven to be problems with TSO when not >>> + ** at full gigabit speed, so disable the assist automat= ically >>> + ** when at lower speeds. -jfv >>> + */ >>> + if (adapter->link_speed !=3D SPEED_1000) { >>> + if_sethwassistbits(ifp, 0, CSUM_TSO); >>> + if_setcapenablebit(ifp, 0, IFCAP_TSO4); >>> + if_setcapabilitiesbit(ifp, 0, IFCAP_TSO4); >>> + >>> + } >> >> Even though I suggested it, I wonder if it wouldn't be better to only >> modify if_capenable and not if_capabilities, that way the admin can >> decide to use 'ifconfig em0 tso' to force it back on (e.g. if moving >> an adapter from 100 to 1G). >=20 > I believe simply clearing CSUM_TSO should work for the TCP stack; > messing administrative like capenable and hwcaps does not sound > correct to me. >=20 I don't disagree, but I also don't have an opinion. What I didn't want, was a continuation of the half disabled/half enabled TSO code path that we had prior to this change. > As for this patch, do you need to re-enable TSO once link speed > becomes 1000Mbps? Probably? There wasn't a clear way to flip this back on that I could find that would catch the case of "link speed was 100 and is now 1000". BTW, since the link status check/update is async w/ > the TX path, does this really work, if there are TSO packets pending > on the TX rings (let alone inflight TSO packets from the TCP stack) > when the link speed changed to 100Mbps? TSO packets that are "pending" will continue out their path, AFAIK. I don't believe that a link speed change from 1000 to 100 is a very common occurrence, but I'm willing to change the code to something more "graceful" if you have an idea of how to do it. sean --R9PVhDFbhknGeFBWBGSRNGBvjj516oHeu-- --7j8ti3piQR8DUwJAq8fPrfVnOOm8dSErp Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQF8BAEBCgBmBQJYIIpHXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRCQUFENDYzMkU3MTIxREU4RDIwOTk3REQx MjAxRUZDQTFFNzI3RTY0AAoJEBIB78oecn5kNgkH/jm1x6D4T1mAXZ0Eqrkkui2z fCzr1RMnSYM1vfIhjUR18VPn4c9Dze4X81gnrPv99YUHk9zecs3HtDbUTN3TRLAp ILs9jOo6PKwvLCI2f0rnzn4OguPqy+nTCMRi5/pT0MTBIVXeoBaLy5OfblctFG8x srhrZydr6O2swttCNz/HErUFyLOHs1yFVtQFQiNrAAikpniEb3fD1o1NPDYp3OX2 WJTDeElXhL+rITwrkd4DQSzbAISS3VGGrJF9NJRMSrNb4RXQDpzVFMoKm4Pp0kiC tMWwfNOAO+YblwUJ4oiUljwk67zlfpc1J9ADYkI+V176c4emO4Lh2bevVxkEtMM= =+Jfz -----END PGP SIGNATURE----- --7j8ti3piQR8DUwJAq8fPrfVnOOm8dSErp-- From owner-svn-src-all@freebsd.org Mon Nov 7 14:07:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FF21C3345B; Mon, 7 Nov 2016 14:07:13 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3573854; Mon, 7 Nov 2016 14:07:12 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7E7Cqq062421; Mon, 7 Nov 2016 14:07:12 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7E7CpU062420; Mon, 7 Nov 2016 14:07:12 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611071407.uA7E7CpU062420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 7 Nov 2016 14:07:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308419 - head/tools/tools/nanobsd/embedded X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 14:07:13 -0000 Author: andrew Date: Mon Nov 7 14:07:11 2016 New Revision: 308419 URL: https://svnweb.freebsd.org/changeset/base/308419 Log: Use the armv6 GENERIC in the qemu nanobsd image. Sponsored by: ABT Systems Ltd Modified: head/tools/tools/nanobsd/embedded/qemu-armv7.cfg Modified: head/tools/tools/nanobsd/embedded/qemu-armv7.cfg ============================================================================== --- head/tools/tools/nanobsd/embedded/qemu-armv7.cfg Mon Nov 7 12:10:17 2016 (r308418) +++ head/tools/tools/nanobsd/embedded/qemu-armv7.cfg Mon Nov 7 14:07:11 2016 (r308419) @@ -29,7 +29,7 @@ NANO_ARCH=armv6 NANO_DRIVE=vtbd0 -NANO_KERNEL=VIRT +NANO_KERNEL=GENERIC NANO_NAME=qemu-armv7 NANO_LAYOUT=std-uefi-bios NANO_CPUTYPE=cortexa From owner-svn-src-all@freebsd.org Mon Nov 7 15:05:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 524C1C34DE4; Mon, 7 Nov 2016 15:05:13 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 303BA1C9; Mon, 7 Nov 2016 15:05:11 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 62C4510A727; Mon, 7 Nov 2016 10:05:10 -0500 (EST) From: John Baldwin To: Sean Bruno Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308345 - head/sys/dev/e1000 Date: Mon, 07 Nov 2016 07:04:36 -0800 Message-ID: <7525024.AEWygEoTEf@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <28ef0f40-f2a3-92ea-fac6-a586c81810b0@freebsd.org> References: <201611051630.uA5GUhtk073581@repo.freebsd.org> <15572642.JMvQo5TC3D@ralph.baldwin.cx> <28ef0f40-f2a3-92ea-fac6-a586c81810b0@freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 07 Nov 2016 10:05:10 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 15:05:13 -0000 On Monday, November 07, 2016 07:02:23 AM Sean Bruno wrote: > > On 11/05/16 17:16, John Baldwin wrote: > > On Saturday, November 05, 2016 04:30:43 PM Sean Bruno wrote: > >> Author: sbruno > >> Date: Sat Nov 5 16:30:42 2016 > >> New Revision: 308345 > >> URL: https://svnweb.freebsd.org/changeset/base/308345 > >> > >> Log: > >> r295133 attempted to deactivate TSO in the 100Mbit link case with this > >> adapter to work around bugs in TSO handling at this speed. > >> > >> em_init_locked is called during first boot of the adapter and will > >> see that link_speed is unitialized, effectively turning off tso for > >> all cards at all speeds, which I believe was *not* the intent. > >> > >> Move the handling of TSO deactivation to the link handler where we can > >> more effectively make the decision about what to do. In addition, > >> completely purge the TSO capabilities instead of disabling just CSUM_TSO. > >> > >> Thanks to jhb for explanation of the hw capabilites api. > >> > >> Thanks to royger and cognet for testing the 100Mbit failure case to > >> ensure that their adapters do indeed still work. > >> > >> MFC after: 1 week > >> Sponsored by: Limelight Networks > >> > >> Modified: > >> head/sys/dev/e1000/if_em.c > >> > >> Modified: head/sys/dev/e1000/if_em.c > >> ============================================================================== > >> --- head/sys/dev/e1000/if_em.c Sat Nov 5 16:23:33 2016 (r308344) > >> +++ head/sys/dev/e1000/if_em.c Sat Nov 5 16:30:42 2016 (r308345) > >> @@ -369,11 +369,6 @@ MODULE_DEPEND(em, netmap, 1, 1, 1); > >> #define MAX_INTS_PER_SEC 8000 > >> #define DEFAULT_ITR (1000000000/(MAX_INTS_PER_SEC * 256)) > >> > >> -/* Allow common code without TSO */ > >> -#ifndef CSUM_TSO > >> -#define CSUM_TSO 0 > >> -#endif > >> - > >> #define TSO_WORKAROUND 4 > >> > >> static SYSCTL_NODE(_hw, OID_AUTO, em, CTLFLAG_RD, 0, "EM driver parameters"); > >> @@ -1396,15 +1391,9 @@ em_init_locked(struct adapter *adapter) > >> if_clearhwassist(ifp); > >> if (if_getcapenable(ifp) & IFCAP_TXCSUM) > >> if_sethwassistbits(ifp, CSUM_TCP | CSUM_UDP, 0); > >> - /* > >> - ** There have proven to be problems with TSO when not > >> - ** at full gigabit speed, so disable the assist automatically > >> - ** when at lower speeds. -jfv > >> - */ > >> - if (if_getcapenable(ifp) & IFCAP_TSO4) { > >> - if (adapter->link_speed == SPEED_1000) > >> - if_sethwassistbits(ifp, CSUM_TSO, 0); > >> - } > >> + > >> + if (if_getcapenable(ifp) & IFCAP_TSO4) > >> + if_sethwassistbits(ifp, CSUM_TSO, 0); > > > > Does this always disable TSO? Should this part be removed entirely? > > (That is, it seems like this would disable TSO even on Gigabit links). > > > > I was confused by this question. The old code *always* disabled TSO > because link_speed was always 0 here on boot. My intention is to ensure > that CSUM_TSO is set if IFCAP_TSO4 is set. Oh, I misread the code. It is setting CSUM_TSO and clearing 0. I think you probably don't need this as the flag can only be set in capenable by an ioctl handler that sets the flag to true (and the calling ioctl code should update hwassist for you). Oh, the driver does 'if_clearhwassist()' above this. How... unfortunate. I think that since you are now handling this in 'update_link_status' that you can instead remove this whole block starting with 'if_clearhwassist()' and ending with the 'if_sethwassist' for CSUM_TSO. That is, you can now leave if_hwasssist alone in em_init_locked() and not change it. > >> /* Configure for OS presence */ > >> em_init_manageability(adapter); > >> @@ -2412,6 +2401,18 @@ em_update_link_status(struct adapter *ad > >> if (link_check && (adapter->link_active == 0)) { > >> e1000_get_speed_and_duplex(hw, &adapter->link_speed, > >> &adapter->link_duplex); > >> + /* > >> + ** There have proven to be problems with TSO when not > >> + ** at full gigabit speed, so disable the assist automatically > >> + ** when at lower speeds. -jfv > >> + */ > >> + if (adapter->link_speed != SPEED_1000) { > >> + if_sethwassistbits(ifp, 0, CSUM_TSO); > >> + if_setcapenablebit(ifp, 0, IFCAP_TSO4); > >> + if_setcapabilitiesbit(ifp, 0, IFCAP_TSO4); > >> + > >> + } > > > > Even though I suggested it, I wonder if it wouldn't be better to only > > modify if_capenable and not if_capabilities, that way the admin can > > decide to use 'ifconfig em0 tso' to force it back on (e.g. if moving > > an adapter from 100 to 1G). > > > > I spent several hours trying to come up with logic that would allow me > to allow the user to do this. I am open to suggestions here, but it > would require quite a bit more finesse than my "big hammer" approach. I think you just need to remove 'if_setcapabilities' here and leave the rest of the logic as-is. -- John Baldwin From owner-svn-src-all@freebsd.org Mon Nov 7 15:54:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CB23C354A9; Mon, 7 Nov 2016 15:54:49 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30F89AB7; Mon, 7 Nov 2016 15:54:49 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7FsmlQ007035; Mon, 7 Nov 2016 15:54:48 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7FsmI1007030; Mon, 7 Nov 2016 15:54:48 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201611071554.uA7FsmI1007030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 7 Nov 2016 15:54:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308420 - in head: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/python contrib/file/src lib/libmagic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 15:54:49 -0000 Author: delphij Date: Mon Nov 7 15:54:47 2016 New Revision: 308420 URL: https://svnweb.freebsd.org/changeset/base/308420 Log: MFV r308392: file 5.29. MFC after: 2 weeks Added: head/contrib/file/magic/Magdir/algol68 - copied unchanged from r308392, vendor/file/dist/magic/Magdir/algol68 head/contrib/file/magic/Magdir/application - copied unchanged from r308392, vendor/file/dist/magic/Magdir/application head/contrib/file/magic/Magdir/apt - copied unchanged from r308392, vendor/file/dist/magic/Magdir/apt head/contrib/file/magic/Magdir/psl - copied unchanged from r308392, vendor/file/dist/magic/Magdir/psl Modified: head/contrib/file/ChangeLog head/contrib/file/TODO head/contrib/file/config.guess head/contrib/file/config.sub head/contrib/file/configure head/contrib/file/configure.ac head/contrib/file/doc/file.man head/contrib/file/doc/magic.man head/contrib/file/ltmain.sh head/contrib/file/magic/Magdir/animation head/contrib/file/magic/Magdir/apple head/contrib/file/magic/Magdir/bioinformatics head/contrib/file/magic/Magdir/c-lang head/contrib/file/magic/Magdir/claris head/contrib/file/magic/Magdir/commands head/contrib/file/magic/Magdir/compress head/contrib/file/magic/Magdir/cups head/contrib/file/magic/Magdir/editors head/contrib/file/magic/Magdir/filesystems head/contrib/file/magic/Magdir/fonts head/contrib/file/magic/Magdir/gcc head/contrib/file/magic/Magdir/gnu head/contrib/file/magic/Magdir/images head/contrib/file/magic/Magdir/jpeg head/contrib/file/magic/Magdir/msdos head/contrib/file/magic/Magdir/pgp head/contrib/file/magic/Magdir/python head/contrib/file/magic/Magdir/ruby head/contrib/file/magic/Magdir/sgml head/contrib/file/magic/Magdir/sql head/contrib/file/magic/Makefile.am head/contrib/file/magic/Makefile.in head/contrib/file/python/magic.py head/contrib/file/src/apprentice.c head/contrib/file/src/ascmagic.c head/contrib/file/src/cdf.c head/contrib/file/src/cdf.h head/contrib/file/src/compress.c head/contrib/file/src/der.c head/contrib/file/src/file.c head/contrib/file/src/file.h head/contrib/file/src/funcs.c head/contrib/file/src/magic.c head/contrib/file/src/readcdf.c head/contrib/file/src/readelf.c head/contrib/file/src/softmagic.c head/lib/libmagic/config.h Directory Properties: head/contrib/file/ (props changed) Modified: head/contrib/file/ChangeLog ============================================================================== --- head/contrib/file/ChangeLog Mon Nov 7 14:07:11 2016 (r308419) +++ head/contrib/file/ChangeLog Mon Nov 7 15:54:47 2016 (r308420) @@ -1,3 +1,32 @@ +2016-10-25 10:40 Christos Zoulas + + * release 5.28 + +2016-10-24 11:20 Christos Zoulas + + * der getlength overflow (Jonas Wagner) + * multiple magic file load failure (Christoph Biedl) + +2016-10-17 11:26 Christos Zoulas + + * CDF parsing improvements (Guy Helmer) + +2016-07-20 7:26 Christos Zoulas + + * Add support for signed indirect offsets + +2016-07-18 7:41 Christos Zoulas + + * cat /dev/null | file - should print empty (Christoph Biedl) + +2016-07-05 15:20 Christos Zoulas + + * Bump string size from 64 to 96. + +2016-06-13 20:20 Christos Zoulas + + * PR/556: Fix separators on annotations. + 2016-06-13 19:40 Christos Zoulas * release 5.28 Modified: head/contrib/file/TODO ============================================================================== --- head/contrib/file/TODO Mon Nov 7 14:07:11 2016 (r308419) +++ head/contrib/file/TODO Mon Nov 7 15:54:47 2016 (r308420) @@ -6,7 +6,6 @@ file, not here. More speculative materia listed in the BUGS section of the man page had been fixed!) --- - It would be nice to simplify file considerably. For example, reimplement the apprentice and non-pattern magic methods in Python, and compile the magic patterns to a giant regex (or something similar; @@ -15,8 +14,23 @@ small amount of C is needed (because fas required for soft magic, not the more detailed information given by hard-wired routines). In this regard, note that hplip, which is BSD-licensed, has a magic reimplementation in Python. - +--- Read the kerberos magic entry for more ideas. - +--- Write a string merger to make magic entry sizes dynamic. Strings will be converted to offsets from the string table. +--- +Programming language support, we can introduce the concept of a group +of rules where n rules need to match before the rule is positive. This +could require structural changes to the matching code :-( + +0 group 2 # require 2 matches +# rule 1 +>0 .... +... +# rule 2 +>0 .... +... + +christos + Modified: head/contrib/file/config.guess ============================================================================== --- head/contrib/file/config.guess Mon Nov 7 14:07:11 2016 (r308419) +++ head/contrib/file/config.guess Mon Nov 7 15:54:47 2016 (r308420) @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2015 Free Software Foundation, Inc. -timestamp='2012-02-10' +timestamp='2015-03-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -22,19 +20,17 @@ timestamp='2012-02-10' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches to . + me=`echo "$0" | sed -e 's,.*/,,'` @@ -54,9 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -138,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` | UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -153,20 +168,27 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) + arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ @@ -182,6 +204,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -198,7 +227,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` @@ -302,7 +335,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -560,8 +593,9 @@ EOF else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -801,10 +835,13 @@ EOF i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - i*:MSYS*:*) + *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -852,21 +889,21 @@ EOF exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -879,59 +916,57 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -950,54 +985,63 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1201,6 +1245,9 @@ EOF BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1227,19 +1274,31 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1256,7 +1315,7 @@ EOF NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1330,157 +1389,6 @@ EOF exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - cat >&2 <. @@ -26,11 +20,12 @@ timestamp='2012-04-18' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -73,9 +68,7 @@ Report bugs and patches to Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2D37C35250; Mon, 7 Nov 2016 17:34:20 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5AFCB1C57; Mon, 7 Nov 2016 17:34:20 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7HYJcI045752; Mon, 7 Nov 2016 17:34:19 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7HYJL1045751; Mon, 7 Nov 2016 17:34:19 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201611071734.uA7HYJL1045751@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Mon, 7 Nov 2016 17:34:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308423 - head/sys/dev/mpt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 17:34:20 -0000 Author: scottl Date: Mon Nov 7 17:34:19 2016 New Revision: 308423 URL: https://svnweb.freebsd.org/changeset/base/308423 Log: Fix the fallout from r308268 (mpt driver causes endless witness warnings in VMWare and elsewhere) with the precision of a dull, rusty butter knife. Reported by: tuexen Obtained from: Netflix Modified: head/sys/dev/mpt/mpt.c Modified: head/sys/dev/mpt/mpt.c ============================================================================== --- head/sys/dev/mpt/mpt.c Mon Nov 7 17:17:46 2016 (r308422) +++ head/sys/dev/mpt/mpt.c Mon Nov 7 17:34:19 2016 (r308423) @@ -2695,7 +2695,11 @@ mpt_configure_ioc(struct mpt_softc *mpt, */ mpt->max_cam_seg_cnt = min(mpt->max_seg_cnt, (MAXPHYS / PAGE_SIZE) + 1); + /* XXX Lame Locking! */ + MPT_UNLOCK(mpt); error = mpt_dma_buf_alloc(mpt); + MPT_LOCK(mpt); + if (error != 0) { mpt_prt(mpt, "mpt_dma_buf_alloc() failed!\n"); return (EIO); @@ -2745,6 +2749,7 @@ mpt_configure_ioc(struct mpt_softc *mpt, * retrieved, we are responsible for re-downloading * the firmware after any hard-reset. */ + MPT_UNLOCK(mpt); mpt->fw_image_size = mpt->ioc_facts.FWImageSize; error = mpt_dma_tag_create(mpt, mpt->parent_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, @@ -2752,6 +2757,7 @@ mpt_configure_ioc(struct mpt_softc *mpt, &mpt->fw_dmat); if (error != 0) { mpt_prt(mpt, "cannot create firmware dma tag\n"); + MPT_LOCK(mpt); return (ENOMEM); } error = bus_dmamem_alloc(mpt->fw_dmat, @@ -2760,6 +2766,7 @@ mpt_configure_ioc(struct mpt_softc *mpt, if (error != 0) { mpt_prt(mpt, "cannot allocate firmware memory\n"); bus_dma_tag_destroy(mpt->fw_dmat); + MPT_LOCK(mpt); return (ENOMEM); } mi.mpt = mpt; @@ -2768,6 +2775,7 @@ mpt_configure_ioc(struct mpt_softc *mpt, mpt->fw_image, mpt->fw_image_size, mpt_map_rquest, &mi, 0); mpt->fw_phys = mi.phys; + MPT_LOCK(mpt); error = mpt_upload_fw(mpt); if (error != 0) { mpt_prt(mpt, "firmware upload failed.\n"); From owner-svn-src-all@freebsd.org Mon Nov 7 17:38:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0804DC353AF; Mon, 7 Nov 2016 17:38:41 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D93A81F09; Mon, 7 Nov 2016 17:38:40 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7Hce59045945; Mon, 7 Nov 2016 17:38:40 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7HceYu045944; Mon, 7 Nov 2016 17:38:40 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201611071738.uA7HceYu045944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 7 Nov 2016 17:38:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308424 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 17:38:41 -0000 Author: gonzo Date: Mon Nov 7 17:38:39 2016 New Revision: 308424 URL: https://svnweb.freebsd.org/changeset/base/308424 Log: Fix locking in bcm2835_audio driver - Move all VCHI activity to worker thread: channel methods are called with non-sleepable lock held and VCHI uses sleepable lock. - In worker thread use sx(9) lock instead of mutex(9) for the same reason. PR: 213801, 205979 Modified: head/sys/arm/broadcom/bcm2835/bcm2835_audio.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_audio.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_audio.c Mon Nov 7 17:34:19 2016 (r308423) +++ head/sys/arm/broadcom/bcm2835/bcm2835_audio.c Mon Nov 7 17:38:39 2016 (r308424) @@ -104,14 +104,17 @@ struct bcm2835_audio_info { struct intr_config_hook intr_hook; /* VCHI data */ - struct mtx vchi_lock; + struct sx vchi_lock; VCHI_INSTANCE_T vchi_instance; VCHI_CONNECTION_T *vchi_connection; VCHI_SERVICE_HANDLE_T vchi_handle; - struct mtx data_lock; - struct cv data_cv; + struct sx worker_lock; + struct cv worker_cv; + + bool parameters_update_pending; + bool controls_update_pending; /* Unloadign module */ int unloading; @@ -121,8 +124,8 @@ struct bcm2835_audio_info { #define bcm2835_audio_unlock(_ess) snd_mtxunlock((_ess)->lock) #define bcm2835_audio_lock_assert(_ess) snd_mtxassert((_ess)->lock) -#define VCHIQ_VCHI_LOCK(sc) mtx_lock(&(sc)->vchi_lock) -#define VCHIQ_VCHI_UNLOCK(sc) mtx_unlock(&(sc)->vchi_lock) +#define VCHIQ_VCHI_LOCK(sc) sx_xlock(&(sc)->vchi_lock) +#define VCHIQ_VCHI_UNLOCK(sc) sx_xunlock(&(sc)->vchi_lock) static const char * dest_description(uint32_t dest) @@ -175,7 +178,7 @@ bcm2835_audio_callback(void *param, cons chn_intr(sc->pch.channel); if (perr || ch->free_buffer >= VCHIQ_AUDIO_PACKET_SIZE) - cv_signal(&sc->data_cv); + cv_signal(&sc->worker_cv); } else printf("%s: unknown m.type: %d\n", __func__, m.type); } @@ -261,8 +264,6 @@ bcm2835_audio_start(struct bcm2835_audio if (sc->vchi_handle != VCHIQ_SERVICE_HANDLE_INVALID) { vchi_service_use(sc->vchi_handle); - bcm2835_audio_reset_channel(ch); - m.type = VC_AUDIO_MSG_TYPE_START; ret = vchi_msg_queue(sc->vchi_handle, &m, sizeof m, VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); @@ -324,7 +325,7 @@ bcm2835_audio_open(struct bcm2835_audio_ } static void -bcm2835_audio_update_controls(struct bcm2835_audio_info *sc) +bcm2835_audio_update_controls(struct bcm2835_audio_info *sc, uint32_t volume, uint32_t dest) { VC_AUDIO_MSG_T m; int ret, db; @@ -334,10 +335,10 @@ bcm2835_audio_update_controls(struct bcm vchi_service_use(sc->vchi_handle); m.type = VC_AUDIO_MSG_TYPE_CONTROL; - m.u.control.dest = sc->dest; - if (sc->volume > 99) - sc->volume = 99; - db = db_levels[sc->volume/5]; + m.u.control.dest = dest; + if (volume > 99) + volume = 99; + db = db_levels[volume/5]; m.u.control.volume = VCHIQ_AUDIO_VOLUME(db); ret = vchi_msg_queue(sc->vchi_handle, @@ -352,7 +353,7 @@ bcm2835_audio_update_controls(struct bcm } static void -bcm2835_audio_update_params(struct bcm2835_audio_info *sc, struct bcm2835_audio_chinfo *ch) +bcm2835_audio_update_params(struct bcm2835_audio_info *sc, uint32_t fmt, uint32_t speed) { VC_AUDIO_MSG_T m; int ret; @@ -362,9 +363,9 @@ bcm2835_audio_update_params(struct bcm28 vchi_service_use(sc->vchi_handle); m.type = VC_AUDIO_MSG_TYPE_CONFIG; - m.u.config.channels = AFMT_CHANNEL(ch->fmt); - m.u.config.samplerate = ch->spd; - m.u.config.bps = AFMT_BIT(ch->fmt); + m.u.config.channels = AFMT_CHANNEL(fmt); + m.u.config.samplerate = speed; + m.u.config.bps = AFMT_BIT(fmt); ret = vchi_msg_queue(sc->vchi_handle, &m, sizeof m, VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); @@ -474,29 +475,61 @@ bcm2835_audio_worker(void *data) { struct bcm2835_audio_info *sc = (struct bcm2835_audio_info *)data; struct bcm2835_audio_chinfo *ch = &sc->pch; - mtx_lock(&sc->data_lock); + uint32_t speed, format; + uint32_t volume, dest; + bool parameters_changed, controls_changed; + + sx_slock(&sc->worker_lock); while(1) { if (sc->unloading) break; + parameters_changed = false; + controls_changed = false; + bcm2835_audio_lock(sc); + if (sc->parameters_update_pending) { + /* TODO: update parameters */ + speed = ch->spd; + format = ch->fmt; + sc->parameters_update_pending = false; + parameters_changed = true; + } + + if (sc->controls_update_pending) { + volume = sc->volume; + dest = sc->dest; + sc->controls_update_pending = false; + controls_changed = true; + } + + bcm2835_audio_unlock(sc); + + if (parameters_changed) { + bcm2835_audio_update_params(sc, format, speed); + } + + if (controls_changed) { + bcm2835_audio_update_controls(sc, volume, dest); + } + if (ch->playback_state == PLAYBACK_IDLE) { - cv_wait_sig(&sc->data_cv, &sc->data_lock); + cv_wait_sig(&sc->worker_cv, &sc->worker_lock); continue; } if (ch->playback_state == PLAYBACK_STOPPING) { + bcm2835_audio_stop(ch); bcm2835_audio_reset_channel(&sc->pch); ch->playback_state = PLAYBACK_IDLE; continue; } if (ch->free_buffer < vchiq_unbuffered_bytes(ch)) { - cv_timedwait_sig(&sc->data_cv, &sc->data_lock, 10); + cv_timedwait_sig(&sc->worker_cv, &sc->worker_lock, 10); continue; } - bcm2835_audio_write_samples(ch); if (ch->playback_state == PLAYBACK_STARTING) { @@ -507,7 +540,7 @@ bcm2835_audio_worker(void *data) } } } - mtx_unlock(&sc->data_lock); + sx_sunlock(&sc->worker_lock); kproc_exit(0); } @@ -547,11 +580,13 @@ bcmchan_init(kobj_t obj, void *devinfo, buffer = malloc(sc->bufsz, M_DEVBUF, M_WAITOK | M_ZERO); if (sndbuf_setup(ch->buffer, buffer, sc->bufsz) != 0) { + device_printf(sc->dev, "sndbuf_setup failed\n"); free(buffer, M_DEVBUF); return NULL; } - bcm2835_audio_update_params(sc, ch); + sc->parameters_update_pending = true; + cv_signal(&sc->worker_cv); return ch; } @@ -576,12 +611,12 @@ bcmchan_setformat(kobj_t obj, void *data struct bcm2835_audio_info *sc = ch->parent; bcm2835_audio_lock(sc); - ch->fmt = format; - bcm2835_audio_update_params(sc, ch); - + sc->parameters_update_pending = true; bcm2835_audio_unlock(sc); + cv_signal(&sc->worker_cv); + return 0; } @@ -592,12 +627,12 @@ bcmchan_setspeed(kobj_t obj, void *data, struct bcm2835_audio_info *sc = ch->parent; bcm2835_audio_lock(sc); - ch->spd = speed; - bcm2835_audio_update_params(sc, ch); - + sc->parameters_update_pending = true; bcm2835_audio_unlock(sc); + cv_signal(&sc->worker_cv); + return ch->spd; } @@ -618,26 +653,30 @@ bcmchan_trigger(kobj_t obj, void *data, if (!PCMTRIG_COMMON(go)) return (0); - bcm2835_audio_lock(sc); switch (go) { case PCMTRIG_START: + bcm2835_audio_lock(sc); + bcm2835_audio_reset_channel(ch); ch->playback_state = PLAYBACK_STARTING; + bcm2835_audio_unlock(sc); + /* kickstart data flow */ + chn_intr(sc->pch.channel); /* wakeup worker thread */ - cv_signal(&sc->data_cv); + cv_signal(&sc->worker_cv); break; case PCMTRIG_STOP: case PCMTRIG_ABORT: + bcm2835_audio_lock(sc); ch->playback_state = PLAYBACK_STOPPING; - bcm2835_audio_stop(ch); + bcm2835_audio_unlock(sc); + cv_signal(&sc->worker_cv); break; default: break; } - - bcm2835_audio_unlock(sc); return 0; } @@ -695,8 +734,11 @@ bcmmix_set(struct snd_mixer *m, unsigned switch (dev) { case SOUND_MIXER_VOLUME: + bcm2835_audio_lock(sc); sc->volume = left; - bcm2835_audio_update_controls(sc); + sc->controls_update_pending = true; + bcm2835_audio_unlock(sc); + cv_signal(&sc->worker_cv); break; default: @@ -729,9 +771,13 @@ sysctl_bcm2835_audio_dest(SYSCTL_HANDLER if ((val < 0) || (val > 2)) return (EINVAL); + bcm2835_audio_lock(sc); sc->dest = val; + sc->controls_update_pending = true; + bcm2835_audio_unlock(sc); + + cv_signal(&sc->worker_cv); device_printf(sc->dev, "destination set to %s\n", dest_description(val)); - bcm2835_audio_update_controls(sc); return (0); } @@ -821,9 +867,9 @@ bcm2835_audio_attach(device_t dev) sc->lock = snd_mtxcreate(device_get_nameunit(dev), "bcm2835_audio softc"); - mtx_init(&sc->vchi_lock, "bcm2835_audio", "vchi_lock", MTX_DEF); - mtx_init(&sc->data_lock, "data_mtx", "data_mtx", MTX_DEF); - cv_init(&sc->data_cv, "data_cv"); + sx_init(&sc->vchi_lock, device_get_nameunit(dev)); + sx_init(&sc->worker_lock, "bcm_audio_worker_lock"); + cv_init(&sc->worker_cv, "worker_cv"); sc->vchi_handle = VCHIQ_SERVICE_HANDLE_INVALID; /* @@ -850,16 +896,18 @@ bcm2835_audio_detach(device_t dev) sc = pcm_getdevinfo(dev); /* Stop worker thread */ + sx_xlock(&sc->worker_lock); sc->unloading = 1; - cv_signal(&sc->data_cv); + sx_xunlock(&sc->worker_lock); + cv_signal(&sc->worker_cv); r = pcm_unregister(dev); if (r) return r; - mtx_destroy(&sc->vchi_lock); - mtx_destroy(&sc->data_lock); - cv_destroy(&sc->data_cv); + sx_destroy(&sc->vchi_lock); + sx_destroy(&sc->worker_lock); + cv_destroy(&sc->worker_cv); bcm2835_audio_release(sc); From owner-svn-src-all@freebsd.org Mon Nov 7 18:21:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3503C35EFF; Mon, 7 Nov 2016 18:21:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 682CDB0B; Mon, 7 Nov 2016 18:21:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7ILr6q063284; Mon, 7 Nov 2016 18:21:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7ILrPu063282; Mon, 7 Nov 2016 18:21:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611071821.uA7ILrPu063282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 7 Nov 2016 18:21:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308425 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 18:21:54 -0000 Author: mav Date: Mon Nov 7 18:21:53 2016 New Revision: 308425 URL: https://svnweb.freebsd.org/changeset/base/308425 Log: Add support for EIIOE flag in Additional Element Status. It was added in SES-3 spec, and its support required to properly link the Additional Element Status page data to the original elements. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/cam/scsi/scsi_enc_ses.c head/sys/cam/scsi/scsi_ses.h Modified: head/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- head/sys/cam/scsi/scsi_enc_ses.c Mon Nov 7 17:38:39 2016 (r308424) +++ head/sys/cam/scsi/scsi_enc_ses.c Mon Nov 7 18:21:53 2016 (r308425) @@ -1758,14 +1758,20 @@ ses_process_elm_addlstatus(enc_softc_t * eip = ses_elm_addlstatus_eip(elm_hdr); if (eip && !ignore_index) { struct ses_elm_addlstatus_eip_hdr *eip_hdr; - int expected_index; + int expected_index, index; + ses_elem_index_type_t index_type; eip_hdr = (struct ses_elm_addlstatus_eip_hdr *)elm_hdr; - expected_index = iter.individual_element_index; + if (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) { + index_type = SES_ELEM_INDEX_GLOBAL; + expected_index = iter.global_element_index; + } else { + index_type = SES_ELEM_INDEX_INDIVIDUAL; + expected_index = iter.individual_element_index; + } titer = iter; telement = ses_iter_seek_to(&titer, - eip_hdr->element_index, - SES_ELEM_INDEX_INDIVIDUAL); + eip_hdr->element_index, index_type); if (telement != NULL && (ses_typehasaddlstatus(enc, titer.type_index) != TYPE_ADDLSTATUS_NONE || @@ -1775,13 +1781,18 @@ ses_process_elm_addlstatus(enc_softc_t * } else ignore_index = 1; - if (iter.individual_element_index > expected_index + if (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) + index = iter.global_element_index; + else + index = iter.individual_element_index; + if (index > expected_index && status_type == TYPE_ADDLSTATUS_MANDATORY) { - ENC_VLOG(enc, "%s: provided element " + ENC_VLOG(enc, "%s: provided %s element" "index %d skips mandatory status " " element at index %d\n", - __func__, eip_hdr->element_index, - expected_index); + __func__, (eip_hdr->byte2 & + SES_ADDL_EIP_EIIOE) ? "global " : "", + index, expected_index); } } elmpriv = element->elm_private; Modified: head/sys/cam/scsi/scsi_ses.h ============================================================================== --- head/sys/cam/scsi/scsi_ses.h Mon Nov 7 17:38:39 2016 (r308424) +++ head/sys/cam/scsi/scsi_ses.h Mon Nov 7 18:21:53 2016 (r308425) @@ -2413,7 +2413,8 @@ int ses_elm_addlstatus_invalid(struct se struct ses_elm_addlstatus_eip_hdr { struct ses_elm_addlstatus_base_hdr base; - uint8_t reserved; + uint8_t byte2; +#define SES_ADDL_EIP_EIIOE 1 uint8_t element_index; /* NB: This define (currently) applies to all eip=1 headers */ #define SES_EIP_HDR_EXTRA_LEN 2 From owner-svn-src-all@freebsd.org Mon Nov 7 18:22:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E795C35F62; Mon, 7 Nov 2016 18:22:20 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF859CE2; Mon, 7 Nov 2016 18:22:19 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id D23961FE022; Mon, 7 Nov 2016 19:22:17 +0100 (CET) Subject: Re: svn commit: r308424 - head/sys/arm/broadcom/bcm2835 To: Oleksandr Tymoshenko , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201611071738.uA7HceYu045944@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Mon, 7 Nov 2016 19:27:28 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <201611071738.uA7HceYu045944@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 18:22:20 -0000 On 11/07/16 18:38, Oleksandr Tymoshenko wrote: > + bcm2835_audio_unlock(sc); > + cv_signal(&sc->worker_cv); Shouldn't cv_signal() be done locked, so that you don't loose any transactions? CV's only wakeup the treads that are sleeping right there and then. --HPS From owner-svn-src-all@freebsd.org Mon Nov 7 18:29:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B105EC3410A; Mon, 7 Nov 2016 18:29:22 +0000 (UTC) (envelope-from jch@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82944FB8; Mon, 7 Nov 2016 18:29:22 +0000 (UTC) (envelope-from jch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7ITLrF065622; Mon, 7 Nov 2016 18:29:21 GMT (envelope-from jch@FreeBSD.org) Received: (from jch@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7ITLfv065621; Mon, 7 Nov 2016 18:29:21 GMT (envelope-from jch@FreeBSD.org) Message-Id: <201611071829.uA7ITLfv065621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jch set sender to jch@FreeBSD.org using -f From: Julien Charbon Date: Mon, 7 Nov 2016 18:29:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308426 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 18:29:22 -0000 Author: jch Date: Mon Nov 7 18:29:21 2016 New Revision: 308426 URL: https://svnweb.freebsd.org/changeset/base/308426 Log: MFC r307966: Remove an extraneous call to soisconnected() in syncache_socket(), introduced with r261242. The useful and expected soisconnected() call is done in tcp_do_segment(). Has been found as part of unrelated PR:212920 investigation. Improve slightly (~2%) the maximum number of TCP accept per second. Tested by: kevin.bowling_kev009.com, jch Approved by: gnn, hiren MFC after: 1 week Sponsored by: Verisign, Inc Differential Revision: https://reviews.freebsd.org/D8072 Modified: stable/11/sys/netinet/tcp_syncache.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_syncache.c ============================================================================== --- stable/11/sys/netinet/tcp_syncache.c Mon Nov 7 18:21:53 2016 (r308425) +++ stable/11/sys/netinet/tcp_syncache.c Mon Nov 7 18:29:21 2016 (r308426) @@ -918,10 +918,6 @@ syncache_socket(struct syncache *sc, str tp->t_keepcnt = sototcpcb(lso)->t_keepcnt; tcp_timer_activate(tp, TT_KEEP, TP_KEEPINIT(tp)); - if ((so->so_options & SO_ACCEPTFILTER) == 0) { - soisconnected(so); - } - TCPSTAT_INC(tcps_accepts); return (so); From owner-svn-src-all@freebsd.org Mon Nov 7 19:24:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E34BAC3508B; Mon, 7 Nov 2016 19:24:12 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9801D53; Mon, 7 Nov 2016 19:24:12 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from [208.184.220.60] (helo=[10.112.202.233]) by id.bluezbox.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87 (FreeBSD)) (envelope-from ) id 1c3pWX-000MiN-7D; Mon, 07 Nov 2016 11:24:05 -0800 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r308424 - head/sys/arm/broadcom/bcm2835 From: Oleksandr Tymoshenko In-Reply-To: Date: Mon, 7 Nov 2016 11:23:36 -0800 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <680D84F2-65BF-48DD-8D11-311B1F65A634@freebsd.org> References: <201611071738.uA7HceYu045944@repo.freebsd.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.3251) Sender: gonzo@id.bluezbox.com X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: > On Nov 7, 2016, at 10:27 AM, Hans Petter Selasky wrote: > > On 11/07/16 18:38, Oleksandr Tymoshenko wrote: >> + bcm2835_audio_unlock(sc); >> + cv_signal(&sc->worker_cv); > > > Shouldn't cv_signal() be done locked, so that you don't loose any transactions? CV's only wakeup the treads that are sleeping right there and then. [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 19:24:13 -0000 > On Nov 7, 2016, at 10:27 AM, Hans Petter Selasky = wrote: >=20 > On 11/07/16 18:38, Oleksandr Tymoshenko wrote: >> + bcm2835_audio_unlock(sc); >> + cv_signal(&sc->worker_cv); >=20 >=20 > Shouldn't cv_signal() be done locked, so that you don't loose any = transactions? CV's only wakeup the treads that are sleeping right there = and then. Hi Hans,=20 In this case it doesn=E2=80=99t matter. bcm2835_audio_xxx lock functions = are used to keep channel state consistent. The actual audio hw = reprogramming happens in worker thread which only picks up latest state = of the virtual channel, there is no need to run every transaction in = sequence.=20 From owner-svn-src-all@freebsd.org Mon Nov 7 19:27:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEF8CC350FE; Mon, 7 Nov 2016 19:27:15 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7395DF20; Mon, 7 Nov 2016 19:27:14 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id D04D21FE022; Mon, 7 Nov 2016 20:27:06 +0100 (CET) Subject: Re: svn commit: r308424 - head/sys/arm/broadcom/bcm2835 To: Oleksandr Tymoshenko References: <201611071738.uA7HceYu045944@repo.freebsd.org> <680D84F2-65BF-48DD-8D11-311B1F65A634@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky Message-ID: Date: Mon, 7 Nov 2016 20:32:17 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <680D84F2-65BF-48DD-8D11-311B1F65A634@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 19:27:15 -0000 On 11/07/16 20:23, Oleksandr Tymoshenko wrote: > >> On Nov 7, 2016, at 10:27 AM, Hans Petter Selasky wrote: >> >> On 11/07/16 18:38, Oleksandr Tymoshenko wrote: >>> + bcm2835_audio_unlock(sc); >>> + cv_signal(&sc->worker_cv); >> >> >> Shouldn't cv_signal() be done locked, so that you don't loose any transactions? CV's only wakeup the treads that are sleeping right there and then. > > Hi Hans, > > In this case it doesn’t matter. bcm2835_audio_xxx lock functions are used to keep channel state consistent. The actual audio hw reprogramming happens in worker thread which only picks up latest state of the virtual channel, there is no need to run every transaction in sequence. > Hi, It is not about running in sequence, but that if the worker thread is not sleeping, but on the way to sleep, it will never get woken up unless you use proper locks here! --HPS From owner-svn-src-all@freebsd.org Mon Nov 7 19:46:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 547EAC354D9; Mon, 7 Nov 2016 19:46:31 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3ACAB7B; Mon, 7 Nov 2016 19:46:30 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 105DB1FE022; Mon, 7 Nov 2016 20:46:29 +0100 (CET) Subject: Re: svn commit: r308424 - head/sys/arm/broadcom/bcm2835 To: Oleksandr Tymoshenko References: <201611071738.uA7HceYu045944@repo.freebsd.org> <680D84F2-65BF-48DD-8D11-311B1F65A634@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky Message-ID: <2b03afc6-9bfa-1124-7b70-2532751bfed9@selasky.org> Date: Mon, 7 Nov 2016 20:51:39 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------470FDF2C15B0D23E906DFD84" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 19:46:31 -0000 This is a multi-part message in MIME format. --------------470FDF2C15B0D23E906DFD84 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 11/07/16 20:32, Hans Petter Selasky wrote: > On 11/07/16 20:23, Oleksandr Tymoshenko wrote: >> >>> On Nov 7, 2016, at 10:27 AM, Hans Petter Selasky >>> wrote: >>> >>> On 11/07/16 18:38, Oleksandr Tymoshenko wrote: >>>> + bcm2835_audio_unlock(sc); >>>> + cv_signal(&sc->worker_cv); >>> >>> >>> Shouldn't cv_signal() be done locked, so that you don't loose any >>> transactions? CV's only wakeup the treads that are sleeping right >>> there and then. >> >> Hi Hans, >> >> In this case it doesn’t matter. bcm2835_audio_xxx lock functions are >> used to keep channel state consistent. The actual audio hw >> reprogramming happens in worker thread which only picks up latest >> state of the virtual channel, there is no need to run every >> transaction in sequence. >> > > Hi, > > It is not about running in sequence, but that if the worker thread is > not sleeping, but on the way to sleep, it will never get woken up unless > you use proper locks here! > > --HPS Hi, Also the teardown sequence for the worker thread looks a bit broken, that it doesn't wait for the thread to exit. I've made a patch, attached which I think is the right way to do it. Try opening and closing /dev/dsp in a loop with some DSP ioctls and see what happens. --HPS --------------470FDF2C15B0D23E906DFD84 Content-Type: text/x-patch; name="bcm2835_audio.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bcm2835_audio.diff" Index: sys/arm/broadcom/bcm2835/bcm2835_audio.c =================================================================== --- sys/arm/broadcom/bcm2835/bcm2835_audio.c (revision 308426) +++ sys/arm/broadcom/bcm2835/bcm2835_audio.c (working copy) @@ -149,6 +149,14 @@ } static void +bcm2835_wakeup_worker(struct bcm2835_audio_info *sc) +{ + sx_xlock(&sc->worker_lock); + cv_signal(&sc->worker_cv); + sx_xunlock(&sc->worker_lock); +} + +static void bcm2835_audio_callback(void *param, const VCHI_CALLBACK_REASON_T reason, void *msg_handle) { struct bcm2835_audio_info *sc = (struct bcm2835_audio_info *)param; @@ -540,6 +548,8 @@ } } } + sc->unloading = 2; + cv_signal(&sc->worker_cv); sx_sunlock(&sc->worker_lock); kproc_exit(0); @@ -586,8 +596,9 @@ } sc->parameters_update_pending = true; - cv_signal(&sc->worker_cv); + bcm2835_wakeup_worker(sc); + return ch; } @@ -615,7 +626,7 @@ sc->parameters_update_pending = true; bcm2835_audio_unlock(sc); - cv_signal(&sc->worker_cv); + bcm2835_wakeup_worker(sc); return 0; } @@ -631,7 +642,7 @@ sc->parameters_update_pending = true; bcm2835_audio_unlock(sc); - cv_signal(&sc->worker_cv); + bcm2835_wakeup_worker(sc); return ch->spd; } @@ -662,8 +673,7 @@ bcm2835_audio_unlock(sc); /* kickstart data flow */ chn_intr(sc->pch.channel); - /* wakeup worker thread */ - cv_signal(&sc->worker_cv); + bcm2835_wakeup_worker(sc); break; case PCMTRIG_STOP: @@ -671,7 +681,7 @@ bcm2835_audio_lock(sc); ch->playback_state = PLAYBACK_STOPPING; bcm2835_audio_unlock(sc); - cv_signal(&sc->worker_cv); + bcm2835_wakeup_worker(sc); break; default: @@ -738,7 +748,8 @@ sc->volume = left; sc->controls_update_pending = true; bcm2835_audio_unlock(sc); - cv_signal(&sc->worker_cv); + + bcm2835_wakeup_worker(sc); break; default: @@ -776,7 +787,7 @@ sc->controls_update_pending = true; bcm2835_audio_unlock(sc); - cv_signal(&sc->worker_cv); + bcm2835_wakeup_worker(sc); device_printf(sc->dev, "destination set to %s\n", dest_description(val)); return (0); @@ -898,8 +909,11 @@ /* Stop worker thread */ sx_xlock(&sc->worker_lock); sc->unloading = 1; + cv_signal(&sc->worker_cv); + /* Wait for thread to exit */ + while (sc->unloading != 2) + cv_wait_sig(&sc->worker_cv, &sc->worker_lock); sx_xunlock(&sc->worker_lock); - cv_signal(&sc->worker_cv); r = pcm_unregister(dev); if (r) --------------470FDF2C15B0D23E906DFD84-- From owner-svn-src-all@freebsd.org Mon Nov 7 20:02:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85D71C35973; Mon, 7 Nov 2016 20:02:19 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 509168CF; Mon, 7 Nov 2016 20:02:19 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7K2IC1003508; Mon, 7 Nov 2016 20:02:18 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7K2IxD003507; Mon, 7 Nov 2016 20:02:18 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201611072002.uA7K2IxD003507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 7 Nov 2016 20:02:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308427 - head/sys/cddl/dev/dtrace/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 20:02:19 -0000 Author: gonzo Date: Mon Nov 7 20:02:18 2016 New Revision: 308427 URL: https://svnweb.freebsd.org/changeset/base/308427 Log: Fix include order as required post r308415 Modified: head/sys/cddl/dev/dtrace/arm/dtrace_asm.S Modified: head/sys/cddl/dev/dtrace/arm/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/arm/dtrace_asm.S Mon Nov 7 18:29:21 2016 (r308426) +++ head/sys/cddl/dev/dtrace/arm/dtrace_asm.S Mon Nov 7 20:02:18 2016 (r308427) @@ -32,8 +32,8 @@ #include #include -#include #include +#include #include "assym.s" From owner-svn-src-all@freebsd.org Mon Nov 7 20:17:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2BCAC35CFC; Mon, 7 Nov 2016 20:17:29 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qt0-x233.google.com (mail-qt0-x233.google.com [IPv6:2607:f8b0:400d:c0d::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6F369FBA; Mon, 7 Nov 2016 20:17:29 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qt0-x233.google.com with SMTP id p16so94661896qta.0; Mon, 07 Nov 2016 12:17:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=oL1CYgVpngErDgXYqZe9aeOmIUn+lxOR1A+Mboc+xi4=; b=R8qFywVO9S/YSj9nAOQms5xd0T4ov/zuy5WFMopxG9M1v9uehtHYXhXBcoAj5yrTSE h3NNb7Iuf93F7sYJqVfsENfSiguP9YC7tAqqK1u6dD6uhJa+VbQo49b2VX3d7/L17rgu rCQDasP7NyrytjXgCdk8PYaCsQNb4S/pItnvM1E76CdDLbjKjzqSJkGB4TU8uBpsJG/p 2Femi9rz32ixCLcKVkUWNoh6r8Jk00yR+oZseOd1g2+9NzdzWupNF6Hhf43ofJe1USDA +jedwNw6KoKuw25RAdJmjqQcgyoKF5Gq2OayTPRCINRAgp0od1I8+Cgitl++xB8tKeA5 Iyig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=oL1CYgVpngErDgXYqZe9aeOmIUn+lxOR1A+Mboc+xi4=; b=l72rr9uxhdlZ7uBTRN9yjeIDwsyU+cugdI0Fx589Xg+Li5h0IGq7dJUZ12qEZopp2q Xecya6kvFonaJb5LmXmlnQyGR2YNkVD4Fw9p47nIyQ0gq9dyQS7XWIS+CM1INelYbeBW rzYy6W3NUkR8WbqHb4Q7v20SOb5KY8lMuDeKpuYiok6KN/NGqhmQ+lDNtt/JKpkAn57B gNFsyvAOJtmigwSBIKw3ZBz0n+Q0H5JJT2Gyj13qQ4PZVRCufM32OlVs+0uMPlwTCOlL yKrruuVKPkZjwly4hSOd7762FFyKrp5v/5u42aq2cX9Y8edzPVQRhQUPd0ceASmQG2kZ 3yow== X-Gm-Message-State: ABUngvdvfZi/EAYocerJSZspbCcuTPmbGXwQM8sH/wV9A3MBFCgajsQr1OX8Dn6aVrUDyvm9xVrw+pFwSDGopA== X-Received: by 10.237.57.137 with SMTP id m9mr8087246qte.35.1478549848256; Mon, 07 Nov 2016 12:17:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.29.66 with HTTP; Mon, 7 Nov 2016 12:17:27 -0800 (PST) In-Reply-To: <201611022318.uA2NIGla049356@repo.freebsd.org> References: <201611022318.uA2NIGla049356@repo.freebsd.org> From: Ngie Cooper Date: Mon, 7 Nov 2016 12:17:27 -0800 Message-ID: Subject: Re: svn commit: r308230 - head/sys/dev/ioat To: "Conrad E. Meyer" Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 20:17:29 -0000 On Wed, Nov 2, 2016 at 4:18 PM, Conrad E. Meyer wrote: > Author: cem > Date: Wed Nov 2 23:18:16 2016 > New Revision: 308230 > URL: https://svnweb.freebsd.org/changeset/base/308230 > > Log: > ioat(4): Read CHANSTS register for suspended/halted checks > > The device doesn't accurately update the CHANCMP address with the device state > when the device is suspended or halted. So, read the CHANSTS register to check > for those states. > > We still need to read the CHANCMP address for the last completed descriptor. > > Sponsored by: Dell EMC Isilon Did anyone review this change, either external or internal to Isilon? Thanks, -Ngie From owner-svn-src-all@freebsd.org Mon Nov 7 20:31:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF862C35357; Mon, 7 Nov 2016 20:31:07 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B999AF4B; Mon, 7 Nov 2016 20:31:07 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from [208.184.220.60] (helo=[10.112.202.233]) by id.bluezbox.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87 (FreeBSD)) (envelope-from ) id 1c3qZN-000Mta-Pf; Mon, 07 Nov 2016 12:31:06 -0800 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r308424 - head/sys/arm/broadcom/bcm2835 From: Oleksandr Tymoshenko In-Reply-To: <2b03afc6-9bfa-1124-7b70-2532751bfed9@selasky.org> Date: Mon, 7 Nov 2016 12:30:35 -0800 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201611071738.uA7HceYu045944@repo.freebsd.org> <680D84F2-65BF-48DD-8D11-311B1F65A634@freebsd.org> <2b03afc6-9bfa-1124-7b70-2532751bfed9@selasky.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.3251) Sender: gonzo@id.bluezbox.com X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: > On Nov 7, 2016, at 11:51 AM, Hans Petter Selasky wrote: > > On 11/07/16 20:32, Hans Petter Selasky wrote: >> On 11/07/16 20:23, Oleksandr Tymoshenko wrote: >>> >>>> On Nov 7, 2016, at 10:27 AM, Hans Petter Selasky >>>> wrote: >>>> >>>> On 11/07/16 18:38, Oleksandr Tymoshenko wrote: >>>>> + bcm2835_audio_unlock(sc); >>>>> + cv_signal(&sc->worker_cv); >>>> >>>> >>>> Shouldn't cv_signal() be done locked, so that you don't loose any >>>> transactions? CV's only wakeup the treads that are sleeping right >>>> there and then. >>> >>> Hi Hans, >>> >>> In this case it doesn’t matter. bcm2835_audio_xxx lock functions are >>> used to keep channel state consistent. The actual audio hw >>> reprogramming happens in worker thread which only picks up latest >>> state of the virtual channel, there is no need to run every >>> transaction in sequence. >>> >> >> Hi, >> >> It is not about running in sequence, but that if the worker thread is >> not sleeping, but on the way to sleep, it will never get woken up unless >> you use proper locks here! >> >> --HPS > > Hi, > > Also the teardown sequence for the worker thread looks a bit broken, that it doesn't wait for the thread to exit. > > I've made a patch, attached which I think is the right way to do it. > > Try opening and closing /dev/dsp in a loop with some DSP ioctls and see what happens. [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 20:31:08 -0000 > On Nov 7, 2016, at 11:51 AM, Hans Petter Selasky = wrote: >=20 > On 11/07/16 20:32, Hans Petter Selasky wrote: >> On 11/07/16 20:23, Oleksandr Tymoshenko wrote: >>>=20 >>>> On Nov 7, 2016, at 10:27 AM, Hans Petter Selasky >>>> wrote: >>>>=20 >>>> On 11/07/16 18:38, Oleksandr Tymoshenko wrote: >>>>> + bcm2835_audio_unlock(sc); >>>>> + cv_signal(&sc->worker_cv); >>>>=20 >>>>=20 >>>> Shouldn't cv_signal() be done locked, so that you don't loose any >>>> transactions? CV's only wakeup the treads that are sleeping right >>>> there and then. >>>=20 >>> Hi Hans, >>>=20 >>> In this case it doesn=E2=80=99t matter. bcm2835_audio_xxx lock = functions are >>> used to keep channel state consistent. The actual audio hw >>> reprogramming happens in worker thread which only picks up latest >>> state of the virtual channel, there is no need to run every >>> transaction in sequence. >>>=20 >>=20 >> Hi, >>=20 >> It is not about running in sequence, but that if the worker thread is >> not sleeping, but on the way to sleep, it will never get woken up = unless >> you use proper locks here! >>=20 >> --HPS >=20 > Hi, >=20 > Also the teardown sequence for the worker thread looks a bit broken, = that it doesn't wait for the thread to exit. >=20 > I've made a patch, attached which I think is the right way to do it. >=20 > Try opening and closing /dev/dsp in a loop with some DSP ioctls and = see what happens. Thanks for patch Hans. Looks good to me. I=E2=80=99ll test and commit = it.=20= From owner-svn-src-all@freebsd.org Mon Nov 7 21:15:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34EC3C342E7; Mon, 7 Nov 2016 21:15:41 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1007C8C; Mon, 7 Nov 2016 21:15:40 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7LFeWQ032039; Mon, 7 Nov 2016 21:15:40 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7LFdwM032034; Mon, 7 Nov 2016 21:15:39 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201611072115.uA7LFdwM032034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 7 Nov 2016 21:15:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308428 - in head/sys: conf dev/gpio modules/gpio/gpioled X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 21:15:41 -0000 Author: gonzo Date: Mon Nov 7 21:15:39 2016 New Revision: 308428 URL: https://svnweb.freebsd.org/changeset/base/308428 Log: Refactor FDT part of gpioled driver - Split driver in two parts: FDT and non-FDT - Instead of reattach gpioled nodes to GPIO bus use gpio_pin_get_by_ofw_idx and add ofwbus and simplebus as parrent buses Reviewed by: loos Differential Revision: https://reviews.freebsd.org/D8233 Added: head/sys/dev/gpio/gpioled_fdt.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/gpio/gpioled.c head/sys/modules/gpio/gpioled/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Nov 7 20:02:18 2016 (r308427) +++ head/sys/conf/files Mon Nov 7 21:15:39 2016 (r308428) @@ -1612,7 +1612,8 @@ dev/gpio/gpiobus.c optional gpio \ dev/gpio/gpioc.c optional gpio \ dependency "gpio_if.h" dev/gpio/gpioiic.c optional gpioiic -dev/gpio/gpioled.c optional gpioled +dev/gpio/gpioled.c optional gpioled !fdt +dev/gpio/gpioled_fdt.c optional gpioled fdt dev/gpio/gpioregulator.c optional gpioregulator fdt ext_resources dev/gpio/gpiospi.c optional gpiospi dev/gpio/gpio_if.m optional gpio Modified: head/sys/dev/gpio/gpioled.c ============================================================================== --- head/sys/dev/gpio/gpioled.c Mon Nov 7 20:02:18 2016 (r308427) +++ head/sys/dev/gpio/gpioled.c Mon Nov 7 21:15:39 2016 (r308428) @@ -39,11 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef FDT -#include -#include -#endif - #include #include @@ -91,66 +86,9 @@ gpioled_control(void *priv, int onoff) GPIOLED_UNLOCK(sc); } -#ifdef FDT -static void -gpioled_identify(driver_t *driver, device_t bus) -{ - phandle_t child, leds, root; - - root = OF_finddevice("/"); - if (root == 0) - return; - for (leds = OF_child(root); leds != 0; leds = OF_peer(leds)) { - if (!fdt_is_compatible_strict(leds, "gpio-leds")) - continue; - /* Traverse the 'gpio-leds' node and add its children. */ - for (child = OF_child(leds); child != 0; child = OF_peer(child)) { - if (!OF_hasprop(child, "gpios")) - continue; - if (ofw_gpiobus_add_fdt_child(bus, driver->name, child) == NULL) - continue; - } - } -} -#endif - static int gpioled_probe(device_t dev) { -#ifdef FDT - int match; - phandle_t node; - char *compat; - - /* - * We can match against our own node compatible string and also against - * our parent node compatible string. The first is normally used to - * describe leds on a gpiobus and the later when there is a common node - * compatible with 'gpio-leds' which is used to concentrate all the - * leds nodes on the dts. - */ - match = 0; - if (ofw_bus_is_compatible(dev, "gpioled")) - match = 1; - - if (match == 0) { - if ((node = ofw_bus_get_node(dev)) == -1) - return (ENXIO); - if ((node = OF_parent(node)) == -1) - return (ENXIO); - if (OF_getprop_alloc(node, "compatible", 1, - (void **)&compat) == -1) - return (ENXIO); - - if (strcasecmp(compat, "gpio-leds") == 0) - match = 1; - - OF_prop_free(compat); - } - - if (match == 0) - return (ENXIO); -#endif device_set_desc(dev, "GPIO led"); return (BUS_PROBE_DEFAULT); @@ -161,13 +99,7 @@ gpioled_attach(device_t dev) { struct gpioled_softc *sc; int state; -#ifdef FDT - phandle_t node; - char *default_state; - char *name; -#else const char *name; -#endif sc = device_get_softc(dev); sc->sc_dev = dev; @@ -176,42 +108,14 @@ gpioled_attach(device_t dev) state = 0; -#ifdef FDT - if ((node = ofw_bus_get_node(dev)) == -1) - return (ENXIO); - - if (OF_getprop_alloc(node, "default-state", - sizeof(char), (void **)&default_state) != -1) { - if (strcasecmp(default_state, "on") == 0) - state = 1; - else if (strcasecmp(default_state, "off") == 0) - state = 0; - else if (strcasecmp(default_state, "keep") == 0) - state = -1; - else { - device_printf(dev, - "unknown value for default-state in FDT\n"); - } - OF_prop_free(default_state); - } - - name = NULL; - if (OF_getprop_alloc(node, "label", 1, (void **)&name) == -1) - OF_getprop_alloc(node, "name", 1, (void **)&name); -#else if (resource_string_value(device_get_name(dev), device_get_unit(dev), "name", &name)) name = NULL; resource_int_value(device_get_name(dev), device_get_unit(dev), "invert", &sc->sc_invert); -#endif sc->sc_leddev = led_create_state(gpioled_control, sc, name ? name : device_get_nameunit(dev), state); -#ifdef FDT - if (name != NULL) - OF_prop_free(name); -#endif return (0); } @@ -234,9 +138,6 @@ static devclass_t gpioled_devclass; static device_method_t gpioled_methods[] = { /* Device interface */ -#ifdef FDT - DEVMETHOD(device_identify, gpioled_identify), -#endif DEVMETHOD(device_probe, gpioled_probe), DEVMETHOD(device_attach, gpioled_attach), DEVMETHOD(device_detach, gpioled_detach), Added: head/sys/dev/gpio/gpioled_fdt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gpio/gpioled_fdt.c Mon Nov 7 21:15:39 2016 (r308428) @@ -0,0 +1,230 @@ +/*- + * Copyright (c) 2009 Oleksandr Tymoshenko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "gpiobus_if.h" + +struct gpioled +{ + struct gpioleds_softc *parent_sc; + gpio_pin_t pin; + struct cdev *leddev; +}; + +struct gpioleds_softc +{ + device_t sc_dev; + device_t sc_busdev; + struct gpioled *sc_leds; + int sc_total_leds; +}; + +static void gpioled_control(void *, int); +static int gpioled_probe(device_t); +static int gpioled_attach(device_t); +static int gpioled_detach(device_t); + +static void +gpioled_control(void *priv, int onoff) +{ + struct gpioled *led; + + led = (struct gpioled *)priv; + if (led->pin) + gpio_pin_set_active(led->pin, onoff); +} + +static void +gpioleds_attach_led(struct gpioleds_softc *sc, phandle_t node, + struct gpioled *led) +{ + char *name; + int state, err; + char *default_state; + + led->parent_sc = sc; + + state = 0; + if (OF_getprop_alloc(node, "default-state", + sizeof(char), (void **)&default_state) != -1) { + if (strcasecmp(default_state, "on") == 0) + state = 1; + else if (strcasecmp(default_state, "off") == 0) + state = 0; + else if (strcasecmp(default_state, "keep") == 0) + state = -1; + else { + state = -1; + device_printf(sc->sc_dev, + "unknown value for default-state in FDT\n"); + } + OF_prop_free(default_state); + } + + name = NULL; + if (OF_getprop_alloc(node, "label", 1, (void **)&name) == -1) + OF_getprop_alloc(node, "name", 1, (void **)&name); + + if (name == NULL) { + device_printf(sc->sc_dev, + "no name provided for gpio LED, skipping\n"); + return; + } + + err = gpio_pin_get_by_ofw_idx(sc->sc_dev, node, 0, &led->pin); + if (err) { + device_printf(sc->sc_dev, "<%s> failed to map pin\n", name); + if (name) + OF_prop_free(name); + return; + } + gpio_pin_setflags(led->pin, GPIO_PIN_OUTPUT); + + led->leddev = led_create_state(gpioled_control, led, name, + state); + + if (name != NULL) + OF_prop_free(name); +} + +static void +gpioleds_detach_led(struct gpioled *led) +{ + + if (led->leddev != NULL) + led_destroy(led->leddev); + + if (led->pin) + gpio_pin_release(led->pin); +} + +static int +gpioled_probe(device_t dev) +{ + if (!ofw_bus_is_compatible(dev, "gpio-leds")) + return (ENXIO); + + device_set_desc(dev, "GPIO LEDs"); + + return (BUS_PROBE_DEFAULT); +} + +static int +gpioled_attach(device_t dev) +{ + struct gpioleds_softc *sc; + phandle_t child, leds; + int total_leds; + + if ((leds = ofw_bus_get_node(dev)) == -1) + return (ENXIO); + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_busdev = device_get_parent(dev); + + /* Traverse the 'gpio-leds' node and count leds */ + total_leds = 0; + for (child = OF_child(leds); child != 0; child = OF_peer(child)) { + if (!OF_hasprop(child, "gpios")) + continue; + total_leds++; + } + + if (total_leds) { + sc->sc_leds = malloc(sizeof(struct gpioled) * total_leds, + M_DEVBUF, M_WAITOK | M_ZERO); + + sc->sc_total_leds = 0; + /* Traverse the 'gpio-leds' node and count leds */ + for (child = OF_child(leds); child != 0; child = OF_peer(child)) { + if (!OF_hasprop(child, "gpios")) + continue; + gpioleds_attach_led(sc, child, &sc->sc_leds[sc->sc_total_leds]); + sc->sc_total_leds++; + } + } + + return (0); +} + +static int +gpioled_detach(device_t dev) +{ + struct gpioleds_softc *sc; + int i; + + sc = device_get_softc(dev); + + for (i = 0; i < sc->sc_total_leds; i++) + gpioleds_detach_led(&sc->sc_leds[i]); + + if (sc->sc_leds) + free(sc->sc_leds, M_DEVBUF); + + return (0); +} + +static devclass_t gpioled_devclass; + +static device_method_t gpioled_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, gpioled_probe), + DEVMETHOD(device_attach, gpioled_attach), + DEVMETHOD(device_detach, gpioled_detach), + + DEVMETHOD_END +}; + +static driver_t gpioled_driver = { + "gpioled", + gpioled_methods, + sizeof(struct gpioleds_softc), +}; + +DRIVER_MODULE(gpioled, ofwbus, gpioled_driver, gpioled_devclass, 0, 0); +DRIVER_MODULE(gpioled, simplebus, gpioled_driver, gpioled_devclass, 0, 0); +MODULE_DEPEND(gpioled, gpiobus, 1, 1, 1); Modified: head/sys/modules/gpio/gpioled/Makefile ============================================================================== --- head/sys/modules/gpio/gpioled/Makefile Mon Nov 7 20:02:18 2016 (r308427) +++ head/sys/modules/gpio/gpioled/Makefile Mon Nov 7 21:15:39 2016 (r308428) @@ -32,7 +32,11 @@ .PATH: ${.CURDIR}/../../../dev/gpio/ KMOD= gpioled +.if !empty(OPT_FDT) +SRCS= gpioled_fdt.c +.else SRCS= gpioled.c +.endif SRCS+= device_if.h bus_if.h gpio_if.h gpiobus_if.h opt_platform.h ofw_bus_if.h CFLAGS+= -I. -I${.CURDIR}/../../../dev/gpio/ From owner-svn-src-all@freebsd.org Mon Nov 7 22:24:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2686C35817; Mon, 7 Nov 2016 22:24:38 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7817A36; Mon, 7 Nov 2016 22:24:38 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7MObCj058914; Mon, 7 Nov 2016 22:24:37 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7MOb9Y058913; Mon, 7 Nov 2016 22:24:37 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201611072224.uA7MOb9Y058913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Mon, 7 Nov 2016 22:24:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308429 - head/sys/dev/e1000 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 22:24:39 -0000 Author: sbruno Date: Mon Nov 7 22:24:37 2016 New Revision: 308429 URL: https://svnweb.freebsd.org/changeset/base/308429 Log: The igb driver currently requires a VF interface to have a non-zero MAC address, but the associated PF is giving the VF an all zeros MAC address when one is not administratively assigned. The driver should check for this case and generate a random address, similar to how the linux igbvf driver does. Submitted by: skoumjian@juniper.net (Scott Koumjian) MFH: 2 weeks Differential Revision: https://reviews.freebsd.org/D8399 Modified: head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Mon Nov 7 21:15:39 2016 (r308428) +++ head/sys/dev/e1000/if_igb.c Mon Nov 7 22:24:37 2016 (r308429) @@ -590,11 +590,20 @@ igb_attach(device_t dev) error = EIO; goto err_late; } - /* Check its sanity */ - if (!igb_is_valid_ether_addr(adapter->hw.mac.addr)) { - device_printf(dev, "Invalid MAC address\n"); - error = EIO; - goto err_late; + + /* Check its sanity */ + if (!igb_is_valid_ether_addr(adapter->hw.mac.addr)) { + if (adapter->vf_ifp) { + u8 addr[ETHER_ADDR_LEN]; + arc4rand(&addr, sizeof(addr), 0); + addr[0] &= 0xFE; + addr[0] |= 0x02; + bcopy(addr, adapter->hw.mac.addr, sizeof(addr)); + } else { + device_printf(dev, "Invalid MAC address\n"); + error = EIO; + goto err_late; + } } /* Setup OS specific network interface */ From owner-svn-src-all@freebsd.org Mon Nov 7 22:41:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2535DC35AAF; Mon, 7 Nov 2016 22:41:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0D2919A; Mon, 7 Nov 2016 22:41:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA7Mfr4g065931; Mon, 7 Nov 2016 22:41:53 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA7MfqgC065929; Mon, 7 Nov 2016 22:41:52 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201611072241.uA7MfqgC065929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 7 Nov 2016 22:41:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308430 - head/contrib/elftoolchain/libelftc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 22:41:54 -0000 Author: emaste Date: Mon Nov 7 22:41:52 2016 New Revision: 308430 URL: https://svnweb.freebsd.org/changeset/base/308430 Log: libelftc: add elf{32,64}-tradbigmips target emulation names Reported by: theraven Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Modified: head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 ============================================================================== --- head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Mon Nov 7 22:24:37 2016 (r308429) +++ head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Mon Nov 7 22:41:52 2016 (r308430) @@ -82,6 +82,7 @@ Known descriptor names and their propert .It Li elf32-shbig-linux Ta ELF Ta MSB Ta 32 .It Li elf32-shl-linux Ta ELF Ta LSB Ta 32 .It Li elf32-sparc Ta ELF Ta MSB Ta 32 +.It Li elf32-tradbigmips Ta ELF Ta MSB Ta 32 .It Li elf64-alpha Ta ELF Ta LSB Ta 64 .It Li elf64-alpha-freebsd Ta ELF Ta LSB Ta 64 .It Li elf64-big Ta ELF Ta MSB Ta 64 @@ -101,6 +102,7 @@ Known descriptor names and their propert .It Li elf64-sh64-linux Ta ELF Ta LSB Ta 64 .It Li elf64-sparc Ta ELF Ta MSB Ta 64 .It Li elf64-sparc-freebsd Ta ELF Ta MSB Ta 64 +.It Li elf64-tradbigmips Ta ELF Ta MSB Ta 64 .It Li elf64-x86-64 Ta ELF Ta LSB Ta 64 .It Li elf64-x86-64-freebsd Ta ELF Ta LSB Ta 64 .It Li ihex Ta IHEX Ta - Ta - Modified: head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c ============================================================================== --- head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Mon Nov 7 22:24:37 2016 (r308429) +++ head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Mon Nov 7 22:41:52 2016 (r308430) @@ -195,6 +195,14 @@ struct _Elftc_Bfd_Target _libelftc_targe }, { + .bt_name = "elf32-tradbigmips", + .bt_type = ETF_ELF, + .bt_byteorder = ELFDATA2MSB, + .bt_elfclass = ELFCLASS32, + .bt_machine = EM_MIPS, + }, + + { .bt_name = "elf64-alpha", .bt_type = ETF_ELF, .bt_byteorder = ELFDATA2LSB, @@ -351,6 +359,14 @@ struct _Elftc_Bfd_Target _libelftc_targe }, { + .bt_name = "elf64-tradbigmips", + .bt_type = ETF_ELF, + .bt_byteorder = ELFDATA2MSB, + .bt_elfclass = ELFCLASS64, + .bt_machine = EM_MIPS, + }, + + { .bt_name = "elf64-x86-64", .bt_type = ETF_ELF, .bt_byteorder = ELFDATA2LSB, From owner-svn-src-all@freebsd.org Tue Nov 8 00:05:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A215C3527D; Tue, 8 Nov 2016 00:05:22 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f42.google.com (mail-it0-f42.google.com [209.85.214.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0BF0FDF0; Tue, 8 Nov 2016 00:05:21 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f42.google.com with SMTP id u205so165822015itc.0; Mon, 07 Nov 2016 16:05:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=YMmr+lylwwVw2fotgDXGzn0QwwH92wOzO7Crrqiqs/I=; b=L1jK7cTofZeAwbK+s/Q7ZQaBUfAj7T0v56YtXNxpK6zvwLBkwCYpHwM9X/PGj00SNl 34U2pfDgEFPZ73jhQInjy4j0mbWolVDySdf/zSwqp+5u5Lkzf8/Wh2iSDAqJ4CJ5tnXB rTZSTTjApeANElMLv2oaNPZU2RrFgPnBZuEGDoVt9fGmntzyJggQ5wFFUIGJLDIbVKC2 Sj/Aw/yiSRxmlGi/HgXKu6nc7C7pZUyS3REoiDKXuVx6E++K8JWevfEUhjmd6WJWX6UE AEd2kNI7pq+ViB7YzSfWseXMr70WibMZQRf98L1uG0G95syV2hkMTRWzHB1VIn5xcdh/ rFIw== X-Gm-Message-State: ABUngveFiteGE7vY+Sf8z0sSUrAYuA4PohBBk1JTIzGF5JgwSprPPbHtH29kzD8wcnwJjA== X-Received: by 10.36.69.155 with SMTP id c27mr7920427itd.1.1478553617896; Mon, 07 Nov 2016 13:20:17 -0800 (PST) Received: from mail-it0-f48.google.com (mail-it0-f48.google.com. [209.85.214.48]) by smtp.gmail.com with ESMTPSA id 145sm4865569itg.7.2016.11.07.13.20.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Nov 2016 13:20:17 -0800 (PST) Received: by mail-it0-f48.google.com with SMTP id e187so115617163itc.0; Mon, 07 Nov 2016 13:20:17 -0800 (PST) X-Received: by 10.107.140.65 with SMTP id o62mr9660386iod.17.1478553613721; Mon, 07 Nov 2016 13:20:13 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.220.199 with HTTP; Mon, 7 Nov 2016 13:20:13 -0800 (PST) In-Reply-To: References: <201611022318.uA2NIGla049356@repo.freebsd.org> From: Conrad Meyer Date: Mon, 7 Nov 2016 13:20:13 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r308230 - head/sys/dev/ioat To: Ngie Cooper Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 00:05:22 -0000 Nope. On Mon, Nov 7, 2016 at 12:17 PM, Ngie Cooper wrote: > On Wed, Nov 2, 2016 at 4:18 PM, Conrad E. Meyer wrote: >> Author: cem >> Date: Wed Nov 2 23:18:16 2016 >> New Revision: 308230 >> URL: https://svnweb.freebsd.org/changeset/base/308230 >> >> Log: >> ioat(4): Read CHANSTS register for suspended/halted checks >> >> The device doesn't accurately update the CHANCMP address with the device state >> when the device is suspended or halted. So, read the CHANSTS register to check >> for those states. >> >> We still need to read the CHANCMP address for the last completed descriptor. >> >> Sponsored by: Dell EMC Isilon > > Did anyone review this change, either external or internal to Isilon? > Thanks, > -Ngie From owner-svn-src-all@freebsd.org Tue Nov 8 00:24:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B1CEC357F6; Tue, 8 Nov 2016 00:24:50 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E551A89; Tue, 8 Nov 2016 00:24:50 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA80OndQ005630; Tue, 8 Nov 2016 00:24:49 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA80OnZu005627; Tue, 8 Nov 2016 00:24:49 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201611080024.uA80OnZu005627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Tue, 8 Nov 2016 00:24:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308431 - head/sys/dev/nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 00:24:50 -0000 Author: scottl Date: Tue Nov 8 00:24:49 2016 New Revision: 308431 URL: https://svnweb.freebsd.org/changeset/base/308431 Log: Convert the Q-Pair and PRP list memory allocations to use BUSDMA. Add a bunch of safery belts and error handling in related codepaths. Reviewed by: jimharris Obtained from: Netflix Differential Revision: D8453 Modified: head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_private.h head/sys/dev/nvme/nvme_qpair.c Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Mon Nov 7 22:41:52 2016 (r308430) +++ head/sys/dev/nvme/nvme_ctrlr.c Tue Nov 8 00:24:49 2016 (r308431) @@ -80,11 +80,12 @@ nvme_ctrlr_allocate_bar(struct nvme_cont return (0); } -static void +static int nvme_ctrlr_construct_admin_qpair(struct nvme_controller *ctrlr) { struct nvme_qpair *qpair; uint32_t num_entries; + int error; qpair = &ctrlr->adminq; @@ -105,12 +106,13 @@ nvme_ctrlr_construct_admin_qpair(struct * The admin queue's max xfer size is treated differently than the * max I/O xfer size. 16KB is sufficient here - maybe even less? */ - nvme_qpair_construct(qpair, - 0, /* qpair ID */ - 0, /* vector */ - num_entries, - NVME_ADMIN_TRACKERS, - ctrlr); + error = nvme_qpair_construct(qpair, + 0, /* qpair ID */ + 0, /* vector */ + num_entries, + NVME_ADMIN_TRACKERS, + ctrlr); + return (error); } static int @@ -118,7 +120,7 @@ nvme_ctrlr_construct_io_qpairs(struct nv { struct nvme_qpair *qpair; union cap_lo_register cap_lo; - int i, num_entries, num_trackers; + int i, error, num_entries, num_trackers; num_entries = NVME_IO_ENTRIES; TUNABLE_INT_FETCH("hw.nvme.io_entries", &num_entries); @@ -163,12 +165,14 @@ nvme_ctrlr_construct_io_qpairs(struct nv * For I/O queues, use the controller-wide max_xfer_size * calculated in nvme_attach(). */ - nvme_qpair_construct(qpair, + error = nvme_qpair_construct(qpair, i+1, /* qpair ID */ ctrlr->msix_enabled ? i+1 : 0, /* vector */ num_entries, num_trackers, ctrlr); + if (error) + return (error); /* * Do not bother binding interrupts if we only have one I/O @@ -1098,7 +1102,8 @@ nvme_ctrlr_construct(struct nvme_control nvme_ctrlr_setup_interrupts(ctrlr); ctrlr->max_xfer_size = NVME_MAX_XFER_SIZE; - nvme_ctrlr_construct_admin_qpair(ctrlr); + if (nvme_ctrlr_construct_admin_qpair(ctrlr) != 0) + return (ENXIO); ctrlr->cdev = make_dev(&nvme_ctrlr_cdevsw, device_get_unit(dev), UID_ROOT, GID_WHEEL, 0600, "nvme%d", device_get_unit(dev)); Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Mon Nov 7 22:41:52 2016 (r308430) +++ head/sys/dev/nvme/nvme_private.h Tue Nov 8 00:24:49 2016 (r308431) @@ -172,9 +172,8 @@ struct nvme_tracker { bus_dmamap_t payload_dma_map; uint16_t cid; - uint64_t prp[NVME_MAX_PRP_LIST_ENTRIES]; + uint64_t *prp; bus_addr_t prp_bus_addr; - bus_dmamap_t prp_dma_map; }; struct nvme_qpair { @@ -206,10 +205,8 @@ struct nvme_qpair { bus_dma_tag_t dma_tag; bus_dma_tag_t dma_tag_payload; - bus_dmamap_t cmd_dma_map; + bus_dmamap_t queuemem_map; uint64_t cmd_bus_addr; - - bus_dmamap_t cpl_dma_map; uint64_t cpl_bus_addr; TAILQ_HEAD(, nvme_tracker) free_tr; @@ -417,7 +414,7 @@ void nvme_ctrlr_submit_io_request(struct void nvme_ctrlr_post_failed_request(struct nvme_controller *ctrlr, struct nvme_request *req); -void nvme_qpair_construct(struct nvme_qpair *qpair, uint32_t id, +int nvme_qpair_construct(struct nvme_qpair *qpair, uint32_t id, uint16_t vector, uint32_t num_entries, uint32_t num_trackers, struct nvme_controller *ctrlr); Modified: head/sys/dev/nvme/nvme_qpair.c ============================================================================== --- head/sys/dev/nvme/nvme_qpair.c Mon Nov 7 22:41:52 2016 (r308430) +++ head/sys/dev/nvme/nvme_qpair.c Tue Nov 8 00:24:49 2016 (r308431) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); static void _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req); +static void nvme_qpair_destroy(struct nvme_qpair *qpair); struct nvme_opcode_string { @@ -290,22 +291,6 @@ nvme_completion_is_retry(const struct nv } static void -nvme_qpair_construct_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr, - uint16_t cid) -{ - - bus_dmamap_create(qpair->dma_tag_payload, 0, &tr->payload_dma_map); - bus_dmamap_create(qpair->dma_tag, 0, &tr->prp_dma_map); - - bus_dmamap_load(qpair->dma_tag, tr->prp_dma_map, tr->prp, - sizeof(tr->prp), nvme_single_map, &tr->prp_bus_addr, 0); - - callout_init(&tr->timer, 1); - tr->cid = cid; - tr->qpair = qpair; -} - -static void nvme_qpair_complete_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr, struct nvme_completion *cpl, boolean_t print_on_error) { @@ -457,14 +442,16 @@ nvme_qpair_msix_handler(void *arg) nvme_qpair_process_completions(qpair); } -void +int nvme_qpair_construct(struct nvme_qpair *qpair, uint32_t id, uint16_t vector, uint32_t num_entries, uint32_t num_trackers, struct nvme_controller *ctrlr) { struct nvme_tracker *tr; - uint32_t i; - int err; + size_t cmdsz, cplsz, prpsz, allocsz, prpmemsz; + uint64_t queuemem_phys, prpmem_phys, list_phys; + uint8_t *queuemem, *prpmem, *prp_list; + int i, err; qpair->id = id; qpair->vector = vector; @@ -495,40 +482,51 @@ nvme_qpair_construct(struct nvme_qpair * BUS_SPACE_MAXADDR, NULL, NULL, NVME_MAX_XFER_SIZE, (NVME_MAX_XFER_SIZE/PAGE_SIZE)+1, PAGE_SIZE, 0, NULL, NULL, &qpair->dma_tag_payload); - if (err != 0) + if (err != 0) { nvme_printf(ctrlr, "payload tag create failed %d\n", err); + goto out; + } + + /* + * Each component must be page aligned, and individual PRP lists + * cannot cross a page boundary. + */ + cmdsz = qpair->num_entries * sizeof(struct nvme_command); + cmdsz = roundup2(cmdsz, PAGE_SIZE); + cplsz = qpair->num_entries * sizeof(struct nvme_completion); + cplsz = roundup2(cplsz, PAGE_SIZE); + prpsz = sizeof(uint64_t) * NVME_MAX_PRP_LIST_ENTRIES;; + prpmemsz = qpair->num_trackers * prpsz; + allocsz = cmdsz + cplsz + prpmemsz; err = bus_dma_tag_create(bus_get_dma_tag(ctrlr->dev), - 4, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, - BUS_SPACE_MAXSIZE, 1, BUS_SPACE_MAXSIZE, 0, - NULL, NULL, &qpair->dma_tag); - if (err != 0) + PAGE_SIZE, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + allocsz, 1, allocsz, 0, NULL, NULL, &qpair->dma_tag); + if (err != 0) { nvme_printf(ctrlr, "tag create failed %d\n", err); + goto out; + } + + if (bus_dmamem_alloc(qpair->dma_tag, (void **)&queuemem, + BUS_DMA_NOWAIT, &qpair->queuemem_map)) { + nvme_printf(ctrlr, "failed to alloc qpair memory\n"); + goto out; + } + + if (bus_dmamap_load(qpair->dma_tag, qpair->queuemem_map, + queuemem, allocsz, nvme_single_map, &queuemem_phys, 0) != 0) { + nvme_printf(ctrlr, "failed to load qpair memory\n"); + goto out; + } qpair->num_cmds = 0; qpair->num_intr_handler_calls = 0; - - qpair->cmd = contigmalloc(qpair->num_entries * - sizeof(struct nvme_command), M_NVME, M_ZERO, - 0, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); - qpair->cpl = contigmalloc(qpair->num_entries * - sizeof(struct nvme_completion), M_NVME, M_ZERO, - 0, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); - - err = bus_dmamap_create(qpair->dma_tag, 0, &qpair->cmd_dma_map); - if (err != 0) - nvme_printf(ctrlr, "cmd_dma_map create failed %d\n", err); - - err = bus_dmamap_create(qpair->dma_tag, 0, &qpair->cpl_dma_map); - if (err != 0) - nvme_printf(ctrlr, "cpl_dma_map create failed %d\n", err); - - bus_dmamap_load(qpair->dma_tag, qpair->cmd_dma_map, - qpair->cmd, qpair->num_entries * sizeof(struct nvme_command), - nvme_single_map, &qpair->cmd_bus_addr, 0); - bus_dmamap_load(qpair->dma_tag, qpair->cpl_dma_map, - qpair->cpl, qpair->num_entries * sizeof(struct nvme_completion), - nvme_single_map, &qpair->cpl_bus_addr, 0); + qpair->cmd = (struct nvme_command *)queuemem; + qpair->cpl = (struct nvme_completion *)(queuemem + cmdsz); + prpmem = (uint8_t *)(queuemem + cmdsz + cplsz); + qpair->cmd_bus_addr = queuemem_phys; + qpair->cpl_bus_addr = queuemem_phys + cmdsz; + prpmem_phys = queuemem_phys + cmdsz + cplsz; qpair->sq_tdbl_off = nvme_mmio_offsetof(doorbell[id].sq_tdbl); qpair->cq_hdbl_off = nvme_mmio_offsetof(doorbell[id].cq_hdbl); @@ -537,14 +535,51 @@ nvme_qpair_construct(struct nvme_qpair * TAILQ_INIT(&qpair->outstanding_tr); STAILQ_INIT(&qpair->queued_req); + list_phys = prpmem_phys; + prp_list = prpmem; for (i = 0; i < qpair->num_trackers; i++) { + + if (list_phys + prpsz > prpmem_phys + prpmemsz) { + qpair->num_trackers = i; + break; + } + + /* + * Make sure that the PRP list for this tracker doesn't + * overflow to another page. + */ + if (trunc_page(list_phys) != + trunc_page(list_phys + prpsz - 1)) { + list_phys = roundup2(list_phys, PAGE_SIZE); + prp_list = + (uint8_t *)roundup2((uintptr_t)prp_list, PAGE_SIZE); + } + tr = malloc(sizeof(*tr), M_NVME, M_ZERO | M_WAITOK); - nvme_qpair_construct_tracker(qpair, tr, i); + bus_dmamap_create(qpair->dma_tag_payload, 0, + &tr->payload_dma_map); + callout_init(&tr->timer, 1); + tr->cid = i; + tr->qpair = qpair; + tr->prp = (uint64_t *)prp_list; + tr->prp_bus_addr = list_phys; TAILQ_INSERT_HEAD(&qpair->free_tr, tr, tailq); + list_phys += prpsz; + prp_list += prpsz; + } + + if (qpair->num_trackers == 0) { + nvme_printf(ctrlr, "failed to allocate enough trackers\n"); + goto out; } - qpair->act_tr = malloc(sizeof(struct nvme_tracker *) * qpair->num_entries, - M_NVME, M_ZERO | M_WAITOK); + qpair->act_tr = malloc(sizeof(struct nvme_tracker *) * + qpair->num_entries, M_NVME, M_ZERO | M_WAITOK); + return (0); + +out: + nvme_qpair_destroy(qpair); + return (ENOMEM); } static void @@ -555,23 +590,17 @@ nvme_qpair_destroy(struct nvme_qpair *qp if (qpair->tag) bus_teardown_intr(qpair->ctrlr->dev, qpair->res, qpair->tag); + if (mtx_initialized(&qpair->lock)) + mtx_destroy(&qpair->lock); + if (qpair->res) bus_release_resource(qpair->ctrlr->dev, SYS_RES_IRQ, rman_get_rid(qpair->res), qpair->res); - if (qpair->cmd) { - bus_dmamap_unload(qpair->dma_tag, qpair->cmd_dma_map); - bus_dmamap_destroy(qpair->dma_tag, qpair->cmd_dma_map); - contigfree(qpair->cmd, - qpair->num_entries * sizeof(struct nvme_command), M_NVME); - } - - if (qpair->cpl) { - bus_dmamap_unload(qpair->dma_tag, qpair->cpl_dma_map); - bus_dmamap_destroy(qpair->dma_tag, qpair->cpl_dma_map); - contigfree(qpair->cpl, - qpair->num_entries * sizeof(struct nvme_completion), - M_NVME); + if (qpair->cmd != NULL) { + bus_dmamap_unload(qpair->dma_tag, qpair->queuemem_map); + bus_dmamem_free(qpair->dma_tag, qpair->cmd, + qpair->queuemem_map); } if (qpair->dma_tag) @@ -587,7 +616,6 @@ nvme_qpair_destroy(struct nvme_qpair *qp tr = TAILQ_FIRST(&qpair->free_tr); TAILQ_REMOVE(&qpair->free_tr, tr, tailq); bus_dmamap_destroy(qpair->dma_tag, tr->payload_dma_map); - bus_dmamap_destroy(qpair->dma_tag, tr->prp_dma_map); free(tr, M_NVME); } } From owner-svn-src-all@freebsd.org Tue Nov 8 05:31:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B259C34591; Tue, 8 Nov 2016 05:31:04 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15748C3E; Tue, 8 Nov 2016 05:31:04 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA85V3g1025396; Tue, 8 Nov 2016 05:31:03 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA85V2DL025382; Tue, 8 Nov 2016 05:31:02 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201611080531.uA85V2DL025382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 8 Nov 2016 05:31:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308432 - in head: bin/echo bin/sleep usr.bin/basename usr.bin/dc usr.bin/dirname usr.bin/fold usr.bin/getopt usr.bin/locate/bigram usr.bin/logname usr.bin/printenv usr.bin/yes X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 05:31:04 -0000 Author: cem Date: Tue Nov 8 05:31:01 2016 New Revision: 308432 URL: https://svnweb.freebsd.org/changeset/base/308432 Log: Capsicumize some trivial stdio programs Trivially capsicumize some simple programs that just interact with stdio. This list of programs uses 'pledge("stdio")' in OpenBSD. No objection from: allanjude, emaste, oshogbo Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8307 Modified: head/bin/echo/echo.c head/bin/sleep/sleep.c head/usr.bin/basename/basename.c head/usr.bin/dc/dc.c head/usr.bin/dirname/dirname.c head/usr.bin/fold/fold.c head/usr.bin/getopt/getopt.c head/usr.bin/locate/bigram/locate.bigram.c head/usr.bin/logname/logname.c head/usr.bin/printenv/printenv.c head/usr.bin/yes/yes.c Modified: head/bin/echo/echo.c ============================================================================== --- head/bin/echo/echo.c Tue Nov 8 00:24:49 2016 (r308431) +++ head/bin/echo/echo.c Tue Nov 8 05:31:01 2016 (r308432) @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -78,6 +80,9 @@ main(int argc, char *argv[]) char newline[] = "\n"; char *progname = argv[0]; + if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS)) + err(1, "capsicum"); + /* This utility may NOT do getopt(3) option parsing. */ if (*++argv && !strcmp(*argv, "-n")) { ++argv; Modified: head/bin/sleep/sleep.c ============================================================================== --- head/bin/sleep/sleep.c Tue Nov 8 00:24:49 2016 (r308431) +++ head/bin/sleep/sleep.c Tue Nov 8 05:31:01 2016 (r308432) @@ -41,6 +41,7 @@ static char sccsid[] = "@(#)sleep.c 8.3 #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -69,6 +70,9 @@ main(int argc, char *argv[]) time_t original; char buf[2]; + if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS)) + err(1, "capsicum"); + if (argc != 2) usage(); Modified: head/usr.bin/basename/basename.c ============================================================================== --- head/usr.bin/basename/basename.c Tue Nov 8 00:24:49 2016 (r308431) +++ head/usr.bin/basename/basename.c Tue Nov 8 05:31:01 2016 (r308432) @@ -42,6 +42,7 @@ static char sccsid[] = "@(#)basename.c 8 #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -64,6 +65,9 @@ main(int argc, char **argv) setlocale(LC_ALL, ""); + if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS)) + err(1, "capsicum"); + aflag = 0; suffix = NULL; suffixlen = 0; Modified: head/usr.bin/dc/dc.c ============================================================================== --- head/usr.bin/dc/dc.c Tue Nov 8 00:24:49 2016 (r308431) +++ head/usr.bin/dc/dc.c Tue Nov 8 05:31:01 2016 (r308432) @@ -22,9 +22,11 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include +#include #include #include #include @@ -58,11 +60,11 @@ usage(void) } static void -procfile(char *fname) { +procfd(int fd, char *fname) { struct stat st; FILE *file; - file = fopen(fname, "r"); + file = fdopen(fd, "r"); if (file == NULL) err(1, "cannot open file %s", fname); if (fstat(fileno(file), &st) == -1) @@ -80,7 +82,7 @@ procfile(char *fname) { int main(int argc, char *argv[]) { - int ch; + int ch, fd; bool extended_regs = false, preproc_done = false; /* accept and ignore a single dash to be 4.4BSD dc(1) compatible */ @@ -97,7 +99,10 @@ main(int argc, char *argv[]) case 'f': if (!preproc_done) init_bmachine(extended_regs); - procfile(optarg); + fd = open(optarg, O_RDONLY); + if (fd < 0) + err(1, "cannot open file %s", optarg); + procfd(fd, optarg); preproc_done = true; break; case 'x': @@ -126,12 +131,23 @@ main(int argc, char *argv[]) if (argc > 1) usage(); if (argc == 1) { - procfile(argv[0]); + fd = open(argv[0], O_RDONLY); + if (fd < 0) + err(1, "cannot open file %s", argv[0]); + + if (caph_limit_stream(fd, CAPH_READ) < 0 || + caph_limit_stdio() < 0 || + (cap_enter() < 0 && errno != ENOSYS)) + err(1, "capsicum"); + + procfd(fd, argv[0]); preproc_done = true; } if (preproc_done) return (0); + if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS)) + err(1, "capsicum"); src_setstream(&src, stdin); reset_bmachine(&src); eval(); Modified: head/usr.bin/dirname/dirname.c ============================================================================== --- head/usr.bin/dirname/dirname.c Tue Nov 8 00:24:49 2016 (r308431) +++ head/usr.bin/dirname/dirname.c Tue Nov 8 05:31:01 2016 (r308432) @@ -39,6 +39,7 @@ static const char sccsid[] = "@(#)dirnam #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -53,6 +54,9 @@ main(int argc, char **argv) char *p; int ch; + if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS)) + err(1, "capsicum"); + while ((ch = getopt(argc, argv, "")) != -1) switch(ch) { case '?': Modified: head/usr.bin/fold/fold.c ============================================================================== --- head/usr.bin/fold/fold.c Tue Nov 8 00:24:49 2016 (r308431) +++ head/usr.bin/fold/fold.c Tue Nov 8 05:31:01 2016 (r308432) @@ -45,6 +45,7 @@ static char sccsid[] = "@(#)fold.c 8.1 ( #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -72,6 +73,9 @@ main(int argc, char **argv) (void) setlocale(LC_CTYPE, ""); + if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS)) + err(1, "capsicum"); + width = -1; previous_ch = 0; while ((ch = getopt(argc, argv, "0123456789bsw:")) != -1) { Modified: head/usr.bin/getopt/getopt.c ============================================================================== --- head/usr.bin/getopt/getopt.c Tue Nov 8 00:24:49 2016 (r308431) +++ head/usr.bin/getopt/getopt.c Tue Nov 8 05:31:01 2016 (r308432) @@ -6,6 +6,9 @@ __FBSDID("$FreeBSD$"); * into the public domain and is thus not subject to any copyright. */ +#include +#include +#include #include #include #include @@ -16,6 +19,9 @@ main(int argc, char *argv[]) int c; int status = 0; + if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS)) + err(1, "capsicum"); + optind = 2; /* Past the program name and the option letters. */ while ((c = getopt(argc, argv, argv[1])) != -1) switch (c) { Modified: head/usr.bin/locate/bigram/locate.bigram.c ============================================================================== --- head/usr.bin/locate/bigram/locate.bigram.c Tue Nov 8 00:24:49 2016 (r308431) +++ head/usr.bin/locate/bigram/locate.bigram.c Tue Nov 8 05:31:01 2016 (r308432) @@ -57,6 +57,9 @@ static char sccsid[] = "@(#)locate.bigra * Use 'code' to encode a file using this output. */ +#include +#include +#include #include #include #include /* for MAXPATHLEN */ @@ -73,6 +76,9 @@ main(void) u_char *oldpath = buf1, *path = buf2; u_int i, j; + if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS)) + err(1, "capsicum"); + while (fgets(path, sizeof(buf2), stdin) != NULL) { /* Modified: head/usr.bin/logname/logname.c ============================================================================== --- head/usr.bin/logname/logname.c Tue Nov 8 00:24:49 2016 (r308431) +++ head/usr.bin/logname/logname.c Tue Nov 8 05:31:01 2016 (r308432) @@ -39,6 +39,7 @@ static const char sccsid[] = "@(#)lognam #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -51,6 +52,9 @@ main(int argc, char *argv[] __unused) { char *p; + if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS)) + err(1, "capsicum"); + if (argc != 1) usage(); if ((p = getlogin()) == NULL) Modified: head/usr.bin/printenv/printenv.c ============================================================================== --- head/usr.bin/printenv/printenv.c Tue Nov 8 00:24:49 2016 (r308431) +++ head/usr.bin/printenv/printenv.c Tue Nov 8 05:31:01 2016 (r308432) @@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$"); #include +#include +#include #include #include #include @@ -65,6 +67,9 @@ main(int argc, char *argv[]) size_t len; int ch; + if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS)) + err(1, "capsicum"); + while ((ch = getopt(argc, argv, "")) != -1) switch(ch) { case '?': Modified: head/usr.bin/yes/yes.c ============================================================================== --- head/usr.bin/yes/yes.c Tue Nov 8 00:24:49 2016 (r308431) +++ head/usr.bin/yes/yes.c Tue Nov 8 05:31:01 2016 (r308432) @@ -41,12 +41,17 @@ static const char rcsid[] = "$FreeBSD$"; #endif #endif /* not lint */ +#include #include #include int main(int argc, char **argv) { + + if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS)) + err(1, "capsicum"); + if (argc > 1) while (puts(argv[1]) != EOF) ; From owner-svn-src-all@freebsd.org Tue Nov 8 06:13:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30BB9C36AE5; Tue, 8 Nov 2016 06:13:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E256AA47; Tue, 8 Nov 2016 06:13:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA86DNsR044222; Tue, 8 Nov 2016 06:13:23 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA86DMIr044213; Tue, 8 Nov 2016 06:13:22 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611080613.uA86DMIr044213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 8 Nov 2016 06:13:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308433 - in stable/11/sys: amd64/amd64 amd64/include compat/linprocfs i386/include x86/include x86/x86 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 06:13:24 -0000 Author: jhb Date: Tue Nov 8 06:13:22 2016 New Revision: 308433 URL: https://svnweb.freebsd.org/changeset/base/308433 Log: MFC 305836: Remove 'cpu' and 'cpu_class' on amd64. The 'cpu' and 'cpu_class' variables were always set to the same value on amd64 and are legacy holdovers from i386. Remove them entirely on amd64. Requested by: kib (MFC) Modified: stable/11/sys/amd64/amd64/machdep.c stable/11/sys/amd64/include/cputypes.h stable/11/sys/compat/linprocfs/linprocfs.c stable/11/sys/i386/include/cputypes.h stable/11/sys/i386/include/md_var.h stable/11/sys/x86/include/cputypes.h stable/11/sys/x86/include/x86_var.h stable/11/sys/x86/x86/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/machdep.c Tue Nov 8 05:31:01 2016 (r308432) +++ stable/11/sys/amd64/amd64/machdep.c Tue Nov 8 06:13:22 2016 (r308433) @@ -273,7 +273,6 @@ cpu_startup(dummy) */ startrtclock(); printcpuinfo(); - panicifcpuunsupported(); #ifdef PERFMON perfmon_init(); #endif Modified: stable/11/sys/amd64/include/cputypes.h ============================================================================== --- stable/11/sys/amd64/include/cputypes.h Tue Nov 8 05:31:01 2016 (r308432) +++ stable/11/sys/amd64/include/cputypes.h Tue Nov 8 06:13:22 2016 (r308433) @@ -1,48 +1,6 @@ /*- - * Copyright (c) 1993 Christopher G. Demetriou - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * 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$ + * This file is in the public domain. */ - -#ifndef _MACHINE_CPUTYPES_H_ -#define _MACHINE_CPUTYPES_H_ +/* $FreeBSD$ */ #include - -/* - * Classes of processor. - */ -#define CPUCLASS_X86 0 /* X86 */ -#define CPUCLASS_K8 1 /* K8 AMD64 class */ - -/* - * Kinds of processor. - */ -#define CPU_X86 0 /* Intel */ -#define CPU_CLAWHAMMER 1 /* AMD Clawhammer */ -#define CPU_SLEDGEHAMMER 2 /* AMD Sledgehammer */ - -#endif /* !_MACHINE_CPUTYPES_H_ */ Modified: stable/11/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/11/sys/compat/linprocfs/linprocfs.c Tue Nov 8 05:31:01 2016 (r308432) +++ stable/11/sys/compat/linprocfs/linprocfs.c Tue Nov 8 06:13:22 2016 (r308433) @@ -218,7 +218,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) char model[128]; uint64_t freq; size_t size; - int class, fqmhz, fqkhz; + int fqmhz, fqkhz; int i; /* @@ -235,33 +235,6 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) "3dnowext", "3dnow" }; - switch (cpu_class) { -#ifdef __i386__ - case CPUCLASS_286: - class = 2; - break; - case CPUCLASS_386: - class = 3; - break; - case CPUCLASS_486: - class = 4; - break; - case CPUCLASS_586: - class = 5; - break; - case CPUCLASS_686: - class = 6; - break; - default: - class = 0; - break; -#else /* __amd64__ */ - default: - class = 15; - break; -#endif - } - hw_model[0] = CTL_HW; hw_model[1] = HW_MODEL; model[0] = '\0'; @@ -286,7 +259,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) #ifdef __i386__ switch (cpu_vendor_id) { case CPU_VENDOR_AMD: - if (class < 6) + if (cpu_class < CPUCLASS_686) flags[16] = "fcmov"; break; case CPU_VENDOR_CYRIX: Modified: stable/11/sys/i386/include/cputypes.h ============================================================================== --- stable/11/sys/i386/include/cputypes.h Tue Nov 8 05:31:01 2016 (r308432) +++ stable/11/sys/i386/include/cputypes.h Tue Nov 8 06:13:22 2016 (r308433) @@ -63,4 +63,9 @@ #define CPU_P4 16 /* Intel Pentium 4 */ #define CPU_GEODE1100 17 /* NS Geode SC1100 */ +#ifndef LOCORE +extern int cpu; +extern int cpu_class; +#endif + #endif /* !_MACHINE_CPUTYPES_H_ */ Modified: stable/11/sys/i386/include/md_var.h ============================================================================== --- stable/11/sys/i386/include/md_var.h Tue Nov 8 05:31:01 2016 (r308432) +++ stable/11/sys/i386/include/md_var.h Tue Nov 8 06:13:22 2016 (r308433) @@ -65,6 +65,7 @@ void i686_pagezero(void *addr); void sse2_pagezero(void *addr); void init_AMD_Elan_sc520(void); vm_paddr_t kvtop(void *addr); +void panicifcpuunsupported(void); void ppro_reenable_apic(void); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int selec); union savefpu *get_pcb_user_save_td(struct thread *td); Modified: stable/11/sys/x86/include/cputypes.h ============================================================================== --- stable/11/sys/x86/include/cputypes.h Tue Nov 8 05:31:01 2016 (r308432) +++ stable/11/sys/x86/include/cputypes.h Tue Nov 8 06:13:22 2016 (r308433) @@ -46,9 +46,4 @@ #define CPU_VENDOR_RISE 0xdead2bad /* Rise */ #define CPU_VENDOR_CENTAUR CPU_VENDOR_IDT -#ifndef LOCORE -extern int cpu; -extern int cpu_class; -#endif - #endif /* !_X86_CPUTYPES_H_ */ Modified: stable/11/sys/x86/include/x86_var.h ============================================================================== --- stable/11/sys/x86/include/x86_var.h Tue Nov 8 05:31:01 2016 (r308432) +++ stable/11/sys/x86/include/x86_var.h Tue Nov 8 06:13:22 2016 (r308433) @@ -107,7 +107,6 @@ bool fix_cpuid(void); void fillw(int /*u_short*/ pat, void *base, size_t cnt); int is_physical_memory(vm_paddr_t addr); int isa_nmi(int cd); -void panicifcpuunsupported(void); void pagecopy(void *from, void *to); void printcpuinfo(void); int user_dbreg_trap(void); Modified: stable/11/sys/x86/x86/identcpu.c ============================================================================== --- stable/11/sys/x86/x86/identcpu.c Tue Nov 8 05:31:01 2016 (r308432) +++ stable/11/sys/x86/x86/identcpu.c Tue Nov 8 06:13:22 2016 (r308433) @@ -87,8 +87,10 @@ static void print_svm_info(void); static void print_via_padlock_info(void); static void print_vmx_info(void); +#ifdef __i386__ int cpu; /* Are we 386, 386sx, 486, etc? */ int cpu_class; +#endif u_int cpu_feature; /* Feature flags */ u_int cpu_feature2; /* Feature flags */ u_int amd_feature; /* AMD feature flags */ @@ -184,13 +186,11 @@ static const char *cpu_brandtable[MAX_BR NULL, "Intel Pentium 4" }; -#endif static struct { char *cpu_name; int cpu_class; } cpus[] = { -#ifdef __i386__ { "Intel 80286", CPUCLASS_286 }, /* CPU_286 */ { "i386SX", CPUCLASS_386 }, /* CPU_386SX */ { "i386DX", CPUCLASS_386 }, /* CPU_386 */ @@ -208,11 +208,8 @@ static struct { { "Pentium II", CPUCLASS_686 }, /* CPU_PII */ { "Pentium III", CPUCLASS_686 }, /* CPU_PIII */ { "Pentium 4", CPUCLASS_686 }, /* CPU_P4 */ -#else - { "Clawhammer", CPUCLASS_K8 }, /* CPU_CLAWHAMMER */ - { "Sledgehammer", CPUCLASS_K8 }, /* CPU_SLEDGEHAMMER */ -#endif }; +#endif static struct { char *vendor; @@ -242,9 +239,13 @@ printcpuinfo(void) u_int regs[4], i; char *brand; - cpu_class = cpus[cpu].cpu_class; printf("CPU: "); +#ifdef __i386__ + cpu_class = cpus[cpu].cpu_class; strncpy(cpu_model, cpus[cpu].cpu_name, sizeof (cpu_model)); +#else + strncpy(cpu_model, "Hammer", sizeof (cpu_model)); +#endif /* Check for extended CPUID information and a processor name. */ if (cpu_exthigh >= 0x80000004) { @@ -697,8 +698,8 @@ printcpuinfo(void) (intmax_t)(tsc_freq + 4999) / 1000000, (u_int)((tsc_freq + 4999) / 10000) % 100); } - switch(cpu_class) { #ifdef __i386__ + switch(cpu_class) { case CPUCLASS_286: printf("286"); break; @@ -720,14 +721,12 @@ printcpuinfo(void) printf("686"); break; #endif -#else - case CPUCLASS_K8: - printf("K8"); - break; -#endif default: printf("Unknown"); /* will panic below... */ } +#else + printf("K8"); +#endif printf("-class CPU)\n"); if (*cpu_vendor) printf(" Origin=\"%s\"", cpu_vendor); @@ -1051,28 +1050,22 @@ printcpuinfo(void) print_hypervisor_info(); } +#ifdef __i386__ void panicifcpuunsupported(void) { -#ifdef __i386__ #if !defined(lint) #if !defined(I486_CPU) && !defined(I586_CPU) && !defined(I686_CPU) #error This kernel is not configured for one of the supported CPUs #endif #else /* lint */ #endif /* lint */ -#else /* __amd64__ */ -#ifndef HAMMER -#error "You need to specify a cpu type" -#endif -#endif /* * Now that we have told the user what they have, * let them know if that machine type isn't configured. */ switch (cpu_class) { -#ifdef __i386__ case CPUCLASS_286: /* a 286 should not make it this far, anyway */ case CPUCLASS_386: #if !defined(I486_CPU) @@ -1084,19 +1077,12 @@ panicifcpuunsupported(void) #if !defined(I686_CPU) case CPUCLASS_686: #endif -#else /* __amd64__ */ - case CPUCLASS_X86: -#ifndef HAMMER - case CPUCLASS_K8: -#endif -#endif panic("CPU class not configured"); default: break; } } -#ifdef __i386__ static volatile u_int trap_by_rdmsr; /* @@ -1580,9 +1566,6 @@ identify_cpu(void) return; } } -#else - /* XXX */ - cpu = CPU_CLAWHAMMER; #endif } From owner-svn-src-all@freebsd.org Tue Nov 8 06:50:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04589C366B7; Tue, 8 Nov 2016 06:50:23 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C07D8BCE; Tue, 8 Nov 2016 06:50:22 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA86oMVj056053; Tue, 8 Nov 2016 06:50:22 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA86oJ7W056026; Tue, 8 Nov 2016 06:50:19 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201611080650.uA86oJ7W056026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 8 Nov 2016 06:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308434 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sys... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 06:50:23 -0000 Author: tsoome Date: Tue Nov 8 06:50:18 2016 New Revision: 308434 URL: https://svnweb.freebsd.org/changeset/base/308434 Log: Loader paged/pageable data is not always paged. This change does modify devsw dv_print() to return the int value, enabling walkers to interrupt the walk on non zero value from dv_print(). This will allow the pager_print actually to stop displaying data on user input, and additionally pager is used in various *dev_print callbacks, where it was missing. For test, lsdev [-v] command should display data by screenfuls and should stop when the key 'q' is pressed on pager prompt. Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D5461 Modified: head/lib/libstand/stand.h head/sys/boot/common/dev_net.c head/sys/boot/common/module.c head/sys/boot/common/part.c head/sys/boot/common/util.c head/sys/boot/common/util.h head/sys/boot/efi/libefi/efinet.c head/sys/boot/efi/libefi/efipart.c head/sys/boot/efi/loader/main.c head/sys/boot/i386/libfirewire/firewire.c head/sys/boot/i386/libi386/bioscd.c head/sys/boot/i386/libi386/biosdisk.c head/sys/boot/i386/libi386/pxe.c head/sys/boot/mips/beri/loader/beri_disk_cfi.c head/sys/boot/mips/beri/loader/beri_disk_sdcard.c head/sys/boot/ofw/libofw/ofw_disk.c head/sys/boot/pc98/libpc98/bioscd.c head/sys/boot/pc98/libpc98/biosdisk.c head/sys/boot/powerpc/kboot/hostdisk.c head/sys/boot/powerpc/ps3/ps3cdrom.c head/sys/boot/powerpc/ps3/ps3disk.c head/sys/boot/uboot/lib/disk.c head/sys/boot/usb/storage/umass_loader.c head/sys/boot/userboot/userboot/host.c head/sys/boot/userboot/userboot/userboot_disk.c head/sys/boot/zfs/zfs.c head/sys/boot/zfs/zfsimpl.c Modified: head/lib/libstand/stand.h ============================================================================== --- head/lib/libstand/stand.h Tue Nov 8 06:13:22 2016 (r308433) +++ head/lib/libstand/stand.h Tue Nov 8 06:50:18 2016 (r308434) @@ -143,7 +143,7 @@ struct devsw { int (*dv_open)(struct open_file *f, ...); int (*dv_close)(struct open_file *f); int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data); - void (*dv_print)(int verbose); /* print device information */ + int (*dv_print)(int verbose); /* print device information */ void (*dv_cleanup)(void); }; Modified: head/sys/boot/common/dev_net.c ============================================================================== --- head/sys/boot/common/dev_net.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/common/dev_net.c Tue Nov 8 06:50:18 2016 (r308434) @@ -80,7 +80,7 @@ static int net_open(struct open_file *, static int net_close(struct open_file *); static void net_cleanup(void); static int net_strategy(); -static void net_print(int); +static int net_print(int); static int net_getparams(int sock); @@ -325,23 +325,27 @@ exit: return (0); } -static void +static int net_print(int verbose) { struct netif_driver *drv; int i, d, cnt; + int ret = 0; cnt = 0; for (d = 0; netif_drivers[d]; d++) { drv = netif_drivers[d]; for (i = 0; i < drv->netif_nifs; i++) { printf("\t%s%d:", "net", cnt++); - if (verbose) + if (verbose) { printf(" (%s%d)", drv->netif_bname, drv->netif_ifs[i].dif_unit); + } + if ((ret = pager_output("\n")) != 0) + return (ret); } } - printf("\n"); + return (ret); } /* Modified: head/sys/boot/common/module.c ============================================================================== --- head/sys/boot/common/module.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/common/module.c Tue Nov 8 06:50:18 2016 (r308434) @@ -254,7 +254,7 @@ command_lsmod(int argc, char *argv[]) struct kernel_module *mp; struct file_metadata *md; char lbuf[80]; - int ch, verbose; + int ch, verbose, ret = 0; verbose = 0; optind = 1; @@ -273,11 +273,13 @@ command_lsmod(int argc, char *argv[]) pager_open(); for (fp = preloaded_files; fp; fp = fp->f_next) { - sprintf(lbuf, " %p: ", (void *) fp->f_addr); + snprintf(lbuf, sizeof(lbuf), " %p: ", (void *) fp->f_addr); pager_output(lbuf); pager_output(fp->f_name); - sprintf(lbuf, " (%s, 0x%lx)\n", fp->f_type, (long)fp->f_size); - pager_output(lbuf); + snprintf(lbuf, sizeof(lbuf), " (%s, 0x%lx)\n", fp->f_type, + (long)fp->f_size); + if (pager_output(lbuf)) + break; if (fp->f_args != NULL) { pager_output(" args: "); pager_output(fp->f_args); @@ -287,7 +289,8 @@ command_lsmod(int argc, char *argv[]) if (fp->f_modules) { pager_output(" modules: "); for (mp = fp->f_modules; mp; mp = mp->m_next) { - sprintf(lbuf, "%s.%d ", mp->m_name, mp->m_version); + snprintf(lbuf, sizeof(lbuf), "%s.%d ", mp->m_name, + mp->m_version); pager_output(lbuf); } if (pager_output("\n")) @@ -296,11 +299,14 @@ command_lsmod(int argc, char *argv[]) if (verbose) { /* XXX could add some formatting smarts here to display some better */ for (md = fp->f_metadata; md != NULL; md = md->md_next) { - sprintf(lbuf, " 0x%04x, 0x%lx\n", md->md_type, (long) md->md_size); + snprintf(lbuf, sizeof(lbuf), " 0x%04x, 0x%lx\n", + md->md_type, (long) md->md_size); if (pager_output(lbuf)) break; } } + if (ret) + break; } pager_close(); return(CMD_OK); Modified: head/sys/boot/common/part.c ============================================================================== --- head/sys/boot/common/part.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/common/part.c Tue Nov 8 06:50:18 2016 (r308434) @@ -834,6 +834,7 @@ ptable_iterate(const struct ptable *tabl { struct pentry *entry; char name[32]; + int ret = 0; name[0] = '\0'; STAILQ_FOREACH(entry, &table->entries, entry) { @@ -856,9 +857,8 @@ ptable_iterate(const struct ptable *tabl if (table->type == PTABLE_BSD) sprintf(name, "%c", (u_char) 'a' + entry->part.index); - if (iter(arg, name, &entry->part)) - return 1; + if ((ret = iter(arg, name, &entry->part)) != 0) + return (ret); } - return 0; + return (ret); } - Modified: head/sys/boot/common/util.c ============================================================================== --- head/sys/boot/common/util.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/common/util.c Tue Nov 8 06:50:18 2016 (r308434) @@ -114,7 +114,7 @@ strlen(const char *s) return (len); } -void +int printf(const char *fmt, ...) { va_list ap; @@ -178,4 +178,5 @@ nextfmt: } } va_end(ap); + return (0); } Modified: head/sys/boot/common/util.h ============================================================================== --- head/sys/boot/common/util.h Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/common/util.h Tue Nov 8 06:50:18 2016 (r308434) @@ -48,6 +48,6 @@ void strcat(char *dst, const char *src); char *strchr(const char *s, char ch); size_t strlen(const char *s); -void printf(const char *fmt, ...); +int printf(const char *fmt, ...); #endif /* !_UTIL_H_ */ Modified: head/sys/boot/efi/libefi/efinet.c ============================================================================== --- head/sys/boot/efi/libefi/efinet.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/efi/libefi/efinet.c Tue Nov 8 06:50:18 2016 (r308434) @@ -252,7 +252,7 @@ efinet_end(struct netif *nif) } static int efinet_dev_init(void); -static void efinet_dev_print(int); +static int efinet_dev_print(int); struct devsw efinet_dev = { .dv_name = "net", @@ -346,14 +346,13 @@ efinet_dev_init() return (0); } -static void +static int efinet_dev_print(int verbose) { CHAR16 *text; EFI_HANDLE h; - int unit; + int unit, ret = 0; - pager_open(); for (unit = 0, h = efi_find_handle(&efinet_dev, 0); h != NULL; h = efi_find_handle(&efinet_dev, ++unit)) { printf(" %s%d:", efinet_dev.dv_name, unit); @@ -364,8 +363,8 @@ efinet_dev_print(int verbose) efi_free_devpath_name(text); } } - if (pager_output("\n")) + if ((ret = pager_output("\n")) != 0) break; } - pager_close(); + return (ret); } Modified: head/sys/boot/efi/libefi/efipart.c ============================================================================== --- head/sys/boot/efi/libefi/efipart.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/efi/libefi/efipart.c Tue Nov 8 06:50:18 2016 (r308434) @@ -47,7 +47,7 @@ static int efipart_realstrategy(void *, size_t *); static int efipart_open(struct open_file *, ...); static int efipart_close(struct open_file *); -static void efipart_print(int); +static int efipart_print(int); struct devsw efipart_dev = { .dv_name = "part", @@ -162,7 +162,7 @@ efipart_init(void) return (err); } -static void +static int efipart_print(int verbose) { char line[80]; @@ -170,28 +170,29 @@ efipart_print(int verbose) EFI_HANDLE h; EFI_STATUS status; u_int unit; + int ret = 0; - pager_open(); for (unit = 0, h = efi_find_handle(&efipart_dev, 0); h != NULL; h = efi_find_handle(&efipart_dev, ++unit)) { - sprintf(line, " %s%d:", efipart_dev.dv_name, unit); - if (pager_output(line)) + snprintf(line, sizeof(line), " %s%d:", + efipart_dev.dv_name, unit); + if ((ret = pager_output(line)) != 0) break; status = BS->HandleProtocol(h, &blkio_guid, (void **)&blkio); if (!EFI_ERROR(status)) { - sprintf(line, " %llu blocks", + snprintf(line, sizeof(line), " %llu blocks", (unsigned long long)(blkio->Media->LastBlock + 1)); - if (pager_output(line)) + if ((ret = pager_output(line)) != 0) break; if (blkio->Media->RemovableMedia) - if (pager_output(" (removable)")) + if ((ret = pager_output(" (removable)")) != 0) break; } - if (pager_output("\n")) + if ((ret = pager_output("\n")) != 0) break; } - pager_close(); + return (ret); } static int Modified: head/sys/boot/efi/loader/main.c ============================================================================== --- head/sys/boot/efi/loader/main.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/efi/loader/main.c Tue Nov 8 06:50:18 2016 (r308434) @@ -533,6 +533,7 @@ command_memmap(int argc, char *argv[]) UINT32 dver; EFI_STATUS status; int i, ndesc; + char line[80]; static char *types[] = { "Reserved", "LoaderCode", @@ -564,14 +565,19 @@ command_memmap(int argc, char *argv[]) } ndesc = sz / dsz; - printf("%23s %12s %12s %8s %4s\n", + snprintf(line, sizeof(line), "%23s %12s %12s %8s %4s\n", "Type", "Physical", "Virtual", "#Pages", "Attr"); + pager_open(); + if (pager_output(line)) { + pager_close(); + return (CMD_OK); + } for (i = 0, p = map; i < ndesc; i++, p = NextMemoryDescriptor(p, dsz)) { printf("%23s %012jx %012jx %08jx ", types[p->Type], - (uintmax_t)p->PhysicalStart, (uintmax_t)p->VirtualStart, - (uintmax_t)p->NumberOfPages); + (uintmax_t)p->PhysicalStart, (uintmax_t)p->VirtualStart, + (uintmax_t)p->NumberOfPages); if (p->Attribute & EFI_MEMORY_UC) printf("UC "); if (p->Attribute & EFI_MEMORY_WC) @@ -588,9 +594,11 @@ command_memmap(int argc, char *argv[]) printf("RP "); if (p->Attribute & EFI_MEMORY_XP) printf("XP "); - printf("\n"); + if (pager_output("\n")) + break; } + pager_close(); return (CMD_OK); } @@ -612,10 +620,17 @@ guid_to_string(EFI_GUID *guid) static int command_configuration(int argc, char *argv[]) { + char line[80]; UINTN i; - printf("NumberOfTableEntries=%lu\n", + snprintf(line, sizeof(line), "NumberOfTableEntries=%lu\n", (unsigned long)ST->NumberOfTableEntries); + pager_open(); + if (pager_output(line)) { + pager_close(); + return (CMD_OK); + } + for (i = 0; i < ST->NumberOfTableEntries; i++) { EFI_GUID *guid; @@ -642,9 +657,13 @@ command_configuration(int argc, char *ar printf("FDT Table"); else printf("Unknown Table (%s)", guid_to_string(guid)); - printf(" at %p\n", ST->ConfigurationTable[i].VendorTable); + snprintf(line, sizeof(line), " at %p\n", + ST->ConfigurationTable[i].VendorTable); + if (pager_output(line)) + break; } + pager_close(); return (CMD_OK); } Modified: head/sys/boot/i386/libfirewire/firewire.c ============================================================================== --- head/sys/boot/i386/libfirewire/firewire.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/i386/libfirewire/firewire.c Tue Nov 8 06:50:18 2016 (r308434) @@ -69,7 +69,7 @@ static int fw_strategy(void *devdata, in size_t offset, size_t size, char *buf, size_t *rsize); static int fw_open(struct open_file *f, ...); static int fw_close(struct open_file *f); -static void fw_print(int verbose); +static int fw_print(int verbose); static void fw_cleanup(void); void fw_enable(void); @@ -148,21 +148,26 @@ fw_init(void) /* * Print information about OHCI chips */ -static void +static int fw_print(int verbose) { - int i; + char line[80]; + int i, ret = 0; struct fwohci_softc *sc; for (i = 0; i < MAX_OHCI; i ++) { sc = &fwinfo[i]; if (sc->state == FWOHCI_STATE_DEAD) break; - printf("%d: locator=0x%04x devid=0x%08x" + snprintf(line, sizeof(line), "%d: locator=0x%04x devid=0x%08x" " base_addr=0x%08x handle=0x%08x bus_id=0x%08x\n", i, sc->locator, sc->devid, sc->base_addr, sc->handle, sc->bus_id); + ret = pager_output(line); + if (ret != 0) + break; } + return (ret); } static int Modified: head/sys/boot/i386/libi386/bioscd.c ============================================================================== --- head/sys/boot/i386/libi386/bioscd.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/i386/libi386/bioscd.c Tue Nov 8 06:50:18 2016 (r308434) @@ -100,7 +100,7 @@ static int bc_realstrategy(void *devdata size_t offset, size_t size, char *buf, size_t *rsize); static int bc_open(struct open_file *f, ...); static int bc_close(struct open_file *f); -static void bc_print(int verbose); +static int bc_print(int verbose); struct devsw bioscd = { "cd", @@ -177,20 +177,19 @@ bc_add(int biosdev) /* * Print information about disks */ -static void +static int bc_print(int verbose) { char line[80]; - int i; + int i, ret = 0; - pager_open(); for (i = 0; i < nbcinfo; i++) { - sprintf(line, " cd%d: Device 0x%x\n", i, + snprintf(line, sizeof(line), " cd%d: Device 0x%x\n", i, bcinfo[i].bc_sp.sp_devicespec); - if (pager_output(line)) + if ((ret = pager_output(line)) != 0) break; } - pager_close(); + return (ret); } /* Modified: head/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- head/sys/boot/i386/libi386/biosdisk.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/i386/libi386/biosdisk.c Tue Nov 8 06:50:18 2016 (r308434) @@ -135,7 +135,7 @@ static int bd_realstrategy(void *devdata static int bd_open(struct open_file *f, ...); static int bd_close(struct open_file *f); static int bd_ioctl(struct open_file *f, u_long cmd, void *data); -static void bd_print(int verbose); +static int bd_print(int verbose); static void bd_cleanup(void); #ifdef LOADER_GELI_SUPPORT @@ -321,21 +321,21 @@ bd_int13probe(struct bdinfo *bd) /* * Print information about disks */ -static void +static int bd_print(int verbose) { static char line[80]; struct disk_devdesc dev; - int i; + int i, ret = 0; - pager_open(); for (i = 0; i < nbdinfo; i++) { - sprintf(line, " disk%d: BIOS drive %c (%ju X %u):\n", i, + snprintf(line, sizeof(line), + " disk%d: BIOS drive %c (%ju X %u):\n", i, (bdinfo[i].bd_unit < 0x80) ? ('A' + bdinfo[i].bd_unit): ('C' + bdinfo[i].bd_unit - 0x80), (uintmax_t)bdinfo[i].bd_sectors, bdinfo[i].bd_sectorsize); - if (pager_output(line)) + if ((ret = pager_output(line)) != 0) break; dev.d_dev = &biosdisk; dev.d_unit = i; @@ -346,12 +346,14 @@ bd_print(int verbose) bdinfo[i].bd_sectorsize, (bdinfo[i].bd_flags & BD_FLOPPY) ? DISK_F_NOCACHE: 0) == 0) { - sprintf(line, " disk%d", i); - disk_print(&dev, line, verbose); + snprintf(line, sizeof(line), " disk%d", i); + ret = disk_print(&dev, line, verbose); disk_close(&dev); + if (ret != 0) + return (ret); } } - pager_close(); + return (ret); } /* Modified: head/sys/boot/i386/libi386/pxe.c ============================================================================== --- head/sys/boot/i386/libi386/pxe.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/i386/libi386/pxe.c Tue Nov 8 06:50:18 2016 (r308434) @@ -75,7 +75,7 @@ static int pxe_strategy(void *devdata, i size_t offset, size_t size, char *buf, size_t *rsize); static int pxe_open(struct open_file *f, ...); static int pxe_close(struct open_file *f); -static void pxe_print(int verbose); +static int pxe_print(int verbose); static void pxe_cleanup(void); static void pxe_setnfshandle(char *rootpath); @@ -381,14 +381,20 @@ pxe_close(struct open_file *f) return (0); } -static void +static int pxe_print(int verbose) { - + char line[255]; if (pxe_call == NULL) - return; + return (0); - printf(" pxe0: %s:%s\n", inet_ntoa(rootip), rootpath); + if (verbose) { + snprintf(line, sizeof(line), " pxe0: %s:%s\n", + inet_ntoa(rootip), rootpath); + } else { + snprintf(line, sizeof(line), " pxe0:\n"); + } + return (pager_output(line)); } static void Modified: head/sys/boot/mips/beri/loader/beri_disk_cfi.c ============================================================================== --- head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Nov 8 06:50:18 2016 (r308434) @@ -47,7 +47,7 @@ static int beri_cfi_disk_close(struct op static void beri_cfi_disk_cleanup(void); static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t, size_t, char *, size_t *); -static void beri_cfi_disk_print(int); +static int beri_cfi_disk_print(int); struct devsw beri_cfi_disk = { .dv_name = "cfi", @@ -112,25 +112,29 @@ beri_cfi_disk_close(struct open_file *f) return (disk_close(dev)); } -static void +static int beri_cfi_disk_print(int verbose) { struct disk_devdesc dev; char line[80]; + int ret; - sprintf(line, " cfi%d CFI flash device\n", 0); - pager_output(line); + snprintf(line, sizeof(line), " cfi%d CFI flash device\n", 0); + ret = pager_output(line); + if (ret != 0) + return (ret); dev.d_dev = &beri_cfi_disk; dev.d_unit = 0; dev.d_slice = -1; dev.d_partition = -1; if (disk_open(&dev, cfi_get_mediasize(), cfi_get_sectorsize(), 0) == 0) { - sprintf(line, " cfi%d", 0); - disk_print(&dev, line, verbose); + snprintf(line, sizeof(line), " cfi%d", 0); + ret = disk_print(&dev, line, verbose); disk_close(&dev); } + return (ret); } static void Modified: head/sys/boot/mips/beri/loader/beri_disk_sdcard.c ============================================================================== --- head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Nov 8 06:50:18 2016 (r308434) @@ -47,7 +47,7 @@ static int beri_sdcard_disk_close(struct static void beri_sdcard_disk_cleanup(void); static int beri_sdcard_disk_strategy(void *, int, daddr_t, size_t, size_t, char *, size_t *); -static void beri_sdcard_disk_print(int); +static int beri_sdcard_disk_print(int); struct devsw beri_sdcard_disk = { .dv_name = "sdcard", @@ -123,19 +123,23 @@ beri_sdcard_disk_print(int verbose) { struct disk_devdesc dev; char line[80]; + int ret; - sprintf(line, " sdcard%d Altera SD card drive\n", 0); - pager_output(line); + snprintf(line, sizeof(line), " sdcard%d Altera SD card drive\n", 0); + ret = pager_output(line); + if (ret != 0) + return (ret); dev.d_dev = &beri_sdcard_disk; dev.d_unit = 0; dev.d_slice = -1; dev.d_partition = -1; if (disk_open(&dev, altera_sdcard_get_mediasize(), altera_sdcard_get_sectorsize(), 0) == 0) { - sprintf(line, " sdcard%d", 0); - disk_print(&dev, line, verbose); + snprintf(line, sizeof(line), " sdcard%d", 0); + ret = disk_print(&dev, line, verbose); disk_close(&dev); } + return (ret); } static void Modified: head/sys/boot/ofw/libofw/ofw_disk.c ============================================================================== --- head/sys/boot/ofw/libofw/ofw_disk.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/ofw/libofw/ofw_disk.c Tue Nov 8 06:50:18 2016 (r308434) @@ -47,7 +47,7 @@ static int ofwd_strategy(void *devdata, static int ofwd_open(struct open_file *f, ...); static int ofwd_close(struct open_file *f); static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data); -static void ofwd_print(int verbose); +static int ofwd_print(int verbose); struct devsw ofwdisk = { "block", @@ -161,8 +161,8 @@ ofwd_ioctl(struct open_file *f __unused, return (EINVAL); } -static void +static int ofwd_print(int verbose __unused) { - + return (0); } Modified: head/sys/boot/pc98/libpc98/bioscd.c ============================================================================== --- head/sys/boot/pc98/libpc98/bioscd.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/pc98/libpc98/bioscd.c Tue Nov 8 06:50:18 2016 (r308434) @@ -99,7 +99,7 @@ static int bc_realstrategy(void *devdata size_t offset, size_t size, char *buf, size_t *rsize); static int bc_open(struct open_file *f, ...); static int bc_close(struct open_file *f); -static void bc_print(int verbose); +static int bc_print(int verbose); struct devsw bioscd = { "cd", @@ -173,20 +173,19 @@ bc_add(int biosdev) /* * Print information about disks */ -static void +static int bc_print(int verbose) { char line[80]; - int i; + int i, ret = 0; - pager_open(); for (i = 0; i < nbcinfo; i++) { sprintf(line, " cd%d: Device 0x%x\n", i, bcinfo[i].bc_sp.sp_devicespec); - if (pager_output(line)) + if ((ret = pager_output(line)) != 0) break; } - pager_close(); + return (ret); } /* Modified: head/sys/boot/pc98/libpc98/biosdisk.c ============================================================================== --- head/sys/boot/pc98/libpc98/biosdisk.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/pc98/libpc98/biosdisk.c Tue Nov 8 06:50:18 2016 (r308434) @@ -123,7 +123,7 @@ static int bd_realstrategy(void *devdata size_t offset, size_t size, char *buf, size_t *rsize); static int bd_open(struct open_file *f, ...); static int bd_close(struct open_file *f); -static void bd_print(int verbose); +static int bd_print(int verbose); struct devsw biosdisk = { "disk", @@ -249,21 +249,20 @@ bd_int13probe(struct bdinfo *bd) /* * Print information about disks */ -static void +static int bd_print(int verbose) { - int i, j, done; + int i, j, ret = 0; char line[80]; struct i386_devdesc dev; struct open_disk *od; struct pc98_partition *dptr; - pager_open(); - done = 0; - for (i = 0; i < nbdinfo && !done; i++) { - sprintf(line, " disk%d: BIOS drive %c:\n", i, 'A' + i); - if (pager_output(line)) - break; + for (i = 0; i < nbdinfo; i++) { + snprintf(line, sizeof(line), " disk%d: BIOS drive %c:\n", + i, 'A' + i); + if ((ret = pager_output(line)) != 0) + break; /* try to open the whole disk */ dev.d_unit = i; @@ -278,17 +277,17 @@ bd_print(int verbose) /* Check for a "dedicated" disk */ for (j = 0; j < od->od_nslices; j++) { - sprintf(line, " disk%ds%d", i, j + 1); - if (bd_printslice(od, &dptr[j], line, verbose)) { - done = 1; - break; - } + snprintf(line, sizeof(line), " disk%ds%d", i, j + 1); + if ((ret = bd_printslice(od, &dptr[j], line, verbose)) != 0) + break; } } bd_closedisk(od); + if (ret != 0) + break; } } - pager_close(); + return (ret); } /* Given a size in 512 byte sectors, convert it to a human-readable number. */ Modified: head/sys/boot/powerpc/kboot/hostdisk.c ============================================================================== --- head/sys/boot/powerpc/kboot/hostdisk.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/powerpc/kboot/hostdisk.c Tue Nov 8 06:50:18 2016 (r308434) @@ -37,7 +37,7 @@ static int hostdisk_strategy(void *devda static int hostdisk_open(struct open_file *f, ...); static int hostdisk_close(struct open_file *f); static int hostdisk_ioctl(struct open_file *f, u_long cmd, void *data); -static void hostdisk_print(int verbose); +static int hostdisk_print(int verbose); struct devsw hostdisk = { "/dev", @@ -117,9 +117,9 @@ hostdisk_ioctl(struct open_file *f, u_lo return (EINVAL); } -static void +static int hostdisk_print(int verbose) { - + return (0); } Modified: head/sys/boot/powerpc/ps3/ps3cdrom.c ============================================================================== --- head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Nov 8 06:50:18 2016 (r308434) @@ -49,7 +49,7 @@ static int ps3cdrom_strategy(void *devda size_t offset, size_t size, char *buf, size_t *rsize); static int ps3cdrom_open(struct open_file *f, ...); static int ps3cdrom_close(struct open_file *f); -static void ps3cdrom_print(int verbose); +static int ps3cdrom_print(int verbose); struct devsw ps3cdrom = { "cd", @@ -149,6 +149,7 @@ static int ps3cdrom_close(struct open_fi return 0; } -static void ps3cdrom_print(int verbose) +static int ps3cdrom_print(int verbose) { + return (0); } Modified: head/sys/boot/powerpc/ps3/ps3disk.c ============================================================================== --- head/sys/boot/powerpc/ps3/ps3disk.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/powerpc/ps3/ps3disk.c Tue Nov 8 06:50:18 2016 (r308434) @@ -61,7 +61,7 @@ static int ps3disk_strategy(void *devdat size_t offset, size_t size, char *buf, size_t *rsize); static int ps3disk_open(struct open_file *f, ...); static int ps3disk_close(struct open_file *f); -static void ps3disk_print(int verbose); +static int ps3disk_print(int verbose); struct devsw ps3disk = { "disk", @@ -186,8 +186,9 @@ static int ps3disk_close(struct open_fil return 0; } -static void ps3disk_print(int verbose) +static int ps3disk_print(int verbose) { + return (0); } static int ps3disk_open_gpt(struct ps3_devdesc *dev, struct open_dev *od) Modified: head/sys/boot/uboot/lib/disk.c ============================================================================== --- head/sys/boot/uboot/lib/disk.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/uboot/lib/disk.c Tue Nov 8 06:50:18 2016 (r308434) @@ -78,7 +78,7 @@ static int stor_strategy(void *, int, da static int stor_open(struct open_file *, ...); static int stor_close(struct open_file *); static int stor_ioctl(struct open_file *f, u_long cmd, void *data); -static void stor_print(int); +static int stor_print(int); static void stor_cleanup(void); struct devsw uboot_storage = { @@ -238,30 +238,31 @@ stor_readdev(struct disk_devdesc *dev, d return (err); } -static void +static int stor_print(int verbose) { struct disk_devdesc dev; static char line[80]; - int i; + int i, ret = 0; - pager_open(); for (i = 0; i < stor_info_no; i++) { dev.d_dev = &uboot_storage; dev.d_unit = i; dev.d_slice = -1; dev.d_partition = -1; - sprintf(line, "\tdisk%d (%s)\n", i, + snprintf(line, sizeof(line), "\tdisk%d (%s)\n", i, ub_stor_type(SI(&dev).type)); - if (pager_output(line)) + if ((ret = pager_output(line)) != 0) break; if (stor_opendev(&dev) == 0) { sprintf(line, "\tdisk%d", i); - disk_print(&dev, line, verbose); + ret = disk_print(&dev, line, verbose); disk_close(&dev); + if (ret != 0) + break; } } - pager_close(); + return (ret); } static int Modified: head/sys/boot/usb/storage/umass_loader.c ============================================================================== --- head/sys/boot/usb/storage/umass_loader.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/usb/storage/umass_loader.c Tue Nov 8 06:50:18 2016 (r308434) @@ -50,7 +50,7 @@ static void umass_disk_cleanup(void); static int umass_disk_ioctl(struct open_file *, u_long, void *); static int umass_disk_strategy(void *, int, daddr_t, size_t, size_t, char *, size_t *); -static void umass_disk_print(int); +static int umass_disk_print(int); struct devsw umass_disk = { .dv_name = "umass", @@ -170,23 +170,26 @@ umass_disk_close(struct open_file *f) return (disk_close(dev)); } -static void +static int umass_disk_print(int verbose) { struct disk_devdesc dev; memset(&dev, 0, sizeof(dev)); - pager_output(" umass0 UMASS device\n"); + ret = pager_output(" umass0 UMASS device\n"); + if (ret != 0) + return (ret); dev.d_dev = &umass_disk; dev.d_unit = 0; dev.d_slice = -1; dev.d_partition = -1; if (umass_disk_open_sub(&dev) == 0) { - disk_print(&dev, " umass0", verbose); + ret = disk_print(&dev, " umass0", verbose); disk_close(&dev); } + return (ret); } static void Modified: head/sys/boot/userboot/userboot/host.c ============================================================================== --- head/sys/boot/userboot/userboot/host.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/userboot/userboot/host.c Tue Nov 8 06:50:18 2016 (r308434) @@ -134,13 +134,13 @@ host_dev_init(void) return (0); } -static void +static int host_dev_print(int verbose) { char line[80]; - sprintf(line, " host%d: Host filesystem\n", 0); - pager_output(line); + snprintf(line, sizeof(line), " host%d: Host filesystem\n", 0); + return (pager_output(line)); } /* Modified: head/sys/boot/userboot/userboot/userboot_disk.c ============================================================================== --- head/sys/boot/userboot/userboot/userboot_disk.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/userboot/userboot/userboot_disk.c Tue Nov 8 06:50:18 2016 (r308434) @@ -60,7 +60,7 @@ static int userdisk_realstrategy(void *d static int userdisk_open(struct open_file *f, ...); static int userdisk_close(struct open_file *f); static int userdisk_ioctl(struct open_file *f, u_long cmd, void *data); -static void userdisk_print(int verbose); +static int userdisk_print(int verbose); struct devsw userboot_disk = { "disk", @@ -116,27 +116,33 @@ userdisk_cleanup(void) /* * Print information about disks */ -static void +static int userdisk_print(int verbose) { struct disk_devdesc dev; char line[80]; - int i; + int i, ret = 0; for (i = 0; i < userdisk_maxunit; i++) { - sprintf(line, " disk%d: Guest drive image\n", i); - pager_output(line); + snprintf(line, sizeof(line), + " disk%d: Guest drive image\n", i); + ret = pager_output(line); + if (ret != 0) + break; dev.d_dev = &userboot_disk; dev.d_unit = i; dev.d_slice = -1; dev.d_partition = -1; if (disk_open(&dev, ud_info[i].mediasize, ud_info[i].sectorsize, 0) == 0) { - sprintf(line, " disk%d", i); - disk_print(&dev, line, verbose); + snprintf(line, sizeof(line), " disk%d", i); + ret = disk_print(&dev, line, verbose); disk_close(&dev); + if (ret != 0) + break; } } + return (ret); } /* Modified: head/sys/boot/zfs/zfs.c ============================================================================== --- head/sys/boot/zfs/zfs.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/zfs/zfs.c Tue Nov 8 06:50:18 2016 (r308434) @@ -514,20 +514,23 @@ zfs_probe_dev(const char *devname, uint6 /* * Print information about ZFS pools */ -static void +static int zfs_dev_print(int verbose) { spa_t *spa; char line[80]; + int ret = 0; if (verbose) { - spa_all_status(); - return; + return (spa_all_status()); } STAILQ_FOREACH(spa, &zfs_pools, spa_link) { - sprintf(line, " zfs:%s\n", spa->spa_name); - pager_output(line); + snprintf(line, sizeof(line), " zfs:%s\n", spa->spa_name); + ret = pager_output(line); + if (ret != 0) + break; } + return (ret); } /* Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Tue Nov 8 06:13:22 2016 (r308433) +++ head/sys/boot/zfs/zfsimpl.c Tue Nov 8 06:50:18 2016 (r308434) @@ -780,7 +780,7 @@ state_name(vdev_state_t state) #else -static void +static int pager_printf(const char *fmt, ...) { char line[80]; @@ -789,14 +789,14 @@ pager_printf(const char *fmt, ...) va_start(args, fmt); vsprintf(line, fmt, args); va_end(args); - pager_output(line); + return (pager_output(line)); } #endif #define STATUS_FORMAT " %s %s\n" -static void +static int print_state(int indent, const char *name, vdev_state_t state) { int i; @@ -806,40 +806,56 @@ print_state(int indent, const char *name for (i = 0; i < indent; i++) strcat(buf, " "); strcat(buf, name); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Nov 8 07:18:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF880C35B73; Tue, 8 Nov 2016 07:18:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE8511D5; Tue, 8 Nov 2016 07:18:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA87IXj3068223; Tue, 8 Nov 2016 07:18:33 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA87IXdN068222; Tue, 8 Nov 2016 07:18:33 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611080718.uA87IXdN068222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Nov 2016 07:18:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308435 - stable/11/sys/amd64/vmm/amd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 07:18:35 -0000 Author: avg Date: Tue Nov 8 07:18:33 2016 New Revision: 308435 URL: https://svnweb.freebsd.org/changeset/base/308435 Log: MFC r307903,307904,308039,308050: vmm/svm: iopm_bitmap and msr_bitmap must be contiguous in physical memory Modified: stable/11/sys/amd64/vmm/amd/svm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/vmm/amd/svm.c ============================================================================== --- stable/11/sys/amd64/vmm/amd/svm.c Tue Nov 8 06:50:18 2016 (r308434) +++ stable/11/sys/amd64/vmm/amd/svm.c Tue Nov 8 07:18:33 2016 (r308435) @@ -514,10 +514,11 @@ svm_vminit(struct vm *vm, pmap_t pmap) { struct svm_softc *svm_sc; struct svm_vcpu *vcpu; - vm_paddr_t msrpm_pa, iopm_pa, pml4_pa; + vm_paddr_t msrpm_pa, iopm_pa, pml4_pa; int i; - svm_sc = malloc(sizeof (struct svm_softc), M_SVM, M_WAITOK | M_ZERO); + svm_sc = contigmalloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO, + 0, ~(vm_paddr_t)0, PAGE_SIZE, 0); svm_sc->vm = vm; svm_sc->nptp = (vm_offset_t)vtophys(pmap->pm_pml4); @@ -534,7 +535,7 @@ svm_vminit(struct vm *vm, pmap_t pmap) svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_GSBASE); svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_FSBASE); svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_KGSBASE); - + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_STAR); svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_LSTAR); svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_CSTAR); @@ -2042,7 +2043,7 @@ svm_vmcleanup(void *arg) { struct svm_softc *sc = arg; - free(sc, M_SVM); + contigfree(sc, sizeof (*sc), M_SVM); } static register_t * From owner-svn-src-all@freebsd.org Tue Nov 8 07:18:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A5F5C35BBC; Tue, 8 Nov 2016 07:18:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 344F32CC; Tue, 8 Nov 2016 07:18:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA87Id41068273; Tue, 8 Nov 2016 07:18:39 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA87IdBm068272; Tue, 8 Nov 2016 07:18:39 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611080718.uA87IdBm068272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Nov 2016 07:18:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308436 - stable/10/sys/amd64/vmm/amd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 07:18:40 -0000 Author: avg Date: Tue Nov 8 07:18:39 2016 New Revision: 308436 URL: https://svnweb.freebsd.org/changeset/base/308436 Log: MFC r307903,307904,308039,308050: vmm/svm: iopm_bitmap and msr_bitmap must be contiguous in physical memory Modified: stable/10/sys/amd64/vmm/amd/svm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/vmm/amd/svm.c ============================================================================== --- stable/10/sys/amd64/vmm/amd/svm.c Tue Nov 8 07:18:33 2016 (r308435) +++ stable/10/sys/amd64/vmm/amd/svm.c Tue Nov 8 07:18:39 2016 (r308436) @@ -515,10 +515,11 @@ svm_vminit(struct vm *vm, pmap_t pmap) { struct svm_softc *svm_sc; struct svm_vcpu *vcpu; - vm_paddr_t msrpm_pa, iopm_pa, pml4_pa; + vm_paddr_t msrpm_pa, iopm_pa, pml4_pa; int i; - svm_sc = malloc(sizeof (struct svm_softc), M_SVM, M_WAITOK | M_ZERO); + svm_sc = contigmalloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO, + 0, ~(vm_paddr_t)0, PAGE_SIZE, 0); svm_sc->vm = vm; svm_sc->nptp = (vm_offset_t)vtophys(pmap->pm_pml4); @@ -535,7 +536,7 @@ svm_vminit(struct vm *vm, pmap_t pmap) svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_GSBASE); svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_FSBASE); svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_KGSBASE); - + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_STAR); svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_LSTAR); svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_CSTAR); @@ -2043,7 +2044,7 @@ svm_vmcleanup(void *arg) { struct svm_softc *sc = arg; - free(sc, M_SVM); + contigfree(sc, sizeof (*sc), M_SVM); } static register_t * From owner-svn-src-all@freebsd.org Tue Nov 8 08:09:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24909C33AE1; Tue, 8 Nov 2016 08:09:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA636E99; Tue, 8 Nov 2016 08:09:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA889nLC088843; Tue, 8 Nov 2016 08:09:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA889nVl088842; Tue, 8 Nov 2016 08:09:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611080809.uA889nVl088842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 8 Nov 2016 08:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308437 - head/sys/dev/sound/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 08:09:50 -0000 Author: hselasky Date: Tue Nov 8 08:09:48 2016 New Revision: 308437 URL: https://svnweb.freebsd.org/changeset/base/308437 Log: Range check the jitter values to avoid bogus sample rate adjustments. The expected deviation should not be more than 1Hz per second. The USB v2.0 specification also mandates this requirement. Refer to chapter 5.12.4.2 about feedback. PR: 208791 MFC after: 3 days Modified: head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Tue Nov 8 07:18:39 2016 (r308436) +++ head/sys/dev/sound/usb/uaudio.c Tue Nov 8 08:09:48 2016 (r308437) @@ -2078,9 +2078,22 @@ uaudio_chan_play_sync_callback(struct us * Use feedback value as fallback when there is no * recording channel: */ - if (ch->priv_sc->sc_rec_chan.num_alt == 0) - ch->jitter_curr = temp - sample_rate; - + if (ch->priv_sc->sc_rec_chan.num_alt == 0) { + /* + * Range check the jitter values to avoid + * bogus sample rate adjustments. The expected + * deviation should not be more than 1Hz per + * second. The USB v2.0 specification also + * mandates this requirement. Refer to chapter + * 5.12.4.2 about feedback. + */ + if (temp > sample_rate) + ch->jitter_curr = 1; + else if (temp < sample_rate) + ch->jitter_curr = -1; + else + ch->jitter_curr = 0; + } ch->feedback_rate = temp; break; From owner-svn-src-all@freebsd.org Tue Nov 8 08:32:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD120C3668E; Tue, 8 Nov 2016 08:32:23 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: from mail-vk0-x22c.google.com (mail-vk0-x22c.google.com [IPv6:2607:f8b0:400c:c05::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 87B6B34E; Tue, 8 Nov 2016 08:32:23 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: by mail-vk0-x22c.google.com with SMTP id p9so142770500vkd.3; Tue, 08 Nov 2016 00:32:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=KHEpvPhJ3fCL519L2TKFZpf1I3P0e9FP/d/I5kn6kHg=; b=OfSh1etH/ZJplN5VAYTT8GNoi3yr1LUHQPPYu61qtWXpKeX82wV0XT4SsHrTQroyYS gsuqSWYwC9zh4/LhEprbU2Ol7s2U+CKOTELg+9QxQZO3/a9R/yiSkfNuGjYkaJvwcjbv FlRa2/hGQHry+PvAR96vpQ4Rae4PTEs9ZmKRsBKf7pY/dlEN3+puYi6UKx8tB+mofmCF kEPvA8QdiuinrXoBFlLd6nsI88rXaqZJ4SSvzr1qFXQrCvlWWWg/2N8OVAuzMm15yzd8 3AIXA3NYnxdy0Z/g5mju7sckwyAAQPpkn4UjpUGRYSHRwq8fFruWrnRTmKRAqq+INObq WoOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KHEpvPhJ3fCL519L2TKFZpf1I3P0e9FP/d/I5kn6kHg=; b=Tv6VmTLtby18AC6MceoO7MpYGBS4/zlY5Wf2Eak4PBgdEy0O0wja4lGm5cIOONmiAL Y0tvp5r7PEMpce4SUjhvh8VImGlyN/w1IH4JRLQiSdf7jdmrexLpmT/qxj6KTmR6IPCg iN0JdVBkO8SLEJNxfwI1IJA1hve9PkK8atbbsN4WQUOtdVIB4sOF09HAOcwZf30y5RrZ aLbiUIg96P10rKDpz9FpkOawULrx5SSnyYq7sZG+IFdK+67LPv3QyQUx3QdKPSybA5aI m19BrmRlBCKoHbUW3fKJQgu9VDfLTyxMjuUUJZIdU6zafxjWGg50IlDZ5YBjj7AIu8HO RS3A== X-Gm-Message-State: ABUngvcYlz/VxsDfgnolxslFD8Kk7L48Chai19LW94qaXEC04HmMnR/dqWn1gC/E6r2ywvTNBJPMfifTu2vP7A== X-Received: by 10.31.155.208 with SMTP id d199mr7336396vke.55.1478593942326; Tue, 08 Nov 2016 00:32:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.159.36.247 with HTTP; Tue, 8 Nov 2016 00:32:21 -0800 (PST) In-Reply-To: <075f36ce-53c8-ce58-672f-6086d8decc41@freebsd.org> References: <201611051630.uA5GUhtk073581@repo.freebsd.org> <15572642.JMvQo5TC3D@ralph.baldwin.cx> <075f36ce-53c8-ce58-672f-6086d8decc41@freebsd.org> From: Sepherosa Ziehau Date: Tue, 8 Nov 2016 16:32:21 +0800 Message-ID: Subject: Re: svn commit: r308345 - head/sys/dev/e1000 To: Sean Bruno Cc: John Baldwin , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 08:32:23 -0000 On Mon, Nov 7, 2016 at 10:05 PM, Sean Bruno wrote: > > > On 11/06/16 23:37, Sepherosa Ziehau wrote: >> On Sun, Nov 6, 2016 at 7:16 AM, John Baldwin wrote: >>> On Saturday, November 05, 2016 04:30:43 PM Sean Bruno wrote: >>>> Author: sbruno >>>> Date: Sat Nov 5 16:30:42 2016 >>>> New Revision: 308345 >>>> URL: https://svnweb.freebsd.org/changeset/base/308345 >>>> >>>> Log: >>>> r295133 attempted to deactivate TSO in the 100Mbit link case with this >>>> adapter to work around bugs in TSO handling at this speed. >>>> >>>> em_init_locked is called during first boot of the adapter and will >>>> see that link_speed is unitialized, effectively turning off tso for >>>> all cards at all speeds, which I believe was *not* the intent. >>>> >>>> Move the handling of TSO deactivation to the link handler where we can >>>> more effectively make the decision about what to do. In addition, >>>> completely purge the TSO capabilities instead of disabling just CSUM_TSO. >>>> >>>> Thanks to jhb for explanation of the hw capabilites api. >>>> >>>> Thanks to royger and cognet for testing the 100Mbit failure case to >>>> ensure that their adapters do indeed still work. >>>> >>>> MFC after: 1 week >>>> Sponsored by: Limelight Networks >>>> >>>> Modified: >>>> head/sys/dev/e1000/if_em.c >>>> >>>> Modified: head/sys/dev/e1000/if_em.c >>>> ============================================================================== >>>> --- head/sys/dev/e1000/if_em.c Sat Nov 5 16:23:33 2016 (r308344) >>>> +++ head/sys/dev/e1000/if_em.c Sat Nov 5 16:30:42 2016 (r308345) >>>> @@ -369,11 +369,6 @@ MODULE_DEPEND(em, netmap, 1, 1, 1); >>>> #define MAX_INTS_PER_SEC 8000 >>>> #define DEFAULT_ITR (1000000000/(MAX_INTS_PER_SEC * 256)) >>>> >>>> -/* Allow common code without TSO */ >>>> -#ifndef CSUM_TSO >>>> -#define CSUM_TSO 0 >>>> -#endif >>>> - >>>> #define TSO_WORKAROUND 4 >>>> >>>> static SYSCTL_NODE(_hw, OID_AUTO, em, CTLFLAG_RD, 0, "EM driver parameters"); >>>> @@ -1396,15 +1391,9 @@ em_init_locked(struct adapter *adapter) >>>> if_clearhwassist(ifp); >>>> if (if_getcapenable(ifp) & IFCAP_TXCSUM) >>>> if_sethwassistbits(ifp, CSUM_TCP | CSUM_UDP, 0); >>>> - /* >>>> - ** There have proven to be problems with TSO when not >>>> - ** at full gigabit speed, so disable the assist automatically >>>> - ** when at lower speeds. -jfv >>>> - */ >>>> - if (if_getcapenable(ifp) & IFCAP_TSO4) { >>>> - if (adapter->link_speed == SPEED_1000) >>>> - if_sethwassistbits(ifp, CSUM_TSO, 0); >>>> - } >>>> + >>>> + if (if_getcapenable(ifp) & IFCAP_TSO4) >>>> + if_sethwassistbits(ifp, CSUM_TSO, 0); >>> >>> Does this always disable TSO? Should this part be removed entirely? >>> (That is, it seems like this would disable TSO even on Gigabit links). >>> >>>> /* Configure for OS presence */ >>>> em_init_manageability(adapter); >>>> @@ -2412,6 +2401,18 @@ em_update_link_status(struct adapter *ad >>>> if (link_check && (adapter->link_active == 0)) { >>>> e1000_get_speed_and_duplex(hw, &adapter->link_speed, >>>> &adapter->link_duplex); >>>> + /* >>>> + ** There have proven to be problems with TSO when not >>>> + ** at full gigabit speed, so disable the assist automatically >>>> + ** when at lower speeds. -jfv >>>> + */ >>>> + if (adapter->link_speed != SPEED_1000) { >>>> + if_sethwassistbits(ifp, 0, CSUM_TSO); >>>> + if_setcapenablebit(ifp, 0, IFCAP_TSO4); >>>> + if_setcapabilitiesbit(ifp, 0, IFCAP_TSO4); >>>> + >>>> + } >>> >>> Even though I suggested it, I wonder if it wouldn't be better to only >>> modify if_capenable and not if_capabilities, that way the admin can >>> decide to use 'ifconfig em0 tso' to force it back on (e.g. if moving >>> an adapter from 100 to 1G). >> >> I believe simply clearing CSUM_TSO should work for the TCP stack; >> messing administrative like capenable and hwcaps does not sound >> correct to me. >> > > I don't disagree, but I also don't have an opinion. What I didn't want, > was a continuation of the half disabled/half enabled TSO code path that > we had prior to this change. > >> As for this patch, do you need to re-enable TSO once link speed >> becomes 1000Mbps? > > Probably? There wasn't a clear way to flip this back on that I could > find that would catch the case of "link speed was 100 and is now 1000". > > > BTW, since the link status check/update is async w/ >> the TX path, does this really work, if there are TSO packets pending >> on the TX rings (let alone inflight TSO packets from the TCP stack) >> when the link speed changed to 100Mbps? > > TSO packets that are "pending" will continue out their path, AFAIK. I > don't believe that a link speed change from 1000 to 100 is a very common > occurrence, but I'm willing to change the code to something more > "graceful" if you have an idea of how to do it. https://people.freebsd.org/~sephe/em1.diff Thanks, sephe -- Tomorrow Will Never Die From owner-svn-src-all@freebsd.org Tue Nov 8 09:51:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04C73C3662B; Tue, 8 Nov 2016 09:51:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C670ACD7; Tue, 8 Nov 2016 09:51:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA89ptD8032214; Tue, 8 Nov 2016 09:51:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA89pt4W032207; Tue, 8 Nov 2016 09:51:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611080951.uA89pt4W032207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 8 Nov 2016 09:51:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308438 - in stable/11/sys: amd64/amd64 i386/i386 kern x86/include x86/x86 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 09:51:57 -0000 Author: kib Date: Tue Nov 8 09:51:55 2016 New Revision: 308438 URL: https://svnweb.freebsd.org/changeset/base/308438 Log: MFC r307866: Handle broadcast NMIs. MFC r307880: Follow-up to r307866. MFC r308030: Use correct cpu id in the banner. Modified: stable/11/sys/amd64/amd64/trap.c stable/11/sys/i386/i386/trap.c stable/11/sys/kern/subr_smp.c stable/11/sys/x86/include/x86_smp.h stable/11/sys/x86/include/x86_var.h stable/11/sys/x86/x86/cpu_machdep.c stable/11/sys/x86/x86/mp_x86.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Tue Nov 8 08:09:48 2016 (r308437) +++ stable/11/sys/amd64/amd64/trap.c Tue Nov 8 09:51:55 2016 (r308438) @@ -144,14 +144,6 @@ static char *trap_msg[] = { "DTrace pid return trap", /* 32 T_DTRACE_RET */ }; -#ifdef KDB -static int kdb_on_nmi = 1; -SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RWTUN, - &kdb_on_nmi, 0, "Go to KDB on NMI"); -#endif -static int panic_on_nmi = 1; -SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN, - &panic_on_nmi, 0, "Panic on NMI"); static int prot_fault_translation; SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RWTUN, &prot_fault_translation, 0, @@ -377,21 +369,7 @@ trap(struct trapframe *frame) #ifdef DEV_ISA case T_NMI: - /* machine/parity/power fail/"kitchen sink" faults */ - if (isa_nmi(frame->tf_err) == 0) { -#ifdef KDB - /* - * NMI can be hooked up to a pushbutton - * for debugging. - */ - if (kdb_on_nmi) { - printf ("NMI ... going to debugger\n"); - kdb_trap(type, 0, frame); - } -#endif /* KDB */ - goto userout; - } else if (panic_on_nmi) - panic("NMI indicates hardware failure"); + nmi_handle_intr(type, frame); break; #endif /* DEV_ISA */ @@ -563,22 +541,8 @@ trap(struct trapframe *frame) #ifdef DEV_ISA case T_NMI: - /* machine/parity/power fail/"kitchen sink" faults */ - if (isa_nmi(frame->tf_err) == 0) { -#ifdef KDB - /* - * NMI can be hooked up to a pushbutton - * for debugging. - */ - if (kdb_on_nmi) { - printf ("NMI ... going to debugger\n"); - kdb_trap(type, 0, frame); - } -#endif /* KDB */ - goto out; - } else if (panic_on_nmi == 0) - goto out; - /* FALLTHROUGH */ + nmi_handle_intr(type, frame); + goto out; #endif /* DEV_ISA */ } Modified: stable/11/sys/i386/i386/trap.c ============================================================================== --- stable/11/sys/i386/i386/trap.c Tue Nov 8 08:09:48 2016 (r308437) +++ stable/11/sys/i386/i386/trap.c Tue Nov 8 09:51:55 2016 (r308438) @@ -158,14 +158,6 @@ static char *trap_msg[] = { int has_f00f_bug = 0; /* Initialized so that it can be patched. */ #endif -#ifdef KDB -static int kdb_on_nmi = 1; -SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RWTUN, - &kdb_on_nmi, 0, "Go to KDB on NMI"); -#endif -static int panic_on_nmi = 1; -SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN, - &panic_on_nmi, 0, "Panic on NMI"); static int prot_fault_translation = 0; SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RW, &prot_fault_translation, 0, "Select signal to deliver on protection fault"); @@ -467,21 +459,7 @@ user_trctrap_out: } goto userout; #else /* !POWERFAIL_NMI */ - /* machine/parity/power fail/"kitchen sink" faults */ - if (isa_nmi(frame->tf_err) == 0) { -#ifdef KDB - /* - * NMI can be hooked up to a pushbutton - * for debugging. - */ - if (kdb_on_nmi) { - printf ("NMI ... going to debugger\n"); - kdb_trap(type, 0, frame); - } -#endif /* KDB */ - goto userout; - } else if (panic_on_nmi) - panic("NMI indicates hardware failure"); + nmi_handle_intr(type, frame); break; #endif /* POWERFAIL_NMI */ #endif /* DEV_ISA */ @@ -730,22 +708,8 @@ kernel_trctrap: } goto out; #else /* !POWERFAIL_NMI */ - /* machine/parity/power fail/"kitchen sink" faults */ - if (isa_nmi(frame->tf_err) == 0) { -#ifdef KDB - /* - * NMI can be hooked up to a pushbutton - * for debugging. - */ - if (kdb_on_nmi) { - printf ("NMI ... going to debugger\n"); - kdb_trap(type, 0, frame); - } -#endif /* KDB */ - goto out; - } else if (panic_on_nmi == 0) - goto out; - /* FALLTHROUGH */ + nmi_handle_intr(type, frame); + goto out; #endif /* POWERFAIL_NMI */ #endif /* DEV_ISA */ } Modified: stable/11/sys/kern/subr_smp.c ============================================================================== --- stable/11/sys/kern/subr_smp.c Tue Nov 8 08:09:48 2016 (r308437) +++ stable/11/sys/kern/subr_smp.c Tue Nov 8 09:51:55 2016 (r308438) @@ -209,6 +209,11 @@ forward_signal(struct thread *td) * 1: ok * */ +#if defined(__amd64__) || defined(__i386__) +#define X86 1 +#else +#define X86 0 +#endif static int generic_stop_cpus(cpuset_t map, u_int type) { @@ -220,12 +225,11 @@ generic_stop_cpus(cpuset_t map, u_int ty volatile cpuset_t *cpus; KASSERT( -#if defined(__amd64__) || defined(__i386__) - type == IPI_STOP || type == IPI_STOP_HARD || type == IPI_SUSPEND, -#else - type == IPI_STOP || type == IPI_STOP_HARD, + type == IPI_STOP || type == IPI_STOP_HARD +#if X86 + || type == IPI_SUSPEND #endif - ("%s: invalid stop type", __func__)); + , ("%s: invalid stop type", __func__)); if (!smp_started) return (0); @@ -233,7 +237,7 @@ generic_stop_cpus(cpuset_t map, u_int ty CTR2(KTR_SMP, "stop_cpus(%s) with %u type", cpusetobj_strprint(cpusetbuf, &map), type); -#if defined(__amd64__) || defined(__i386__) +#if X86 /* * When suspending, ensure there are are no IPIs in progress. * IPIs that have been issued, but not yet delivered (e.g. @@ -245,6 +249,9 @@ generic_stop_cpus(cpuset_t map, u_int ty mtx_lock_spin(&smp_ipi_mtx); #endif +#if X86 + if (!nmi_is_broadcast || nmi_kdb_lock == 0) { +#endif if (stopping_cpu != PCPU_GET(cpuid)) while (atomic_cmpset_int(&stopping_cpu, NOCPU, PCPU_GET(cpuid)) == 0) @@ -253,8 +260,11 @@ generic_stop_cpus(cpuset_t map, u_int ty /* send the stop IPI to all CPUs in map */ ipi_selected(map, type); +#if X86 + } +#endif -#if defined(__amd64__) || defined(__i386__) +#if X86 if (type == IPI_SUSPEND) cpus = &suspended_cpus; else @@ -272,7 +282,7 @@ generic_stop_cpus(cpuset_t map, u_int ty } } -#if defined(__amd64__) || defined(__i386__) +#if X86 if (type == IPI_SUSPEND) mtx_unlock_spin(&smp_ipi_mtx); #endif @@ -295,7 +305,7 @@ stop_cpus_hard(cpuset_t map) return (generic_stop_cpus(map, IPI_STOP_HARD)); } -#if defined(__amd64__) || defined(__i386__) +#if X86 int suspend_cpus(cpuset_t map) { @@ -325,20 +335,18 @@ generic_restart_cpus(cpuset_t map, u_int #endif volatile cpuset_t *cpus; - KASSERT( -#if defined(__amd64__) || defined(__i386__) - type == IPI_STOP || type == IPI_STOP_HARD || type == IPI_SUSPEND, -#else - type == IPI_STOP || type == IPI_STOP_HARD, + KASSERT(type == IPI_STOP || type == IPI_STOP_HARD +#if X86 + || type == IPI_SUSPEND #endif - ("%s: invalid stop type", __func__)); + , ("%s: invalid stop type", __func__)); if (!smp_started) - return 0; + return (0); CTR1(KTR_SMP, "restart_cpus(%s)", cpusetobj_strprint(cpusetbuf, &map)); -#if defined(__amd64__) || defined(__i386__) +#if X86 if (type == IPI_SUSPEND) cpus = &suspended_cpus; else @@ -348,11 +356,17 @@ generic_restart_cpus(cpuset_t map, u_int /* signal other cpus to restart */ CPU_COPY_STORE_REL(&map, &started_cpus); +#if X86 + if (!nmi_is_broadcast || nmi_kdb_lock == 0) { +#endif /* wait for each to clear its bit */ while (CPU_OVERLAP(cpus, &map)) cpu_spinwait(); +#if X86 + } +#endif - return 1; + return (1); } int @@ -362,7 +376,7 @@ restart_cpus(cpuset_t map) return (generic_restart_cpus(map, IPI_STOP)); } -#if defined(__amd64__) || defined(__i386__) +#if X86 int resume_cpus(cpuset_t map) { @@ -370,6 +384,7 @@ resume_cpus(cpuset_t map) return (generic_restart_cpus(map, IPI_SUSPEND)); } #endif +#undef X86 /* * All-CPU rendezvous. CPUs are signalled, all execute the setup function Modified: stable/11/sys/x86/include/x86_smp.h ============================================================================== --- stable/11/sys/x86/include/x86_smp.h Tue Nov 8 08:09:48 2016 (r308437) +++ stable/11/sys/x86/include/x86_smp.h Tue Nov 8 09:51:55 2016 (r308438) @@ -45,6 +45,9 @@ extern u_int ipi_page; extern u_int ipi_range; extern u_int ipi_range_size; +extern int nmi_kdb_lock; +extern int nmi_is_broadcast; + struct cpu_info { int cpu_present:1; int cpu_bsp:1; Modified: stable/11/sys/x86/include/x86_var.h ============================================================================== --- stable/11/sys/x86/include/x86_var.h Tue Nov 8 08:09:48 2016 (r308437) +++ stable/11/sys/x86/include/x86_var.h Tue Nov 8 09:51:55 2016 (r308438) @@ -85,6 +85,7 @@ struct reg; struct fpreg; struct dbreg; struct dumperinfo; +struct trapframe; /* * The interface type of the interrupt handler entry point cannot be @@ -107,6 +108,9 @@ bool fix_cpuid(void); void fillw(int /*u_short*/ pat, void *base, size_t cnt); int is_physical_memory(vm_paddr_t addr); int isa_nmi(int cd); +void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame); +void nmi_call_kdb_smp(u_int type, struct trapframe *frame); +void nmi_handle_intr(u_int type, struct trapframe *frame); void pagecopy(void *from, void *to); void printcpuinfo(void); int user_dbreg_trap(void); Modified: stable/11/sys/x86/x86/cpu_machdep.c ============================================================================== --- stable/11/sys/x86/x86/cpu_machdep.c Tue Nov 8 08:09:48 2016 (r308437) +++ stable/11/sys/x86/x86/cpu_machdep.c Tue Nov 8 09:51:55 2016 (r308438) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include "opt_inet.h" #include "opt_isa.h" +#include "opt_kdb.h" #include "opt_kstack_pages.h" #include "opt_maxmem.h" #include "opt_mp_watchdog.h" @@ -526,3 +527,55 @@ idle_sysctl(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_machdep, OID_AUTO, idle, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, idle_sysctl, "A", "currently selected idle function"); + +static int panic_on_nmi = 1; +SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN, + &panic_on_nmi, 0, + "Panic on NMI"); +int nmi_is_broadcast = 1; +SYSCTL_INT(_machdep, OID_AUTO, nmi_is_broadcast, CTLFLAG_RWTUN, + &nmi_is_broadcast, 0, + "Chipset NMI is broadcast"); +#ifdef KDB +int kdb_on_nmi = 1; +SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RWTUN, + &kdb_on_nmi, 0, + "Go to KDB on NMI"); +#endif + +#ifdef DEV_ISA +void +nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame) +{ + + /* machine/parity/power fail/"kitchen sink" faults */ + if (isa_nmi(frame->tf_err) == 0) { +#ifdef KDB + /* + * NMI can be hooked up to a pushbutton for debugging. + */ + if (kdb_on_nmi) { + printf("NMI/cpu%d ... going to debugger\n", cpu); + kdb_trap(type, 0, frame); + } +#endif /* KDB */ + } else if (panic_on_nmi) { + panic("NMI indicates hardware failure"); + } +} +#endif + +void +nmi_handle_intr(u_int type, struct trapframe *frame) +{ + +#ifdef DEV_ISA +#ifdef SMP + if (nmi_is_broadcast) { + nmi_call_kdb_smp(type, frame); + return; + } +#endif + nmi_call_kdb(PCPU_GET(cpuid), type, frame); +#endif +} Modified: stable/11/sys/x86/x86/mp_x86.c ============================================================================== --- stable/11/sys/x86/x86/mp_x86.c Tue Nov 8 08:09:48 2016 (r308437) +++ stable/11/sys/x86/x86/mp_x86.c Tue Nov 8 09:51:55 2016 (r308438) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include "opt_apic.h" #endif #include "opt_cpu.h" +#include "opt_isa.h" #include "opt_kstack_pages.h" #include "opt_pmap.h" #include "opt_sched.h" @@ -140,6 +141,7 @@ int cpu_apic_ids[MAXCPU]; volatile u_int cpu_ipi_pending[MAXCPU]; static void release_aps(void *dummy); +static void cpustop_handler_post(u_int cpu); static int hyperthreading_allowed = 1; SYSCTL_INT(_machdep, OID_AUTO, hyperthreading_allowed, CTLFLAG_RDTUN, @@ -1215,6 +1217,32 @@ ipi_nmi_handler(void) return (0); } +#ifdef DEV_ISA +int nmi_kdb_lock; + +void +nmi_call_kdb_smp(u_int type, struct trapframe *frame) +{ + int cpu; + bool call_post; + + cpu = PCPU_GET(cpuid); + if (atomic_cmpset_acq_int(&nmi_kdb_lock, 0, 1)) { + nmi_call_kdb(cpu, type, frame); + call_post = false; + } else { + savectx(&stoppcbs[cpu]); + CPU_SET_ATOMIC(cpu, &stopped_cpus); + while (!atomic_cmpset_acq_int(&nmi_kdb_lock, 0, 1)) + ia32_pause(); + call_post = true; + } + atomic_store_rel_int(&nmi_kdb_lock, 0); + if (call_post) + cpustop_handler_post(cpu); +} +#endif + /* * Handle an IPI_STOP by saving our current context and spinning until we * are resumed. @@ -1235,6 +1263,13 @@ cpustop_handler(void) while (!CPU_ISSET(cpu, &started_cpus)) ia32_pause(); + cpustop_handler_post(cpu); +} + +static void +cpustop_handler_post(u_int cpu) +{ + CPU_CLR_ATOMIC(cpu, &started_cpus); CPU_CLR_ATOMIC(cpu, &stopped_cpus); From owner-svn-src-all@freebsd.org Tue Nov 8 09:54:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CF48C366DE; Tue, 8 Nov 2016 09:54:12 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CB3AEED; Tue, 8 Nov 2016 09:54:12 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA89sBmZ034574; Tue, 8 Nov 2016 09:54:11 GMT (envelope-from pjd@FreeBSD.org) Received: (from pjd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA89sBRM034572; Tue, 8 Nov 2016 09:54:11 GMT (envelope-from pjd@FreeBSD.org) Message-Id: <201611080954.uA89sBRM034572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pjd set sender to pjd@FreeBSD.org using -f From: Pawel Jakub Dawidek Date: Tue, 8 Nov 2016 09:54:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r308439 - svnadmin/conf X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 09:54:12 -0000 Author: pjd Date: Tue Nov 8 09:54:11 2016 New Revision: 308439 URL: https://svnweb.freebsd.org/changeset/base/308439 Log: Please welcome Konrad Witaszczyk (def@) as a new source committer. Konrad is interested in working on encrypted kernel dumps and memory deduplication, at least initially. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Tue Nov 8 09:51:55 2016 (r308438) +++ svnadmin/conf/access Tue Nov 8 09:54:11 2016 (r308439) @@ -65,6 +65,7 @@ das davidch davidcs dchagin +def deischen delphij des Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Tue Nov 8 09:51:55 2016 (r308438) +++ svnadmin/conf/mentors Tue Nov 8 09:54:11 2016 (r308439) @@ -18,6 +18,7 @@ benl philip Co-mentor: simon carl jimharris cherry gibbs dab vangyzen +def pjd dexuan sephe eri gnn Co-mentor: thompsa ivadasz adrian Co-mentor: cognet From owner-svn-src-all@freebsd.org Tue Nov 8 10:05:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A0D3C36A70; Tue, 8 Nov 2016 10:05:12 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BDF9815; Tue, 8 Nov 2016 10:05:12 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8A5B3X038634; Tue, 8 Nov 2016 10:05:11 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8A5Bso038633; Tue, 8 Nov 2016 10:05:11 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201611081005.uA8A5Bso038633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 8 Nov 2016 10:05:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308440 - head/sys/dev/extres/clk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 10:05:12 -0000 Author: manu Date: Tue Nov 8 10:05:11 2016 New Revision: 308440 URL: https://svnweb.freebsd.org/changeset/base/308440 Log: Do not warn if the 'assigned-clock-parents' property does not exists. MFC after: 2 weeks Modified: head/sys/dev/extres/clk/clk.c Modified: head/sys/dev/extres/clk/clk.c ============================================================================== --- head/sys/dev/extres/clk/clk.c Tue Nov 8 09:54:11 2016 (r308439) +++ head/sys/dev/extres/clk/clk.c Tue Nov 8 10:05:11 2016 (r308440) @@ -1205,7 +1205,9 @@ clk_set_assigned(device_t dev, phandle_t "assigned-clock-parents", "#clock-cells", &nclocks); if (error != 0) { - device_printf(dev, "cannot parse assigned-clock-parents property\n"); + if (error != ENOENT) + device_printf(dev, + "cannot parse assigned-clock-parents property\n"); return (error); } From owner-svn-src-all@freebsd.org Tue Nov 8 10:06:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FAADC36AD7; Tue, 8 Nov 2016 10:06:44 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3FEE299A; Tue, 8 Nov 2016 10:06:44 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8A6hQs038741; Tue, 8 Nov 2016 10:06:43 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8A6hgP038740; Tue, 8 Nov 2016 10:06:43 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201611081006.uA8A6hgP038740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 8 Nov 2016 10:06:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308441 - head/sys/arm/allwinner/clk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 10:06:44 -0000 Author: manu Date: Tue Nov 8 10:06:43 2016 New Revision: 308441 URL: https://svnweb.freebsd.org/changeset/base/308441 Log: Do not fail to attach the clock if we cannot set the assigned parents as this property isn't mandatory. MFC after: 2 weeks Modified: head/sys/arm/allwinner/clk/aw_ahbclk.c Modified: head/sys/arm/allwinner/clk/aw_ahbclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_ahbclk.c Tue Nov 8 10:05:11 2016 (r308440) +++ head/sys/arm/allwinner/clk/aw_ahbclk.c Tue Nov 8 10:06:43 2016 (r308441) @@ -351,7 +351,7 @@ aw_ahbclk_attach(device_t dev) } error = clk_set_assigned(dev, node); - if (error != 0) { + if (error != 0 && error != ENOENT) { device_printf(dev, "cannot set assigned parents: %d\n", error); goto fail; } From owner-svn-src-all@freebsd.org Tue Nov 8 10:10:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44997C36C5C; Tue, 8 Nov 2016 10:10:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 150C3CDE; Tue, 8 Nov 2016 10:10:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8AAtDB041396; Tue, 8 Nov 2016 10:10:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8AAtqD041363; Tue, 8 Nov 2016 10:10:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611081010.uA8AAtqD041363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 8 Nov 2016 10:10:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308442 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 10:10:56 -0000 Author: kib Date: Tue Nov 8 10:10:55 2016 New Revision: 308442 URL: https://svnweb.freebsd.org/changeset/base/308442 Log: Tweaks for the buffer pager. Pass current thread credentials instead of NOCRED. Only allow unmapped buffers for filesystem which proclaimed the support. For all filesystems which currently use buffer pager (UFS, msdosfs and cd9660), the changes are effectively nop. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Nov 8 10:06:43 2016 (r308441) +++ head/sys/kern/vfs_bio.c Tue Nov 8 10:10:55 2016 (r308442) @@ -4686,13 +4686,15 @@ vfs_bio_getpages(struct vnode *vp, vm_pa vm_page_t m; vm_object_t object; struct buf *bp; + struct mount *mp; daddr_t lbn, lbnp; vm_ooffset_t la, lb, poff, poffe; long bsize; - int bo_bs, error, i; + int bo_bs, br_flags, error, i; bool redo, lpart; object = vp->v_object; + mp = vp->v_mount; la = IDX_TO_OFF(ma[count - 1]->pindex); if (la >= object->un_pager.vnp.vnp_size) return (VM_PAGER_BAD); @@ -4709,6 +4711,8 @@ vfs_bio_getpages(struct vnode *vp, vm_pa vnp.vnp_size, PAGE_SIZE) - la); } } + br_flags = (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMAPPED_BUFS) + != 0) ? GB_UNMAPPED : 0; VM_OBJECT_WLOCK(object); again: for (i = 0; i < count; i++) @@ -4741,8 +4745,8 @@ again: lbnp = lbn; bsize = get_blksize(vp, lbn); - error = bread_gb(vp, lbn, bsize, NOCRED, GB_UNMAPPED, - &bp); + error = bread_gb(vp, lbn, bsize, curthread->td_ucred, + br_flags, &bp); if (error != 0) goto end_pages; if (LIST_EMPTY(&bp->b_dep)) { From owner-svn-src-all@freebsd.org Tue Nov 8 11:36:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87FB1C37C68; Tue, 8 Nov 2016 11:36:34 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 411D3232; Tue, 8 Nov 2016 11:36:34 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8BaXYR073939; Tue, 8 Nov 2016 11:36:33 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8BaXrs073937; Tue, 8 Nov 2016 11:36:33 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201611081136.uA8BaXrs073937@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Tue, 8 Nov 2016 11:36:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308443 - head/bin/hostname X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 11:36:34 -0000 Author: araujo Date: Tue Nov 8 11:36:33 2016 New Revision: 308443 URL: https://svnweb.freebsd.org/changeset/base/308443 Log: Add -d flag that prints domain only. PR: 212875 Submitted by: Ben RUBSON Reviewed by: pi Modified: head/bin/hostname/hostname.1 head/bin/hostname/hostname.c Modified: head/bin/hostname/hostname.1 ============================================================================== --- head/bin/hostname/hostname.1 Tue Nov 8 10:10:55 2016 (r308442) +++ head/bin/hostname/hostname.1 Tue Nov 8 11:36:33 2016 (r308443) @@ -29,7 +29,7 @@ .\" @(#)hostname.1 8.2 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd December 7, 2006 +.Dd November 9, 2016 .Dt HOSTNAME 1 .Os .Sh NAME @@ -37,7 +37,8 @@ .Nd set or print name of current host system .Sh SYNOPSIS .Nm -.Op Fl fs +.Op Fl f +.Op Fl s|d .Op Ar name-of-host .Sh DESCRIPTION The @@ -62,6 +63,8 @@ This is the default behavior. .It Fl s Trim off any domain information from the printed name. +.It Fl d +Only print domain information. .El .Sh SEE ALSO .Xr gethostname 3 , Modified: head/bin/hostname/hostname.c ============================================================================== --- head/bin/hostname/hostname.c Tue Nov 8 10:10:55 2016 (r308442) +++ head/bin/hostname/hostname.c Tue Nov 8 11:36:33 2016 (r308443) @@ -54,11 +54,12 @@ static void usage(void) __dead2; int main(int argc, char *argv[]) { - int ch, sflag; + int ch, sflag, dflag; char *p, hostname[MAXHOSTNAMELEN]; sflag = 0; - while ((ch = getopt(argc, argv, "fs")) != -1) + dflag = 0; + while ((ch = getopt(argc, argv, "fsd")) != -1) switch (ch) { case 'f': /* @@ -70,6 +71,9 @@ main(int argc, char *argv[]) case 's': sflag = 1; break; + case 'd': + dflag = 1; + break; case '?': default: usage(); @@ -77,7 +81,7 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - if (argc > 1) + if (argc > 1 || (sflag && dflag)) usage(); if (*argv) { @@ -90,6 +94,10 @@ main(int argc, char *argv[]) p = strchr(hostname, '.'); if (p != NULL) *p = '\0'; + } else if (dflag) { + p = strchr(hostname, '.'); + if (p != NULL) + strcpy(hostname, ++p); } (void)printf("%s\n", hostname); } @@ -100,6 +108,6 @@ static void usage(void) { - (void)fprintf(stderr, "usage: hostname [-fs] [name-of-host]\n"); + (void)fprintf(stderr, "usage: hostname [-f] [s|d] [name-of-host]\n"); exit(1); } From owner-svn-src-all@freebsd.org Tue Nov 8 12:15:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 002F0C3527F; Tue, 8 Nov 2016 12:15:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4F85CEA; Tue, 8 Nov 2016 12:15:58 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8CFw6D089649; Tue, 8 Nov 2016 12:15:58 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8CFvNc089640; Tue, 8 Nov 2016 12:15:57 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611081215.uA8CFvNc089640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 8 Nov 2016 12:15:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308444 - in head/sys/arm: allwinner allwinner/a10 broadcom/bcm2835 qemu ti X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 12:15:59 -0000 Author: andrew Date: Tue Nov 8 12:15:57 2016 New Revision: 308444 URL: https://svnweb.freebsd.org/changeset/base/308444 Log: Start to remove the old pre-INTRNG code from the arm platforms. These have all moved to use INTRNG. Reviewed by: manu, mmel Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D8469 Deleted: head/sys/arm/allwinner/a10_common.c head/sys/arm/broadcom/bcm2835/bcm2835_common.c head/sys/arm/broadcom/bcm2835/bcm2836.h head/sys/arm/qemu/virt_common.c head/sys/arm/ti/ti_common.c Modified: head/sys/arm/allwinner/a10/a10_intc.c head/sys/arm/allwinner/files.allwinner head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c head/sys/arm/broadcom/bcm2835/bcm2835_intr.c head/sys/arm/broadcom/bcm2835/bcm2836.c head/sys/arm/broadcom/bcm2835/bcm2836_mp.c head/sys/arm/broadcom/bcm2835/files.bcm283x head/sys/arm/qemu/files.qemu head/sys/arm/ti/aintc.c head/sys/arm/ti/files.ti head/sys/arm/ti/ti_gpio.c head/sys/arm/ti/ti_gpio.h Modified: head/sys/arm/allwinner/a10/a10_intc.c ============================================================================== --- head/sys/arm/allwinner/a10/a10_intc.c Tue Nov 8 11:36:33 2016 (r308443) +++ head/sys/arm/allwinner/a10/a10_intc.c Tue Nov 8 12:15:57 2016 (r308444) @@ -43,9 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef INTRNG #include -#endif #include #include @@ -54,9 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef INTRNG #include "pic_if.h" -#endif /** * Interrupt controller registers @@ -97,12 +93,10 @@ __FBSDID("$FreeBSD$"); #define SW_INT_ENABLE_REG(_b) (0x40 + ((_b) * 4)) #define SW_INT_MASK_REG(_b) (0x50 + ((_b) * 4)) -#ifdef INTRNG struct a10_intr_irqsrc { struct intr_irqsrc isrc; u_int irq; }; -#endif struct a10_aintc_softc { device_t sc_dev; @@ -110,9 +104,7 @@ struct a10_aintc_softc { bus_space_tag_t aintc_bst; bus_space_handle_t aintc_bsh; struct mtx mtx; -#ifdef INTRNG struct a10_intr_irqsrc isrcs[A10_INTR_MAX_NIRQS]; -#endif }; #define aintc_read_4(sc, reg) \ @@ -189,31 +181,6 @@ a10_pending_irq(struct a10_aintc_softc * return (-1); } -#ifndef INTRNG - -static struct a10_aintc_softc *a10_aintc_sc = NULL; - -int -arm_get_next_irq(int last_irq) -{ - return (a10_pending_irq(a10_aintc_sc)); -} - -void -arm_mask_irq(uintptr_t irq) -{ - a10_intr_mask(a10_aintc_sc, irq); -} - -void -arm_unmask_irq(uintptr_t irq) -{ - a10_intr_unmask(a10_aintc_sc, irq); - a10_intr_eoi(a10_aintc_sc, irq); -} - -#else /* INTRNG */ - static int a10_intr(void *arg) { @@ -340,8 +307,6 @@ a10_intr_post_filter(device_t dev, struc a10_intr_eoi(sc, irq); } -#endif /* INTRNG */ - static int a10_aintc_probe(device_t dev) { @@ -363,13 +328,6 @@ a10_aintc_attach(device_t dev) int i; sc->sc_dev = dev; -#ifndef INTRNG - if (a10_aintc_sc) - goto error; - - a10_aintc_sc = sc; -#endif - sc->aintc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (!sc->aintc_res) { @@ -393,12 +351,10 @@ a10_aintc_attach(device_t dev) /* config the external interrupt source type*/ aintc_write_4(sc, SW_INT_NMI_CTRL_REG, 0x00); -#ifdef INTRNG if (a10_intr_pic_attach(sc) != 0) { device_printf(dev, "could not attach PIC\n"); return (ENXIO); } -#endif return (0); @@ -411,7 +367,7 @@ error: static device_method_t a10_aintc_methods[] = { DEVMETHOD(device_probe, a10_aintc_probe), DEVMETHOD(device_attach, a10_aintc_attach), -#ifdef INTRNG + /* Interrupt controller interface */ DEVMETHOD(pic_disable_intr, a10_intr_disable_intr), DEVMETHOD(pic_enable_intr, a10_intr_enable_intr), @@ -419,7 +375,7 @@ static device_method_t a10_aintc_methods DEVMETHOD(pic_post_filter, a10_intr_post_filter), DEVMETHOD(pic_post_ithread, a10_intr_post_ithread), DEVMETHOD(pic_pre_ithread, a10_intr_pre_ithread), -#endif + { 0, 0 } }; Modified: head/sys/arm/allwinner/files.allwinner ============================================================================== --- head/sys/arm/allwinner/files.allwinner Tue Nov 8 11:36:33 2016 (r308443) +++ head/sys/arm/allwinner/files.allwinner Tue Nov 8 12:15:57 2016 (r308444) @@ -3,7 +3,6 @@ kern/kern_clocksource.c standard arm/allwinner/a10_ahci.c optional ahci arm/allwinner/a10_codec.c optional sound -arm/allwinner/a10_common.c standard arm/allwinner/a10_dmac.c standard arm/allwinner/a31_dmac.c standard arm/allwinner/a10_ehci.c optional ehci Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Tue Nov 8 11:36:33 2016 (r308443) +++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Tue Nov 8 12:15:57 2016 (r308444) @@ -53,9 +53,7 @@ __FBSDID("$FreeBSD$"); #include "gpio_if.h" -#ifdef INTRNG #include "pic_if.h" -#endif #ifdef DEBUG #define dprintf(fmt, args...) do { printf("%s(): ", __func__); \ @@ -68,15 +66,10 @@ __FBSDID("$FreeBSD$"); #define BCM_GPIO_PINS 54 #define BCM_GPIO_PINS_PER_BANK 32 -#ifdef INTRNG #define BCM_GPIO_DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN | GPIO_INTR_LEVEL_LOW | \ GPIO_INTR_LEVEL_HIGH | GPIO_INTR_EDGE_RISING | \ GPIO_INTR_EDGE_FALLING | GPIO_INTR_EDGE_BOTH) -#else -#define BCM_GPIO_DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ - GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN) -#endif static struct resource_spec bcm_gpio_res_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, @@ -90,14 +83,12 @@ struct bcm_gpio_sysctl { uint32_t pin; }; -#ifdef INTRNG struct bcm_gpio_irqsrc { struct intr_irqsrc bgi_isrc; uint32_t bgi_irq; uint32_t bgi_mode; uint32_t bgi_mask; }; -#endif struct bcm_gpio_softc { device_t sc_dev; @@ -111,16 +102,8 @@ struct bcm_gpio_softc { int sc_ro_npins; int sc_ro_pins[BCM_GPIO_PINS]; struct gpio_pin sc_gpio_pins[BCM_GPIO_PINS]; -#ifndef INTRNG - struct intr_event * sc_events[BCM_GPIO_PINS]; -#endif struct bcm_gpio_sysctl sc_sysctl[BCM_GPIO_PINS]; -#ifdef INTRNG struct bcm_gpio_irqsrc sc_isrcs[BCM_GPIO_PINS]; -#else - enum intr_trigger sc_irq_trigger[BCM_GPIO_PINS]; - enum intr_polarity sc_irq_polarity[BCM_GPIO_PINS]; -#endif }; enum bcm_gpio_pud { @@ -165,12 +148,10 @@ static struct ofw_compat_data compat_dat static struct bcm_gpio_softc *bcm_gpio_sc = NULL; -#ifdef INTRNG static int bcm_gpio_intr_bank0(void *arg); static int bcm_gpio_intr_bank1(void *arg); static int bcm_gpio_pic_attach(struct bcm_gpio_softc *sc); static int bcm_gpio_pic_detach(struct bcm_gpio_softc *sc); -#endif static int bcm_gpio_pin_is_ro(struct bcm_gpio_softc *sc, int pin) @@ -703,42 +684,6 @@ bcm_gpio_get_reserved_pins(struct bcm_gp return (0); } -#ifndef INTRNG -static int -bcm_gpio_intr(void *arg) -{ - int bank_last, irq; - struct bcm_gpio_softc *sc; - struct intr_event *event; - uint32_t bank, mask, reg; - - sc = (struct bcm_gpio_softc *)arg; - reg = 0; - bank_last = -1; - for (irq = 0; irq < BCM_GPIO_PINS; irq++) { - bank = BCM_GPIO_BANK(irq); - mask = BCM_GPIO_MASK(irq); - if (bank != bank_last) { - reg = BCM_GPIO_READ(sc, BCM_GPIO_GPEDS(bank)); - bank_last = bank; - } - if (reg & mask) { - event = sc->sc_events[irq]; - if (event != NULL && !TAILQ_EMPTY(&event->ie_handlers)) - intr_event_handle(event, NULL); - else { - device_printf(sc->sc_dev, "Stray IRQ %d\n", - irq); - } - /* Clear the Status bit by writing '1' to it. */ - BCM_GPIO_WRITE(sc, BCM_GPIO_GPEDS(bank), mask); - } - } - - return (FILTER_HANDLED); -} -#endif - static int bcm_gpio_probe(device_t dev) { @@ -753,7 +698,6 @@ bcm_gpio_probe(device_t dev) return (BUS_PROBE_DEFAULT); } -#ifdef INTRNG static int bcm_gpio_intr_attach(device_t dev) { @@ -795,41 +739,6 @@ bcm_gpio_intr_detach(device_t dev) bcm_gpio_pic_detach(sc); } -#else -static int -bcm_gpio_intr_attach(device_t dev) -{ - struct bcm_gpio_softc *sc; - int i; - - sc = device_get_softc(dev); - for (i = 0; i < BCM_GPIO_IRQS; i++) { - if (bus_setup_intr(dev, sc->sc_res[i + 1], - INTR_TYPE_MISC | INTR_MPSAFE, bcm_gpio_intr, - NULL, sc, &sc->sc_intrhand[i]) != 0) { - return (-1); - } - } - - return (0); -} - -static void -bcm_gpio_intr_detach(device_t dev) -{ - struct bcm_gpio_softc *sc; - int i; - - sc = device_get_softc(dev); - for (i = 0; i < BCM_GPIO_IRQS; i++) { - if (sc->sc_intrhand[i]) { - bus_teardown_intr(dev, sc->sc_res[i + 1], - sc->sc_intrhand[i]); - } - } -} -#endif - static int bcm_gpio_attach(device_t dev) { @@ -874,11 +783,6 @@ bcm_gpio_attach(device_t dev) sc->sc_gpio_pins[i].gp_pin = j; sc->sc_gpio_pins[i].gp_caps = BCM_GPIO_DEFAULT_CAPS; sc->sc_gpio_pins[i].gp_flags = bcm_gpio_func_flag(func); -#ifndef INTRNG - /* The default is active-low interrupts. */ - sc->sc_irq_trigger[i] = INTR_TRIGGER_LEVEL; - sc->sc_irq_polarity[i] = INTR_POLARITY_LOW; -#endif i++; } sc->sc_gpio_npins = i; @@ -904,7 +808,6 @@ bcm_gpio_detach(device_t dev) return (EBUSY); } -#ifdef INTRNG static inline void bcm_gpio_modify(struct bcm_gpio_softc *sc, uint32_t reg, uint32_t mask, bool set_bits) @@ -1275,179 +1178,6 @@ bcm_gpio_pic_teardown_intr(device_t dev, return (0); } -#else -static uint32_t -bcm_gpio_intr_reg(struct bcm_gpio_softc *sc, unsigned int irq, uint32_t bank) -{ - - if (irq > BCM_GPIO_PINS) - return (0); - if (sc->sc_irq_trigger[irq] == INTR_TRIGGER_LEVEL) { - if (sc->sc_irq_polarity[irq] == INTR_POLARITY_LOW) - return (BCM_GPIO_GPLEN(bank)); - else if (sc->sc_irq_polarity[irq] == INTR_POLARITY_HIGH) - return (BCM_GPIO_GPHEN(bank)); - } else if (sc->sc_irq_trigger[irq] == INTR_TRIGGER_EDGE) { - if (sc->sc_irq_polarity[irq] == INTR_POLARITY_LOW) - return (BCM_GPIO_GPFEN(bank)); - else if (sc->sc_irq_polarity[irq] == INTR_POLARITY_HIGH) - return (BCM_GPIO_GPREN(bank)); - } - - return (0); -} - -static void -bcm_gpio_mask_irq(void *source) -{ - uint32_t bank, mask, reg; - unsigned int irq; - - irq = (unsigned int)source; - if (irq > BCM_GPIO_PINS) - return; - if (bcm_gpio_pin_is_ro(bcm_gpio_sc, irq)) - return; - bank = BCM_GPIO_BANK(irq); - mask = BCM_GPIO_MASK(irq); - BCM_GPIO_LOCK(bcm_gpio_sc); - reg = bcm_gpio_intr_reg(bcm_gpio_sc, irq, bank); - if (reg != 0) - BCM_GPIO_CLEAR_BITS(bcm_gpio_sc, reg, mask); - BCM_GPIO_UNLOCK(bcm_gpio_sc); -} - -static void -bcm_gpio_unmask_irq(void *source) -{ - uint32_t bank, mask, reg; - unsigned int irq; - - irq = (unsigned int)source; - if (irq > BCM_GPIO_PINS) - return; - if (bcm_gpio_pin_is_ro(bcm_gpio_sc, irq)) - return; - bank = BCM_GPIO_BANK(irq); - mask = BCM_GPIO_MASK(irq); - BCM_GPIO_LOCK(bcm_gpio_sc); - reg = bcm_gpio_intr_reg(bcm_gpio_sc, irq, bank); - if (reg != 0) - BCM_GPIO_SET_BITS(bcm_gpio_sc, reg, mask); - BCM_GPIO_UNLOCK(bcm_gpio_sc); -} - -static int -bcm_gpio_activate_resource(device_t bus, device_t child, int type, int rid, - struct resource *res) -{ - int pin; - - if (type != SYS_RES_IRQ) - return (ENXIO); - /* Unmask the interrupt. */ - pin = rman_get_start(res); - bcm_gpio_unmask_irq((void *)pin); - - return (0); -} - -static int -bcm_gpio_deactivate_resource(device_t bus, device_t child, int type, int rid, - struct resource *res) -{ - int pin; - - if (type != SYS_RES_IRQ) - return (ENXIO); - /* Mask the interrupt. */ - pin = rman_get_start(res); - bcm_gpio_mask_irq((void *)pin); - - return (0); -} - -static int -bcm_gpio_config_intr(device_t dev, int irq, enum intr_trigger trig, - enum intr_polarity pol) -{ - int bank; - struct bcm_gpio_softc *sc; - uint32_t mask, oldreg, reg; - - if (irq > BCM_GPIO_PINS) - return (EINVAL); - /* There is no standard trigger or polarity. */ - if (trig == INTR_TRIGGER_CONFORM || pol == INTR_POLARITY_CONFORM) - return (EINVAL); - sc = device_get_softc(dev); - if (bcm_gpio_pin_is_ro(sc, irq)) - return (EINVAL); - bank = BCM_GPIO_BANK(irq); - mask = BCM_GPIO_MASK(irq); - BCM_GPIO_LOCK(sc); - oldreg = bcm_gpio_intr_reg(sc, irq, bank); - sc->sc_irq_trigger[irq] = trig; - sc->sc_irq_polarity[irq] = pol; - reg = bcm_gpio_intr_reg(sc, irq, bank); - if (reg != 0) - BCM_GPIO_SET_BITS(sc, reg, mask); - if (reg != oldreg && oldreg != 0) - BCM_GPIO_CLEAR_BITS(sc, oldreg, mask); - BCM_GPIO_UNLOCK(sc); - - return (0); -} - -static int -bcm_gpio_setup_intr(device_t bus, device_t child, struct resource *ires, - int flags, driver_filter_t *filt, driver_intr_t *handler, - void *arg, void **cookiep) -{ - struct bcm_gpio_softc *sc; - struct intr_event *event; - int pin, error; - - sc = device_get_softc(bus); - pin = rman_get_start(ires); - if (pin > BCM_GPIO_PINS) - panic("%s: bad pin %d", __func__, pin); - event = sc->sc_events[pin]; - if (event == NULL) { - error = intr_event_create(&event, (void *)pin, 0, pin, - bcm_gpio_mask_irq, bcm_gpio_unmask_irq, NULL, NULL, - "gpio%d pin%d:", device_get_unit(bus), pin); - if (error != 0) - return (error); - sc->sc_events[pin] = event; - } - intr_event_add_handler(event, device_get_nameunit(child), filt, - handler, arg, intr_priority(flags), flags, cookiep); - - return (0); -} - -static int -bcm_gpio_teardown_intr(device_t dev, device_t child, struct resource *ires, - void *cookie) -{ - struct bcm_gpio_softc *sc; - int pin, err; - - sc = device_get_softc(dev); - pin = rman_get_start(ires); - if (pin > BCM_GPIO_PINS) - panic("%s: bad pin %d", __func__, pin); - if (sc->sc_events[pin] == NULL) - panic("Trying to teardown unoccupied IRQ"); - err = intr_event_remove_handler(cookie); - if (!err) - sc->sc_events[pin] = NULL; - - return (err); -} -#endif - static phandle_t bcm_gpio_get_node(device_t bus, device_t dev) { @@ -1473,7 +1203,6 @@ static device_method_t bcm_gpio_methods[ DEVMETHOD(gpio_pin_set, bcm_gpio_pin_set), DEVMETHOD(gpio_pin_toggle, bcm_gpio_pin_toggle), -#ifdef INTRNG /* Interrupt controller interface */ DEVMETHOD(pic_disable_intr, bcm_gpio_pic_disable_intr), DEVMETHOD(pic_enable_intr, bcm_gpio_pic_enable_intr), @@ -1483,14 +1212,7 @@ static device_method_t bcm_gpio_methods[ DEVMETHOD(pic_pre_ithread, bcm_gpio_pic_pre_ithread), DEVMETHOD(pic_setup_intr, bcm_gpio_pic_setup_intr), DEVMETHOD(pic_teardown_intr, bcm_gpio_pic_teardown_intr), -#else - /* Bus interface */ - DEVMETHOD(bus_activate_resource, bcm_gpio_activate_resource), - DEVMETHOD(bus_deactivate_resource, bcm_gpio_deactivate_resource), - DEVMETHOD(bus_config_intr, bcm_gpio_config_intr), - DEVMETHOD(bus_setup_intr, bcm_gpio_setup_intr), - DEVMETHOD(bus_teardown_intr, bcm_gpio_teardown_intr), -#endif + /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, bcm_gpio_get_node), Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_intr.c Tue Nov 8 11:36:33 2016 (r308443) +++ head/sys/arm/broadcom/bcm2835/bcm2835_intr.c Tue Nov 8 12:15:57 2016 (r308444) @@ -48,13 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef SOC_BCM2836 -#include -#endif - -#ifdef INTRNG #include "pic_if.h" -#endif #define INTC_PENDING_BASIC 0x00 #define INTC_PENDING_BANK1 0x04 @@ -105,17 +99,10 @@ __FBSDID("$FreeBSD$"); #define BANK1_END (BANK1_START + 32 - 1) #define BANK2_START (BANK1_START + 32) #define BANK2_END (BANK2_START + 32 - 1) -#ifndef INTRNG -#define BANK3_START (BANK2_START + 32) -#define BANK3_END (BANK3_START + 32 - 1) -#endif #define IS_IRQ_BASIC(n) (((n) >= 0) && ((n) < BANK1_START)) #define IS_IRQ_BANK1(n) (((n) >= BANK1_START) && ((n) <= BANK1_END)) #define IS_IRQ_BANK2(n) (((n) >= BANK2_START) && ((n) <= BANK2_END)) -#ifndef INTRNG -#define ID_IRQ_BCM2836(n) (((n) >= BANK3_START) && ((n) <= BANK3_END)) -#endif #define IRQ_BANK1(n) ((n) - BANK1_START) #define IRQ_BANK2(n) ((n) - BANK2_START) @@ -125,7 +112,6 @@ __FBSDID("$FreeBSD$"); #define dprintf(fmt, args...) #endif -#ifdef INTRNG #define BCM_INTC_NIRQS 72 /* 8 + 32 + 32 */ struct bcm_intc_irqsrc { @@ -135,18 +121,15 @@ struct bcm_intc_irqsrc { uint16_t bii_enable_reg; uint32_t bii_mask; }; -#endif struct bcm_intc_softc { device_t sc_dev; struct resource * intc_res; bus_space_tag_t intc_bst; bus_space_handle_t intc_bsh; -#ifdef INTRNG struct resource * intc_irq_res; void * intc_irq_hdl; struct bcm_intc_irqsrc intc_isrcs[BCM_INTC_NIRQS]; -#endif }; static struct bcm_intc_softc *bcm_intc_sc = NULL; @@ -156,7 +139,6 @@ static struct bcm_intc_softc *bcm_intc_s #define intc_write_4(_sc, reg, val) \ bus_space_write_4((_sc)->intc_bst, (_sc)->intc_bsh, (reg), (val)) -#ifdef INTRNG static inline void bcm_intc_isrc_mask(struct bcm_intc_softc *sc, struct bcm_intc_irqsrc *bii) { @@ -375,7 +357,6 @@ bcm_intc_pic_register(struct bcm_intc_so return (0); } -#endif static int bcm_intc_probe(device_t dev) @@ -396,9 +377,7 @@ bcm_intc_attach(device_t dev) { struct bcm_intc_softc *sc = device_get_softc(dev); int rid = 0; -#ifdef INTRNG intptr_t xref; -#endif sc->sc_dev = dev; if (bcm_intc_sc) @@ -410,7 +389,6 @@ bcm_intc_attach(device_t dev) return (ENXIO); } -#ifdef INTRNG xref = OF_xref_from_node(ofw_bus_get_node(dev)); if (bcm_intc_pic_register(sc, xref) != 0) { bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->intc_res); @@ -435,7 +413,6 @@ bcm_intc_attach(device_t dev) return (ENXIO); } } -#endif sc->intc_bst = rman_get_bustag(sc->intc_res); sc->intc_bsh = rman_get_bushandle(sc->intc_res); @@ -448,14 +425,12 @@ static device_method_t bcm_intc_methods[ DEVMETHOD(device_probe, bcm_intc_probe), DEVMETHOD(device_attach, bcm_intc_attach), -#ifdef INTRNG DEVMETHOD(pic_disable_intr, bcm_intc_disable_intr), DEVMETHOD(pic_enable_intr, bcm_intc_enable_intr), DEVMETHOD(pic_map_intr, bcm_intc_map_intr), DEVMETHOD(pic_post_filter, bcm_intc_post_filter), DEVMETHOD(pic_post_ithread, bcm_intc_post_ithread), DEVMETHOD(pic_pre_ithread, bcm_intc_pre_ithread), -#endif { 0, 0 } }; @@ -470,105 +445,3 @@ static devclass_t bcm_intc_devclass; EARLY_DRIVER_MODULE(intc, simplebus, bcm_intc_driver, bcm_intc_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); - -#ifndef INTRNG -int -arm_get_next_irq(int last_irq) -{ - struct bcm_intc_softc *sc = bcm_intc_sc; - uint32_t pending; - int32_t irq = last_irq + 1; -#ifdef SOC_BCM2836 - int ret; -#endif - - /* Sanity check */ - if (irq < 0) - irq = 0; - -#ifdef SOC_BCM2836 - if ((ret = bcm2836_get_next_irq(irq)) < 0) - return (-1); - if (ret != BCM2836_GPU_IRQ) - return (ret + BANK3_START); -#endif - - /* TODO: should we mask last_irq? */ - if (irq < BANK1_START) { - pending = intc_read_4(sc, INTC_PENDING_BASIC); - if ((pending & 0xFF) == 0) { - irq = BANK1_START; /* skip to next bank */ - } else do { - if (pending & (1 << irq)) - return irq; - irq++; - } while (irq < BANK1_START); - } - if (irq < BANK2_START) { - pending = intc_read_4(sc, INTC_PENDING_BANK1); - if (pending == 0) { - irq = BANK2_START; /* skip to next bank */ - } else do { - if (pending & (1 << IRQ_BANK1(irq))) - return irq; - irq++; - } while (irq < BANK2_START); - } - if (irq < BANK3_START) { - pending = intc_read_4(sc, INTC_PENDING_BANK2); - if (pending != 0) do { - if (pending & (1 << IRQ_BANK2(irq))) - return irq; - irq++; - } while (irq < BANK3_START); - } - return (-1); -} - -void -arm_mask_irq(uintptr_t nb) -{ - struct bcm_intc_softc *sc = bcm_intc_sc; - dprintf("%s: %d\n", __func__, nb); - - if (IS_IRQ_BASIC(nb)) - intc_write_4(sc, INTC_DISABLE_BASIC, (1 << nb)); - else if (IS_IRQ_BANK1(nb)) - intc_write_4(sc, INTC_DISABLE_BANK1, (1 << IRQ_BANK1(nb))); - else if (IS_IRQ_BANK2(nb)) - intc_write_4(sc, INTC_DISABLE_BANK2, (1 << IRQ_BANK2(nb))); -#ifdef SOC_BCM2836 - else if (ID_IRQ_BCM2836(nb)) - bcm2836_mask_irq(nb - BANK3_START); -#endif - else - printf("arm_mask_irq: Invalid IRQ number: %d\n", nb); -} - -void -arm_unmask_irq(uintptr_t nb) -{ - struct bcm_intc_softc *sc = bcm_intc_sc; - dprintf("%s: %d\n", __func__, nb); - - if (IS_IRQ_BASIC(nb)) - intc_write_4(sc, INTC_ENABLE_BASIC, (1 << nb)); - else if (IS_IRQ_BANK1(nb)) - intc_write_4(sc, INTC_ENABLE_BANK1, (1 << IRQ_BANK1(nb))); - else if (IS_IRQ_BANK2(nb)) - intc_write_4(sc, INTC_ENABLE_BANK2, (1 << IRQ_BANK2(nb))); -#ifdef SOC_BCM2836 - else if (ID_IRQ_BCM2836(nb)) - bcm2836_unmask_irq(nb - BANK3_START); -#endif - else - printf("arm_mask_irq: Invalid IRQ number: %d\n", nb); -} - -#ifdef SMP -void -intr_pic_init_secondary(void) -{ -} -#endif -#endif Modified: head/sys/arm/broadcom/bcm2835/bcm2836.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2836.c Tue Nov 8 11:36:33 2016 (r308443) +++ head/sys/arm/broadcom/bcm2835/bcm2836.c Tue Nov 8 12:15:57 2016 (r308444) @@ -53,26 +53,8 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef INTRNG #include "pic_if.h" -#else -#include - -#define ARM_LOCAL_BASE 0x40000000 -#define ARM_LOCAL_SIZE 0x00001000 -#define ARM_LOCAL_CONTROL 0x00 -#define ARM_LOCAL_PRESCALER 0x08 -#define PRESCALER_19_2 0x80000000 /* 19.2 MHz */ -#define ARM_LOCAL_INT_TIMER(n) (0x40 + (n) * 4) -#define ARM_LOCAL_INT_MAILBOX(n) (0x50 + (n) * 4) -#define ARM_LOCAL_INT_PENDING(n) (0x60 + (n) * 4) -#define INT_PENDING_MASK 0x011f -#define MAILBOX0_IRQ 4 -#define MAILBOX0_IRQEN (1 << 0) -#endif - -#ifdef INTRNG #define BCM_LINTC_CONTROL_REG 0x00 #define BCM_LINTC_PRESCALER_REG 0x08 #define BCM_LINTC_GPU_ROUTING_REG 0x0c @@ -751,163 +733,3 @@ static devclass_t bcm_lintc_devclass; EARLY_DRIVER_MODULE(local_intc, simplebus, bcm_lintc_driver, bcm_lintc_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); -#else -/* - * A driver for features of the bcm2836. - */ - -struct bcm2836_softc { - device_t sc_dev; - struct resource *sc_mem; -}; - -static device_identify_t bcm2836_identify; -static device_probe_t bcm2836_probe; -static device_attach_t bcm2836_attach; - -struct bcm2836_softc *softc; - -static void -bcm2836_identify(driver_t *driver, device_t parent) -{ - - if (BUS_ADD_CHILD(parent, 0, "bcm2836", -1) == NULL) - device_printf(parent, "add child failed\n"); -} - -static int -bcm2836_probe(device_t dev) -{ - - if (softc != NULL) - return (ENXIO); - - device_set_desc(dev, "Broadcom bcm2836"); - - return (BUS_PROBE_DEFAULT); -} - -static int -bcm2836_attach(device_t dev) -{ - int i, rid; - - softc = device_get_softc(dev); - softc->sc_dev = dev; - - rid = 0; - softc->sc_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - ARM_LOCAL_BASE, ARM_LOCAL_BASE + ARM_LOCAL_SIZE, ARM_LOCAL_SIZE, - RF_ACTIVE); - if (softc->sc_mem == NULL) { - device_printf(dev, "could not allocate memory resource\n"); - return (ENXIO); - } - - bus_write_4(softc->sc_mem, ARM_LOCAL_CONTROL, 0); - bus_write_4(softc->sc_mem, ARM_LOCAL_PRESCALER, PRESCALER_19_2); - - for (i = 0; i < 4; i++) - bus_write_4(softc->sc_mem, ARM_LOCAL_INT_TIMER(i), 0); - - for (i = 0; i < 4; i++) - bus_write_4(softc->sc_mem, ARM_LOCAL_INT_MAILBOX(i), 1); - - return (0); -} - -int -bcm2836_get_next_irq(int last_irq) -{ - uint32_t reg; - int cpu; - int irq; - - cpu = PCPU_GET(cpuid); - - reg = bus_read_4(softc->sc_mem, ARM_LOCAL_INT_PENDING(cpu)); - reg &= INT_PENDING_MASK; - if (reg == 0) - return (-1); - - irq = ffs(reg) - 1; - - return (irq); -} - -void -bcm2836_mask_irq(uintptr_t irq) -{ - uint32_t reg; -#ifdef SMP - int cpu; -#endif - int i; - - if (irq < MAILBOX0_IRQ) { - for (i = 0; i < 4; i++) { - reg = bus_read_4(softc->sc_mem, - ARM_LOCAL_INT_TIMER(i)); - reg &= ~(1 << irq); - bus_write_4(softc->sc_mem, - ARM_LOCAL_INT_TIMER(i), reg); - } -#ifdef SMP - } else if (irq == MAILBOX0_IRQ) { - /* Mailbox 0 for IPI */ - cpu = PCPU_GET(cpuid); - reg = bus_read_4(softc->sc_mem, ARM_LOCAL_INT_MAILBOX(cpu)); - reg &= ~MAILBOX0_IRQEN; - bus_write_4(softc->sc_mem, ARM_LOCAL_INT_MAILBOX(cpu), reg); -#endif - } -} - -void -bcm2836_unmask_irq(uintptr_t irq) -{ - uint32_t reg; -#ifdef SMP - int cpu; -#endif - int i; - - if (irq < MAILBOX0_IRQ) { - for (i = 0; i < 4; i++) { - reg = bus_read_4(softc->sc_mem, - ARM_LOCAL_INT_TIMER(i)); - reg |= (1 << irq); - bus_write_4(softc->sc_mem, - ARM_LOCAL_INT_TIMER(i), reg); - } -#ifdef SMP - } else if (irq == MAILBOX0_IRQ) { - /* Mailbox 0 for IPI */ - cpu = PCPU_GET(cpuid); - reg = bus_read_4(softc->sc_mem, ARM_LOCAL_INT_MAILBOX(cpu)); - reg |= MAILBOX0_IRQEN; - bus_write_4(softc->sc_mem, ARM_LOCAL_INT_MAILBOX(cpu), reg); -#endif - } -} - -static device_method_t bcm2836_methods[] = { - /* Device interface */ - DEVMETHOD(device_identify, bcm2836_identify), - DEVMETHOD(device_probe, bcm2836_probe), - DEVMETHOD(device_attach, bcm2836_attach), - - DEVMETHOD_END -}; - -static devclass_t bcm2836_devclass; - -static driver_t bcm2836_driver = { - "bcm2836", - bcm2836_methods, - sizeof(struct bcm2836_softc), -}; - -EARLY_DRIVER_MODULE(bcm2836, nexus, bcm2836_driver, bcm2836_devclass, 0, 0, - BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); -#endif Modified: head/sys/arm/broadcom/bcm2835/bcm2836_mp.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2836_mp.c Tue Nov 8 11:36:33 2016 (r308443) +++ head/sys/arm/broadcom/bcm2835/bcm2836_mp.c Tue Nov 8 12:15:57 2016 (r308444) @@ -142,43 +142,3 @@ bcm2836_mp_start_ap(platform_t plat) CPU_SET(i, &all_cpus); } } - -#ifndef INTRNG -void -pic_ipi_send(cpuset_t cpus, u_int ipi) -{ - int i; - - dsb(); - for (i = 0; i < mp_ncpus; i++) { - if (CPU_ISSET(i, &cpus)) - BSWR4(MBOX0SET_CORE(i), 1 << ipi); - } - wmb(); -} - -int -pic_ipi_read(int i) -{ - uint32_t val; - int cpu, ipi; - - cpu = PCPU_GET(cpuid); - dsb(); - if (i != -1) { - val = BSRD4(MBOX0CLR_CORE(cpu)); - if (val == 0) - return (0); - ipi = ffs(val) - 1; - BSWR4(MBOX0CLR_CORE(cpu), 1 << ipi); - dsb(); - return (ipi); - } - return (0x3ff); -} - -void -pic_ipi_clear(int ipi) -{ -} -#endif Modified: head/sys/arm/broadcom/bcm2835/files.bcm283x ============================================================================== --- head/sys/arm/broadcom/bcm2835/files.bcm283x Tue Nov 8 11:36:33 2016 (r308443) +++ head/sys/arm/broadcom/bcm2835/files.bcm283x Tue Nov 8 12:15:57 2016 (r308444) @@ -1,7 +1,6 @@ # $FreeBSD$ arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Nov 8 17:02:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BBEFC36128; Tue, 8 Nov 2016 17:02:38 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f65.google.com (mail-it0-f65.google.com [209.85.214.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D8BE5168; Tue, 8 Nov 2016 17:02:37 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f65.google.com with SMTP id q124so17647364itd.1; Tue, 08 Nov 2016 09:02:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=1h6CyAP0NZAbZxKbamt51kO99EwBgSACHhFh82A9t2c=; b=Da53ZpSGqlbNTF+tvLCS1CRT7iI9zCOvtPx/HvAAvca+geQCQVfanipaZmyGuRAW1F ftztNozNlhTHFDx/TZOZ2ItBlWssjRVXzdXwJfNYmepnrKcKnjS+S6c8B2JRmsBujCeN nbVtyD8lSqmgcr+pW6+P2RbcVFh0FBc6D4BwaN6tqMy4UOL5IR4EilPra4YNb7lA2GYC xBEfdYrdC6Tf2NOeaOD/PjdIAGN8U8dlrVuFsxI0N+I9wvZeTxz7fSkdbSsjGYxbcUXC xdtSGVZtM1uCdrrfGVaD1puVh2aspj4+7I48Xn/53qwLV7u1+5+YE5r8hix106qtXc/u ITXw== X-Gm-Message-State: ABUngvd1F0+1fC8Orr767dxU+Smt/A4XFTisglhThd8IKwsOb0uR4R4jmjLb0qD94wW2Zg== X-Received: by 10.36.53.138 with SMTP id k132mr11501418ita.28.1478623859941; Tue, 08 Nov 2016 08:50:59 -0800 (PST) Received: from mail-it0-f48.google.com (mail-it0-f48.google.com. [209.85.214.48]) by smtp.gmail.com with ESMTPSA id c101sm12360077ioj.25.2016.11.08.08.50.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Nov 2016 08:50:59 -0800 (PST) Received: by mail-it0-f48.google.com with SMTP id q124so109984669itd.1; Tue, 08 Nov 2016 08:50:59 -0800 (PST) X-Received: by 10.107.16.170 with SMTP id 42mr13158183ioq.93.1478623856804; Tue, 08 Nov 2016 08:50:56 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.220.199 with HTTP; Tue, 8 Nov 2016 08:50:56 -0800 (PST) In-Reply-To: <201611010141.uA11fOPS086073@repo.freebsd.org> References: <201611010141.uA11fOPS086073@repo.freebsd.org> From: Conrad Meyer Date: Tue, 8 Nov 2016 08:50:56 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r308160 - in head: etc etc/mtree usr.sbin/syslogd To: Baptiste Daroussin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 17:02:38 -0000 On Mon, Oct 31, 2016 at 6:41 PM, Baptiste Daroussin wrote: > Author: bapt > Date: Tue Nov 1 01:41:24 2016 > New Revision: 308160 > URL: https://svnweb.freebsd.org/changeset/base/308160 > > Log: > syslogd(8): add an 'include' keyword > > All the '.conf' files not beginning with a '.' contained int he directory > following the keyword will be included. > > This keyword can only be used in the first level configuration files. > > Modify the default syslogd.conf to 'include' /etc/syslog.d and > /usr/local/etc/syslog.d > > It simplify a lot handling of syslog from automation tools. This breaks some paths in init(), as pointed out by Coverity (CID 1365665). See inline below. >... > Modified: head/usr.sbin/syslogd/syslogd.c > ============================================================================== > --- head/usr.sbin/syslogd/syslogd.c Tue Nov 1 01:19:48 2016 (r308159) > +++ head/usr.sbin/syslogd/syslogd.c Tue Nov 1 01:41:24 2016 (r308160) > ... > @@ -1601,6 +1604,157 @@ die(int signo) > ... > /* > * INIT -- Initialize syslogd from configuration table > */ > @@ -1611,9 +1765,6 @@ init(int signo) > FILE *cf; > struct filed *f, *next, **nextp; > char *p; > - char cline[LINE_MAX]; > - char prog[LINE_MAX]; > - char host[MAXHOSTNAMELEN]; > char oldLocalHostName[MAXHOSTNAMELEN]; > char hostMsg[2*MAXHOSTNAMELEN+40]; > char bootfileMsg[LINE_MAX]; > @@ -1684,7 +1835,6 @@ init(int signo) > free((char *)f); > } > Files = NULL; > - nextp = &Files; This line leaves nextp uninitialized in init(). > > /* open the configuration file */ > if ((cf = fopen(ConfFile, "r")) == NULL) { Nextp is used in init() between these two hunks: 1838 1839 /* open the configuration file */ 1840 if ((cf = fopen(ConfFile, "r")) == NULL) { 1841 dprintf("cannot open %s\n", ConfFile); 1842 *nextp = (struct filed *)calloc(1, sizeof(*f)); <<<< now bogus 1843 if (*nextp == NULL) { 1844 logerror("calloc"); 1845 exit(1); 1846 } 1847 cfline("*.ERR\t/dev/console", *nextp, "*", "*"); 1848 (*nextp)->f_next = (struct filed *)calloc(1, sizeof(*f)); 1849 if ((*nextp)->f_next == NULL) { 1850 logerror("calloc"); 1851 exit(1); 1852 } 1853 cfline("*.PANIC\t*", (*nextp)->f_next, "*", "*"); 1854 Initialized = 1; 1855 return; 1856 } > @@ -1705,83 +1855,7 @@ init(int signo) > ... Thanks, Conrad From owner-svn-src-all@freebsd.org Tue Nov 8 17:36:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64DE3C36D89; Tue, 8 Nov 2016 17:36:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A1CCAB1; Tue, 8 Nov 2016 17:36:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8HaJEI016857; Tue, 8 Nov 2016 17:36:19 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8HaJew016856; Tue, 8 Nov 2016 17:36:19 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201611081736.uA8HaJew016856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 8 Nov 2016 17:36:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308445 - head/lib/libgcc_s X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 17:36:20 -0000 Author: emaste Date: Tue Nov 8 17:36:19 2016 New Revision: 308445 URL: https://svnweb.freebsd.org/changeset/base/308445 Log: add missing i386 symbols libgcc_s symbol version map After r308294 they were missing on i386 (and previously were exported only accidentally). Reported by: antoine Modified: head/lib/libgcc_s/Version.map Modified: head/lib/libgcc_s/Version.map ============================================================================== --- head/lib/libgcc_s/Version.map Tue Nov 8 12:15:57 2016 (r308444) +++ head/lib/libgcc_s/Version.map Tue Nov 8 17:36:19 2016 (r308445) @@ -8,9 +8,12 @@ global: __absvsi2; __addvdi3; __addvsi3; + __ashldi3; __ashlti3; + __ashrdi3; __ashrti3; __clear_cache; + __cmpdi2; __cmpti2; __deregister_frame; __deregister_frame_info; @@ -19,23 +22,36 @@ global: __divti3; __ffsdi2; __ffsti2; + __fixdfdi; __fixdfti; + __fixsfdi; __fixsfti; __fixunsdfdi; + __fixunsdfsi; __fixunsdfti; __fixunssfdi; + __fixunssfsi; __fixunssfti; __fixunsxfdi; + __fixunsxfsi; __fixunsxfti; + __fixxfdi; __fixxfti; + __floatdidf; + __floatdisf; + __floatdixf; __floattidf; __floattisf; __floattixf; + __lshrdi3; __lshrti3; + __moddi3; __modti3; + __muldi3; __mulvdi3; __mulvsi3; __multi3; + __negdi2; __negti2; __negvdi2; __negvsi2; @@ -47,10 +63,13 @@ global: __register_frame_table; __subvdi3; __subvsi3; + __ucmpdi2; __ucmpti2; __udivdi3; + __udivmoddi4; __udivmodti4; __udivti3; + __umoddi3; __umodti3; _Unwind_DeleteException; _Unwind_Find_FDE; @@ -82,12 +101,16 @@ GCC_3.3.1 { GCC_3.4 { __clzdi2; + __clzsi2; __clzti2; __ctzdi2; + __ctzsi2; __ctzti2; __paritydi2; + __paritysi2; __parityti2; __popcountdi2; + __popcountsi2; __popcountti2; } GCC_3.3.1; @@ -116,6 +139,9 @@ GCC_4.0.0 { } GCC_3.4.4; GCC_4.2.0 { + __floatundidf; + __floatundisf; + __floatundixf; __floatuntidf; __floatuntisf; __floatuntixf; From owner-svn-src-all@freebsd.org Tue Nov 8 19:33:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BEEAC3635A; Tue, 8 Nov 2016 19:33:25 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: from mail-qk0-x22f.google.com (mail-qk0-x22f.google.com [IPv6:2607:f8b0:400d:c09::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4362DA6E; Tue, 8 Nov 2016 19:33:25 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: by mail-qk0-x22f.google.com with SMTP id q130so230096250qke.1; Tue, 08 Nov 2016 11:33:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=dP1BWtCruhfhS6yJpD514SR02rGWj6DKNg1QvgGfg4g=; b=EBavpZ1InN82X29MnZf7qvCKhSpZUpy9AUuVoLRRi6fqgEeGUOW9uqpfSxSMLmzzj/ 9MaN65cP7qQX3ZxKqG8VRswGlUZSES6rbAMLM+lSraekSuTMFl0W4hK9Bjbmgmx2OWkL dSeHKU8RyOqsRUZzA4KBF1yiH1XaLyVwSBEvLuzLxg5cnOFEhw+qxsJVtI5iynkyOEOv pWFGEW958BA/SPxLKCXcY7LhdL9e2nEVmn3o3gR80WfLYwLP6B2fjKKNchiayutG9Xqt 843/dXjmVayWMBpNAMRvUVdMf1YOJUy+/L9B3KoLqpdreFoIAy49/hbS34en5w2Ka42k CUXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=dP1BWtCruhfhS6yJpD514SR02rGWj6DKNg1QvgGfg4g=; b=FR8Hkmxd8ml1j4xP7i/NLIehrR2B/b18bh+yFLPGGbkKSb1JmLGHvi957mlgrrhNqj wANkJju2Jg3Y0OK9OMDMw7wCOIRdQXkUlb2YlPYGWzSNFSA1cfkdlYZUfJtWG3uBVwze cG2rMOK8j3kzFq7GuvErl/h3vycd93RPMndIHt65MZljS6BtfjyhSNyrQZEZN50WHZO4 tetAUWwG1GjR2oaTjOn/1BANJGte8TUc5AoLj3aYpWpK9gWFIxiLtfNVj4+vU6mLRHPP k8gTRE1vPhU+riwH1Dadd86jDCNPFNg2JbnoXbwwTMH/SScvFtCBk9APLajuvO7tf7B1 nlug== X-Gm-Message-State: ABUngvem659M82UwfiUgJrBCjJJFtifqcsUkMXztFVEEfme2ylDOnzKlageIZtuR/rq7dg== X-Received: by 10.55.104.20 with SMTP id d20mr16068404qkc.126.1478633604307; Tue, 08 Nov 2016 11:33:24 -0800 (PST) Received: from mbp-eth.home ([200.236.233.160]) by smtp.gmail.com with ESMTPSA id n67sm2824763qkf.28.2016.11.08.11.33.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Nov 2016 11:33:23 -0800 (PST) Sender: Renato Botelho From: Renato Botelho Message-Id: Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r308443 - head/bin/hostname Date: Tue, 8 Nov 2016 17:33:19 -0200 In-Reply-To: <201611081136.uA8BaXrs073937@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Marcelo Araujo References: <201611081136.uA8BaXrs073937@repo.freebsd.org> X-Mailer: Apple Mail (2.3251) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 19:33:25 -0000 > On 8 Nov 2016, at 09:36, Marcelo Araujo wrote: >=20 > Author: araujo > Date: Tue Nov 8 11:36:33 2016 > New Revision: 308443 > URL: https://svnweb.freebsd.org/changeset/base/308443 >=20 > Log: > Add -d flag that prints domain only. >=20 > PR: 212875 > Submitted by: Ben RUBSON > Reviewed by: pi >=20 > Modified: > head/bin/hostname/hostname.1 > head/bin/hostname/hostname.c >=20 > Modified: head/bin/hostname/hostname.1 > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/bin/hostname/hostname.1 Tue Nov 8 10:10:55 2016 = (r308442) > +++ head/bin/hostname/hostname.1 Tue Nov 8 11:36:33 2016 = (r308443) > @@ -29,7 +29,7 @@ > .\" @(#)hostname.1 8.2 (Berkeley) 4/28/95 > .\" $FreeBSD$ > .\" > -.Dd December 7, 2006 > +.Dd November 9, 2016 > .Dt HOSTNAME 1 > .Os > .Sh NAME > @@ -37,7 +37,8 @@ > .Nd set or print name of current host system > .Sh SYNOPSIS > .Nm > -.Op Fl fs > +.Op Fl f > +.Op Fl s|d > .Op Ar name-of-host > .Sh DESCRIPTION > The > @@ -62,6 +63,8 @@ This is the default behavior. > .It Fl s > Trim off any domain information from the printed > name. > +.It Fl d > +Only print domain information. > .El > .Sh SEE ALSO > .Xr gethostname 3 , >=20 > Modified: head/bin/hostname/hostname.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/bin/hostname/hostname.c Tue Nov 8 10:10:55 2016 = (r308442) > +++ head/bin/hostname/hostname.c Tue Nov 8 11:36:33 2016 = (r308443) > @@ -54,11 +54,12 @@ static void usage(void) __dead2; > int > main(int argc, char *argv[]) > { > - int ch, sflag; > + int ch, sflag, dflag; > char *p, hostname[MAXHOSTNAMELEN]; >=20 > sflag =3D 0; > - while ((ch =3D getopt(argc, argv, "fs")) !=3D -1) > + dflag =3D 0; > + while ((ch =3D getopt(argc, argv, "fsd")) !=3D -1) > switch (ch) { > case 'f': > /* > @@ -70,6 +71,9 @@ main(int argc, char *argv[]) > case 's': > sflag =3D 1; > break; > + case 'd': > + dflag =3D 1; > + break; > case '?': > default: > usage(); > @@ -77,7 +81,7 @@ main(int argc, char *argv[]) > argc -=3D optind; > argv +=3D optind; >=20 > - if (argc > 1) > + if (argc > 1 || (sflag && dflag)) > usage(); >=20 > if (*argv) { > @@ -90,6 +94,10 @@ main(int argc, char *argv[]) > p =3D strchr(hostname, '.'); > if (p !=3D NULL) > *p =3D '\0'; > + } else if (dflag) { > + p =3D strchr(hostname, '.'); > + if (p !=3D NULL) > + strcpy(hostname, ++p); > } > (void)printf("%s\n", hostname); > } > @@ -100,6 +108,6 @@ static void > usage(void) > { >=20 > - (void)fprintf(stderr, "usage: hostname [-fs] [name-of-host]\n"); > + (void)fprintf(stderr, "usage: hostname [-f] [s|d] = [name-of-host]\n"); It=E2=80=99s missing =E2=80=98-=E2=80=98 sign on [s|d] block, what makes = message a bit confused IMO. Maybe [-s|-d] would be more clear. -- Renato Botelho From owner-svn-src-all@freebsd.org Tue Nov 8 20:12:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50515C3719B; Tue, 8 Nov 2016 20:12:15 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11D7A5F7; Tue, 8 Nov 2016 20:12:14 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8KCEBl080035; Tue, 8 Nov 2016 20:12:14 GMT (envelope-from lidl@FreeBSD.org) Received: (from lidl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8KCDbo080031; Tue, 8 Nov 2016 20:12:13 GMT (envelope-from lidl@FreeBSD.org) Message-Id: <201611082012.uA8KCDbo080031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lidl set sender to lidl@FreeBSD.org using -f From: Kurt Lidl Date: Tue, 8 Nov 2016 20:12:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308446 - stable/11/libexec/ftpd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 20:12:15 -0000 Author: lidl Date: Tue Nov 8 20:12:13 2016 New Revision: 308446 URL: https://svnweb.freebsd.org/changeset/base/308446 Log: MFC r308175: Revisit blacklistd support in ftpd Enhance blacklistd support to not log anything by default, unless blacklistd support is enabled on the command line. Document new flag in man page, cleanup patches to be less intrusive in code. Sponsored by: The FreeBSD Foundation Modified: stable/11/libexec/ftpd/blacklist.c stable/11/libexec/ftpd/blacklist_client.h stable/11/libexec/ftpd/ftpd.8 stable/11/libexec/ftpd/ftpd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/ftpd/blacklist.c ============================================================================== --- stable/11/libexec/ftpd/blacklist.c Tue Nov 8 17:36:19 2016 (r308445) +++ stable/11/libexec/ftpd/blacklist.c Tue Nov 8 20:12:13 2016 (r308446) @@ -37,16 +37,20 @@ #include static struct blacklist *blstate; +extern int use_blacklist; void blacklist_init(void) { - blstate = blacklist_open(); + + if (use_blacklist) + blstate = blacklist_open(); } void blacklist_notify(int action, int fd, char *msg) { + if (blstate == NULL) return; (void)blacklist_r(blstate, action, fd, msg); Modified: stable/11/libexec/ftpd/blacklist_client.h ============================================================================== --- stable/11/libexec/ftpd/blacklist_client.h Tue Nov 8 17:36:19 2016 (r308445) +++ stable/11/libexec/ftpd/blacklist_client.h Tue Nov 8 20:12:13 2016 (r308446) @@ -28,5 +28,26 @@ /* $FreeBSD$ */ -void blacklist_notify(int, int, char *); +#ifndef BLACKLIST_CLIENT_H +#define BLACKLIST_CLIENT_H + +enum { + BLACKLIST_AUTH_OK = 0, + BLACKLIST_AUTH_FAIL +}; + +#ifdef USE_BLACKLIST void blacklist_init(void); +void blacklist_notify(int, int, char *); + +#define BLACKLIST_INIT() blacklist_init() +#define BLACKLIST_NOTIFY(x, y, z) blacklist_notify(x, y, z) + +#else + +#define BLACKLIST_INIT() +#define BLACKLIST_NOTIFY(x, y, z) + +#endif + +#endif /* BLACKLIST_CLIENT_H */ Modified: stable/11/libexec/ftpd/ftpd.8 ============================================================================== --- stable/11/libexec/ftpd/ftpd.8 Tue Nov 8 17:36:19 2016 (r308445) +++ stable/11/libexec/ftpd/ftpd.8 Tue Nov 8 20:12:13 2016 (r308446) @@ -36,7 +36,7 @@ .Nd Internet File Transfer Protocol server .Sh SYNOPSIS .Nm -.Op Fl 468ADdEhMmOoRrSUvW +.Op Fl 468ABDdEhMmOoRrSUvW .Op Fl l Op Fl l .Op Fl a Ar address .Op Fl P Ar port @@ -95,6 +95,14 @@ When .Fl D is specified, accept connections only on the specified .Ar address . +.It Fl B +With this option set, +.Nm +sends authentication success and failure messages to the +.Xr blacklistd 8 +daemon. If this option is not specified, no communcation with the +.Xr blacklistd 8 +daemon is attempted. .It Fl D With this option set, .Nm Modified: stable/11/libexec/ftpd/ftpd.c ============================================================================== --- stable/11/libexec/ftpd/ftpd.c Tue Nov 8 17:36:19 2016 (r308445) +++ stable/11/libexec/ftpd/ftpd.c Tue Nov 8 20:12:13 2016 (r308446) @@ -144,6 +144,7 @@ int noretr = 0; /* RETR command is disa int noguestretr = 0; /* RETR command is disabled for anon users. */ int noguestmkd = 0; /* MKD command is disabled for anon users. */ int noguestmod = 1; /* anon users may not modify existing files. */ +int use_blacklist = 0; off_t file_size; off_t byte_count; @@ -305,7 +306,7 @@ main(int argc, char *argv[], char **envp openlog("ftpd", LOG_PID | LOG_NDELAY, LOG_FTP); while ((ch = getopt(argc, argv, - "468a:AdDEhlmMoOp:P:rRSt:T:u:UvW")) != -1) { + "468a:ABdDEhlmMoOp:P:rRSt:T:u:UvW")) != -1) { switch (ch) { case '4': family = (family == AF_INET6) ? AF_UNSPEC : AF_INET; @@ -327,6 +328,14 @@ main(int argc, char *argv[], char **envp anon_only = 1; break; + case 'B': +#ifdef USE_BLACKLIST + use_blacklist = 1; +#else + syslog(LOG_WARNING, "not compiled with USE_BLACKLIST support"); +#endif + break; + case 'd': ftpdebug++; break; @@ -644,9 +653,7 @@ gotchild: reply(220, "%s FTP server (%s) ready.", hostname, version); else reply(220, "FTP server ready."); -#ifdef USE_BLACKLIST - blacklist_init(); -#endif + BLACKLIST_INIT(); for (;;) (void) yyparse(); /* NOTREACHED */ @@ -1422,9 +1429,7 @@ skip: */ if (rval) { reply(530, "Login incorrect."); -#ifdef USE_BLACKLIST - blacklist_notify(1, STDIN_FILENO, "Login incorrect"); -#endif + BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL, STDIN_FILENO, "Login incorrect"); if (logging) { syslog(LOG_NOTICE, "FTP LOGIN FAILED FROM %s", @@ -1441,12 +1446,9 @@ skip: exit(0); } return; + } else { + BLACKLIST_NOTIFY(BLACKLIST_AUTH_OK, STDIN_FILENO, "Login successful"); } -#ifdef USE_BLACKLIST - else { - blacklist_notify(0, STDIN_FILENO, "Login successful"); - } -#endif } login_attempts = 0; /* this time successful */ if (setegid(pw->pw_gid) < 0) { From owner-svn-src-all@freebsd.org Tue Nov 8 20:57:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6028C37CE8; Tue, 8 Nov 2016 20:57:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94B2FD7E; Tue, 8 Nov 2016 20:57:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8KvkkL096012; Tue, 8 Nov 2016 20:57:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8Kvk3t096011; Tue, 8 Nov 2016 20:57:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611082057.uA8Kvk3t096011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 8 Nov 2016 20:57:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308447 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 20:57:47 -0000 Author: mav Date: Tue Nov 8 20:57:46 2016 New Revision: 308447 URL: https://svnweb.freebsd.org/changeset/base/308447 Log: MFC r307857: Fix panic after ZVOL renamed to name invalid for DEVFS. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Nov 8 20:12:13 2016 (r308446) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Nov 8 20:57:46 2016 (r308447) @@ -782,8 +782,10 @@ zvol_remove_zv(zvol_state_t *zv) g_topology_lock(); zvol_geom_destroy(zv); g_topology_unlock(); - } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) - destroy_dev(zv->zv_dev); + } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) { + if (zv->zv_dev != NULL) + destroy_dev(zv->zv_dev); + } #endif avl_destroy(&zv->zv_znode.z_range_avl); @@ -2973,14 +2975,14 @@ zvol_rename_minor(zvol_state_t *zv, cons } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) { struct make_dev_args args; - dev = zv->zv_dev; - ASSERT(dev != NULL); - zv->zv_dev = NULL; - destroy_dev(dev); - if (zv->zv_total_opens > 0) { - zv->zv_flags &= ~ZVOL_EXCL; - zv->zv_total_opens = 0; - zvol_last_close(zv); + if ((dev = zv->zv_dev) != NULL) { + zv->zv_dev = NULL; + destroy_dev(dev); + if (zv->zv_total_opens > 0) { + zv->zv_flags &= ~ZVOL_EXCL; + zv->zv_total_opens = 0; + zvol_last_close(zv); + } } make_dev_args_init(&args); From owner-svn-src-all@freebsd.org Tue Nov 8 20:58:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E823C37D5F; Tue, 8 Nov 2016 20:58:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4901DF1B; Tue, 8 Nov 2016 20:58:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8KwPIc096090; Tue, 8 Nov 2016 20:58:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8KwPMS096089; Tue, 8 Nov 2016 20:58:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611082058.uA8KwPMS096089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 8 Nov 2016 20:58:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308448 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 20:58:26 -0000 Author: mav Date: Tue Nov 8 20:58:25 2016 New Revision: 308448 URL: https://svnweb.freebsd.org/changeset/base/308448 Log: MFC r307857: Fix panic after ZVOL renamed to name invalid for DEVFS. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Nov 8 20:57:46 2016 (r308447) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Nov 8 20:58:25 2016 (r308448) @@ -780,8 +780,10 @@ zvol_remove_zv(zvol_state_t *zv) g_topology_lock(); zvol_geom_destroy(zv); g_topology_unlock(); - } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) - destroy_dev(zv->zv_dev); + } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) { + if (zv->zv_dev != NULL) + destroy_dev(zv->zv_dev); + } #endif avl_destroy(&zv->zv_znode.z_range_avl); @@ -2952,14 +2954,14 @@ zvol_rename_minor(zvol_state_t *zv, cons } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) { struct make_dev_args args; - dev = zv->zv_dev; - ASSERT(dev != NULL); - zv->zv_dev = NULL; - destroy_dev(dev); - if (zv->zv_total_opens > 0) { - zv->zv_flags &= ~ZVOL_EXCL; - zv->zv_total_opens = 0; - zvol_last_close(zv); + if ((dev = zv->zv_dev) != NULL) { + zv->zv_dev = NULL; + destroy_dev(dev); + if (zv->zv_total_opens > 0) { + zv->zv_flags &= ~ZVOL_EXCL; + zv->zv_total_opens = 0; + zvol_last_close(zv); + } } make_dev_args_init(&args); From owner-svn-src-all@freebsd.org Tue Nov 8 21:09:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 644AFC37023; Tue, 8 Nov 2016 21:09:49 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33F3514B7; Tue, 8 Nov 2016 21:09:49 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8L9m8V099905; Tue, 8 Nov 2016 21:09:48 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8L9mJq099904; Tue, 8 Nov 2016 21:09:48 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201611082109.uA8L9mJq099904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 8 Nov 2016 21:09:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308449 - stable/11/usr.sbin/mountd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 21:09:49 -0000 Author: rmacklem Date: Tue Nov 8 21:09:48 2016 New Revision: 308449 URL: https://svnweb.freebsd.org/changeset/base/308449 Log: MFC: r307890 mountd(8) was erroneously setting the sysctl for the old NFS server when the new/default NFS server was running, for the "-n" option. This patch fixes the problem for head and stable/11. For stable/10 the patch will need to be modified when MFC'd, since the stable/10 mountd.c handles both old and new NFS servers. Since the new NFS server uses vfs.nfsd.nfs_privport == 0 by default, there wouldn't have been many users affected by the code not setting it to 0 when the "-n" option was specified. Modified: stable/11/usr.sbin/mountd/mountd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/mountd/mountd.c ============================================================================== --- stable/11/usr.sbin/mountd/mountd.c Tue Nov 8 20:58:25 2016 (r308448) +++ stable/11/usr.sbin/mountd/mountd.c Tue Nov 8 21:09:48 2016 (r308449) @@ -476,7 +476,7 @@ main(int argc, char **argv) rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec); if (!resvport_only) { - if (sysctlbyname("vfs.nfsrv.nfs_privport", NULL, NULL, + if (sysctlbyname("vfs.nfsd.nfs_privport", NULL, NULL, &resvport_only, sizeof(resvport_only)) != 0 && errno != ENOENT) { syslog(LOG_ERR, "sysctl: %m"); From owner-svn-src-all@freebsd.org Tue Nov 8 21:15:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE651C37368; Tue, 8 Nov 2016 21:15:51 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D2A71C15; Tue, 8 Nov 2016 21:15:51 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8LFoB2003969; Tue, 8 Nov 2016 21:15:50 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8LFouP003968; Tue, 8 Nov 2016 21:15:50 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201611082115.uA8LFouP003968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 8 Nov 2016 21:15:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308450 - stable/11/usr.sbin/mountd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 21:15:51 -0000 Author: rmacklem Date: Tue Nov 8 21:15:50 2016 New Revision: 308450 URL: https://svnweb.freebsd.org/changeset/base/308450 Log: MFC: r307891 Fix the man page to reflect the change done by r307890 to mountd.c so that the "-n" option uses the sysctl for the new NFS server. This is a content change. Modified: stable/11/usr.sbin/mountd/mountd.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/mountd/mountd.8 ============================================================================== --- stable/11/usr.sbin/mountd/mountd.8 Tue Nov 8 21:09:48 2016 (r308449) +++ stable/11/usr.sbin/mountd/mountd.8 Tue Nov 8 21:15:50 2016 (r308450) @@ -28,7 +28,7 @@ .\" @(#)mountd.8 8.4 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd October 14, 2012 +.Dd October 24, 2016 .Dt MOUNTD 8 .Os .Sh NAME @@ -95,7 +95,7 @@ requests to be logged. Allow non-root mount requests to be served. This should only be specified if there are clients such as PC's, that require it. -It will automatically clear the vfs.nfsrv.nfs_privport sysctl flag, which +It will automatically clear the vfs.nfsd.nfs_privport sysctl flag, which controls if the kernel will accept NFS requests from reserved ports only. .It Fl p Ar port Force From owner-svn-src-all@freebsd.org Tue Nov 8 21:17:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79119C37481; Tue, 8 Nov 2016 21:17:26 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BFD71DDE; Tue, 8 Nov 2016 21:17:26 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8LHPOu004064; Tue, 8 Nov 2016 21:17:25 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8LHPju004062; Tue, 8 Nov 2016 21:17:25 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201611082117.uA8LHPju004062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 8 Nov 2016 21:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308451 - in head/sys/cam: . scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 21:17:26 -0000 Author: cem Date: Tue Nov 8 21:17:24 2016 New Revision: 308451 URL: https://svnweb.freebsd.org/changeset/base/308451 Log: cam: Zero bio pointer in user-supplied SCSI CCBs The BUF_TRACKING bio pointer only makes sense for kernel consumers of CCBs. PR: 214250 Reported by: trasz@ Reviewed by: imp@, markj@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8477 Modified: head/sys/cam/cam_xpt.c head/sys/cam/scsi/scsi_pass.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Tue Nov 8 21:15:50 2016 (r308450) +++ head/sys/cam/cam_xpt.c Tue Nov 8 21:17:24 2016 (r308451) @@ -414,6 +414,10 @@ xptdoioctl(struct cdev *dev, u_long cmd, struct cam_eb *bus; inccb = (union ccb *)addr; +#if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) + if (inccb->ccb_h.func_code == XPT_SCSI_IO) + inccb->csio.bio = NULL; +#endif bus = xpt_find_bus(inccb->ccb_h.path_id); if (bus == NULL) @@ -593,6 +597,10 @@ xptdoioctl(struct cdev *dev, u_long cmd, unit = ccb->cgdl.unit_number; name = ccb->cgdl.periph_name; base_periph_found = 0; +#if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) + if (ccb->ccb_h.func_code == XPT_SCSI_IO) + ccb->csio.bio = NULL; +#endif /* * Sanity check -- make sure we don't get a null peripheral Modified: head/sys/cam/scsi/scsi_pass.c ============================================================================== --- head/sys/cam/scsi/scsi_pass.c Tue Nov 8 21:15:50 2016 (r308450) +++ head/sys/cam/scsi/scsi_pass.c Tue Nov 8 21:17:24 2016 (r308451) @@ -1777,6 +1777,10 @@ passdoioctl(struct cdev *dev, u_long cmd int ccb_malloced; inccb = (union ccb *)addr; +#if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) + if (inccb->ccb_h.func_code == XPT_SCSI_IO) + inccb->csio.bio = NULL; +#endif /* * Some CCB types, like scan bus and scan lun can only go @@ -1875,6 +1879,10 @@ passdoioctl(struct cdev *dev, u_long cmd cam_periph_lock(periph); break; } +#if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) + if (ccb->ccb_h.func_code == XPT_SCSI_IO) + ccb->csio.bio = NULL; +#endif if (ccb->ccb_h.flags & CAM_CDB_POINTER) { if (ccb->csio.cdb_len > IOCDBLEN) { From owner-svn-src-all@freebsd.org Tue Nov 8 21:39:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9AB51C37B85; Tue, 8 Nov 2016 21:39:16 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63C8CEA1; Tue, 8 Nov 2016 21:39:16 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8LdFEQ012364; Tue, 8 Nov 2016 21:39:15 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8LdFEF012363; Tue, 8 Nov 2016 21:39:15 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201611082139.uA8LdFEF012363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 8 Nov 2016 21:39:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308452 - stable/10/usr.sbin/mountd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 21:39:16 -0000 Author: rmacklem Date: Tue Nov 8 21:39:15 2016 New Revision: 308452 URL: https://svnweb.freebsd.org/changeset/base/308452 Log: MFC: r307890 mountd(8) was erroneously setting the sysctl for the old NFS server when the new/default NFS server was running, for the "-n" option. This patch fixes the problem for stable/10 and stable/9. Since the new NFS server uses vfs.nfsd.nfs_privport == 0 by default, there wouldn't have been many users affected by the code not setting it to 0 when the "-n" option was specified. Modified: stable/10/usr.sbin/mountd/mountd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/mountd/mountd.c ============================================================================== --- stable/10/usr.sbin/mountd/mountd.c Tue Nov 8 21:17:24 2016 (r308451) +++ stable/10/usr.sbin/mountd/mountd.c Tue Nov 8 21:39:15 2016 (r308452) @@ -489,11 +489,20 @@ main(int argc, char **argv) rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec); if (!resvport_only) { - if (sysctlbyname("vfs.nfsrv.nfs_privport", NULL, NULL, - &resvport_only, sizeof(resvport_only)) != 0 && - errno != ENOENT) { - syslog(LOG_ERR, "sysctl: %m"); - exit(1); + if (run_v4server != 0) { + if (sysctlbyname("vfs.nfsd.nfs_privport", NULL, NULL, + &resvport_only, sizeof(resvport_only)) != 0 && + errno != ENOENT) { + syslog(LOG_ERR, "sysctl: %m"); + exit(1); + } + } else { + if (sysctlbyname("vfs.nfsrv.nfs_privport", NULL, NULL, + &resvport_only, sizeof(resvport_only)) != 0 && + errno != ENOENT) { + syslog(LOG_ERR, "sysctl: %m"); + exit(1); + } } } From owner-svn-src-all@freebsd.org Tue Nov 8 21:47:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24B5AC37D9A; Tue, 8 Nov 2016 21:47:02 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E46EB6A8; Tue, 8 Nov 2016 21:47:01 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8Ll1WC016342; Tue, 8 Nov 2016 21:47:01 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8Ll16T016341; Tue, 8 Nov 2016 21:47:01 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201611082147.uA8Ll16T016341@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 8 Nov 2016 21:47:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308453 - stable/10/usr.sbin/mountd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 21:47:02 -0000 Author: rmacklem Date: Tue Nov 8 21:47:00 2016 New Revision: 308453 URL: https://svnweb.freebsd.org/changeset/base/308453 Log: MFC: r307891 Fix the man page to reflect the change done by r307890 to mountd.c so that the "-n" option uses the sysctl for the correct NFS server. This is a content change. Modified: stable/10/usr.sbin/mountd/mountd.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/mountd/mountd.8 ============================================================================== --- stable/10/usr.sbin/mountd/mountd.8 Tue Nov 8 21:39:15 2016 (r308452) +++ stable/10/usr.sbin/mountd/mountd.8 Tue Nov 8 21:47:00 2016 (r308453) @@ -28,7 +28,7 @@ .\" @(#)mountd.8 8.4 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd October 14, 2012 +.Dd October 24, 2016 .Dt MOUNTD 8 .Os .Sh NAME @@ -96,7 +96,7 @@ requests to be logged. Allow non-root mount requests to be served. This should only be specified if there are clients such as PC's, that require it. -It will automatically clear the vfs.nfsrv.nfs_privport sysctl flag, which +It will automatically clear the vfs.[nfsrv|nfsd].nfs_privport sysctl flag, which controls if the kernel will accept NFS requests from reserved ports only. .It Fl o This flag forces the system to run the old NFS server, which does not From owner-svn-src-all@freebsd.org Tue Nov 8 21:52:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B9F8C37F64; Tue, 8 Nov 2016 21:52:56 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 675CFB56; Tue, 8 Nov 2016 21:52:56 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8LqtO2020151; Tue, 8 Nov 2016 21:52:55 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8Lqtcv020150; Tue, 8 Nov 2016 21:52:55 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201611082152.uA8Lqtcv020150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 8 Nov 2016 21:52: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: r308454 - stable/9/usr.sbin/mountd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 21:52:56 -0000 Author: rmacklem Date: Tue Nov 8 21:52:55 2016 New Revision: 308454 URL: https://svnweb.freebsd.org/changeset/base/308454 Log: MFC: r307890 mountd(8) was erroneously setting the sysctl for the old NFS server when the new/default NFS server was running, for the "-n" option. This patch fixes the problem for stable/10 and stable/9. Since the new NFS server uses vfs.nfsd.nfs_privport == 0 by default, there wouldn't have been many users affected by the code not setting it to 0 when the "-n" option was specified. Modified: stable/9/usr.sbin/mountd/mountd.c Directory Properties: stable/9/usr.sbin/mountd/ (props changed) Modified: stable/9/usr.sbin/mountd/mountd.c ============================================================================== --- stable/9/usr.sbin/mountd/mountd.c Tue Nov 8 21:47:00 2016 (r308453) +++ stable/9/usr.sbin/mountd/mountd.c Tue Nov 8 21:52:55 2016 (r308454) @@ -421,11 +421,20 @@ main(int argc, char **argv) rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec); if (!resvport_only) { - if (sysctlbyname("vfs.nfsrv.nfs_privport", NULL, NULL, - &resvport_only, sizeof(resvport_only)) != 0 && - errno != ENOENT) { - syslog(LOG_ERR, "sysctl: %m"); - exit(1); + if (run_v4server != 0) { + if (sysctlbyname("vfs.nfsd.nfs_privport", NULL, NULL, + &resvport_only, sizeof(resvport_only)) != 0 && + errno != ENOENT) { + syslog(LOG_ERR, "sysctl: %m"); + exit(1); + } + } else { + if (sysctlbyname("vfs.nfsrv.nfs_privport", NULL, NULL, + &resvport_only, sizeof(resvport_only)) != 0 && + errno != ENOENT) { + syslog(LOG_ERR, "sysctl: %m"); + exit(1); + } } } From owner-svn-src-all@freebsd.org Tue Nov 8 21:57:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20630C3702D; Tue, 8 Nov 2016 21:57:51 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DAB9BCF4; Tue, 8 Nov 2016 21:57:50 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8Lvo0t020381; Tue, 8 Nov 2016 21:57:50 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8LvoxT020380; Tue, 8 Nov 2016 21:57:50 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201611082157.uA8LvoxT020380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 8 Nov 2016 21:57:50 +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: r308455 - stable/9/usr.sbin/mountd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 21:57:51 -0000 Author: rmacklem Date: Tue Nov 8 21:57:49 2016 New Revision: 308455 URL: https://svnweb.freebsd.org/changeset/base/308455 Log: MFC: r307891 Fix the man page to reflect the change done by r307890 to mountd.c so that the "-n" option uses the sysctl for the correct NFS server. This is a content change. Modified: stable/9/usr.sbin/mountd/mountd.8 Directory Properties: stable/9/usr.sbin/mountd/ (props changed) Modified: stable/9/usr.sbin/mountd/mountd.8 ============================================================================== --- stable/9/usr.sbin/mountd/mountd.8 Tue Nov 8 21:52:55 2016 (r308454) +++ stable/9/usr.sbin/mountd/mountd.8 Tue Nov 8 21:57:49 2016 (r308455) @@ -28,7 +28,7 @@ .\" @(#)mountd.8 8.4 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd October 14, 2012 +.Dd October 24, 2016 .Dt MOUNTD 8 .Os .Sh NAME @@ -96,7 +96,7 @@ requests to be logged. Allow non-root mount requests to be served. This should only be specified if there are clients such as PC's, that require it. -It will automatically clear the vfs.nfsrv.nfs_privport sysctl flag, which +It will automatically clear the vfs.[nfsrv|nfsd].nfs_privport sysctl flag, which controls if the kernel will accept NFS requests from reserved ports only. .It Fl o This flag forces the system to run the old NFS server, which does not From owner-svn-src-all@freebsd.org Tue Nov 8 22:41:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 540B4C37961; Tue, 8 Nov 2016 22:41:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A64DAA; Tue, 8 Nov 2016 22:41:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8MfC1Q036144; Tue, 8 Nov 2016 22:41:12 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8MfCJN036142; Tue, 8 Nov 2016 22:41:12 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611082241.uA8MfCJN036142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 8 Nov 2016 22:41:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308456 - in head/libexec/rtld-elf: . sparc64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 22:41:13 -0000 Author: jhb Date: Tue Nov 8 22:41:11 2016 New Revision: 308456 URL: https://svnweb.freebsd.org/changeset/base/308456 Log: Pass the correct flag to find_symdef() from _rtld_bind(). When symbol versioning was added to rtld, the boolean 'in_plt' argument to find_symdef() was converted to a bitmask of flags. The first flag added was 'SYMLOOK_IN_PLT' which replaced the 'in_plt' bool. This happened to still work by accident as SYMLOOK_IN_PLT had the value of 1 which is the same as 'true', so there should be no functional change. Tested on: amd64 Reviewed by: kan MFC after: 2 weeks Sponsored by: DARPA / AFRL Modified: head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/sparc64/reloc.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Tue Nov 8 21:57:49 2016 (r308455) +++ head/libexec/rtld-elf/rtld.c Tue Nov 8 22:41:11 2016 (r308456) @@ -713,8 +713,8 @@ _rtld_bind(Obj_Entry *obj, Elf_Size relo rel = (const Elf_Rel *) ((caddr_t) obj->pltrela + reloff); where = (Elf_Addr *) (obj->relocbase + rel->r_offset); - def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true, NULL, - &lockstate); + def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, SYMLOOK_IN_PLT, + NULL, &lockstate); if (def == NULL) rtld_die(); if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) Modified: head/libexec/rtld-elf/sparc64/reloc.c ============================================================================== --- head/libexec/rtld-elf/sparc64/reloc.c Tue Nov 8 21:57:49 2016 (r308455) +++ head/libexec/rtld-elf/sparc64/reloc.c Tue Nov 8 22:41:11 2016 (r308456) @@ -503,7 +503,7 @@ reloc_plt(Obj_Entry *obj) assert(ELF64_R_TYPE_ID(rela->r_info) == R_SPARC_JMP_SLOT); where = (Elf_Addr *)(obj->relocbase + rela->r_offset); def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - true, NULL, lockstate); + SYMLOOK_IN_PLT, NULL, lockstate); value = (Elf_Addr)(defobj->relocbase + def->st_value); *where = value; } From owner-svn-src-all@freebsd.org Tue Nov 8 23:59:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5485BC37CDB; Tue, 8 Nov 2016 23:59:47 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CEFB882; Tue, 8 Nov 2016 23:59:47 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8NxkdH067821; Tue, 8 Nov 2016 23:59:46 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8NxfRG067778; Tue, 8 Nov 2016 23:59:41 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201611082359.uA8NxfRG067778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 8 Nov 2016 23:59:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308457 - in head: sbin/pfctl sys/amd64/vmm/io sys/arm/include sys/arm/ti/omap4 sys/arm64/arm64 sys/cam sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/dev/dtrace/aarch64 sys/cd... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 23:59:47 -0000 Author: bdrewery Date: Tue Nov 8 23:59:41 2016 New Revision: 308457 URL: https://svnweb.freebsd.org/changeset/base/308457 Log: Fix improper use of "its". Sponsored by: Dell EMC Isilon Modified: head/sbin/pfctl/pfctl_optimize.c head/sys/amd64/vmm/io/vlapic.c head/sys/arm/include/profile.h head/sys/arm/ti/omap4/omap4_prcm_clks.c head/sys/arm64/arm64/identcpu.c head/sys/cam/cam.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c head/sys/cddl/dev/dtrace/arm/dtrace_subr.c head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c head/sys/dev/aic7xxx/aic7xxx.seq head/sys/dev/ath/if_ath_tdma.c head/sys/dev/isci/scil/sati_design.h head/sys/dev/isci/scil/sci_base_controller.h head/sys/dev/sfxge/common/efx_mcdi.c head/sys/dev/sound/pci/hda/hdaa.c head/sys/dev/sound/pci/hda/hdac.c head/sys/fs/nullfs/null_vnops.c head/sys/geom/raid/md_ddf.c head/sys/geom/raid/md_intel.c head/sys/geom/raid/md_jmicron.c head/sys/geom/raid/md_nvidia.c head/sys/geom/raid/md_promise.c head/sys/geom/raid/md_sii.c head/sys/i386/include/cserial.h head/sys/kern/init_main.c head/sys/kern/kern_ctf.c head/sys/kern/subr_firmware.c head/sys/kern/uipc_mbuf.c head/sys/net80211/ieee80211_node.h head/sys/netgraph/ng_base.c head/sys/powerpc/powerpc/mmu_if.m head/sys/security/mac/mac_inet.c head/sys/vm/vm_pageout.c head/sys/x86/xen/xen_intr.c head/usr.bin/du/du.c head/usr.bin/xlint/lint2/read.c head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bsnmpd/modules/snmp_bridge/BEGEMOT-BRIDGE-MIB.txt head/usr.sbin/newsyslog/newsyslog.c Modified: head/sbin/pfctl/pfctl_optimize.c ============================================================================== --- head/sbin/pfctl/pfctl_optimize.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sbin/pfctl/pfctl_optimize.c Tue Nov 8 23:59:41 2016 (r308457) @@ -84,7 +84,7 @@ TAILQ_HEAD(superblocks, superblock); * Description of the PF rule structure. */ enum { - BARRIER, /* the presence of the field puts the rule in it's own block */ + BARRIER, /* the presence of the field puts the rule in its own block */ BREAK, /* the field may not differ between rules in a superblock */ NOMERGE, /* the field may not differ between rules when combined */ COMBINED, /* the field may itself be combined with other rules */ @@ -104,7 +104,7 @@ static struct pf_rule_field { /* - * The presence of these fields in a rule put the rule in it's own + * The presence of these fields in a rule put the rule in its own * superblock. Thus it will not be optimized. It also prevents the * rule from being re-ordered at all. */ Modified: head/sys/amd64/vmm/io/vlapic.c ============================================================================== --- head/sys/amd64/vmm/io/vlapic.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/amd64/vmm/io/vlapic.c Tue Nov 8 23:59:41 2016 (r308457) @@ -859,7 +859,7 @@ vlapic_calcdest(struct vm *vm, cpuset_t /* * Logical mode: match each APIC that has a bit set - * in it's LDR that matches a bit in the ldest. + * in its LDR that matches a bit in the ldest. */ CPU_ZERO(dmask); amask = vm_active_cpus(vm); Modified: head/sys/arm/include/profile.h ============================================================================== --- head/sys/arm/include/profile.h Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/arm/include/profile.h Tue Nov 8 23:59:41 2016 (r308457) @@ -89,7 +89,7 @@ typedef u_long fptrdiff_t; __asm__("ldmfd sp!, {r0-r3, lr}"); \ /* \ * Return to the caller. Loading lr and pc in one instruction \ - * is deprecated on ARMv7 so we need this on it's own. \ + * is deprecated on ARMv7 so we need this on its own. \ */ \ __asm__("ldmfd sp!, {pc}"); void bintr(void); Modified: head/sys/arm/ti/omap4/omap4_prcm_clks.c ============================================================================== --- head/sys/arm/ti/omap4/omap4_prcm_clks.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/arm/ti/omap4/omap4_prcm_clks.c Tue Nov 8 23:59:41 2016 (r308457) @@ -1033,7 +1033,7 @@ omap4_clk_get_arm_fclk_freq(struct ti_cl * The USB clocking setup seems to be a bit more tricky than the other modules, * to start with the clocking diagram for the HS host module shows 13 different * clocks. So to try and make it easier to follow the clocking activation - * and deactivation is handled in it's own set of callbacks. + * and deactivation is handled in its own set of callbacks. * * LOCKING: * Inherits the locks from the omap_prcm driver, no internal locking. Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/arm64/arm64/identcpu.c Tue Nov 8 23:59:41 2016 (r308457) @@ -205,7 +205,7 @@ print_cpu_features(u_int cpu) * https://lkml.org/lkml/2016/8/4/722 */ /* - * XXX: CPU_MATCH_ERRATA_CAVIUM_THUNDER_1_1 on it's own also + * XXX: CPU_MATCH_ERRATA_CAVIUM_THUNDER_1_1 on its own also * triggers on pass 2.0+. */ if (cpu == 0 && CPU_VAR(PCPU_GET(midr)) == 0 && Modified: head/sys/cam/cam.h ============================================================================== --- head/sys/cam/cam.h Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/cam/cam.h Tue Nov 8 23:59:41 2016 (r308457) @@ -290,7 +290,7 @@ typedef enum { /* SIM ready to take more commands */ CAM_RELEASE_SIMQ = 0x100, - /* SIM has this command in it's queue */ + /* SIM has this command in its queue */ CAM_SIM_QUEUED = 0x200, /* Quality of service data is valid */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Nov 8 23:59:41 2016 (r308457) @@ -3104,7 +3104,7 @@ arc_buf_size(arc_buf_t *buf) /* * Evict the arc_buf_hdr that is provided as a parameter. The resultant - * state of the header is dependent on it's state prior to entering this + * state of the header is dependent on its state prior to entering this * function. The following transitions are possible: * * - arc_mru -> arc_mru_ghost Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Tue Nov 8 23:59:41 2016 (r308457) @@ -186,7 +186,7 @@ dtrace_trap(struct trapframe *frame, u_i /* * A trap can occur while DTrace executes a probe. Before * executing the probe, DTrace blocks re-scheduling and sets - * a flag in it's per-cpu flags to indicate that it doesn't + * a flag in its per-cpu flags to indicate that it doesn't * want to fault. On returning from the probe, the no-fault * flag is cleared and finally re-scheduling is enabled. * Modified: head/sys/cddl/dev/dtrace/arm/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/arm/dtrace_subr.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/cddl/dev/dtrace/arm/dtrace_subr.c Tue Nov 8 23:59:41 2016 (r308457) @@ -186,7 +186,7 @@ dtrace_trap(struct trapframe *frame, u_i /* * A trap can occur while DTrace executes a probe. Before * executing the probe, DTrace blocks re-scheduling and sets - * a flag in it's per-cpu flags to indicate that it doesn't + * a flag in its per-cpu flags to indicate that it doesn't * want to fault. On returning from the probe, the no-fault * flag is cleared and finally re-scheduling is enabled. * Modified: head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c Tue Nov 8 23:59:41 2016 (r308457) @@ -189,7 +189,7 @@ dtrace_trap(struct trapframe *frame, u_i /* * A trap can occur while DTrace executes a probe. Before * executing the probe, DTrace blocks re-scheduling and sets - * a flag in it's per-cpu flags to indicate that it doesn't + * a flag in its per-cpu flags to indicate that it doesn't * want to fault. On returning from the probe, the no-fault * flag is cleared and finally re-scheduling is enabled. * Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c Tue Nov 8 23:59:41 2016 (r308457) @@ -4397,7 +4397,7 @@ ar9300_eeprom_restore(struct ath_hal *ah #endif /* * At this point, mptr points to the eeprom data structure - * in it's "default" state. If this is big endian, swap the + * in its "default" state. If this is big endian, swap the * data structures back to "little endian" form. */ if (ar9300_eeprom_restore_internal(ah, mptr, mdata_size) >= 0) { Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c ============================================================================== --- head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c Tue Nov 8 23:59:41 2016 (r308457) @@ -1806,7 +1806,7 @@ vchiq_arm_init_state(VCHIQ_STATE_T *stat ** suspend completion and reset the resume state machine. ** ** VC_RESUME_IDLE - Initialise the resume completion at the same time. The -** resume completion is in it's 'done' state whenever +** resume completion is in its 'done' state whenever ** videcore is running. Therfore, the VC_RESUME_IDLE state ** implies that videocore is suspended. ** Hence, any thread which needs to wait until videocore is Modified: head/sys/dev/aic7xxx/aic7xxx.seq ============================================================================== --- head/sys/dev/aic7xxx/aic7xxx.seq Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/dev/aic7xxx/aic7xxx.seq Tue Nov 8 23:59:41 2016 (r308457) @@ -1446,7 +1446,7 @@ p_command_xfer: test SSTAT0, SDONE jnz . + 2; test SSTAT1, PHASEMIS jz . - 1; /* - * Wait for our ACK to go-away on it's own + * Wait for our ACK to go-away on its own * instead of being killed by SCSIEN getting cleared. */ test SCSISIGI, ACKI jnz .; Modified: head/sys/dev/ath/if_ath_tdma.c ============================================================================== --- head/sys/dev/ath/if_ath_tdma.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/dev/ath/if_ath_tdma.c Tue Nov 8 23:59:41 2016 (r308457) @@ -270,7 +270,7 @@ ath_tdma_config(struct ath_softc *sc, st * fixed/lowest transmit rate. Note that the interface * mtu does not include the 802.11 overhead so we must * tack that on (ath_hal_computetxtime includes the - * preamble and plcp in it's calculation). + * preamble and plcp in its calculation). */ tdma = vap->iv_tdma; if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) Modified: head/sys/dev/isci/scil/sati_design.h ============================================================================== --- head/sys/dev/isci/scil/sati_design.h Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/dev/isci/scil/sati_design.h Tue Nov 8 23:59:41 2016 (r308457) @@ -130,7 +130,7 @@ block devices (e.g. disks). @image html Use_Case_Diagram__SATI__SATI_-_SBC.jpg "SCSI Block Command Translation Use Cases" -The SCSI-to-ATA Translation (SAT) specification defines a few of it's own +The SCSI-to-ATA Translation (SAT) specification defines a few of its own commands, parameter data, and log pages. This use case diagram, however, only captures the SAT specific commands being translated. Modified: head/sys/dev/isci/scil/sci_base_controller.h ============================================================================== --- head/sys/dev/isci/scil/sci_base_controller.h Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/dev/isci/scil/sci_base_controller.h Tue Nov 8 23:59:41 2016 (r308457) @@ -90,7 +90,7 @@ typedef enum _SCI_BASE_CONTROLLER_STATES /** * This state indicates that the controller is reset. The memory for - * the controller is in it's initial state, but the controller requires + * the controller is in its initial state, but the controller requires * initialization. * This state is entered from the INITIAL state. * This state is entered from the RESETTING state. Modified: head/sys/dev/sfxge/common/efx_mcdi.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mcdi.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/dev/sfxge/common/efx_mcdi.c Tue Nov 8 23:59:41 2016 (r308457) @@ -1092,7 +1092,7 @@ efx_mcdi_read_assertion( /* * Before we attempt to chat to the MC, we should verify that the MC - * isn't in it's assertion handler, either due to a previous reboot, + * isn't in its assertion handler, either due to a previous reboot, * or because we're reinitializing due to an eec_exception(). * * Use GET_ASSERTS to read any assertion state that may be present. Modified: head/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/dev/sound/pci/hda/hdaa.c Tue Nov 8 23:59:41 2016 (r308457) @@ -2382,7 +2382,7 @@ hdaa_audio_ctl_source_volume(struct hdaa } /* If widget has own ossdev - not traverse it. - It will be traversed on it's own. */ + It will be traversed on its own. */ if (w->ossdev >= 0 && depth > 0) return; @@ -4550,7 +4550,7 @@ hdaa_audio_ctl_source_amp(struct hdaa_de } /* If widget has own ossdev - not traverse it. - It will be traversed on it's own. */ + It will be traversed on its own. */ if (w->ossdev >= 0 && depth > 0) return (found); Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/dev/sound/pci/hda/hdac.c Tue Nov 8 23:59:41 2016 (r308457) @@ -426,7 +426,7 @@ hdac_reset(struct hdac_softc *sc, int wa /* * Wait for codecs to finish their own reset sequence. The delay here - * should be of 250us but for some reasons, on it's not enough on my + * should be of 250us but for some reasons, it's not enough on my * computer. Let's use twice as much as necessary to make sure that * it's reset properly. */ Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/fs/nullfs/null_vnops.c Tue Nov 8 23:59:41 2016 (r308457) @@ -649,7 +649,7 @@ null_lock(struct vop_lock1_args *ap) nn = VTONULL(vp); /* * If we're still active we must ask the lower layer to - * lock as ffs has special lock considerations in it's + * lock as ffs has special lock considerations in its * vop lock. */ if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) { @@ -662,7 +662,7 @@ null_lock(struct vop_lock1_args *ap) * the lowervp's vop_lock routine. When we vgone we will * drop our last ref to the lowervp, which would allow it * to be reclaimed. The lowervp could then be recycled, - * in which case it is not legal to be sleeping in it's VOP. + * in which case it is not legal to be sleeping in its VOP. * We prevent it from being recycled by holding the vnode * here. */ Modified: head/sys/geom/raid/md_ddf.c ============================================================================== --- head/sys/geom/raid/md_ddf.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/geom/raid/md_ddf.c Tue Nov 8 23:59:41 2016 (r308457) @@ -1626,7 +1626,7 @@ g_raid_md_ddf_start_disk(struct g_raid_d vmeta = &pv->pv_meta; gmeta = &mdi->mdio_meta; - /* Find disk position in metadata by it's reference. */ + /* Find disk position in metadata by its reference. */ disk_pos = ddf_meta_find_disk(vmeta, reference, &md_disk_bvd, &md_disk_pos); md_pde_pos = ddf_meta_find_pd(gmeta, NULL, reference); Modified: head/sys/geom/raid/md_intel.c ============================================================================== --- head/sys/geom/raid/md_intel.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/geom/raid/md_intel.c Tue Nov 8 23:59:41 2016 (r308457) @@ -923,7 +923,7 @@ g_raid_md_intel_start_disk(struct g_raid pd = (struct g_raid_md_intel_perdisk *)disk->d_md_data; olddisk = NULL; - /* Find disk position in metadata by it's serial. */ + /* Find disk position in metadata by its serial. */ disk_pos = intel_meta_find_disk(meta, pd->pd_disk_meta.serial); if (disk_pos < 0) { G_RAID_DEBUG1(1, sc, "Unknown, probably new or stale disk"); Modified: head/sys/geom/raid/md_jmicron.c ============================================================================== --- head/sys/geom/raid/md_jmicron.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/geom/raid/md_jmicron.c Tue Nov 8 23:59:41 2016 (r308457) @@ -434,7 +434,7 @@ g_raid_md_jmicron_start_disk(struct g_ra pd = (struct g_raid_md_jmicron_perdisk *)disk->d_md_data; olddisk = NULL; - /* Find disk position in metadata by it's serial. */ + /* Find disk position in metadata by its serial. */ if (pd->pd_meta != NULL) disk_pos = jmicron_meta_find_disk(meta, pd->pd_disk_id); else Modified: head/sys/geom/raid/md_nvidia.c ============================================================================== --- head/sys/geom/raid/md_nvidia.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/geom/raid/md_nvidia.c Tue Nov 8 23:59:41 2016 (r308457) @@ -441,7 +441,7 @@ g_raid_md_nvidia_start_disk(struct g_rai pd = (struct g_raid_md_nvidia_perdisk *)disk->d_md_data; olddisk = NULL; - /* Find disk position in metadata by it's serial. */ + /* Find disk position in metadata by its serial. */ if (pd->pd_meta != NULL) { disk_pos = pd->pd_meta->disk_number; if (disk_pos >= meta->total_disks || mdi->mdio_started) Modified: head/sys/geom/raid/md_promise.c ============================================================================== --- head/sys/geom/raid/md_promise.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/geom/raid/md_promise.c Tue Nov 8 23:59:41 2016 (r308457) @@ -673,7 +673,7 @@ g_raid_md_promise_start_disk(struct g_ra meta = pv->pv_meta; if (sdn >= 0) { - /* Find disk position in metadata by it's serial. */ + /* Find disk position in metadata by its serial. */ md_disk_pos = promise_meta_find_disk(meta, pd->pd_meta[sdn]->disk.id); /* For RAID0+1 we need to translate order. */ disk_pos = promise_meta_translate_disk(vol, md_disk_pos); Modified: head/sys/geom/raid/md_sii.c ============================================================================== --- head/sys/geom/raid/md_sii.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/geom/raid/md_sii.c Tue Nov 8 23:59:41 2016 (r308457) @@ -489,7 +489,7 @@ g_raid_md_sii_start_disk(struct g_raid_d pd = (struct g_raid_md_sii_perdisk *)disk->d_md_data; olddisk = NULL; - /* Find disk position in metadata by it's serial. */ + /* Find disk position in metadata by its serial. */ if (pd->pd_meta != NULL) disk_pos = sii_meta_disk_pos(meta, pd->pd_meta); else Modified: head/sys/i386/include/cserial.h ============================================================================== --- head/sys/i386/include/cserial.h Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/i386/include/cserial.h Tue Nov 8 23:59:41 2016 (r308457) @@ -117,7 +117,7 @@ struct e3_statistics { /* * Attach/detach the protocol to the channel. - * The protocol is given by it's name, char[8]. + * The protocol is given by its name, char[8]. * For example "async", "hdlc", "cisco", "fr", "ppp". */ #define SERIAL_GETPROTO _IOR ('x', 1, char [8]) Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/kern/init_main.c Tue Nov 8 23:59:41 2016 (r308457) @@ -793,7 +793,7 @@ start_init(void *dummy) } /* - * Like kproc_create(), but runs in it's own address space. + * Like kproc_create(), but runs in its own address space. * We do this early to reserve pid 1. * * Note special case - do not make it runnable yet. Other work Modified: head/sys/kern/kern_ctf.c ============================================================================== --- head/sys/kern/kern_ctf.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/kern/kern_ctf.c Tue Nov 8 23:59:41 2016 (r308457) @@ -236,7 +236,7 @@ link_elf_ctf_get(linker_file_t lf, linke } /* - * Allocate memory to buffer the CTF data in it's decompressed + * Allocate memory to buffer the CTF data in its decompressed * form. */ ctftab = malloc(sz, M_LINKER, M_WAITOK); Modified: head/sys/kern/subr_firmware.c ============================================================================== --- head/sys/kern/subr_firmware.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/kern/subr_firmware.c Tue Nov 8 23:59:41 2016 (r308457) @@ -229,7 +229,7 @@ firmware_unregister(const char *imagenam /* * It is ok for the lookup to fail; this can happen * when a module is unloaded on last reference and the - * module unload handler unregister's each of it's + * module unload handler unregister's each of its * firmware images. */ err = 0; Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/kern/uipc_mbuf.c Tue Nov 8 23:59:41 2016 (r308457) @@ -1336,7 +1336,7 @@ nospace: /* * Defragment an mbuf chain, returning at most maxfrags separate * mbufs+clusters. If this is not possible NULL is returned and - * the original mbuf chain is left in it's present (potentially + * the original mbuf chain is left in its present (potentially * modified) state. We use two techniques: collapsing consecutive * mbufs and replacing consecutive mbufs by a cluster. * Modified: head/sys/net80211/ieee80211_node.h ============================================================================== --- head/sys/net80211/ieee80211_node.h Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/net80211/ieee80211_node.h Tue Nov 8 23:59:41 2016 (r308457) @@ -36,7 +36,7 @@ * IEEE80211_INACT_WAIT seconds to handle "inactivity processing". * This is used to do node inactivity processing when operating * as an AP, adhoc or mesh mode. For inactivity processing each node - * has a timeout set in it's ni_inact field that is decremented + * has a timeout set in its ni_inact field that is decremented * on each timeout and the node is reclaimed when the counter goes * to zero. We use different inactivity timeout values depending * on whether the node is associated and authorized (either by Modified: head/sys/netgraph/ng_base.c ============================================================================== --- head/sys/netgraph/ng_base.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/netgraph/ng_base.c Tue Nov 8 23:59:41 2016 (r308457) @@ -1179,7 +1179,7 @@ ng_destroy_hook(hook_p hook) /* * Set the peer to point to ng_deadhook * from this moment on we are effectively independent it. - * send it an rmhook message of it's own. + * send it an rmhook message of its own. */ peer->hk_peer = &ng_deadhook; /* They no longer know us */ hook->hk_peer = &ng_deadhook; /* Nor us, them */ @@ -3005,7 +3005,7 @@ void ng_free_item(item_p item) { /* - * The item may hold resources on it's own. We need to free + * The item may hold resources on its own. We need to free * these before we can free the item. What they are depends upon * what kind of item it is. it is important that nodes zero * out pointers to resources that they remove from the item @@ -3577,7 +3577,7 @@ ng_address_hook(node_p here, item_p item ITEM_DEBUG_CHECKS; /* * Quick sanity check.. - * Since a hook holds a reference on it's node, once we know + * Since a hook holds a reference on its node, once we know * that the peer is still connected (even if invalid,) we know * that the peer node is present, though maybe invalid. */ Modified: head/sys/powerpc/powerpc/mmu_if.m ============================================================================== --- head/sys/powerpc/powerpc/mmu_if.m Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/powerpc/powerpc/mmu_if.m Tue Nov 8 23:59:41 2016 (r308457) @@ -725,7 +725,7 @@ METHOD void align_superpage { /** * @brief Bootstrap the VM system. At the completion of this routine, the - * kernel will be running in it's own address space with full control over + * kernel will be running in its own address space with full control over * paging. * * @param _start start of reserved memory (obsolete ???) Modified: head/sys/security/mac/mac_inet.c ============================================================================== --- head/sys/security/mac/mac_inet.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/security/mac/mac_inet.c Tue Nov 8 23:59:41 2016 (r308457) @@ -435,7 +435,7 @@ mac_netinet_firewall_send(struct mbuf *m /* * These functions really should be referencing the syncache structure * instead of the label. However, due to some of the complexities associated - * with exposing this syncache structure we operate directly on it's label + * with exposing this syncache structure we operate directly on its label * pointer. This should be OK since we aren't making any access control * decisions within this code directly, we are merely allocating and copying * label storage so we can properly initialize mbuf labels for any packets Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/vm/vm_pageout.c Tue Nov 8 23:59:41 2016 (r308457) @@ -1410,7 +1410,7 @@ vm_pageout_oom(int shortage) /* * We keep the process bigproc locked once we find it to keep anyone * from messing with it; however, there is a possibility of - * deadlock if process B is bigproc and one of it's child processes + * deadlock if process B is bigproc and one of its child processes * attempts to propagate a signal to B while we are waiting for A's * lock while walking this list. To avoid this, we don't block on * the process lock but just skip a process if it is already locked. Modified: head/sys/x86/xen/xen_intr.c ============================================================================== --- head/sys/x86/xen/xen_intr.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/sys/x86/xen/xen_intr.c Tue Nov 8 23:59:41 2016 (r308457) @@ -940,7 +940,7 @@ xen_intr_disable_source(struct intsrc *b /* * NB: checking if the event channel is already masked is * needed because the event channel user-space device - * masks event channels on it's filter as part of it's + * masks event channels on its filter as part of its * normal operation, and those shouldn't be automatically * unmasked by the generic interrupt code. The event channel * device will unmask them when needed. Modified: head/usr.bin/du/du.c ============================================================================== --- head/usr.bin/du/du.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/usr.bin/du/du.c Tue Nov 8 23:59:41 2016 (r308457) @@ -421,7 +421,7 @@ linkchk(FTSENT *p) if (le->dev == st->st_dev && le->ino == st->st_ino) { /* * Save memory by releasing an entry when we've seen - * all of it's links. + * all of its links. */ if (--le->links <= 0) { if (le->previous != NULL) Modified: head/usr.bin/xlint/lint2/read.c ============================================================================== --- head/usr.bin/xlint/lint2/read.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/usr.bin/xlint/lint2/read.c Tue Nov 8 23:59:41 2016 (r308457) @@ -909,7 +909,7 @@ gettlen(const char *cp, const char **epp } /* - * Search a type by it's type string. + * Search a type by its type string. */ static u_short findtype(const char *cp, size_t len, int h) Modified: head/usr.sbin/bhyve/bhyverun.c ============================================================================== --- head/usr.sbin/bhyve/bhyverun.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/usr.sbin/bhyve/bhyverun.c Tue Nov 8 23:59:41 2016 (r308457) @@ -908,7 +908,7 @@ main(int argc, char *argv[]) sci_init(ctx); /* - * Exit if a device emulation finds an error in it's initilization + * Exit if a device emulation finds an error in its initilization */ if (init_pci(ctx) != 0) exit(1); Modified: head/usr.sbin/bsnmpd/modules/snmp_bridge/BEGEMOT-BRIDGE-MIB.txt ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_bridge/BEGEMOT-BRIDGE-MIB.txt Tue Nov 8 22:41:11 2016 (r308456) +++ head/usr.sbin/bsnmpd/modules/snmp_bridge/BEGEMOT-BRIDGE-MIB.txt Tue Nov 8 23:59:41 2016 (r308457) @@ -875,7 +875,7 @@ begemotBridgeTpMaxAddresses OBJECT-TYPE STATUS current DESCRIPTION "The maximum number of entires that this bridge can - learn in it's Forwarding Address Table and use for + learn in its Forwarding Address Table and use for making forwarding decisions." ::= { begemotBridgeTpEntry 3 } Modified: head/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.c Tue Nov 8 22:41:11 2016 (r308456) +++ head/usr.sbin/newsyslog/newsyslog.c Tue Nov 8 23:59:41 2016 (r308457) @@ -2062,7 +2062,7 @@ do_zipwork(struct zipwork_entry *zwork) * Save information on any process we need to signal. Any single * process may need to be sent different signal-values for different * log files, but usually a single signal-value will cause the process - * to close and re-open all of it's log files. + * to close and re-open all of its log files. */ static struct sigwork_entry * save_sigwork(const struct conf_entry *ent) From owner-svn-src-all@freebsd.org Wed Nov 9 01:58:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91638C37CF0; Wed, 9 Nov 2016 01:58:49 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 34400EB4; Wed, 9 Nov 2016 01:58:48 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c110-21-100-78.carlnfd1.nsw.optusnet.com.au [110.21.100.78]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 93566425D5F; Wed, 9 Nov 2016 12:39:06 +1100 (AEDT) Date: Wed, 9 Nov 2016 12:39:05 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Renato Botelho cc: Marcelo Araujo , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308443 - head/bin/hostname In-Reply-To: Message-ID: <20161109115729.F924@besplex.bde.org> References: <201611081136.uA8BaXrs073937@repo.freebsd.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=VIkg5I7X c=1 sm=1 tr=0 a=uGjuzT6u7JdBDS7kH8taPg==:117 a=uGjuzT6u7JdBDS7kH8taPg==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=nlC_4_pT8q9DhB4Ho9EA:9 a=6I5d2MoRAAAA:8 a=pGLkceISAAAA:8 a=p9n8UFVK5ax8Qv8xNh8A:9 a=45ClL6m2LaAA:10 a=IjZwj45LgO3ly-622nXo:22 a=6kGIvZw6iX1k4Y-7sg4_:22 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 01:58:49 -0000 On Tue, 8 Nov 2016, Renato Botelho wrote: >> On 8 Nov 2016, at 09:36, Marcelo Araujo wrote: >> >> Log: >> Add -d flag that prints domain only. >> >> PR:=09=09212875 >> Submitted by:=09Ben RUBSON >> Reviewed by:=09pi This has many style bugs. >> Modified: >> head/bin/hostname/hostname.1 >> head/bin/hostname/hostname.c >> >> Modified: head/bin/hostname/hostname.1 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/bin/hostname/hostname.1=09Tue Nov 8 10:10:55 2016=09(r308442) >> +++ head/bin/hostname/hostname.1=09Tue Nov 8 11:36:33 2016=09(r308443) >> @@ -29,7 +29,7 @@ >> .\"=09@(#)hostname.1=098.2 (Berkeley) 4/28/95 >> .\" $FreeBSD$ >> .\" >> -.Dd December 7, 2006 >> +.Dd November 9, 2016 >> .Dt HOSTNAME 1 >> .Os >> .Sh NAME >> @@ -37,7 +37,8 @@ >> .Nd set or print name of current host system >> .Sh SYNOPSIS >> .Nm >> -.Op Fl fs >> +.Op Fl f >> +.Op Fl s|d >> .Op Ar name-of-host >> .Sh DESCRIPTION >> The >> @@ -62,6 +63,8 @@ This is the default behavior. >> .It Fl s >> Trim off any domain information from the printed >> name. >> +.It Fl d >> +Only print domain information. >> .El >> .Sh SEE ALSO >> .Xr gethostname 3 , >> >> Modified: head/bin/hostname/hostname.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/bin/hostname/hostname.c=09Tue Nov 8 10:10:55 2016=09(r308442) >> +++ head/bin/hostname/hostname.c=09Tue Nov 8 11:36:33 2016=09(r308443) >> @@ -54,11 +54,12 @@ static void usage(void) __dead2; >> int >> main(int argc, char *argv[]) >> { >> -=09int ch, sflag; >> +=09int ch, sflag, dflag; >> =09char *p, hostname[MAXHOSTNAMELEN]; >> >> =09sflag =3D 0; >> -=09while ((ch =3D getopt(argc, argv, "fs")) !=3D -1) >> +=09dflag =3D 0; >> +=09while ((ch =3D getopt(argc, argv, "fsd")) !=3D -1) >> =09=09switch (ch) { >> =09=09case 'f': >> =09=09=09/* >> @@ -70,6 +71,9 @@ main(int argc, char *argv[]) >> =09=09case 's': >> =09=09=09sflag =3D 1; >> =09=09=09break; >> +=09=09case 'd': >> +=09=09=09dflag =3D 1; >> +=09=09=09break; >> =09=09case '?': >> =09=09default: >> =09=09=09usage(); >> @@ -77,7 +81,7 @@ main(int argc, char *argv[]) >> =09argc -=3D optind; >> =09argv +=3D optind; >> >> -=09if (argc > 1) >> +=09if (argc > 1 || (sflag && dflag)) >> =09=09usage(); >> >> =09if (*argv) { >> @@ -90,6 +94,10 @@ main(int argc, char *argv[]) >> =09=09=09p =3D strchr(hostname, '.'); >> =09=09=09if (p !=3D NULL) >> =09=09=09=09*p =3D '\0'; >> +=09=09} else if (dflag) { >> +=09=09=09p =3D strchr(hostname, '.'); >> +=09=09=09if (p !=3D NULL) >> +=09=09=09=09strcpy(hostname, ++p); >> =09=09} >> =09=09(void)printf("%s\n", hostname); >> =09} >> @@ -100,6 +108,6 @@ static void >> usage(void) >> { >> >> -=09(void)fprintf(stderr, "usage: hostname [-fs] [name-of-host]\n"); >> +=09(void)fprintf(stderr, "usage: hostname [-f] [s|d] [name-of-host]\n")= ; > > > It=E2=80=99s missing =E2=80=98-=E2=80=98 sign on [s|d] block, what makes = message a bit confused IMO. Maybe [-s|-d] would be more clear. Both are wrong. This is also broken in the man page, where the '|' is literal and misformatted. Normal markup would give '[-d | -s]' in the man page, and this should be copied to the usage message. Hard-coding the '|' using 's|d' gives the different syntax error of a hyphen before the 's'but no hyphen before the 's' ('[-s|d]'). The hard-coding has 2 other bugs: - missing spaces around '|' - d and s are unsorted d and s are unsorted consistently in about 8 instances in the patch. The correct order for sorting -f and [-d | -s] in the synopsis and usage message is unclear. It would be best to put -f after -d and keep -s attached to -d, but with longer options list this takes too much space by splitting up the single-letter options. Bruce From owner-svn-src-all@freebsd.org Wed Nov 9 04:07:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC838C35645; Wed, 9 Nov 2016 04:07:16 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A3025E0; Wed, 9 Nov 2016 04:07:16 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA947F47065310; Wed, 9 Nov 2016 04:07:15 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA947Fnu065307; Wed, 9 Nov 2016 04:07:15 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201611090407.uA947Fnu065307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 9 Nov 2016 04:07:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308458 - in head/sys: boot/fdt/dts/arm modules/dtb/am335x X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 04:07:16 -0000 Author: loos Date: Wed Nov 9 04:07:15 2016 New Revision: 308458 URL: https://svnweb.freebsd.org/changeset/base/308458 Log: Add the DTS for the Netgate SG-1000 (micro-Firewall). The SG-1000 boots with GENERIC ARM kernel on -head. Obtained from: pfSense Sponsored by: Rubicon Communications, LLC (Netgate) Added: head/sys/boot/fdt/dts/arm/ubmc.dtsi (contents, props changed) head/sys/boot/fdt/dts/arm/ufw.dts (contents, props changed) Modified: head/sys/modules/dtb/am335x/Makefile Added: head/sys/boot/fdt/dts/arm/ubmc.dtsi ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/fdt/dts/arm/ubmc.dtsi Wed Nov 9 04:07:15 2016 (r308458) @@ -0,0 +1,315 @@ +/* + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * $FreeBSD$ + */ + +/ { + memory { + device_type = "memory"; + reg = <0x80000000 0x10000000>; /* 256 MB */ + }; + + vmmcsd_fixed: fixedregulator@0 { + compatible = "regulator-fixed"; + regulator-name = "vmmcsd_fixed"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; +}; + +&am33xx_pinmux { + pinctrl-names = "default"; + pinctrl-0 = <&clkout2_pin>; + + i2c0_pins: pinmux_i2c0_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */ + AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */ + >; + }; + + i2c1_pins: pinmux_i2c1_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x968, PIN_INPUT_PULLUP | MUX_MODE3) /* uart0_ctsn.i2c1_sda */ + AM33XX_IOPAD(0x96c, PIN_INPUT_PULLUP | MUX_MODE3) /* uart0_rtsn.i2c1_scl */ + >; + }; + + spi0_pins: pinmux_spi0_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x950, PIN_INPUT_PULLDOWN | MUX_MODE0) /* spi0_sclk.spi0_sclk */ + AM33XX_IOPAD(0x954, PIN_INPUT_PULLDOWN | MUX_MODE0) /* spi0_d0.spi0_miso */ + AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_d1.spi0_mosi */ + AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_cs0.spi0_cs0 */ + >; + }; + + spi1_pins: pinmux_spi1_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x908, PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_col.spi1_sclk */ + AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_crs.spi1_miso */ + AM33XX_IOPAD(0x910, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rx_er.spi1_mosi */ + AM33XX_IOPAD(0x944, PIN_INPUT_PULLUP | MUX_MODE2) /* rmii1_ref_clk.spi1_cs0 */ + >; + }; + + uart0_pins: pinmux_uart0_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */ + AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */ + >; + }; + + clkout2_pin: pinmux_clkout2_pin { + pinctrl-single,pins = < + AM33XX_IOPAD(0x9b4, PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr1.clkout2 */ + >; + }; + + cpsw_default: cpsw_default { + pinctrl-single,pins = < + /* Slave 1 */ + AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txen.rgmii_1_txen */ + AM33XX_IOPAD(0x918, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxdv.rgmii_1_rxdv */ + AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd3.rgmii_1_txd3 */ + AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd2.rgmii_1_txd2 */ + AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd1.rgmii_1_txd1 */ + AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd0.rgmii_1_txd0 */ + AM33XX_IOPAD(0x92c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txclk.rgmii_1_txclk */ + AM33XX_IOPAD(0x930, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxclk.rgmii_1_rxclk */ + AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd3.rgmii_1_rxd3 */ + AM33XX_IOPAD(0x938, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd2.rgmii_1_rxd2 */ + AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd1.rgmii_1_rxd1 */ + AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd0.rgmii_1_rxd0 */ + + /* Slave 2 */ + AM33XX_IOPAD(0x840, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a0.rgmii_2_txen */ + AM33XX_IOPAD(0x844, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a1.rgmii_2_rxdv */ + AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a2.rgmii_2_txd3 */ + AM33XX_IOPAD(0x84c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a3.rgmii_2_txd2 */ + AM33XX_IOPAD(0x850, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a4.rgmii_2_txd1 */ + AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a5.rgmii_2_txd0 */ + AM33XX_IOPAD(0x858, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a6.rgmii_2_txclk */ + AM33XX_IOPAD(0x85c, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a7.rgmii_2_rxclk */ + AM33XX_IOPAD(0x860, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a8.rgmii_2_rxd3 */ + AM33XX_IOPAD(0x864, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a9.rgmii_2_rxd2 */ + AM33XX_IOPAD(0x868, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a10.rgmii_2_rxd1 */ + AM33XX_IOPAD(0x86c, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a11.rgmii_2_rxd0 */ + >; + }; + + cpsw_sleep: cpsw_sleep { + pinctrl-single,pins = < + /* Slave 1 reset value */ + AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x91c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x920, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x92c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7) + + /* Slave 2 reset value */ + AM33XX_IOPAD(0x840, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x844, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x848, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x84c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x850, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x854, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x858, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x85c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x860, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x864, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE7) + >; + }; + + davinci_mdio_default: davinci_mdio_default { + pinctrl-single,pins = < + /* MDIO */ + AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */ + AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */ + >; + }; + + davinci_mdio_sleep: davinci_mdio_sleep { + pinctrl-single,pins = < + /* MDIO reset value */ + AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7) + >; + }; + + mmc1_pins: pinmux_mmc1_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat3.mmc0_dat3 */ + AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat2.mmc0_dat2 */ + AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat1.mmc0_dat1 */ + AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat0.mmc0_dat0 */ + AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_clk.mmc0_clk */ + AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_cmd.mmc0_cmd */ + AM33XX_IOPAD(0x960, PIN_INPUT_PULLUP | MUX_MODE5) /* spi0_cs1.mmc0_cd */ + >; + }; + + emmc_pins: pinmux_emmc_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x994, PIN_INPUT_PULLUP | MUX_MODE4) /* mcasp0_fsx.mmc1_cd */ + AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */ + AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */ + AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */ + AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */ + AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */ + AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */ + AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */ + AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */ + AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */ + AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */ + >; + }; + + ecap0_pins: pinmux_ecap0_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x964, PIN_INPUT | MUX_MODE0) /* ecap0_in_pwm0_out.ecap0_in_pwm0_out */ + >; + }; + + ecap1_pins: pinmux_ecap1_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE2) /* spi0_cs1.ecap1_in_pwm1_out */ + >; + }; + + ehrpwm1_pins: pinmux_ehrpwm1_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x8c8, PIN_OUTPUT | MUX_MODE2) /* lcd_data10.ehrpwm1a */ + >; + }; + + ecap2_pins: pinmux_ecap2_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x99c, PIN_INPUT | MUX_MODE4) /* mcasp0_ahclkr.ecap2_in_pwm2_out */ + >; + }; + + ehrpwm2_pins: pinmux_ehrpwm2_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE3) /* lcd_data0.ehrpwm2a */ + >; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + + status = "okay"; +}; + +&usb { + status = "okay"; +}; + +&usb_ctrl_mod { + status = "okay"; +}; + +&usb0_phy { + status = "okay"; +}; + +&usb1_phy { + status = "okay"; +}; + +&usb0 { + status = "okay"; + dr_mode = "host"; +}; + +&usb1 { + status = "okay"; + dr_mode = "host"; +}; + +&cppi41dma { + status = "okay"; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + + status = "okay"; + clock-frequency = <400000>; + + baseboard_eeprom: baseboard_eeprom@50 { + compatible = "atmel,24c02"; + reg = <0x50>; + + #address-cells = <1>; + #size-cells = <1>; + baseboard_data: baseboard_data@0 { + reg = <0 0x100>; + }; + }; +}; + +&cpsw_emac0 { + phy_id = <&davinci_mdio>, <1>; + phy-mode = "rgmii"; + dual_emac_res_vlan = <1>; +}; + +&cpsw_emac1 { + phy_id = <&davinci_mdio>, <2>; + phy-mode = "rgmii"; + dual_emac_res_vlan = <2>; +}; + +&mac { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&cpsw_default>; + pinctrl-1 = <&cpsw_sleep>; + active_slave = <1>; + status = "okay"; + dual_emac; + txen-skew-ps = <0>; + rxdv-skew-ps = <1400>; + rxd0-skew-ps = <1400>; + rxd1-skew-ps = <1400>; + rxd2-skew-ps = <1400>; + rxd3-skew-ps = <1400>; + txd0-skew-ps = <0>; + txd1-skew-ps = <0>; + txd2-skew-ps = <0>; + txd3-skew-ps = <0>; + rxc-skew-ps = <4400>; + txc-skew-ps = <6200>; +}; + +&davinci_mdio { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&davinci_mdio_default>; + pinctrl-1 = <&davinci_mdio_sleep>; + status = "okay"; +}; + +&aes { + status = "okay"; +}; + +&sham { + status = "okay"; +}; Added: head/sys/boot/fdt/dts/arm/ufw.dts ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/fdt/dts/arm/ufw.dts Wed Nov 9 04:07:15 2016 (r308458) @@ -0,0 +1,70 @@ +/*- + * Copyright (c) 2016 Rubicon Communications, LLC (Netgate) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/dts-v1/; + +#include "am33xx.dtsi" +#include "ubmc.dtsi" + +/ { + model = "AM335x uFW"; + compatible = "ti,am335x-ufw", "ti,am335x-ubmc", "ti,am33xx"; +}; + +&mmc1 { + vmmc-supply = <&vmmcsd_fixed>; + pinctrl-names = "default"; + pinctrl-0 = <&mmc1_pins>; + bus-width = <4>; + non-removable; + status = "okay"; +}; + +&mmc2 { + vmmc-supply = <&vmmcsd_fixed>; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_pins>; + bus-width = <8>; + ti,dual-volt; + non-removable; + status = "okay"; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + + status = "okay"; +}; + +&i2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_pins>; + + status = "okay"; +}; Modified: head/sys/modules/dtb/am335x/Makefile ============================================================================== --- head/sys/modules/dtb/am335x/Makefile Tue Nov 8 23:59:41 2016 (r308457) +++ head/sys/modules/dtb/am335x/Makefile Wed Nov 9 04:07:15 2016 (r308458) @@ -2,6 +2,7 @@ # All the dts files for am335x systems we support. DTS= \ beaglebone.dts \ - beaglebone-black.dts + beaglebone-black.dts \ + ufw.dts .include From owner-svn-src-all@freebsd.org Wed Nov 9 04:31:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D42A0C35EFD; Wed, 9 Nov 2016 04:31:56 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id EA61823E; Wed, 9 Nov 2016 04:31:55 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 0885ac72; Wed, 9 Nov 2016 05:26:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=MVGPoLG9qUDP/cxRew0tkd86/5c=; b=j1OGgYmMOVAUSjCACvlKla3Ngsrs oLjok1AT+hiFRmx90EUF59IcEQAe5XuuJp1EQ75sh3uIqYG4nNJmkGEo/Sx19XxJ PZtEM/jJf1usBHgeoAj3d2WtgxF+L9wVxEF+m5ip+cFeKnBC3P114qkRWLusyrMm XmBwjakYklVNsVM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=WSktQoPGn0z4ONDwU9pfwLWRqYyIZ6XOU5M/HHweBTzkhnpgWslS/RzH QrT7wZNby+Zbx8uhGNiLEhjm7PTkYOueYWk0B6meevjxA7m11i5fwCrx+EH7MWMg fHhBt88b95tbCqPs2FLg3htxucJMyo2tHXV4dAB/aFixWG6079Q= Received: from knuckles.blih.net (ip-54.net-82-216-203.roubaix.rev.numericable.fr [82.216.203.54]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 3277d5ef TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Wed, 9 Nov 2016 05:26:59 +0100 (CET) Date: Wed, 9 Nov 2016 05:26:56 +0100 From: Emmanuel Vadot To: Luiz Otavio O Souza Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308458 - in head/sys: boot/fdt/dts/arm modules/dtb/am335x Message-Id: <20161109052656.76911ada273bb14048bb999b@bidouilliste.com> In-Reply-To: <201611090407.uA947Fnu065307@repo.freebsd.org> References: <201611090407.uA947Fnu065307@repo.freebsd.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.29; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 04:31:56 -0000 On Wed, 9 Nov 2016 04:07:15 +0000 (UTC) Luiz Otavio O Souza wrote: > Author: loos > Date: Wed Nov 9 04:07:15 2016 > New Revision: 308458 > URL: https://svnweb.freebsd.org/changeset/base/308458 > > Log: > Add the DTS for the Netgate SG-1000 (micro-Firewall). > > The SG-1000 boots with GENERIC ARM kernel on -head. > > Obtained from: pfSense > Sponsored by: Rubicon Communications, LLC (Netgate) > > Added: > head/sys/boot/fdt/dts/arm/ubmc.dtsi (contents, props changed) > head/sys/boot/fdt/dts/arm/ufw.dts (contents, props changed) > Modified: > head/sys/modules/dtb/am335x/Makefile Hello Luiz, Two things: - If ubmc.dtsi is gnu licenced it shouldn't go in sys/boot/fdt/dts. It shouldn't go to sys/gnu/dts too as it's not from upstream. - I don't understand why you didn't use the am33xx.dtsi from upstream, it is the way to go for dts. The correct way to add support for this board would be : 1) Create a ubmc.dtsi that uses upstream am33xx.dtsi and submit it upstream (i.e. linux-arm), MIT/GPL dual licence 2) Create a ufw.dts and also submit it upstream (also MIT/GPL) 3) Since those are also MIT you could add them to sys/boot/fdt 4) When we will update the dts from upstream you can then remove them from sys/boot/fdt But there would still be a problem since the am33xx.dtsi is not MIT/GPL licenced. So I guess you don't have any other solution than dealing with DTS somewhere in the pfsense repository (maybe with package or something). The DTS world is already a mess with it's licence and the fact that linux is the "official" place, so please do not add more :) > Added: head/sys/boot/fdt/dts/arm/ubmc.dtsi > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/boot/fdt/dts/arm/ubmc.dtsi Wed Nov 9 04:07:15 2016 (r308458) > @@ -0,0 +1,315 @@ > +/* > + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + * > + * $FreeBSD$ > + */ > + > +/ { > + memory { > + device_type = "memory"; > + reg = <0x80000000 0x10000000>; /* 256 MB */ > + }; > + > + vmmcsd_fixed: fixedregulator@0 { > + compatible = "regulator-fixed"; > + regulator-name = "vmmcsd_fixed"; > + regulator-min-microvolt = <3300000>; > + regulator-max-microvolt = <3300000>; > + }; > +}; > + > +&am33xx_pinmux { > + pinctrl-names = "default"; > + pinctrl-0 = <&clkout2_pin>; > + > + i2c0_pins: pinmux_i2c0_pins { > + pinctrl-single,pins = < > + AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */ > + AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */ > + >; > + }; > + > + i2c1_pins: pinmux_i2c1_pins { > + pinctrl-single,pins = < > + AM33XX_IOPAD(0x968, PIN_INPUT_PULLUP | MUX_MODE3) /* uart0_ctsn.i2c1_sda */ > + AM33XX_IOPAD(0x96c, PIN_INPUT_PULLUP | MUX_MODE3) /* uart0_rtsn.i2c1_scl */ > + >; > + }; > + > + spi0_pins: pinmux_spi0_pins { > + pinctrl-single,pins = < > + AM33XX_IOPAD(0x950, PIN_INPUT_PULLDOWN | MUX_MODE0) /* spi0_sclk.spi0_sclk */ > + AM33XX_IOPAD(0x954, PIN_INPUT_PULLDOWN | MUX_MODE0) /* spi0_d0.spi0_miso */ > + AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_d1.spi0_mosi */ > + AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_cs0.spi0_cs0 */ > + >; > + }; > + > + spi1_pins: pinmux_spi1_pins { > + pinctrl-single,pins = < > + AM33XX_IOPAD(0x908, PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_col.spi1_sclk */ > + AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_crs.spi1_miso */ > + AM33XX_IOPAD(0x910, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rx_er.spi1_mosi */ > + AM33XX_IOPAD(0x944, PIN_INPUT_PULLUP | MUX_MODE2) /* rmii1_ref_clk.spi1_cs0 */ > + >; > + }; > + > + uart0_pins: pinmux_uart0_pins { > + pinctrl-single,pins = < > + AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */ > + AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */ > + >; > + }; > + > + clkout2_pin: pinmux_clkout2_pin { > + pinctrl-single,pins = < > + AM33XX_IOPAD(0x9b4, PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr1.clkout2 */ > + >; > + }; > + > + cpsw_default: cpsw_default { > + pinctrl-single,pins = < > + /* Slave 1 */ > + AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txen.rgmii_1_txen */ > + AM33XX_IOPAD(0x918, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxdv.rgmii_1_rxdv */ > + AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd3.rgmii_1_txd3 */ > + AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd2.rgmii_1_txd2 */ > + AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd1.rgmii_1_txd1 */ > + AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd0.rgmii_1_txd0 */ > + AM33XX_IOPAD(0x92c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txclk.rgmii_1_txclk */ > + AM33XX_IOPAD(0x930, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxclk.rgmii_1_rxclk */ > + AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd3.rgmii_1_rxd3 */ > + AM33XX_IOPAD(0x938, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd2.rgmii_1_rxd2 */ > + AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd1.rgmii_1_rxd1 */ > + AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd0.rgmii_1_rxd0 */ > + > + /* Slave 2 */ > + AM33XX_IOPAD(0x840, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a0.rgmii_2_txen */ > + AM33XX_IOPAD(0x844, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a1.rgmii_2_rxdv */ > + AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a2.rgmii_2_txd3 */ > + AM33XX_IOPAD(0x84c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a3.rgmii_2_txd2 */ > + AM33XX_IOPAD(0x850, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a4.rgmii_2_txd1 */ > + AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a5.rgmii_2_txd0 */ > + AM33XX_IOPAD(0x858, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a6.rgmii_2_txclk */ > + AM33XX_IOPAD(0x85c, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a7.rgmii_2_rxclk */ > + AM33XX_IOPAD(0x860, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a8.rgmii_2_rxd3 */ > + AM33XX_IOPAD(0x864, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a9.rgmii_2_rxd2 */ > + AM33XX_IOPAD(0x868, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a10.rgmii_2_rxd1 */ > + AM33XX_IOPAD(0x86c, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a11.rgmii_2_rxd0 */ > + >; > + }; > + > + cpsw_sleep: cpsw_sleep { > + pinctrl-single,pins = < > + /* Slave 1 reset value */ > + AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x91c, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x920, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x92c, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7) > + > + /* Slave 2 reset value */ > + AM33XX_IOPAD(0x840, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x844, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x848, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x84c, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x850, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x854, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x858, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x85c, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x860, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x864, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE7) > + >; > + }; > + > + davinci_mdio_default: davinci_mdio_default { > + pinctrl-single,pins = < > + /* MDIO */ > + AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */ > + AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */ > + >; > + }; > + > + davinci_mdio_sleep: davinci_mdio_sleep { > + pinctrl-single,pins = < > + /* MDIO reset value */ > + AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7) > + AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7) > + >; > + }; > + > + mmc1_pins: pinmux_mmc1_pins { > + pinctrl-single,pins = < > + AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat3.mmc0_dat3 */ > + AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat2.mmc0_dat2 */ > + AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat1.mmc0_dat1 */ > + AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat0.mmc0_dat0 */ > + AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_clk.mmc0_clk */ > + AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_cmd.mmc0_cmd */ > + AM33XX_IOPAD(0x960, PIN_INPUT_PULLUP | MUX_MODE5) /* spi0_cs1.mmc0_cd */ > + >; > + }; > + > + emmc_pins: pinmux_emmc_pins { > + pinctrl-single,pins = < > + AM33XX_IOPAD(0x994, PIN_INPUT_PULLUP | MUX_MODE4) /* mcasp0_fsx.mmc1_cd */ > + AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */ > + AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */ > + AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */ > + AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */ > + AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */ > + AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */ > + AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */ > + AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */ > + AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */ > + AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */ > + >; > + }; > + > + ecap0_pins: pinmux_ecap0_pins { > + pinctrl-single,pins = < > + AM33XX_IOPAD(0x964, PIN_INPUT | MUX_MODE0) /* ecap0_in_pwm0_out.ecap0_in_pwm0_out */ > + >; > + }; > + > + ecap1_pins: pinmux_ecap1_pins { > + pinctrl-single,pins = < > + AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE2) /* spi0_cs1.ecap1_in_pwm1_out */ > + >; > + }; > + > + ehrpwm1_pins: pinmux_ehrpwm1_pins { > + pinctrl-single,pins = < > + AM33XX_IOPAD(0x8c8, PIN_OUTPUT | MUX_MODE2) /* lcd_data10.ehrpwm1a */ > + >; > + }; > + > + ecap2_pins: pinmux_ecap2_pins { > + pinctrl-single,pins = < > + AM33XX_IOPAD(0x99c, PIN_INPUT | MUX_MODE4) /* mcasp0_ahclkr.ecap2_in_pwm2_out */ > + >; > + }; > + > + ehrpwm2_pins: pinmux_ehrpwm2_pins { > + pinctrl-single,pins = < > + AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE3) /* lcd_data0.ehrpwm2a */ > + >; > + }; > +}; > + > +&uart0 { > + pinctrl-names = "default"; > + pinctrl-0 = <&uart0_pins>; > + > + status = "okay"; > +}; > + > +&usb { > + status = "okay"; > +}; > + > +&usb_ctrl_mod { > + status = "okay"; > +}; > + > +&usb0_phy { > + status = "okay"; > +}; > + > +&usb1_phy { > + status = "okay"; > +}; > + > +&usb0 { > + status = "okay"; > + dr_mode = "host"; > +}; > + > +&usb1 { > + status = "okay"; > + dr_mode = "host"; > +}; > + > +&cppi41dma { > + status = "okay"; > +}; > + > +&i2c0 { > + pinctrl-names = "default"; > + pinctrl-0 = <&i2c0_pins>; > + > + status = "okay"; > + clock-frequency = <400000>; > + > + baseboard_eeprom: baseboard_eeprom@50 { > + compatible = "atmel,24c02"; > + reg = <0x50>; > + > + #address-cells = <1>; > + #size-cells = <1>; > + baseboard_data: baseboard_data@0 { > + reg = <0 0x100>; > + }; > + }; > +}; > + > +&cpsw_emac0 { > + phy_id = <&davinci_mdio>, <1>; > + phy-mode = "rgmii"; > + dual_emac_res_vlan = <1>; > +}; > + > +&cpsw_emac1 { > + phy_id = <&davinci_mdio>, <2>; > + phy-mode = "rgmii"; > + dual_emac_res_vlan = <2>; > +}; > + > +&mac { > + pinctrl-names = "default", "sleep"; > + pinctrl-0 = <&cpsw_default>; > + pinctrl-1 = <&cpsw_sleep>; > + active_slave = <1>; > + status = "okay"; > + dual_emac; > + txen-skew-ps = <0>; > + rxdv-skew-ps = <1400>; > + rxd0-skew-ps = <1400>; > + rxd1-skew-ps = <1400>; > + rxd2-skew-ps = <1400>; > + rxd3-skew-ps = <1400>; > + txd0-skew-ps = <0>; > + txd1-skew-ps = <0>; > + txd2-skew-ps = <0>; > + txd3-skew-ps = <0>; > + rxc-skew-ps = <4400>; > + txc-skew-ps = <6200>; > +}; > + > +&davinci_mdio { > + pinctrl-names = "default", "sleep"; > + pinctrl-0 = <&davinci_mdio_default>; > + pinctrl-1 = <&davinci_mdio_sleep>; > + status = "okay"; > +}; > + > +&aes { > + status = "okay"; > +}; > + > +&sham { > + status = "okay"; > +}; > > Added: head/sys/boot/fdt/dts/arm/ufw.dts > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/boot/fdt/dts/arm/ufw.dts Wed Nov 9 04:07:15 2016 (r308458) > @@ -0,0 +1,70 @@ > +/*- > + * Copyright (c) 2016 Rubicon Communications, LLC (Netgate) > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +/dts-v1/; > + > +#include "am33xx.dtsi" > +#include "ubmc.dtsi" > + > +/ { > + model = "AM335x uFW"; > + compatible = "ti,am335x-ufw", "ti,am335x-ubmc", "ti,am33xx"; > +}; > + > +&mmc1 { > + vmmc-supply = <&vmmcsd_fixed>; > + pinctrl-names = "default"; > + pinctrl-0 = <&mmc1_pins>; > + bus-width = <4>; > + non-removable; > + status = "okay"; > +}; > + > +&mmc2 { > + vmmc-supply = <&vmmcsd_fixed>; > + pinctrl-names = "default"; > + pinctrl-0 = <&emmc_pins>; > + bus-width = <8>; > + ti,dual-volt; > + non-removable; > + status = "okay"; > +}; > + > +&i2c0 { > + pinctrl-names = "default"; > + pinctrl-0 = <&i2c0_pins>; > + > + status = "okay"; > +}; > + > +&i2c1 { > + pinctrl-names = "default"; > + pinctrl-0 = <&i2c1_pins>; > + > + status = "okay"; > +}; > > Modified: head/sys/modules/dtb/am335x/Makefile > ============================================================================== > --- head/sys/modules/dtb/am335x/Makefile Tue Nov 8 23:59:41 2016 (r308457) > +++ head/sys/modules/dtb/am335x/Makefile Wed Nov 9 04:07:15 2016 (r308458) > @@ -2,6 +2,7 @@ > # All the dts files for am335x systems we support. > DTS= \ > beaglebone.dts \ > - beaglebone-black.dts > + beaglebone-black.dts \ > + ufw.dts > > .include -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Wed Nov 9 04:42:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44E4EC3731C; Wed, 9 Nov 2016 04:42:11 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 140EE9BA; Wed, 9 Nov 2016 04:42:11 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA94gAFF079822; Wed, 9 Nov 2016 04:42:10 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA94gAKS079820; Wed, 9 Nov 2016 04:42:10 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201611090442.uA94gAKS079820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Wed, 9 Nov 2016 04:42:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308459 - head/bin/hostname X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 04:42:11 -0000 Author: araujo Date: Wed Nov 9 04:42:09 2016 New Revision: 308459 URL: https://svnweb.freebsd.org/changeset/base/308459 Log: Fix missing '-' for the flags -s and -d on both manpage and usage. Reported by: garga, bde Modified: head/bin/hostname/hostname.1 head/bin/hostname/hostname.c Modified: head/bin/hostname/hostname.1 ============================================================================== --- head/bin/hostname/hostname.1 Wed Nov 9 04:07:15 2016 (r308458) +++ head/bin/hostname/hostname.1 Wed Nov 9 04:42:09 2016 (r308459) @@ -29,7 +29,7 @@ .\" @(#)hostname.1 8.2 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd November 9, 2016 +.Dd November 10, 2016 .Dt HOSTNAME 1 .Os .Sh NAME @@ -38,7 +38,7 @@ .Sh SYNOPSIS .Nm .Op Fl f -.Op Fl s|d +.Op Fl s | d .Op Ar name-of-host .Sh DESCRIPTION The Modified: head/bin/hostname/hostname.c ============================================================================== --- head/bin/hostname/hostname.c Wed Nov 9 04:07:15 2016 (r308458) +++ head/bin/hostname/hostname.c Wed Nov 9 04:42:09 2016 (r308459) @@ -108,6 +108,6 @@ static void usage(void) { - (void)fprintf(stderr, "usage: hostname [-f] [s|d] [name-of-host]\n"); + (void)fprintf(stderr, "usage: hostname [-f] [-s | -d] [name-of-host]\n"); exit(1); } From owner-svn-src-all@freebsd.org Wed Nov 9 04:42:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E013FC3732E; Wed, 9 Nov 2016 04:42:19 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-yw0-x22f.google.com (mail-yw0-x22f.google.com [IPv6:2607:f8b0:4002:c05::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5B2FAD5; Wed, 9 Nov 2016 04:42:19 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by mail-yw0-x22f.google.com with SMTP id r204so201884483ywb.0; Tue, 08 Nov 2016 20:42:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc; bh=uFsDqUeYAEGd89Nsx0VN9cW6wwpauG5xp8WQuzq2KN4=; b=xeWKwyU6dsuEpEf9Drfbq6GW/5q9yuwo/ZZVHpNlg4KSoeT8R+4nu8dFrqmNyXT4ED l5j5g5AfOyC/IAszuHsJ9uc/f2aGUdwj01NB8sUgJ/0FCrGjrVPhAYMj6nbZ+pdZYBoO Y/JzJeAD0KR5EhbAFPsL0TbbWT5r82t0r77DhV48XTz4ft/u9yx1K0NJ7HlsjesKGdcF tehYCBLl65GZlwW7+JRxV8jFBg4ay0I3kzc+XLEK0e2LrERZnfLseCUHWwm4w45zYFRo Ktv9MbpGq88Mm8+xW9sL2XlTQRVg6ev+OR8s8zci9VfqoRy2hq39/2f8sVYfWfz5D/o8 7GEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=uFsDqUeYAEGd89Nsx0VN9cW6wwpauG5xp8WQuzq2KN4=; b=mG5d9GxIpprw8gDr6MHY16zoK8aaYTyXD6/po8pF3GSVu1BfFmZijkqyOH6za4MBne 1ccuyIly4dCxOTAWNK0xkY2xfxIMJ1yAvOFLiZ3WuZEebMZI+L03Dv3tsXDsusrZ8OOg NV1sWoLOw+N6ClgMRHwk3ttYNio7tta+PKCOebj2XZ285BrAyOWlPhx8uGNO37eLHyHt iaN26hYyMKrvZVWSur43CNJVE1sdQzNi/KximJGKHMxzC6+P5FgQ4Okx3nILaTi5UtcF NZbVEED6WIi7C9bCFjARQIFHIBr9n+1BFxEMWtAnnGv8qiUbEwD0enUD+L5dCfIF2DyH 89Fw== X-Gm-Message-State: ABUngvdKL12vfmmXYagbw3v7VFpFlBCTTg5QBrOlgTAz6EqYZfMUJsrypTKVyp5P8A8EVI9Y2QuNqki7RT0vEA== X-Received: by 10.129.98.65 with SMTP id w62mr15145520ywb.38.1478666538477; Tue, 08 Nov 2016 20:42:18 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.133.131 with HTTP; Tue, 8 Nov 2016 20:42:18 -0800 (PST) Reply-To: araujo@freebsd.org In-Reply-To: <20161109115729.F924@besplex.bde.org> References: <201611081136.uA8BaXrs073937@repo.freebsd.org> <20161109115729.F924@besplex.bde.org> From: Marcelo Araujo Date: Wed, 9 Nov 2016 12:42:18 +0800 Message-ID: Subject: Re: svn commit: r308443 - head/bin/hostname To: Bruce Evans Cc: Renato Botelho , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 04:42:20 -0000 Fixed, thanks! 2016-11-09 9:39 GMT+08:00 Bruce Evans : > On Tue, 8 Nov 2016, Renato Botelho wrote: > > On 8 Nov 2016, at 09:36, Marcelo Araujo wrote: >>> >>> Log: >>> Add -d flag that prints domain only. >>> >>> PR: 212875 >>> Submitted by: Ben RUBSON >>> Reviewed by: pi >>> >> > This has many style bugs. > > > Modified: >>> head/bin/hostname/hostname.1 >>> head/bin/hostname/hostname.c >>> >>> Modified: head/bin/hostname/hostname.1 >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> --- head/bin/hostname/hostname.1 Tue Nov 8 10:10:55 2016 >>> (r308442) >>> +++ head/bin/hostname/hostname.1 Tue Nov 8 11:36:33 2016 >>> (r308443) >>> @@ -29,7 +29,7 @@ >>> .\" @(#)hostname.1 8.2 (Berkeley) 4/28/95 >>> .\" $FreeBSD$ >>> .\" >>> -.Dd December 7, 2006 >>> +.Dd November 9, 2016 >>> .Dt HOSTNAME 1 >>> .Os >>> .Sh NAME >>> @@ -37,7 +37,8 @@ >>> .Nd set or print name of current host system >>> .Sh SYNOPSIS >>> .Nm >>> -.Op Fl fs >>> +.Op Fl f >>> +.Op Fl s|d >>> .Op Ar name-of-host >>> .Sh DESCRIPTION >>> The >>> @@ -62,6 +63,8 @@ This is the default behavior. >>> .It Fl s >>> Trim off any domain information from the printed >>> name. >>> +.It Fl d >>> +Only print domain information. >>> .El >>> .Sh SEE ALSO >>> .Xr gethostname 3 , >>> >>> Modified: head/bin/hostname/hostname.c >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> --- head/bin/hostname/hostname.c Tue Nov 8 10:10:55 2016 >>> (r308442) >>> +++ head/bin/hostname/hostname.c Tue Nov 8 11:36:33 2016 >>> (r308443) >>> @@ -54,11 +54,12 @@ static void usage(void) __dead2; >>> int >>> main(int argc, char *argv[]) >>> { >>> - int ch, sflag; >>> + int ch, sflag, dflag; >>> char *p, hostname[MAXHOSTNAMELEN]; >>> >>> sflag =3D 0; >>> - while ((ch =3D getopt(argc, argv, "fs")) !=3D -1) >>> + dflag =3D 0; >>> + while ((ch =3D getopt(argc, argv, "fsd")) !=3D -1) >>> switch (ch) { >>> case 'f': >>> /* >>> @@ -70,6 +71,9 @@ main(int argc, char *argv[]) >>> case 's': >>> sflag =3D 1; >>> break; >>> + case 'd': >>> + dflag =3D 1; >>> + break; >>> case '?': >>> default: >>> usage(); >>> @@ -77,7 +81,7 @@ main(int argc, char *argv[]) >>> argc -=3D optind; >>> argv +=3D optind; >>> >>> - if (argc > 1) >>> + if (argc > 1 || (sflag && dflag)) >>> usage(); >>> >>> if (*argv) { >>> @@ -90,6 +94,10 @@ main(int argc, char *argv[]) >>> p =3D strchr(hostname, '.'); >>> if (p !=3D NULL) >>> *p =3D '\0'; >>> + } else if (dflag) { >>> + p =3D strchr(hostname, '.'); >>> + if (p !=3D NULL) >>> + strcpy(hostname, ++p); >>> } >>> (void)printf("%s\n", hostname); >>> } >>> @@ -100,6 +108,6 @@ static void >>> usage(void) >>> { >>> >>> - (void)fprintf(stderr, "usage: hostname [-fs] [name-of-host]\n")= ; >>> + (void)fprintf(stderr, "usage: hostname [-f] [s|d] >>> [name-of-host]\n"); >>> >> >> >> It=E2=80=99s missing =E2=80=98-=E2=80=98 sign on [s|d] block, what makes= message a bit confused >> IMO. Maybe [-s|-d] would be more clear. >> > > Both are wrong. > > This is also broken in the man page, where the '|' is literal and > misformatted. Normal markup would give '[-d | -s]' in the man page, and > this should be copied to the usage message. Hard-coding the '|' using > 's|d' gives the different syntax error of a hyphen before the 's'but no > hyphen before the 's' ('[-s|d]'). > > The hard-coding has 2 other bugs: > - missing spaces around '|' > - d and s are unsorted > > d and s are unsorted consistently in about 8 instances in the patch. > > The correct order for sorting -f and [-d | -s] in the synopsis and > usage message is unclear. It would be best to put -f after -d and keep > -s attached to -d, but with longer options list this takes too much > space by splitting up the single-letter options. > > Bruce --=20 --=20 Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_) From owner-svn-src-all@freebsd.org Wed Nov 9 05:27:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62230C37018; Wed, 9 Nov 2016 05:27:56 +0000 (UTC) (envelope-from lists.br@gmail.com) Received: from mail-yb0-x22b.google.com (mail-yb0-x22b.google.com [IPv6:2607:f8b0:4002:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 33A0DED7; Wed, 9 Nov 2016 05:27:56 +0000 (UTC) (envelope-from lists.br@gmail.com) Received: by mail-yb0-x22b.google.com with SMTP id v78so75030982ybe.3; Tue, 08 Nov 2016 21:27:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Od0XO94SDrHTOH7iSXiphpSMQH8QVG/S7njPOFaFPtM=; b=0/l8nztiLJGNbWMubjNl2ahG9EnFUoDKwj1jkMxGyWmEl4eaKs6UzkfwFg4AFR2nUt 65oLXQQuvA19w9ckqgReIDUkYhIkvnCCr2Vl6AQBDunGjMashkV51ZUeaErU6VV+YzGK /qjr8WjWHcJiPBP8pnR9MU/w6eE1j32ZXd7kMDOD3OyPf4JvXcy+Q4mt5l70LUWBbAFD QijJMXwVJQM9ONNjAAR/kY23fTLil9aUCG/5QdU1wYj0/0UQTiJXXTaC3SkOCvNJRVpU zbP9eL+6/yqfS9J9XtNREM4WOWABhlb/1wz7JluBTsx1BTcB0eEH8Nu6TPcE0A57oK1F Ni/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Od0XO94SDrHTOH7iSXiphpSMQH8QVG/S7njPOFaFPtM=; b=eszmnAZn1hE+Io6hmF3sZbuLDo+Cex1Mz/Rg15mHaCFryVf8Qhxy1viQkg/THZYNUH uqkITG5cNSyOa6PMwWgY5h5cTJOLS3AvhMhGy3vEg3f5Bql5G/yGsEV0Z+1xh3s25NSO DIQoxpZI3izCxHGPvY8S1K0sw1XYVAM+xJCxiI1F/fbiJhOVL+t61WYfdtnLXAn4Zb94 RTS5Q1CAOgHyZiBWBztpPGUe+73SgrTG5v+ZoNOJMSwJCEoLQ8Sxt3MA0kdHZs1uX+G7 PWZ0Q1pEERjvAH0xhomqgjIwTceMtsJFVHpVi8zhiDBtNdToY/WwI33Yvotfi5TL+h3V jGyA== X-Gm-Message-State: ABUngvewDPJidprVnUpb/KENTDQ3bLWgwK9pL/YgTyYHFGZJGuw2PMvam8FX+Xu3E1NzZPhZ3PK5inlvklcELw== X-Received: by 10.37.0.137 with SMTP id 131mr16038742yba.87.1478669275260; Tue, 08 Nov 2016 21:27:55 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.162.88 with HTTP; Tue, 8 Nov 2016 21:27:54 -0800 (PST) In-Reply-To: <20161109052656.76911ada273bb14048bb999b@bidouilliste.com> References: <201611090407.uA947Fnu065307@repo.freebsd.org> <20161109052656.76911ada273bb14048bb999b@bidouilliste.com> From: Luiz Otavio O Souza Date: Wed, 9 Nov 2016 03:27:54 -0200 Message-ID: Subject: Re: svn commit: r308458 - in head/sys: boot/fdt/dts/arm modules/dtb/am335x To: Emmanuel Vadot Cc: Luiz Otavio O Souza , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 05:27:56 -0000 On 9 November 2016 at 02:26, Emmanuel Vadot wrote: > On Wed, 9 Nov 2016 04:07:15 +0000 (UTC) > Luiz Otavio O Souza wrote: > >> Author: loos >> Date: Wed Nov 9 04:07:15 2016 >> New Revision: 308458 >> URL: https://svnweb.freebsd.org/changeset/base/308458 >> >> Log: >> Add the DTS for the Netgate SG-1000 (micro-Firewall). >> >> The SG-1000 boots with GENERIC ARM kernel on -head. >> >> Obtained from: pfSense >> Sponsored by: Rubicon Communications, LLC (Netgate) >> >> Added: >> head/sys/boot/fdt/dts/arm/ubmc.dtsi (contents, props changed) >> head/sys/boot/fdt/dts/arm/ufw.dts (contents, props changed) >> Modified: >> head/sys/modules/dtb/am335x/Makefile > > Hello Luiz, > > Two things: > > - If ubmc.dtsi is gnu licenced it shouldn't go in sys/boot/fdt/dts. > It shouldn't go to sys/gnu/dts too as it's not from upstream. > - I don't understand why you didn't use the am33xx.dtsi from > upstream, it is the way to go for dts. > > The correct way to add support for this board would be : > > 1) Create a ubmc.dtsi that uses upstream am33xx.dtsi and submit it > upstream (i.e. linux-arm), MIT/GPL dual licence > 2) Create a ufw.dts and also submit it upstream (also MIT/GPL) > 3) Since those are also MIT you could add them to sys/boot/fdt > 4) When we will update the dts from upstream you can then remove them > from sys/boot/fdt > > But there would still be a problem since the am33xx.dtsi is not MIT/GPL > licenced. > So I guess you don't have any other solution than dealing with DTS > somewhere in the pfsense repository (maybe with package or something). > > The DTS world is already a mess with it's licence and the fact that > linux is the "official" place, so please do not add more :) Hi Emmanuel, Yes, you're right. I forgot about the licence in this file. This is not an issue for us in pfSense (we do not depend on this change in FreeBSD), we want to provide support for the people that is going to use/test FreeBSD on uFW. As this is all our work, I'll redo the files and include our changes in a single file. FreeBSD is the upstream here, it is the first officially supported OS for uFW. Thanks, Luiz From owner-svn-src-all@freebsd.org Wed Nov 9 06:47:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91323C371E9; Wed, 9 Nov 2016 06:47:30 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50DF8EA5; Wed, 9 Nov 2016 06:47:30 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA96lTnH027829; Wed, 9 Nov 2016 06:47:29 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA96lTUs027828; Wed, 9 Nov 2016 06:47:29 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201611090647.uA96lTUs027828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Wed, 9 Nov 2016 06:47:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308460 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 06:47:30 -0000 Author: kevlo Date: Wed Nov 9 06:47:29 2016 New Revision: 308460 URL: https://svnweb.freebsd.org/changeset/base/308460 Log: Sort DLINK section and add USB device ID of D-Link DWA-131 rev E1. Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Wed Nov 9 04:42:09 2016 (r308459) +++ head/sys/dev/usb/usbdevs Wed Nov 9 06:47:29 2016 (r308460) @@ -1621,12 +1621,18 @@ product DLINK DUBE100 0x1a00 10/100 Eth product DLINK DUBE100C1 0x1a02 DUB-E100 rev C1 product DLINK DSB650TX4 0x200c 10/100 Ethernet product DLINK DWL120E 0x3200 DWL-120 rev E +product DLINK RTL8192CU_1 0x3307 RTL8192CU +product DLINK RTL8188CU 0x3308 RTL8188CU +product DLINK RTL8192CU_2 0x3309 RTL8192CU +product DLINK RTL8192CU_3 0x330a RTL8192CU +product DLINK DWA131B 0x330d DWA-131 rev B product DLINK DWA125D1 0x330f DWA-125 rev D1 product DLINK DWA123D1 0x3310 DWA-123 rev D1 product DLINK DWA171A1 0x3314 DWA-171 rev A1 product DLINK DWA182C1 0x3315 DWA-182 rev C1 product DLINK DWA180A1 0x3316 DWA-180 rev A1 product DLINK DWA172A1 0x3318 DWA-172 rev A1 +product DLINK DWA131E1 0x3319 DWA-131 rev E1 product DLINK DWL122 0x3700 DWL-122 product DLINK DWLG120 0x3701 DWL-G120 product DLINK DWL120F 0x3702 DWL-120 rev F @@ -1652,17 +1658,12 @@ product DLINK DSB650TX_PNA 0x4003 1/10/1 product DLINK DSB650TX3 0x400b 10/100 Ethernet product DLINK DSB650TX2 0x4102 10/100 Ethernet product DLINK DUB1312 0x4a00 10/100/1000 Ethernet -product DLINK DSB650 0xabc1 10/100 Ethernet -product DLINK DUBH7 0xf103 DUB-H7 USB 2.0 7-Port Hub -product DLINK DWR510_CD 0xa805 DWR-510 CD-ROM Mode -product DLINK DWR510 0x7e12 DWR-510 product DLINK DWM157 0x7d02 DWM-157 +product DLINK DWR510 0x7e12 DWR-510 product DLINK DWM157_CD 0xa707 DWM-157 CD-ROM Mode -product DLINK RTL8188CU 0x3308 RTL8188CU -product DLINK RTL8192CU_1 0x3307 RTL8192CU -product DLINK RTL8192CU_2 0x3309 RTL8192CU -product DLINK RTL8192CU_3 0x330a RTL8192CU -product DLINK DWA131B 0x330d DWA-131 rev B +product DLINK DWR510_CD 0xa805 DWR-510 CD-ROM Mode +product DLINK DSB650 0xabc1 10/100 Ethernet +product DLINK DUBH7 0xf103 DUB-H7 USB 2.0 7-Port Hub product DLINK2 RTL8192SU_1 0x3300 RTL8192SU product DLINK2 RTL8192SU_2 0x3302 RTL8192SU product DLINK2 DWA131A1 0x3303 DWA-131 A1 @@ -1673,8 +1674,8 @@ product DLINK2 DWA130D1 0x3a0f DWA-130 product DLINK2 DWLG122C1 0x3c03 DWL-G122 c1 product DLINK2 WUA1340 0x3c04 WUA-1340 product DLINK2 DWA111 0x3c06 DWA-111 -product DLINK2 RT2870_1 0x3c09 RT2870 product DLINK2 DWA110 0x3c07 DWA-110 +product DLINK2 RT2870_1 0x3c09 RT2870 product DLINK2 RT3072 0x3c0a RT3072 product DLINK2 RT3072_1 0x3c0b RT3072 product DLINK2 RT3070_1 0x3c0d RT3070 @@ -4477,6 +4478,7 @@ product TOSHIBA TRANSMEMORY 0x6545 USB T /* TP-Link products */ product TPLINK T4U 0x0101 Archer T4U +product TPLINK WN823NV2 0x0109 TL-WN823N v2 /* Trek Technology products */ product TREK THUMBDRIVE 0x1111 ThumbDrive From owner-svn-src-all@freebsd.org Wed Nov 9 07:09:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77FD7C3797C; Wed, 9 Nov 2016 07:09:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49AECCBB; Wed, 9 Nov 2016 07:09:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA979RGf035473; Wed, 9 Nov 2016 07:09:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA979RAZ035472; Wed, 9 Nov 2016 07:09:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611090709.uA979RAZ035472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 9 Nov 2016 07:09:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308461 - head/sys/dev/sound/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 07:09:28 -0000 Author: hselasky Date: Wed Nov 9 07:09:27 2016 New Revision: 308461 URL: https://svnweb.freebsd.org/changeset/base/308461 Log: Allow higher sample rates to have more jitter than lower ones. PR: 208791 MFC after: 3 days Modified: head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Wed Nov 9 06:47:29 2016 (r308460) +++ head/sys/dev/sound/usb/uaudio.c Wed Nov 9 07:09:27 2016 (r308461) @@ -2079,6 +2079,8 @@ uaudio_chan_play_sync_callback(struct us * recording channel: */ if (ch->priv_sc->sc_rec_chan.num_alt == 0) { + int32_t jitter_max = howmany(sample_rate, 16000); + /* * Range check the jitter values to avoid * bogus sample rate adjustments. The expected @@ -2087,12 +2089,11 @@ uaudio_chan_play_sync_callback(struct us * mandates this requirement. Refer to chapter * 5.12.4.2 about feedback. */ - if (temp > sample_rate) - ch->jitter_curr = 1; - else if (temp < sample_rate) - ch->jitter_curr = -1; - else - ch->jitter_curr = 0; + ch->jitter_curr = temp - sample_rate; + if (ch->jitter_curr > jitter_max) + ch->jitter_curr = jitter_max; + else if (ch->jitter_curr < -jitter_max) + ch->jitter_curr = -jitter_max; } ch->feedback_rate = temp; break; From owner-svn-src-all@freebsd.org Wed Nov 9 07:31:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97689C37F6C; Wed, 9 Nov 2016 07:31:40 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C17B7EA; Wed, 9 Nov 2016 07:31:40 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA97VdJT044288; Wed, 9 Nov 2016 07:31:39 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA97Vd0h044286; Wed, 9 Nov 2016 07:31:39 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201611090731.uA97Vd0h044286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Wed, 9 Nov 2016 07:31:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308462 - head/usr.sbin/gstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 07:31:40 -0000 Author: araujo Date: Wed Nov 9 07:31:39 2016 New Revision: 308462 URL: https://svnweb.freebsd.org/changeset/base/308462 Log: Add flag -B which does the same like batch mode but without exiting after print. Also add a new flag -s that add blocks size to statistics. PR: 198347, 212726 Submitted by: Ben RUBSON Tested by: pi MFC After: 2 weeks. Modified: head/usr.sbin/gstat/gstat.8 head/usr.sbin/gstat/gstat.c Modified: head/usr.sbin/gstat/gstat.8 ============================================================================== --- head/usr.sbin/gstat/gstat.8 Wed Nov 9 07:09:27 2016 (r308461) +++ head/usr.sbin/gstat/gstat.8 Wed Nov 9 07:31:39 2016 (r308462) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 3, 2014 +.Dd November 10, 2016 .Dt GSTAT 8 .Os .Sh NAME @@ -32,7 +32,7 @@ .Nd print statistics about GEOM disks .Sh SYNOPSIS .Nm -.Op Fl abcdop +.Op Fl abBcdops .Op Fl f Ar filter .Op Fl I Ar interval .Sh DESCRIPTION @@ -50,6 +50,10 @@ Only display providers that are at least Batch mode. Collect numbers, print and exit. Default if stdout is not a tty. +.It Fl B +Endless batch mode. +Same as batch mode, but does not exit after collecting +the first set of data. .It Fl c Enable display of .Xr geom 4 @@ -72,6 +76,8 @@ The format of the regular expression is .It Fl o Enable display of statistics for other operations .Pq Dv BIO_FLUSH . +.It Fl s +Enable blocks' size statistics. .It Fl I Ar interval Refresh the .Nm Modified: head/usr.sbin/gstat/gstat.c ============================================================================== --- head/usr.sbin/gstat/gstat.c Wed Nov 9 07:09:27 2016 (r308461) +++ head/usr.sbin/gstat/gstat.c Wed Nov 9 07:31:39 2016 (r308462) @@ -51,11 +51,11 @@ #include #include -static int flag_a, flag_b, flag_c, flag_d, flag_o, flag_p; +static int flag_a, flag_b, flag_B, flag_c, flag_d, flag_o, flag_p, flag_s; static int flag_I = 1000000; #define PRINTMSG(...) do { \ - if (flag_b && !loop) \ + if ((flag_b && !loop) || (flag_B)) \ printf(__VA_ARGS__); \ else if (!flag_b) \ printw(__VA_ARGS__); \ @@ -88,7 +88,7 @@ main(int argc, char **argv) char *p; char f_s[100], pf_s[100], tmp_f_s[100]; const char *line; - long double ld[13]; + long double ld[16]; uint64_t u64; EditLine *el; History *hist; @@ -104,7 +104,7 @@ main(int argc, char **argv) flag_b = 1; f_s[0] = '\0'; - while ((i = getopt(argc, argv, "abdcf:I:op")) != -1) { + while ((i = getopt(argc, argv, "abBdcf:I:ops")) != -1) { switch (i) { case 'a': flag_a = 1; @@ -112,6 +112,10 @@ main(int argc, char **argv) case 'b': flag_b = 1; break; + case 'B': + flag_B = 1; + flag_b = 1; + break; case 'c': flag_c = 1; break; @@ -146,6 +150,9 @@ main(int argc, char **argv) case 'p': flag_p = 1; break; + case 's': + flag_s = 1; + break; case '?': default: usage(); @@ -208,7 +215,8 @@ main(int argc, char **argv) geom_stats_snapshot_reset(sp); geom_stats_snapshot_reset(sq); - move(0,0); + if (!flag_b) + move(0,0); PRINTMSG("dT: %5.3fs w: %.3fs", dt, (float)flag_I / 1000000); if (f_s[0] != '\0') { PRINTMSG(" filter: "); @@ -231,10 +239,20 @@ main(int argc, char **argv) } PRINTMSG("\n"); PRINTMSG(" L(q) ops/s "); - PRINTMSG(" r/s kBps ms/r "); - PRINTMSG(" w/s kBps ms/w "); - if (flag_d) - PRINTMSG(" d/s kBps ms/d "); + if (flag_s) { + PRINTMSG(" r/s kB kBps ms/r "); + PRINTMSG(" w/s kB kBps ms/w "); + } + else { + PRINTMSG(" r/s kBps ms/r "); + PRINTMSG(" w/s kBps ms/w "); + } + if (flag_d) { + if (flag_s) + PRINTMSG(" d/s kB kBps ms/d "); + else + PRINTMSG(" d/s kBps ms/d "); + } if (flag_o) PRINTMSG(" o/s ms/o "); PRINTMSG("%%busy Name\n"); @@ -298,6 +316,10 @@ main(int argc, char **argv) DSM_TRANSFERS_PER_SECOND_OTHER, &ld[11], DSM_MS_PER_TRANSACTION_OTHER, &ld[12], + DSM_KB_PER_TRANSFER_READ, &ld[13], + DSM_KB_PER_TRANSFER_WRITE, &ld[14], + DSM_KB_PER_TRANSFER_FREE, &ld[15], + DSM_NONE); if (flag_a && ld[7] < 0.1) { @@ -308,12 +330,16 @@ main(int argc, char **argv) PRINTMSG(" %4ju", (uintmax_t)u64); PRINTMSG(" %6.0f", (double)ld[0]); PRINTMSG(" %6.0f", (double)ld[1]); + if (flag_s) + PRINTMSG(" %6.0f", (double)ld[13]); PRINTMSG(" %6.0f", (double)ld[2] * 1024); if (ld[3] > 1e3) PRINTMSG(" %6.0f", (double)ld[3]); else PRINTMSG(" %6.1f", (double)ld[3]); PRINTMSG(" %6.0f", (double)ld[4]); + if (flag_s) + PRINTMSG(" %6.0f", (double)ld[14]); PRINTMSG(" %6.0f", (double)ld[5] * 1024); if (ld[6] > 1e3) PRINTMSG(" %6.0f", (double)ld[6]); @@ -322,6 +348,8 @@ main(int argc, char **argv) if (flag_d) { PRINTMSG(" %6.0f", (double)ld[8]); + if (flag_s) + PRINTMSG(" %6.0f", (double)ld[15]); PRINTMSG(" %6.0f", (double)ld[9] * 1024); if (ld[10] > 1e3) PRINTMSG(" %6.0f", (double)ld[10]); @@ -373,7 +401,10 @@ main(int argc, char **argv) /* We loop extra to make sure we get the information. */ if (!loop) break; - loop = 0; + if (!flag_B) + loop = 0; + else + fflush(stdout); usleep(flag_I); continue; } @@ -452,7 +483,7 @@ main(int argc, char **argv) static void usage(void) { - fprintf(stderr, "usage: gstat [-abcdp] [-f filter] [-I interval]\n"); + fprintf(stderr, "usage: gstat [-abBcdps] [-f filter] [-I interval]\n"); exit(EX_USAGE); /* NOTREACHED */ } From owner-svn-src-all@freebsd.org Wed Nov 9 08:08:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D35B3C37D4E; Wed, 9 Nov 2016 08:08:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 951EAB16; Wed, 9 Nov 2016 08:08:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA9882Ba059015; Wed, 9 Nov 2016 08:08:02 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA9882MM059014; Wed, 9 Nov 2016 08:08:02 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201611090808.uA9882MM059014@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 9 Nov 2016 08:08:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308463 - stable/11/contrib/llvm/lib/Target/AArch64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 08:08:03 -0000 Author: dim Date: Wed Nov 9 08:08:02 2016 New Revision: 308463 URL: https://svnweb.freebsd.org/changeset/base/308463 Log: MFC r308375: Pull in r278002 from upstream llvm trunk (by Silviu Baranga): [AArch64] PR28877: Don't assume we're running after legalization when creating vcvtfp2fxs Summary: The DAG combine transformation that was generating the aarch64_neon_vcvtfp2fxs node was assuming that all inputs where legal and wasn't accounting that the input could be a v4f64 if we're trying to do the transformation before legalization. We now bail out in this case. All illegal types besides v4f64 were already rejected. Fixes https://llvm.org/bugs/show_bug.cgi?id=28877 Reviewers: jmolloy Subscribers: aemerson, rengolin, llvm-commits Differential Revision: https://reviews.llvm.org/D23261 This fixes several ports on AArch64. Requested by: andrew Modified: stable/11/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Wed Nov 9 07:31:39 2016 (r308462) +++ stable/11/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Wed Nov 9 08:08:02 2016 (r308463) @@ -7562,6 +7562,7 @@ static SDValue performIntToFpCombine(SDN /// Fold a floating-point multiply by power of two into floating-point to /// fixed-point conversion. static SDValue performFpToIntCombine(SDNode *N, SelectionDAG &DAG, + TargetLowering::DAGCombinerInfo &DCI, const AArch64Subtarget *Subtarget) { if (!Subtarget->hasNEON()) return SDValue(); @@ -7604,10 +7605,16 @@ static SDValue performFpToIntCombine(SDN ResTy = FloatBits == 32 ? MVT::v2i32 : MVT::v2i64; break; case 4: - ResTy = MVT::v4i32; + ResTy = FloatBits == 32 ? MVT::v4i32 : MVT::v4i64; break; } + if (ResTy == MVT::v4i64 && DCI.isBeforeLegalizeOps()) + return SDValue(); + + assert((ResTy != MVT::v4i64 || DCI.isBeforeLegalizeOps()) && + "Illegal vector type after legalization"); + SDLoc DL(N); bool IsSigned = N->getOpcode() == ISD::FP_TO_SINT; unsigned IntrinsicOpcode = IsSigned ? Intrinsic::aarch64_neon_vcvtfp2fxs @@ -9711,7 +9718,7 @@ SDValue AArch64TargetLowering::PerformDA return performIntToFpCombine(N, DAG, Subtarget); case ISD::FP_TO_SINT: case ISD::FP_TO_UINT: - return performFpToIntCombine(N, DAG, Subtarget); + return performFpToIntCombine(N, DAG, DCI, Subtarget); case ISD::FDIV: return performFDivCombine(N, DAG, Subtarget); case ISD::OR: From owner-svn-src-all@freebsd.org Wed Nov 9 08:58:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67DA8C35A8A; Wed, 9 Nov 2016 08:58:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 203175E3; Wed, 9 Nov 2016 08:58:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA98w0fW078814; Wed, 9 Nov 2016 08:58:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA98vxUV078805; Wed, 9 Nov 2016 08:57:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611090857.uA98vxUV078805@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 9 Nov 2016 08:57:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308464 - in head/sys/dev: ichsmb sound/pci/hda usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 08:58:01 -0000 Author: mav Date: Wed Nov 9 08:57:59 2016 New Revision: 308464 URL: https://svnweb.freebsd.org/changeset/base/308464 Log: Add some device IDs found in my new laptop. Modified: head/sys/dev/ichsmb/ichsmb_pci.c head/sys/dev/sound/pci/hda/hdac.c head/sys/dev/sound/pci/hda/hdac.h head/sys/dev/sound/pci/hda/hdacc.c head/sys/dev/usb/controller/xhci_pci.c Modified: head/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- head/sys/dev/ichsmb/ichsmb_pci.c Wed Nov 9 08:08:02 2016 (r308463) +++ head/sys/dev/ichsmb/ichsmb_pci.c Wed Nov 9 08:57:59 2016 (r308464) @@ -93,6 +93,7 @@ __FBSDID("$FreeBSD$"); #define ID_WCPTLP 0x9ca28086 #define ID_WELLSBURG 0x8d228086 #define ID_SRPT 0xa1238086 +#define ID_SRPTLP 0x9d238086 #define PCIS_SERIALBUS_SMBUS_PROGIF 0x00 @@ -220,6 +221,9 @@ ichsmb_pci_probe(device_t dev) case ID_SRPT: device_set_desc(dev, "Intel Sunrise Point-H SMBus controller"); break; + case ID_SRPTLP: + device_set_desc(dev, "Intel Sunrise Point-LP SMBus controller"); + break; default: return (ENXIO); } Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Wed Nov 9 08:08:02 2016 (r308463) +++ head/sys/dev/sound/pci/hda/hdac.c Wed Nov 9 08:57:59 2016 (r308464) @@ -94,7 +94,9 @@ static const struct { { HDA_INTEL_LPTLP1, "Intel Lynx Point-LP", 0, 0 }, { HDA_INTEL_LPTLP2, "Intel Lynx Point-LP", 0, 0 }, { HDA_INTEL_SRPTLP, "Intel Sunrise Point-LP", 0, 0 }, + { HDA_INTEL_KBLKLP, "Intel Kabylake-LP", 0, 0 }, { HDA_INTEL_SRPT, "Intel Sunrise Point", 0, 0 }, + { HDA_INTEL_KBLK, "Intel Kabylake", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0, 0 }, Modified: head/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.h Wed Nov 9 08:08:02 2016 (r308463) +++ head/sys/dev/sound/pci/hda/hdac.h Wed Nov 9 08:57:59 2016 (r308464) @@ -70,7 +70,9 @@ #define HDA_INTEL_LPTLP2 HDA_MODEL_CONSTRUCT(INTEL, 0x9c21) #define HDA_INTEL_BDW2 HDA_MODEL_CONSTRUCT(INTEL, 0x9ca0) #define HDA_INTEL_SRPTLP HDA_MODEL_CONSTRUCT(INTEL, 0x9d70) +#define HDA_INTEL_KBLKLP HDA_MODEL_CONSTRUCT(INTEL, 0x9d71) #define HDA_INTEL_SRPT HDA_MODEL_CONSTRUCT(INTEL, 0xa170) +#define HDA_INTEL_KBLK HDA_MODEL_CONSTRUCT(INTEL, 0xa171) #define HDA_INTEL_ALL HDA_MODEL_CONSTRUCT(INTEL, 0xffff) /* Nvidia */ @@ -348,6 +350,7 @@ #define HDA_CODEC_ALC275 HDA_CODEC_CONSTRUCT(REALTEK, 0x0275) #define HDA_CODEC_ALC276 HDA_CODEC_CONSTRUCT(REALTEK, 0x0276) #define HDA_CODEC_ALC292 HDA_CODEC_CONSTRUCT(REALTEK, 0x0292) +#define HDA_CODEC_ALC295 HDA_CODEC_CONSTRUCT(REALTEK, 0x0295) #define HDA_CODEC_ALC660 HDA_CODEC_CONSTRUCT(REALTEK, 0x0660) #define HDA_CODEC_ALC662 HDA_CODEC_CONSTRUCT(REALTEK, 0x0662) #define HDA_CODEC_ALC663 HDA_CODEC_CONSTRUCT(REALTEK, 0x0663) @@ -633,6 +636,8 @@ #define HDA_CODEC_INTELPPT HDA_CODEC_CONSTRUCT(INTEL, 0x2806) #define HDA_CODEC_INTELHSW HDA_CODEC_CONSTRUCT(INTEL, 0x2807) #define HDA_CODEC_INTELBDW HDA_CODEC_CONSTRUCT(INTEL, 0x2808) +#define HDA_CODEC_INTELSKLK HDA_CODEC_CONSTRUCT(INTEL, 0x2809) +#define HDA_CODEC_INTELKBLK HDA_CODEC_CONSTRUCT(INTEL, 0x280b) #define HDA_CODEC_INTELCL HDA_CODEC_CONSTRUCT(INTEL, 0x29fb) #define HDA_CODEC_INTELXXXX HDA_CODEC_CONSTRUCT(INTEL, 0xffff) Modified: head/sys/dev/sound/pci/hda/hdacc.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdacc.c Wed Nov 9 08:08:02 2016 (r308463) +++ head/sys/dev/sound/pci/hda/hdacc.c Wed Nov 9 08:57:59 2016 (r308464) @@ -88,6 +88,7 @@ static const struct { { HDA_CODEC_ALC275, 0, "Realtek ALC275" }, { HDA_CODEC_ALC276, 0, "Realtek ALC276" }, { HDA_CODEC_ALC292, 0, "Realtek ALC292" }, + { HDA_CODEC_ALC295, 0, "Realtek ALC295" }, { HDA_CODEC_ALC660, 0, "Realtek ALC660-VD" }, { HDA_CODEC_ALC662, 0x0002, "Realtek ALC662 rev2" }, { HDA_CODEC_ALC662, 0, "Realtek ALC662" }, @@ -321,6 +322,8 @@ static const struct { { HDA_CODEC_INTELPPT, 0, "Intel Panther Point" }, { HDA_CODEC_INTELHSW, 0, "Intel Haswell" }, { HDA_CODEC_INTELBDW, 0, "Intel Broadwell" }, + { HDA_CODEC_INTELSKLK, 0, "Intel Kabylake" }, + { HDA_CODEC_INTELKBLK, 0, "Intel Kabylake" }, { HDA_CODEC_INTELCL, 0, "Intel Crestline" }, { HDA_CODEC_SII1390, 0, "Silicon Image SiI1390" }, { HDA_CODEC_SII1392, 0, "Silicon Image SiI1392" }, Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Wed Nov 9 08:08:02 2016 (r308463) +++ head/sys/dev/usb/controller/xhci_pci.c Wed Nov 9 08:57:59 2016 (r308464) @@ -122,6 +122,8 @@ xhci_pci_match(device_t self) return ("Intel Wellsburg USB 3.0 controller"); case 0x9cb18086: return ("Broadwell Integrated PCH-LP chipset USB 3.0 controller"); + case 0x9d2f8086: + return ("Intel Sunrise Point-LP USB 3.0 controller"); case 0xa12f8086: return ("Intel Sunrise Point USB 3.0 controller"); From owner-svn-src-all@freebsd.org Wed Nov 9 14:50:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75557C383EC; Wed, 9 Nov 2016 14:50:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 55AC3A84; Wed, 9 Nov 2016 14:50:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 79BCC10A728; Wed, 9 Nov 2016 09:50:47 -0500 (EST) From: John Baldwin To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, kan@freebsd.org Subject: Re: svn commit: r308430 - head/contrib/elftoolchain/libelftc Date: Tue, 08 Nov 2016 15:37:47 -0800 Message-ID: <2183706.KJxf8SBB7q@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201611072241.uA7MfqgC065929@repo.freebsd.org> References: <201611072241.uA7MfqgC065929@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 09 Nov 2016 09:50:47 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 14:50:49 -0000 On Monday, November 07, 2016 10:41:52 PM Ed Maste wrote: > Author: emaste > Date: Mon Nov 7 22:41:52 2016 > New Revision: 308430 > URL: https://svnweb.freebsd.org/changeset/base/308430 > > Log: > libelftc: add elf{32,64}-tradbigmips target emulation names Should elfXX-tradlittlemips be added as well? -- John Baldwin From owner-svn-src-all@freebsd.org Wed Nov 9 15:04:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66B28C3871F; Wed, 9 Nov 2016 15:04:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 360352E9; Wed, 9 Nov 2016 15:04:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA9F4Tkj024144; Wed, 9 Nov 2016 15:04:29 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA9F4Tl7024143; Wed, 9 Nov 2016 15:04:29 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201611091504.uA9F4Tl7024143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 9 Nov 2016 15:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308465 - head/contrib/elftoolchain/cxxfilt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 15:04:30 -0000 Author: emaste Date: Wed Nov 9 15:04:29 2016 New Revision: 308465 URL: https://svnweb.freebsd.org/changeset/base/308465 Log: c++filt: flush output after newline Some tools spawn c++filt and pass it a single line at a time for demangling. This is akin to r276689 for addr2line. Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/cxxfilt/cxxfilt.c Modified: head/contrib/elftoolchain/cxxfilt/cxxfilt.c ============================================================================== --- head/contrib/elftoolchain/cxxfilt/cxxfilt.c Wed Nov 9 08:57:59 2016 (r308464) +++ head/contrib/elftoolchain/cxxfilt/cxxfilt.c Wed Nov 9 15:04:29 2016 (r308465) @@ -188,6 +188,8 @@ main(int argc, char **argv) if (c == EOF) break; putchar(c); + if (c == '\n') + fflush(stdout); } else { if ((size_t) p >= sizeof(buf) - 1) warnx("buffer overflowed"); From owner-svn-src-all@freebsd.org Wed Nov 9 15:09:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 008DAC387AC; Wed, 9 Nov 2016 15:09:25 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0B98769; Wed, 9 Nov 2016 15:09:24 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 6C11910A722; Wed, 9 Nov 2016 10:09:22 -0500 (EST) From: John Baldwin To: Hans Petter Selasky Cc: Oleksandr Tymoshenko , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308424 - head/sys/arm/broadcom/bcm2835 Date: Wed, 09 Nov 2016 07:02:36 -0800 Message-ID: <3214848.geWV8qu7rM@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <201611071738.uA7HceYu045944@repo.freebsd.org> <680D84F2-65BF-48DD-8D11-311B1F65A634@freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 09 Nov 2016 10:09:22 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 15:09:25 -0000 On Monday, November 07, 2016 08:32:17 PM Hans Petter Selasky wrote: > On 11/07/16 20:23, Oleksandr Tymoshenko wrote: > > > >> On Nov 7, 2016, at 10:27 AM, Hans Petter Selasky = wrote: > >> > >> On 11/07/16 18:38, Oleksandr Tymoshenko wrote: > >>> +=09=09bcm2835_audio_unlock(sc); > >>> +=09=09cv_signal(&sc->worker_cv); > >> > >> > >> Shouldn't cv_signal() be done locked, so that you don't loose any = transactions? CV's only wakeup the treads that are sleeping right there= and then. > > > > Hi Hans, > > > > In this case it doesn=E2=80=99t matter. bcm2835_audio_xxx lock func= tions are used to keep channel state consistent. The actual audio hw re= programming happens in worker thread which only picks up latest state o= f the virtual channel, there is no need to run every transaction in seq= uence. > > >=20 > Hi, >=20 > It is not about running in sequence, but that if the worker thread is= =20 > not sleeping, but on the way to sleep, it will never get woken up unl= ess=20 > you use proper locks here! You do not have to hold locks across cv_signal/broadcast or wakeup. Yo= u do have to hold them across the check determining whether you should sleep= . Take this simple example: =09lock(&m); =09while (should_sleep) =09=09cv_wait(&cv, &m); =09unlock(&m); =09... =09lock(&m); =09should_sleep =3D true; =09unlock(&m); =09cv_signal(&cv); A thread that locks 'm' after the 'unlock' but before the cv_signal wil= l see 'should_sleep' as false and will not call cv_wait(). The cv_signal of = course might then wakeup a second thread prematurely, but that's why you shoul= d always use a while loop with cv wait operations (same is true with pthr= ead condvars btw). On the other hand, doing the wakeup outside of the lock= avoids preempting during the wakeup only to immediately block on the lo= ck and switch back to the thread that did the wakeup. --=20 John Baldwin From owner-svn-src-all@freebsd.org Wed Nov 9 16:05:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0927CC378F9; Wed, 9 Nov 2016 16:05:02 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5AD192E; Wed, 9 Nov 2016 16:05:00 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 1E8871FE022; Wed, 9 Nov 2016 17:04:58 +0100 (CET) Subject: Re: svn commit: r308424 - head/sys/arm/broadcom/bcm2835 To: John Baldwin References: <201611071738.uA7HceYu045944@repo.freebsd.org> <680D84F2-65BF-48DD-8D11-311B1F65A634@freebsd.org> <3214848.geWV8qu7rM@ralph.baldwin.cx> Cc: Oleksandr Tymoshenko , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky Message-ID: <5c170b6b-1189-4712-ffdd-653cc6b8c59e@selasky.org> Date: Wed, 9 Nov 2016 17:10:09 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <3214848.geWV8qu7rM@ralph.baldwin.cx> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 16:05:02 -0000 Hi, On 11/09/16 16:02, John Baldwin wrote: > On the other hand, doing the wakeup outside of the lock > avoids preempting during the wakeup only to immediately block on the lock and > switch back to the thread that did the wakeup. This can be predicted and avoided by the turnstiles iff cv_signal() is used under a lock. Else not. Won't doing the wakeup outside the lock cause double preemtion? First at mtx_unlock() and then inside cv_signal()/cv_broadcast(). --HPS From owner-svn-src-all@freebsd.org Wed Nov 9 16:06:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BECEC379B4; Wed, 9 Nov 2016 16:06:55 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from mail.samsco.org (suzi.samsco.org [96.84.242.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1EA71ADD; Wed, 9 Nov 2016 16:06:54 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from localhost (localhost [192.168.254.3]) by mail.samsco.org (Postfix) with ESMTP id D4A9215C1867E; Wed, 9 Nov 2016 16:06:47 +0000 (UTC) Received: from mail.samsco.org ([192.168.254.3]) by localhost (mail.samsco.org [192.168.254.3]) (maiad, port 10024) with ESMTP id 82995-09; Wed, 9 Nov 2016 16:06:47 +0000 (UTC) Received: from [172.19.248.94] (unknown [104.153.224.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: scottl@samsco.org) by mail.samsco.org (Postfix) with ESMTPSA id 172DD15C1867C; Wed, 9 Nov 2016 16:06:41 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r308217 - in head/sys/dev: mpr mps From: Scott Long In-Reply-To: <581C5249.2060104@omnilan.de> Date: Wed, 9 Nov 2016 09:06:29 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <161EBBC5-F642-4A05-9361-179B74CDA50A@samsco.org> References: <201611021513.uA2FDPk6062463@repo.freebsd.org> <581C5249.2060104@omnilan.de> To: Harry Schmalzbauer X-Mailer: Apple Mail (2.3251) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 16:06:55 -0000 > On Nov 4, 2016, at 3:18 AM, Harry Schmalzbauer = wrote: >=20 > Bez=C3=BCglich Scott Long's Nachricht vom 02.11.2016 16:13 = (localtime): >> Author: scottl >> Date: Wed Nov 2 15:13:25 2016 >> New Revision: 308217 >> URL: https://svnweb.freebsd.org/changeset/base/308217 >>=20 >> Log: >> Add a fallback to the device mapper logic. We've seen systems in = the field >> that are apparently misconfigured by the manufacturer and cause the = mapping >> logic to fail. The fallback allows drive numbers to be assigned = based on the >> PHY number that they're attached to. Add sysctls and tunables to = overrid >> this new behavior, but they should be considered only necessary for = debugging. >=20 > Thanks a lot, this is welcome not only for debugging! >=20 > I had a hard time finding out how to get rid of static > driveserial-targetID assigning. > And more surprising, this affects only IT-fw. When using the same > controller in IR-mode, mapping is done (correctly) slot-based. > In IT-mode, every drive got a consecutive target ID which was static, > and even persistent over firmware updates. There's only one = possibility > with LSIUtil(1.71) to erase /"persitent non-manufacturing config = pages/". > But I guess this hard drive-targetID assigning is triggered by the > driver, namely the mps(4) in FreeBSD. > I did quick tests on windows and IT-mode, where I think I saw slot (or > Phy?) based assigning. >=20 > If it's really mps(4) who decides to store driveserial-targetID > numbering in the /"persitent non-manufacturing config pages/" of the > controller, mpsutil(8) should be able to reset. Otherwise replacing > failed drives, or - even mor confusing - rearranging drive/zpool = layouts > is very unsatisfying. >=20 > Maybe "-1" should be mentioned with sysctl decription, otherwise this = is > another very hard to find/influence behaviour. >=20 >=20 Thanks for the feedback. For the record, this problem happens on a Supermicro X10SDV-7TP4F motherboard. It appears that the support logic around the LSI controller is mis-configured to show the SAS ports being part of an enclosure with 0 slots, instead of 8. This confuses the device mapper logic in the driver that activates if the controller = NVRAM doesn=E2=80=99t specify a pre-existing mapping. Typically this is not = the default, the NVRAM persistent mappings are the default and are used by the = driver, so I considered this problem to be unique to our deployment. Maybe = it=E2=80=99s more of a problem than I estimated? Anyways, sounds like this new functionality should be properly documented in the driver. Scott From owner-svn-src-all@freebsd.org Wed Nov 9 16:42:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F17C6C38480; Wed, 9 Nov 2016 16:42:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A277DEDD; Wed, 9 Nov 2016 16:42:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA9GgFxn061005; Wed, 9 Nov 2016 16:42:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA9GgF1l061004; Wed, 9 Nov 2016 16:42:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611091642.uA9GgF1l061004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 9 Nov 2016 16:42:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308466 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 16:42:17 -0000 Author: kib Date: Wed Nov 9 16:42:15 2016 New Revision: 308466 URL: https://svnweb.freebsd.org/changeset/base/308466 Log: MFC r308210: Style fixes. Modified: stable/11/sys/kern/vfs_lookup.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_lookup.c ============================================================================== --- stable/11/sys/kern/vfs_lookup.c Wed Nov 9 15:04:29 2016 (r308465) +++ stable/11/sys/kern/vfs_lookup.c Wed Nov 9 16:42:15 2016 (r308466) @@ -73,13 +73,10 @@ SDT_PROBE_DEFINE3(vfs, namei, lookup, en "unsigned long"); SDT_PROBE_DEFINE2(vfs, namei, lookup, return, "int", "struct vnode *"); -/* - * Allocation zone for namei - */ +/* Allocation zone for namei. */ uma_zone_t namei_zone; -/* - * Placeholder vnode for mp traversal - */ + +/* Placeholder vnode for mp traversal. */ static struct vnode *vp_crossmp; static void @@ -97,11 +94,12 @@ SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_SECOND static int lookup_shared = 1; SYSCTL_INT(_vfs, OID_AUTO, lookup_shared, CTLFLAG_RWTUN, &lookup_shared, 0, - "Enables/Disables shared locks for path name translation"); + "enables shared locks for path name translation"); static void namei_cleanup_cnp(struct componentname *cnp) { + uma_zfree(namei_zone, cnp->cn_pnbuf); #ifdef DIAGNOSTIC cnp->cn_pnbuf = NULL; @@ -158,12 +156,16 @@ namei(struct nameidata *ndp) char *cp; /* pointer into pathname argument */ struct vnode *dp; /* the directory we are searching */ struct iovec aiov; /* uio for reading symbolic links */ + struct componentname *cnp; + struct thread *td; + struct proc *p; + cap_rights_t rights; struct uio auio; int error, linklen, startdir_used; - struct componentname *cnp = &ndp->ni_cnd; - struct thread *td = cnp->cn_thread; - struct proc *p = td->td_proc; + cnp = &ndp->ni_cnd; + td = cnp->cn_thread; + p = td->td_proc; ndp->ni_cnd.cn_cred = ndp->ni_cnd.cn_thread->td_ucred; KASSERT(cnp->cn_cred && p, ("namei: bad cred/proc")); KASSERT((cnp->cn_nameiop & (~OPMASK)) == 0, @@ -258,8 +260,6 @@ namei(struct nameidata *ndp) dp = fdp->fd_cdir; VREF(dp); } else { - cap_rights_t rights; - rights = ndp->ni_rightsneeded; cap_rights_set(&rights, CAP_LOOKUP); From owner-svn-src-all@freebsd.org Wed Nov 9 16:45:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34876C38524; Wed, 9 Nov 2016 16:45:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00D9FFA; Wed, 9 Nov 2016 16:45:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA9Gj7lP063914; Wed, 9 Nov 2016 16:45:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA9Gj7R1063913; Wed, 9 Nov 2016 16:45:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611091645.uA9Gj7R1063913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 9 Nov 2016 16:45:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308467 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 16:45:08 -0000 Author: kib Date: Wed Nov 9 16:45:06 2016 New Revision: 308467 URL: https://svnweb.freebsd.org/changeset/base/308467 Log: MFC r308211: Remove tautological casts. Modified: stable/11/sys/kern/vfs_lookup.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_lookup.c ============================================================================== --- stable/11/sys/kern/vfs_lookup.c Wed Nov 9 16:42:15 2016 (r308466) +++ stable/11/sys/kern/vfs_lookup.c Wed Nov 9 16:45:06 2016 (r308467) @@ -188,11 +188,11 @@ namei(struct nameidata *ndp) if ((cnp->cn_flags & HASBUF) == 0) cnp->cn_pnbuf = uma_zalloc(namei_zone, M_WAITOK); if (ndp->ni_segflg == UIO_SYSSPACE) - error = copystr(ndp->ni_dirp, cnp->cn_pnbuf, - MAXPATHLEN, (size_t *)&ndp->ni_pathlen); + error = copystr(ndp->ni_dirp, cnp->cn_pnbuf, MAXPATHLEN, + &ndp->ni_pathlen); else - error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf, - MAXPATHLEN, (size_t *)&ndp->ni_pathlen); + error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf, MAXPATHLEN, + &ndp->ni_pathlen); /* * Don't allow empty pathnames. From owner-svn-src-all@freebsd.org Wed Nov 9 16:46:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26EA4C385AC; Wed, 9 Nov 2016 16:46:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E943D2D2; Wed, 9 Nov 2016 16:46:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA9Gkw3A064028; Wed, 9 Nov 2016 16:46:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA9GkwYt064027; Wed, 9 Nov 2016 16:46:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611091646.uA9GkwYt064027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 9 Nov 2016 16:46:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308468 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 16:46:59 -0000 Author: kib Date: Wed Nov 9 16:46:57 2016 New Revision: 308468 URL: https://svnweb.freebsd.org/changeset/base/308468 Log: MFC r308228: Remove remnants of the recursive sleep support. Modified: stable/11/sys/kern/kern_synch.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_synch.c ============================================================================== --- stable/11/sys/kern/kern_synch.c Wed Nov 9 16:45:06 2016 (r308467) +++ stable/11/sys/kern/kern_synch.c Wed Nov 9 16:46:57 2016 (r308468) @@ -170,13 +170,7 @@ _sleep(void *ident, struct lock_object * catch = priority & PCATCH; pri = priority & PRIMASK; - /* - * If we are already on a sleep queue, then remove us from that - * sleep queue first. We have to do this to handle recursive - * sleeps. - */ - if (TD_ON_SLEEPQ(td)) - sleepq_remove(td, td->td_wchan); + KASSERT(!TD_ON_SLEEPQ(td), ("recursive sleep")); if ((uint8_t *)ident >= &pause_wchan[0] && (uint8_t *)ident <= &pause_wchan[MAXCPU - 1]) From owner-svn-src-all@freebsd.org Wed Nov 9 17:05:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2622FC38B48; Wed, 9 Nov 2016 17:05:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0505EE16; Wed, 9 Nov 2016 17:05:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id DD7F610A727; Wed, 9 Nov 2016 12:05:28 -0500 (EST) From: John Baldwin To: Hans Petter Selasky Cc: Oleksandr Tymoshenko , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308424 - head/sys/arm/broadcom/bcm2835 Date: Wed, 09 Nov 2016 08:32:25 -0800 Message-ID: <2064206.nvhhXHc9vW@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <5c170b6b-1189-4712-ffdd-653cc6b8c59e@selasky.org> References: <201611071738.uA7HceYu045944@repo.freebsd.org> <3214848.geWV8qu7rM@ralph.baldwin.cx> <5c170b6b-1189-4712-ffdd-653cc6b8c59e@selasky.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 09 Nov 2016 12:05:28 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 17:05:31 -0000 On Wednesday, November 09, 2016 05:10:09 PM Hans Petter Selasky wrote: > Hi, > > On 11/09/16 16:02, John Baldwin wrote: > > On the other hand, doing the wakeup outside of the lock > > avoids preempting during the wakeup only to immediately block on the lock and > > switch back to the thread that did the wakeup. > > This can be predicted and avoided by the turnstiles iff cv_signal() is > used under a lock. Else not. It isn't predicted and avoided by turnstiles. In particular, the cv_signal has no idea what lock is associated, so it can't try to do something "smart" and move the thread from the sleepq to the lockq. You will pay the double context switch. > Won't doing the wakeup outside the lock cause double preemtion? First at > mtx_unlock() and then inside cv_signal()/cv_broadcast(). No. The other thread can't be blocked on both the mutex and cv. If the thread is blocked on the mutex and you preempt to it, then it won't ever bother sleeping on the cv anyway (and the cv_signal will be a nop once the awakening thread resumes). -- John Baldwin From owner-svn-src-all@freebsd.org Wed Nov 9 17:07:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23A29C38C4F; Wed, 9 Nov 2016 17:07:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6D87FB; Wed, 9 Nov 2016 17:07:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA9H7kZg071984; Wed, 9 Nov 2016 17:07:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA9H7kNC071983; Wed, 9 Nov 2016 17:07:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611091707.uA9H7kNC071983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 9 Nov 2016 17:07:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308469 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 17:07:47 -0000 Author: kib Date: Wed Nov 9 17:07:45 2016 New Revision: 308469 URL: https://svnweb.freebsd.org/changeset/base/308469 Log: MFC r308211: Remove tautological casts. Modified: stable/10/sys/kern/vfs_lookup.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_lookup.c ============================================================================== --- stable/10/sys/kern/vfs_lookup.c Wed Nov 9 16:46:57 2016 (r308468) +++ stable/10/sys/kern/vfs_lookup.c Wed Nov 9 17:07:45 2016 (r308469) @@ -164,11 +164,11 @@ namei(struct nameidata *ndp) if ((cnp->cn_flags & HASBUF) == 0) cnp->cn_pnbuf = uma_zalloc(namei_zone, M_WAITOK); if (ndp->ni_segflg == UIO_SYSSPACE) - error = copystr(ndp->ni_dirp, cnp->cn_pnbuf, - MAXPATHLEN, (size_t *)&ndp->ni_pathlen); + error = copystr(ndp->ni_dirp, cnp->cn_pnbuf, MAXPATHLEN, + &ndp->ni_pathlen); else - error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf, - MAXPATHLEN, (size_t *)&ndp->ni_pathlen); + error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf, MAXPATHLEN, + &ndp->ni_pathlen); /* * Don't allow empty pathnames. From owner-svn-src-all@freebsd.org Wed Nov 9 17:19:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8072FC38FB6; Wed, 9 Nov 2016 17:19:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FAD6B88; Wed, 9 Nov 2016 17:19:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA9HJo2e075937; Wed, 9 Nov 2016 17:19:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA9HJoaF075936; Wed, 9 Nov 2016 17:19:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611091719.uA9HJoaF075936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 9 Nov 2016 17:19:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308470 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 17:19:51 -0000 Author: kib Date: Wed Nov 9 17:19:50 2016 New Revision: 308470 URL: https://svnweb.freebsd.org/changeset/base/308470 Log: MFC r308228: Remove remnants of the recursive sleep support. Modified: stable/10/sys/kern/kern_synch.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_synch.c ============================================================================== --- stable/10/sys/kern/kern_synch.c Wed Nov 9 17:07:45 2016 (r308469) +++ stable/10/sys/kern/kern_synch.c Wed Nov 9 17:19:50 2016 (r308470) @@ -196,13 +196,7 @@ _sleep(void *ident, struct lock_object * catch = priority & PCATCH; pri = priority & PRIMASK; - /* - * If we are already on a sleep queue, then remove us from that - * sleep queue first. We have to do this to handle recursive - * sleeps. - */ - if (TD_ON_SLEEPQ(td)) - sleepq_remove(td, td->td_wchan); + KASSERT(!TD_ON_SLEEPQ(td), ("recursive sleep")); if ((uint8_t *)ident >= &pause_wchan[0] && (uint8_t *)ident <= &pause_wchan[MAXCPU - 1]) From owner-svn-src-all@freebsd.org Wed Nov 9 17:57:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2276C3888B; Wed, 9 Nov 2016 17:57:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 716A7146; Wed, 9 Nov 2016 17:57:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA9Hvt5e091333; Wed, 9 Nov 2016 17:57:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA9HvtHD091332; Wed, 9 Nov 2016 17:57:55 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611091757.uA9HvtHD091332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 9 Nov 2016 17:57:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308471 - head/sys/dev/sound/pci/hda X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 17:57:56 -0000 Author: mav Date: Wed Nov 9 17:57:55 2016 New Revision: 308471 URL: https://svnweb.freebsd.org/changeset/base/308471 Log: Fix copy/paste bug in r308464. MFC after: 1 week Modified: head/sys/dev/sound/pci/hda/hdacc.c Modified: head/sys/dev/sound/pci/hda/hdacc.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdacc.c Wed Nov 9 17:19:50 2016 (r308470) +++ head/sys/dev/sound/pci/hda/hdacc.c Wed Nov 9 17:57:55 2016 (r308471) @@ -322,7 +322,7 @@ static const struct { { HDA_CODEC_INTELPPT, 0, "Intel Panther Point" }, { HDA_CODEC_INTELHSW, 0, "Intel Haswell" }, { HDA_CODEC_INTELBDW, 0, "Intel Broadwell" }, - { HDA_CODEC_INTELSKLK, 0, "Intel Kabylake" }, + { HDA_CODEC_INTELSKLK, 0, "Intel Skylake" }, { HDA_CODEC_INTELKBLK, 0, "Intel Kabylake" }, { HDA_CODEC_INTELCL, 0, "Intel Crestline" }, { HDA_CODEC_SII1390, 0, "Silicon Image SiI1390" }, From owner-svn-src-all@freebsd.org Wed Nov 9 18:00:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40AF1C38A2B; Wed, 9 Nov 2016 18:00:51 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10931674; Wed, 9 Nov 2016 18:00:50 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA9I0oTY093805; Wed, 9 Nov 2016 18:00:50 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA9I0oqB093789; Wed, 9 Nov 2016 18:00:50 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201611091800.uA9I0oqB093789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 9 Nov 2016 18:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308472 - stable/11/usr.bin/sed X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 18:00:51 -0000 Author: pfg Date: Wed Nov 9 18:00:50 2016 New Revision: 308472 URL: https://svnweb.freebsd.org/changeset/base/308472 Log: MFC r308314: sed(1): add LEGACY_BSDSED_COMPAT compile-time flag. In r297602, which included a __FreeBSD_version bump to 1100105, we changed sed 'i' and 'a' from discarding whitespaces to conform with what GNU and sysvish sed do. There are arguments in favor of keeping the old behavior but the new behavior is also useful for migration purposes. It seems important to at least consider the case of developers depending on the previous behavior so add a CFLAG to enable the old behavior. PR: 213474 Modified: stable/11/usr.bin/sed/compile.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/sed/compile.c ============================================================================== --- stable/11/usr.bin/sed/compile.c Wed Nov 9 17:57:55 2016 (r308471) +++ stable/11/usr.bin/sed/compile.c Wed Nov 9 18:00:50 2016 (r308472) @@ -746,6 +746,9 @@ compile_text(void) while (cu_fgets(lbuf, sizeof(lbuf), NULL)) { op = s = text + size; p = lbuf; +#ifdef LEGACY_BSDSED_COMPAT + EATSPACE(); +#endif for (esc_nl = 0; *p != '\0'; p++) { if (*p == '\\' && p[1] != '\0' && *++p == '\n') esc_nl = 1; From owner-svn-src-all@freebsd.org Wed Nov 9 18:42:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7D6FC3775C; Wed, 9 Nov 2016 18:42:31 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92D1E131; Wed, 9 Nov 2016 18:42:31 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA9IgUfY012603; Wed, 9 Nov 2016 18:42:30 GMT (envelope-from jasone@FreeBSD.org) Received: (from jasone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA9IgUet012596; Wed, 9 Nov 2016 18:42:30 GMT (envelope-from jasone@FreeBSD.org) Message-Id: <201611091842.uA9IgUet012596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jasone set sender to jasone@FreeBSD.org using -f From: Jason Evans Date: Wed, 9 Nov 2016 18:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308473 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src lib/libc/stdlib/jemalloc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 18:42:31 -0000 Author: jasone Date: Wed Nov 9 18:42:30 2016 New Revision: 308473 URL: https://svnweb.freebsd.org/changeset/base/308473 Log: Update jemalloc to 4.3.1. Added: head/contrib/jemalloc/include/jemalloc/internal/spin.h (contents, props changed) head/contrib/jemalloc/src/spin.c (contents, props changed) Modified: head/contrib/jemalloc/ChangeLog head/contrib/jemalloc/FREEBSD-Xlist head/contrib/jemalloc/FREEBSD-diffs head/contrib/jemalloc/VERSION head/contrib/jemalloc/doc/jemalloc.3 head/contrib/jemalloc/include/jemalloc/internal/arena.h head/contrib/jemalloc/include/jemalloc/internal/chunk.h head/contrib/jemalloc/include/jemalloc/internal/chunk_dss.h head/contrib/jemalloc/include/jemalloc/internal/ckh.h head/contrib/jemalloc/include/jemalloc/internal/huge.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_decls.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h head/contrib/jemalloc/include/jemalloc/internal/mb.h head/contrib/jemalloc/include/jemalloc/internal/mutex.h head/contrib/jemalloc/include/jemalloc/internal/nstime.h head/contrib/jemalloc/include/jemalloc/internal/private_namespace.h head/contrib/jemalloc/include/jemalloc/internal/prng.h head/contrib/jemalloc/include/jemalloc/internal/prof.h head/contrib/jemalloc/include/jemalloc/internal/size_classes.h head/contrib/jemalloc/include/jemalloc/internal/tcache.h head/contrib/jemalloc/include/jemalloc/internal/tsd.h head/contrib/jemalloc/include/jemalloc/internal/util.h head/contrib/jemalloc/include/jemalloc/internal/witness.h head/contrib/jemalloc/include/jemalloc/jemalloc.h head/contrib/jemalloc/src/arena.c head/contrib/jemalloc/src/chunk.c head/contrib/jemalloc/src/chunk_dss.c head/contrib/jemalloc/src/ckh.c head/contrib/jemalloc/src/ctl.c head/contrib/jemalloc/src/huge.c head/contrib/jemalloc/src/jemalloc.c head/contrib/jemalloc/src/mutex.c head/contrib/jemalloc/src/nstime.c head/contrib/jemalloc/src/pages.c head/contrib/jemalloc/src/prof.c head/contrib/jemalloc/src/rtree.c head/contrib/jemalloc/src/stats.c head/contrib/jemalloc/src/tcache.c head/contrib/jemalloc/src/tsd.c head/contrib/jemalloc/src/util.c head/lib/libc/stdlib/jemalloc/Makefile.inc Modified: head/contrib/jemalloc/ChangeLog ============================================================================== --- head/contrib/jemalloc/ChangeLog Wed Nov 9 18:00:50 2016 (r308472) +++ head/contrib/jemalloc/ChangeLog Wed Nov 9 18:42:30 2016 (r308473) @@ -4,6 +4,59 @@ brevity. Much more detail can be found https://github.com/jemalloc/jemalloc +* 4.3.1 (November 7, 2016) + + Bug fixes: + - Fix a severe virtual memory leak. This regression was first released in + 4.3.0. (@interwq, @jasone) + - Refactor atomic and prng APIs to restore support for 32-bit platforms that + use pre-C11 toolchains, e.g. FreeBSD's mips. (@jasone) + +* 4.3.0 (November 4, 2016) + + This is the first release that passes the test suite for multiple Windows + configurations, thanks in large part to @glandium setting up continuous + integration via AppVeyor (and Travis CI for Linux and OS X). + + New features: + - Add "J" (JSON) support to malloc_stats_print(). (@jasone) + - Add Cray compiler support. (@ronawho) + + Optimizations: + - Add/use adaptive spinning for bootstrapping and radix tree node + initialization. (@jasone) + + Bug fixes: + - Fix large allocation to search starting in the optimal size class heap, + which can substantially reduce virtual memory churn and fragmentation. This + regression was first released in 4.0.0. (@mjp41, @jasone) + - Fix stats.arenas..nthreads accounting. (@interwq) + - Fix and simplify decay-based purging. (@jasone) + - Make DSS (sbrk(2)-related) operations lockless, which resolves potential + deadlocks during thread exit. (@jasone) + - Fix over-sized allocation of radix tree leaf nodes. (@mjp41, @ogaun, + @jasone) + - Fix over-sized allocation of arena_t (plus associated stats) data + structures. (@jasone, @interwq) + - Fix EXTRA_CFLAGS to not affect configuration. (@jasone) + - Fix a Valgrind integration bug. (@ronawho) + - Disallow 0x5a junk filling when running in Valgrind. (@jasone) + - Fix a file descriptor leak on Linux. This regression was first released in + 4.2.0. (@vsarunas, @jasone) + - Fix static linking of jemalloc with glibc. (@djwatson) + - Use syscall(2) rather than {open,read,close}(2) during boot on Linux. This + works around other libraries' system call wrappers performing reentrant + allocation. (@kspinka, @Whissi, @jasone) + - Fix OS X default zone replacement to work with OS X 10.12. (@glandium, + @jasone) + - Fix cached memory management to avoid needless commit/decommit operations + during purging, which resolves permanent virtual memory map fragmentation + issues on Windows. (@mjp41, @jasone) + - Fix TSD fetches to avoid (recursive) allocation. This is relevant to + non-TLS and Windows configurations. (@jasone) + - Fix malloc_conf overriding to work on Windows. (@jasone) + - Forcibly disable lazy-lock on Windows (was forcibly *enabled*). (@jasone) + * 4.2.1 (June 8, 2016) Bug fixes: Modified: head/contrib/jemalloc/FREEBSD-Xlist ============================================================================== --- head/contrib/jemalloc/FREEBSD-Xlist Wed Nov 9 18:00:50 2016 (r308472) +++ head/contrib/jemalloc/FREEBSD-Xlist Wed Nov 9 18:42:30 2016 (r308473) @@ -1,6 +1,8 @@ $FreeBSD$ +.appveyor.yml .autom4te.cfg .git* +.travis.yml FREEBSD-* INSTALL Makefile* Modified: head/contrib/jemalloc/FREEBSD-diffs ============================================================================== --- head/contrib/jemalloc/FREEBSD-diffs Wed Nov 9 18:00:50 2016 (r308472) +++ head/contrib/jemalloc/FREEBSD-diffs Wed Nov 9 18:42:30 2016 (r308473) @@ -1,11 +1,11 @@ diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in -index c4a44e3..4626e9b 100644 +index 3d2e721..b361db2 100644 --- a/doc/jemalloc.xml.in +++ b/doc/jemalloc.xml.in @@ -53,11 +53,23 @@ This manual describes jemalloc @jemalloc_version@. More information can be found at the jemalloc website. + url="http://jemalloc.net/">jemalloc website. + + The following configuration options are enabled in libc's built-in + jemalloc: , @@ -27,30 +27,30 @@ index c4a44e3..4626e9b 100644 Standard API -@@ -2961,4 +2973,18 @@ malloc_conf = "lg_chunk:24";]]> - The posix_memalign function conforms - to IEEE Std 1003.1-2001 (“POSIX.1”). +@@ -2963,4 +2975,18 @@ malloc_conf = "lg_chunk:24";]]> + The posix_memalign() function conforms + to IEEE Std 1003.1-2001 (POSIX.1). + + HISTORY -+ The malloc_usable_size and -+ posix_memalign functions first appeared in -+ FreeBSD 7.0. -+ -+ The aligned_alloc, -+ malloc_stats_print, and -+ mallctl* functions first appeared in -+ FreeBSD 10.0. ++ The malloc_usable_size() and ++ posix_memalign() functions first appeared in FreeBSD ++ 7.0. ++ ++ The aligned_alloc(), ++ malloc_stats_print(), and ++ mallctl*() functions first appeared in FreeBSD ++ 10.0. + -+ The *allocx functions first appeared -+ in FreeBSD 11.0. ++ The *allocx() functions first appeared in FreeBSD ++ 11.0. + diff --git a/include/jemalloc/internal/arena.h b/include/jemalloc/internal/arena.h -index b1de2b6..da6b6d2 100644 +index f39ce54..a3ba55d 100644 --- a/include/jemalloc/internal/arena.h +++ b/include/jemalloc/internal/arena.h -@@ -718,8 +718,13 @@ arena_miscelm_get_mutable(arena_chunk_t *chunk, size_t pageind) +@@ -719,8 +719,13 @@ arena_miscelm_get_mutable(arena_chunk_t *chunk, size_t pageind) JEMALLOC_ALWAYS_INLINE const arena_chunk_map_misc_t * arena_miscelm_get_const(const arena_chunk_t *chunk, size_t pageind) { @@ -64,7 +64,7 @@ index b1de2b6..da6b6d2 100644 } JEMALLOC_ALWAYS_INLINE size_t -@@ -778,8 +783,13 @@ arena_mapbitsp_get_mutable(arena_chunk_t *chunk, size_t pageind) +@@ -779,8 +784,13 @@ arena_mapbitsp_get_mutable(arena_chunk_t *chunk, size_t pageind) JEMALLOC_ALWAYS_INLINE const size_t * arena_mapbitsp_get_const(const arena_chunk_t *chunk, size_t pageind) { @@ -79,7 +79,7 @@ index b1de2b6..da6b6d2 100644 JEMALLOC_ALWAYS_INLINE size_t diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in -index 8f82edd..78e2df2 100644 +index fdc8fef..56a35a4 100644 --- a/include/jemalloc/internal/jemalloc_internal.h.in +++ b/include/jemalloc/internal/jemalloc_internal.h.in @@ -8,6 +8,9 @@ @@ -108,7 +108,7 @@ index 8f82edd..78e2df2 100644 static const bool config_prof = #ifdef JEMALLOC_PROF diff --git a/include/jemalloc/internal/jemalloc_internal_decls.h b/include/jemalloc/internal/jemalloc_internal_decls.h -index 2b8ca5d..42d97f2 100644 +index c907d91..4626632 100644 --- a/include/jemalloc/internal/jemalloc_internal_decls.h +++ b/include/jemalloc/internal/jemalloc_internal_decls.h @@ -1,6 +1,9 @@ @@ -122,10 +122,10 @@ index 2b8ca5d..42d97f2 100644 #ifdef _WIN32 # include diff --git a/include/jemalloc/internal/mutex.h b/include/jemalloc/internal/mutex.h -index 5221799..60ab041 100644 +index b442d2d..76518db 100644 --- a/include/jemalloc/internal/mutex.h +++ b/include/jemalloc/internal/mutex.h -@@ -52,9 +52,6 @@ struct malloc_mutex_s { +@@ -57,9 +57,6 @@ struct malloc_mutex_s { #ifdef JEMALLOC_LAZY_LOCK extern bool isthreaded; @@ -135,7 +135,7 @@ index 5221799..60ab041 100644 #endif bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, -@@ -62,6 +59,7 @@ bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, +@@ -67,6 +64,7 @@ bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name, void malloc_mutex_prefork(tsdn_t *tsdn, malloc_mutex_t *mutex); void malloc_mutex_postfork_parent(tsdn_t *tsdn, malloc_mutex_t *mutex); void malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex); @@ -144,10 +144,10 @@ index 5221799..60ab041 100644 #endif /* JEMALLOC_H_EXTERNS */ diff --git a/include/jemalloc/internal/private_symbols.txt b/include/jemalloc/internal/private_symbols.txt -index f2b6a55..69369c9 100644 +index 87c8c9b..df576f6 100644 --- a/include/jemalloc/internal/private_symbols.txt +++ b/include/jemalloc/internal/private_symbols.txt -@@ -311,7 +311,6 @@ iralloct_realign +@@ -307,7 +307,6 @@ iralloct_realign isalloc isdalloct isqalloc @@ -335,7 +335,7 @@ index f943891..47d032c 100755 +#include "jemalloc_FreeBSD.h" EOF diff --git a/src/jemalloc.c b/src/jemalloc.c -index 5d1f493..46dd1d1 100644 +index 38650ff..f659b55 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -4,6 +4,10 @@ @@ -347,9 +347,9 @@ index 5d1f493..46dd1d1 100644 +__sym_compat(_malloc_options, __malloc_options_1_0, FBSD_1.0); + /* Runtime configuration options. */ - const char *je_malloc_conf JEMALLOC_ATTR(weak); - bool opt_abort = -@@ -2673,6 +2677,107 @@ je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr) + const char *je_malloc_conf + #ifndef _WIN32 +@@ -2756,6 +2760,107 @@ je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr) */ /******************************************************************************/ /* @@ -457,7 +457,7 @@ index 5d1f493..46dd1d1 100644 * The following functions are used by threading libraries for protection of * malloc during fork(). */ -@@ -2814,4 +2919,11 @@ jemalloc_postfork_child(void) +@@ -2894,4 +2999,11 @@ jemalloc_postfork_child(void) ctl_postfork_child(tsd_tsdn(tsd)); } @@ -470,7 +470,7 @@ index 5d1f493..46dd1d1 100644 + /******************************************************************************/ diff --git a/src/mutex.c b/src/mutex.c -index a1fac34..a24e420 100644 +index 6333e73..13f8d79 100644 --- a/src/mutex.c +++ b/src/mutex.c @@ -66,6 +66,17 @@ pthread_create(pthread_t *__restrict thread, @@ -491,7 +491,7 @@ index a1fac34..a24e420 100644 #endif bool -@@ -140,7 +151,7 @@ malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex) +@@ -142,7 +153,7 @@ malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex) } bool @@ -500,7 +500,7 @@ index a1fac34..a24e420 100644 { #ifdef JEMALLOC_MUTEX_INIT_CB -@@ -154,3 +165,14 @@ malloc_mutex_boot(void) +@@ -156,3 +167,14 @@ malloc_mutex_boot(void) #endif return (false); } @@ -516,7 +516,7 @@ index a1fac34..a24e420 100644 +#endif +} diff --git a/src/util.c b/src/util.c -index a1c4a2a..04f9153 100644 +index 7905267..bee1c77 100644 --- a/src/util.c +++ b/src/util.c @@ -67,6 +67,22 @@ wrtmessage(void *cbopaque, const char *s) Modified: head/contrib/jemalloc/VERSION ============================================================================== --- head/contrib/jemalloc/VERSION Wed Nov 9 18:00:50 2016 (r308472) +++ head/contrib/jemalloc/VERSION Wed Nov 9 18:42:30 2016 (r308473) @@ -1 +1 @@ -4.2.1-0-g3de035335255d553bdb344c32ffdb603816195d8 +4.3.1-0-g0110fa8451af905affd77c3bea0d545fee2251b2 Modified: head/contrib/jemalloc/doc/jemalloc.3 ============================================================================== --- head/contrib/jemalloc/doc/jemalloc.3 Wed Nov 9 18:00:50 2016 (r308472) +++ head/contrib/jemalloc/doc/jemalloc.3 Wed Nov 9 18:42:30 2016 (r308473) @@ -2,12 +2,12 @@ .\" Title: JEMALLOC .\" Author: Jason Evans .\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 06/08/2016 +.\" Date: 11/08/2016 .\" Manual: User Manual -.\" Source: jemalloc 4.2.1-0-g3de035335255d553bdb344c32ffdb603816195d8 +.\" Source: jemalloc 4.3.1-0-g0110fa8451af905affd77c3bea0d545fee2251b2 .\" Language: English .\" -.TH "JEMALLOC" "3" "06/08/2016" "jemalloc 4.2.1-0-g3de035335255" "User Manual" +.TH "JEMALLOC" "3" "11/08/2016" "jemalloc 4.3.1-0-g0110fa8451af" "User Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -31,7 +31,7 @@ jemalloc \- general purpose memory allocation functions .SH "LIBRARY" .PP -This manual describes jemalloc 4\&.2\&.1\-0\-g3de035335255d553bdb344c32ffdb603816195d8\&. More information can be found at the +This manual describes jemalloc 4\&.3\&.1\-0\-g0110fa8451af905affd77c3bea0d545fee2251b2\&. More information can be found at the \m[blue]\fBjemalloc website\fR\m[]\&\s-2\u[1]\d\s+2\&. .PP The following configuration options are enabled in libc\*(Aqs built\-in jemalloc: @@ -101,26 +101,26 @@ const char *\fImalloc_conf\fR; .SS "Standard API" .PP The -\fBmalloc\fR\fB\fR +malloc() function allocates \fIsize\fR bytes of uninitialized memory\&. The allocated space is suitably aligned (after possible pointer coercion) for storage of any type of object\&. .PP The -\fBcalloc\fR\fB\fR +calloc() function allocates space for \fInumber\fR objects, each \fIsize\fR bytes in length\&. The result is identical to calling -\fBmalloc\fR\fB\fR +malloc() with an argument of \fInumber\fR * \fIsize\fR, with the exception that the allocated memory is explicitly initialized to zero bytes\&. .PP The -\fBposix_memalign\fR\fB\fR +posix_memalign() function allocates \fIsize\fR bytes of memory such that the allocation\*(Aqs base address is a multiple of @@ -131,7 +131,7 @@ must be a power of 2 at least as large a sizeof(\fBvoid *\fR)\&. .PP The -\fBaligned_alloc\fR\fB\fR +aligned_alloc() function allocates \fIsize\fR bytes of memory such that the allocation\*(Aqs base address is a multiple of @@ -143,7 +143,7 @@ is not an integral multiple of \fIalignment\fR\&. .PP The -\fBrealloc\fR\fB\fR +realloc() function changes the size of the previously allocated memory referenced by \fIptr\fR to @@ -151,19 +151,19 @@ to bytes\&. The contents of the memory are unchanged up to the lesser of the new and old sizes\&. If the new size is larger, the contents of the newly allocated portion of the memory are undefined\&. Upon success, the memory referenced by \fIptr\fR is freed and a pointer to the newly allocated memory is returned\&. Note that -\fBrealloc\fR\fB\fR +realloc() may move the memory allocation, resulting in a different return value than \fIptr\fR\&. If \fIptr\fR is \fBNULL\fR, the -\fBrealloc\fR\fB\fR +realloc() function behaves identically to -\fBmalloc\fR\fB\fR +malloc() for the specified size\&. .PP The -\fBfree\fR\fB\fR +free() function causes the allocated memory referenced by \fIptr\fR to be made available for future allocations\&. If @@ -173,13 +173,13 @@ is .SS "Non\-standard API" .PP The -\fBmallocx\fR\fB\fR, -\fBrallocx\fR\fB\fR, -\fBxallocx\fR\fB\fR, -\fBsallocx\fR\fB\fR, -\fBdallocx\fR\fB\fR, -\fBsdallocx\fR\fB\fR, and -\fBnallocx\fR\fB\fR +mallocx(), +rallocx(), +xallocx(), +sallocx(), +dallocx(), +sdallocx(), and +nallocx() functions all have a \fIflags\fR argument that can be used to specify options\&. The functions only check the options that are contextually relevant\&. Use bitwise or (|) operations to specify one or more of the following: @@ -211,7 +211,7 @@ Initialize newly allocated memory to con .RS 4 Use the thread\-specific cache (tcache) specified by the identifier \fItc\fR, which must have been acquired via the -"tcache\&.create" +tcache\&.create mallctl\&. This macro does not validate that \fItc\fR specifies a valid identifier\&. @@ -238,7 +238,7 @@ specifies an arena index in the valid ra .RE .PP The -\fBmallocx\fR\fB\fR +mallocx() function allocates at least \fIsize\fR bytes of memory, and returns a pointer to the base address of the allocation\&. Behavior is undefined if @@ -247,7 +247,7 @@ is \fB0\fR\&. .PP The -\fBrallocx\fR\fB\fR +rallocx() function resizes the allocation at \fIptr\fR to be at least @@ -258,7 +258,7 @@ is \fB0\fR\&. .PP The -\fBxallocx\fR\fB\fR +xallocx() function resizes the allocation at \fIptr\fR in place to be at least @@ -274,33 +274,33 @@ is (\fIsize\fR + \fIextra\fR > \fBSIZE_T_MAX\fR)\&. .PP The -\fBsallocx\fR\fB\fR +sallocx() function returns the real size of the allocation at \fIptr\fR\&. .PP The -\fBdallocx\fR\fB\fR +dallocx() function causes the memory referenced by \fIptr\fR to be made available for future allocations\&. .PP The -\fBsdallocx\fR\fB\fR +sdallocx() function is an extension of -\fBdallocx\fR\fB\fR +dallocx() with a \fIsize\fR parameter to allow the caller to pass in the allocation size as an optimization\&. The minimum valid input size is the original requested size of the allocation, and the maximum valid input size is the corresponding value returned by -\fBnallocx\fR\fB\fR +nallocx() or -\fBsallocx\fR\fB\fR\&. +sallocx()\&. .PP The -\fBnallocx\fR\fB\fR +nallocx() function allocates no memory, but it performs the same size computation as the -\fBmallocx\fR\fB\fR +mallocx() function, and returns the real size of the allocation that would result from the equivalent -\fBmallocx\fR\fB\fR +mallocx() function call, or \fB0\fR if the inputs exceed the maximum supported size class and/or alignment\&. Behavior is undefined if @@ -309,7 +309,7 @@ is \fB0\fR\&. .PP The -\fBmallctl\fR\fB\fR +mallctl() function provides a general interface for introspecting the memory allocator, as well as setting modifiable parameters and triggering actions\&. The period\-separated \fIname\fR argument specifies a location in a tree\-structured namespace; see the @@ -328,10 +328,12 @@ and \fB0\fR\&. .PP The -\fBmallctlnametomib\fR\fB\fR -function provides a way to avoid repeated name lookups for applications that repeatedly query the same portion of the namespace, by translating a name to a \(lqManagement Information Base\(rq (MIB) that can be passed repeatedly to -\fBmallctlbymib\fR\fB\fR\&. Upon successful return from -\fBmallctlnametomib\fR\fB\fR, +mallctlnametomib() +function provides a way to avoid repeated name lookups for applications that repeatedly query the same portion of the namespace, by translating a name to a +\(lqManagement Information Base\(rq +(MIB) that can be passed repeatedly to +mallctlbymib()\&. Upon successful return from +mallctlnametomib(), \fImibp\fR contains an array of \fI*miblenp\fR @@ -343,7 +345,7 @@ and the input value of \fI*miblenp\fR\&. Thus it is possible to pass a \fI*miblenp\fR that is smaller than the number of period\-separated name components, which results in a partial MIB that can be used as the basis for constructing a complete MIB\&. For name components that are integers (e\&.g\&. the 2 in -"arenas\&.bin\&.2\&.size"), the corresponding MIB component will always be that integer\&. Therefore, it is legitimate to construct code like the following: +arenas\&.bin\&.2\&.size), the corresponding MIB component will always be that integer\&. Therefore, it is legitimate to construct code like the following: .sp .if n \{\ .RS 4 @@ -372,35 +374,50 @@ for (i = 0; i < nbins; i++) { .\} .PP The -\fBmalloc_stats_print\fR\fB\fR -function writes human\-readable summary statistics via the +malloc_stats_print() +function writes summary statistics via the \fIwrite_cb\fR callback function pointer and \fIcbopaque\fR data passed to \fIwrite_cb\fR, or -\fBmalloc_message\fR\fB\fR +malloc_message() if \fIwrite_cb\fR is -\fBNULL\fR\&. This function can be called repeatedly\&. General information that never changes during execution can be omitted by specifying "g" as a character within the +\fBNULL\fR\&. The statistics are presented in human\-readable form unless +\(lqJ\(rq +is specified as a character within the +\fIopts\fR +string, in which case the statistics are presented in +\m[blue]\fBJSON format\fR\m[]\&\s-2\u[2]\d\s+2\&. This function can be called repeatedly\&. General information that never changes during execution can be omitted by specifying +\(lqg\(rq +as a character within the \fIopts\fR string\&. Note that -\fBmalloc_message\fR\fB\fR +malloc_message() uses the -\fBmallctl*\fR\fB\fR +mallctl*() functions internally, so inconsistent statistics can be reported if multiple threads use these functions simultaneously\&. If \fB\-\-enable\-stats\fR -is specified during configuration, \(lqm\(rq and \(lqa\(rq can be specified to omit merged arena and per arena statistics, respectively; \(lqb\(rq, \(lql\(rq, and \(lqh\(rq can be specified to omit per size class statistics for bins, large objects, and huge objects, respectively\&. Unrecognized characters are silently ignored\&. Note that thread caching may prevent some statistics from being completely up to date, since extra locking would be required to merge counters that track thread cache operations\&. +is specified during configuration, +\(lqm\(rq +and +\(lqa\(rq +can be specified to omit merged arena and per arena statistics, respectively; +\(lqb\(rq, +\(lql\(rq, and +\(lqh\(rq +can be specified to omit per size class statistics for bins, large objects, and huge objects, respectively\&. Unrecognized characters are silently ignored\&. Note that thread caching may prevent some statistics from being completely up to date, since extra locking would be required to merge counters that track thread cache operations\&. .PP The -\fBmalloc_usable_size\fR\fB\fR +malloc_usable_size() function returns the usable size of the allocation pointed to by \fIptr\fR\&. The return value may be larger than the size that was requested during allocation\&. The -\fBmalloc_usable_size\fR\fB\fR +malloc_usable_size() function is not a mechanism for in\-place -\fBrealloc\fR\fB\fR; rather it is provided solely as a tool for introspection purposes\&. Any discrepancy between the requested allocation size and the size reported by -\fBmalloc_usable_size\fR\fB\fR +realloc(); rather it is provided solely as a tool for introspection purposes\&. Any discrepancy between the requested allocation size and the size reported by +malloc_usable_size() should not be depended on, since such behavior is entirely implementation\-dependent\&. .SH "TUNING" .PP @@ -408,12 +425,14 @@ Once, when the first call is made to one .PP The string specified via \fB\-\-with\-malloc\-conf\fR, the string pointed to by the global variable -\fImalloc_conf\fR, the \(lqname\(rq of the file referenced by the symbolic link named +\fImalloc_conf\fR, the +\(lqname\(rq +of the file referenced by the symbolic link named /etc/malloc\&.conf, and the value of the environment variable \fBMALLOC_CONF\fR, will be interpreted, in that order, from left to right as options\&. Note that \fImalloc_conf\fR may be read before -\fBmain\fR\fB\fR +main() is entered, so the declaration of \fImalloc_conf\fR should specify an initializer that contains the final value to be read by jemalloc\&. @@ -427,15 +446,15 @@ and can be safely set any time prior to program invocation\&. .PP An options string is a comma\-separated list of option:value pairs\&. There is one key corresponding to each -"opt\&.*" +opt\&.* mallctl (see the MALLCTL NAMESPACE section for options documentation)\&. For example, abort:true,narenas:1 sets the -"opt\&.abort" +opt\&.abort and -"opt\&.narenas" +opt\&.narenas options\&. Some options have boolean values (true/false), others have integer values (base 8, 10, or 16, depending on prefix), and yet others have raw string values\&. .SH "IMPLEMENTATION NOTES" .PP @@ -460,22 +479,22 @@ Memory is conceptually broken into equal .PP Small objects are managed in groups by page runs\&. Each run maintains a bitmap to track which regions are in use\&. Allocation requests that are no more than half the quantum (8 or 16, depending on architecture) are rounded up to the nearest power of two that is at least sizeof(\fBdouble\fR)\&. All other object size classes are multiples of the quantum, spaced such that there are four size classes for each doubling in size, which limits internal fragmentation to approximately 20% for all but the smallest size classes\&. Small size classes are smaller than four times the page size, large size classes are smaller than the chunk size (see the -"opt\&.lg_chunk" +opt\&.lg_chunk option), and huge size classes extend from the chunk size up to the largest size class that does not exceed \fBPTRDIFF_MAX\fR\&. .PP Allocations are packed tightly together, which can be an issue for multi\-threaded applications\&. If you need to assure that allocations do not suffer from cacheline sharing, round your allocation requests up to the nearest multiple of the cacheline size, or specify cacheline alignment when allocating\&. .PP The -\fBrealloc\fR\fB\fR, -\fBrallocx\fR\fB\fR, and -\fBxallocx\fR\fB\fR +realloc(), +rallocx(), and +xallocx() functions may resize allocations without moving them under limited circumstances\&. Unlike the -\fB*allocx\fR\fB\fR +*allocx() API, the standard API does not officially round up the usable size of an allocation to the nearest size class, so technically it is necessary to call -\fBrealloc\fR\fB\fR +realloc() to grow e\&.g\&. a 9\-byte allocation to 16 bytes, or shrink a 16\-byte allocation to 9 bytes\&. Growth and shrinkage trivially succeeds in place as long as the pre\-size and post\-size both round up to the same size class\&. No other API guarantees are made regarding in\-place resizing, but the current implementation also tries to resize large and huge allocations in place, as long as the pre\-size and post\-size are both large or both huge\&. In such cases shrinkage always succeeds for large size classes, but for huge size classes the chunk allocator must support splitting (see -"arena\&.\&.chunk_hooks")\&. Growth only succeeds if the trailing memory is currently available, and additionally for huge size classes the chunk allocator must support merging\&. +arena\&.\&.chunk_hooks)\&. Growth only succeeds if the trailing memory is currently available, and additionally for huge size classes the chunk allocator must support merging\&. .PP Assuming 2 MiB chunks, 4 KiB pages, and a 16\-byte quantum on a 64\-bit system, the size classes in each category are as shown in Table 1\&. @@ -663,7 +682,7 @@ T} .SH "MALLCTL NAMESPACE" .PP The following names are defined in the namespace accessible via the -\fBmallctl*\fR\fB\fR +mallctl*() functions\&. Value types are specified in parentheses, their readable/writable statuses are encoded as rw, r\-, @@ -673,118 +692,118 @@ r\-, or indicates an integer component, where the integer varies from 0 to some upper value that must be determined via introspection\&. In the case of -"stats\&.arenas\&.\&.*", +stats\&.arenas\&.\&.*, equal to -"arenas\&.narenas" +arenas\&.narenas can be used to access the summation of statistics from all arenas\&. Take special note of the -"epoch" +epoch mallctl, which controls refreshing of cached dynamic statistics\&. .PP -"version" (\fBconst char *\fR) r\- +version (\fBconst char *\fR) r\- .RS 4 Return the jemalloc version string\&. .RE .PP -"epoch" (\fBuint64_t\fR) rw +epoch (\fBuint64_t\fR) rw .RS 4 If a value is passed in, refresh the data from which the -\fBmallctl*\fR\fB\fR +mallctl*() functions report values, and increment the epoch\&. Return the current epoch\&. This is useful for detecting whether another thread caused a refresh\&. .RE .PP -"config\&.cache_oblivious" (\fBbool\fR) r\- +config\&.cache_oblivious (\fBbool\fR) r\- .RS 4 \fB\-\-enable\-cache\-oblivious\fR was specified during build configuration\&. .RE .PP -"config\&.debug" (\fBbool\fR) r\- +config\&.debug (\fBbool\fR) r\- .RS 4 \fB\-\-enable\-debug\fR was specified during build configuration\&. .RE .PP -"config\&.fill" (\fBbool\fR) r\- +config\&.fill (\fBbool\fR) r\- .RS 4 \fB\-\-enable\-fill\fR was specified during build configuration\&. .RE .PP -"config\&.lazy_lock" (\fBbool\fR) r\- +config\&.lazy_lock (\fBbool\fR) r\- .RS 4 \fB\-\-enable\-lazy\-lock\fR was specified during build configuration\&. .RE .PP -"config\&.malloc_conf" (\fBconst char *\fR) r\- +config\&.malloc_conf (\fBconst char *\fR) r\- .RS 4 Embedded configure\-time\-specified run\-time options string, empty unless \fB\-\-with\-malloc\-conf\fR was specified during build configuration\&. .RE .PP -"config\&.munmap" (\fBbool\fR) r\- +config\&.munmap (\fBbool\fR) r\- .RS 4 \fB\-\-enable\-munmap\fR was specified during build configuration\&. .RE .PP -"config\&.prof" (\fBbool\fR) r\- +config\&.prof (\fBbool\fR) r\- .RS 4 \fB\-\-enable\-prof\fR was specified during build configuration\&. .RE .PP -"config\&.prof_libgcc" (\fBbool\fR) r\- +config\&.prof_libgcc (\fBbool\fR) r\- .RS 4 \fB\-\-disable\-prof\-libgcc\fR was not specified during build configuration\&. .RE .PP -"config\&.prof_libunwind" (\fBbool\fR) r\- +config\&.prof_libunwind (\fBbool\fR) r\- .RS 4 \fB\-\-enable\-prof\-libunwind\fR was specified during build configuration\&. .RE .PP -"config\&.stats" (\fBbool\fR) r\- +config\&.stats (\fBbool\fR) r\- .RS 4 \fB\-\-enable\-stats\fR was specified during build configuration\&. .RE .PP -"config\&.tcache" (\fBbool\fR) r\- +config\&.tcache (\fBbool\fR) r\- .RS 4 \fB\-\-disable\-tcache\fR was not specified during build configuration\&. .RE .PP -"config\&.tls" (\fBbool\fR) r\- +config\&.tls (\fBbool\fR) r\- .RS 4 \fB\-\-disable\-tls\fR was not specified during build configuration\&. .RE .PP -"config\&.utrace" (\fBbool\fR) r\- +config\&.utrace (\fBbool\fR) r\- .RS 4 \fB\-\-enable\-utrace\fR was specified during build configuration\&. .RE .PP -"config\&.valgrind" (\fBbool\fR) r\- +config\&.valgrind (\fBbool\fR) r\- .RS 4 \fB\-\-enable\-valgrind\fR was specified during build configuration\&. .RE .PP -"config\&.xmalloc" (\fBbool\fR) r\- +config\&.xmalloc (\fBbool\fR) r\- .RS 4 \fB\-\-enable\-xmalloc\fR was specified during build configuration\&. .RE .PP -"opt\&.abort" (\fBbool\fR) r\- +opt\&.abort (\fBbool\fR) r\- .RS 4 Abort\-on\-warning enabled/disabled\&. If true, most warnings are fatal\&. The process will call \fBabort\fR(3) @@ -793,115 +812,132 @@ in these cases\&. This option is disable is specified during configuration, in which case it is enabled by default\&. .RE .PP -"opt\&.dss" (\fBconst char *\fR) r\- +opt\&.dss (\fBconst char *\fR) r\- .RS 4 dss (\fBsbrk\fR(2)) allocation precedence as related to \fBmmap\fR(2) allocation\&. The following settings are supported if \fBsbrk\fR(2) -is supported by the operating system: \(lqdisabled\(rq, \(lqprimary\(rq, and \(lqsecondary\(rq; otherwise only \(lqdisabled\(rq is supported\&. The default is \(lqsecondary\(rq if +is supported by the operating system: +\(lqdisabled\(rq, +\(lqprimary\(rq, and +\(lqsecondary\(rq; otherwise only +\(lqdisabled\(rq +is supported\&. The default is +\(lqsecondary\(rq +if \fBsbrk\fR(2) -is supported by the operating system; \(lqdisabled\(rq otherwise\&. +is supported by the operating system; +\(lqdisabled\(rq +otherwise\&. .RE .PP -"opt\&.lg_chunk" (\fBsize_t\fR) r\- +opt\&.lg_chunk (\fBsize_t\fR) r\- .RS 4 Virtual memory chunk size (log base 2)\&. If a chunk size outside the supported size range is specified, the size is silently clipped to the minimum/maximum supported size\&. The default chunk size is 2 MiB (2^21)\&. .RE .PP -"opt\&.narenas" (\fBunsigned\fR) r\- +opt\&.narenas (\fBunsigned\fR) r\- .RS 4 Maximum number of arenas to use for automatic multiplexing of threads and arenas\&. The default is four times the number of CPUs, or one if there is a single CPU\&. .RE .PP -"opt\&.purge" (\fBconst char *\fR) r\- +opt\&.purge (\fBconst char *\fR) r\- .RS 4 Purge mode is \(lqratio\(rq (default) or \(lqdecay\(rq\&. See -"opt\&.lg_dirty_mult" +opt\&.lg_dirty_mult for details of the ratio mode\&. See -"opt\&.decay_time" +opt\&.decay_time for details of the decay mode\&. .RE .PP -"opt\&.lg_dirty_mult" (\fBssize_t\fR) r\- +opt\&.lg_dirty_mult (\fBssize_t\fR) r\- .RS 4 Per\-arena minimum ratio (log base 2) of active to dirty pages\&. Some dirty unused pages may be allowed to accumulate, within the limit set by the ratio (or one chunk worth of dirty pages, whichever is greater), before informing the kernel about some of those pages via \fBmadvise\fR(2) or a similar system call\&. This provides the kernel with sufficient information to recycle dirty pages if physical memory becomes scarce and the pages remain unused\&. The default minimum ratio is 8:1 (2^3:1); an option value of \-1 will disable dirty page purging\&. See -"arenas\&.lg_dirty_mult" +arenas\&.lg_dirty_mult and -"arena\&.\&.lg_dirty_mult" +arena\&.\&.lg_dirty_mult for related dynamic control options\&. .RE .PP -"opt\&.decay_time" (\fBssize_t\fR) r\- +opt\&.decay_time (\fBssize_t\fR) r\- .RS 4 Approximate time in seconds from the creation of a set of unused dirty pages until an equivalent set of unused dirty pages is purged and/or reused\&. The pages are incrementally purged according to a sigmoidal decay curve that starts and ends with zero purge rate\&. A decay time of 0 causes all unused dirty pages to be purged immediately upon creation\&. A decay time of \-1 disables purging\&. The default decay time is 10 seconds\&. See -"arenas\&.decay_time" +arenas\&.decay_time and -"arena\&.\&.decay_time" +arena\&.\&.decay_time for related dynamic control options\&. .RE .PP -"opt\&.stats_print" (\fBbool\fR) r\- +opt\&.stats_print (\fBbool\fR) r\- .RS 4 Enable/disable statistics printing at exit\&. If enabled, the -\fBmalloc_stats_print\fR\fB\fR +malloc_stats_print() function is called at program exit via an \fBatexit\fR(3) function\&. If \fB\-\-enable\-stats\fR is specified during configuration, this has the potential to cause deadlock for a multi\-threaded process that exits while one or more threads are executing in the memory allocation functions\&. Furthermore, -\fBatexit\fR\fB\fR +atexit() may allocate memory during application initialization and then deadlock internally when jemalloc in turn calls -\fBatexit\fR\fB\fR, so this option is not universally usable (though the application can register its own -\fBatexit\fR\fB\fR +atexit(), so this option is not universally usable (though the application can register its own +atexit() function with equivalent functionality)\&. Therefore, this option should only be used with care; it is primarily intended as a performance tuning aid during application development\&. This option is disabled by default\&. .RE .PP -"opt\&.junk" (\fBconst char *\fR) r\- [\fB\-\-enable\-fill\fR] +opt\&.junk (\fBconst char *\fR) r\- [\fB\-\-enable\-fill\fR] .RS 4 -Junk filling\&. If set to "alloc", each byte of uninitialized allocated memory will be initialized to -0xa5\&. If set to "free", all deallocated memory will be initialized to -0x5a\&. If set to "true", both allocated and deallocated memory will be initialized, and if set to "false", junk filling be disabled entirely\&. This is intended for debugging and will impact performance negatively\&. This option is "false" by default unless +Junk filling\&. If set to +\(lqalloc\(rq, each byte of uninitialized allocated memory will be initialized to +0xa5\&. If set to +\(lqfree\(rq, all deallocated memory will be initialized to +0x5a\&. If set to +\(lqtrue\(rq, both allocated and deallocated memory will be initialized, and if set to +\(lqfalse\(rq, junk filling be disabled entirely\&. This is intended for debugging and will impact performance negatively\&. This option is +\(lqfalse\(rq +by default unless \fB\-\-enable\-debug\fR -is specified during configuration, in which case it is "true" by default unless running inside -\m[blue]\fBValgrind\fR\m[]\&\s-2\u[2]\d\s+2\&. +is specified during configuration, in which case it is +\(lqtrue\(rq +by default unless running inside +\m[blue]\fBValgrind\fR\m[]\&\s-2\u[3]\d\s+2\&. .RE .PP -"opt\&.quarantine" (\fBsize_t\fR) r\- [\fB\-\-enable\-fill\fR] +opt\&.quarantine (\fBsize_t\fR) r\- [\fB\-\-enable\-fill\fR] .RS 4 Per thread quarantine size in bytes\&. If non\-zero, each thread maintains a FIFO object quarantine that stores up to the specified number of bytes of memory\&. The quarantined memory is not freed until it is released from quarantine, though it is immediately junk\-filled if the -"opt\&.junk" +opt\&.junk option is enabled\&. This feature is of particular use in combination with -\m[blue]\fBValgrind\fR\m[]\&\s-2\u[2]\d\s+2, which can detect attempts to access quarantined objects\&. This is intended for debugging and will impact performance negatively\&. The default quarantine size is 0 unless running inside Valgrind, in which case the default is 16 MiB\&. +\m[blue]\fBValgrind\fR\m[]\&\s-2\u[3]\d\s+2, which can detect attempts to access quarantined objects\&. This is intended for debugging and will impact performance negatively\&. The default quarantine size is 0 unless running inside Valgrind, in which case the default is 16 MiB\&. .RE .PP -"opt\&.redzone" (\fBbool\fR) r\- [\fB\-\-enable\-fill\fR] +opt\&.redzone (\fBbool\fR) r\- [\fB\-\-enable\-fill\fR] .RS 4 Redzones enabled/disabled\&. If enabled, small allocations have redzones before and after them\&. Furthermore, if the -"opt\&.junk" +opt\&.junk option is enabled, the redzones are checked for corruption during deallocation\&. However, the primary intended purpose of this feature is to be used in combination with -\m[blue]\fBValgrind\fR\m[]\&\s-2\u[2]\d\s+2, which needs redzones in order to do effective buffer overflow/underflow detection\&. This option is intended for debugging and will impact performance negatively\&. This option is disabled by default unless running inside Valgrind\&. +\m[blue]\fBValgrind\fR\m[]\&\s-2\u[3]\d\s+2, which needs redzones in order to do effective buffer overflow/underflow detection\&. This option is intended for debugging and will impact performance negatively\&. This option is disabled by default unless running inside Valgrind\&. .RE .PP -"opt\&.zero" (\fBbool\fR) r\- [\fB\-\-enable\-fill\fR] +opt\&.zero (\fBbool\fR) r\- [\fB\-\-enable\-fill\fR] .RS 4 Zero filling enabled/disabled\&. If enabled, each byte of uninitialized allocated memory will be initialized to 0\&. Note that this initialization only happens once for each byte, so -\fBrealloc\fR\fB\fR +realloc() and -\fBrallocx\fR\fB\fR +rallocx() calls do not zero memory that was previously allocated\&. This is intended for debugging and will impact performance negatively\&. This option is disabled by default\&. .RE .PP -"opt\&.utrace" (\fBbool\fR) r\- [\fB\-\-enable\-utrace\fR] +opt\&.utrace (\fBbool\fR) r\- [\fB\-\-enable\-utrace\fR] .RS 4 Allocation tracing based on \fButrace\fR(2) enabled/disabled\&. This option is disabled by default\&. .RE .PP -"opt\&.xmalloc" (\fBbool\fR) r\- [\fB\-\-enable\-xmalloc\fR] +opt\&.xmalloc (\fBbool\fR) r\- [\fB\-\-enable\-xmalloc\fR] .RS 4 Abort\-on\-out\-of\-memory enabled/disabled\&. If enabled, rather than returning failure for any allocation function, display a diagnostic message on \fBSTDERR_FILENO\fR @@ -921,94 +957,94 @@ malloc_conf = "xmalloc:true"; This option is disabled by default\&. .RE .PP -"opt\&.tcache" (\fBbool\fR) r\- [\fB\-\-enable\-tcache\fR] +opt\&.tcache (\fBbool\fR) r\- [\fB\-\-enable\-tcache\fR] .RS 4 Thread\-specific caching (tcache) enabled/disabled\&. When there are multiple threads, each thread uses a tcache for objects up to a certain size\&. Thread\-specific caching allows many allocations to be satisfied without performing any thread synchronization, at the cost of increased memory use\&. See the -"opt\&.lg_tcache_max" +opt\&.lg_tcache_max option for related tuning information\&. This option is enabled by default unless running inside -\m[blue]\fBValgrind\fR\m[]\&\s-2\u[2]\d\s+2, in which case it is forcefully disabled\&. +\m[blue]\fBValgrind\fR\m[]\&\s-2\u[3]\d\s+2, in which case it is forcefully disabled\&. .RE .PP -"opt\&.lg_tcache_max" (\fBsize_t\fR) r\- [\fB\-\-enable\-tcache\fR] +opt\&.lg_tcache_max (\fBsize_t\fR) r\- [\fB\-\-enable\-tcache\fR] .RS 4 Maximum size class (log base 2) to cache in the thread\-specific cache (tcache)\&. At a minimum, all small size classes are cached, and at a maximum all large size classes are cached\&. The default maximum is 32 KiB (2^15)\&. .RE .PP -"opt\&.prof" (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR] +opt\&.prof (\fBbool\fR) r\- [\fB\-\-enable\-prof\fR] .RS 4 Memory profiling enabled/disabled\&. If enabled, profile memory allocation activity\&. See the -"opt\&.prof_active" +opt\&.prof_active option for on\-the\-fly activation/deactivation\&. See the -"opt\&.lg_prof_sample" +opt\&.lg_prof_sample option for probabilistic sampling control\&. See the -"opt\&.prof_accum" +opt\&.prof_accum option for control of cumulative sample reporting\&. See the -"opt\&.lg_prof_interval" +opt\&.lg_prof_interval option for information on interval\-triggered profile dumping, the -"opt\&.prof_gdump" +opt\&.prof_gdump option for information on high\-water\-triggered profile dumping, and the -"opt\&.prof_final" +opt\&.prof_final option for final profile dumping\&. Profile output is compatible with the \fBjeprof\fR command, which is based on the \fBpprof\fR that is developed as part of the -\m[blue]\fBgperftools package\fR\m[]\&\s-2\u[3]\d\s+2\&. See +\m[blue]\fBgperftools package\fR\m[]\&\s-2\u[4]\d\s+2\&. See *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 9 18:48:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DEF0C37813; Wed, 9 Nov 2016 18:48:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3975E37F; Wed, 9 Nov 2016 18:48:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA9ImcdT013841; Wed, 9 Nov 2016 18:48:38 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA9ImbLT013831; Wed, 9 Nov 2016 18:48:37 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201611091848.uA9ImbLT013831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Wed, 9 Nov 2016 18:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308474 - in head/sys: sys vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 18:48:39 -0000 Author: alc Date: Wed Nov 9 18:48:37 2016 New Revision: 308474 URL: https://svnweb.freebsd.org/changeset/base/308474 Log: Introduce a new page queue, PQ_LAUNDRY, for storing unreferenced, dirty pages, specificially, dirty pages that have passed once through the inactive queue. A new, dedicated thread is responsible for both deciding when to launder pages and actually laundering them. The new policy uses the relative sizes of the inactive and laundry queues to determine whether to launder pages at a given point in time. In general, this leads to more intelligent swapping behavior, since the laundry thread will avoid pageouts when the marginal benefit of doing so is low. Previously, without a dedicated queue for dirty pages, the page daemon didn't have the information to determine whether pageout provides any benefit to the system. Thus, the previous policy often resulted in small but steadily increasing amounts of swap usage when the system is under memory pressure, even when the inactive queue consisted mostly of clean pages. This change addresses that issue, and also paves the way for some future virtual memory system improvements by removing the last source of object-cached clean pages, i.e., PG_CACHE pages. The new laundry thread sleeps while waiting for a request from the page daemon thread(s). A request is raised by setting the variable vm_laundry_request and waking the laundry thread. We request launderings for two reasons: to try and balance the inactive and laundry queue sizes ("background laundering"), and to quickly make up for a shortage of free pages and clean inactive pages ("shortfall laundering"). When background laundering is requested, the laundry thread computes the number of page daemon wakeups that have taken place since the last laundering. If this number is large enough relative to the ratio of the laundry and (global) inactive queue sizes, we will launder vm_background_launder_target pages at vm_background_launder_rate KB/s. Otherwise, the laundry thread goes back to sleep without doing any work. When scanning the laundry queue during background laundering, reactivated pages are counted towards the laundry thread's target. In contrast, shortfall laundering is requested when an inactive queue scan fails to meet its target. In this case, the laundry thread attempts to launder enough pages to meet v_free_target within 0.5s, which is the inactive queue scan period. A laundry request can be latched while another is currently being serviced. In particular, a shortfall request will immediately preempt a background laundering. This change also redefines the meaning of vm_cnt.v_reactivated and removes the functions vm_page_cache() and vm_page_try_to_cache(). The new meaning of vm_cnt.v_reactivated now better reflects its name. It represents the number of inactive or laundry pages that are returned to the active queue on account of a reference. In collaboration with: markj Reviewed by: kib Tested by: pho Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8302 Modified: head/sys/sys/vmmeter.h head/sys/vm/swap_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_meter.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c Modified: head/sys/sys/vmmeter.h ============================================================================== --- head/sys/sys/vmmeter.h Wed Nov 9 18:42:30 2016 (r308473) +++ head/sys/sys/vmmeter.h Wed Nov 9 18:48:37 2016 (r308474) @@ -75,9 +75,10 @@ struct vmmeter { u_int v_vnodepgsin; /* (p) vnode_pager pages paged in */ u_int v_vnodepgsout; /* (p) vnode pager pages paged out */ u_int v_intrans; /* (p) intransit blocking page faults */ - u_int v_reactivated; /* (f) pages reactivated from free list */ + u_int v_reactivated; /* (p) pages reactivated by the pagedaemon */ u_int v_pdwakeups; /* (p) times daemon has awaken from sleep */ u_int v_pdpages; /* (p) pages analyzed by daemon */ + u_int v_pdshortfalls; /* (p) page reclamation shortfalls */ u_int v_tcached; /* (p) total pages cached */ u_int v_dfree; /* (p) pages freed by daemon */ @@ -96,6 +97,7 @@ struct vmmeter { u_int v_active_count; /* (q) pages active */ u_int v_inactive_target; /* (c) pages desired inactive */ u_int v_inactive_count; /* (q) pages inactive */ + u_int v_laundry_count; /* (q) pages eligible for laundering */ u_int v_cache_count; /* (f) pages on cache queue */ u_int v_pageout_free_min; /* (c) min pages reserved for kernel */ u_int v_interrupt_free_min; /* (c) reserved pages for int code */ @@ -111,7 +113,6 @@ struct vmmeter { u_int v_vforkpages; /* (p) VM pages affected by vfork() */ u_int v_rforkpages; /* (p) VM pages affected by rfork() */ u_int v_kthreadpages; /* (p) VM pages affected by fork() by kernel */ - u_int v_spare[2]; }; #ifdef _KERNEL @@ -184,6 +185,25 @@ vm_paging_needed(void) vm_pageout_wakeup_thresh); } +/* + * Return the number of pages we need to launder. + * A positive number indicates that we have a shortfall of clean pages. + */ +static inline int +vm_laundry_target(void) +{ + + return (vm_paging_target()); +} + +/* + * Obtain the value of a per-CPU counter. + */ +#define VM_METER_PCPU_CNT(member) \ + vm_meter_cnt(__offsetof(struct vmmeter, member)) + +u_int vm_meter_cnt(size_t); + #endif /* systemwide totals computed every five seconds */ Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Wed Nov 9 18:42:30 2016 (r308473) +++ head/sys/vm/swap_pager.c Wed Nov 9 18:48:37 2016 (r308474) @@ -1549,17 +1549,18 @@ swp_pager_async_iodone(struct buf *bp) * For write success, clear the dirty * status, then finish the I/O ( which decrements the * busy count and possibly wakes waiter's up ). + * A page is only written to swap after a period of + * inactivity. Therefore, we do not expect it to be + * reused. */ KASSERT(!pmap_page_is_write_mapped(m), ("swp_pager_async_iodone: page %p is not write" " protected", m)); vm_page_undirty(m); + vm_page_lock(m); + vm_page_deactivate_noreuse(m); + vm_page_unlock(m); vm_page_sunbusy(m); - if (vm_page_count_severe()) { - vm_page_lock(m); - vm_page_try_to_cache(m); - vm_page_unlock(m); - } } } @@ -1635,12 +1636,15 @@ swap_pager_isswapped(vm_object_t object, /* * SWP_PAGER_FORCE_PAGEIN() - force a swap block to be paged in * - * This routine dissociates the page at the given index within a - * swap block from its backing store, paging it in if necessary. - * If the page is paged in, it is placed in the inactive queue, - * since it had its backing store ripped out from under it. - * We also attempt to swap in all other pages in the swap block, - * we only guarantee that the one at the specified index is + * This routine dissociates the page at the given index within an object + * from its backing store, paging it in if it does not reside in memory. + * If the page is paged in, it is marked dirty and placed in the laundry + * queue. The page is marked dirty because it no longer has backing + * store. It is placed in the laundry queue because it has not been + * accessed recently. Otherwise, it would already reside in memory. + * + * We also attempt to swap in all other pages in the swap block. + * However, we only guarantee that the one at the specified index is * paged in. * * XXX - The code to page the whole block in doesn't work, so we @@ -1669,7 +1673,7 @@ swp_pager_force_pagein(vm_object_t objec vm_object_pip_wakeup(object); vm_page_dirty(m); vm_page_lock(m); - vm_page_deactivate(m); + vm_page_launder(m); vm_page_unlock(m); vm_page_xunbusy(m); vm_pager_page_unswapped(m); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Wed Nov 9 18:42:30 2016 (r308473) +++ head/sys/vm/vm_fault.c Wed Nov 9 18:48:37 2016 (r308474) @@ -290,12 +290,13 @@ int vm_fault_hold(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, int fault_flags, vm_page_t *m_hold) { - vm_prot_t prot; - vm_object_t next_object; struct faultstate fs; struct vnode *vp; + vm_object_t next_object, retry_object; vm_offset_t e_end, e_start; vm_page_t m; + vm_pindex_t retry_pindex; + vm_prot_t prot, retry_prot; int ahead, alloc_req, behind, cluster_offset, error, era, faultcount; int locked, map_generation, nera, result, rv; u_char behavior; @@ -946,10 +947,6 @@ readrest: * lookup. */ if (!fs.lookup_still_valid) { - vm_object_t retry_object; - vm_pindex_t retry_pindex; - vm_prot_t retry_prot; - if (!vm_map_trylock_read(fs.map)) { release_page(&fs); unlock_and_deallocate(&fs); Modified: head/sys/vm/vm_meter.c ============================================================================== --- head/sys/vm/vm_meter.c Wed Nov 9 18:42:30 2016 (r308473) +++ head/sys/vm/vm_meter.c Wed Nov 9 18:48:37 2016 (r308474) @@ -216,29 +216,37 @@ vmtotal(SYSCTL_HANDLER_ARGS) } /* - * vcnt() - accumulate statistics from all cpus and the global cnt - * structure. + * vm_meter_cnt() - accumulate statistics from all cpus and the global cnt + * structure. * * The vmmeter structure is now per-cpu as well as global. Those * statistics which can be kept on a per-cpu basis (to avoid cache * stalls between cpus) can be moved to the per-cpu vmmeter. Remaining * statistics, such as v_free_reserved, are left in the global * structure. - * - * (sysctl_oid *oidp, void *arg1, int arg2, struct sysctl_req *req) */ -static int -vcnt(SYSCTL_HANDLER_ARGS) +u_int +vm_meter_cnt(size_t offset) { - int count = *(int *)arg1; - int offset = (char *)arg1 - (char *)&vm_cnt; + struct pcpu *pcpu; + u_int count; int i; + count = *(u_int *)((char *)&vm_cnt + offset); CPU_FOREACH(i) { - struct pcpu *pcpu = pcpu_find(i); - count += *(int *)((char *)&pcpu->pc_cnt + offset); + pcpu = pcpu_find(i); + count += *(u_int *)((char *)&pcpu->pc_cnt + offset); } - return (SYSCTL_OUT(req, &count, sizeof(int))); + return (count); +} + +static int +cnt_sysctl(SYSCTL_HANDLER_ARGS) +{ + u_int count; + + count = vm_meter_cnt((char *)arg1 - (char *)&vm_cnt); + return (SYSCTL_OUT(req, &count, sizeof(count))); } SYSCTL_PROC(_vm, VM_TOTAL, vmtotal, CTLTYPE_OPAQUE|CTLFLAG_RD|CTLFLAG_MPSAFE, @@ -253,8 +261,8 @@ SYSCTL_NODE(_vm_stats, OID_AUTO, misc, C #define VM_STATS(parent, var, descr) \ SYSCTL_PROC(parent, OID_AUTO, var, \ - CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_MPSAFE, &vm_cnt.var, 0, vcnt, \ - "IU", descr) + CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_MPSAFE, &vm_cnt.var, 0, \ + cnt_sysctl, "IU", descr) #define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr) #define VM_STATS_SYS(var, descr) VM_STATS(_vm_stats_sys, var, descr) @@ -278,9 +286,10 @@ VM_STATS_VM(v_vnodeout, "Vnode pager pag VM_STATS_VM(v_vnodepgsin, "Vnode pages paged in"); VM_STATS_VM(v_vnodepgsout, "Vnode pages paged out"); VM_STATS_VM(v_intrans, "In transit page faults"); -VM_STATS_VM(v_reactivated, "Pages reactivated from free list"); +VM_STATS_VM(v_reactivated, "Pages reactivated by pagedaemon"); VM_STATS_VM(v_pdwakeups, "Pagedaemon wakeups"); VM_STATS_VM(v_pdpages, "Pages analyzed by pagedaemon"); +VM_STATS_VM(v_pdshortfalls, "Page reclamation shortfalls"); VM_STATS_VM(v_tcached, "Total pages cached"); VM_STATS_VM(v_dfree, "Pages freed by pagedaemon"); VM_STATS_VM(v_pfree, "Pages freed by exiting processes"); @@ -295,6 +304,7 @@ VM_STATS_VM(v_wire_count, "Wired pages") VM_STATS_VM(v_active_count, "Active pages"); VM_STATS_VM(v_inactive_target, "Desired inactive pages"); VM_STATS_VM(v_inactive_count, "Inactive pages"); +VM_STATS_VM(v_laundry_count, "Pages eligible for laundering"); VM_STATS_VM(v_cache_count, "Pages on cache queue"); VM_STATS_VM(v_pageout_free_min, "Min pages reserved for kernel"); VM_STATS_VM(v_interrupt_free_min, "Reserved pages for interrupt code"); Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed Nov 9 18:42:30 2016 (r308473) +++ head/sys/vm/vm_object.c Wed Nov 9 18:48:37 2016 (r308474) @@ -2329,9 +2329,9 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARG * sysctl is only meant to give an * approximation of the system anyway. */ - if (m->queue == PQ_ACTIVE) + if (vm_page_active(m)) kvo.kvo_active++; - else if (m->queue == PQ_INACTIVE) + else if (vm_page_inactive(m)) kvo.kvo_inactive++; } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Nov 9 18:42:30 2016 (r308473) +++ head/sys/vm/vm_page.c Wed Nov 9 18:48:37 2016 (r308474) @@ -390,6 +390,10 @@ vm_page_domain_init(struct vm_domain *vm "vm active pagequeue"; *__DECONST(u_int **, &vmd->vmd_pagequeues[PQ_ACTIVE].pq_vcnt) = &vm_cnt.v_active_count; + *__DECONST(char **, &vmd->vmd_pagequeues[PQ_LAUNDRY].pq_name) = + "vm laundry pagequeue"; + *__DECONST(int **, &vmd->vmd_pagequeues[PQ_LAUNDRY].pq_vcnt) = + &vm_cnt.v_laundry_count; vmd->vmd_page_count = 0; vmd->vmd_free_count = 0; vmd->vmd_segs = 0; @@ -1730,9 +1734,7 @@ vm_page_alloc(vm_object_t object, vm_pin ("vm_page_alloc: cached page %p is PG_ZERO", m)); KASSERT(m->valid != 0, ("vm_page_alloc: cached page %p is invalid", m)); - if (m->object == object && m->pindex == pindex) - vm_cnt.v_reactivated++; - else + if (m->object != object || m->pindex != pindex) m->valid = 0; m_object = m->object; vm_page_cache_remove(m); @@ -2254,7 +2256,7 @@ retry: } KASSERT((m->flags & PG_UNHOLDFREE) == 0, ("page %p is PG_UNHOLDFREE", m)); - /* Don't care: PG_NODUMP, PG_WINATCFLS, PG_ZERO. */ + /* Don't care: PG_NODUMP, PG_ZERO. */ if (object->type != OBJT_DEFAULT && object->type != OBJT_SWAP && object->type != OBJT_VNODE) @@ -2450,7 +2452,7 @@ retry: } KASSERT((m->flags & PG_UNHOLDFREE) == 0, ("page %p is PG_UNHOLDFREE", m)); - /* Don't care: PG_NODUMP, PG_WINATCFLS, PG_ZERO. */ + /* Don't care: PG_NODUMP, PG_ZERO. */ if (object->type != OBJT_DEFAULT && object->type != OBJT_SWAP && object->type != OBJT_VNODE) @@ -2778,7 +2780,10 @@ struct vm_pagequeue * vm_page_pagequeue(vm_page_t m) { - return (&vm_phys_domain(m)->vmd_pagequeues[m->queue]); + if (vm_page_in_laundry(m)) + return (&vm_dom[0].vmd_pagequeues[m->queue]); + else + return (&vm_phys_domain(m)->vmd_pagequeues[m->queue]); } /* @@ -2840,7 +2845,10 @@ vm_page_enqueue(uint8_t queue, vm_page_t KASSERT(queue < PQ_COUNT, ("vm_page_enqueue: invalid queue %u request for page %p", queue, m)); - pq = &vm_phys_domain(m)->vmd_pagequeues[queue]; + if (queue == PQ_LAUNDRY) + pq = &vm_dom[0].vmd_pagequeues[queue]; + else + pq = &vm_phys_domain(m)->vmd_pagequeues[queue]; vm_pagequeue_lock(pq); m->queue = queue; TAILQ_INSERT_TAIL(&pq->pq_pl, m, plinks.q); @@ -3124,11 +3132,8 @@ vm_page_unwire(vm_page_t m, uint8_t queu if (m->wire_count == 0) { atomic_subtract_int(&vm_cnt.v_wire_count, 1); if ((m->oflags & VPO_UNMANAGED) == 0 && - m->object != NULL && queue != PQ_NONE) { - if (queue == PQ_INACTIVE) - m->flags &= ~PG_WINATCFLS; + m->object != NULL && queue != PQ_NONE) vm_page_enqueue(queue, m); - } return (TRUE); } else return (FALSE); @@ -3181,7 +3186,6 @@ _vm_page_deactivate(vm_page_t m, boolean } else { if (queue != PQ_NONE) vm_page_dequeue(m); - m->flags &= ~PG_WINATCFLS; vm_pagequeue_lock(pq); } m->queue = PQ_INACTIVE; @@ -3221,24 +3225,25 @@ vm_page_deactivate_noreuse(vm_page_t m) } /* - * vm_page_try_to_cache: + * vm_page_launder * - * Returns 0 on failure, 1 on success + * Put a page in the laundry. */ -int -vm_page_try_to_cache(vm_page_t m) +void +vm_page_launder(vm_page_t m) { + int queue; - vm_page_lock_assert(m, MA_OWNED); - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (m->dirty || m->hold_count || m->wire_count || - (m->oflags & VPO_UNMANAGED) != 0 || vm_page_busied(m)) - return (0); - pmap_remove_all(m); - if (m->dirty) - return (0); - vm_page_cache(m); - return (1); + vm_page_assert_locked(m); + if ((queue = m->queue) != PQ_LAUNDRY) { + if (m->wire_count == 0 && (m->oflags & VPO_UNMANAGED) == 0) { + if (queue != PQ_NONE) + vm_page_dequeue(m); + vm_page_enqueue(PQ_LAUNDRY, m); + } else + KASSERT(queue == PQ_NONE, + ("wired page %p is queued", m)); + } } /* @@ -3265,112 +3270,6 @@ vm_page_try_to_free(vm_page_t m) } /* - * vm_page_cache - * - * Put the specified page onto the page cache queue (if appropriate). - * - * The object and page must be locked. - */ -void -vm_page_cache(vm_page_t m) -{ - vm_object_t object; - boolean_t cache_was_empty; - - vm_page_lock_assert(m, MA_OWNED); - object = m->object; - VM_OBJECT_ASSERT_WLOCKED(object); - if (vm_page_busied(m) || (m->oflags & VPO_UNMANAGED) || - m->hold_count || m->wire_count) - panic("vm_page_cache: attempting to cache busy page"); - KASSERT(!pmap_page_is_mapped(m), - ("vm_page_cache: page %p is mapped", m)); - KASSERT(m->dirty == 0, ("vm_page_cache: page %p is dirty", m)); - if (m->valid == 0 || object->type == OBJT_DEFAULT || - (object->type == OBJT_SWAP && - !vm_pager_has_page(object, m->pindex, NULL, NULL))) { - /* - * Hypothesis: A cache-eligible page belonging to a - * default object or swap object but without a backing - * store must be zero filled. - */ - vm_page_free(m); - return; - } - KASSERT((m->flags & PG_CACHED) == 0, - ("vm_page_cache: page %p is already cached", m)); - - /* - * Remove the page from the paging queues. - */ - vm_page_remque(m); - - /* - * Remove the page from the object's collection of resident - * pages. - */ - vm_radix_remove(&object->rtree, m->pindex); - TAILQ_REMOVE(&object->memq, m, listq); - object->resident_page_count--; - - /* - * Restore the default memory attribute to the page. - */ - if (pmap_page_get_memattr(m) != VM_MEMATTR_DEFAULT) - pmap_page_set_memattr(m, VM_MEMATTR_DEFAULT); - - /* - * Insert the page into the object's collection of cached pages - * and the physical memory allocator's cache/free page queues. - */ - m->flags &= ~PG_ZERO; - mtx_lock(&vm_page_queue_free_mtx); - cache_was_empty = vm_radix_is_empty(&object->cache); - if (vm_radix_insert(&object->cache, m)) { - mtx_unlock(&vm_page_queue_free_mtx); - if (object->type == OBJT_VNODE && - object->resident_page_count == 0) - vdrop(object->handle); - m->object = NULL; - vm_page_free(m); - return; - } - - /* - * The above call to vm_radix_insert() could reclaim the one pre- - * existing cached page from this object, resulting in a call to - * vdrop(). - */ - if (!cache_was_empty) - cache_was_empty = vm_radix_is_singleton(&object->cache); - - m->flags |= PG_CACHED; - vm_cnt.v_cache_count++; - PCPU_INC(cnt.v_tcached); -#if VM_NRESERVLEVEL > 0 - if (!vm_reserv_free_page(m)) { -#else - if (TRUE) { -#endif - vm_phys_free_pages(m, 0); - } - vm_page_free_wakeup(); - mtx_unlock(&vm_page_queue_free_mtx); - - /* - * Increment the vnode's hold count if this is the object's only - * cached page. Decrement the vnode's hold count if this was - * the object's only resident page. - */ - if (object->type == OBJT_VNODE) { - if (cache_was_empty && object->resident_page_count != 0) - vhold(object->handle); - else if (!cache_was_empty && object->resident_page_count == 0) - vdrop(object->handle); - } -} - -/* * vm_page_advise * * Deactivate or do nothing, as appropriate. @@ -3413,11 +3312,13 @@ vm_page_advise(vm_page_t m, int advice) /* * Place clean pages near the head of the inactive queue rather than * the tail, thus defeating the queue's LRU operation and ensuring that - * the page will be reused quickly. Dirty pages are given a chance to - * cycle once through the inactive queue before becoming eligible for - * laundering. + * the page will be reused quickly. Dirty pages not already in the + * laundry are moved there. */ - _vm_page_deactivate(m, m->dirty == 0); + if (m->dirty == 0) + vm_page_deactivate_noreuse(m); + else + vm_page_launder(m); } /* @@ -3926,6 +3827,7 @@ DB_SHOW_COMMAND(page, vm_page_print_page db_printf("vm_cnt.v_cache_count: %d\n", vm_cnt.v_cache_count); db_printf("vm_cnt.v_inactive_count: %d\n", vm_cnt.v_inactive_count); db_printf("vm_cnt.v_active_count: %d\n", vm_cnt.v_active_count); + db_printf("vm_cnt.v_laundry_count: %d\n", vm_cnt.v_laundry_count); db_printf("vm_cnt.v_wire_count: %d\n", vm_cnt.v_wire_count); db_printf("vm_cnt.v_free_reserved: %d\n", vm_cnt.v_free_reserved); db_printf("vm_cnt.v_free_min: %d\n", vm_cnt.v_free_min); @@ -3940,12 +3842,14 @@ DB_SHOW_COMMAND(pageq, vm_page_print_pag db_printf("pq_free %d pq_cache %d\n", vm_cnt.v_free_count, vm_cnt.v_cache_count); for (dom = 0; dom < vm_ndomains; dom++) { - db_printf("dom %d page_cnt %d free %d pq_act %d pq_inact %d\n", + db_printf( + "dom %d page_cnt %d free %d pq_act %d pq_inact %d pq_laund %d\n", dom, vm_dom[dom].vmd_page_count, vm_dom[dom].vmd_free_count, vm_dom[dom].vmd_pagequeues[PQ_ACTIVE].pq_cnt, - vm_dom[dom].vmd_pagequeues[PQ_INACTIVE].pq_cnt); + vm_dom[dom].vmd_pagequeues[PQ_INACTIVE].pq_cnt, + vm_dom[dom].vmd_pagequeues[PQ_LAUNDRY].pq_cnt); } } Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Wed Nov 9 18:42:30 2016 (r308473) +++ head/sys/vm/vm_page.h Wed Nov 9 18:48:37 2016 (r308474) @@ -206,7 +206,8 @@ struct vm_page { #define PQ_NONE 255 #define PQ_INACTIVE 0 #define PQ_ACTIVE 1 -#define PQ_COUNT 2 +#define PQ_LAUNDRY 2 +#define PQ_COUNT 3 TAILQ_HEAD(pglist, vm_page); SLIST_HEAD(spglist, vm_page); @@ -228,6 +229,7 @@ struct vm_domain { boolean_t vmd_oom; int vmd_oom_seq; int vmd_last_active_scan; + struct vm_page vmd_laundry_marker; struct vm_page vmd_marker; /* marker for pagedaemon private use */ struct vm_page vmd_inacthead; /* marker for LRU-defeating insertions */ }; @@ -236,6 +238,7 @@ extern struct vm_domain vm_dom[MAXMEMDOM #define vm_pagequeue_assert_locked(pq) mtx_assert(&(pq)->pq_mutex, MA_OWNED) #define vm_pagequeue_lock(pq) mtx_lock(&(pq)->pq_mutex) +#define vm_pagequeue_lockptr(pq) (&(pq)->pq_mutex) #define vm_pagequeue_unlock(pq) mtx_unlock(&(pq)->pq_mutex) #ifdef _KERNEL @@ -327,7 +330,6 @@ extern struct mtx_padalign pa_lock[]; #define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ #define PG_ZERO 0x0008 /* page is zeroed */ #define PG_MARKER 0x0010 /* special queue marker page */ -#define PG_WINATCFLS 0x0040 /* flush dirty page on inactive q */ #define PG_NODUMP 0x0080 /* don't include this page in a dump */ #define PG_UNHOLDFREE 0x0100 /* delayed free of a held page */ @@ -451,10 +453,8 @@ vm_page_t vm_page_alloc_contig(vm_object vm_paddr_t boundary, vm_memattr_t memattr); vm_page_t vm_page_alloc_freelist(int, int); vm_page_t vm_page_grab (vm_object_t, vm_pindex_t, int); -void vm_page_cache(vm_page_t); void vm_page_cache_free(vm_object_t, vm_pindex_t, vm_pindex_t); void vm_page_cache_transfer(vm_object_t, vm_pindex_t, vm_object_t); -int vm_page_try_to_cache (vm_page_t); int vm_page_try_to_free (vm_page_t); void vm_page_deactivate (vm_page_t); void vm_page_deactivate_noreuse(vm_page_t); @@ -465,6 +465,7 @@ vm_page_t vm_page_getfake(vm_paddr_t pad void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr); int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); boolean_t vm_page_is_cached(vm_object_t object, vm_pindex_t pindex); +void vm_page_launder(vm_page_t m); vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t); vm_page_t vm_page_next(vm_page_t m); int vm_page_pa_tryrelock(pmap_t, vm_paddr_t, vm_paddr_t *); @@ -697,5 +698,26 @@ vm_page_replace_checked(vm_page_t mnew, (void)mret; } +static inline bool +vm_page_active(vm_page_t m) +{ + + return (m->queue == PQ_ACTIVE); +} + +static inline bool +vm_page_inactive(vm_page_t m) +{ + + return (m->queue == PQ_INACTIVE); +} + +static inline bool +vm_page_in_laundry(vm_page_t m) +{ + + return (m->queue == PQ_LAUNDRY); +} + #endif /* _KERNEL */ #endif /* !_VM_PAGE_ */ Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Wed Nov 9 18:42:30 2016 (r308473) +++ head/sys/vm/vm_pageout.c Wed Nov 9 18:48:37 2016 (r308474) @@ -119,7 +119,7 @@ __FBSDID("$FreeBSD$"); /* the kernel process "vm_pageout"*/ static void vm_pageout(void); static void vm_pageout_init(void); -static int vm_pageout_clean(vm_page_t m); +static int vm_pageout_clean(vm_page_t m, int *numpagedout); static int vm_pageout_cluster(vm_page_t m); static bool vm_pageout_scan(struct vm_domain *vmd, int pass); static void vm_pageout_mightbe_oom(struct vm_domain *vmd, int page_shortage, @@ -154,6 +154,9 @@ static struct kproc_desc vm_kp = { SYSINIT(vmdaemon, SI_SUB_KTHREAD_VM, SI_ORDER_FIRST, kproc_start, &vm_kp); #endif +/* Pagedaemon activity rates, in subdivisions of one second. */ +#define VM_LAUNDER_RATE 10 +#define VM_INACT_SCAN_RATE 2 int vm_pageout_deficit; /* Estimated number of pages deficit */ u_int vm_pageout_wakeup_thresh; @@ -161,6 +164,13 @@ static int vm_pageout_oom_seq = 12; bool vm_pageout_wanted; /* Event on which pageout daemon sleeps */ bool vm_pages_needed; /* Are threads waiting for free pages? */ +/* Pending request for dirty page laundering. */ +static enum { + VM_LAUNDRY_IDLE, + VM_LAUNDRY_BACKGROUND, + VM_LAUNDRY_SHORTFALL +} vm_laundry_request = VM_LAUNDRY_IDLE; + #if !defined(NO_SWAPPING) static int vm_pageout_req_swapout; /* XXX */ static int vm_daemon_needed; @@ -168,9 +178,7 @@ static struct mtx vm_daemon_mtx; /* Allow for use by vm_pageout before vm_daemon is initialized. */ MTX_SYSINIT(vm_daemon, &vm_daemon_mtx, "vm daemon", MTX_DEF); #endif -static int vm_max_launder = 32; static int vm_pageout_update_period; -static int defer_swap_pageouts; static int disable_swap_pageouts; static int lowmem_period = 10; static time_t lowmem_uptime; @@ -193,9 +201,6 @@ SYSCTL_INT(_vm, OID_AUTO, pageout_wakeup CTLFLAG_RW, &vm_pageout_wakeup_thresh, 0, "free page threshold for waking up the pageout daemon"); -SYSCTL_INT(_vm, OID_AUTO, max_launder, - CTLFLAG_RW, &vm_max_launder, 0, "Limit dirty flushes in pageout"); - SYSCTL_INT(_vm, OID_AUTO, pageout_update_period, CTLFLAG_RW, &vm_pageout_update_period, 0, "Maximum active LRU update period"); @@ -215,9 +220,6 @@ SYSCTL_INT(_vm, OID_AUTO, swap_idle_enab CTLFLAG_RW, &vm_swap_idle_enabled, 0, "Allow swapout on idle criteria"); #endif -SYSCTL_INT(_vm, OID_AUTO, defer_swapspace_pageouts, - CTLFLAG_RW, &defer_swap_pageouts, 0, "Give preference to dirty pages in mem"); - SYSCTL_INT(_vm, OID_AUTO, disable_swapspace_pageouts, CTLFLAG_RW, &disable_swap_pageouts, 0, "Disallow swapout of dirty pages"); @@ -229,6 +231,25 @@ SYSCTL_INT(_vm, OID_AUTO, pageout_oom_se CTLFLAG_RW, &vm_pageout_oom_seq, 0, "back-to-back calls to oom detector to start OOM"); +static int act_scan_laundry_weight = 3; +SYSCTL_INT(_vm, OID_AUTO, act_scan_laundry_weight, CTLFLAG_RW, + &act_scan_laundry_weight, 0, + "weight given to clean vs. dirty pages in active queue scans"); + +static u_int vm_background_launder_target; +SYSCTL_UINT(_vm, OID_AUTO, background_launder_target, CTLFLAG_RW, + &vm_background_launder_target, 0, + "background laundering target, in pages"); + +static u_int vm_background_launder_rate = 4096; +SYSCTL_UINT(_vm, OID_AUTO, background_launder_rate, CTLFLAG_RW, + &vm_background_launder_rate, 0, + "background laundering rate, in kilobytes per second"); + +static u_int vm_background_launder_max = 20 * 1024; +SYSCTL_UINT(_vm, OID_AUTO, background_launder_max, CTLFLAG_RW, + &vm_background_launder_max, 0, "background laundering cap, in kilobytes"); + #define VM_PAGEOUT_PAGE_COUNT 16 int vm_pageout_page_count = VM_PAGEOUT_PAGE_COUNT; @@ -236,7 +257,11 @@ int vm_page_max_wired; /* XXX max # of SYSCTL_INT(_vm, OID_AUTO, max_wired, CTLFLAG_RW, &vm_page_max_wired, 0, "System-wide limit to wired page count"); +static u_int isqrt(u_int num); static boolean_t vm_pageout_fallback_object_lock(vm_page_t, vm_page_t *); +static int vm_pageout_launder(struct vm_domain *vmd, int launder, + bool in_shortfall); +static void vm_pageout_laundry_worker(void *arg); #if !defined(NO_SWAPPING) static void vm_pageout_map_deactivate_pages(vm_map_t, long); static void vm_pageout_object_deactivate_pages(pmap_t, vm_object_t, long); @@ -387,7 +412,7 @@ vm_pageout_cluster(vm_page_t m) /* * We can cluster only if the page is not clean, busy, or held, and - * the page is inactive. + * the page is in the laundry queue. * * During heavy mmap/modification loads the pageout * daemon can really fragment the underlying file @@ -413,7 +438,7 @@ more: break; } vm_page_lock(p); - if (p->queue != PQ_INACTIVE || + if (!vm_page_in_laundry(p) || p->hold_count != 0) { /* may be undergoing I/O */ vm_page_unlock(p); ib = 0; @@ -439,7 +464,7 @@ more: if (p->dirty == 0) break; vm_page_lock(p); - if (p->queue != PQ_INACTIVE || + if (!vm_page_in_laundry(p) || p->hold_count != 0) { /* may be undergoing I/O */ vm_page_unlock(p); break; @@ -519,23 +544,33 @@ vm_pageout_flush(vm_page_t *mc, int coun ("vm_pageout_flush: page %p is not write protected", mt)); switch (pageout_status[i]) { case VM_PAGER_OK: + vm_page_lock(mt); + if (vm_page_in_laundry(mt)) + vm_page_deactivate_noreuse(mt); + vm_page_unlock(mt); + /* FALLTHROUGH */ case VM_PAGER_PEND: numpagedout++; break; case VM_PAGER_BAD: /* - * Page outside of range of object. Right now we - * essentially lose the changes by pretending it - * worked. + * The page is outside the object's range. We pretend + * that the page out worked and clean the page, so the + * changes will be lost if the page is reclaimed by + * the page daemon. */ vm_page_undirty(mt); + vm_page_lock(mt); + if (vm_page_in_laundry(mt)) + vm_page_deactivate_noreuse(mt); + vm_page_unlock(mt); break; case VM_PAGER_ERROR: case VM_PAGER_FAIL: /* - * If page couldn't be paged out, then reactivate the - * page so it doesn't clog the inactive list. (We - * will try paging out it again later). + * If the page couldn't be paged out, then reactivate + * it so that it doesn't clog the laundry and inactive + * queues. (We will try paging it out again later). */ vm_page_lock(mt); vm_page_activate(mt); @@ -617,10 +652,10 @@ vm_pageout_object_deactivate_pages(pmap_ act_delta = 1; vm_page_aflag_clear(p, PGA_REFERENCED); } - if (p->queue != PQ_ACTIVE && act_delta != 0) { + if (!vm_page_active(p) && act_delta != 0) { vm_page_activate(p); p->act_count += act_delta; - } else if (p->queue == PQ_ACTIVE) { + } else if (vm_page_active(p)) { if (act_delta == 0) { p->act_count -= min(p->act_count, ACT_DECLINE); @@ -636,7 +671,7 @@ vm_pageout_object_deactivate_pages(pmap_ p->act_count += ACT_ADVANCE; vm_page_requeue(p); } - } else if (p->queue == PQ_INACTIVE) + } else if (vm_page_inactive(p)) pmap_remove_all(p); vm_page_unlock(p); } @@ -739,7 +774,7 @@ vm_pageout_map_deactivate_pages(map, des * Returns 0 on success and an errno otherwise. */ static int -vm_pageout_clean(vm_page_t m) +vm_pageout_clean(vm_page_t m, int *numpagedout) { struct vnode *vp; struct mount *mp; @@ -797,7 +832,7 @@ vm_pageout_clean(vm_page_t m) * (3) reallocated to a different offset, or * (4) cleaned. */ - if (m->queue != PQ_INACTIVE || m->object != object || + if (!vm_page_in_laundry(m) || m->object != object || m->pindex != pindex || m->dirty == 0) { vm_page_unlock(m); error = ENXIO; @@ -821,7 +856,7 @@ vm_pageout_clean(vm_page_t m) * laundry. If it is still in the laundry, then we * start the cleaning operation. */ - if (vm_pageout_cluster(m) == 0) + if ((*numpagedout = vm_pageout_cluster(m)) == 0) error = EIO; unlock_all: @@ -840,11 +875,390 @@ unlock_mp: } /* + * Attempt to launder the specified number of pages. + * + * Returns the number of pages successfully laundered. + */ +static int +vm_pageout_launder(struct vm_domain *vmd, int launder, bool in_shortfall) +{ + struct vm_pagequeue *pq; + vm_object_t object; + vm_page_t m, next; + int act_delta, error, maxscan, numpagedout, starting_target; + int vnodes_skipped; + bool pageout_ok, queue_locked; + + starting_target = launder; + vnodes_skipped = 0; + + /* + * Scan the laundry queue for pages eligible to be laundered. We stop + * once the target number of dirty pages have been laundered, or once + * we've reached the end of the queue. A single iteration of this loop + * may cause more than one page to be laundered because of clustering. + * + * maxscan ensures that we don't re-examine requeued pages. Any + * additional pages written as part of a cluster are subtracted from + * maxscan since they must be taken from the laundry queue. + */ + pq = &vmd->vmd_pagequeues[PQ_LAUNDRY]; + maxscan = pq->pq_cnt; + + vm_pagequeue_lock(pq); + queue_locked = true; + for (m = TAILQ_FIRST(&pq->pq_pl); + m != NULL && maxscan-- > 0 && launder > 0; + m = next) { + vm_pagequeue_assert_locked(pq); + KASSERT(queue_locked, ("unlocked laundry queue")); + KASSERT(vm_page_in_laundry(m), + ("page %p has an inconsistent queue", m)); + next = TAILQ_NEXT(m, plinks.q); + if ((m->flags & PG_MARKER) != 0) + continue; + KASSERT((m->flags & PG_FICTITIOUS) == 0, + ("PG_FICTITIOUS page %p cannot be in laundry queue", m)); + KASSERT((m->oflags & VPO_UNMANAGED) == 0, + ("VPO_UNMANAGED page %p cannot be in laundry queue", m)); + if (!vm_pageout_page_lock(m, &next) || m->hold_count != 0) { + vm_page_unlock(m); + continue; + } + object = m->object; + if ((!VM_OBJECT_TRYWLOCK(object) && + (!vm_pageout_fallback_object_lock(m, &next) || + m->hold_count != 0)) || vm_page_busied(m)) { + VM_OBJECT_WUNLOCK(object); + vm_page_unlock(m); + continue; + } + + /* + * Unlock the laundry queue, invalidating the 'next' pointer. + * Use a marker to remember our place in the laundry queue. + */ + TAILQ_INSERT_AFTER(&pq->pq_pl, m, &vmd->vmd_laundry_marker, + plinks.q); + vm_pagequeue_unlock(pq); + queue_locked = false; + + /* + * Invalid pages can be easily freed. They cannot be + * mapped; vm_page_free() asserts this. + */ + if (m->valid == 0) + goto free_page; + + /* + * If the page has been referenced and the object is not dead, + * reactivate or requeue the page depending on whether the + * object is mapped. + */ + if ((m->aflags & PGA_REFERENCED) != 0) { + vm_page_aflag_clear(m, PGA_REFERENCED); + act_delta = 1; + } else + act_delta = 0; + if (object->ref_count != 0) + act_delta += pmap_ts_referenced(m); + else { + KASSERT(!pmap_page_is_mapped(m), + ("page %p is mapped", m)); + } + if (act_delta != 0) { + if (object->ref_count != 0) { + PCPU_INC(cnt.v_reactivated); + vm_page_activate(m); + + /* + * Increase the activation count if the page + * was referenced while in the laundry queue. + * This makes it less likely that the page will + * be returned prematurely to the inactive + * queue. + */ + m->act_count += act_delta + ACT_ADVANCE; + + /* + * If this was a background laundering, count + * activated pages towards our target. The + * purpose of background laundering is to ensure + * that pages are eventually cycled through the + * laundry queue, and an activation is a valid + * way out. + */ + if (!in_shortfall) + launder--; + goto drop_page; + } else if ((object->flags & OBJ_DEAD) == 0) + goto requeue_page; + } + + /* + * If the page appears to be clean at the machine-independent + * layer, then remove all of its mappings from the pmap in + * anticipation of freeing it. If, however, any of the page's + * mappings allow write access, then the page may still be + * modified until the last of those mappings are removed. + */ + if (object->ref_count != 0) { + vm_page_test_dirty(m); + if (m->dirty == 0) + pmap_remove_all(m); + } + + /* + * Clean pages are freed, and dirty pages are paged out unless + * they belong to a dead object. Requeueing dirty pages from + * dead objects is pointless, as they are being paged out and + * freed by the thread that destroyed the object. + */ + if (m->dirty == 0) { +free_page: + vm_page_free(m); + PCPU_INC(cnt.v_dfree); + } else if ((object->flags & OBJ_DEAD) == 0) { + if (object->type != OBJT_SWAP && + object->type != OBJT_DEFAULT) + pageout_ok = true; + else if (disable_swap_pageouts) + pageout_ok = false; + else + pageout_ok = true; + if (!pageout_ok) { +requeue_page: + vm_pagequeue_lock(pq); + queue_locked = true; + vm_page_requeue_locked(m); + goto drop_page; + } + + /* + * Form a cluster with adjacent, dirty pages from the + * same object, and page out that entire cluster. + * + * The adjacent, dirty pages must also be in the + * laundry. However, their mappings are not checked + * for new references. Consequently, a recently + * referenced page may be paged out. However, that + * page will not be prematurely reclaimed. After page + * out, the page will be placed in the inactive queue, + * where any new references will be detected and the + * page reactivated. + */ + error = vm_pageout_clean(m, &numpagedout); + if (error == 0) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 9 21:28:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1379BC382D9; Wed, 9 Nov 2016 21:28:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D96F7EC9; Wed, 9 Nov 2016 21:28:47 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA9LSlk8079819; Wed, 9 Nov 2016 21:28:47 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA9LSlDo079818; Wed, 9 Nov 2016 21:28:47 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201611092128.uA9LSlDo079818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Wed, 9 Nov 2016 21:28:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308476 - head/sys/boot/forth X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 21:28:48 -0000 Author: tsoome Date: Wed Nov 9 21:28:46 2016 New Revision: 308476 URL: https://svnweb.freebsd.org/changeset/base/308476 Log: boot/forth spelling issue in forth word Reviewed by: dteske, imp Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D8484 Modified: head/sys/boot/forth/support.4th Modified: head/sys/boot/forth/support.4th ============================================================================== --- head/sys/boot/forth/support.4th Wed Nov 9 19:08:39 2016 (r308475) +++ head/sys/boot/forth/support.4th Wed Nov 9 21:28:46 2016 (r308476) @@ -1115,7 +1115,7 @@ string current_file_name_ref \ used to p : load_error_message verbose? if ." failed!" cr then ; -: load_succesful_message verbose? if ." ok" cr then ; +: load_successful_message verbose? if ." ok" cr then ; : load_module load_parameters load @@ -1133,7 +1133,7 @@ string current_file_name_ref \ used to p then else after_load - load_succesful_message true \ Successful, do not retry + load_successful_message true \ Successful, do not retry then until ; From owner-svn-src-all@freebsd.org Wed Nov 9 21:51:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 712B0C3894B; Wed, 9 Nov 2016 21:51:49 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 424C31D26; Wed, 9 Nov 2016 21:51:49 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA9LpmJc091651; Wed, 9 Nov 2016 21:51:48 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA9LpmM6091650; Wed, 9 Nov 2016 21:51:48 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201611092151.uA9LpmM6091650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 9 Nov 2016 21:51:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308477 - head/sys/boot/i386/libi386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 21:51:49 -0000 Author: bapt Date: Wed Nov 9 21:51:48 2016 New Revision: 308477 URL: https://svnweb.freebsd.org/changeset/base/308477 Log: make pxeboot consistent with common/dev_net.c Always define boot.netif.server in kenv in pxeboot Add "boot.tftproot.server" to kenv when pxeboot uses tftpfs Change the code order when setting env for TFTP or NFS to be the same as common/dev_net.c Reported by: tsoome Modified: head/sys/boot/i386/libi386/pxe.c Modified: head/sys/boot/i386/libi386/pxe.c ============================================================================== --- head/sys/boot/i386/libi386/pxe.c Wed Nov 9 21:28:46 2016 (r308476) +++ head/sys/boot/i386/libi386/pxe.c Wed Nov 9 21:51:48 2016 (r308477) @@ -311,6 +311,7 @@ pxe_open(struct open_file *f, ...) setenv("boot.netif.ip", inet_ntoa(myip), 1); setenv("boot.netif.netmask", intoa(netmask), 1); setenv("boot.netif.gateway", inet_ntoa(gateip), 1); + setenv("boot.netif.server", inet_ntoa(rootip), 1); if (bootplayer.Hardware == ETHER_TYPE) { sprintf(temp, "%6D", bootplayer.CAddr, ":"); setenv("boot.netif.hwaddr", temp, 1); @@ -324,12 +325,12 @@ pxe_open(struct open_file *f, ...) printf("pxe_open: server path: %s\n", rootpath); printf("pxe_open: gateway ip: %s\n", inet_ntoa(gateip)); - if (netproto == NET_NFS) { + if (netproto == NET_TFTP) { + setenv("boot.tftproot.server", inet_ntoa(rootip), 1); + setenv("boot.tftproot.path", rootpath, 1); + } else if (netproto == NET_NFS) { setenv("boot.nfsroot.server", inet_ntoa(rootip), 1); setenv("boot.nfsroot.path", rootpath, 1); - } else if (netproto == NET_TFTP) { - setenv("boot.netif.server", inet_ntoa(rootip), 1); - setenv("boot.tftproot.path", rootpath, 1); } setenv("dhcp.host-name", hostname, 1); From owner-svn-src-all@freebsd.org Wed Nov 9 23:31:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29794C37B2E; Wed, 9 Nov 2016 23:31:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id F296AA54; Wed, 9 Nov 2016 23:31:10 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id uA9NV9cl099629 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 9 Nov 2016 15:31:09 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id uA9NV9Kk099628; Wed, 9 Nov 2016 15:31:09 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 9 Nov 2016 15:31:09 -0800 From: Gleb Smirnoff To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308026 - in head/sys: kern sys ufs/ffs Message-ID: <20161109233109.GY27748@FreeBSD.org> References: <201610281143.u9SBhxrN008547@repo.freebsd.org> <20161101000246.GQ27748@FreeBSD.org> <20161101125310.GD54029@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161101125310.GD54029@kib.kiev.ua> User-Agent: Mutt/1.7.0 (2016-08-17) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 23:31:11 -0000 Konstantin, On Tue, Nov 01, 2016 at 02:53:10PM +0200, Konstantin Belousov wrote: K> > K> +static int buf_pager_relbuf; K> > K> +SYSCTL_INT(_vfs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN, K> > K> + &buf_pager_relbuf, 0, K> > K> + "Make buffer pager release buffers after reading"); K> > K> + K> > K> +/* K> > K> + * The buffer pager. It uses buffer reads to validate pages. K> > K> + * K> > K> + * In contrast to the generic local pager from vm/vnode_pager.c, this K> > K> + * pager correctly and easily handles volumes where the underlying K> > K> + * device block size is greater than the machine page size. The K> > K> + * buffer cache transparently extends the requested page run to be K> > K> + * aligned at the block boundary, and does the necessary bogus page K> > K> + * replacements in the addends to avoid obliterating already valid K> > K> + * pages. K> > K> + * K> > K> + * The only non-trivial issue is that the exclusive busy state for K> > K> + * pages, which is assumed by the vm_pager_getpages() interface, is K> > K> + * incompatible with the VMIO buffer cache's desire to share-busy the K> > K> + * pages. This function performs a trivial downgrade of the pages' K> > K> + * state before reading buffers, and a less trivial upgrade from the K> > K> + * shared-busy to excl-busy state after the read. K> > K> > IMHO, should be noted that the pager ignores requested rbehind and rahead K> > values, and does the rbehind and rahead sizes that he prefers. K> Pager interface considers the ahead/behind pages' page-in as unsignificant, K> in particular because the pages can be recycled or invalidated during the K> pager operation, when pager drops the object lock. K> K> More important, this pager de-facto uses the optimal filesystem-depended K> aligned io size due to its structure, comparing with the bmap pager. K> For this reason, I consider additional attempts to follow optional K> upper-level hints not very useful. Measurements show no difference in K> the real workload times, and marginal improvements for microbenchmarks K> (5% scale). The buildworld isn't the only true workload. If we do readbehind or readahead we allocate pages for that, which means that some other pages need to be purged. There are cases, when the pager has absolutely no idea about what is optimal. So, not following hints from the upper layers is a bug. Note, that I don't ask you to fix it. I'm just asking to document that behaviour. K> I might do something more aggressive when upper-level specified rahead is K> (significantly) above the natural block size limit, like using breadn() K> instead of bread(). Practice suggests that this would not help or even K> be a pessimisation due to higher buf cache trashing. -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Thu Nov 10 07:05:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94809C390C7; Thu, 10 Nov 2016 07:05:42 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65D3ABB4; Thu, 10 Nov 2016 07:05:42 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAA75fnQ011253; Thu, 10 Nov 2016 07:05:41 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAA75ffM011252; Thu, 10 Nov 2016 07:05:41 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201611100705.uAA75ffM011252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Thu, 10 Nov 2016 07:05:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308478 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 07:05:42 -0000 Author: araujo Date: Thu Nov 10 07:05:41 2016 New Revision: 308478 URL: https://svnweb.freebsd.org/changeset/base/308478 Log: We can't use protect(1) inside a jail(8)! To avoid have warning for services that are using oomprotect, oomprotect will only be applied on services that won't run inside jails. Reported by: allanjude MFC after: 2 weeks. Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Wed Nov 9 21:51:48 2016 (r308477) +++ head/etc/rc.subr Thu Nov 10 07:05:41 2016 (r308478) @@ -1205,6 +1205,11 @@ $command $rc_flags $command_args" # Apply protect(1) to the PID if ${name}_oomprotect is set. case "$rc_arg" in start) + # We cannot use protect(1) inside jails. + jailed="$(sysctl -n security.jail.jailed)" + if [ ${jailed} -eq 1 ]; then + return $_return + fi if [ -n "$_oomprotect" ]; then if [ -f "${PROTECT}" ]; then pid=$(check_process $command) From owner-svn-src-all@freebsd.org Thu Nov 10 07:47:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 477E2C39FC8; Thu, 10 Nov 2016 07:47:02 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F160E7A2; Thu, 10 Nov 2016 07:47:01 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 384141FE022; Thu, 10 Nov 2016 08:46:56 +0100 (CET) Subject: Re: svn commit: r308424 - head/sys/arm/broadcom/bcm2835 To: John Baldwin References: <201611071738.uA7HceYu045944@repo.freebsd.org> <3214848.geWV8qu7rM@ralph.baldwin.cx> <5c170b6b-1189-4712-ffdd-653cc6b8c59e@selasky.org> <2064206.nvhhXHc9vW@ralph.baldwin.cx> Cc: Oleksandr Tymoshenko , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Marshall Kirk McKusick From: Hans Petter Selasky Message-ID: <6bce6a4b-d782-77af-8515-7243eab38cf3@selasky.org> Date: Thu, 10 Nov 2016 08:52:07 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <2064206.nvhhXHc9vW@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 07:47:02 -0000 Hi, On 11/09/16 17:32, John Baldwin wrote: > It isn't predicted and avoided by turnstiles. In particular, the cv_signal has > no idea what lock is associated, so it can't try to do something "smart" and > move the thread from the sleepq to the lockq. You will pay the double context > switch. Maybe this is an idea for a turnstile optimisation? In another embedded OS based on FreeBSD I did exactly this. If someone is sleeping through cv_wait() the lock it is sleeping on, if different from NULL, is stored in the sleepqueue. When cv_signal() is invoked we simply check if the saved lock is owned by the caller and then don't do the pre-emption, because we predict it will be locked by cv_wait() before returning. --HPS From owner-svn-src-all@freebsd.org Thu Nov 10 07:54:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B6F1C39450; Thu, 10 Nov 2016 07:54:56 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B0C4E51; Thu, 10 Nov 2016 07:54:55 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mh0.gentlemail.de (ezra.dcm1.omnilan.net [IPv6:2a00:e10:2800::a135]) by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id uAA7smNu002920; Thu, 10 Nov 2016 08:54:48 +0100 (CET) (envelope-from freebsd@omnilan.de) Received: from titan.inop.mo1.omnilan.net (titan.inop.mo1.omnilan.net [IPv6:2001:a60:f0bb:1::3:1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id 55CB1125; Thu, 10 Nov 2016 08:54:48 +0100 (CET) Message-ID: <582427C7.5020007@omnilan.de> Date: Thu, 10 Nov 2016 08:54:47 +0100 From: Harry Schmalzbauer Organization: OmniLAN User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; de-DE; rv:1.9.2.8) Gecko/20100906 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Scott Long CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308217 - in head/sys/dev: mpr mps References: <201611021513.uA2FDPk6062463@repo.freebsd.org> <581C5249.2060104@omnilan.de> <161EBBC5-F642-4A05-9361-179B74CDA50A@samsco.org> In-Reply-To: <161EBBC5-F642-4A05-9361-179B74CDA50A@samsco.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]); Thu, 10 Nov 2016 08:54:52 +0100 (CET) X-Milter: Spamilter (Reciever: mx0.gentlemail.de; Sender-ip: ; Sender-helo: mh0.gentlemail.de; ) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 07:54:56 -0000 Bezüglich Scott Long's Nachricht vom 09.11.2016 17:06 (localtime): > >> On Nov 4, 2016, at 3:18 AM, Harry Schmalzbauer wrote: … >> If it's really mps(4) who decides to store driveserial-targetID >> numbering in the /"persitent non-manufacturing config pages/" of the >> controller, mpsutil(8) should be able to reset. Otherwise replacing >> failed drives, or - even mor confusing - rearranging drive/zpool layouts >> is very unsatisfying. >> >> Maybe "-1" should be mentioned with sysctl decription, otherwise this is >> another very hard to find/influence behaviour. >> >> > > Thanks for the feedback. For the record, this problem happens on a > Supermicro X10SDV-7TP4F motherboard. It appears that the support > logic around the LSI controller is mis-configured to show the SAS ports > being part of an enclosure with 0 slots, instead of 8. This confuses > the device mapper logic in the driver that activates if the controller NVRAM > doesn’t specify a pre-existing mapping. Typically this is not the default, > the NVRAM persistent mappings are the default and are used by the driver, > so I considered this problem to be unique to our deployment. Maybe it’s > more of a problem than I estimated? Anyways, sounds like this new I haven't had too much diversity regarding Fusion-MPT and this mapping problem has never hit me yet, so I can't help estimating the severity of that specific problem. But I think I haven't described clearly that I'm having da(4)-numbering problems which are not directly enclosure-mapping related (at least not related to the nvram mapping page), but which hopefully could be worked arround the same way: I frequently had problems replacing drives due to the eternal targetID assigning (every drive with a new/unknown serial gets a consecutive targetID regardless of the enclosure-slot or the number of attached drives). I guess this is stored in a completely different NVRAM page than the enclosure-mapping page. Your patch is intended to solve problems with invalid/absent enclosure-mapping page, but I guess I'll sooner or later need to try the "hw.mpr.use_phy_num=-1" sysctl to hopefully overwrite the targetID++ assigning, which causes "wholes" every time a drive gets replaced. In that case it's just a cosmetic problem, but when rearranging old and new drives on the same controller, it can cause severe confusion for the admins – leading to fatal mistakes. And migrating disks to new controller/chassis is even more problematic if the host had hard wired da(4) assignins via device.hints. I couldn't search the driver to find out if the "save eternal targetID in nvram page N" is really present and not firmware-only induced, but since I saw a different behaviour on windows, I guess it is. I could circumvent the problem by simply using IR firmware since it is only active when mps(4) runs IT firmware. But having a way to disable "save eternal targetID in nvram page N" for mps(4)-IT (via sysctl, and possibly for mpr/mpt also) would be very welcome. Top on my wishlist was extending mpsutil(8) to be able to list and selectively delete single serial-targetID mappings, but I haven't even found a way to do that with any vendor provided tool, not even with LSIUtil – where I can at least erase _all_ mappings. > functionality should be properly documented in the driver. Thanks for your continuous supprt/help/improvements! -Harry From owner-svn-src-all@freebsd.org Thu Nov 10 10:45:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5426C392C2; Thu, 10 Nov 2016 10:45:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D515987; Thu, 10 Nov 2016 10:45:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAAAjC5v098417; Thu, 10 Nov 2016 10:45:12 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAAAjCvp098416; Thu, 10 Nov 2016 10:45:12 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611101045.uAAAjCvp098416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 10 Nov 2016 10:45:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308479 - head/usr.sbin/watchdogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 10:45:13 -0000 Author: avg Date: Thu Nov 10 10:45:12 2016 New Revision: 308479 URL: https://svnweb.freebsd.org/changeset/base/308479 Log: fix a watchdogd regression introduced in r308040 The code assumed that 'timeout' and 'timeout_sec' are in sync which they weren't if no '-t' option was passed to watchdogd. Reported by: Olivier Smedts , Alex Deiter Tested by: Olivier Smedts , Alex Deiter MFC after: 5 days X-MFC with: r308040 Modified: head/usr.sbin/watchdogd/watchdogd.c Modified: head/usr.sbin/watchdogd/watchdogd.c ============================================================================== --- head/usr.sbin/watchdogd/watchdogd.c Thu Nov 10 07:05:41 2016 (r308478) +++ head/usr.sbin/watchdogd/watchdogd.c Thu Nov 10 10:45:12 2016 (r308479) @@ -685,10 +685,15 @@ seconds_to_pow2ns(int seconds) static void parseargs(int argc, char *argv[]) { + struct timespec ts; int longindex; int c; const char *lopt; + /* Get the default value of timeout_sec from the default timeout. */ + pow2ns_to_ts(timeout, &ts); + timeout_sec = ts.tv_sec; + /* * if we end with a 'd' aka 'watchdogd' then we are the daemon program, * otherwise run as a command line utility. @@ -731,9 +736,9 @@ parseargs(int argc, char *argv[]) case 't': timeout_sec = atoi(optarg); timeout = parse_timeout_to_pow2ns(c, NULL, optarg); - if (debugging) - printf("Timeout is 2^%d nanoseconds\n", - timeout); + if (debugging) + printf("Timeout is 2^%d nanoseconds\n", + timeout); break; case 'T': carp_thresh_seconds = @@ -782,10 +787,7 @@ parseargs(int argc, char *argv[]) if (is_daemon && timeout < WD_TO_1SEC) errx(EX_USAGE, "-t argument is less than one second."); if (pretimeout_set) { - struct timespec ts; - - pow2ns_to_ts(timeout, &ts); - if (pretimeout >= (uintmax_t)ts.tv_sec) { + if (pretimeout >= timeout_sec) { errx(EX_USAGE, "pretimeout (%d) >= timeout (%d -> %ld)\n" "see manual section TIMEOUT RESOLUTION", From owner-svn-src-all@freebsd.org Thu Nov 10 11:12:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D176C39F2A; Thu, 10 Nov 2016 11:12:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A0AAB6A; Thu, 10 Nov 2016 11:12:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAABCjn4010278; Thu, 10 Nov 2016 11:12:45 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAABCjJt010277; Thu, 10 Nov 2016 11:12:45 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611101112.uAABCjJt010277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 10 Nov 2016 11:12:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308480 - head/sys/dev/hwpmc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 11:12:46 -0000 Author: avg Date: Thu Nov 10 11:12:45 2016 New Revision: 308480 URL: https://svnweb.freebsd.org/changeset/base/308480 Log: pmc_process_csw_out: ignore deleted counters I see the fllowing panic on AMD when exiting pmcstat: panic: [pmc,1473] pp_pmcval outside of expected range cpu=2 ri=17 pp_pmcval=fffffffffa529f5b pm_reloadcount=10000 It seems that at least on AMD a performance counter keeps counting after overflowing. When pmcstat exits it sets counters that it used to PMC_STATE_DELETED and waits until their use count goes to zero. amd_intr() wouldn't reload a counter in that state and, thus, a counter would be allowed to overflow. That means that the counter's value would be allowed to go outside the expected range. MFC after: 2 weeks Modified: head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Thu Nov 10 10:45:12 2016 (r308479) +++ head/sys/dev/hwpmc/hwpmc_mod.c Thu Nov 10 11:12:45 2016 (r308480) @@ -1431,8 +1431,8 @@ pmc_process_csw_out(struct thread *td) * save the reading. */ - if (pp != NULL && pp->pp_pmcs[ri].pp_pmc != NULL) { - + if (pm->pm_state != PMC_STATE_DELETED && pp != NULL && + pp->pp_pmcs[ri].pp_pmc != NULL) { KASSERT(pm == pp->pp_pmcs[ri].pp_pmc, ("[pmc,%d] pm %p != pp_pmcs[%d] %p", __LINE__, pm, ri, pp->pp_pmcs[ri].pp_pmc)); From owner-svn-src-all@freebsd.org Thu Nov 10 11:14:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 615FBC3A08F; Thu, 10 Nov 2016 11:14:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30715DD4; Thu, 10 Nov 2016 11:14:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAABEkUW010407; Thu, 10 Nov 2016 11:14:46 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAABEko3010406; Thu, 10 Nov 2016 11:14:46 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611101114.uAABEko3010406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 10 Nov 2016 11:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308481 - stable/11/sys/dev/cpuctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 11:14:47 -0000 Author: avg Date: Thu Nov 10 11:14:46 2016 New Revision: 308481 URL: https://svnweb.freebsd.org/changeset/base/308481 Log: MFC r308225: dev/cpuctl: put debug output under CPUCTL_DEBUG rather than DEBUG Modified: stable/11/sys/dev/cpuctl/cpuctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/11/sys/dev/cpuctl/cpuctl.c Thu Nov 10 11:12:45 2016 (r308480) +++ stable/11/sys/dev/cpuctl/cpuctl.c Thu Nov 10 11:14:46 2016 (r308481) @@ -57,7 +57,7 @@ static d_ioctl_t cpuctl_ioctl; #define CPUCTL_VERSION 1 -#ifdef DEBUG +#ifdef CPUCTL_DEBUG # define DPRINTF(format,...) printf(format, __VA_ARGS__); #else # define DPRINTF(...) From owner-svn-src-all@freebsd.org Thu Nov 10 11:14:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E122AC3A0C8; Thu, 10 Nov 2016 11:14:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5D39DF3; Thu, 10 Nov 2016 11:14:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAABEp1p010457; Thu, 10 Nov 2016 11:14:51 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAABEpfq010456; Thu, 10 Nov 2016 11:14:51 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611101114.uAABEpfq010456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 10 Nov 2016 11:14:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308482 - stable/10/sys/dev/cpuctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 11:14:53 -0000 Author: avg Date: Thu Nov 10 11:14:51 2016 New Revision: 308482 URL: https://svnweb.freebsd.org/changeset/base/308482 Log: MFC r308225: dev/cpuctl: put debug output under CPUCTL_DEBUG rather than DEBUG Modified: stable/10/sys/dev/cpuctl/cpuctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/10/sys/dev/cpuctl/cpuctl.c Thu Nov 10 11:14:46 2016 (r308481) +++ stable/10/sys/dev/cpuctl/cpuctl.c Thu Nov 10 11:14:51 2016 (r308482) @@ -57,7 +57,7 @@ static d_ioctl_t cpuctl_ioctl; #define CPUCTL_VERSION 1 -#ifdef DEBUG +#ifdef CPUCTL_DEBUG # define DPRINTF(format,...) printf(format, __VA_ARGS__); #else # define DPRINTF(...) From owner-svn-src-all@freebsd.org Thu Nov 10 12:54:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C5F8C38D52; Thu, 10 Nov 2016 12:54:34 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05BBE194; Thu, 10 Nov 2016 12:54:33 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAACsXvG049742; Thu, 10 Nov 2016 12:54:33 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAACsXEu049741; Thu, 10 Nov 2016 12:54:33 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611101254.uAACsXEu049741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 10 Nov 2016 12:54:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308483 - head/contrib/llvm/projects/libunwind/src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 12:54:34 -0000 Author: br Date: Thu Nov 10 12:54:33 2016 New Revision: 308483 URL: https://svnweb.freebsd.org/changeset/base/308483 Log: Implement riscv jumpto() so world can be compiled. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Modified: head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Modified: head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S ============================================================================== --- head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Thu Nov 10 11:14:51 2016 (r308482) +++ head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Thu Nov 10 12:54:33 2016 (r308483) @@ -480,6 +480,50 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li #elif defined(__riscv__) -/* RISCVTODO */ +// +// void libunwind::Registers_riscv::jumpto() +// +// On entry: +// thread_state pointer is in a0 +// + .p2align 2 +DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Registers_riscv6jumptoEv) + // x0 is zero + ld x1, (8 * 1)(a0) + ld x2, (8 * 2)(a0) + ld x3, (8 * 3)(a0) + ld x4, (8 * 4)(a0) + ld x5, (8 * 5)(a0) + ld x6, (8 * 6)(a0) + ld x7, (8 * 7)(a0) + ld x8, (8 * 8)(a0) + ld x9, (8 * 9)(a0) + // skip a0 for now + ld x11, (8 * 11)(a0) + ld x12, (8 * 12)(a0) + ld x13, (8 * 13)(a0) + ld x14, (8 * 14)(a0) + ld x15, (8 * 15)(a0) + ld x16, (8 * 16)(a0) + ld x17, (8 * 17)(a0) + ld x18, (8 * 18)(a0) + ld x19, (8 * 19)(a0) + ld x20, (8 * 20)(a0) + ld x21, (8 * 21)(a0) + ld x22, (8 * 22)(a0) + ld x23, (8 * 23)(a0) + ld x24, (8 * 24)(a0) + ld x25, (8 * 25)(a0) + ld x26, (8 * 26)(a0) + ld x27, (8 * 27)(a0) + ld x28, (8 * 28)(a0) + ld x29, (8 * 29)(a0) + ld x30, (8 * 30)(a0) + ld x31, (8 * 31)(a0) + ld x10, (8 * 10)(a0) // restore a0 + + /* RISCVTODO: restore FPU registers */ + + ret // jump to ra #endif From owner-svn-src-all@freebsd.org Thu Nov 10 16:27:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3795EC3A517; Thu, 10 Nov 2016 16:27:35 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09B08328; Thu, 10 Nov 2016 16:27:34 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAAGRYfv031917; Thu, 10 Nov 2016 16:27:34 GMT (envelope-from antoine@FreeBSD.org) Received: (from antoine@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAAGRYZo031916; Thu, 10 Nov 2016 16:27:34 GMT (envelope-from antoine@FreeBSD.org) Message-Id: <201611101627.uAAGRYZo031916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: antoine set sender to antoine@FreeBSD.org using -f From: Antoine Brodin Date: Thu, 10 Nov 2016 16:27:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308484 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 16:27:35 -0000 Author: antoine Date: Thu Nov 10 16:27:34 2016 New Revision: 308484 URL: https://svnweb.freebsd.org/changeset/base/308484 Log: Add limits(1) to native-xtools so that it can be used in qemu user-mode jails Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Nov 10 12:54:33 2016 (r308483) +++ head/Makefile.inc1 Thu Nov 10 16:27:34 2016 (r308484) @@ -1954,6 +1954,7 @@ native-xtools: .PHONY usr.bin/gzip \ usr.bin/id \ usr.bin/lex \ + usr.bin/limits \ usr.bin/lorder \ usr.bin/mktemp \ usr.bin/mt \ From owner-svn-src-all@freebsd.org Thu Nov 10 18:36:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1513C3842C; Thu, 10 Nov 2016 18:36:41 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 770DA382; Thu, 10 Nov 2016 18:36:41 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAAIaeWn082293; Thu, 10 Nov 2016 18:36:40 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAAIaeUE082291; Thu, 10 Nov 2016 18:36:40 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201611101836.uAAIaeUE082291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 10 Nov 2016 18:36:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308485 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 18:36:41 -0000 Author: adrian Date: Thu Nov 10 18:36:40 2016 New Revision: 308485 URL: https://svnweb.freebsd.org/changeset/base/308485 Log: [net80211] implement "first RX defines the BAW" hack. Unfortunately (sigh) some firmware doesn't provide the RX BA starting point, so we need to cope and set a "close enough" sequence number so we (hopefully!) don't discard frames as duplicates. Tested: * QCA9880v2, athp driver (under development), STA mode Modified: head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_ht.h Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Thu Nov 10 16:27:34 2016 (r308484) +++ head/sys/net80211/ieee80211_ht.c Thu Nov 10 18:36:40 2016 (r308485) @@ -582,7 +582,13 @@ ieee80211_ampdu_rx_start_ext(struct ieee memset(rap, 0, sizeof(*rap)); rap->rxa_wnd = (baw== 0) ? IEEE80211_AGGR_BAWMAX : min(baw, IEEE80211_AGGR_BAWMAX); - rap->rxa_start = seq; + if (seq == -1) { + /* Wait for the first RX frame, use that as BAW */ + rap->rxa_start = 0; + rap->rxa_flags |= IEEE80211_AGGR_WAITRX; + } else { + rap->rxa_start = seq; + } rap->rxa_flags |= IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_XCHGPEND; IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni, @@ -617,7 +623,9 @@ ampdu_rx_stop(struct ieee80211_node *ni, { ampdu_rx_purge(rap); - rap->rxa_flags &= ~(IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_XCHGPEND); + rap->rxa_flags &= ~(IEEE80211_AGGR_RUNNING + | IEEE80211_AGGR_XCHGPEND + | IEEE80211_AGGR_WAITRX); } /* @@ -842,6 +850,16 @@ ieee80211_ampdu_reorder(struct ieee80211 } rxseq >>= IEEE80211_SEQ_SEQ_SHIFT; rap->rxa_nframes++; + + /* + * Handle waiting for the first frame to define the BAW. + * Some firmware doesn't provide the RX of the starting point + * of the BAW and we have to cope. + */ + if (rap->rxa_flags & IEEE80211_AGGR_WAITRX) { + rap->rxa_flags &= ~IEEE80211_AGGR_WAITRX; + rap->rxa_start = rxseq; + } again: if (rxseq == rap->rxa_start) { /* Modified: head/sys/net80211/ieee80211_ht.h ============================================================================== --- head/sys/net80211/ieee80211_ht.h Thu Nov 10 16:27:34 2016 (r308484) +++ head/sys/net80211/ieee80211_ht.h Thu Nov 10 18:36:40 2016 (r308485) @@ -44,6 +44,7 @@ struct ieee80211_tx_ampdu { #define IEEE80211_AGGR_SETUP 0x0008 /* deferred state setup */ #define IEEE80211_AGGR_NAK 0x0010 /* peer NAK'd ADDBA request */ #define IEEE80211_AGGR_BARPEND 0x0020 /* BAR response pending */ +#define IEEE80211_AGGR_WAITRX 0x0040 /* Wait for first RX frame to define BAW */ uint8_t txa_tid; uint8_t txa_token; /* dialog token */ int txa_lastsample; /* ticks @ last traffic sample */ From owner-svn-src-all@freebsd.org Thu Nov 10 18:41:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03DB9C38804; Thu, 10 Nov 2016 18:41:45 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4E13BF2; Thu, 10 Nov 2016 18:41:44 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAAIfhGu082648; Thu, 10 Nov 2016 18:41:43 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAAIfhDv082647; Thu, 10 Nov 2016 18:41:43 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201611101841.uAAIfhDv082647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 10 Nov 2016 18:41:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308486 - head/sbin/pfctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 18:41:45 -0000 Author: kp Date: Thu Nov 10 18:41:43 2016 New Revision: 308486 URL: https://svnweb.freebsd.org/changeset/base/308486 Log: pfctl: fix nested inline anchors Import the OpenBSD fix for nested inline anchors. PR: 196314 Submitted by: krichy@cflinux.hu Obtained from: OpenBSD Modified: head/sbin/pfctl/pfctl.c Modified: head/sbin/pfctl/pfctl.c ============================================================================== --- head/sbin/pfctl/pfctl.c Thu Nov 10 18:36:40 2016 (r308485) +++ head/sbin/pfctl/pfctl.c Thu Nov 10 18:41:43 2016 (r308486) @@ -1339,7 +1339,7 @@ pfctl_load_rule(struct pfctl *pf, char * else snprintf(&path[len], MAXPATHLEN - len, "%s", r->anchor->name); - name = path; + name = r->anchor->name; } else name = r->anchor->path; } else From owner-svn-src-all@freebsd.org Thu Nov 10 19:40:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32647C3ABDA; Thu, 10 Nov 2016 19:40:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE629DF1; Thu, 10 Nov 2016 19:40:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAAJeFl4006572; Thu, 10 Nov 2016 19:40:15 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAAJeF4m006571; Thu, 10 Nov 2016 19:40:15 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201611101940.uAAJeF4m006571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 10 Nov 2016 19:40:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308487 - head/contrib/llvm/lib/Target/AArch64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 19:40:16 -0000 Author: dim Date: Thu Nov 10 19:40:14 2016 New Revision: 308487 URL: https://svnweb.freebsd.org/changeset/base/308487 Log: Pull in r263301 from upstream llvm trunk (by Ahmed Bougacha): [AArch64] Don't blindly lower f16/f128 FCCMPs. Instead, extend f16 (like we do when lowering a standalone SETCC), and let f128 be legalized to the RT calls. Fixes PR26803. This fixes a fatal "Cannot select" backend error when building the net/freerdp port for AArch64. PR: 214380 MFC after: 3 days Modified: head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Modified: head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Thu Nov 10 18:41:43 2016 (r308486) +++ head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Thu Nov 10 19:40:14 2016 (r308487) @@ -1177,8 +1177,14 @@ static SDValue emitComparison(SDValue LH SDLoc dl, SelectionDAG &DAG) { EVT VT = LHS.getValueType(); - if (VT.isFloatingPoint()) + if (VT.isFloatingPoint()) { + assert(VT != MVT::f128); + if (VT == MVT::f16) { + LHS = DAG.getNode(ISD::FP_EXTEND, dl, MVT::f32, LHS); + RHS = DAG.getNode(ISD::FP_EXTEND, dl, MVT::f32, RHS); + } return DAG.getNode(AArch64ISD::FCMP, dl, VT, LHS, RHS); + } // The CMP instruction is just an alias for SUBS, and representing it as // SUBS means that it's possible to get CSE with subtract operations. @@ -1261,9 +1267,14 @@ static SDValue emitConditionalComparison SDValue Condition, unsigned NZCV, SDLoc DL, SelectionDAG &DAG) { unsigned Opcode = 0; - if (LHS.getValueType().isFloatingPoint()) + if (LHS.getValueType().isFloatingPoint()) { + assert(LHS.getValueType() != MVT::f128); + if (LHS.getValueType() == MVT::f16) { + LHS = DAG.getNode(ISD::FP_EXTEND, DL, MVT::f32, LHS); + RHS = DAG.getNode(ISD::FP_EXTEND, DL, MVT::f32, RHS); + } Opcode = AArch64ISD::FCCMP; - else if (RHS.getOpcode() == ISD::SUB) { + } else if (RHS.getOpcode() == ISD::SUB) { SDValue SubOp0 = RHS.getOperand(0); if (isNullConstant(SubOp0) && (CC == ISD::SETEQ || CC == ISD::SETNE)) { // See emitComparison() on why we can only do this for SETEQ and SETNE. @@ -1290,6 +1301,8 @@ static bool isConjunctionDisjunctionTree return false; unsigned Opcode = Val->getOpcode(); if (Opcode == ISD::SETCC) { + if (Val->getOperand(0).getValueType() == MVT::f128) + return false; CanPushNegate = true; return true; } From owner-svn-src-all@freebsd.org Thu Nov 10 19:55:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD6F3C3A13E; Thu, 10 Nov 2016 19:55:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 793E6C19; Thu, 10 Nov 2016 19:55:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAAJtjnp014003; Thu, 10 Nov 2016 19:55:45 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAAJtjEM013998; Thu, 10 Nov 2016 19:55:45 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201611101955.uAAJtjEM013998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 10 Nov 2016 19:55:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308489 - in head/usr.bin: systat top vmstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 19:55:46 -0000 Author: markj Date: Thu Nov 10 19:55:45 2016 New Revision: 308489 URL: https://svnweb.freebsd.org/changeset/base/308489 Log: Add the laundry page count to the displays of systat, top, and vmstat. Reviewed by: alc, kib Differential Revision: https://reviews.freebsd.org/D8467 Modified: head/usr.bin/systat/systat.1 head/usr.bin/systat/vmstat.c head/usr.bin/top/machine.c head/usr.bin/top/top.local.1 head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/systat/systat.1 ============================================================================== --- head/usr.bin/systat/systat.1 Thu Nov 10 19:50:19 2016 (r308488) +++ head/usr.bin/systat/systat.1 Thu Nov 10 19:55:45 2016 (r308489) @@ -28,7 +28,7 @@ .\" @(#)systat.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd October 24, 2015 +.Dd November 10, 2016 .Dt SYSTAT 1 .Os .Sh NAME @@ -411,7 +411,7 @@ as amounts of memory in kilobytes, pages wired down (`wire'), active pages (`act'), inactive pages (`inact'), -pages on the cache queue (`cache'), +dirty pages queued for laundering (`laund'), and free pages (`free'). Note that the values displayed are the current transient ones; Modified: head/usr.bin/systat/vmstat.c ============================================================================== --- head/usr.bin/systat/vmstat.c Thu Nov 10 19:50:19 2016 (r308488) +++ head/usr.bin/systat/vmstat.c Thu Nov 10 19:55:45 2016 (r308489) @@ -92,7 +92,7 @@ static struct Info { u_int v_vnodepgsin; /* vnode_pager pages paged in */ u_int v_vnodepgsout; /* vnode pager pages paged out */ u_int v_intrans; /* intransit blocking page faults */ - u_int v_reactivated; /* number of pages reactivated from free list */ + u_int v_reactivated; /* number of pages reactivated by pagedaemon */ u_int v_pdwakeups; /* number of times daemon has awaken from sleep */ u_int v_pdpages; /* number of pages analyzed by daemon */ @@ -107,7 +107,7 @@ static struct Info { u_int v_wire_count; /* number of pages wired down */ u_int v_active_count; /* number of pages active */ u_int v_inactive_count; /* number of pages inactive */ - u_int v_cache_count; /* number of pages on buffer cache queue */ + u_int v_laundry_count; /* number of pages in laundry queue */ u_long v_kmem_map_size; /* Current kmem allocation size */ struct vmtotal Total; struct nchstats nchstats; @@ -343,7 +343,7 @@ labelkre(void) mvprintw(VMSTATROW + 12, VMSTATCOL + 9, "wire"); mvprintw(VMSTATROW + 13, VMSTATCOL + 9, "act"); mvprintw(VMSTATROW + 14, VMSTATCOL + 9, "inact"); - mvprintw(VMSTATROW + 15, VMSTATCOL + 9, "cache"); + mvprintw(VMSTATROW + 15, VMSTATCOL + 9, "laund"); mvprintw(VMSTATROW + 16, VMSTATCOL + 9, "free"); if (LINES - 1 > VMSTATROW + 17) mvprintw(VMSTATROW + 17, VMSTATCOL + 9, "buf"); @@ -519,7 +519,7 @@ showkre(void) putint(pgtokb(s.v_wire_count), VMSTATROW + 12, VMSTATCOL, 8); putint(pgtokb(s.v_active_count), VMSTATROW + 13, VMSTATCOL, 8); putint(pgtokb(s.v_inactive_count), VMSTATROW + 14, VMSTATCOL, 8); - putint(pgtokb(s.v_cache_count), VMSTATROW + 15, VMSTATCOL, 8); + putint(pgtokb(s.v_laundry_count), VMSTATROW + 15, VMSTATCOL, 8); putint(pgtokb(s.v_free_count), VMSTATROW + 16, VMSTATCOL, 8); if (LINES - 1 > VMSTATROW + 17) putint(s.bufspace / 1024, VMSTATROW + 17, VMSTATCOL, 8); @@ -794,7 +794,7 @@ getinfo(struct Info *ls) GETSYSCTL("vm.stats.vm.v_wire_count", ls->v_wire_count); GETSYSCTL("vm.stats.vm.v_active_count", ls->v_active_count); GETSYSCTL("vm.stats.vm.v_inactive_count", ls->v_inactive_count); - GETSYSCTL("vm.stats.vm.v_cache_count", ls->v_cache_count); + GETSYSCTL("vm.stats.vm.v_laundry_count", ls->v_laundry_count); GETSYSCTL("vfs.bufspace", ls->bufspace); GETSYSCTL("kern.maxvnodes", ls->desiredvnodes); GETSYSCTL("vfs.numvnodes", ls->numvnodes); Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Thu Nov 10 19:50:19 2016 (r308488) +++ head/usr.bin/top/machine.c Thu Nov 10 19:55:45 2016 (r308489) @@ -178,7 +178,7 @@ char *cpustatenames[] = { int memory_stats[7]; char *memorynames[] = { - "K Active, ", "K Inact, ", "K Wired, ", "K Cache, ", "K Buf, ", + "K Active, ", "K Inact, ", "K Laundry, ", "K Wired, ", "K Buf, ", "K Free", NULL }; @@ -503,8 +503,8 @@ get_system_info(struct system_info *si) GETSYSCTL("vfs.bufspace", bufspace); GETSYSCTL("vm.stats.vm.v_active_count", memory_stats[0]); GETSYSCTL("vm.stats.vm.v_inactive_count", memory_stats[1]); - GETSYSCTL("vm.stats.vm.v_wire_count", memory_stats[2]); - GETSYSCTL("vm.stats.vm.v_cache_count", memory_stats[3]); + GETSYSCTL("vm.stats.vm.v_laundry_count", memory_stats[2]); + GETSYSCTL("vm.stats.vm.v_wire_count", memory_stats[3]); GETSYSCTL("vm.stats.vm.v_free_count", memory_stats[5]); GETSYSCTL("vm.stats.vm.v_swappgsin", nspgsin); GETSYSCTL("vm.stats.vm.v_swappgsout", nspgsout); Modified: head/usr.bin/top/top.local.1 ============================================================================== --- head/usr.bin/top/top.local.1 Thu Nov 10 19:50:19 2016 (r308488) +++ head/usr.bin/top/top.local.1 Thu Nov 10 19:55:45 2016 (r308489) @@ -2,8 +2,8 @@ .SH "FreeBSD NOTES" .SH DESCRIPTION OF MEMORY -Mem: 9220K Active, 1M Inact, 3284K Wired, 1M Cache, 2M Buf, 1320K Free -ARC: 2048K Total, 342K MRU, 760K MFU, 272K Anon, 232K Header, 442K Other +Mem: 9220K Active, 1M Inact, 1M Laundry, 3284K Wired, 2M Buf, 932K Free +ARC: 2048K Total, 342K MRU, 760K MFU, 272K Anon, 96K Header, 442K Other Swap: 91M Total, 79M Free, 13% Inuse, 80K In, 104K Out .TP .B K: @@ -23,15 +23,14 @@ Gigabyte number of bytes active .TP .B Inact: -number of bytes inactive +number of clean bytes inactive +.TP +.B Laundry: +number of dirty bytes queued for laundering .TP .B Wired: number of bytes wired down, including BIO-level cached file data pages .TP -.B Cache: -number of clean bytes caching data that are available for -immediate reallocation -.TP .B Buf: number of bytes used for BIO-level disk caching .TP Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Thu Nov 10 19:50:19 2016 (r308488) +++ head/usr.bin/vmstat/vmstat.c Thu Nov 10 19:55:45 2016 (r308489) @@ -567,7 +567,7 @@ fill_vmmeter(struct vmmeter *vmmp) GET_VM_STATS(vm, v_reactivated); GET_VM_STATS(vm, v_pdwakeups); GET_VM_STATS(vm, v_pdpages); - GET_VM_STATS(vm, v_tcached); + GET_VM_STATS(vm, v_pdshortfalls); GET_VM_STATS(vm, v_dfree); GET_VM_STATS(vm, v_pfree); GET_VM_STATS(vm, v_tfree); @@ -581,7 +581,7 @@ fill_vmmeter(struct vmmeter *vmmp) GET_VM_STATS(vm, v_active_count); GET_VM_STATS(vm, v_inactive_target); GET_VM_STATS(vm, v_inactive_count); - GET_VM_STATS(vm, v_cache_count); + GET_VM_STATS(vm, v_laundry_count); GET_VM_STATS(vm, v_pageout_free_min); GET_VM_STATS(vm, v_interrupt_free_min); /*GET_VM_STATS(vm, v_free_severe);*/ @@ -1059,7 +1059,9 @@ dosum(void) sum.v_pdwakeups); xo_emit("{:page-daemon-pages/%9u} {N:pages examined by the page daemon}\n", sum.v_pdpages); - xo_emit("{:reactivated/%9u} {N:pages reactivated}\n", + xo_emit("{:page-reclamation-shortfalls/%9u} {N:clean page reclamation shortfalls}\n", + sum.v_pdshortfalls); + xo_emit("{:reactivated/%9u} {N:pages reactivated by the page daemon}\n", sum.v_reactivated); xo_emit("{:copy-on-write-faults/%9u} {N:copy-on-write faults}\n", sum.v_cow_faults); @@ -1095,8 +1097,8 @@ dosum(void) sum.v_active_count); xo_emit("{:inactive-pages/%9u} {N:pages inactive}\n", sum.v_inactive_count); - xo_emit("{:vm-cache/%9u} {N:pages in VM cache}\n", - sum.v_cache_count); + xo_emit("{:laundry-pages/%9u} {N:pages in the laundry queue}\n", + sum.v_laundry_count); xo_emit("{:wired-pages/%9u} {N:pages wired down}\n", sum.v_wire_count); xo_emit("{:free-pages/%9u} {N:pages free}\n", From owner-svn-src-all@freebsd.org Thu Nov 10 20:49:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CAF4C3AF25; Thu, 10 Nov 2016 20:49:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0A64B6B6; Thu, 10 Nov 2016 20:49:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x230.google.com with SMTP id q124so262405071itd.1; Thu, 10 Nov 2016 12:49:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=IidboQCDgNj40ZkeIDcw5vLm9lsg9AEBxPZiNx2k/Os=; b=h1EPxfgpX349vIbUqURukWKUNVIVHrqQeNb796scBUTrQW9+ZqaDaZDux31j21z0LI y7O4JRSxVbl84pi9vM7deeGAoTp5eZHZ+CGOT0yAiqakHNS416oF0xjssfhtZKzqIY4A Ui5b/DfstDPaa/f5xNeU9vl6w3GteBcTQ10SGLn1l/iTPqwHj5fTUNxo3MweKb1xRBOJ 1ngHMeOrk9H7GPE6fWqOD+s/fXZC/eUJMIJ0+wp/kSHo41aD2Rae2/JxHSmpnL403ijm N70Dg2Iwwnc7nwWXrEL78hF27kE7nKYL380ZFlMwuBq/szQL5KLr3W31GBJw3+Qco6DE fb7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=IidboQCDgNj40ZkeIDcw5vLm9lsg9AEBxPZiNx2k/Os=; b=UQDrIlt+sN4ChAYhzT9YXBZJXBR3wnmDJC9fAzMgkvyJBcr2xsIrgtkeitw6riPYzy BtitWsqbTbsKO1E0N/cKinNWx17MzyHb7vpiynMn7vbzvMuFSYHa9/2B+GqOPelhb4jn TaJFY3xFWQdSwurIdRwYO+r0eVmoosiWyoRKUbLKP17qdPvY7M5HGzJ1/G4AICyKKqDf uNx+PSlzGTbGZimnbIad50Q0FfRRClxDHmF23bKyx0anUnZ4bR7KJOpbhNlqGsXcvWvx EkfjVAsU+/1zCsxVvyk9k17mb2pOCnVXPhHVvhLAgxO4LT30sR/63lVBmZirlZVWgVeV nR3w== X-Gm-Message-State: ABUngvcQQbZgYqrBqGBh03xNThN7oC92z360AaNuNdW9xMEn0JRHCwfRR1U/y6TQ1l1FQ527kUmqwGNlbqxehA== X-Received: by 10.36.65.216 with SMTP id b85mr18818283itd.39.1478810990583; Thu, 10 Nov 2016 12:49:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.39.134 with HTTP; Thu, 10 Nov 2016 12:49:49 -0800 (PST) In-Reply-To: <20161103201059.GA2104@bsdpad.com> References: <201610311533.u9VFXw2x053156@repo.freebsd.org> <128f2edc-eced-dc8b-72b4-267e1d26bd48@FreeBSD.org> <20161103201059.GA2104@bsdpad.com> From: Adrian Chadd Date: Thu, 10 Nov 2016 12:49:49 -0800 Message-ID: Subject: Re: svn commit: r308130 - in head: . gnu/lib/libgcc gnu/usr.bin/binutils gnu/usr.bin/binutils/ld gnu/usr.bin/binutils/libbfd gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb lib/libc lib/libc/mips... To: Ruslan Bukin Cc: Bryan Drewery , Ruslan Bukin , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 20:49:52 -0000 hi, This fails to boot on actual mips24k hardware, no hardfloat: COP1_UNUSABLE: pid 1 tid 100001 (init), uid 0: pc 0x404237c0 ra 0x404224d4 Trapframe Register Dump: zero: 0 at: 0xffffffffffffffe0 v0: 0x404471b8 v1: 0xffffffffffffffff .. lots of that the moment we boot userland. -adrian On 3 November 2016 at 13:10, Ruslan Bukin wrote: > On Thu, Nov 03, 2016 at 12:39:48PM -0700, Bryan Drewery wrote: >> On 10/31/16 8:33 AM, Ruslan Bukin wrote: >> > Modified: head/share/mk/bsd.cpu.mk >> > ============================================================================== >> > --- head/share/mk/bsd.cpu.mk Mon Oct 31 15:11:55 2016 (r308129) >> > +++ head/share/mk/bsd.cpu.mk Mon Oct 31 15:33:58 2016 (r308130) >> > @@ -303,6 +303,9 @@ MACHINE_CPU = v9 ultrasparc ultrasparc3 >> > >> > .if ${MACHINE_CPUARCH} == "mips" >> > CFLAGS += -G0 >> > +.if ${TARGET_ARCH:Mmips*hf} >> >> TARGET_ARCH is not valid here. This broke building ports. Fixed in >> r308262. >> > > Thank you! > > Ruslan > From owner-svn-src-all@freebsd.org Thu Nov 10 20:51:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C461FC3A0CE; Thu, 10 Nov 2016 20:51:27 +0000 (UTC) (envelope-from syrinx@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 900EDA39; Thu, 10 Nov 2016 20:51:27 +0000 (UTC) (envelope-from syrinx@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAAKpQMo033921; Thu, 10 Nov 2016 20:51:26 GMT (envelope-from syrinx@FreeBSD.org) Received: (from syrinx@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAAKpQjT033920; Thu, 10 Nov 2016 20:51:26 GMT (envelope-from syrinx@FreeBSD.org) Message-Id: <201611102051.uAAKpQjT033920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: syrinx set sender to syrinx@FreeBSD.org using -f From: Shteryana Shopova Date: Thu, 10 Nov 2016 20:51:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308490 - head/contrib/bsnmp/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 20:51:27 -0000 Author: syrinx Date: Thu Nov 10 20:51:26 2016 New Revision: 308490 URL: https://svnweb.freebsd.org/changeset/base/308490 Log: Reply to a snmpEngineID discovery PDU with a Report PDU as per the requirements of RFC 3414 section 4. PR: 174974 Submitted by: pguyot@kallisys.net Reported by: several people Reviewed by: bz@ Modified: head/contrib/bsnmp/lib/snmpagent.c Modified: head/contrib/bsnmp/lib/snmpagent.c ============================================================================== --- head/contrib/bsnmp/lib/snmpagent.c Thu Nov 10 19:55:45 2016 (r308489) +++ head/contrib/bsnmp/lib/snmpagent.c Thu Nov 10 20:51:26 2016 (r308490) @@ -171,7 +171,10 @@ snmp_pdu_create_response(const struct sn memset(resp, 0, sizeof(*resp)); strcpy(resp->community, pdu->community); resp->version = pdu->version; - resp->type = SNMP_PDU_RESPONSE; + if (pdu->flags & SNMP_MSG_AUTODISCOVER) + resp->type = SNMP_PDU_REPORT; /* RFC 3414.4 */ + else + resp->type = SNMP_PDU_RESPONSE; resp->request_id = pdu->request_id; resp->version = pdu->version; From owner-svn-src-all@freebsd.org Thu Nov 10 21:09:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C455C3A735; Thu, 10 Nov 2016 21:09:22 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 224D66C8; Thu, 10 Nov 2016 21:09:22 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x233.google.com with SMTP id q124so263606267itd.1; Thu, 10 Nov 2016 13:09:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=A7aAYWs4jtvsOwJKRQUC6uDZyl/TVMDUnFTmCWDrcDU=; b=NeuDRlDqZ1umwjmoGZJqqgj27J/2ZYyy+f0mrIutI3/xr84kuVjbuhA4k9ImXXtfMm 5QVP3+RTmss+bwk6OPR/tgawjOesiIc98G2IK9azEjk2heTsCh6awjgP3veMbESnMmTz 9c+gtZgXPcDEH9o8d7amx7qC9oJQE59SV/7ND4g+MA9qZYADANvCEVPUwT2Zf3c2R4Qc lf37qvxxN3hle52ULkAxr7Fo4TNA8kX8bSzSO+aHY+ZW9CcuVeCfEv3RrkvEtwkhn2wk KWIXTTTdJnIo+DW+3z7ZTi+mSALaRl3BfFPtJHLhRkpBvH0NbVQEJfDa/qwwG642WSKM fGOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=A7aAYWs4jtvsOwJKRQUC6uDZyl/TVMDUnFTmCWDrcDU=; b=Nxnea5l4b1z3/0OLIEK8MWD1FJYOK1u1BMa6jNi/mo8S0L9iuPuz8YAb5t/w6hRt2R m94H/f4ZwVLKJPsDVk3EYdjs0re8I2owcOj6YVjECxomcPEvLLoEFEqESrxYDg3e/Xle yh8xAHnLfiBpIWtBybVUvDCorv1XAXdI+8P1oIKr72lR2PQCZjQ0H5KqLqw6imZSVHES k+jjl90P//4DQ0IzbN02L6Bh29ajsfD7yn8P+qoD2HfscZ/FSQT+RVEz7jgZVRnPX5nq JgzdRfJo7gvMDM3QiVqFrAASVdu8MhFf8ahqXd1+ujtCaMkMZfCOlBeosjZXr951krU+ 3OwA== X-Gm-Message-State: ABUngve90SHNbReM+MoGsY69NnitTRLad7WfWN9M4LGHFFsmv6GZCqKCWU9/X5vGWjDMgNCjXD3Hah4ewuqqlw== X-Received: by 10.107.192.194 with SMTP id q185mr8237460iof.129.1478812161422; Thu, 10 Nov 2016 13:09:21 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.39.134 with HTTP; Thu, 10 Nov 2016 13:09:20 -0800 (PST) In-Reply-To: References: <201610311533.u9VFXw2x053156@repo.freebsd.org> <128f2edc-eced-dc8b-72b4-267e1d26bd48@FreeBSD.org> <20161103201059.GA2104@bsdpad.com> From: Adrian Chadd Date: Thu, 10 Nov 2016 13:09:20 -0800 Message-ID: Subject: Re: svn commit: r308130 - in head: . gnu/lib/libgcc gnu/usr.bin/binutils gnu/usr.bin/binutils/ld gnu/usr.bin/binutils/libbfd gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb lib/libc lib/libc/mips... To: Ruslan Bukin , "freebsd-mips@freebsd.org" Cc: Bryan Drewery , Ruslan Bukin , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 21:09:22 -0000 ok, so there are two problems with mips now. * COP1_UNUSABLE - which is now being logged, and we were likely triggering it before. The problem: we always turned it on. If I comment out flipping on the COP1 bits in the .S files, those exceptions go away. * Page faults, but that may be me with an older userland: BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x404237c0 got a read fault (type 0x2) at 0x8 Trapframe Register Dump: zero: 0 at: 0xffffffffffffffe0 v0: 0x404471b8 v1: 0xffffffffffffffff a0: 0x404471b8 a1: 0x7ffeea50 a2: 0x16c a3: 0 t0: 0 t1: 0 t2: 0 t3: 0x70000011 t4: 0x11 t5: 0x70000013 t6: 0x3 t7: 0 t8: 0 t9: 0x4041c940 s0: 0 s1: 0x40417000 s2: 0x7fffeee0 s3: 0xffffffffffffffff s4: 0xc s5: 0x40427000 s6: 0x7fffeecc s7: 0x7ffeea50 k0: 0 k1: 0 gp: 0x4044e630 sp: 0x7ffee838 s8: 0x2 ra: 0x404224d4 sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0x8 cause: 0x8 pc: 0x404237c0 Page table info for pc address 0x404237c0: pde = 0x809aa000, pte = 0xa001ba9a Dumping 4 words starting at pc address 0x404237c0: 8e100008 1600fff1 8f828070 100000a3 -adrian On 10 November 2016 at 12:49, Adrian Chadd wrote: > hi, > > This fails to boot on actual mips24k hardware, no hardfloat: > > COP1_UNUSABLE: pid 1 tid 100001 (init), uid 0: pc 0x404237c0 ra 0x404224d4 > Trapframe Register Dump: > zero: 0 at: 0xffffffffffffffe0 v0: 0x404471b8 v1: > 0xffffffffffffffff > > .. lots of that the moment we boot userland. > > > > -adrian > > > On 3 November 2016 at 13:10, Ruslan Bukin wrote: >> On Thu, Nov 03, 2016 at 12:39:48PM -0700, Bryan Drewery wrote: >>> On 10/31/16 8:33 AM, Ruslan Bukin wrote: >>> > Modified: head/share/mk/bsd.cpu.mk >>> > ============================================================================== >>> > --- head/share/mk/bsd.cpu.mk Mon Oct 31 15:11:55 2016 (r308129) >>> > +++ head/share/mk/bsd.cpu.mk Mon Oct 31 15:33:58 2016 (r308130) >>> > @@ -303,6 +303,9 @@ MACHINE_CPU = v9 ultrasparc ultrasparc3 >>> > >>> > .if ${MACHINE_CPUARCH} == "mips" >>> > CFLAGS += -G0 >>> > +.if ${TARGET_ARCH:Mmips*hf} >>> >>> TARGET_ARCH is not valid here. This broke building ports. Fixed in >>> r308262. >>> >> >> Thank you! >> >> Ruslan >> From owner-svn-src-all@freebsd.org Thu Nov 10 21:25:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 885D5C3ADD4; Thu, 10 Nov 2016 21:25:21 +0000 (UTC) (envelope-from rionda@gmail.com) Received: from mail-qk0-x22f.google.com (mail-qk0-x22f.google.com [IPv6:2607:f8b0:400d:c09::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 41C8A24B; Thu, 10 Nov 2016 21:25:21 +0000 (UTC) (envelope-from rionda@gmail.com) Received: by mail-qk0-x22f.google.com with SMTP id n204so302956670qke.2; Thu, 10 Nov 2016 13:25:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=O+JzQDc/2o65igbCvQsUdwEz5AGfyWOtRliDE3nKB9U=; b=MmN/dAGivUZ83Y8ed44Vh31nTFSz0IPIqGKtftOlE3/OyNvdNBmhs8ZJ5HvgUh7dt1 NBVHSDE81rmCRI4mYYNgfKNX1nMTXcGgIN+I2ompo4aOESNgnykI93b80UMrBnSy5laQ ubkizEEL+uS+G0C/A/mDwDtRG5o6c9Baxn+UfaPpBNO0zUoRDzyTnr9vJB2cPoAaIrK2 DQsSGSXDwTBuvS6sNarfwntm3DaWmlPxvTM+uFpBTI3eTK8N9wled3z9cn2R++VIdiKu P466dnYR2qXu48mm7BlpiGUbKdqopOmzw9rbM5z0w0W/W4GvpZ83fH8NjXtq9jc1QFP/ P0wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=O+JzQDc/2o65igbCvQsUdwEz5AGfyWOtRliDE3nKB9U=; b=Gg7kkZQDtPRUaobu2Ikhw7D4M5iKon7K334i3g3vKQidBHb3PHjorJZI0sPzd8Z6BO Gy2dbvVhfXOKXDcvH+t1BhGoVYcgkbWwZFFyy+EoUQGZt5OmiZqA5ZmxOzWmH1ZAcVhB Hc8D+Vx0uoP408C/RqFUxdSfCPi2z9DCVBng+IQ4fykwzU2f+lBNIN0tQK27P7ZC9NmR hegesm1gmYnCWXqgXJiEsa3HGyUeX/dk9Gz1YRWpnTZTqRIDyeU+nkxNc1GkboYi5evB 8edaWG1P8mC/V3qNbPpc7YsCUUDlp7akBc7DEqyc6vPCp3Lnb5jDRe6A7YbUQ4vxczwF uRpA== X-Gm-Message-State: ABUngvcST37nrKcYowGNnAT3b2XmECKATN5waA853I+AchyX+pVWvgE++fxMS+Z2yi7UIw== X-Received: by 10.55.140.194 with SMTP id o185mr7720970qkd.243.1478813120190; Thu, 10 Nov 2016 13:25:20 -0800 (PST) Received: from [172.31.26.254] (gzac12-mdf2-1.aoa.twosigma.com. [208.77.215.155]) by smtp.gmail.com with ESMTPSA id v127sm3579880qkb.29.2016.11.10.13.25.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Nov 2016 13:25:19 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r308175 - head/libexec/ftpd From: Matteo Riondato In-Reply-To: <201611011818.uA1II9oe069262@repo.freebsd.org> Date: Thu, 10 Nov 2016 16:25:18 -0500 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201611011818.uA1II9oe069262@repo.freebsd.org> To: Kurt Lidl X-Mailer: Apple Mail (2.3251) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 21:25:21 -0000 > On Nov 1, 2016, at 2:18 PM, Kurt Lidl wrote: >=20 > Author: lidl > Date: Tue Nov 1 18:18:09 2016 > New Revision: 308175 > URL: https://svnweb.freebsd.org/changeset/base/308175 >=20 > Log: > Revisit blacklistd support in ftpd This commit is breaking buildworld for me with WITHOUT_BLACKLIST=3Dy in = src.conf : --- ftpd.o --- /usr/src/libexec/ftpd/ftpd.c:656:2: warning: implicit declaration of = function 'BLACKLIST_INIT' is invalid in C99 = [-Wimplicit-function-declaration] BLACKLIST_INIT(); ^ /usr/src/libexec/ftpd/ftpd.c:1432:4: warning: implicit declaration of = function 'BLACKLIST_NOTIFY' is invalid in C99 = [-Wimplicit-function-declaration] BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL, = STDIN_FILENO, "Login incorrect"); ^ /usr/src/libexec/ftpd/ftpd.c:1432:21: error: use of undeclared = identifier 'BLACKLIST_AUTH_FAIL'; did you mean 'BLACKLIST_NOTIFY'? BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL, = STDIN_FILENO, "Login incorrect"); ^~~~~~~~~~~~~~~~~~~ BLACKLIST_NOTIFY /usr/src/libexec/ftpd/ftpd.c:1432:4: note: 'BLACKLIST_NOTIFY' declared = here BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL, = STDIN_FILENO, "Login incorrect"); ^ /usr/src/libexec/ftpd/ftpd.c:1450:21: error: use of undeclared = identifier 'BLACKLIST_AUTH_OK'; did you mean 'BLACKLIST_NOTIFY'? BLACKLIST_NOTIFY(BLACKLIST_AUTH_OK, = STDIN_FILENO, "Login successful"); ^~~~~~~~~~~~~~~~~ BLACKLIST_NOTIFY /usr/src/libexec/ftpd/ftpd.c:1432:4: note: 'BLACKLIST_NOTIFY' declared = here BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL, = STDIN_FILENO, "Login incorrect"); ^ 2 warnings and 2 errors generated. *** [ftpd.o] Error code 1 Matteo From owner-svn-src-all@freebsd.org Thu Nov 10 21:34:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E38AC3AFD7; Thu, 10 Nov 2016 21:34:57 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-30.csi.cam.ac.uk (ppsw-30.csi.cam.ac.uk [131.111.8.130]) by mx1.freebsd.org (Postfix) with ESMTP id 5BF499F4; Thu, 10 Nov 2016 21:34:56 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from sc1.bsdpad.com ([163.172.212.18]:37801) by ppsw-30.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.156]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1c4wzo-000bhA-d4 (Exim 4.86_36-e07b163) (return-path ); Thu, 10 Nov 2016 21:34:56 +0000 Date: Thu, 10 Nov 2016 21:34:12 +0000 From: Ruslan Bukin To: Adrian Chadd Cc: "freebsd-mips@freebsd.org" , Bryan Drewery , Ruslan Bukin , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r308130 - in head: . gnu/lib/libgcc gnu/usr.bin/binutils gnu/usr.bin/binutils/ld gnu/usr.bin/binutils/libbfd gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb lib/libc lib/libc/mips... Message-ID: <20161110213412.GA21672@bsdpad.com> References: <201610311533.u9VFXw2x053156@repo.freebsd.org> <128f2edc-eced-dc8b-72b4-267e1d26bd48@FreeBSD.org> <20161103201059.GA2104@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 21:34:57 -0000 Hi, Adrian, thanks, but I have lack of ideas yet. I just tested this on Ingenic X1000 (mips.mipsel) and it works fine, as well as mips.mipselhf (this hardware has FPU). I have no hardware without FPU. What exactly COP_1 bits you have commented to get rid of COP1_UNUSABLE? Ruslan On Thu, Nov 10, 2016 at 01:09:20PM -0800, Adrian Chadd wrote: > ok, so there are two problems with mips now. > > * COP1_UNUSABLE - which is now being logged, and we were likely > triggering it before. The problem: we always turned it on. If I > comment out flipping on the COP1 bits in the .S files, those > exceptions go away. > > * Page faults, but that may be me with an older userland: > > BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x404237c0 got a > read fault (type 0x2) at 0x8 > Trapframe Register Dump: > zero: 0 at: 0xffffffffffffffe0 v0: 0x404471b8 v1: > 0xffffffffffffffff > a0: 0x404471b8 a1: 0x7ffeea50 a2: 0x16c a3: 0 > t0: 0 t1: 0 t2: 0 t3: 0x70000011 > t4: 0x11 t5: 0x70000013 t6: 0x3 t7: 0 > t8: 0 t9: 0x4041c940 s0: 0 s1: 0x40417000 > s2: 0x7fffeee0 s3: 0xffffffffffffffff s4: 0xc s5: 0x40427000 > s6: 0x7fffeecc s7: 0x7ffeea50 k0: 0 k1: 0 > gp: 0x4044e630 sp: 0x7ffee838 s8: 0x2 ra: 0x404224d4 > sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0x8 > cause: 0x8 pc: 0x404237c0 > Page table info for pc address 0x404237c0: pde = 0x809aa000, pte = 0xa001ba9a > Dumping 4 words starting at pc address 0x404237c0: > 8e100008 1600fff1 8f828070 100000a3 > > > > -adrian > > > On 10 November 2016 at 12:49, Adrian Chadd wrote: > > hi, > > > > This fails to boot on actual mips24k hardware, no hardfloat: > > > > COP1_UNUSABLE: pid 1 tid 100001 (init), uid 0: pc 0x404237c0 ra 0x404224d4 > > Trapframe Register Dump: > > zero: 0 at: 0xffffffffffffffe0 v0: 0x404471b8 v1: > > 0xffffffffffffffff > > > > .. lots of that the moment we boot userland. > > > > > > > > -adrian > > > > > > On 3 November 2016 at 13:10, Ruslan Bukin wrote: > >> On Thu, Nov 03, 2016 at 12:39:48PM -0700, Bryan Drewery wrote: > >>> On 10/31/16 8:33 AM, Ruslan Bukin wrote: > >>> > Modified: head/share/mk/bsd.cpu.mk > >>> > ============================================================================== > >>> > --- head/share/mk/bsd.cpu.mk Mon Oct 31 15:11:55 2016 (r308129) > >>> > +++ head/share/mk/bsd.cpu.mk Mon Oct 31 15:33:58 2016 (r308130) > >>> > @@ -303,6 +303,9 @@ MACHINE_CPU = v9 ultrasparc ultrasparc3 > >>> > > >>> > .if ${MACHINE_CPUARCH} == "mips" > >>> > CFLAGS += -G0 > >>> > +.if ${TARGET_ARCH:Mmips*hf} > >>> > >>> TARGET_ARCH is not valid here. This broke building ports. Fixed in > >>> r308262. > >>> > >> > >> Thank you! > >> > >> Ruslan > >> From owner-svn-src-all@freebsd.org Thu Nov 10 22:21:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70D4AC3B700; Thu, 10 Nov 2016 22:21:49 +0000 (UTC) (envelope-from kczekirda@gmail.com) Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A27A3A63; Thu, 10 Nov 2016 22:21:48 +0000 (UTC) (envelope-from kczekirda@gmail.com) Received: by mail-wm0-x232.google.com with SMTP id t79so59903215wmt.0; Thu, 10 Nov 2016 14:21:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=vAwjOTZfabfCtM79bnuysLyBrtdB2jKdXzY1cnn+a44=; b=iuSg7/wRHbsWmy996SNJJ71Prp/UT+JPmxcXv51wKitHRFfapfS6xM2E3F5zM35lE5 vYEiwvmpJ0yiBFRj1EuPV0BZKG/QWizZD5hmikEi8erYOPkDj6dgL2JX9jBrpCegE/jU WH1o34jkK/8udAk5TZsT0X0EwMI0dS0xeCnqVxbR9Nc9A8ttYR4+7k4y2mjkvSvJee8O zuvAiTAC2YnKBJA1foVLT+EfIYx0CJc99IuZ4zoBKHLVqj5b+ogfsMmrTxlRyZbLDdKM 5788RAco4hSCj/k3uyxtowhjCQflSXNgVtwqh5E118hLgdam5erbhGPYzti8LD52g5US LhFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=vAwjOTZfabfCtM79bnuysLyBrtdB2jKdXzY1cnn+a44=; b=LpevMsV6Sp73aNNAPtuHC3OCkt9cfJ7GWsjzM6s3LhDRCsUkIGdNGQWDhwRdyK/LEf zTci54RNg0vH80624Z6AD5RnBlun/D7Ef4W6rl9yzN7FSvUJkRMRsgm/9T6szxEYpzw6 1ih8wA0MR2rE7nqAKZM5bYuHDkRFjyWbrjW/JYjsaunGbSkwEWz4zlDswUEYgAV0l84U nLh0FwRfm81y9dPDpUEGVXlWAAE6nzUUo/tKyVn16FYR+EyXtNibhJGqQuCL3js62dDF 6r73358l5RDJ94XJDKdRRulrMSw0OQcnixPRmAws4+mbZ+IlYvthZ4ch5Gjx7c+pVpqR C1Fg== X-Gm-Message-State: ABUngvfd8S7Kd2Hy9nudPtsJMs6SR69dewda5pUk6RiowSJN+w8k6xxMgxS5zsi9jiIPB6A79/KxhZRR+Zjd0Q== X-Received: by 10.194.236.72 with SMTP id us8mr6482570wjc.211.1478816506152; Thu, 10 Nov 2016 14:21:46 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.49.137 with HTTP; Thu, 10 Nov 2016 14:21:15 -0800 (PST) In-Reply-To: <201611080650.uA86oJ7W056026@repo.freebsd.org> References: <201611080650.uA86oJ7W056026@repo.freebsd.org> From: Kamil Czekirda Date: Thu, 10 Nov 2016 23:21:15 +0100 Message-ID: Subject: Re: svn commit: r308434 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sys... To: Toomas Soome Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 22:21:49 -0000 Hi, I got the following: root@current:/usr/src # svnlite up -r r308434 Updating '.': U lib/libstand/stand.h U sys/boot/common/dev_net.c U sys/boot/common/module.c U sys/boot/common/part.c U sys/boot/common/util.c U sys/boot/common/util.h U sys/boot/efi/libefi/efinet.c U sys/boot/efi/libefi/efipart.c U sys/boot/efi/loader/main.c U sys/boot/i386/libfirewire/firewire.c U sys/boot/i386/libi386/bioscd.c U sys/boot/i386/libi386/biosdisk.c U sys/boot/mips/beri/loader/beri_disk_cfi.c U sys/boot/mips/beri/loader/beri_disk_sdcard.c U sys/boot/ofw/libofw/ofw_disk.c U sys/boot/pc98/libpc98/bioscd.c U sys/boot/pc98/libpc98/biosdisk.c U sys/boot/powerpc/kboot/hostdisk.c U sys/boot/powerpc/ps3/ps3cdrom.c U sys/boot/powerpc/ps3/ps3disk.c U sys/boot/uboot/lib/disk.c U sys/boot/usb/storage/umass_loader.c U sys/boot/userboot/userboot/host.c U sys/boot/userboot/userboot/userboot_disk.c U sys/boot/zfs/zfs.c U sys/boot/zfs/zfsimpl.c U sys/boot/i386/libi386/pxe.c Updated to revision 308434. root@current:/usr/src # cd sys/boot/ root@current:/usr/src/sys/boot # make clean (...) root@current:/usr/src/sys/boot # make obj (...) root@current:/usr/src/sys/boot # make (...) cc -O2 -pipe -DSKEIN_LOOP=111 -fPIC -I/usr/src/sys/boot/efi/loader -I/usr/src/sys/boot/efi/loader/arch/amd64 -I/usr/src/sys/boot/efi/loader/../include -I/usr/src/sys/boot/efi/loader/../include/amd64 -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include -I/usr/src/sys/boot/efi/loader/../../.. -I/usr/src/sys/boot/efi/loader/../../i386/libi386 -I/usr/src/sys/boot/efi/loader/../../zfs -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT -DNO_PCI -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH -I/usr/src/sys/boot/efi/loader/../../ficl -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 -DLOADER_DISK_SUPPORT -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC -I/usr/src/sys/boot/ficl -I/usr/src/sys/boot/ficl/amd64 -I/usr/src/sys/boot/ficl/../common -I/usr/src/sys/boot/efi/loader/../../common -ffreestanding -Wformat -msoft-float -mno-mmx -mno-sse -mno-avx -fshort-wchar -mno-red-zone -mno-aes -g -MD -MF.depend.vers.o -MTvers.o -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Qunused-arguments -c vers.c -o vers.o cc -O2 -pipe -DSKEIN_LOOP=111 -fPIC -I/usr/src/sys/boot/efi/loader -I/usr/src/sys/boot/efi/loader/arch/amd64 -I/usr/src/sys/boot/efi/loader/../include -I/usr/src/sys/boot/efi/loader/../include/amd64 -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include -I/usr/src/sys/boot/efi/loader/../../.. -I/usr/src/sys/boot/efi/loader/../../i386/libi386 -I/usr/src/sys/boot/efi/loader/../../zfs -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT -DNO_PCI -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH -I/usr/src/sys/boot/efi/loader/../../ficl -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 -DLOADER_DISK_SUPPORT -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC -I/usr/src/sys/boot/ficl -I/usr/src/sys/boot/ficl/amd64 -I/usr/src/sys/boot/ficl/../common -I/usr/src/sys/boot/efi/loader/../../common -ffreestanding -Wformat -msoft-float -mno-mmx -mno-sse -mno-avx -fshort-wchar -mno-red-zone -mno-aes -g -MD -MF.depend.zfs.o -MTzfs.o -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-sign-compare -Wno-array-bounds -Wno-missing-prototypes -Qunused-arguments -c /usr/src/sys/boot/efi/loader/../../zfs/zfs.c -o zfs.o /usr/src/sys/boot/efi/loader/../../zfs/zfs.c:599:14: error: incompatible pointer types initializing 'void (*)(int)' with an expression of type 'int (int)' [-Werror,-Wincompatible-pointer-types] .dv_print = zfs_dev_print, ^~~~~~~~~~~~~ 1 error generated. *** Error code 1 Stop. make[2]: stopped in /usr/src/sys/boot/efi/loader *** Error code 1 Stop. make[1]: stopped in /usr/src/sys/boot/efi *** Error code 1 Stop. make: stopped in /usr/src/sys/boot Kamil 2016-11-08 7:50 GMT+01:00 Toomas Soome : > Author: tsoome > Date: Tue Nov 8 06:50:18 2016 > New Revision: 308434 > URL: https://svnweb.freebsd.org/changeset/base/308434 > > Log: > Loader paged/pageable data is not always paged. > > This change does modify devsw dv_print() to return the int value, > enabling walkers to interrupt the walk on non zero value from dv_print(). > > This will allow the pager_print actually to stop displaying data on > user input, and additionally pager is used in various *dev_print > callbacks, > where it was missing. > > For test, lsdev [-v] command should display data by screenfuls and should > stop when the key 'q' is pressed on pager prompt. > > Reviewed by: allanjude > Approved by: allanjude (mentor) > Differential Revision: https://reviews.freebsd.org/D5461 > > Modified: > head/lib/libstand/stand.h > head/sys/boot/common/dev_net.c > head/sys/boot/common/module.c > head/sys/boot/common/part.c > head/sys/boot/common/util.c > head/sys/boot/common/util.h > head/sys/boot/efi/libefi/efinet.c > head/sys/boot/efi/libefi/efipart.c > head/sys/boot/efi/loader/main.c > head/sys/boot/i386/libfirewire/firewire.c > head/sys/boot/i386/libi386/bioscd.c > head/sys/boot/i386/libi386/biosdisk.c > head/sys/boot/i386/libi386/pxe.c > head/sys/boot/mips/beri/loader/beri_disk_cfi.c > head/sys/boot/mips/beri/loader/beri_disk_sdcard.c > head/sys/boot/ofw/libofw/ofw_disk.c > head/sys/boot/pc98/libpc98/bioscd.c > head/sys/boot/pc98/libpc98/biosdisk.c > head/sys/boot/powerpc/kboot/hostdisk.c > head/sys/boot/powerpc/ps3/ps3cdrom.c > head/sys/boot/powerpc/ps3/ps3disk.c > head/sys/boot/uboot/lib/disk.c > head/sys/boot/usb/storage/umass_loader.c > head/sys/boot/userboot/userboot/host.c > head/sys/boot/userboot/userboot/userboot_disk.c > head/sys/boot/zfs/zfs.c > head/sys/boot/zfs/zfsimpl.c > > Modified: head/lib/libstand/stand.h > ============================================================ > ================== > --- head/lib/libstand/stand.h Tue Nov 8 06:13:22 2016 (r308433) > +++ head/lib/libstand/stand.h Tue Nov 8 06:50:18 2016 (r308434) > @@ -143,7 +143,7 @@ struct devsw { > int (*dv_open)(struct open_file *f, ...); > int (*dv_close)(struct open_file *f); > int (*dv_ioctl)(struct open_file *f, u_long cmd, void > *data); > - void (*dv_print)(int verbose); /* print device > information */ > + int (*dv_print)(int verbose); /* print device > information */ > void (*dv_cleanup)(void); > }; > > > Modified: head/sys/boot/common/dev_net.c > ============================================================ > ================== > --- head/sys/boot/common/dev_net.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/common/dev_net.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -80,7 +80,7 @@ static int net_open(struct open_file *, > static int net_close(struct open_file *); > static void net_cleanup(void); > static int net_strategy(); > -static void net_print(int); > +static int net_print(int); > > static int net_getparams(int sock); > > @@ -325,23 +325,27 @@ exit: > return (0); > } > > -static void > +static int > net_print(int verbose) > { > struct netif_driver *drv; > int i, d, cnt; > + int ret = 0; > > cnt = 0; > for (d = 0; netif_drivers[d]; d++) { > drv = netif_drivers[d]; > for (i = 0; i < drv->netif_nifs; i++) { > printf("\t%s%d:", "net", cnt++); > - if (verbose) > + if (verbose) { > printf(" (%s%d)", drv->netif_bname, > drv->netif_ifs[i].dif_unit); > + } > + if ((ret = pager_output("\n")) != 0) > + return (ret); > } > } > - printf("\n"); > + return (ret); > } > > /* > > Modified: head/sys/boot/common/module.c > ============================================================ > ================== > --- head/sys/boot/common/module.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/common/module.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -254,7 +254,7 @@ command_lsmod(int argc, char *argv[]) > struct kernel_module *mp; > struct file_metadata *md; > char lbuf[80]; > - int ch, verbose; > + int ch, verbose, ret = 0; > > verbose = 0; > optind = 1; > @@ -273,11 +273,13 @@ command_lsmod(int argc, char *argv[]) > > pager_open(); > for (fp = preloaded_files; fp; fp = fp->f_next) { > - sprintf(lbuf, " %p: ", (void *) fp->f_addr); > + snprintf(lbuf, sizeof(lbuf), " %p: ", (void *) fp->f_addr); > pager_output(lbuf); > pager_output(fp->f_name); > - sprintf(lbuf, " (%s, 0x%lx)\n", fp->f_type, (long)fp->f_size); > - pager_output(lbuf); > + snprintf(lbuf, sizeof(lbuf), " (%s, 0x%lx)\n", fp->f_type, > + (long)fp->f_size); > + if (pager_output(lbuf)) > + break; > if (fp->f_args != NULL) { > pager_output(" args: "); > pager_output(fp->f_args); > @@ -287,7 +289,8 @@ command_lsmod(int argc, char *argv[]) > if (fp->f_modules) { > pager_output(" modules: "); > for (mp = fp->f_modules; mp; mp = mp->m_next) { > - sprintf(lbuf, "%s.%d ", mp->m_name, mp->m_version); > + snprintf(lbuf, sizeof(lbuf), "%s.%d ", mp->m_name, > + mp->m_version); > pager_output(lbuf); > } > if (pager_output("\n")) > @@ -296,11 +299,14 @@ command_lsmod(int argc, char *argv[]) > if (verbose) { > /* XXX could add some formatting smarts here to display some > better */ > for (md = fp->f_metadata; md != NULL; md = md->md_next) { > - sprintf(lbuf, " 0x%04x, 0x%lx\n", md->md_type, (long) > md->md_size); > + snprintf(lbuf, sizeof(lbuf), " 0x%04x, 0x%lx\n", > + md->md_type, (long) md->md_size); > if (pager_output(lbuf)) > break; > } > } > + if (ret) > + break; > } > pager_close(); > return(CMD_OK); > > Modified: head/sys/boot/common/part.c > ============================================================ > ================== > --- head/sys/boot/common/part.c Tue Nov 8 06:13:22 2016 (r308433) > +++ head/sys/boot/common/part.c Tue Nov 8 06:50:18 2016 (r308434) > @@ -834,6 +834,7 @@ ptable_iterate(const struct ptable *tabl > { > struct pentry *entry; > char name[32]; > + int ret = 0; > > name[0] = '\0'; > STAILQ_FOREACH(entry, &table->entries, entry) { > @@ -856,9 +857,8 @@ ptable_iterate(const struct ptable *tabl > if (table->type == PTABLE_BSD) > sprintf(name, "%c", (u_char) 'a' + > entry->part.index); > - if (iter(arg, name, &entry->part)) > - return 1; > + if ((ret = iter(arg, name, &entry->part)) != 0) > + return (ret); > } > - return 0; > + return (ret); > } > - > > Modified: head/sys/boot/common/util.c > ============================================================ > ================== > --- head/sys/boot/common/util.c Tue Nov 8 06:13:22 2016 (r308433) > +++ head/sys/boot/common/util.c Tue Nov 8 06:50:18 2016 (r308434) > @@ -114,7 +114,7 @@ strlen(const char *s) > return (len); > } > > -void > +int > printf(const char *fmt, ...) > { > va_list ap; > @@ -178,4 +178,5 @@ nextfmt: > } > } > va_end(ap); > + return (0); > } > > Modified: head/sys/boot/common/util.h > ============================================================ > ================== > --- head/sys/boot/common/util.h Tue Nov 8 06:13:22 2016 (r308433) > +++ head/sys/boot/common/util.h Tue Nov 8 06:50:18 2016 (r308434) > @@ -48,6 +48,6 @@ void strcat(char *dst, const char *src); > char *strchr(const char *s, char ch); > size_t strlen(const char *s); > > -void printf(const char *fmt, ...); > +int printf(const char *fmt, ...); > > #endif /* !_UTIL_H_ */ > > Modified: head/sys/boot/efi/libefi/efinet.c > ============================================================ > ================== > --- head/sys/boot/efi/libefi/efinet.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/efi/libefi/efinet.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -252,7 +252,7 @@ efinet_end(struct netif *nif) > } > > static int efinet_dev_init(void); > -static void efinet_dev_print(int); > +static int efinet_dev_print(int); > > struct devsw efinet_dev = { > .dv_name = "net", > @@ -346,14 +346,13 @@ efinet_dev_init() > return (0); > } > > -static void > +static int > efinet_dev_print(int verbose) > { > CHAR16 *text; > EFI_HANDLE h; > - int unit; > + int unit, ret = 0; > > - pager_open(); > for (unit = 0, h = efi_find_handle(&efinet_dev, 0); > h != NULL; h = efi_find_handle(&efinet_dev, ++unit)) { > printf(" %s%d:", efinet_dev.dv_name, unit); > @@ -364,8 +363,8 @@ efinet_dev_print(int verbose) > efi_free_devpath_name(text); > } > } > - if (pager_output("\n")) > + if ((ret = pager_output("\n")) != 0) > break; > } > - pager_close(); > + return (ret); > } > > Modified: head/sys/boot/efi/libefi/efipart.c > ============================================================ > ================== > --- head/sys/boot/efi/libefi/efipart.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/efi/libefi/efipart.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -47,7 +47,7 @@ static int efipart_realstrategy(void *, > size_t *); > static int efipart_open(struct open_file *, ...); > static int efipart_close(struct open_file *); > -static void efipart_print(int); > +static int efipart_print(int); > > struct devsw efipart_dev = { > .dv_name = "part", > @@ -162,7 +162,7 @@ efipart_init(void) > return (err); > } > > -static void > +static int > efipart_print(int verbose) > { > char line[80]; > @@ -170,28 +170,29 @@ efipart_print(int verbose) > EFI_HANDLE h; > EFI_STATUS status; > u_int unit; > + int ret = 0; > > - pager_open(); > for (unit = 0, h = efi_find_handle(&efipart_dev, 0); > h != NULL; h = efi_find_handle(&efipart_dev, ++unit)) { > - sprintf(line, " %s%d:", efipart_dev.dv_name, unit); > - if (pager_output(line)) > + snprintf(line, sizeof(line), " %s%d:", > + efipart_dev.dv_name, unit); > + if ((ret = pager_output(line)) != 0) > break; > > status = BS->HandleProtocol(h, &blkio_guid, (void > **)&blkio); > if (!EFI_ERROR(status)) { > - sprintf(line, " %llu blocks", > + snprintf(line, sizeof(line), " %llu blocks", > (unsigned long long)(blkio->Media->LastBlock + > 1)); > - if (pager_output(line)) > + if ((ret = pager_output(line)) != 0) > break; > if (blkio->Media->RemovableMedia) > - if (pager_output(" (removable)")) > + if ((ret = pager_output(" (removable)")) > != 0) > break; > } > - if (pager_output("\n")) > + if ((ret = pager_output("\n")) != 0) > break; > } > - pager_close(); > + return (ret); > } > > static int > > Modified: head/sys/boot/efi/loader/main.c > ============================================================ > ================== > --- head/sys/boot/efi/loader/main.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/efi/loader/main.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -533,6 +533,7 @@ command_memmap(int argc, char *argv[]) > UINT32 dver; > EFI_STATUS status; > int i, ndesc; > + char line[80]; > static char *types[] = { > "Reserved", > "LoaderCode", > @@ -564,14 +565,19 @@ command_memmap(int argc, char *argv[]) > } > > ndesc = sz / dsz; > - printf("%23s %12s %12s %8s %4s\n", > + snprintf(line, sizeof(line), "%23s %12s %12s %8s %4s\n", > "Type", "Physical", "Virtual", "#Pages", "Attr"); > + pager_open(); > + if (pager_output(line)) { > + pager_close(); > + return (CMD_OK); > + } > > for (i = 0, p = map; i < ndesc; > i++, p = NextMemoryDescriptor(p, dsz)) { > printf("%23s %012jx %012jx %08jx ", types[p->Type], > - (uintmax_t)p->PhysicalStart, (uintmax_t)p->VirtualStart, > - (uintmax_t)p->NumberOfPages); > + (uintmax_t)p->PhysicalStart, > (uintmax_t)p->VirtualStart, > + (uintmax_t)p->NumberOfPages); > if (p->Attribute & EFI_MEMORY_UC) > printf("UC "); > if (p->Attribute & EFI_MEMORY_WC) > @@ -588,9 +594,11 @@ command_memmap(int argc, char *argv[]) > printf("RP "); > if (p->Attribute & EFI_MEMORY_XP) > printf("XP "); > - printf("\n"); > + if (pager_output("\n")) > + break; > } > > + pager_close(); > return (CMD_OK); > } > > @@ -612,10 +620,17 @@ guid_to_string(EFI_GUID *guid) > static int > command_configuration(int argc, char *argv[]) > { > + char line[80]; > UINTN i; > > - printf("NumberOfTableEntries=%lu\n", > + snprintf(line, sizeof(line), "NumberOfTableEntries=%lu\n", > (unsigned long)ST->NumberOfTableEntries); > + pager_open(); > + if (pager_output(line)) { > + pager_close(); > + return (CMD_OK); > + } > + > for (i = 0; i < ST->NumberOfTableEntries; i++) { > EFI_GUID *guid; > > @@ -642,9 +657,13 @@ command_configuration(int argc, char *ar > printf("FDT Table"); > else > printf("Unknown Table (%s)", guid_to_string(guid)); > - printf(" at %p\n", ST->ConfigurationTable[i].VendorTable); > + snprintf(line, sizeof(line), " at %p\n", > + ST->ConfigurationTable[i].VendorTable); > + if (pager_output(line)) > + break; > } > > + pager_close(); > return (CMD_OK); > } > > > Modified: head/sys/boot/i386/libfirewire/firewire.c > ============================================================ > ================== > --- head/sys/boot/i386/libfirewire/firewire.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/i386/libfirewire/firewire.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -69,7 +69,7 @@ static int fw_strategy(void *devdata, in > size_t offset, size_t size, char *buf, size_t *rsize); > static int fw_open(struct open_file *f, ...); > static int fw_close(struct open_file *f); > -static void fw_print(int verbose); > +static int fw_print(int verbose); > static void fw_cleanup(void); > > void fw_enable(void); > @@ -148,21 +148,26 @@ fw_init(void) > /* > * Print information about OHCI chips > */ > -static void > +static int > fw_print(int verbose) > { > - int i; > + char line[80]; > + int i, ret = 0; > struct fwohci_softc *sc; > > for (i = 0; i < MAX_OHCI; i ++) { > sc = &fwinfo[i]; > if (sc->state == FWOHCI_STATE_DEAD) > break; > - printf("%d: locator=0x%04x devid=0x%08x" > + snprintf(line, sizeof(line), "%d: locator=0x%04x > devid=0x%08x" > " base_addr=0x%08x handle=0x%08x bus_id=0x%08x\n", > i, sc->locator, sc->devid, > sc->base_addr, sc->handle, sc->bus_id); > + ret = pager_output(line); > + if (ret != 0) > + break; > } > + return (ret); > } > > static int > > Modified: head/sys/boot/i386/libi386/bioscd.c > ============================================================ > ================== > --- head/sys/boot/i386/libi386/bioscd.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/i386/libi386/bioscd.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -100,7 +100,7 @@ static int bc_realstrategy(void *devdata > size_t offset, size_t size, char *buf, size_t *rsize); > static int bc_open(struct open_file *f, ...); > static int bc_close(struct open_file *f); > -static void bc_print(int verbose); > +static int bc_print(int verbose); > > struct devsw bioscd = { > "cd", > @@ -177,20 +177,19 @@ bc_add(int biosdev) > /* > * Print information about disks > */ > -static void > +static int > bc_print(int verbose) > { > char line[80]; > - int i; > + int i, ret = 0; > > - pager_open(); > for (i = 0; i < nbcinfo; i++) { > - sprintf(line, " cd%d: Device 0x%x\n", i, > + snprintf(line, sizeof(line), " cd%d: Device 0x%x\n", i, > bcinfo[i].bc_sp.sp_devicespec); > - if (pager_output(line)) > + if ((ret = pager_output(line)) != 0) > break; > } > - pager_close(); > + return (ret); > } > > /* > > Modified: head/sys/boot/i386/libi386/biosdisk.c > ============================================================ > ================== > --- head/sys/boot/i386/libi386/biosdisk.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/i386/libi386/biosdisk.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -135,7 +135,7 @@ static int bd_realstrategy(void *devdata > static int bd_open(struct open_file *f, ...); > static int bd_close(struct open_file *f); > static int bd_ioctl(struct open_file *f, u_long cmd, void *data); > -static void bd_print(int verbose); > +static int bd_print(int verbose); > static void bd_cleanup(void); > > #ifdef LOADER_GELI_SUPPORT > @@ -321,21 +321,21 @@ bd_int13probe(struct bdinfo *bd) > /* > * Print information about disks > */ > -static void > +static int > bd_print(int verbose) > { > static char line[80]; > struct disk_devdesc dev; > - int i; > + int i, ret = 0; > > - pager_open(); > for (i = 0; i < nbdinfo; i++) { > - sprintf(line, " disk%d: BIOS drive %c (%ju X %u):\n", > i, > + snprintf(line, sizeof(line), > + " disk%d: BIOS drive %c (%ju X %u):\n", i, > (bdinfo[i].bd_unit < 0x80) ? ('A' + bdinfo[i].bd_unit): > ('C' + bdinfo[i].bd_unit - 0x80), > (uintmax_t)bdinfo[i].bd_sectors, > bdinfo[i].bd_sectorsize); > - if (pager_output(line)) > + if ((ret = pager_output(line)) != 0) > break; > dev.d_dev = &biosdisk; > dev.d_unit = i; > @@ -346,12 +346,14 @@ bd_print(int verbose) > bdinfo[i].bd_sectorsize, > (bdinfo[i].bd_flags & BD_FLOPPY) ? > DISK_F_NOCACHE: 0) == 0) { > - sprintf(line, " disk%d", i); > - disk_print(&dev, line, verbose); > + snprintf(line, sizeof(line), " disk%d", i); > + ret = disk_print(&dev, line, verbose); > disk_close(&dev); > + if (ret != 0) > + return (ret); > } > } > - pager_close(); > + return (ret); > } > > /* > > Modified: head/sys/boot/i386/libi386/pxe.c > ============================================================ > ================== > --- head/sys/boot/i386/libi386/pxe.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/i386/libi386/pxe.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -75,7 +75,7 @@ static int pxe_strategy(void *devdata, i > size_t offset, size_t size, char *buf, size_t > *rsize); > static int pxe_open(struct open_file *f, ...); > static int pxe_close(struct open_file *f); > -static void pxe_print(int verbose); > +static int pxe_print(int verbose); > static void pxe_cleanup(void); > static void pxe_setnfshandle(char *rootpath); > > @@ -381,14 +381,20 @@ pxe_close(struct open_file *f) > return (0); > } > > -static void > +static int > pxe_print(int verbose) > { > - > + char line[255]; > if (pxe_call == NULL) > - return; > + return (0); > > - printf(" pxe0: %s:%s\n", inet_ntoa(rootip), rootpath); > + if (verbose) { > + snprintf(line, sizeof(line), " pxe0: %s:%s\n", > + inet_ntoa(rootip), rootpath); > + } else { > + snprintf(line, sizeof(line), " pxe0:\n"); > + } > + return (pager_output(line)); > } > > static void > > Modified: head/sys/boot/mips/beri/loader/beri_disk_cfi.c > ============================================================ > ================== > --- head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Nov 8 > 06:13:22 2016 (r308433) > +++ head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Nov 8 > 06:50:18 2016 (r308434) > @@ -47,7 +47,7 @@ static int beri_cfi_disk_close(struct op > static void beri_cfi_disk_cleanup(void); > static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t, > size_t, > char *, size_t *); > -static void beri_cfi_disk_print(int); > +static int beri_cfi_disk_print(int); > > struct devsw beri_cfi_disk = { > .dv_name = "cfi", > @@ -112,25 +112,29 @@ beri_cfi_disk_close(struct open_file *f) > return (disk_close(dev)); > } > > -static void > +static int > beri_cfi_disk_print(int verbose) > { > struct disk_devdesc dev; > char line[80]; > + int ret; > > - sprintf(line, " cfi%d CFI flash device\n", 0); > - pager_output(line); > + snprintf(line, sizeof(line), " cfi%d CFI flash device\n", 0); > + ret = pager_output(line); > + if (ret != 0) > + return (ret); > dev.d_dev = &beri_cfi_disk; > dev.d_unit = 0; > dev.d_slice = -1; > dev.d_partition = -1; > if (disk_open(&dev, cfi_get_mediasize(), > cfi_get_sectorsize(), 0) == 0) { > - sprintf(line, " cfi%d", 0); > - disk_print(&dev, line, verbose); > + snprintf(line, sizeof(line), " cfi%d", 0); > + ret = disk_print(&dev, line, verbose); > disk_close(&dev); > } > > + return (ret); > } > > static void > > Modified: head/sys/boot/mips/beri/loader/beri_disk_sdcard.c > ============================================================ > ================== > --- head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Nov 8 > 06:13:22 2016 (r308433) > +++ head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Nov 8 > 06:50:18 2016 (r308434) > @@ -47,7 +47,7 @@ static int beri_sdcard_disk_close(struct > static void beri_sdcard_disk_cleanup(void); > static int beri_sdcard_disk_strategy(void *, int, daddr_t, size_t, > size_t, > char *, size_t *); > -static void beri_sdcard_disk_print(int); > +static int beri_sdcard_disk_print(int); > > struct devsw beri_sdcard_disk = { > .dv_name = "sdcard", > @@ -123,19 +123,23 @@ beri_sdcard_disk_print(int verbose) > { > struct disk_devdesc dev; > char line[80]; > + int ret; > > - sprintf(line, " sdcard%d Altera SD card drive\n", 0); > - pager_output(line); > + snprintf(line, sizeof(line), " sdcard%d Altera SD card > drive\n", 0); > + ret = pager_output(line); > + if (ret != 0) > + return (ret); > dev.d_dev = &beri_sdcard_disk; > dev.d_unit = 0; > dev.d_slice = -1; > dev.d_partition = -1; > if (disk_open(&dev, altera_sdcard_get_mediasize(), > altera_sdcard_get_sectorsize(), 0) == 0) { > - sprintf(line, " sdcard%d", 0); > - disk_print(&dev, line, verbose); > + snprintf(line, sizeof(line), " sdcard%d", 0); > + ret = disk_print(&dev, line, verbose); > disk_close(&dev); > } > + return (ret); > } > > static void > > Modified: head/sys/boot/ofw/libofw/ofw_disk.c > ============================================================ > ================== > --- head/sys/boot/ofw/libofw/ofw_disk.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/ofw/libofw/ofw_disk.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -47,7 +47,7 @@ static int ofwd_strategy(void *devdata, > static int ofwd_open(struct open_file *f, ...); > static int ofwd_close(struct open_file *f); > static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data); > -static void ofwd_print(int verbose); > +static int ofwd_print(int verbose); > > struct devsw ofwdisk = { > "block", > @@ -161,8 +161,8 @@ ofwd_ioctl(struct open_file *f __unused, > return (EINVAL); > } > > -static void > +static int > ofwd_print(int verbose __unused) > { > - > + return (0); > } > > Modified: head/sys/boot/pc98/libpc98/bioscd.c > ============================================================ > ================== > --- head/sys/boot/pc98/libpc98/bioscd.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/pc98/libpc98/bioscd.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -99,7 +99,7 @@ static int bc_realstrategy(void *devdata > size_t offset, size_t size, char *buf, size_t *rsize); > static int bc_open(struct open_file *f, ...); > static int bc_close(struct open_file *f); > -static void bc_print(int verbose); > +static int bc_print(int verbose); > > struct devsw bioscd = { > "cd", > @@ -173,20 +173,19 @@ bc_add(int biosdev) > /* > * Print information about disks > */ > -static void > +static int > bc_print(int verbose) > { > char line[80]; > - int i; > + int i, ret = 0; > > - pager_open(); > for (i = 0; i < nbcinfo; i++) { > sprintf(line, " cd%d: Device 0x%x\n", i, > bcinfo[i].bc_sp.sp_devicespec); > - if (pager_output(line)) > + if ((ret = pager_output(line)) != 0) > break; > } > - pager_close(); > + return (ret); > } > > /* > > Modified: head/sys/boot/pc98/libpc98/biosdisk.c > ============================================================ > ================== > --- head/sys/boot/pc98/libpc98/biosdisk.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/pc98/libpc98/biosdisk.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -123,7 +123,7 @@ static int bd_realstrategy(void *devdata > size_t offset, size_t size, char *buf, size_t *rsize); > static int bd_open(struct open_file *f, ...); > static int bd_close(struct open_file *f); > -static void bd_print(int verbose); > +static int bd_print(int verbose); > > struct devsw biosdisk = { > "disk", > @@ -249,21 +249,20 @@ bd_int13probe(struct bdinfo *bd) > /* > * Print information about disks > */ > -static void > +static int > bd_print(int verbose) > { > - int i, j, done; > + int i, j, ret = 0; > char line[80]; > struct i386_devdesc dev; > struct open_disk *od; > struct pc98_partition *dptr; > > - pager_open(); > - done = 0; > - for (i = 0; i < nbdinfo && !done; i++) { > - sprintf(line, " disk%d: BIOS drive %c:\n", i, 'A' + i); > - if (pager_output(line)) > - break; > + for (i = 0; i < nbdinfo; i++) { > + snprintf(line, sizeof(line), " disk%d: BIOS drive %c:\n", > + i, 'A' + i); > + if ((ret = pager_output(line)) != 0) > + break; > > /* try to open the whole disk */ > dev.d_unit = i; > @@ -278,17 +277,17 @@ bd_print(int verbose) > > /* Check for a "dedicated" disk */ > for (j = 0; j < od->od_nslices; j++) { > - sprintf(line, " disk%ds%d", i, j + 1); > - if (bd_printslice(od, &dptr[j], line, verbose)) { > - done = 1; > - break; > - } > + snprintf(line, sizeof(line), " disk%ds%d", i, j + > 1); > + if ((ret = bd_printslice(od, &dptr[j], line, verbose)) > != 0) > + break; > } > } > bd_closedisk(od); > + if (ret != 0) > + break; > } > } > - pager_close(); > + return (ret); > } > > /* Given a size in 512 byte sectors, convert it to a human-readable > number. */ > > Modified: head/sys/boot/powerpc/kboot/hostdisk.c > ============================================================ > ================== > --- head/sys/boot/powerpc/kboot/hostdisk.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/powerpc/kboot/hostdisk.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -37,7 +37,7 @@ static int hostdisk_strategy(void *devda > static int hostdisk_open(struct open_file *f, ...); > static int hostdisk_close(struct open_file *f); > static int hostdisk_ioctl(struct open_file *f, u_long cmd, void *data); > -static void hostdisk_print(int verbose); > +static int hostdisk_print(int verbose); > > struct devsw hostdisk = { > "/dev", > @@ -117,9 +117,9 @@ hostdisk_ioctl(struct open_file *f, u_lo > return (EINVAL); > } > > -static void > +static int > hostdisk_print(int verbose) > { > - > + return (0); > } > > > Modified: head/sys/boot/powerpc/ps3/ps3cdrom.c > ============================================================ > ================== > --- head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -49,7 +49,7 @@ static int ps3cdrom_strategy(void *devda > size_t offset, size_t size, char *buf, size_t *rsize); > static int ps3cdrom_open(struct open_file *f, ...); > static int ps3cdrom_close(struct open_file *f); > -static void ps3cdrom_print(int verbose); > +static int ps3cdrom_print(int verbose); > > struct devsw ps3cdrom = { > "cd", > @@ -149,6 +149,7 @@ static int ps3cdrom_close(struct open_fi > return 0; > } > > -static void ps3cdrom_print(int verbose) > +static int ps3cdrom_print(int verbose) > { > + return (0); > } > > Modified: head/sys/boot/powerpc/ps3/ps3disk.c > ============================================================ > ================== > --- head/sys/boot/powerpc/ps3/ps3disk.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/powerpc/ps3/ps3disk.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -61,7 +61,7 @@ static int ps3disk_strategy(void *devdat > size_t offset, size_t size, char *buf, size_t *rsize); > static int ps3disk_open(struct open_file *f, ...); > static int ps3disk_close(struct open_file *f); > -static void ps3disk_print(int verbose); > +static int ps3disk_print(int verbose); > > struct devsw ps3disk = { > "disk", > @@ -186,8 +186,9 @@ static int ps3disk_close(struct open_fil > return 0; > } > > -static void ps3disk_print(int verbose) > +static int ps3disk_print(int verbose) > { > + return (0); > } > > static int ps3disk_open_gpt(struct ps3_devdesc *dev, struct open_dev *od) > > Modified: head/sys/boot/uboot/lib/disk.c > ============================================================ > ================== > --- head/sys/boot/uboot/lib/disk.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/uboot/lib/disk.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -78,7 +78,7 @@ static int stor_strategy(void *, int, da > static int stor_open(struct open_file *, ...); > static int stor_close(struct open_file *); > static int stor_ioctl(struct open_file *f, u_long cmd, void *data); > -static void stor_print(int); > +static int stor_print(int); > static void stor_cleanup(void); > > struct devsw uboot_storage = { > @@ -238,30 +238,31 @@ stor_readdev(struct disk_devdesc *dev, d > return (err); > } > > -static void > +static int > stor_print(int verbose) > { > struct disk_devdesc dev; > static char line[80]; > - int i; > + int i, ret = 0; > > - pager_open(); > for (i = 0; i < stor_info_no; i++) { > dev.d_dev = &uboot_storage; > dev.d_unit = i; > dev.d_slice = -1; > dev.d_partition = -1; > - sprintf(line, "\tdisk%d (%s)\n", i, > + snprintf(line, sizeof(line), "\tdisk%d (%s)\n", i, > ub_stor_type(SI(&dev).type)); > - if (pager_output(line)) > + if ((ret = pager_output(line)) != 0) > break; > if (stor_opendev(&dev) == 0) { > sprintf(line, "\tdisk%d", i); > - disk_print(&dev, line, verbose); > + ret = disk_print(&dev, line, verbose); > disk_close(&dev); > + if (ret != 0) > + break; > } > } > - pager_close(); > + return (ret); > } > > static int > > Modified: head/sys/boot/usb/storage/umass_loader.c > ============================================================ > ================== > --- head/sys/boot/usb/storage/umass_loader.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/usb/storage/umass_loader.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -50,7 +50,7 @@ static void umass_disk_cleanup(void); > static int umass_disk_ioctl(struct open_file *, u_long, void *); > static int umass_disk_strategy(void *, int, daddr_t, size_t, size_t, char > *, > size_t *); > -static void umass_disk_print(int); > +static int umass_disk_print(int); > > struct devsw umass_disk = { > .dv_name = "umass", > @@ -170,23 +170,26 @@ umass_disk_close(struct open_file *f) > return (disk_close(dev)); > } > > -static void > +static int > umass_disk_print(int verbose) > { > struct disk_devdesc dev; > > memset(&dev, 0, sizeof(dev)); > > - pager_output(" umass0 UMASS device\n"); > + ret = pager_output(" umass0 UMASS device\n"); > + if (ret != 0) > + return (ret); > dev.d_dev = &umass_disk; > dev.d_unit = 0; > dev.d_slice = -1; > dev.d_partition = -1; > > if (umass_disk_open_sub(&dev) == 0) { > - disk_print(&dev, " umass0", verbose); > + ret = disk_print(&dev, " umass0", verbose); > disk_close(&dev); > } > + return (ret); > } > > static void > > Modified: head/sys/boot/userboot/userboot/host.c > ============================================================ > ================== > --- head/sys/boot/userboot/userboot/host.c Tue Nov 8 06:13:22 2016 > (r308433) > +++ head/sys/boot/userboot/userboot/host.c Tue Nov 8 06:50:18 2016 > (r308434) > @@ -134,13 +134,13 @@ host_dev_init(void) > return (0); > } > > -static void > +static int > host_dev_print(int verbose) > { > char line[80]; > > - sprintf(line, " host%d: Host filesystem\n", 0); > - pager_output(line); > + snprintf(line, sizeof(line), " host%d: Host filesystem\n", 0); > + return (pager_output(line)); > } > > /* > > Modified: head/sys/boot/userboot/userboot/userboot_disk.c > ============================================================ > ================== > --- head/sys/boot/userboot/userboot/userboot_disk.c Tue Nov 8 > 06:13:22 2016 (r308433) > +++ head/sys/boot/userboot/userboot/userboot_disk.c Tue Nov 8 > 06:50:18 2016 (r308434) > @@ -60,7 +60,7 @@ static int userdisk_realstrategy(void *d > static int userdisk_open(struct open_file *f, ...); > static int userdisk_close(struct open_file *f); > static int userdisk_ioctl(struct open_file *f, u_long cmd, void > *data); > -static void userdisk_print(int verbose); > +static int userdisk_print(int verbose); > > struct devsw userboot_disk = { > "disk", > @@ -116,27 +116,33 @@ userdisk_cleanup(void) > /* > * Print information about disks > */ > -static void > +static int > userdisk_print(int verbose) > { > struct disk_devdesc dev; > char line[80]; > - int i; > + int i, ret = 0; > > for (i = 0; i < userdisk_maxunit; i++) { > - sprintf(line, " disk%d: Guest drive image\n", i); > - pager_output(line); > + snprintf(line, sizeof(line), > + " disk%d: Guest drive image\n", i); > + ret = pager_output(line); > + if (ret != 0) > + break; > dev.d_dev = &userboot_disk; > dev.d_unit = i; > dev.d_slice = -1; > dev.d_partition = -1; > if (disk_open(&dev, ud_info[i].mediasize, > ud_info[i].sectorsize, 0) == 0) { > - sprintf(line, " disk%d", i); > - disk_print(&dev, line, verbose); > + snprintf(line, sizeof(line), " disk%d", i); > + ret = disk_print(&dev, line, verbose); > disk_close(&dev); > + if (ret != 0) > + break; > } > } > + return (ret); > } > > /* > > Modified: head/sys/boot/zfs/zfs.c > ============================================================ > ================== > --- head/sys/boot/zfs/zfs.c Tue Nov 8 06:13:22 2016 (r308433) > +++ head/sys/boot/zfs/zfs.c Tue Nov 8 06:50:18 2016 (r308434) > @@ -514,20 +514,23 @@ zfs_probe_dev(const char *devname, uint6 > /* > * Print information about ZFS pools > */ > -static void > +static int > zfs_dev_print(int verbose) > { > spa_t *spa; > char line[80]; > + int ret = 0; > > if (verbose) { > - spa_all_status(); > - return; > + return (spa_all_status()); > } > STAILQ_FOREACH(spa, &zfs_pools, spa_link) { > - sprintf(line, " zfs:%s\n", spa->spa_name); > - pager_output(line); > + snprintf(line, sizeof(line), " zfs:%s\n", > spa->spa_name); > + ret = pager_output(line); > + if (ret != 0) > + break; > } > + return (ret); > } > > /* > > Modified: head/sys/boot/zfs/zfsimpl.c > ============================================================ > ================== > --- head/sys/boot/zfs/zfsimpl.c Tue Nov 8 06:13:22 2016 (r308433) > +++ head/sys/boot/zfs/zfsimpl.c Tue Nov 8 06:50:18 2016 (r308434) > @@ -780,7 +780,7 @@ state_name(vdev_state_t state) > > #else > > -static void > +static int > pager_printf(const char *fmt, ...) > { > char line[80]; > @@ -789,14 +789,14 @@ pager_printf(const char *fmt, ...) > va_start(args, fmt); > vsprintf(line, fmt, args); > va_end(args); > - pager_output(line); > + return (pager_output(line)); > } > > #endif > > #define STATUS_FORMAT " %s %s\n" > > -static void > +static int > print_state(int indent, const char *name, vdev_state_t state) > { > int i; > @@ -806,40 +806,56 @@ print_state(int indent, const char *name > for (i = 0; i < indent; i++) > strcat(buf, " "); > strcat(buf, name); > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-all@freebsd.org Thu Nov 10 22:28:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAF45C3BA29; Thu, 10 Nov 2016 22:28:58 +0000 (UTC) (envelope-from tsoome@me.com) Received: from st13p35im-asmtp001.me.com (st13p35im-asmtp001.me.com [17.164.199.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 536AA83; Thu, 10 Nov 2016 22:28:58 +0000 (UTC) (envelope-from tsoome@me.com) Received: from process-dkim-sign-daemon.st13p35im-asmtp001.me.com by st13p35im-asmtp001.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OGG00O006CTL900@st13p35im-asmtp001.me.com>; Thu, 10 Nov 2016 22:28:51 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=4d515a; t=1478816931; bh=cmFYWe5j02ZrA0gBdWSuKXm3da40IHZbTaNmY8jg9uY=; h=From:Message-id:Content-type:MIME-version:Subject:Date:To; b=hjLF5kfAbNT+HFODgdjdPmnBxlVjG/swasE7Lt2auoAXJXR0nKsSO6JNrmvOCfhMd ER1C6oM8Xe2LOCwC+hdFfhHLdotxrxUvGAH7tl+53CH90f1UC6buHuf6YfjdrVIEmG ieSrfIN5gCYyjoDcuAr69OUplhyF9MOOMSevJYtf66D1Pu10e3doe4C/nAoGBt+a8X fhkVVp+/m4a4FEhV+7qQz89JPJZzOX5+UtSiOHEcd9BFYHULbVFDB4OFkzz4lkFjag +xwNSQrFKze1W757BYtlh/233f7Q+97PuwHbKIVrmOhVVWmX0xaKcN00x2pYdkx3bx GTllzPl4BRHiA== Received: from nazgul.lan (220-90-235-80.dyn.estpak.ee [80.235.90.220]) by st13p35im-asmtp001.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OGG00E7G6FYXT50@st13p35im-asmtp001.me.com>; Thu, 10 Nov 2016 22:28:50 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-10_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=27 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1611100381 From: Toomas Soome Message-id: <8E0E5C94-EFD7-4008-B563-FF080A98F23D@me.com> MIME-version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r308434 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sys... Date: Fri, 11 Nov 2016 00:28:46 +0200 In-reply-to: Cc: Toomas Soome , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Kamil Czekirda References: <201611080650.uA86oJ7W056026@repo.freebsd.org> X-Mailer: Apple Mail (2.3251) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 22:28:58 -0000 the patch does update the lib/libstand/stand.h to have: struct devsw { . . .=20 int (*dv_print)(int verbose); it was void before; from your svnlite log I can see the = lib/libstand/stand.h is updated, could you confirm if it is int now? if = it is, I suspect the build is getting the old stand.h from somewhere in = the tree and not your /lib/libstand. if so, does the build has target to copy headers in place? I=E2=80=99m = sorry, I don't know all the tricks the build system does as part of the = buildworld.. rgds, toomas > On 11. nov 2016, at 0:21, Kamil Czekirda wrote: >=20 > Hi, >=20 > I got the following: >=20 > root@current:/usr/src # svnlite up -r r308434 > Updating '.': > U lib/libstand/stand.h > U sys/boot/common/dev_net.c > U sys/boot/common/module.c > U sys/boot/common/part.c > U sys/boot/common/util.c > U sys/boot/common/util.h > U sys/boot/efi/libefi/efinet.c > U sys/boot/efi/libefi/efipart.c > U sys/boot/efi/loader/main.c > U sys/boot/i386/libfirewire/firewire.c > U sys/boot/i386/libi386/bioscd.c > U sys/boot/i386/libi386/biosdisk.c > U sys/boot/mips/beri/loader/beri_disk_cfi.c > U sys/boot/mips/beri/loader/beri_disk_sdcard.c > U sys/boot/ofw/libofw/ofw_disk.c > U sys/boot/pc98/libpc98/bioscd.c > U sys/boot/pc98/libpc98/biosdisk.c > U sys/boot/powerpc/kboot/hostdisk.c > U sys/boot/powerpc/ps3/ps3cdrom.c > U sys/boot/powerpc/ps3/ps3disk.c > U sys/boot/uboot/lib/disk.c > U sys/boot/usb/storage/umass_loader.c > U sys/boot/userboot/userboot/host.c > U sys/boot/userboot/userboot/userboot_disk.c > U sys/boot/zfs/zfs.c > U sys/boot/zfs/zfsimpl.c > U sys/boot/i386/libi386/pxe.c > Updated to revision 308434. > root@current:/usr/src # cd sys/boot/ > root@current:/usr/src/sys/boot # make clean > (...) > root@current:/usr/src/sys/boot # make obj > (...) > root@current:/usr/src/sys/boot # make > (...) > cc -O2 -pipe -DSKEIN_LOOP=3D111 -fPIC = -I/usr/src/sys/boot/efi/loader -I/usr/src/sys/boot/efi/loader/arch/amd64 = -I/usr/src/sys/boot/efi/loader/../include = -I/usr/src/sys/boot/efi/loader/../include/amd64 = -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include = -I/usr/src/sys/boot/efi/loader/../../.. = -I/usr/src/sys/boot/efi/loader/../../i386/libi386 = -I/usr/src/sys/boot/efi/loader/../../zfs = -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs = -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT = -DNO_PCI -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH = -I/usr/src/sys/boot/efi/loader/../../ficl = -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 -DLOADER_DISK_SUPPORT = -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC -I/usr/src/sys/boot/ficl = -I/usr/src/sys/boot/ficl/amd64 -I/usr/src/sys/boot/ficl/../common = -I/usr/src/sys/boot/efi/loader/../../common -ffreestanding -Wformat = -msoft-float -mno-mmx -mno-sse -mno-avx -fshort-wchar -mno-red-zone = -mno-aes -g -MD -MF.depend.vers.o -MTvers.o -std=3Dgnu99 = -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter = -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith = -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body = -Wno-string-plus-int -Wno-unused-const-variable = -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality = -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef = -Qunused-arguments -c vers.c -o vers.o > cc -O2 -pipe -DSKEIN_LOOP=3D111 -fPIC = -I/usr/src/sys/boot/efi/loader -I/usr/src/sys/boot/efi/loader/arch/amd64 = -I/usr/src/sys/boot/efi/loader/../include = -I/usr/src/sys/boot/efi/loader/../include/amd64 = -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include = -I/usr/src/sys/boot/efi/loader/../../.. = -I/usr/src/sys/boot/efi/loader/../../i386/libi386 = -I/usr/src/sys/boot/efi/loader/../../zfs = -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs = -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT = -DNO_PCI -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH = -I/usr/src/sys/boot/efi/loader/../../ficl = -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 -DLOADER_DISK_SUPPORT = -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC -I/usr/src/sys/boot/ficl = -I/usr/src/sys/boot/ficl/amd64 -I/usr/src/sys/boot/ficl/../common = -I/usr/src/sys/boot/efi/loader/../../common -ffreestanding -Wformat = -msoft-float -mno-mmx -mno-sse -mno-avx -fshort-wchar -mno-red-zone = -mno-aes -g -MD -MF.depend.zfs.o -MTzfs.o -std=3Dgnu99 -Wsystem-headers = -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter = -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith = -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body = -Wno-string-plus-int -Wno-unused-const-variable = -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality = -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef = -Wno-sign-compare -Wno-array-bounds -Wno-missing-prototypes = -Qunused-arguments -c /usr/src/sys/boot/efi/loader/../../zfs/zfs.c -o = zfs.o > /usr/src/sys/boot/efi/loader/../../zfs/zfs.c:599:14: error: = incompatible pointer types initializing 'void (*)(int)' with an = expression of type 'int (int)' [-Werror,-Wincompatible-pointer-types] > .dv_print =3D zfs_dev_print, > ^~~~~~~~~~~~~ > 1 error generated. > *** Error code 1 >=20 > Stop. > make[2]: stopped in /usr/src/sys/boot/efi/loader > *** Error code 1 >=20 > Stop. > make[1]: stopped in /usr/src/sys/boot/efi > *** Error code 1 >=20 > Stop. > make: stopped in /usr/src/sys/boot >=20 >=20 > Kamil >=20 > 2016-11-08 7:50 GMT+01:00 Toomas Soome >: > Author: tsoome > Date: Tue Nov 8 06:50:18 2016 > New Revision: 308434 > URL: https://svnweb.freebsd.org/changeset/base/308434 = >=20 > Log: > Loader paged/pageable data is not always paged. >=20 > This change does modify devsw dv_print() to return the int value, > enabling walkers to interrupt the walk on non zero value from = dv_print(). >=20 > This will allow the pager_print actually to stop displaying data on > user input, and additionally pager is used in various *dev_print = callbacks, > where it was missing. >=20 > For test, lsdev [-v] command should display data by screenfuls and = should > stop when the key 'q' is pressed on pager prompt. >=20 > Reviewed by: allanjude > Approved by: allanjude (mentor) > Differential Revision: https://reviews.freebsd.org/D5461 = >=20 > Modified: > head/lib/libstand/stand.h > head/sys/boot/common/dev_net.c > head/sys/boot/common/module.c > head/sys/boot/common/part.c > head/sys/boot/common/util.c > head/sys/boot/common/util.h > head/sys/boot/efi/libefi/efinet.c > head/sys/boot/efi/libefi/efipart.c > head/sys/boot/efi/loader/main.c > head/sys/boot/i386/libfirewire/firewire.c > head/sys/boot/i386/libi386/bioscd.c > head/sys/boot/i386/libi386/biosdisk.c > head/sys/boot/i386/libi386/pxe.c > head/sys/boot/mips/beri/loader/beri_disk_cfi.c > head/sys/boot/mips/beri/loader/beri_disk_sdcard.c > head/sys/boot/ofw/libofw/ofw_disk.c > head/sys/boot/pc98/libpc98/bioscd.c > head/sys/boot/pc98/libpc98/biosdisk.c > head/sys/boot/powerpc/kboot/hostdisk.c > head/sys/boot/powerpc/ps3/ps3cdrom.c > head/sys/boot/powerpc/ps3/ps3disk.c > head/sys/boot/uboot/lib/disk.c > head/sys/boot/usb/storage/umass_loader.c > head/sys/boot/userboot/userboot/host.c > head/sys/boot/userboot/userboot/userboot_disk.c > head/sys/boot/zfs/zfs.c > head/sys/boot/zfs/zfsimpl.c >=20 > Modified: head/lib/libstand/stand.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/lib/libstand/stand.h Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/lib/libstand/stand.h Tue Nov 8 06:50:18 2016 = (r308434) > @@ -143,7 +143,7 @@ struct devsw { > int (*dv_open)(struct open_file *f, ...); > int (*dv_close)(struct open_file *f); > int (*dv_ioctl)(struct open_file *f, u_long cmd, = void *data); > - void (*dv_print)(int verbose); /* print device = information */ > + int (*dv_print)(int verbose); /* print = device information */ > void (*dv_cleanup)(void); > }; >=20 >=20 > Modified: head/sys/boot/common/dev_net.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/common/dev_net.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/common/dev_net.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -80,7 +80,7 @@ static int net_open(struct open_file *, > static int net_close(struct open_file *); > static void net_cleanup(void); > static int net_strategy(); > -static void net_print(int); > +static int net_print(int); >=20 > static int net_getparams(int sock); >=20 > @@ -325,23 +325,27 @@ exit: > return (0); > } >=20 > -static void > +static int > net_print(int verbose) > { > struct netif_driver *drv; > int i, d, cnt; > + int ret =3D 0; >=20 > cnt =3D 0; > for (d =3D 0; netif_drivers[d]; d++) { > drv =3D netif_drivers[d]; > for (i =3D 0; i < drv->netif_nifs; i++) { > printf("\t%s%d:", "net", cnt++); > - if (verbose) > + if (verbose) { > printf(" (%s%d)", drv->netif_bname, > drv->netif_ifs[i].dif_unit); > + } > + if ((ret =3D pager_output("\n")) !=3D 0) > + return (ret); > } > } > - printf("\n"); > + return (ret); > } >=20 > /* >=20 > Modified: head/sys/boot/common/module.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/common/module.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/common/module.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -254,7 +254,7 @@ command_lsmod(int argc, char *argv[]) > struct kernel_module *mp; > struct file_metadata *md; > char lbuf[80]; > - int ch, verbose; > + int ch, verbose, ret =3D 0; >=20 > verbose =3D 0; > optind =3D 1; > @@ -273,11 +273,13 @@ command_lsmod(int argc, char *argv[]) >=20 > pager_open(); > for (fp =3D preloaded_files; fp; fp =3D fp->f_next) { > - sprintf(lbuf, " %p: ", (void *) fp->f_addr); > + snprintf(lbuf, sizeof(lbuf), " %p: ", (void *) fp->f_addr); > pager_output(lbuf); > pager_output(fp->f_name); > - sprintf(lbuf, " (%s, 0x%lx)\n", fp->f_type, (long)fp->f_size); > - pager_output(lbuf); > + snprintf(lbuf, sizeof(lbuf), " (%s, 0x%lx)\n", fp->f_type, > + (long)fp->f_size); > + if (pager_output(lbuf)) > + break; > if (fp->f_args !=3D NULL) { > pager_output(" args: "); > pager_output(fp->f_args); > @@ -287,7 +289,8 @@ command_lsmod(int argc, char *argv[]) > if (fp->f_modules) { > pager_output(" modules: "); > for (mp =3D fp->f_modules; mp; mp =3D mp->m_next) { > - sprintf(lbuf, "%s.%d ", mp->m_name, mp->m_version); > + snprintf(lbuf, sizeof(lbuf), "%s.%d ", mp->m_name, > + mp->m_version); > pager_output(lbuf); > } > if (pager_output("\n")) > @@ -296,11 +299,14 @@ command_lsmod(int argc, char *argv[]) > if (verbose) { > /* XXX could add some formatting smarts here to display = some better */ > for (md =3D fp->f_metadata; md !=3D NULL; md =3D = md->md_next) { > - sprintf(lbuf, " 0x%04x, 0x%lx\n", md->md_type, = (long) md->md_size); > + snprintf(lbuf, sizeof(lbuf), " 0x%04x, 0x%lx\n", > + md->md_type, (long) md->md_size); > if (pager_output(lbuf)) > break; > } > } > + if (ret) > + break; > } > pager_close(); > return(CMD_OK); >=20 > Modified: head/sys/boot/common/part.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/common/part.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/common/part.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -834,6 +834,7 @@ ptable_iterate(const struct ptable *tabl > { > struct pentry *entry; > char name[32]; > + int ret =3D 0; >=20 > name[0] =3D '\0'; > STAILQ_FOREACH(entry, &table->entries, entry) { > @@ -856,9 +857,8 @@ ptable_iterate(const struct ptable *tabl > if (table->type =3D=3D PTABLE_BSD) > sprintf(name, "%c", (u_char) 'a' + > entry->part.index); > - if (iter(arg, name, &entry->part)) > - return 1; > + if ((ret =3D iter(arg, name, &entry->part)) !=3D 0) > + return (ret); > } > - return 0; > + return (ret); > } > - >=20 > Modified: head/sys/boot/common/util.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/common/util.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/common/util.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -114,7 +114,7 @@ strlen(const char *s) > return (len); > } >=20 > -void > +int > printf(const char *fmt, ...) > { > va_list ap; > @@ -178,4 +178,5 @@ nextfmt: > } > } > va_end(ap); > + return (0); > } >=20 > Modified: head/sys/boot/common/util.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/common/util.h Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/common/util.h Tue Nov 8 06:50:18 2016 = (r308434) > @@ -48,6 +48,6 @@ void strcat(char *dst, const char *src); > char *strchr(const char *s, char ch); > size_t strlen(const char *s); >=20 > -void printf(const char *fmt, ...); > +int printf(const char *fmt, ...); >=20 > #endif /* !_UTIL_H_ */ >=20 > Modified: head/sys/boot/efi/libefi/efinet.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/efi/libefi/efinet.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/efi/libefi/efinet.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -252,7 +252,7 @@ efinet_end(struct netif *nif) > } >=20 > static int efinet_dev_init(void); > -static void efinet_dev_print(int); > +static int efinet_dev_print(int); >=20 > struct devsw efinet_dev =3D { > .dv_name =3D "net", > @@ -346,14 +346,13 @@ efinet_dev_init() > return (0); > } >=20 > -static void > +static int > efinet_dev_print(int verbose) > { > CHAR16 *text; > EFI_HANDLE h; > - int unit; > + int unit, ret =3D 0; >=20 > - pager_open(); > for (unit =3D 0, h =3D efi_find_handle(&efinet_dev, 0); > h !=3D NULL; h =3D efi_find_handle(&efinet_dev, ++unit)) { > printf(" %s%d:", efinet_dev.dv_name, unit); > @@ -364,8 +363,8 @@ efinet_dev_print(int verbose) > efi_free_devpath_name(text); > } > } > - if (pager_output("\n")) > + if ((ret =3D pager_output("\n")) !=3D 0) > break; > } > - pager_close(); > + return (ret); > } >=20 > Modified: head/sys/boot/efi/libefi/efipart.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/efi/libefi/efipart.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/efi/libefi/efipart.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -47,7 +47,7 @@ static int efipart_realstrategy(void *, > size_t *); > static int efipart_open(struct open_file *, ...); > static int efipart_close(struct open_file *); > -static void efipart_print(int); > +static int efipart_print(int); >=20 > struct devsw efipart_dev =3D { > .dv_name =3D "part", > @@ -162,7 +162,7 @@ efipart_init(void) > return (err); > } >=20 > -static void > +static int > efipart_print(int verbose) > { > char line[80]; > @@ -170,28 +170,29 @@ efipart_print(int verbose) > EFI_HANDLE h; > EFI_STATUS status; > u_int unit; > + int ret =3D 0; >=20 > - pager_open(); > for (unit =3D 0, h =3D efi_find_handle(&efipart_dev, 0); > h !=3D NULL; h =3D efi_find_handle(&efipart_dev, ++unit)) = { > - sprintf(line, " %s%d:", efipart_dev.dv_name, unit); > - if (pager_output(line)) > + snprintf(line, sizeof(line), " %s%d:", > + efipart_dev.dv_name, unit); > + if ((ret =3D pager_output(line)) !=3D 0) > break; >=20 > status =3D BS->HandleProtocol(h, &blkio_guid, (void = **)&blkio); > if (!EFI_ERROR(status)) { > - sprintf(line, " %llu blocks", > + snprintf(line, sizeof(line), " %llu = blocks", > (unsigned long = long)(blkio->Media->LastBlock + 1)); > - if (pager_output(line)) > + if ((ret =3D pager_output(line)) !=3D 0) > break; > if (blkio->Media->RemovableMedia) > - if (pager_output(" (removable)")) > + if ((ret =3D pager_output(" = (removable)")) !=3D 0) > break; > } > - if (pager_output("\n")) > + if ((ret =3D pager_output("\n")) !=3D 0) > break; > } > - pager_close(); > + return (ret); > } >=20 > static int >=20 > Modified: head/sys/boot/efi/loader/main.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/efi/loader/main.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/efi/loader/main.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -533,6 +533,7 @@ command_memmap(int argc, char *argv[]) > UINT32 dver; > EFI_STATUS status; > int i, ndesc; > + char line[80]; > static char *types[] =3D { > "Reserved", > "LoaderCode", > @@ -564,14 +565,19 @@ command_memmap(int argc, char *argv[]) > } >=20 > ndesc =3D sz / dsz; > - printf("%23s %12s %12s %8s %4s\n", > + snprintf(line, sizeof(line), "%23s %12s %12s %8s %4s\n", > "Type", "Physical", "Virtual", "#Pages", "Attr"); > + pager_open(); > + if (pager_output(line)) { > + pager_close(); > + return (CMD_OK); > + } >=20 > for (i =3D 0, p =3D map; i < ndesc; > i++, p =3D NextMemoryDescriptor(p, dsz)) { > printf("%23s %012jx %012jx %08jx ", types[p->Type], > - (uintmax_t)p->PhysicalStart, = (uintmax_t)p->VirtualStart, > - (uintmax_t)p->NumberOfPages); > + (uintmax_t)p->PhysicalStart, = (uintmax_t)p->VirtualStart, > + (uintmax_t)p->NumberOfPages); > if (p->Attribute & EFI_MEMORY_UC) > printf("UC "); > if (p->Attribute & EFI_MEMORY_WC) > @@ -588,9 +594,11 @@ command_memmap(int argc, char *argv[]) > printf("RP "); > if (p->Attribute & EFI_MEMORY_XP) > printf("XP "); > - printf("\n"); > + if (pager_output("\n")) > + break; > } >=20 > + pager_close(); > return (CMD_OK); > } >=20 > @@ -612,10 +620,17 @@ guid_to_string(EFI_GUID *guid) > static int > command_configuration(int argc, char *argv[]) > { > + char line[80]; > UINTN i; >=20 > - printf("NumberOfTableEntries=3D%lu\n", > + snprintf(line, sizeof(line), "NumberOfTableEntries=3D%lu\n", > (unsigned long)ST->NumberOfTableEntries); > + pager_open(); > + if (pager_output(line)) { > + pager_close(); > + return (CMD_OK); > + } > + > for (i =3D 0; i < ST->NumberOfTableEntries; i++) { > EFI_GUID *guid; >=20 > @@ -642,9 +657,13 @@ command_configuration(int argc, char *ar > printf("FDT Table"); > else > printf("Unknown Table (%s)", = guid_to_string(guid)); > - printf(" at %p\n", = ST->ConfigurationTable[i].VendorTable); > + snprintf(line, sizeof(line), " at %p\n", > + ST->ConfigurationTable[i].VendorTable); > + if (pager_output(line)) > + break; > } >=20 > + pager_close(); > return (CMD_OK); > } >=20 >=20 > Modified: head/sys/boot/i386/libfirewire/firewire.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/i386/libfirewire/firewire.c Tue Nov 8 06:13:22 = 2016 (r308433) > +++ head/sys/boot/i386/libfirewire/firewire.c Tue Nov 8 06:50:18 = 2016 (r308434) > @@ -69,7 +69,7 @@ static int fw_strategy(void *devdata, in > size_t offset, size_t size, char *buf, size_t = *rsize); > static int fw_open(struct open_file *f, ...); > static int fw_close(struct open_file *f); > -static void fw_print(int verbose); > +static int fw_print(int verbose); > static void fw_cleanup(void); >=20 > void fw_enable(void); > @@ -148,21 +148,26 @@ fw_init(void) > /* > * Print information about OHCI chips > */ > -static void > +static int > fw_print(int verbose) > { > - int i; > + char line[80]; > + int i, ret =3D 0; > struct fwohci_softc *sc; >=20 > for (i =3D 0; i < MAX_OHCI; i ++) { > sc =3D &fwinfo[i]; > if (sc->state =3D=3D FWOHCI_STATE_DEAD) > break; > - printf("%d: locator=3D0x%04x devid=3D0x%08x" > + snprintf(line, sizeof(line), "%d: locator=3D0x%04x = devid=3D0x%08x" > " base_addr=3D0x%08x handle=3D0x%08x = bus_id=3D0x%08x\n", > i, sc->locator, sc->devid, > sc->base_addr, sc->handle, sc->bus_id); > + ret =3D pager_output(line); > + if (ret !=3D 0) > + break; > } > + return (ret); > } >=20 > static int >=20 > Modified: head/sys/boot/i386/libi386/bioscd.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/i386/libi386/bioscd.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/i386/libi386/bioscd.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -100,7 +100,7 @@ static int bc_realstrategy(void *devdata > size_t offset, size_t size, char *buf, size_t *rsize); > static int bc_open(struct open_file *f, ...); > static int bc_close(struct open_file *f); > -static void bc_print(int verbose); > +static int bc_print(int verbose); >=20 > struct devsw bioscd =3D { > "cd", > @@ -177,20 +177,19 @@ bc_add(int biosdev) > /* > * Print information about disks > */ > -static void > +static int > bc_print(int verbose) > { > char line[80]; > - int i; > + int i, ret =3D 0; >=20 > - pager_open(); > for (i =3D 0; i < nbcinfo; i++) { > - sprintf(line, " cd%d: Device 0x%x\n", i, > + snprintf(line, sizeof(line), " cd%d: Device = 0x%x\n", i, > bcinfo[i].bc_sp.sp_devicespec); > - if (pager_output(line)) > + if ((ret =3D pager_output(line)) !=3D 0) > break; > } > - pager_close(); > + return (ret); > } >=20 > /* >=20 > Modified: head/sys/boot/i386/libi386/biosdisk.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/i386/libi386/biosdisk.c Tue Nov 8 06:13:22 = 2016 (r308433) > +++ head/sys/boot/i386/libi386/biosdisk.c Tue Nov 8 06:50:18 = 2016 (r308434) > @@ -135,7 +135,7 @@ static int bd_realstrategy(void *devdata > static int bd_open(struct open_file *f, ...); > static int bd_close(struct open_file *f); > static int bd_ioctl(struct open_file *f, u_long cmd, void *data); > -static void bd_print(int verbose); > +static int bd_print(int verbose); > static void bd_cleanup(void); >=20 > #ifdef LOADER_GELI_SUPPORT > @@ -321,21 +321,21 @@ bd_int13probe(struct bdinfo *bd) > /* > * Print information about disks > */ > -static void > +static int > bd_print(int verbose) > { > static char line[80]; > struct disk_devdesc dev; > - int i; > + int i, ret =3D 0; >=20 > - pager_open(); > for (i =3D 0; i < nbdinfo; i++) { > - sprintf(line, " disk%d: BIOS drive %c (%ju X = %u):\n", i, > + snprintf(line, sizeof(line), > + " disk%d: BIOS drive %c (%ju X %u):\n", i, > (bdinfo[i].bd_unit < 0x80) ? ('A' + = bdinfo[i].bd_unit): > ('C' + bdinfo[i].bd_unit - 0x80), > (uintmax_t)bdinfo[i].bd_sectors, > bdinfo[i].bd_sectorsize); > - if (pager_output(line)) > + if ((ret =3D pager_output(line)) !=3D 0) > break; > dev.d_dev =3D &biosdisk; > dev.d_unit =3D i; > @@ -346,12 +346,14 @@ bd_print(int verbose) > bdinfo[i].bd_sectorsize, > (bdinfo[i].bd_flags & BD_FLOPPY) ? > DISK_F_NOCACHE: 0) =3D=3D 0) { > - sprintf(line, " disk%d", i); > - disk_print(&dev, line, verbose); > + snprintf(line, sizeof(line), " disk%d", i); > + ret =3D disk_print(&dev, line, verbose); > disk_close(&dev); > + if (ret !=3D 0) > + return (ret); > } > } > - pager_close(); > + return (ret); > } >=20 > /* >=20 > Modified: head/sys/boot/i386/libi386/pxe.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/i386/libi386/pxe.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/i386/libi386/pxe.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -75,7 +75,7 @@ static int pxe_strategy(void *devdata, i > size_t offset, size_t size, char *buf, = size_t *rsize); > static int pxe_open(struct open_file *f, ...); > static int pxe_close(struct open_file *f); > -static void pxe_print(int verbose); > +static int pxe_print(int verbose); > static void pxe_cleanup(void); > static void pxe_setnfshandle(char *rootpath); >=20 > @@ -381,14 +381,20 @@ pxe_close(struct open_file *f) > return (0); > } >=20 > -static void > +static int > pxe_print(int verbose) > { > - > + char line[255]; > if (pxe_call =3D=3D NULL) > - return; > + return (0); >=20 > - printf(" pxe0: %s:%s\n", inet_ntoa(rootip), rootpath); > + if (verbose) { > + snprintf(line, sizeof(line), " pxe0: %s:%s\n", > + inet_ntoa(rootip), rootpath); > + } else { > + snprintf(line, sizeof(line), " pxe0:\n"); > + } > + return (pager_output(line)); > } >=20 > static void >=20 > Modified: head/sys/boot/mips/beri/loader/beri_disk_cfi.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Nov 8 = 06:13:22 2016 (r308433) > +++ head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Nov 8 = 06:50:18 2016 (r308434) > @@ -47,7 +47,7 @@ static int beri_cfi_disk_close(struct op > static void beri_cfi_disk_cleanup(void); > static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t, = size_t, > char *, size_t *); > -static void beri_cfi_disk_print(int); > +static int beri_cfi_disk_print(int); >=20 > struct devsw beri_cfi_disk =3D { > .dv_name =3D "cfi", > @@ -112,25 +112,29 @@ beri_cfi_disk_close(struct open_file *f) > return (disk_close(dev)); > } >=20 > -static void > +static int > beri_cfi_disk_print(int verbose) > { > struct disk_devdesc dev; > char line[80]; > + int ret; >=20 > - sprintf(line, " cfi%d CFI flash device\n", 0); > - pager_output(line); > + snprintf(line, sizeof(line), " cfi%d CFI flash device\n", = 0); > + ret =3D pager_output(line); > + if (ret !=3D 0) > + return (ret); > dev.d_dev =3D &beri_cfi_disk; > dev.d_unit =3D 0; > dev.d_slice =3D -1; > dev.d_partition =3D -1; > if (disk_open(&dev, cfi_get_mediasize(), > cfi_get_sectorsize(), 0) =3D=3D 0) { > - sprintf(line, " cfi%d", 0); > - disk_print(&dev, line, verbose); > + snprintf(line, sizeof(line), " cfi%d", 0); > + ret =3D disk_print(&dev, line, verbose); > disk_close(&dev); > } >=20 > + return (ret); > } >=20 > static void >=20 > Modified: head/sys/boot/mips/beri/loader/beri_disk_sdcard.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Nov 8 = 06:13:22 2016 (r308433) > +++ head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Nov 8 = 06:50:18 2016 (r308434) > @@ -47,7 +47,7 @@ static int beri_sdcard_disk_close(struct > static void beri_sdcard_disk_cleanup(void); > static int beri_sdcard_disk_strategy(void *, int, daddr_t, = size_t, size_t, > char *, size_t *); > -static void beri_sdcard_disk_print(int); > +static int beri_sdcard_disk_print(int); >=20 > struct devsw beri_sdcard_disk =3D { > .dv_name =3D "sdcard", > @@ -123,19 +123,23 @@ beri_sdcard_disk_print(int verbose) > { > struct disk_devdesc dev; > char line[80]; > + int ret; >=20 > - sprintf(line, " sdcard%d Altera SD card drive\n", 0); > - pager_output(line); > + snprintf(line, sizeof(line), " sdcard%d Altera SD card = drive\n", 0); > + ret =3D pager_output(line); > + if (ret !=3D 0) > + return (ret); > dev.d_dev =3D &beri_sdcard_disk; > dev.d_unit =3D 0; > dev.d_slice =3D -1; > dev.d_partition =3D -1; > if (disk_open(&dev, altera_sdcard_get_mediasize(), > altera_sdcard_get_sectorsize(), 0) =3D=3D 0) { > - sprintf(line, " sdcard%d", 0); > - disk_print(&dev, line, verbose); > + snprintf(line, sizeof(line), " sdcard%d", 0); > + ret =3D disk_print(&dev, line, verbose); > disk_close(&dev); > } > + return (ret); > } >=20 > static void >=20 > Modified: head/sys/boot/ofw/libofw/ofw_disk.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/ofw/libofw/ofw_disk.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/ofw/libofw/ofw_disk.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -47,7 +47,7 @@ static int ofwd_strategy(void *devdata, > static int ofwd_open(struct open_file *f, ...); > static int ofwd_close(struct open_file *f); > static int ofwd_ioctl(struct open_file *f, u_long cmd, void = *data); > -static void ofwd_print(int verbose); > +static int ofwd_print(int verbose); >=20 > struct devsw ofwdisk =3D { > "block", > @@ -161,8 +161,8 @@ ofwd_ioctl(struct open_file *f __unused, > return (EINVAL); > } >=20 > -static void > +static int > ofwd_print(int verbose __unused) > { > - > + return (0); > } >=20 > Modified: head/sys/boot/pc98/libpc98/bioscd.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/pc98/libpc98/bioscd.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/pc98/libpc98/bioscd.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -99,7 +99,7 @@ static int bc_realstrategy(void *devdata > size_t offset, size_t size, char *buf, size_t = *rsize); > static int bc_open(struct open_file *f, ...); > static int bc_close(struct open_file *f); > -static void bc_print(int verbose); > +static int bc_print(int verbose); >=20 > struct devsw bioscd =3D { > "cd", > @@ -173,20 +173,19 @@ bc_add(int biosdev) > /* > * Print information about disks > */ > -static void > +static int > bc_print(int verbose) > { > char line[80]; > - int i; > + int i, ret =3D 0; >=20 > - pager_open(); > for (i =3D 0; i < nbcinfo; i++) { > sprintf(line, " cd%d: Device 0x%x\n", i, > bcinfo[i].bc_sp.sp_devicespec); > - if (pager_output(line)) > + if ((ret =3D pager_output(line)) !=3D 0) > break; > } > - pager_close(); > + return (ret); > } >=20 > /* >=20 > Modified: head/sys/boot/pc98/libpc98/biosdisk.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/pc98/libpc98/biosdisk.c Tue Nov 8 06:13:22 = 2016 (r308433) > +++ head/sys/boot/pc98/libpc98/biosdisk.c Tue Nov 8 06:50:18 = 2016 (r308434) > @@ -123,7 +123,7 @@ static int bd_realstrategy(void *devdata > size_t offset, size_t size, char *buf, size_t = *rsize); > static int bd_open(struct open_file *f, ...); > static int bd_close(struct open_file *f); > -static void bd_print(int verbose); > +static int bd_print(int verbose); >=20 > struct devsw biosdisk =3D { > "disk", > @@ -249,21 +249,20 @@ bd_int13probe(struct bdinfo *bd) > /* > * Print information about disks > */ > -static void > +static int > bd_print(int verbose) > { > - int i, j, done; > + int i, j, ret =3D 0; > char line[80]; > struct i386_devdesc dev; > struct open_disk *od; > struct pc98_partition *dptr; >=20 > - pager_open(); > - done =3D 0; > - for (i =3D 0; i < nbdinfo && !done; i++) { > - sprintf(line, " disk%d: BIOS drive %c:\n", i, 'A' + i); > - if (pager_output(line)) > - break; > + for (i =3D 0; i < nbdinfo; i++) { > + snprintf(line, sizeof(line), " disk%d: BIOS drive %c:\n", > + i, 'A' + i); > + if ((ret =3D pager_output(line)) !=3D 0) > + break; >=20 > /* try to open the whole disk */ > dev.d_unit =3D i; > @@ -278,17 +277,17 @@ bd_print(int verbose) >=20 > /* Check for a "dedicated" disk */ > for (j =3D 0; j < od->od_nslices; j++) { > - sprintf(line, " disk%ds%d", i, j + 1); > - if (bd_printslice(od, &dptr[j], line, verbose)) { > - done =3D 1; > - break; > - } > + snprintf(line, sizeof(line), " disk%ds%d", i, = j + 1); > + if ((ret =3D bd_printslice(od, &dptr[j], line, = verbose)) !=3D 0) > + break; > } > } > bd_closedisk(od); > + if (ret !=3D 0) > + break; > } > } > - pager_close(); > + return (ret); > } >=20 > /* Given a size in 512 byte sectors, convert it to a human-readable = number. */ >=20 > Modified: head/sys/boot/powerpc/kboot/hostdisk.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/powerpc/kboot/hostdisk.c Tue Nov 8 06:13:22 = 2016 (r308433) > +++ head/sys/boot/powerpc/kboot/hostdisk.c Tue Nov 8 06:50:18 = 2016 (r308434) > @@ -37,7 +37,7 @@ static int hostdisk_strategy(void *devda > static int hostdisk_open(struct open_file *f, ...); > static int hostdisk_close(struct open_file *f); > static int hostdisk_ioctl(struct open_file *f, u_long cmd, void = *data); > -static void hostdisk_print(int verbose); > +static int hostdisk_print(int verbose); >=20 > struct devsw hostdisk =3D { > "/dev", > @@ -117,9 +117,9 @@ hostdisk_ioctl(struct open_file *f, u_lo > return (EINVAL); > } >=20 > -static void > +static int > hostdisk_print(int verbose) > { > - > + return (0); > } >=20 >=20 > Modified: head/sys/boot/powerpc/ps3/ps3cdrom.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Nov 8 06:13:22 = 2016 (r308433) > +++ head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Nov 8 06:50:18 = 2016 (r308434) > @@ -49,7 +49,7 @@ static int ps3cdrom_strategy(void *devda > size_t offset, size_t size, char *buf, size_t *rsize); > static int ps3cdrom_open(struct open_file *f, ...); > static int ps3cdrom_close(struct open_file *f); > -static void ps3cdrom_print(int verbose); > +static int ps3cdrom_print(int verbose); >=20 > struct devsw ps3cdrom =3D { > "cd", > @@ -149,6 +149,7 @@ static int ps3cdrom_close(struct open_fi > return 0; > } >=20 > -static void ps3cdrom_print(int verbose) > +static int ps3cdrom_print(int verbose) > { > + return (0); > } >=20 > Modified: head/sys/boot/powerpc/ps3/ps3disk.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/powerpc/ps3/ps3disk.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/powerpc/ps3/ps3disk.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -61,7 +61,7 @@ static int ps3disk_strategy(void *devdat > size_t offset, size_t size, char *buf, size_t *rsize); > static int ps3disk_open(struct open_file *f, ...); > static int ps3disk_close(struct open_file *f); > -static void ps3disk_print(int verbose); > +static int ps3disk_print(int verbose); >=20 > struct devsw ps3disk =3D { > "disk", > @@ -186,8 +186,9 @@ static int ps3disk_close(struct open_fil > return 0; > } >=20 > -static void ps3disk_print(int verbose) > +static int ps3disk_print(int verbose) > { > + return (0); > } >=20 > static int ps3disk_open_gpt(struct ps3_devdesc *dev, struct open_dev = *od) >=20 > Modified: head/sys/boot/uboot/lib/disk.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/uboot/lib/disk.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/uboot/lib/disk.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -78,7 +78,7 @@ static int stor_strategy(void *, int, da > static int stor_open(struct open_file *, ...); > static int stor_close(struct open_file *); > static int stor_ioctl(struct open_file *f, u_long cmd, void *data); > -static void stor_print(int); > +static int stor_print(int); > static void stor_cleanup(void); >=20 > struct devsw uboot_storage =3D { > @@ -238,30 +238,31 @@ stor_readdev(struct disk_devdesc *dev, d > return (err); > } >=20 > -static void > +static int > stor_print(int verbose) > { > struct disk_devdesc dev; > static char line[80]; > - int i; > + int i, ret =3D 0; >=20 > - pager_open(); > for (i =3D 0; i < stor_info_no; i++) { > dev.d_dev =3D &uboot_storage; > dev.d_unit =3D i; > dev.d_slice =3D -1; > dev.d_partition =3D -1; > - sprintf(line, "\tdisk%d (%s)\n", i, > + snprintf(line, sizeof(line), "\tdisk%d (%s)\n", i, > ub_stor_type(SI(&dev).type)); > - if (pager_output(line)) > + if ((ret =3D pager_output(line)) !=3D 0) > break; > if (stor_opendev(&dev) =3D=3D 0) { > sprintf(line, "\tdisk%d", i); > - disk_print(&dev, line, verbose); > + ret =3D disk_print(&dev, line, verbose); > disk_close(&dev); > + if (ret !=3D 0) > + break; > } > } > - pager_close(); > + return (ret); > } >=20 > static int >=20 > Modified: head/sys/boot/usb/storage/umass_loader.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/usb/storage/umass_loader.c Tue Nov 8 06:13:22 = 2016 (r308433) > +++ head/sys/boot/usb/storage/umass_loader.c Tue Nov 8 06:50:18 = 2016 (r308434) > @@ -50,7 +50,7 @@ static void umass_disk_cleanup(void); > static int umass_disk_ioctl(struct open_file *, u_long, void *); > static int umass_disk_strategy(void *, int, daddr_t, size_t, size_t, = char *, > size_t *); > -static void umass_disk_print(int); > +static int umass_disk_print(int); >=20 > struct devsw umass_disk =3D { > .dv_name =3D "umass", > @@ -170,23 +170,26 @@ umass_disk_close(struct open_file *f) > return (disk_close(dev)); > } >=20 > -static void > +static int > umass_disk_print(int verbose) > { > struct disk_devdesc dev; >=20 > memset(&dev, 0, sizeof(dev)); >=20 > - pager_output(" umass0 UMASS device\n"); > + ret =3D pager_output(" umass0 UMASS device\n"); > + if (ret !=3D 0) > + return (ret); > dev.d_dev =3D &umass_disk; > dev.d_unit =3D 0; > dev.d_slice =3D -1; > dev.d_partition =3D -1; >=20 > if (umass_disk_open_sub(&dev) =3D=3D 0) { > - disk_print(&dev, " umass0", verbose); > + ret =3D disk_print(&dev, " umass0", verbose); > disk_close(&dev); > } > + return (ret); > } >=20 > static void >=20 > Modified: head/sys/boot/userboot/userboot/host.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/userboot/userboot/host.c Tue Nov 8 06:13:22 = 2016 (r308433) > +++ head/sys/boot/userboot/userboot/host.c Tue Nov 8 06:50:18 = 2016 (r308434) > @@ -134,13 +134,13 @@ host_dev_init(void) > return (0); > } >=20 > -static void > +static int > host_dev_print(int verbose) > { > char line[80]; >=20 > - sprintf(line, " host%d: Host filesystem\n", 0); > - pager_output(line); > + snprintf(line, sizeof(line), " host%d: Host = filesystem\n", 0); > + return (pager_output(line)); > } >=20 > /* >=20 > Modified: head/sys/boot/userboot/userboot/userboot_disk.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/userboot/userboot/userboot_disk.c Tue Nov 8 = 06:13:22 2016 (r308433) > +++ head/sys/boot/userboot/userboot/userboot_disk.c Tue Nov 8 = 06:50:18 2016 (r308434) > @@ -60,7 +60,7 @@ static int userdisk_realstrategy(void *d > static int userdisk_open(struct open_file *f, ...); > static int userdisk_close(struct open_file *f); > static int userdisk_ioctl(struct open_file *f, u_long cmd, void = *data); > -static void userdisk_print(int verbose); > +static int userdisk_print(int verbose); >=20 > struct devsw userboot_disk =3D { > "disk", > @@ -116,27 +116,33 @@ userdisk_cleanup(void) > /* > * Print information about disks > */ > -static void > +static int > userdisk_print(int verbose) > { > struct disk_devdesc dev; > char line[80]; > - int i; > + int i, ret =3D 0; >=20 > for (i =3D 0; i < userdisk_maxunit; i++) { > - sprintf(line, " disk%d: Guest drive image\n", i); > - pager_output(line); > + snprintf(line, sizeof(line), > + " disk%d: Guest drive image\n", i); > + ret =3D pager_output(line); > + if (ret !=3D 0) > + break; > dev.d_dev =3D &userboot_disk; > dev.d_unit =3D i; > dev.d_slice =3D -1; > dev.d_partition =3D -1; > if (disk_open(&dev, ud_info[i].mediasize, > ud_info[i].sectorsize, 0) =3D=3D 0) { > - sprintf(line, " disk%d", i); > - disk_print(&dev, line, verbose); > + snprintf(line, sizeof(line), " disk%d", i); > + ret =3D disk_print(&dev, line, verbose); > disk_close(&dev); > + if (ret !=3D 0) > + break; > } > } > + return (ret); > } >=20 > /* >=20 > Modified: head/sys/boot/zfs/zfs.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/zfs/zfs.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/zfs/zfs.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -514,20 +514,23 @@ zfs_probe_dev(const char *devname, uint6 > /* > * Print information about ZFS pools > */ > -static void > +static int > zfs_dev_print(int verbose) > { > spa_t *spa; > char line[80]; > + int ret =3D 0; >=20 > if (verbose) { > - spa_all_status(); > - return; > + return (spa_all_status()); > } > STAILQ_FOREACH(spa, &zfs_pools, spa_link) { > - sprintf(line, " zfs:%s\n", spa->spa_name); > - pager_output(line); > + snprintf(line, sizeof(line), " zfs:%s\n", = spa->spa_name); > + ret =3D pager_output(line); > + if (ret !=3D 0) > + break; > } > + return (ret); > } >=20 > /* >=20 > Modified: head/sys/boot/zfs/zfsimpl.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/zfs/zfsimpl.c Tue Nov 8 06:13:22 2016 = (r308433) > +++ head/sys/boot/zfs/zfsimpl.c Tue Nov 8 06:50:18 2016 = (r308434) > @@ -780,7 +780,7 @@ state_name(vdev_state_t state) >=20 > #else >=20 > -static void > +static int > pager_printf(const char *fmt, ...) > { > char line[80]; > @@ -789,14 +789,14 @@ pager_printf(const char *fmt, ...) > va_start(args, fmt); > vsprintf(line, fmt, args); > va_end(args); > - pager_output(line); > + return (pager_output(line)); > } >=20 > #endif >=20 > #define STATUS_FORMAT " %s %s\n" >=20 > -static void > +static int > print_state(int indent, const char *name, vdev_state_t state) > { > int i; > @@ -806,40 +806,56 @@ print_state(int indent, const char *name > for (i =3D 0; i < indent; i++) > strcat(buf, " "); > strcat(buf, name); >=20 > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > svn-src-head@freebsd.org mailing = list > https://lists.freebsd.org/mailman/listinfo/svn-src-head = > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org = " >=20 From owner-svn-src-all@freebsd.org Thu Nov 10 23:22:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70BDAC3B2FC; Thu, 10 Nov 2016 23:22:52 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x22b.google.com (mail-qk0-x22b.google.com [IPv6:2607:f8b0:400d:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2BC338D0; Thu, 10 Nov 2016 23:22:52 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x22b.google.com with SMTP id x190so778007qkb.0; Thu, 10 Nov 2016 15:22:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0ekvJGVAF2yq1Zbo/LQKZhhhvs4WhOQ+CID0jCOcYAE=; b=xEryN/GExfMoJnPj5aG+5RnRyOWUqwJ2LuH6OFgdTxbh/yqyU+B2l0Q01NpMEtONe2 97Kp3gb19tPgkfCVGF2eKSKqff5g+LUiZOh9Z8yBNgBH/M569+v4MUyuSWrMp3PY2p44 b3iUhk9C3LwEanrnF4s1vPBxOwgQe3eR1sfUJHTgqSgPT+YX0nyvqWMMYLKvP1VLcsBa LTt075JWXwFIEbDAXVZB948izaHV58L6FUyIuiMoq/LzHLXXEoMjY2E//o5q5UZ+vfom lRSWJ4emdCXp6kPtV80f5azlSyV9yJ+ClBdARvTa0fXGcbvm6xLwbtV6LxE05QIy2UzL BA5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0ekvJGVAF2yq1Zbo/LQKZhhhvs4WhOQ+CID0jCOcYAE=; b=PcCFPltLhdNNs3qgZ0AFWnogD2qLTGkw7wv7UchPBuvclqwtM7VTRk+OzSBk0pYwjv RVVybeONyeFDTkbDFpWwbRhahtQvq9typIuXRKC9PSBjT0m5axsuhOn+Q4XxXXAxLTiI VI5s/BipDYNJG0o8UqWMN72a68V3n7E27U3dZVSb0UZpIYYd7wKectf+daGxwSdPkR+X ap+X7sVR0lkn4sjoIhDGXyfDCNCZ9XMZctHgz2rnjWX0lGZ4XZomnVSTzOEfm2PvzZl/ 5u/mD8TeMQxrG8fgL2UZRYkllEw3xPWCqxZkZprKyQtcNbfL7/txSk5QJQ/+x8rAy1uk bpUA== X-Gm-Message-State: ABUngvcUotDgQqLdOM/ATOhW8Iugi+Mol0eFoDQ9Q5JpPp1GuMveW7PCQ+hVDsxhhGDeiMPDY45kKqZTyxisOg== X-Received: by 10.55.122.134 with SMTP id v128mr227089qkc.111.1478820171157; Thu, 10 Nov 2016 15:22:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.29.66 with HTTP; Thu, 10 Nov 2016 15:22:50 -0800 (PST) In-Reply-To: References: <201611011818.uA1II9oe069262@repo.freebsd.org> From: Ngie Cooper Date: Thu, 10 Nov 2016 15:22:50 -0800 Message-ID: Subject: Re: svn commit: r308175 - head/libexec/ftpd To: Matteo Riondato Cc: Kurt Lidl , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 23:22:52 -0000 On Thu, Nov 10, 2016 at 1:25 PM, Matteo Riondato wrote: > >> On Nov 1, 2016, at 2:18 PM, Kurt Lidl wrote: >> >> Author: lidl >> Date: Tue Nov 1 18:18:09 2016 >> New Revision: 308175 >> URL: https://svnweb.freebsd.org/changeset/base/308175 >> >> Log: >> Revisit blacklistd support in ftpd > > This commit is breaking buildworld for me with WITHOUT_BLACKLIST=y in src.conf : Kurt, I can't assign the bug to you because you don't have a bugzilla account, but here's one that was filed: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214409 . Cheers, -Ngie From owner-svn-src-all@freebsd.org Thu Nov 10 23:34:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86AB8C3B604; Thu, 10 Nov 2016 23:34:19 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x22c.google.com (mail-it0-x22c.google.com [IPv6:2607:f8b0:4001:c0b::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FA50E95; Thu, 10 Nov 2016 23:34:19 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x22c.google.com with SMTP id u205so78644057itc.0; Thu, 10 Nov 2016 15:34:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=llu0SOLQTY1p70BXCr5xyPOBM+eASbcuYpxlMfcO0/U=; b=SD15OgDWkC4MeUzHqM7NdEaLMSRC+nQ7i/flTeS4d/NLPsCtp7V+t1FkUsUQFveQxz 6ePQ8Cp5LR752KaZU0ziDu7I5Fqxn+lh5yPggUguOre+baHaA763fL9LQ1ZRBaGxI69G XJWiOLbUjbvzFrquS8NeeNauAfrTsxhPgCvSFjFBEJUWTX2uWFBjlVfNHu/suP+4HzNy I4+NYNlbooa2aRPzW3PLbYZkJzyXhZasRhbyGGCIiGEE1Teai7N+4rq8DXFYGWov+jlI 2DmgX1tNrdojLytdamYSsZMwpVAHOghQhSratxNlyqr5K3xnEw/J9hGVdeh6tCqi9qzv a9mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=llu0SOLQTY1p70BXCr5xyPOBM+eASbcuYpxlMfcO0/U=; b=hSOhhrDpaSrTj6HnUu+GqaLG5dzDwb7OudXdh3jlyZX0UchPceNPXxV1ojzyMa0uYZ BYt6K4OZHuLkB0gytByNT0A9VgrtvzWHY3/nLJ174N7xcHtgBM3ZL/w6mXjDg2JqBdhW ai/XNyv96TyvjQh6nA/I/19fj4AZjnSq/e3llQlt9xrbJ5SROGaqmHAd39BdlELEWa1I bZNlypICdYHJSXSKQNJgk5vHzoBsg5hQ0B2on+nRLnmPgCfqlYCj+38wUP4uOqRCtzHs +OH7ypwnsoGHaKE93g/Wy4lz+4wufw1ijev7AY8W6fHWbETjkOt2xNlaHi3NhbJ0atmP rnSg== X-Gm-Message-State: ABUngvdyh2fGRbjoWABWpa1YAvUHv7H4fiTbFj33lvmAlxLTdSJsQnwvLoYZox8eu2lPcRz0O5wGAjFBP4nx3Q== X-Received: by 10.36.65.216 with SMTP id b85mr19270485itd.39.1478820857055; Thu, 10 Nov 2016 15:34:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.39.134 with HTTP; Thu, 10 Nov 2016 15:34:16 -0800 (PST) In-Reply-To: <201609151725.u8FHPqFH081568@repo.freebsd.org> References: <201609151725.u8FHPqFH081568@repo.freebsd.org> From: Adrian Chadd Date: Thu, 10 Nov 2016 15:34:16 -0800 Message-ID: Subject: Re: svn commit: r305843 - in head/sys/mips: include mips To: Brooks Davis , "freebsd-mips@freebsd.org" Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 23:34:19 -0000 hi, This patch breaks stuff on my mips24k SoCs (ie, all the atheros chips.) BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x4002a4 got a read fault (type 0x2) at 0 Trapframe Register Dump: zero: 0 at: 0 v0: 0 v1: 0 a0: 0x7fffeecc a1: 0 a2: 0 a3: 0 t0: 0 t1: 0 t2: 0 t3: 0 t4: 0 t5: 0 t6: 0 t7: 0 t8: 0 t9: 0x400260 s0: 0x10 s1: 0x2 s2: 0x7fffeed0 s3: 0 s4: 0 s5: 0 s6: 0 s7: 0 k0: 0 k1: 0 gp: 0x4d55d0 sp: 0x7ffeee90 s8: 0 ra: 0 sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0 cause: 0x8 pc: 0x4002a4 Page table info for pc address 0x4002a4: pde = 0x809a8000, pte = 0xa001b35a Dumping 4 words starting at pc address 0x4002a4: 8c420000 14400003 00908021 8f828024 Page table info for bad address 0: pde = 0, pte = 0 -adrian On 15 September 2016 at 10:25, Brooks Davis wrote: > Author: brooks > Date: Thu Sep 15 17:25:52 2016 > New Revision: 305843 > URL: https://svnweb.freebsd.org/changeset/base/305843 > > Log: > The TLS offset is a property of the process ABI. > > Move to a per-proc TLS offset rather than incorrectly keying off the > presense of freebsd32 compability in the kernel. > > Reviewed by: adrian, sbruno > Obtained from: CheriBSD > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D7843 > > Modified: > head/sys/mips/include/proc.h > head/sys/mips/mips/cpu.c > head/sys/mips/mips/freebsd32_machdep.c > head/sys/mips/mips/genassym.c > head/sys/mips/mips/pm_machdep.c > head/sys/mips/mips/swtch.S > head/sys/mips/mips/sys_machdep.c > head/sys/mips/mips/trap.c > head/sys/mips/mips/vm_machdep.c > > Modified: head/sys/mips/include/proc.h > ============================================================================== > --- head/sys/mips/include/proc.h Thu Sep 15 17:25:11 2016 (r305842) > +++ head/sys/mips/include/proc.h Thu Sep 15 17:25:52 2016 (r305843) > @@ -62,6 +62,7 @@ struct mdthread { > int md_pc_count; /* performance counter */ > int md_pc_spill; /* performance counter spill */ > void *md_tls; > + size_t md_tls_tcb_offset; /* TCB offset */ > #ifdef CPU_CNMIPS > struct octeon_cop2_state *md_cop2; /* kernel context */ > struct octeon_cop2_state *md_ucop2; /* userland context */ > > Modified: head/sys/mips/mips/cpu.c > ============================================================================== > --- head/sys/mips/mips/cpu.c Thu Sep 15 17:25:11 2016 (r305842) > +++ head/sys/mips/mips/cpu.c Thu Sep 15 17:25:52 2016 (r305843) > @@ -71,13 +71,12 @@ struct mips_cpuinfo cpuinfo; > # define _LOAD_T0_MDTLS_A1 \ > _ENCODE_INSN(OP_LD, A1, T0, 0, offsetof(struct thread, td_md.md_tls)) > > -# if defined(COMPAT_FREEBSD32) > -# define _ADDIU_V0_T0_TLS_OFFSET \ > - _ENCODE_INSN(OP_DADDIU, T0, V0, 0, (TLS_TP_OFFSET + TLS_TCB_SIZE32)) > -# else > -# define _ADDIU_V0_T0_TLS_OFFSET \ > - _ENCODE_INSN(OP_DADDIU, T0, V0, 0, (TLS_TP_OFFSET + TLS_TCB_SIZE)) > -# endif /* ! COMPAT_FREEBSD32 */ > +# define _LOAD_T0_MDTLS_TCV_OFFSET_A1 \ > + _ENCODE_INSN(OP_LD, A1, T1, 0, \ > + offsetof(struct thread, td_md.md_tls_tcb_offset)) > + > +# define _ADDU_V0_T0_T1 \ > + _ENCODE_INSN(0, T0, T1, V0, OP_DADDU) > > # define _MTC0_V0_USERLOCAL \ > _ENCODE_INSN(OP_COP0, OP_DMT, V0, 4, 2) > @@ -86,8 +85,14 @@ struct mips_cpuinfo cpuinfo; > > # define _LOAD_T0_MDTLS_A1 \ > _ENCODE_INSN(OP_LW, A1, T0, 0, offsetof(struct thread, td_md.md_tls)) > -# define _ADDIU_V0_T0_TLS_OFFSET \ > - _ENCODE_INSN(OP_ADDIU, T0, V0, 0, (TLS_TP_OFFSET + TLS_TCB_SIZE)) > + > +# define _LOAD_T0_MDTLS_TCV_OFFSET_A1 \ > + _ENCODE_INSN(OP_LW, A1, T1, 0, \ > + offsetof(struct thread, td_md.md_tls_tcb_offset)) > + > +# define _ADDU_V0_T0_T1 \ > + _ENCODE_INSN(0, T0, T1, V0, OP_ADDU) > + > # define _MTC0_V0_USERLOCAL \ > _ENCODE_INSN(OP_COP0, OP_MT, V0, 4, 2) > > @@ -111,8 +116,9 @@ remove_userlocal_code(uint32_t *cpu_swit > if (instructp[0] == _JR_RA) > panic("%s: Unable to patch cpu_switch().", __func__); > if (instructp[0] == _LOAD_T0_MDTLS_A1 && > - instructp[1] == _ADDIU_V0_T0_TLS_OFFSET && > - instructp[2] == _MTC0_V0_USERLOCAL) { > + instructp[1] == _LOAD_T0_MDTLS_TCV_OFFSET_A1 && > + instructp[2] == _ADDU_V0_T0_T1 && > + instructp[3] == _MTC0_V0_USERLOCAL) { > instructp[0] = _JR_RA; > instructp[1] = _NOP; > break; > > Modified: head/sys/mips/mips/freebsd32_machdep.c > ============================================================================== > --- head/sys/mips/mips/freebsd32_machdep.c Thu Sep 15 17:25:11 2016 (r305842) > +++ head/sys/mips/mips/freebsd32_machdep.c Thu Sep 15 17:25:52 2016 (r305843) > @@ -61,6 +61,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -138,6 +139,8 @@ freebsd32_exec_setregs(struct thread *td > * Clear extended address space bit for userland. > */ > td->td_frame->sr &= ~MIPS_SR_UX; > + > + td->td_md.md_tls_tcb_offset = TLS_TP_OFFSET + TLS_TCB_SIZE32; > } > > int > > Modified: head/sys/mips/mips/genassym.c > ============================================================================== > --- head/sys/mips/mips/genassym.c Thu Sep 15 17:25:11 2016 (r305842) > +++ head/sys/mips/mips/genassym.c Thu Sep 15 17:25:52 2016 (r305843) > @@ -74,12 +74,7 @@ ASSYM(TD_FLAGS, offsetof(struct thread, > ASSYM(TD_LOCK, offsetof(struct thread, td_lock)); > ASSYM(TD_MDFLAGS, offsetof(struct thread, td_md.md_flags)); > ASSYM(TD_MDTLS, offsetof(struct thread, td_md.md_tls)); > - > -#if defined(__mips_n64) && defined(COMPAT_FREEBSD32) > -ASSYM(TLS_TCB_OFFSET, (TLS_TP_OFFSET + TLS_TCB_SIZE32)); > -#else > -ASSYM(TLS_TCB_OFFSET, (TLS_TP_OFFSET + TLS_TCB_SIZE)); > -#endif > +ASSYM(TD_MDTLS_TCB_OFFSET, offsetof(struct thread, td_md.md_tls_tcb_offset)); > > ASSYM(U_PCB_REGS, offsetof(struct pcb, pcb_regs.zero)); > ASSYM(U_PCB_CONTEXT, offsetof(struct pcb, pcb_context)); > > Modified: head/sys/mips/mips/pm_machdep.c > ============================================================================== > --- head/sys/mips/mips/pm_machdep.c Thu Sep 15 17:25:11 2016 (r305842) > +++ head/sys/mips/mips/pm_machdep.c Thu Sep 15 17:25:52 2016 (r305843) > @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -466,6 +467,8 @@ exec_setregs(struct thread *td, struct i > if (PCPU_GET(fpcurthread) == td) > PCPU_SET(fpcurthread, (struct thread *)0); > td->td_md.md_ss_addr = 0; > + > + td->td_md.md_tls_tcb_offset = TLS_TP_OFFSET + TLS_TCB_SIZE; > } > > int > > Modified: head/sys/mips/mips/swtch.S > ============================================================================== > --- head/sys/mips/mips/swtch.S Thu Sep 15 17:25:11 2016 (r305842) > +++ head/sys/mips/mips/swtch.S Thu Sep 15 17:25:52 2016 (r305843) > @@ -385,7 +385,8 @@ sw2: > * remove_userlocal_code() in cpu.c. > */ > PTR_L t0, TD_MDTLS(a1) # Get TLS pointer > - PTR_ADDIU v0, t0, TLS_TCB_OFFSET # Add TLS/TCB offset > + PTR_L t1, TD_MDTLS_TCB_OFFSET(a1) # Get TLS/TCB offset > + PTR_ADDU v0, t0, t1 > MTC0 v0, MIPS_COP_0_USERLOCAL, 2 # write it to ULR for rdhwr > > j ra > > Modified: head/sys/mips/mips/sys_machdep.c > ============================================================================== > --- head/sys/mips/mips/sys_machdep.c Thu Sep 15 17:25:11 2016 (r305842) > +++ head/sys/mips/mips/sys_machdep.c Thu Sep 15 17:25:52 2016 (r305843) > @@ -69,13 +69,8 @@ sysarch(struct thread *td, struct sysarc > * rdhwr trap() instruction handler. > */ > if (cpuinfo.userlocal_reg == true) { > -#if defined(__mips_n64) && defined(COMPAT_FREEBSD32) > mips_wr_userlocal((unsigned long)(uap->parms + > - TLS_TP_OFFSET + TLS_TCB_SIZE32)); > -#else > - mips_wr_userlocal((unsigned long)(uap->parms + > - TLS_TP_OFFSET + TLS_TCB_SIZE)); > -#endif > + td->td_md.md_tls_tcb_offset)); > } > return (0); > case MIPS_GET_TLS: > > Modified: head/sys/mips/mips/trap.c > ============================================================================== > --- head/sys/mips/mips/trap.c Thu Sep 15 17:25:11 2016 (r305842) > +++ head/sys/mips/mips/trap.c Thu Sep 15 17:25:52 2016 (r305843) > @@ -909,12 +909,7 @@ dofault: > if (inst.RType.rd == 29) { > frame_regs = &(trapframe->zero); > frame_regs[inst.RType.rt] = (register_t)(intptr_t)td->td_md.md_tls; > -#if defined(__mips_n64) && defined(COMPAT_FREEBSD32) > - if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) > - frame_regs[inst.RType.rt] += TLS_TP_OFFSET + TLS_TCB_SIZE32; > - else > -#endif > - frame_regs[inst.RType.rt] += TLS_TP_OFFSET + TLS_TCB_SIZE; > + frame_regs[inst.RType.rt] += td->td_md.md_tls_tcb_offset; > trapframe->pc += sizeof(int); > goto out; > } > > Modified: head/sys/mips/mips/vm_machdep.c > ============================================================================== > --- head/sys/mips/mips/vm_machdep.c Thu Sep 15 17:25:11 2016 (r305842) > +++ head/sys/mips/mips/vm_machdep.c Thu Sep 15 17:25:52 2016 (r305843) > @@ -154,6 +154,7 @@ cpu_fork(register struct thread *td1,reg > */ > > td2->td_md.md_tls = td1->td_md.md_tls; > + td2->td_md.md_tls_tcb_offset = td1->td_md.md_tls_tcb_offset; > td2->td_md.md_saved_intr = MIPS_SR_INT_IE; > td2->td_md.md_spinlock_count = 1; > #ifdef CPU_CNMIPS > @@ -494,15 +495,16 @@ int > cpu_set_user_tls(struct thread *td, void *tls_base) > { > > - td->td_md.md_tls = (char*)tls_base; > - if (td == curthread && cpuinfo.userlocal_reg == true) { > #if defined(__mips_n64) && defined(COMPAT_FREEBSD32) > - mips_wr_userlocal((unsigned long)tls_base + TLS_TP_OFFSET + > - TLS_TCB_SIZE32); > -#else > - mips_wr_userlocal((unsigned long)tls_base + TLS_TP_OFFSET + > - TLS_TCB_SIZE); > + if (td->td_proc && SV_PROC_FLAG(td->td_proc, SV_ILP32)) > + td->td_md.md_tls_tcb_offset = TLS_TP_OFFSET + TLS_TCB_SIZE32; > + else > #endif > + td->td_md.md_tls_tcb_offset = TLS_TP_OFFSET + TLS_TCB_SIZE; > + td->td_md.md_tls = (char*)tls_base; > + if (td == curthread && cpuinfo.userlocal_reg == true) { > + mips_wr_userlocal((unsigned long)tls_base + > + td->td_md.md_tls_tcb_offset); > } > > return (0); > From owner-svn-src-all@freebsd.org Thu Nov 10 23:37:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09C80C3B6C6; Thu, 10 Nov 2016 23:37:40 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x22e.google.com (mail-it0-x22e.google.com [IPv6:2607:f8b0:4001:c0b::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C36571078; Thu, 10 Nov 2016 23:37:39 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x22e.google.com with SMTP id u205so78848387itc.0; Thu, 10 Nov 2016 15:37:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=It19lkmJQkHUNsyuVqjVdSf7s5dql/gCrE1ek1VZGSo=; b=zve/JmXYG3yTnnetHgdzV7QB31ZLbEU3UKjoGLnTPRpz6xoxBIyVZY6meSPo8QtRfu FEU5uRtb1B33DkQoaEDFf9fv/HEIZ75wPVBPM28GZxjyG5PrhtBECdhgUBxOaUclFfTJ lX6sR2Q5uv8jQ/4awRVHcBEj41CQ9XKNG9Bn/kFXqFfjRBak3QyOItxZv/W3x+DvOTPi sXMQ24N+A01WLusAYb4hP3aKTiLjVzOJ3/NQb01kXksXH4v9cadSWNclqziDeRzb6oOu gI2p/RfoFjORrLfUPaVD4P4hs6EluccV0WiwibRzXxwax23P8zZPb49OJ2hatKGVSeF9 7+nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=It19lkmJQkHUNsyuVqjVdSf7s5dql/gCrE1ek1VZGSo=; b=kDHNUbFBuLNYKfz8gjrAu262pcN2VMLT6BZ11xWeEZDXQLp/f1E/lhFOdNwdKNaM2i B7rG2+jrNvkWlcvsUMyz2Y/zjNT7Z3Z63R5eobmx6Ur6QeODkQChcpSr/1AJhhKYDhO2 z/xuf9AeuOSUvkwHkUPf6d0WErnArWfS+VAJtIOE+2X4xEMo1Jr3MsUA836R/9pciI0F jqx7CAf5+LnUkeRnzn9lmzgZXck9xMVdt+jnz0ncgHVDpnN/b0h4j2JCw61CyWaMqOcf 7+QIW4Le1nD2UyYlS3xG8bmpCw0STZYSaZNAOYzmBgAnodfAhznTpSbHN3MtqcRuYvYE ZRAw== X-Gm-Message-State: ABUngvfJlFHvg8cCnb56n5wrDl+sRowoZmf/jJQylbX9g69ImGtbxOcIEsaB019e4VV7F6Jn7E9JwYdkDqruvw== X-Received: by 10.107.174.157 with SMTP id n29mr4753135ioo.177.1478821059234; Thu, 10 Nov 2016 15:37:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.39.134 with HTTP; Thu, 10 Nov 2016 15:37:38 -0800 (PST) In-Reply-To: <20161110213412.GA21672@bsdpad.com> References: <201610311533.u9VFXw2x053156@repo.freebsd.org> <128f2edc-eced-dc8b-72b4-267e1d26bd48@FreeBSD.org> <20161103201059.GA2104@bsdpad.com> <20161110213412.GA21672@bsdpad.com> From: Adrian Chadd Date: Thu, 10 Nov 2016 15:37:38 -0800 Message-ID: Subject: Re: svn commit: r308130 - in head: . gnu/lib/libgcc gnu/usr.bin/binutils gnu/usr.bin/binutils/ld gnu/usr.bin/binutils/libbfd gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb lib/libc lib/libc/mips... To: Ruslan Bukin Cc: "freebsd-mips@freebsd.org" , Bryan Drewery , Ruslan Bukin , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 23:37:40 -0000 The places where we set MIPS_SR_COP_1_BIT in locore.S, exception.S. -adrian On 10 November 2016 at 13:34, Ruslan Bukin wrote: > Hi, Adrian, > > thanks, but I have lack of ideas yet. > > I just tested this on Ingenic X1000 (mips.mipsel) and it works fine, > as well as mips.mipselhf (this hardware has FPU). > > I have no hardware without FPU. > > What exactly COP_1 bits you have commented to get rid of COP1_UNUSABLE? > > Ruslan > > On Thu, Nov 10, 2016 at 01:09:20PM -0800, Adrian Chadd wrote: >> ok, so there are two problems with mips now. >> >> * COP1_UNUSABLE - which is now being logged, and we were likely >> triggering it before. The problem: we always turned it on. If I >> comment out flipping on the COP1 bits in the .S files, those >> exceptions go away. >> >> * Page faults, but that may be me with an older userland: >> >> BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x404237c0 got a >> read fault (type 0x2) at 0x8 >> Trapframe Register Dump: >> zero: 0 at: 0xffffffffffffffe0 v0: 0x404471b8 v1: >> 0xffffffffffffffff >> a0: 0x404471b8 a1: 0x7ffeea50 a2: 0x16c a3: 0 >> t0: 0 t1: 0 t2: 0 t3: 0x70000011 >> t4: 0x11 t5: 0x70000013 t6: 0x3 t7: 0 >> t8: 0 t9: 0x4041c940 s0: 0 s1: 0x40417000 >> s2: 0x7fffeee0 s3: 0xffffffffffffffff s4: 0xc s5: 0x40427000 >> s6: 0x7fffeecc s7: 0x7ffeea50 k0: 0 k1: 0 >> gp: 0x4044e630 sp: 0x7ffee838 s8: 0x2 ra: 0x404224d4 >> sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0x8 >> cause: 0x8 pc: 0x404237c0 >> Page table info for pc address 0x404237c0: pde = 0x809aa000, pte = 0xa001ba9a >> Dumping 4 words starting at pc address 0x404237c0: >> 8e100008 1600fff1 8f828070 100000a3 >> >> >> >> -adrian >> >> >> On 10 November 2016 at 12:49, Adrian Chadd wrote: >> > hi, >> > >> > This fails to boot on actual mips24k hardware, no hardfloat: >> > >> > COP1_UNUSABLE: pid 1 tid 100001 (init), uid 0: pc 0x404237c0 ra 0x404224d4 >> > Trapframe Register Dump: >> > zero: 0 at: 0xffffffffffffffe0 v0: 0x404471b8 v1: >> > 0xffffffffffffffff >> > >> > .. lots of that the moment we boot userland. >> > >> > >> > >> > -adrian >> > >> > >> > On 3 November 2016 at 13:10, Ruslan Bukin wrote: >> >> On Thu, Nov 03, 2016 at 12:39:48PM -0700, Bryan Drewery wrote: >> >>> On 10/31/16 8:33 AM, Ruslan Bukin wrote: >> >>> > Modified: head/share/mk/bsd.cpu.mk >> >>> > ============================================================================== >> >>> > --- head/share/mk/bsd.cpu.mk Mon Oct 31 15:11:55 2016 (r308129) >> >>> > +++ head/share/mk/bsd.cpu.mk Mon Oct 31 15:33:58 2016 (r308130) >> >>> > @@ -303,6 +303,9 @@ MACHINE_CPU = v9 ultrasparc ultrasparc3 >> >>> > >> >>> > .if ${MACHINE_CPUARCH} == "mips" >> >>> > CFLAGS += -G0 >> >>> > +.if ${TARGET_ARCH:Mmips*hf} >> >>> >> >>> TARGET_ARCH is not valid here. This broke building ports. Fixed in >> >>> r308262. >> >>> >> >> >> >> Thank you! >> >> >> >> Ruslan >> >> From owner-svn-src-all@freebsd.org Fri Nov 11 02:40:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9331C3A9D0; Fri, 11 Nov 2016 02:40:45 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B797369E; Fri, 11 Nov 2016 02:40:45 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB2ei3h073167; Fri, 11 Nov 2016 02:40:44 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB2eiET073165; Fri, 11 Nov 2016 02:40:44 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110240.uAB2eiET073165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 02:40:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308492 - in stable/10/sys/dev/hyperv: include vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 02:40:46 -0000 Author: sephe Date: Fri Nov 11 02:40:44 2016 New Revision: 308492 URL: https://svnweb.freebsd.org/changeset/base/308492 Log: MFC r307624 hyperv/vmbus: Expose channel management taskqueue for driver to use. Sponsored by: Microsoft Modified: stable/10/sys/dev/hyperv/include/vmbus.h stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/10/sys/dev/hyperv/include/vmbus.h Thu Nov 10 22:12:19 2016 (r308491) +++ stable/10/sys/dev/hyperv/include/vmbus.h Fri Nov 11 02:40:44 2016 (r308492) @@ -119,6 +119,7 @@ struct vmbus_chan_br { struct vmbus_channel; struct hyperv_guid; struct task; +struct taskqueue; typedef void (*vmbus_chan_callback_t)(struct vmbus_channel *, void *); @@ -180,5 +181,7 @@ int vmbus_chan_prplist_nelem(int br_siz int dlen_max); bool vmbus_chan_rx_empty(const struct vmbus_channel *chan); bool vmbus_chan_tx_empty(const struct vmbus_channel *chan); +struct taskqueue * + vmbus_chan_mgmt_tq(const struct vmbus_channel *chan); #endif /* !_VMBUS_H_ */ Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Nov 10 22:12:19 2016 (r308491) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Nov 11 02:40:44 2016 (r308492) @@ -1721,3 +1721,10 @@ vmbus_chan_run_task(struct vmbus_channel taskqueue_enqueue(chan->ch_tq, task); taskqueue_drain(chan->ch_tq, task); } + +struct taskqueue * +vmbus_chan_mgmt_tq(const struct vmbus_channel *chan) +{ + + return (chan->ch_mgmt_tq); +} From owner-svn-src-all@freebsd.org Fri Nov 11 02:42:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95094C3ABA7; Fri, 11 Nov 2016 02:42:55 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FDE5AA8; Fri, 11 Nov 2016 02:42:55 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB2gs6s074112; Fri, 11 Nov 2016 02:42:54 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB2gsfj074107; Fri, 11 Nov 2016 02:42:54 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201611110242.uAB2gsfj074107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 11 Nov 2016 02:42:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308493 - in head: contrib/amd contrib/amd/amd contrib/amd/amq contrib/amd/conf/checkmount contrib/amd/conf/mtab contrib/amd/conf/nfs_prot contrib/amd/conf/transp contrib/amd/conf/umoun... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 02:42:55 -0000 Author: cy Date: Fri Nov 11 02:42:53 2016 New Revision: 308493 URL: https://svnweb.freebsd.org/changeset/base/308493 Log: MFV r305100: Update amd from am-utils 6.1.5 to 6.2. Used extensively on my network over the past month. Reviewed by: pfg, brooks Suggested by: pfg Obtained from: ftp://ftp.am-utils.org/pub/am-utils/ MFC after: 6 weeks Relnotes: yes Differential Revision: D8405 Added: head/contrib/amd/amd/info_sun.c - copied unchanged from r305100, vendor/amd/dist/amd/info_sun.c head/contrib/amd/amd/ops_ext.c - copied unchanged from r305100, vendor/amd/dist/amd/ops_ext.c head/contrib/amd/amd/ops_lustre.c - copied unchanged from r305100, vendor/amd/dist/amd/ops_lustre.c head/contrib/amd/amd/ops_nfs4.c - copied unchanged from r305100, vendor/amd/dist/amd/ops_nfs4.c head/contrib/amd/amd/ops_udf.c - copied, changed from r305100, vendor/amd/dist/amd/ops_udf.c head/contrib/amd/amd/sun2amd.8 - copied unchanged from r305100, vendor/amd/dist/amd/sun2amd.8 head/contrib/amd/amd/sun2amd.c - copied unchanged from r305100, vendor/amd/dist/amd/sun2amd.c head/contrib/amd/amd/sun_map.c - copied unchanged from r305100, vendor/amd/dist/amd/sun_map.c head/contrib/amd/amd/sun_map.h - copied unchanged from r305100, vendor/amd/dist/amd/sun_map.h head/contrib/amd/amd/sun_map_parse.y - copied unchanged from r305100, vendor/amd/dist/amd/sun_map_parse.y head/contrib/amd/amd/sun_map_tok.l - copied unchanged from r305100, vendor/amd/dist/amd/sun_map_tok.l head/contrib/amd/amd/test1.sh - copied unchanged from r305100, vendor/amd/dist/amd/test1.sh head/contrib/amd/fsinfo/null_gram.c - copied unchanged from r305100, vendor/amd/dist/fsinfo/null_gram.c head/contrib/amd/fsinfo/null_gram.h - copied unchanged from r305100, vendor/amd/dist/fsinfo/null_gram.h head/contrib/amd/fsinfo/null_gram.y - copied unchanged from r305100, vendor/amd/dist/fsinfo/null_gram.y head/contrib/amd/fsinfo/null_lex.c - copied unchanged from r305100, vendor/amd/dist/fsinfo/null_lex.c head/contrib/amd/fsinfo/null_lex.l - copied unchanged from r305100, vendor/amd/dist/fsinfo/null_lex.l head/contrib/amd/include/nfs_common.h - copied unchanged from r305100, vendor/amd/dist/include/nfs_common.h Modified: head/contrib/amd/AUTHORS head/contrib/amd/BUGS head/contrib/amd/COPYING head/contrib/amd/ChangeLog head/contrib/amd/FAQ head/contrib/amd/INSTALL head/contrib/amd/MIRRORS.html head/contrib/amd/MIRRORS.txt head/contrib/amd/NEWS head/contrib/amd/README head/contrib/amd/README.attrcache head/contrib/amd/README.ldap head/contrib/amd/README.y2k head/contrib/amd/amd/am_ops.c head/contrib/amd/amd/amd.8 head/contrib/amd/amd/amd.c head/contrib/amd/amd/amd.h head/contrib/amd/amd/amfs_auto.c head/contrib/amd/amd/amfs_direct.c head/contrib/amd/amd/amfs_error.c head/contrib/amd/amd/amfs_generic.c head/contrib/amd/amd/amfs_host.c head/contrib/amd/amd/amfs_link.c head/contrib/amd/amd/amfs_linkx.c head/contrib/amd/amd/amfs_nfsl.c head/contrib/amd/amd/amfs_nfsx.c head/contrib/amd/amd/amfs_program.c head/contrib/amd/amd/amfs_root.c head/contrib/amd/amd/amfs_toplvl.c head/contrib/amd/amd/amfs_union.c head/contrib/amd/amd/amq_subr.c head/contrib/amd/amd/amq_svc.c head/contrib/amd/amd/autil.c head/contrib/amd/amd/clock.c head/contrib/amd/amd/conf.c head/contrib/amd/amd/conf_parse.y head/contrib/amd/amd/conf_tok.l head/contrib/amd/amd/get_args.c head/contrib/amd/amd/info_exec.c head/contrib/amd/amd/info_file.c head/contrib/amd/amd/info_hesiod.c head/contrib/amd/amd/info_ldap.c head/contrib/amd/amd/info_ndbm.c head/contrib/amd/amd/info_nis.c head/contrib/amd/amd/info_nisplus.c head/contrib/amd/amd/info_passwd.c head/contrib/amd/amd/info_union.c head/contrib/amd/amd/map.c head/contrib/amd/amd/mapc.c head/contrib/amd/amd/mntfs.c head/contrib/amd/amd/nfs_prot_svc.c head/contrib/amd/amd/nfs_start.c head/contrib/amd/amd/nfs_subr.c head/contrib/amd/amd/ops_TEMPLATE.c head/contrib/amd/amd/ops_cachefs.c head/contrib/amd/amd/ops_cdfs.c head/contrib/amd/amd/ops_efs.c head/contrib/amd/amd/ops_lofs.c head/contrib/amd/amd/ops_mfs.c head/contrib/amd/amd/ops_nfs.c head/contrib/amd/amd/ops_nfs3.c head/contrib/amd/amd/ops_nullfs.c head/contrib/amd/amd/ops_pcfs.c head/contrib/amd/amd/ops_tfs.c head/contrib/amd/amd/ops_tmpfs.c head/contrib/amd/amd/ops_ufs.c head/contrib/amd/amd/ops_umapfs.c head/contrib/amd/amd/ops_unionfs.c head/contrib/amd/amd/ops_xfs.c head/contrib/amd/amd/opts.c head/contrib/amd/amd/readdir.c head/contrib/amd/amd/restart.c head/contrib/amd/amd/rpc_fwd.c head/contrib/amd/amd/sched.c head/contrib/amd/amd/srvr_amfs_auto.c head/contrib/amd/amd/srvr_nfs.c head/contrib/amd/amq/amq.8 head/contrib/amd/amq/amq.c head/contrib/amd/amq/amq.h head/contrib/amd/amq/amq_clnt.c head/contrib/amd/amq/amq_xdr.c head/contrib/amd/amq/pawd.1 head/contrib/amd/amq/pawd.c head/contrib/amd/bootstrap head/contrib/amd/conf/checkmount/checkmount_bsd44.c head/contrib/amd/conf/mtab/mtab_bsd.c head/contrib/amd/conf/nfs_prot/nfs_prot_freebsd2.h head/contrib/amd/conf/nfs_prot/nfs_prot_freebsd3.h head/contrib/amd/conf/transp/transp_sockets.c head/contrib/amd/conf/umount/umount_bsd44.c head/contrib/amd/doc/am-utils.texi head/contrib/amd/doc/stamp-vti head/contrib/amd/doc/texinfo.tex head/contrib/amd/doc/version.texi head/contrib/amd/fixmount/fixmount.8 head/contrib/amd/fixmount/fixmount.c head/contrib/amd/fsinfo/fsi_analyze.c head/contrib/amd/fsinfo/fsi_data.h head/contrib/amd/fsinfo/fsi_dict.c head/contrib/amd/fsinfo/fsi_gram.y head/contrib/amd/fsinfo/fsi_lex.l head/contrib/amd/fsinfo/fsi_util.c head/contrib/amd/fsinfo/fsinfo.8 head/contrib/amd/fsinfo/fsinfo.c head/contrib/amd/fsinfo/fsinfo.h head/contrib/amd/fsinfo/wr_atab.c head/contrib/amd/fsinfo/wr_bparam.c head/contrib/amd/fsinfo/wr_dumpset.c head/contrib/amd/fsinfo/wr_exportfs.c head/contrib/amd/fsinfo/wr_fstab.c head/contrib/amd/hlfsd/hlfsd.8 head/contrib/amd/hlfsd/hlfsd.c head/contrib/amd/hlfsd/hlfsd.h head/contrib/amd/hlfsd/homedir.c head/contrib/amd/hlfsd/nfs_prot_svc.c head/contrib/amd/hlfsd/stubs.c head/contrib/amd/include/am_compat.h head/contrib/amd/include/am_defs.h head/contrib/amd/include/am_utils.h head/contrib/amd/include/am_xdr_func.h head/contrib/amd/include/amq_defs.h head/contrib/amd/include/mount_headers1.h head/contrib/amd/include/mount_headers2.h head/contrib/amd/ldap-id.ms head/contrib/amd/ldap-id.txt head/contrib/amd/libamu/amu.h head/contrib/amd/libamu/hasmntopt.c head/contrib/amd/libamu/misc_rpc.c head/contrib/amd/libamu/mount_fs.c head/contrib/amd/libamu/mtab.c head/contrib/amd/libamu/nfs_prot_xdr.c head/contrib/amd/libamu/strerror.c head/contrib/amd/libamu/strutil.c head/contrib/amd/libamu/wire.c head/contrib/amd/libamu/xdr_func.c head/contrib/amd/libamu/xutil.c head/contrib/amd/mk-amd-map/mk-amd-map.8 head/contrib/amd/mk-amd-map/mk-amd-map.c head/contrib/amd/scripts/amd.conf-sample head/contrib/amd/scripts/amd.conf.5 head/contrib/amd/scripts/automount2amd.8 head/contrib/amd/scripts/fixrmtab.in head/contrib/amd/vers.m4 head/contrib/amd/wire-test/wire-test.8 head/contrib/amd/wire-test/wire-test.c head/usr.sbin/amd/amd/Makefile head/usr.sbin/amd/fsinfo/Makefile head/usr.sbin/amd/include/config.h Directory Properties: head/contrib/amd/ (props changed) Modified: head/contrib/amd/AUTHORS ============================================================================== --- head/contrib/amd/AUTHORS Fri Nov 11 02:40:44 2016 (r308492) +++ head/contrib/amd/AUTHORS Fri Nov 11 02:42:53 2016 (r308493) @@ -6,22 +6,22 @@ This file lists the ones who contributed particular order, and I thank them all. This is of course not to diminish the smaller contributes of the many others. Thank you all. -* Erez Zadok +* Erez Zadok The most significant changes were made by Erez Zadok in terms of bug fixes, ports, and new features added. Erez Zadok is the current maintainer of am-utils, as of January 1997. -* Ion Badulescu +* Ion Badulescu Co-maintainer of am-utils since late 1999: Linux and Solaris autofs support, Linux NFSv3 support, major code reorganization, etc... -* Randall S. Winchester +* Randall S. Winchester May 7, 1997: contributed a special version of upl102 that included NFS V.3 support. Some of the code was contributed by Christos Zoulas -. I (Erez) ported these changes to am-utils. +. I (Erez) ported these changes to am-utils. September 12, 1997: lots of small prototype cleanups and fixes to numerous files. @@ -35,12 +35,12 @@ February 1, 1998: fixes for NetBSD to be September 4, 1999: assorted fixes for NetBSD 1.4+. -* Hannes Reinecke +* Hannes Reinecke Back in 1995, contributed code for linux. A new parser for file system specific options that only exist under linux. -* Leif Johansson +* Leif Johansson June 22, 1997: minor patch to ensure that systems without an RE library work. @@ -52,7 +52,7 @@ functions. Contributed scripts/amd2ldif August 4, 1997: info_ldap.c fixes and adding two new amd.conf ldap variables: ldap_cache_seconds and ldap_cache_maxmem. -* Andreas Stolcke +* Andreas Stolcke June 22, 1997: patches to ensure that proto= and vers= options work properly in mount tables and can be overridden. Later on, more code @@ -68,11 +68,11 @@ message. December 19, 1997: detected an FMR (Free Memory Read) in amd/mntfs.c, uninit_mntfs(). -* Danny Braniss +* Danny Braniss July, 6 1997: contributed patches to hesiod on bsdi3. -* Tom Schmidt +* Tom Schmidt July 10, 1997: Recommdation to include libgdbm if libc has no dbm_open. Patches for netgrp(host) command. Mods to aux/config.guess to recognize @@ -86,7 +86,7 @@ IFF_ROUTE instead of IFF_LOOPBACK. May 30, 2000: correct logging types for addopts/mergeopts messages. -* Daniel S. Riley +* Daniel S. Riley July 11, 1997: fixes to DU-4.0 to support string POSIX.1 signals, and struct sockaddr with sa_len field. @@ -99,15 +99,15 @@ grpid, nosuid, and actimo. August 15, 1998: fix memory leak in processing of /defaults, and avoid accessing uninitialized memory in osf1. -* Roman Hodek +* Roman Hodek July 23, 1997: Got lots of patches from the Debian Linux folks, who fixed several generic bugs, and one serious one for Linux. The latter involved using connected sockets for NFS mounts on kernels 1.3.10 and older. Roman's -work is baed on amd-upl102, and work from Ian Murdock -and Dominik Kubla . +work is baed on amd-upl102, and work from Ian Murdock +and Dominik Kubla . -* Rainer Orth +* Rainer Orth August 6, 1997: assorted fixes to support hesiod-1.3, solaris 2.4 (which I already fixed but did not release yet), and support for $LDFLAGS at @@ -132,34 +132,34 @@ mount tables in Solaris 8. February 9, 2000: new debug options hrtime (hi-res timer) and xdrtrace. bug fixes. -* Jason Thorpe +* Jason Thorpe August 25, 1997: make amd work when talking to NIS+ servers in NIS compatibility mode. Fix originally came from Matthieu Herrb -. +. -* Chris Metcalf +* Chris Metcalf August 29, 1997: patch to make amd use FQHN for NFS/RPC authentication, useful esp. for cross-domain NFS mounts. September 2, 1997: if plock() succeeded, don't display errno string. -* Enami Tsugutomo +* Enami Tsugutomo September 4, 1997: don't ping remote servers with NFS V.3 always, but V.2, regardless of client's NFS version. (conf/transp/transp_sockets.c) -* Dan Riley +* Dan Riley September 19, 1997: make sure that amd works with more secure portmappers that do not allow forwarding of RPC messages to other services. -* Wolfgang Rupprecht +* Wolfgang Rupprecht August 10, 1997: netbsd and other bsd systems have a mask flag for pcfs_args (msdos mount). -* Christos Zoulas +* Christos Zoulas September 25, 1997: fix to initialize uid/gid fields of pcfs_args_t on netbsd. @@ -181,7 +181,7 @@ TLI implementations. Patch to print ver options had been initialized, so we can print domain, host, and hostd. Linux patch to use umount2(2) if umount(2) fails. -* Bill Paul +* Bill Paul November 5, 1997: NFS v.3 support for AIX 4.2.1, which does *not* include headers for this. Bill had to guess at the right structures, field names, @@ -189,26 +189,26 @@ sizes, alignment, etc. January 15, 1999: small ldap bug fixes. -* Stefan Vogel +* Stefan Vogel November 14, 1997: typo in the subscription instructions to amd-dev. -* Guntram Wolski +* Guntram Wolski November 15, 1997: pointed out mismatching documentation for the -o option. -* Michael Hucka +* Michael Hucka January 11, 1997: pointed out reversed definition of NFS mount options vers and proto. -* Albert Chin +* Albert Chin January 12, 1998: minor bug in output of amd -H. June 23, 2005: assortment of small compile bugs on aix4, and solaris 5/6/7. -* Thomas Richter +* Thomas Richter January 13, 1998: use case insensitive comparisons for variables that need it (such as all hostname related ones, and more). @@ -216,11 +216,11 @@ it (such as all hostname related ones, a July 20, 1998: don't leak memory in the private version of yp_all (when vendor yp_all is bad). -* Fred Korz +* Fred Korz January 30, 1998: minor typo fixed to tftp example in am-utils.texi. -* Donald Buczek +* Donald Buczek March 6, 1998: correctly inherit existing NFS V.3 mounts upon restart. @@ -230,36 +230,36 @@ March 20, 1998: do not close stdout in c allow startup script to redirect it. Set a temporary secure umask(0022) before writing log file and restore it afterwards. -* Matthew Crosby +* Matthew Crosby April 20, 1998: allow arbitrary number of interfaces in wire listing. -* David O'Brien +* David O'Brien September 4, 1998: bug fix to avoid overrunning hostname buffer, and minor amd.conf man page typo correction. September 22, 1999: use more secure vsnprintf in real_plog(). -* Danny Rathjens +* Danny Rathjens October 29, 1998: swap arguments to kill(2) in amd.c. -* Mike Mitchell +* Mike Mitchell November 3, 1998: amd/nfs_subr.c (nfsproc_lookup_2_svc): try to avoid a race condition between unmounting and re-mounting an entry, by increasing the ttl of a looked up entry before unmounting it. -* Douglas K. Rand" +* Douglas K. Rand" December 3, 1998: case insensitive host name match for nfsl. -* David Wolfskill +* David Wolfskill January 28, 1999: don't turn on/off noconn option if it was already in that state. -* Jeffrey C Honig +* Jeffrey C Honig March 14, 1999: clean up more autogenerated files upon "make distclean". March 15, 1999: avoid overly verbose NIS warning even on systems that don't @@ -271,30 +271,30 @@ detection for bsdi4. September 17, 1999: fixes to expn. -* Paul Balyoz +* Paul Balyoz March 26, 1999: ensure lostaltmail displays Y2K compliant dates. -* Jon Peatfield +* Jon Peatfield March 30, 1999: turn off incomplete NFS V.3 support in HPUX 10.20. September 22, 1999: safe reloading of maps without first clearing old copies, and using cached copies if map failed to reload. -* Peter Breitenlohner +* Peter Breitenlohner July 24, 1999: patch for linux 2.2.x to work with older libc5 systems, and nis_isup mis-logic fixes. December 13, 2001: report typos in scripts/amd.conf.5. -* Dale Talcott +* Dale Talcott July 26, 1999: added NFS3 support for AIX mounting. -* Christophe Kalt +* Christophe Kalt July 14, 1999: add netgrpd() syntax function which uses FQHN. -* Andrew J. Korty +* Andrew J. Korty September 5, 1999: pawd works for type:=nfsl. -* Nick Williams +* Nick Williams September 1, 1999: bug fix for incorrect symlinks when two locations are requested simultaneously. @@ -306,38 +306,38 @@ doing rapid mounts and umounts in succes June 5, 2000: better handling of potential race-conditions during rapid u/mounts. Correctly update d_drops stats for amq -s. -* Johann Pfefferl +* Johann Pfefferl November 16, 1999: fix to ldap code so repeated calls to string2he don't corrupt the string passed. -* Amitha Perera +* Amitha Perera December 9, 1999: detect all wire() interfaces correctly. -* Steven Danz +* Steven Danz January 25, 2000: allow browsable auto maps. -* Wolfram Klaus . +* Wolfram Klaus . November 21, 2000: recognize proplist mnttab flag. -* Thomas Klausner +* Thomas Klausner November 21, 2000: lots of NetBSD fixes (many of which are generic). April 18, 2003: patch to reference am-utils info pages in man page. November 28, 2004: small fixes to typos in amd.conf(5) man page. -* Olaf Kirch +* Olaf Kirch February 1, 2001: important Linux NFS error number mapping fixed -* Ahmon Dancy +* Ahmon Dancy February 9, 2001: Apple Rhapsody/Darwin/OS X port -* Sebastien Bahloul +* Sebastien Bahloul July 3, 2001: LDAP fixes and updates to support new APIs March 27, 2002: LDAP bug and port to HPUX-11. -* Philippe Troin +* Philippe Troin July 12, 2001: Proper handling of GNU getopt, support for optionally disabling LDAP/Hesiod, fixes for the dev/nodev option on Linux. Texi documentation fix. @@ -348,65 +348,65 @@ generic mount option. July 17, 2003: pref:=null core dump fix. libgdbm portability. tcpd/librap support. And a few other things for the 6.0 branch. -* Trond Myklebust +* Trond Myklebust January 10, 2002: Proper initialization of the timeo parameter on Linux, TCP _must_ have a timeout 2 orders of magnitude larger than UDP -* George Ross +* George Ross April 29, 2002: Rework of old code, support for wildcards in LDAP queries, and an FD leak fix. Amd -A support. October 21, 2002: ldap_unbind fix for SIGPIPE, and support for LDAPv3 -protocol version parameter (with Tim Colles ). +protocol version parameter (with Tim Colles ). -* Matthias Scheler +* Matthias Scheler June 14, 2002: patch to use "xlatecookie" NFS mount option. -* Jun-ichiro itojun Hagino . +* Jun-ichiro itojun Hagino . June 11, 2002: minor fixes to support NetBSD 1.6A. -* Sean Fagan +* Sean Fagan March 14, 2003: detect and use the MNT2_GEN_OPT_AUTOMNTFS mount flag on OS X / Darwin. -* Hendrik Scholz +* Hendrik Scholz June 9, 2003: mk-amd-map should open temp db file using O_EXCL. -* Mark Davies +* Mark Davies July 14, 2003: define "xlatecookie" mnttab option if not defined (for NetBSD). Support null hesiod entries if they start with a ".". -* Eric S. Raymond +* Eric S. Raymond December 9, 2003: fix unbalanced [] typo in fsinfo man page. -* Martin Blapp +* Martin Blapp July 6, 2004: recognize fields in pcfs_args_t in FreeBSD 5. -* Dan Nelson +* Dan Nelson August 2, 2004: pawd to recognize "host" type mounts. -* Hauke Fath +* Hauke Fath August 3, 2004: pawd to recognize "linkx" type mounts. -* Michael van Elst +* Michael van Elst September 1, 2004: bug fix to avoid race condition in calls to mntctl on AIX. -* Jonathan Chen +* Jonathan Chen October 22, 2004: patch/fix to move mlock/mlockall/plock code after the fork(). June 29, 2005: core dump going off end of exported_ap[] array. September 29, 2005: patch/fix for pawd not to go into an infinite loop. October 25, 2005: patch/fix for pawd to repeatedly resolve path. -* David Rage +* David Rage January 17, 2005: prevent Amd from logging 'Read-only filesystem' errors when the mount point has an ancestor (i.e. '/') that is mounted read-only. -* Kevin Layer +* Kevin Layer January 28, 2005: basic instructions how to setup Amd on Mac OS-X. -* Dan Ottavio +* Dan Ottavio March 2, 2005: new global amd.conf option debug_mtab_file, to set the debug mtab file when using debug_options=mtab. Default has changed from "./mtab" to "/tmp/mtab" to avoid security problem. Bug fixed to ensure that Amd @@ -415,16 +415,13 @@ terminates properly even mtab file doesn * Erik Kline January 3, 2005: implementation of executable maps for Amd. -* Jim Zajkowski +* Jim Zajkowski March 14, 2005: small patch to amd2ldif. * Adam Morley January 27, 2005: synchronize what amd2ldif does vs. what the ldap.schema expects. -* Graeme Wilford +* Graeme Wilford July 4, 2005: buffer overflow in pawd. -* Steve Plite -September 22, 2005: repair reversed meaning of D_AMQ, so amq will unregister -on exit. Modified: head/contrib/amd/BUGS ============================================================================== --- head/contrib/amd/BUGS Fri Nov 11 02:40:44 2016 (r308492) +++ head/contrib/amd/BUGS Fri Nov 11 02:42:53 2016 (r308493) @@ -1,7 +1,7 @@ LIST OF KNOWN BUGS IN AM-UTILS OR OPERATING SYSTEMS Note: report am-utils bugs via Bugzilla to https://bugzilla.am-utils.org/ or -by email to the am-utils@am-utils.org mailing list. +by email to the am-utils mailing list (see www.am-utils.org). (1) mips-sgi-irix* @@ -98,11 +98,11 @@ diff -u -r1.1 utsname.h (4) powerpc-ibm-aix4.2.1.0 -[4A] "Randall S. Winchester" reports that for amd to +[4A] "Randall S. Winchester" reports that for amd to start, you need to kill and restart rpc.mountd and possibly also make sure that nfsd is running. Normally these are not required. -[4B] "Stefan Vogel" reports that if your amq +[4B] "Stefan Vogel" reports that if your amq executable dump core unexpectedly, then it may be a bug in gcc 2.7.x. Upgrade to gcc 2.8.x or use IBM's xlC compiler. @@ -123,7 +123,7 @@ but it is not yet in the glibc-2.0.7-19 A bug in libc results in an amq binary that doesn't work; amq -v dumps core in xdr_string. There is no known fix (source code or vendor patch) at this -time. (Please let am-utils@am-utils.org know if you know of a fix.) +time. (Please let us know if you have a fix; see www.am-utils.org.) (7) *-aix4.3.2.0 Modified: head/contrib/amd/COPYING ============================================================================== --- head/contrib/amd/COPYING Fri Nov 11 02:40:44 2016 (r308492) +++ head/contrib/amd/COPYING Fri Nov 11 02:42:53 2016 (r308493) @@ -1,4 +1,4 @@ -Copyright (c) 1997-2006 Erez Zadok +Copyright (c) 1997-2014 Erez Zadok Copyright (c) 1989 Jan-Simon Pendry Copyright (c) 1989 Imperial College of Science, Technology & Medicine Copyright (c) 1989 The Regents of the University of California. @@ -15,12 +15,7 @@ are met: 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -3. All advertising materials mentioning features or use of this software - must display the following acknowledgment: - This product includes software developed by the University of - California, Berkeley and its contributors, as well as the Trustees of - Columbia University. -4. Neither the name of the University nor the names of its contributors +3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. Modified: head/contrib/amd/ChangeLog ============================================================================== --- head/contrib/amd/ChangeLog Fri Nov 11 02:40:44 2016 (r308492) +++ head/contrib/amd/ChangeLog Fri Nov 11 02:42:53 2016 (r308493) @@ -1,14 +1,564 @@ -2006-05-11 Erez Zadok +2014-10-28 Christos Zoulas ******************************************************************* - *** Released am-utils-6.1.5 *** + *** Released am-utils-6.2 *** ******************************************************************* -2006-05-10 Erez Zadok + * add ylwrap.amd, sick and tired of patching broken ylwrap. + +2014-09-05 Christos Zoulas + + * factor out the size check for both readdir methods + (raven at themaw.net) + +2014-09-03 Christos Zoulas + + * configure test for 64 bit xdr function (raven at themaw.net) + +2014-09-01 Christos Zoulas + + * bug fix from raven at themaw.net to prevent writing v3 handle + to a v2 structure. + +2014-07-21 Christos Zoulas + + * fix permission problems with access + * auto_nfs_version = 3 now works for me. + +2014-07-20 Christos Zoulas + + * refresh some autoconf files + * force autoconf version since earlier versions don't work + * changes from raven at themaw.net to support NFSv3 for automounted + toplevel filesystems presented to the list in May. A few bug fixes + and integration changes by me. The code now works well enough to + mount the filesystem with NFSv3 and automount children but readdir + does not work yet (so no listing of automounted filesystems). + The new code is not enabled by default. To enable use + auto_nfs_version = 3 + in your configuration file. + +2014-03-26 Christos Zoulas + + From Ian Kent + + * use mktemp in scripts/fixrmtab + * fix documentatio nits + * [linux] Add ext2, ext3, ext4 specific mount options + * fix tcpwrappers (hosts.{allow,deny} problems for specific host + entries + +2014-03-20 Christos Zoulas + + + * don't background autofs umount + * avoid fh NULL dereference on umount + * handle ENOENT umount return for autofs mounts + * fix error message in get_nfs_version + * fix debug log deadlock + * [linux] retry umount on EBUSY + * handle failed umount on exit + +2014-03-09 Christos Zoulas + + * Remove BSD advertising clause. + * Remove expn program which is not used by anything + +2013-12-05 Christos Zoulas + + * Change the way we handle multiple lex scanners and yacc parsers + in a single program. Our old patch to ylwrap does not work anymore + because the bison parsers need shared symbols that start with yy + and we can't easily select which ones work. So now we use -P and + -p to let lex and yacc do the work for us. This requires a patch + to ylwrap, but it is smaller. + + +2013-12-05 Christos Zoulas + + * Change the way we handle multiple lex scanners and yacc parsers + in a single program. Our old patch to ylwrap does not work anymore + because the bison parsers need shared symbols that start with yy + and we can't easily select which ones work. So now we use -P and + -p to let lex and yacc do the work for us. This requires a patch + to ylwrap, but it is smaller. + +2013-05-14 Christos Zoulas + + * update to handle new autoconf and regen files + +2012-11-23 Christos Zoulas + + * recognize mountport=, noacl options + * simplify the bootstrap process, by forcing + all the files to be rebuild with autoreconf -f - i + +2012-10-03 Christos Zoulas + + * add missing ops_nfs4.c to the Makefile.am + +2012-09-14 Christos Zoulas + + * add locking option handling for lustre + * fix noatime, nodiratime, mandlock for linux + +2012-07-25 Christos Zoulas + + * bug fixes for lustre rhost parsing + +2012-06-27 Christos Zoulas + + * Disable 1/2-baked sun map support to avoid SIGSEGV + +2012-06-16 Christos Zoulas + + ******************************************************************* + *** Released am-utils-6.2-rc1 *** + ******************************************************************* + + * Fix libtool.m4 to work with later versions of autoconf. + * In buildall, use eval so that quoted strings work + * Centralize nfs version checking function, and introduce + new configuration variable nfs_vers_ping, which is the + max version we ping for. This is not documented yet, because + there might be a better way separate the max version we can + use vs the max version we ping for. + +2012-06-09 Christos Zoulas + + * fix issue with parsing nfsv4 security option strings + +2012-05-01 Christos Zoulas + + * Handle EPERM return from v4 file handles + in old linux kernels + +2012-03-09 Christos Zoulas + + * fix linux autofs detection + * fix wrong types in new amq mount xdr processing + +2012-01-25 Christos Zoulas + + * FreeBSD portability fixes + +2012-01-23 Christos Zoulas + + * Avoid type punned warnings + +2011-12-29 Christos Zoulas + + * fix bug I introduced in get_nfs_version that caused it to return 0 + * add direct support for ext{2,3,4} + +2011-12-15 Christos Zoulas + + * Include on linux, to grab extra mount flags + * Add support for lustre + +2011-11-28 Christos Zoulas + + * For nfsl mounts, match against either the short local + host name or the fqdn name. + +2011-10-06 Christos Zoulas + + * Add NFSv4 support (loosely based on Ramya's code). + Currently if the NFSv4 mount fails with ENOENT we fail + back to NFSv3, unless -DNO_FALLBACK. + * Replace strdup with xstrdup. It is not nice to replace + system functions with ones that behave differently. + * Add various consistency checks (caller function checks + variable for NULL, but callee does not). + * Fix error handling in various paths. + * Don't check before using XFREE(). free(NULL) works. + +2011-09-15 Christos Zoulas + + * amq -i addition (prints info about the map files) + +2011-09-14 Christos Zoulas + + * Solaris OS and compiler fixes from: + Hofmann, Frank + Sayle, Alex + - (void)&var generates warnings, removed + - __inline is invalid, changed with inline + - and other headers have extra dependendcies + ` +2011-08-11 Christos Zoulas + + * fix potential buffer overflow in expand_error() + (Richard Kettlewell). Does not seem to be exploitable. + + * simplify %option parsing to appease ancient flex. + +2011-06-21 Christos Zoulas + + * add support for linux autofs version 5 (untested) + +2011-06-18 Christos Zoulas + + * roll back to an older version of libtool that works + + * newer versions of config.guess and config.sub + + * minor fixes to buildall + +2011-05-19 Christos Zoulas + + * m4/macros/libtool.m4: for AIX AC_LANG_PROGRAM is incorrectly + used and the latest autoconf gives an error. For now just + quote it. + + * configure.in: Fedora Core 15 and RedHat 6 now don't define + af_family_t in , but in . + Include so that we get + indirectly. This caused the detection + test to fail. + +2010-11-24 Erez Zadok + + * m4/macros/os_cflags.m4: for linux, define _GNU_SOURCE (to get + definitions for O_LARGEFILE and more). + +2010-11-20 Christos Zoulas + + * Update news items, add release readme, mark as rc1 + + * Fix addopts code to work with options that are key=value + when the built-in hasmntopt() code is not used. The problem + was that the code passed "key=" to hasmntopt not "key". + +2009-12-10 Christos Zoulas + + * Copy all fields of the am_opts structure + When we introduced am_loc we also added a function to + create a duplicate of an am_opts structure. As it turns + out, that only made a partial copy of the struct and some + fields (e.g. opt_cache) was left blank in the new structure. + Unfortunately any code that was checking the options + through the mntfs structure was mislead by the partial + copy: caching was disabled completely, for example, and + since browsing relies on caching being enabled it wasn't + working either. + From: Krisztian Kovacs + + * Initialize RPC authentication flavor to AUTH_UNIX instead + of zero. RHEL 5 uses version 6 of the mount_arg structure + that includes the desired RPC authorization flavour. + Unfortunately amd initializes that value to zero, meaning + AUTH_NULL, resulting in all NFS servers denying operations. + From: Krisztian Kovacs + + * Make sure to remove nodes in the proper order when going + down. Depending on what order the nodes got created it's + possible that the parent of a node has a bigger am_mapno + (index in exported_ap[]) so that it gets freed before + its child while the child's am_parent pointer is still + pointing to the already freed block of memory. + This change makes sure that umount_exported() cleans up + all children of a node first before freeing the node. + From: Krisztian Kovacs + + * Fix Linux-specific stuff in ops_tmpfs.c + AUTOFS_TMPFS_FS_FLAGS is defined only in the Linux-specific + conf_linux.c file, so it cannot be built on Solaris. + From: Krisztian Kovacs + + * Add missing parenthesis to fix defined(XXX + From: Krisztian Kovacs + + * In the previous commit we've already made a change that + makes this code unnecessary since the node is returned + even if the backing file server is known to be down. + Since the code path is unused it should be removed. + From: Krisztian Kovacs + + * amfs_generic_lookup_child() tries to find an alternate + file server if it detects that the current one is down. + However, in the comparison used to decide if a possible + mount is the same as the current one it compares the am_loc + pointers instead of the actual mntfs pointers. Since + amfs_lookup_one_location() creates a brand new am_loc + structure for the returned mntfs structure the am_loc + pointer will be different even if the mntfs it's pointing + to is the same. + This tricks amfs_generic_lookup_child() think it has + found an alternate file server while it hasn't and thus + starts multiple racing mounts for the very same node and + mntfs. + From: Krisztian Kovacs + + * In the new am_loc scheme mounted mntfs structures still + have their mf_fo structure left intact. So when restart + creates a fake mntfs for an already mounted filesystem it + should not free mf_fo right away. + From: Krisztian Kovacs + + * Setting the error flag of the mntfs for which the share + is already mounted results in the mount point not being + removed when it times out. (Amd considers it an error + mntfs and thus umount becomse a no-op.) + From: Krisztian Kovacs + + * Right now AMD sets all timeout values to their defaults + even if you explicitly set them to zero. This patch + introduces separate flags that store if the respective + values have been set and the code path setting default + values checks these flags instead of testing the values + for zero. [Linux only] + From: Krisztian Kovacs + + * Fix mntfs related lookup/(un)mount race conditions, by + introducing a new structure linking an mntfs to a node. + From: Krisztian Kovacs + + * We have to free the buffers allocated by the XDR routines when + decoding the mount response after copying them to their final place. + From: Krisztian Kovacs + +2009-12-09 Christos Zoulas + + * Free continuation in amfs_retry() if we don't call amfs_bgmount() + Normally it's amfs_bgmount() which frees the continuation. However, if + the mount is already in progress and we're in amfs_retry() for another + node we don't try mounting the filesystem once again. Still, we have + to free the continuation as we won't get called again and thus would + leak the continuation structure and our am_loc references. + From: Krisztian Kovacs + + * Fix use-after-free and double free of mntfs private data + ops_nfs.c(nfs_init) does not clear private data pointer after free(). + This leads to use-after-free and double free in case mount() fails. + (found by valgrind) + From: Krisztian Kovacs + +2009-11-23 Christos Zoulas + + * The temporary filename buffer was leaked in lock_mtab(). + From: Krisztian Kovacs + +2009-10-27 Christos Zoulas + + * Deal with errno.h->sys/errno.h better + +2009-10-26 Christos Zoulas + + * Fix issue with autoconf 2.63 + + * Fix compile warnings for gcc-4.4.x + +2009-04-15 Christos Zoulas + + * Share the LDAP connection between different maps to save resources + on the LDAP server. (Olaf Flebbe ) + +2009-03-20 Christos Zoulas + + * Fix largefile re-definitions + + * Fix compilation error caused in previous patch + +2009-02-19 Christos Zoulas + + * Add a synchronous unmount amq rpc that will wait for the remote + filesystem to be unmounted, or return an error. Enabled by amq -uu + +2009-01-11 Erez Zadok + + * amd/ops_udf.c: don't define functions/variables which may not be + used. + + * amd/ops_tmpfs.c (mount_tmpfs): force gcc not to complain about + unused variables. + + * config.guess.long: properly support Fedora Core. + +2009-01-09 Christos Zoulas + + * Fix nfs mounts on linux 2.6.26 by explicitly initializing context. + + * Treat an empty sublink as an unset sublink; this allows us to + say sublink:=; in a spec to override the default. (This produces + Bad selector error, but it works. XXX: We need to decide how to + unset a selector. I proposed an unset keyword a while ago). + +2009-01-06 Christos Zoulas + + * re-renerate all generated files with newer versions of the + auto-tools. + + * move INSTALL to INSTALL.am-utils to avoid conflicts + + * fix incompatibilities with new m4 and new autoconf. + + * add UDF filesystem support. + + * fix NetBSD nfs file handle detection. + +2009-01-02 Christos Zoulas + + * add nocasetrans, nojoliet, rrcaseins for cd9660 filesystems + +2008-12-03 Christos Zoulas + + * allow ldap queries try a comma-separated list of servers given as: + + ldap_hostports = host1:port1,host2,host3:port3 + + original patch from Florian Geyer + +2008-09-19 Christos Zoulas + + * the auth_create gid on NetBSD is int + + * deal with lossage from flex -P + + * fix missing/incorrect prototypes + +2008-09-17 Christos Zoulas + + * fix manual page section issues (sorting, non-existant) + + * add missing forward declarations + + * avoid null pointer derefs (coverity) + + * more portable endian detection support + + * implement tmpfs support + + * use sizeof var instead of constant + + * fix yyerror declaration and definition + + * fix yy function renaming, and correct some renaming issues. + + * work around automake < 1.9 issue where ylwrap is not being run + for a single yacc or lex file. + + * NetBSD + - handle headers that need other headers to compile + - add exfs and tmpfs specific glue + - add options log, noatime, nocoredump, nodevmtime, softdep, + symperm, union + - NetBSD's new mount system call needs the size of the opaque + filesystem specific structure, but passing 0 for now works. + We would need to change a lot more code to pass the size from + the fs-specific calls, so for now punt. + - recvfrom takes socklen_t * on NetBSD + - handle newer NetBSD using statvfs + - NetBSD calls its ufs ffs + + * Linux + - Most recent kernels have trouble with trying to parse the pid + hostname and do locking. What before was a silent failure, now + there is a warning printed and the mount is rejected. This is + the simplest fix: + (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=479884) + +2007-04-13 Erez Zadok + + * amd/sun_map.c (sun_append_str): When translating '&' from Sun + automounter maps, replace it with "${key}" in the Amd map, not + with the value of the key at the time. This way '*' maps work + too. + + * config.guess.long: don't use -q option to grep because some + systems don't support it. Bug fix for solaris. + +2007-03-11 Christos Zoulas + + * amd/opts.c (expand_op): Don't call xstrlcpy() to truncate a + string. It causes spurious xstrlcpy() syslog() errors. Use + memcpy() and explicitly terminate the string. + +2007-01-20 Erez Zadok + + * updated copyright year to 2007 on all files. + +2006-12-27 Erez Zadok + + * minor new port: ia64-hp-hpux11.23 + + * m4/macros/check_libwrap_severity.m4 (LIBS): also test if caller + needs to define rfc931_timeout. + + * amd/sun2amd.c: define rfc931_timeout and allow/deny_severity for + libwrap. + + * amd/amq_svc.c: some versions of libwrap require the caller to + define rfc931_timeout in addition to allow/deny_severity. + + * amd/amfs_toplvl.c (amfs_toplvl_init): properly detect when + forced unmount functionality exists for all systems. + + * libamu/mount_fs.c (compute_nfs_args): reset nfs_args_t->pathconf + only if field exists. + + * conf/nfs_prot/nfs_prot_hpux11.h: prevent HPUX 11.23 from + including or (TLI definitions are already + included from elsewhere). + + * configure.in: detect nfs_args_t->pathconf field. + +2006-11-27 Erez Zadok + + * doc/Makefile.am: properly publish html files using newer + text2html. + +2006-11-27 Erez Zadok + + * doc/Makefile.am: obfuscate emails in ChangeLog before it is *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Nov 11 03:03:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F28F6C3823A; Fri, 11 Nov 2016 03:03:55 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4B9799D; Fri, 11 Nov 2016 03:03:55 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB33txM082767; Fri, 11 Nov 2016 03:03:55 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB33sA0082759; Fri, 11 Nov 2016 03:03:54 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110303.uAB33sA0082759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 03:03:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308494 - in stable/10/sys: dev/hyperv/netvsc net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 03:03:56 -0000 Author: sephe Date: Fri Nov 11 03:03:54 2016 New Revision: 308494 URL: https://svnweb.freebsd.org/changeset/base/308494 Log: MFC 307710-307712,307714 307710 hyperv/hn: Always query RSS capabilities. - This avoid distributing NDIS version check. - Only NDIS 6.20 required (earlier NDIS uses different indirect table format). Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8291 307711 hyperv/hn: Check NVS version for HASHVAL pktinfo on sending path. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8293 307712 hyperv/hn: Add network change support. Currently the network change is simulated by link status changes. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8295 307714 hyperv/hn: Function renaming; consistent w/ hardware capabilities query. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8296 Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/10/sys/dev/hyperv/netvsc/if_hnreg.h stable/10/sys/dev/hyperv/netvsc/if_hnvar.h stable/10/sys/dev/hyperv/netvsc/ndis.h stable/10/sys/net/rndis.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Nov 11 02:42:53 2016 (r308493) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Nov 11 03:03:54 2016 (r308494) @@ -543,8 +543,9 @@ hn_nvs_init(struct hn_softc *sc) if (error) { if_printf(sc->hn_ifp, "reinit NVS version 0x%x " "failed: %d\n", sc->hn_nvs_ver, error); + return (error); } - return (error); + goto done; } /* @@ -566,11 +567,16 @@ hn_nvs_init(struct hn_softc *sc) HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver), HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver)); } - return (0); + goto done; } } if_printf(sc->hn_ifp, "no NVS available\n"); return (ENXIO); + +done: + if (sc->hn_nvs_ver >= HN_NVS_VERSION_5) + sc->hn_caps |= HN_CAP_HASHVAL; + return (0); } int Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 02:42:53 2016 (r308493) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 03:03:54 2016 (r308494) @@ -208,7 +208,6 @@ struct hn_softc { struct arpcom arpcom; struct ifmedia hn_media; device_t hn_dev; - int hn_carrier; int hn_if_flags; struct sx hn_lock; struct vmbus_channel *hn_prichan; @@ -237,6 +236,9 @@ struct hn_softc { struct taskqueue *hn_mgmt_taskq; struct taskqueue *hn_mgmt_taskq0; struct task hn_link_task; + struct task hn_netchg_init; + struct timeout_task hn_netchg_status; + uint32_t hn_link_flags; /* HN_LINK_FLAG_ */ uint32_t hn_caps; /* HN_CAP_ */ uint32_t hn_flags; /* HN_FLAG_ */ @@ -270,6 +272,10 @@ struct hn_softc { #define HN_CAP_UDP6CS 0x0040 #define HN_CAP_TSO4 0x0080 #define HN_CAP_TSO6 0x0100 +#define HN_CAP_HASHVAL 0x0200 + +#define HN_LINK_FLAG_LINKUP 0x0001 +#define HN_LINK_FLAG_NETCHG 0x0002 /* * Externs Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 02:42:53 2016 (r308493) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 03:03:54 2016 (r308494) @@ -337,6 +337,8 @@ static void hn_destroy_tx_data(struct hn static void hn_start_taskfunc(void *, int); static void hn_start_txeof_taskfunc(void *, int); static void hn_link_taskfunc(void *, int); +static void hn_netchg_init_taskfunc(void *, int); +static void hn_netchg_status_taskfunc(void *, int); static void hn_suspend_mgmt_taskfunc(void *, int); static int hn_encap(struct hn_tx_ring *, struct hn_txdesc *, struct mbuf **); static int hn_create_rx_data(struct hn_softc *sc, int); @@ -362,6 +364,7 @@ static void hn_rx_drain(struct vmbus_cha static void hn_tx_resume(struct hn_softc *, int); static void hn_tx_ring_qflush(struct hn_tx_ring *); static int netvsc_detach(device_t dev); +static void hn_link_status(struct hn_softc *); static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt); @@ -484,7 +487,7 @@ hn_ifmedia_sts(struct ifnet *ifp, struct ifmr->ifm_status = IFM_AVALID; ifmr->ifm_active = IFM_ETHER; - if (!sc->hn_carrier) { + if ((sc->hn_link_flags & HN_LINK_FLAG_LINKUP) == 0) { ifmr->ifm_active |= IFM_NONE; return; } @@ -579,6 +582,9 @@ netvsc_attach(device_t dev) taskqueue_start_threads(&sc->hn_mgmt_taskq0, 1, PI_NET, "%s mgmt", device_get_nameunit(dev)); TASK_INIT(&sc->hn_link_task, 0, hn_link_taskfunc, sc); + TASK_INIT(&sc->hn_netchg_init, 0, hn_netchg_init_taskfunc, sc); + TIMEOUT_TASK_INIT(sc->hn_mgmt_taskq0, &sc->hn_netchg_status, 0, + hn_netchg_status_taskfunc, sc); /* * Allocate ifnet and setup its name earlier, so that if_printf @@ -824,10 +830,8 @@ netvsc_shutdown(device_t dev) } static void -hn_link_taskfunc(void *xsc, int pending __unused) +hn_link_status(struct hn_softc *sc) { - struct hn_softc *sc = xsc; - struct ifnet *ifp = sc->hn_ifp; uint32_t link_status; int error; @@ -838,11 +842,51 @@ hn_link_taskfunc(void *xsc, int pending } if (link_status == NDIS_MEDIA_STATE_CONNECTED) - sc->hn_carrier = 1; + sc->hn_link_flags |= HN_LINK_FLAG_LINKUP; else - sc->hn_carrier = 0; - if_link_state_change(ifp, - sc->hn_carrier ? LINK_STATE_UP : LINK_STATE_DOWN); + sc->hn_link_flags &= ~HN_LINK_FLAG_LINKUP; + if_link_state_change(sc->hn_ifp, + (sc->hn_link_flags & HN_LINK_FLAG_LINKUP) ? + LINK_STATE_UP : LINK_STATE_DOWN); +} + +static void +hn_link_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + + if (sc->hn_link_flags & HN_LINK_FLAG_NETCHG) + return; + hn_link_status(sc); +} + +static void +hn_netchg_init_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + + /* Prevent any link status checks from running. */ + sc->hn_link_flags |= HN_LINK_FLAG_NETCHG; + + /* + * Fake up a [link down --> link up] state change; 5 seconds + * delay is used, which closely simulates miibus reaction + * upon link down event. + */ + sc->hn_link_flags &= ~HN_LINK_FLAG_LINKUP; + if_link_state_change(sc->hn_ifp, LINK_STATE_DOWN); + taskqueue_enqueue_timeout(sc->hn_mgmt_taskq0, + &sc->hn_netchg_status, 5 * hz); +} + +static void +hn_netchg_status_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + + /* Re-allow link status checks. */ + sc->hn_link_flags &= ~HN_LINK_FLAG_NETCHG; + hn_link_status(sc); } void @@ -853,6 +897,14 @@ hn_link_status_update(struct hn_softc *s taskqueue_enqueue(sc->hn_mgmt_taskq, &sc->hn_link_task); } +void +hn_network_change(struct hn_softc *sc) +{ + + if (sc->hn_mgmt_taskq != NULL) + taskqueue_enqueue(sc->hn_mgmt_taskq, &sc->hn_netchg_init); +} + static __inline int hn_txdesc_dmamap_load(struct hn_tx_ring *txr, struct hn_txdesc *txd, struct mbuf **m_head, bus_dma_segment_t *segs, int *nsegs) @@ -2253,7 +2305,8 @@ hn_caps_sysctl(SYSCTL_HANDLER_ARGS) "\006UDP4CS" "\007UDP6CS" "\010TSO4" - "\011TSO6"); + "\011TSO6" + "\012HASHVAL"); return sysctl_handle_string(oidp, caps_str, sizeof(caps_str), req); } @@ -3028,12 +3081,15 @@ hn_fixup_tx_data(struct hn_softc *sc) if (sc->hn_caps & HN_CAP_UDP6CS) csum_assist |= CSUM_IP6_UDP; #endif - for (i = 0; i < sc->hn_tx_ring_cnt; ++i) sc->hn_tx_ring[i].hn_csum_assist = csum_assist; - if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30) { - /* Support HASHVAL pktinfo on TX path. */ + if (sc->hn_caps & HN_CAP_HASHVAL) { + /* + * Support HASHVAL pktinfo on TX path. + */ + if (bootverbose) + if_printf(sc->hn_ifp, "support HASHVAL pktinfo\n"); for (i = 0; i < sc->hn_tx_ring_cnt; ++i) sc->hn_tx_ring[i].hn_tx_flags |= HN_TX_FLAG_HASHVAL; } @@ -3428,20 +3484,19 @@ hn_synth_alloc_subchans(struct hn_softc int nchan, rxr_cnt, error; nchan = *nsubch + 1; - if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30 || nchan == 1) { + if (nchan == 1) { /* - * Either RSS is not supported, or multiple RX/TX rings - * are not requested. + * Multiple RX/TX rings are not requested. */ *nsubch = 0; return (0); } /* - * Get RSS capabilities, e.g. # of RX rings, and # of indirect + * Query RSS capabilities, e.g. # of RX rings, and # of indirect * table entries. */ - error = hn_rndis_get_rsscaps(sc, &rxr_cnt); + error = hn_rndis_query_rsscaps(sc, &rxr_cnt); if (error) { /* No RSS; this is benign. */ *nsubch = 0; @@ -3736,6 +3791,8 @@ hn_suspend_mgmt(struct hn_softc *sc) /* * Make sure that all pending management tasks are completed. */ + taskqueue_drain(sc->hn_mgmt_taskq0, &sc->hn_netchg_init); + taskqueue_drain_timeout(sc->hn_mgmt_taskq0, &sc->hn_netchg_status); taskqueue_drain_all(sc->hn_mgmt_taskq0); } @@ -3813,10 +3870,11 @@ hn_resume_mgmt(struct hn_softc *sc) { /* - * Kick off link status check. + * Kick off network change detection, which will + * do link status check too. */ sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; - hn_link_status_update(sc); + hn_network_change(sc); } static void Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 02:42:53 2016 (r308493) +++ stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 03:03:54 2016 (r308494) @@ -159,6 +159,7 @@ static void hv_rf_receive_indicate_status(struct hn_softc *sc, const void *data, int dlen) { const struct rndis_status_msg *msg; + int ofs; if (dlen < sizeof(*msg)) { if_printf(sc->hn_ifp, "invalid RNDIS status\n"); @@ -177,8 +178,19 @@ hv_rf_receive_indicate_status(struct hn_ break; case RNDIS_STATUS_NETWORK_CHANGE: - /* TODO */ - if_printf(sc->hn_ifp, "network changed\n"); + ofs = RNDIS_STBUFOFFSET_ABS(msg->rm_stbufoffset); + if (dlen < ofs + msg->rm_stbuflen || + msg->rm_stbuflen < sizeof(uint32_t)) { + if_printf(sc->hn_ifp, "network changed\n"); + } else { + uint32_t change; + + memcpy(&change, ((const uint8_t *)msg) + ofs, + sizeof(change)); + if_printf(sc->hn_ifp, "network changed, change %u\n", + change); + } + hn_network_change(sc); break; default: @@ -737,7 +749,7 @@ done: } int -hn_rndis_get_rsscaps(struct hn_softc *sc, int *rxr_cnt) +hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt) { struct ndis_rss_caps in, caps; size_t caps_len; @@ -745,15 +757,13 @@ hn_rndis_get_rsscaps(struct hn_softc *sc *rxr_cnt = 0; + if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_20) + return (EOPNOTSUPP); + memset(&in, 0, sizeof(in)); in.ndis_hdr.ndis_type = NDIS_OBJTYPE_RSS_CAPS; - if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30) { - in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_1; - in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE_6_0; - } else { - in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_2; - in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE; - } + in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_2; + in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE; caps_len = NDIS_RSS_CAPS_SIZE; error = hn_rndis_query2(sc, OID_GEN_RECEIVE_SCALE_CAPABILITIES, @@ -1028,10 +1038,12 @@ hn_rndis_conf_rss(struct hn_softc *sc, u int error; /* - * Only NDIS 6.30+ is supported. + * Only NDIS 6.20+ is supported: + * We only support 4bytes element in indirect table, which has been + * adopted since NDIS 6.20. */ - KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30, - ("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); + KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_20, + ("NDIS 6.20+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); /* * NOTE: Modified: stable/10/sys/dev/hyperv/netvsc/if_hnreg.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hnreg.h Fri Nov 11 02:42:53 2016 (r308493) +++ stable/10/sys/dev/hyperv/netvsc/if_hnreg.h Fri Nov 11 03:03:54 2016 (r308494) @@ -36,6 +36,7 @@ * NDIS protocol version numbers */ #define HN_NDIS_VERSION_6_1 0x00060001 +#define HN_NDIS_VERSION_6_20 0x00060014 #define HN_NDIS_VERSION_6_30 0x0006001e #define HN_NDIS_VERSION_MAJOR(ver) (((ver) & 0xffff0000) >> 16) #define HN_NDIS_VERSION_MINOR(ver) ((ver) & 0xffff) Modified: stable/10/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 02:42:53 2016 (r308493) +++ stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 03:03:54 2016 (r308494) @@ -122,7 +122,7 @@ void hn_rndis_detach(struct hn_softc *s int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); void *hn_rndis_pktinfo_append(struct rndis_packet_msg *, size_t pktsize, size_t pi_dlen, uint32_t pi_type); -int hn_rndis_get_rsscaps(struct hn_softc *sc, int *rxr_cnt); +int hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt); int hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr); int hn_rndis_get_linkstatus(struct hn_softc *sc, uint32_t *link_status); @@ -139,6 +139,7 @@ int hn_rxpkt(struct hn_rx_ring *rxr, co const struct hn_recvinfo *info); void hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); void hn_link_status_update(struct hn_softc *sc); +void hn_network_change(struct hn_softc *sc); extern struct hn_send_ctx hn_send_ctx_none; Modified: stable/10/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/ndis.h Fri Nov 11 02:42:53 2016 (r308493) +++ stable/10/sys/dev/hyperv/netvsc/ndis.h Fri Nov 11 03:03:54 2016 (r308494) @@ -32,6 +32,10 @@ #define NDIS_MEDIA_STATE_CONNECTED 0 #define NDIS_MEDIA_STATE_DISCONNECTED 1 +#define NDIS_NETCHANGE_TYPE_POSSIBLE 1 +#define NDIS_NETCHANGE_TYPE_DEFINITE 2 +#define NDIS_NETCHANGE_TYPE_FROMMEDIA 3 + #define NDIS_OFFLOAD_SET_NOCHG 0 #define NDIS_OFFLOAD_SET_ON 1 #define NDIS_OFFLOAD_SET_OFF 2 Modified: stable/10/sys/net/rndis.h ============================================================================== --- stable/10/sys/net/rndis.h Fri Nov 11 02:42:53 2016 (r308493) +++ stable/10/sys/net/rndis.h Fri Nov 11 03:03:54 2016 (r308494) @@ -320,6 +320,10 @@ struct rndis_status_msg { /* rndis_diag_info */ }; +/* stbuf offset from the beginning of rndis_status_msg. */ +#define RNDIS_STBUFOFFSET_ABS(ofs) \ + ((ofs) + __offsetof(struct rndis_status_msg, rm_status)) + /* * Immediately after rndis_status_msg.rm_stbufoffset, if a control * message is malformatted, or a packet message contains inappropriate From owner-svn-src-all@freebsd.org Fri Nov 11 03:09:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63338C38432; Fri, 11 Nov 2016 03:09:17 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3234BBD8; Fri, 11 Nov 2016 03:09:17 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB39GBD083009; Fri, 11 Nov 2016 03:09:16 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB39Faq083003; Fri, 11 Nov 2016 03:09:15 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110309.uAB39Faq083003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 03:09:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308495 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 03:09:17 -0000 Author: sephe Date: Fri Nov 11 03:09:15 2016 New Revision: 308495 URL: https://svnweb.freebsd.org/changeset/base/308495 Log: MFC 307838,307839 307838 hyperv/hn: Move chimney buffer index and size to txdesc. All RNDIS control messages have used SG list for a while. This makes the send context suitable for further refactoring. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8308 307839 hyperv/hn: Fix chimney sending buffer leakage upon NVS sending failure. This will not happen in real world, since TX consumption of the vmbus TX bufring is limitted. Better safe than sorry. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8309 Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Nov 11 03:03:54 2016 (r308494) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Nov 11 03:09:15 2016 (r308495) @@ -116,7 +116,7 @@ hn_nvs_xact_execute(struct hn_softc *sc, /* * Execute the xact setup by the caller. */ - hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); + hn_send_ctx_init(&sndc, hn_nvs_sent_xact, xact); vmbus_xact_activate(xact); error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, @@ -668,34 +668,6 @@ hn_chim_free(struct hn_softc *sc, uint32 atomic_clear_long(&sc->hn_chim_bmap[idx], mask); } -/* - * Net VSC on send - * Sends a packet on the specified Hyper-V device. - * Returns 0 on success, non-zero on failure. - */ -int -hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, - struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) -{ - struct hn_nvs_rndis rndis; - int ret; - - rndis.nvs_type = HN_NVS_TYPE_RNDIS; - rndis.nvs_rndis_mtype = rndis_mtype; - rndis.nvs_chim_idx = sndc->hn_chim_idx; - rndis.nvs_chim_sz = sndc->hn_chim_sz; - - if (gpa_cnt) { - ret = hn_nvs_send_sglist(chan, gpa, gpa_cnt, - &rndis, sizeof(rndis), sndc); - } else { - ret = hn_nvs_send(chan, VMBUS_CHANPKT_FLAG_RC, - &rndis, sizeof(rndis), sndc); - } - - return (ret); -} - int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch0) { Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 03:03:54 2016 (r308494) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 03:09:15 2016 (r308495) @@ -104,8 +104,8 @@ struct vmbus_channel; #define HN_XACT_REQ_SIZE (HN_XACT_REQ_PGCNT * PAGE_SIZE) #define HN_XACT_RESP_SIZE (HN_XACT_RESP_PGCNT * PAGE_SIZE) -#ifndef HN_USE_TXDESC_BUFRING struct hn_txdesc; +#ifndef HN_USE_TXDESC_BUFRING SLIST_HEAD(hn_txdesc_list, hn_txdesc); #else struct buf_ring; @@ -179,6 +179,7 @@ struct hn_tx_ring { bus_dma_tag_t hn_tx_data_dtag; uint64_t hn_csum_assist; + int (*hn_sendpkt)(struct hn_tx_ring *, struct hn_txdesc *); int hn_suspended; int hn_gpa_cnt; struct vmbus_gpa hn_gpa[NETVSC_PACKET_MAXPAGE]; @@ -277,13 +278,5 @@ struct hn_softc { #define HN_LINK_FLAG_LINKUP 0x0001 #define HN_LINK_FLAG_NETCHG 0x0002 -/* - * Externs - */ -struct hn_send_ctx; - -int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, - struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); - #endif /* __HV_NET_VSC_H__ */ Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 03:03:54 2016 (r308494) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 03:09:15 2016 (r308495) @@ -171,6 +171,8 @@ struct hn_txdesc { int refs; uint32_t flags; /* HN_TXD_FLAG_ */ struct hn_send_ctx send_ctx; + uint32_t chim_index; + int chim_size; bus_dmamap_t data_dmap; @@ -365,6 +367,8 @@ static void hn_tx_resume(struct hn_softc static void hn_tx_ring_qflush(struct hn_tx_ring *); static int netvsc_detach(device_t dev); static void hn_link_status(struct hn_softc *); +static int hn_sendpkt_rndis_sglist(struct hn_tx_ring *, struct hn_txdesc *); +static int hn_sendpkt_rndis_chim(struct hn_tx_ring *, struct hn_txdesc *); static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt); @@ -401,6 +405,57 @@ hn_set_lro_lenlim(struct hn_softc *sc, i } #endif +static __inline int +hn_nvs_send_rndis_sglist1(struct vmbus_channel *chan, uint32_t rndis_mtype, + struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) +{ + struct hn_nvs_rndis rndis; + + rndis.nvs_type = HN_NVS_TYPE_RNDIS; + rndis.nvs_rndis_mtype = rndis_mtype; + rndis.nvs_chim_idx = HN_NVS_CHIM_IDX_INVALID; + rndis.nvs_chim_sz = 0; + + return (hn_nvs_send_sglist(chan, gpa, gpa_cnt, + &rndis, sizeof(rndis), sndc)); +} + +int +hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, + struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) +{ + + return hn_nvs_send_rndis_sglist1(chan, HN_NVS_RNDIS_MTYPE_CTRL, + sndc, gpa, gpa_cnt); +} + +static int +hn_sendpkt_rndis_sglist(struct hn_tx_ring *txr, struct hn_txdesc *txd) +{ + + KASSERT(txd->chim_index == HN_NVS_CHIM_IDX_INVALID && + txd->chim_size == 0, ("invalid rndis sglist txd")); + return (hn_nvs_send_rndis_sglist1(txr->hn_chan, HN_NVS_RNDIS_MTYPE_DATA, + &txd->send_ctx, txr->hn_gpa, txr->hn_gpa_cnt)); +} + +static int +hn_sendpkt_rndis_chim(struct hn_tx_ring *txr, struct hn_txdesc *txd) +{ + struct hn_nvs_rndis rndis; + + KASSERT(txd->chim_index != HN_NVS_CHIM_IDX_INVALID && + txd->chim_size > 0, ("invalid rndis chim txd")); + + rndis.nvs_type = HN_NVS_TYPE_RNDIS; + rndis.nvs_rndis_mtype = HN_NVS_RNDIS_MTYPE_DATA; + rndis.nvs_chim_idx = txd->chim_index; + rndis.nvs_chim_sz = txd->chim_size; + + return (hn_nvs_send(txr->hn_chan, VMBUS_CHANPKT_FLAG_RC, + &rndis, sizeof(rndis), &txd->send_ctx)); +} + static int hn_get_txswq_depth(const struct hn_tx_ring *txr) { @@ -912,6 +967,8 @@ hn_txdesc_dmamap_load(struct hn_tx_ring struct mbuf *m = *m_head; int error; + KASSERT(txd->chim_index == HN_NVS_CHIM_IDX_INVALID, ("txd uses chim")); + error = bus_dmamap_load_mbuf_sg(txr->hn_tx_data_dtag, txd->data_dmap, m, segs, nsegs, BUS_DMA_NOWAIT); if (error == EFBIG) { @@ -935,19 +992,6 @@ hn_txdesc_dmamap_load(struct hn_tx_ring return error; } -static __inline void -hn_txdesc_dmamap_unload(struct hn_tx_ring *txr, struct hn_txdesc *txd) -{ - - if (txd->flags & HN_TXD_FLAG_DMAMAP) { - bus_dmamap_sync(txr->hn_tx_data_dtag, - txd->data_dmap, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(txr->hn_tx_data_dtag, - txd->data_dmap); - txd->flags &= ~HN_TXD_FLAG_DMAMAP; - } -} - static __inline int hn_txdesc_put(struct hn_tx_ring *txr, struct hn_txdesc *txd) { @@ -959,14 +1003,25 @@ hn_txdesc_put(struct hn_tx_ring *txr, st if (atomic_fetchadd_int(&txd->refs, -1) != 1) return 0; - hn_txdesc_dmamap_unload(txr, txd); + if (txd->chim_index != HN_NVS_CHIM_IDX_INVALID) { + KASSERT((txd->flags & HN_TXD_FLAG_DMAMAP) == 0, + ("chim txd uses dmamap")); + hn_chim_free(txr->hn_sc, txd->chim_index); + txd->chim_index = HN_NVS_CHIM_IDX_INVALID; + } else if (txd->flags & HN_TXD_FLAG_DMAMAP) { + bus_dmamap_sync(txr->hn_tx_data_dtag, + txd->data_dmap, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(txr->hn_tx_data_dtag, + txd->data_dmap); + txd->flags &= ~HN_TXD_FLAG_DMAMAP; + } + if (txd->m != NULL) { m_freem(txd->m); txd->m = NULL; } txd->flags |= HN_TXD_FLAG_ONLIST; - #ifndef HN_USE_TXDESC_BUFRING mtx_lock_spin(&txr->hn_txlist_spin); KASSERT(txr->hn_txdesc_avail >= 0 && @@ -1007,7 +1062,9 @@ hn_txdesc_get(struct hn_tx_ring *txr) atomic_subtract_int(&txr->hn_txdesc_avail, 1); #endif KASSERT(txd->m == NULL && txd->refs == 0 && - (txd->flags & HN_TXD_FLAG_ONLIST), ("invalid txd")); + txd->chim_index == HN_NVS_CHIM_IDX_INVALID && + (txd->flags & HN_TXD_FLAG_ONLIST) && + (txd->flags & HN_TXD_FLAG_DMAMAP) == 0, ("invalid txd")); txd->flags &= ~HN_TXD_FLAG_ONLIST; txd->refs = 1; } @@ -1054,9 +1111,6 @@ hn_tx_done(struct hn_send_ctx *sndc, str struct hn_txdesc *txd = sndc->hn_cbarg; struct hn_tx_ring *txr; - if (sndc->hn_chim_idx != HN_NVS_CHIM_IDX_INVALID) - hn_chim_free(sc, sndc->hn_chim_idx); - txr = txd->txr; KASSERT(txr->hn_chan == chan, ("channel mismatch, on chan%u, should be chan%u", @@ -1118,9 +1172,8 @@ hn_encap(struct hn_tx_ring *txr, struct int error, nsegs, i; struct mbuf *m_head = *m_head0; struct rndis_packet_msg *pkt; - uint32_t send_buf_section_idx; - int send_buf_section_size, pktlen; uint32_t *pi_data; + int pktlen; /* * extension points to the area reserved for the @@ -1233,18 +1286,19 @@ hn_encap(struct hn_tx_ring *txr, struct */ if (pkt->rm_len < txr->hn_chim_size) { txr->hn_tx_chimney_tried++; - send_buf_section_idx = hn_chim_alloc(txr->hn_sc); - if (send_buf_section_idx != HN_NVS_CHIM_IDX_INVALID) { + txd->chim_index = hn_chim_alloc(txr->hn_sc); + if (txd->chim_index != HN_NVS_CHIM_IDX_INVALID) { uint8_t *dest = txr->hn_sc->hn_chim + - (send_buf_section_idx * txr->hn_sc->hn_chim_szmax); + (txd->chim_index * txr->hn_sc->hn_chim_szmax); memcpy(dest, pkt, pktlen); dest += pktlen; m_copydata(m_head, 0, m_head->m_pkthdr.len, dest); - send_buf_section_size = pkt->rm_len; + txd->chim_size = pkt->rm_len; txr->hn_gpa_cnt = 0; txr->hn_tx_chimney++; + txr->hn_sendpkt = hn_sendpkt_rndis_chim; goto done; } } @@ -1289,14 +1343,14 @@ hn_encap(struct hn_tx_ring *txr, struct gpa->gpa_len = segs[i].ds_len; } - send_buf_section_idx = HN_NVS_CHIM_IDX_INVALID; - send_buf_section_size = 0; + txd->chim_index = HN_NVS_CHIM_IDX_INVALID; + txd->chim_size = 0; + txr->hn_sendpkt = hn_sendpkt_rndis_sglist; done: txd->m = m_head; /* Set the completion routine */ - hn_send_ctx_init(&txd->send_ctx, hn_tx_done, txd, - send_buf_section_idx, send_buf_section_size); + hn_send_ctx_init(&txd->send_ctx, hn_tx_done, txd); return 0; } @@ -1316,8 +1370,7 @@ again: * Make sure that txd is not freed before ETHER_BPF_MTAP. */ hn_txdesc_hold(txd); - error = hv_nv_on_send(txr->hn_chan, HN_NVS_RNDIS_MTYPE_DATA, - &txd->send_ctx, txr->hn_gpa, txr->hn_gpa_cnt); + error = txr->hn_sendpkt(txr, txd); if (!error) { ETHER_BPF_MTAP(ifp, txd->m); if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); @@ -2786,6 +2839,7 @@ hn_create_tx_ring(struct hn_softc *sc, i struct hn_txdesc *txd = &txr->hn_txdesc[i]; txd->txr = txr; + txd->chim_index = HN_NVS_CHIM_IDX_INVALID; /* * Allocate and load RNDIS packet message. Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 03:03:54 2016 (r308494) +++ stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 03:09:15 2016 (r308495) @@ -586,8 +586,7 @@ hn_rndis_xact_exec1(struct hn_softc *sc, * message. */ vmbus_xact_activate(xact); - error = hv_nv_on_send(sc->hn_prichan, HN_NVS_RNDIS_MTYPE_CTRL, sndc, - gpa, gpa_cnt); + error = hn_nvs_send_rndis_ctrl(sc->hn_prichan, sndc, gpa, gpa_cnt); if (error) { vmbus_xact_deactivate(xact); if_printf(sc->hn_ifp, "RNDIS ctrl send failed: %d\n", error); @@ -1166,7 +1165,7 @@ hn_rndis_halt(struct hn_softc *sc) halt->rm_rid = hn_rndis_rid(sc); /* No RNDIS completion; rely on NVS message send completion */ - hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); + hn_send_ctx_init(&sndc, hn_nvs_sent_xact, xact); hn_rndis_xact_exec1(sc, xact, sizeof(*halt), &sndc, &comp_len); vmbus_xact_put(xact); Modified: stable/10/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 03:03:54 2016 (r308494) +++ stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 03:09:15 2016 (r308495) @@ -46,8 +46,6 @@ typedef void (*hn_sent_callback_t) struct hn_send_ctx { hn_sent_callback_t hn_cb; void *hn_cbarg; - uint32_t hn_chim_idx; - int hn_chim_sz; }; struct rndis_hash_info; @@ -66,31 +64,18 @@ struct hn_recvinfo { uint32_t hash_value; }; -#define HN_SEND_CTX_INITIALIZER(cb, cbarg) \ -{ \ - .hn_cb = cb, \ - .hn_cbarg = cbarg, \ - .hn_chim_idx = HN_NVS_CHIM_IDX_INVALID, \ - .hn_chim_sz = 0 \ +#define HN_SEND_CTX_INITIALIZER(cb, cbarg) \ +{ \ + .hn_cb = cb, \ + .hn_cbarg = cbarg \ } static __inline void -hn_send_ctx_init(struct hn_send_ctx *sndc, hn_sent_callback_t cb, - void *cbarg, uint32_t chim_idx, int chim_sz) +hn_send_ctx_init(struct hn_send_ctx *sndc, hn_sent_callback_t cb, void *cbarg) { sndc->hn_cb = cb; sndc->hn_cbarg = cbarg; - sndc->hn_chim_idx = chim_idx; - sndc->hn_chim_sz = chim_sz; -} - -static __inline void -hn_send_ctx_init_simple(struct hn_send_ctx *sndc, hn_sent_callback_t cb, - void *cbarg) -{ - - hn_send_ctx_init(sndc, cb, cbarg, HN_NVS_CHIM_IDX_INVALID, 0); } static __inline int @@ -134,6 +119,9 @@ void hn_nvs_detach(struct hn_softc *sc) int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch); void hn_nvs_sent_xact(struct hn_send_ctx *sndc, struct hn_softc *sc, struct vmbus_channel *chan, const void *data, int dlen); +int hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, + struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, + int gpa_cnt); int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, const struct hn_recvinfo *info); From owner-svn-src-all@freebsd.org Fri Nov 11 03:15:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5548CC38602; Fri, 11 Nov 2016 03:15:53 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 172A012; Fri, 11 Nov 2016 03:15:53 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB3FqfH086909; Fri, 11 Nov 2016 03:15:52 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB3Fq6F086908; Fri, 11 Nov 2016 03:15:52 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110315.uAB3Fq6F086908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 03:15:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308496 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 03:15:53 -0000 Author: sephe Date: Fri Nov 11 03:15:52 2016 New Revision: 308496 URL: https://svnweb.freebsd.org/changeset/base/308496 Log: MFC 307840,307842 307840 hyperv/hn: Properly handle synthetic parts reattach failure. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8310 307842 hyperv/hn: Start link status check, if no network changes were pending. Link status check is much more lightweight than network change detection. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8311 Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 03:09:15 2016 (r308495) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 03:15:52 2016 (r308496) @@ -1803,19 +1803,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, break; } - /* Obtain and record requested MTU */ - ifp->if_mtu = ifr->ifr_mtu; - -#if __FreeBSD_version >= 1100099 - /* - * Make sure that LRO aggregation length limit is still - * valid, after the MTU change. - */ - if (sc->hn_rx_ring[0].hn_lro.lro_length_lim < - HN_LRO_LENLIM_MIN(ifp)) - hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); -#endif - /* * Suspend this interface before the synthetic parts * are ripped. @@ -1830,13 +1817,31 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, /* * Reattach the synthetic parts, i.e. NVS and RNDIS, * with the new MTU setting. - * XXX check error. */ - hn_synth_attach(sc, ifr->ifr_mtu); + error = hn_synth_attach(sc, ifr->ifr_mtu); + if (error) { + HN_UNLOCK(sc); + break; + } + /* + * Commit the requested MTU, after the synthetic parts + * have been successfully attached. + */ + ifp->if_mtu = ifr->ifr_mtu; + + /* + * Make sure that various parameters based on MTU are + * still valid, after the MTU change. + */ if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax) hn_set_chim_size(sc, sc->hn_chim_szmax); - hn_set_tso_maxsize(sc, hn_tso_maxlen, ifr->ifr_mtu); + hn_set_tso_maxsize(sc, hn_tso_maxlen, ifp->if_mtu); +#if __FreeBSD_version >= 1100099 + if (sc->hn_rx_ring[0].hn_lro.lro_length_lim < + HN_LRO_LENLIM_MIN(ifp)) + hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); +#endif /* * All done! Resume the interface now. @@ -3923,12 +3928,18 @@ static void hn_resume_mgmt(struct hn_softc *sc) { + sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; + /* - * Kick off network change detection, which will - * do link status check too. + * Kick off network change detection, if it was pending. + * If no network change was pending, start link status + * checks, which is more lightweight than network change + * detection. */ - sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; - hn_network_change(sc); + if (sc->hn_link_flags & HN_LINK_FLAG_NETCHG) + hn_network_change(sc); + else + hn_link_status_update(sc); } static void From owner-svn-src-all@freebsd.org Fri Nov 11 03:22:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8746C38810; Fri, 11 Nov 2016 03:22:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 652B76C9; Fri, 11 Nov 2016 03:22:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB3MM8C090668; Fri, 11 Nov 2016 03:22:22 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB3MMFW090362; Fri, 11 Nov 2016 03:22:22 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110322.uAB3MMFW090362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 03:22:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308497 - in stable/10/sys: dev/hyperv/netvsc net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 03:22:23 -0000 Author: sephe Date: Fri Nov 11 03:22:22 2016 New Revision: 308497 URL: https://svnweb.freebsd.org/changeset/base/308497 Log: MFC 307843 hyperv/hn: Fix RX filter settings. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8313 Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/net/rndis.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 03:15:52 2016 (r308496) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 03:22:22 2016 (r308497) @@ -233,6 +233,7 @@ struct hn_softc { struct sysctl_oid *hn_rx_sysctl_tree; struct vmbus_xact_ctx *hn_xact; uint32_t hn_nvs_ver; + uint32_t hn_rx_filter; struct taskqueue *hn_mgmt_taskq; struct taskqueue *hn_mgmt_taskq0; Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 03:15:52 2016 (r308496) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 03:22:22 2016 (r308497) @@ -328,6 +328,7 @@ static int hn_tx_conf_int_sysctl(SYSCTL_ static int hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS); static int hn_caps_sysctl(SYSCTL_HANDLER_ARGS); static int hn_hwassist_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); static int hn_check_iplen(const struct mbuf *, int); @@ -369,6 +370,7 @@ static int netvsc_detach(device_t dev); static void hn_link_status(struct hn_softc *); static int hn_sendpkt_rndis_sglist(struct hn_tx_ring *, struct hn_txdesc *); static int hn_sendpkt_rndis_chim(struct hn_tx_ring *, struct hn_txdesc *); +static int hn_set_rxfilter(struct hn_softc *); static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt); @@ -457,6 +459,43 @@ hn_sendpkt_rndis_chim(struct hn_tx_ring } static int +hn_set_rxfilter(struct hn_softc *sc) +{ + struct ifnet *ifp = sc->hn_ifp; + uint32_t filter; + int error = 0; + + HN_LOCK_ASSERT(sc); + + if (ifp->if_flags & IFF_PROMISC) { + filter = NDIS_PACKET_TYPE_PROMISCUOUS; + } else { + filter = NDIS_PACKET_TYPE_DIRECTED; + if (ifp->if_flags & IFF_BROADCAST) + filter |= NDIS_PACKET_TYPE_BROADCAST; +#ifdef notyet + /* + * See the comment in SIOCADDMULTI/SIOCDELMULTI. + */ + /* TODO: support multicast list */ + if ((ifp->if_flags & IFF_ALLMULTI) || + !TAILQ_EMPTY(&ifp->if_multiaddrs)) + filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; +#else + /* Always enable ALLMULTI */ + filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; +#endif + } + + if (sc->hn_rx_filter != filter) { + error = hn_rndis_set_rxfilter(sc, filter); + if (!error) + sc->hn_rx_filter = filter; + } + return (error); +} + +static int hn_get_txswq_depth(const struct hn_tx_ring *txr) { @@ -744,6 +783,9 @@ netvsc_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "hwassist", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_hwassist_sysctl, "A", "hwassist"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxfilter", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_rxfilter_sysctl, "A", "rxfilter"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_key", CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, hn_rss_key_sysctl, "IU", "RSS key"); @@ -1860,31 +1902,13 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, } if (ifp->if_flags & IFF_UP) { - /* - * If only the state of the PROMISC flag changed, - * then just use the 'set promisc mode' command - * instead of reinitializing the entire NIC. Doing - * a full re-init means reloading the firmware and - * waiting for it to start up, which may take a - * second or two. - */ -#ifdef notyet - /* Fixme: Promiscuous mode? */ - if (ifp->if_drv_flags & IFF_DRV_RUNNING && - ifp->if_flags & IFF_PROMISC && - !(sc->hn_if_flags & IFF_PROMISC)) { - /* do something here for Hyper-V */ - } else if (ifp->if_drv_flags & IFF_DRV_RUNNING && - !(ifp->if_flags & IFF_PROMISC) && - sc->hn_if_flags & IFF_PROMISC) { - /* do something here for Hyper-V */ - } else -#endif + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + hn_set_rxfilter(sc); + else hn_init_locked(sc); } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) hn_stop(sc); - } } sc->hn_if_flags = ifp->if_flags; @@ -1942,12 +1966,27 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, case SIOCADDMULTI: case SIOCDELMULTI: - /* Always all-multi */ +#ifdef notyet /* - * TODO: - * Enable/disable all-multi according to the emptiness of - * the mcast address list. + * XXX + * Multicast uses mutex, while RNDIS RX filter setting + * sleeps. We workaround this by always enabling + * ALLMULTI. ALLMULTI would actually always be on, even + * if we supported the SIOCADDMULTI/SIOCDELMULTI, since + * we don't support multicast address list configuration + * for this driver. */ + HN_LOCK(sc); + + if ((sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) == 0) { + HN_UNLOCK(sc); + break; + } + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + hn_set_rxfilter(sc); + + HN_UNLOCK(sc); +#endif break; case SIOCSIFMEDIA: @@ -2055,8 +2094,8 @@ hn_init_locked(struct hn_softc *sc) if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; - /* TODO: add hn_rx_filter */ - hn_rndis_set_rxfilter(sc, NDIS_PACKET_TYPE_PROMISCUOUS); + /* Configure RX filter */ + hn_set_rxfilter(sc); /* Clear OACTIVE bit. */ atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); @@ -2383,6 +2422,21 @@ hn_hwassist_sysctl(SYSCTL_HANDLER_ARGS) } static int +hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + char filter_str[128]; + uint32_t filter; + + HN_LOCK(sc); + filter = sc->hn_rx_filter; + HN_UNLOCK(sc); + snprintf(filter_str, sizeof(filter_str), "%b", filter, + NDIS_PACKET_TYPES); + return sysctl_handle_string(oidp, filter_str, sizeof(filter_str), req); +} + +static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS) { struct hn_softc *sc = arg1; @@ -3803,6 +3857,7 @@ hn_suspend_data(struct hn_softc *sc) * Disable RX by clearing RX filter. */ hn_rndis_set_rxfilter(sc, 0); + sc->hn_rx_filter = 0; /* * Give RNDIS enough time to flush all pending data packets. @@ -3890,9 +3945,8 @@ hn_resume_data(struct hn_softc *sc) /* * Re-enable RX. - * TODO: add hn_rx_filter. */ - hn_rndis_set_rxfilter(sc, NDIS_PACKET_TYPE_PROMISCUOUS); + hn_set_rxfilter(sc); /* * Make sure to clear suspend status on "all" TX rings, Modified: stable/10/sys/net/rndis.h ============================================================================== --- stable/10/sys/net/rndis.h Fri Nov 11 03:15:52 2016 (r308496) +++ stable/10/sys/net/rndis.h Fri Nov 11 03:22:22 2016 (r308497) @@ -351,7 +351,7 @@ struct rndis_keepalive_comp { uint32_t rm_status; }; -/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ +/* Packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ #define NDIS_PACKET_TYPE_DIRECTED 0x00000001 #define NDIS_PACKET_TYPE_MULTICAST 0x00000002 #define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 @@ -365,6 +365,14 @@ struct rndis_keepalive_comp { #define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000 #define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000 +/* + * Packet filter description for use with printf(9) %b identifier. + */ +#define NDIS_PACKET_TYPES \ + "\20\1DIRECT\2MULTICAST\3ALLMULTI\4BROADCAST" \ + "\5SRCROUTE\6PROMISC\7SMT\10ALLLOCAL" \ + "\11GROUP\12ALLFUNC\13FUNC\14MACFRAME" + /* RNDIS offsets */ #define RNDIS_HEADER_OFFSET ((uint32_t)sizeof(struct rndis_msghdr)) #define RNDIS_DATA_OFFSET \ From owner-svn-src-all@freebsd.org Fri Nov 11 03:41:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5506FC38C2A; Fri, 11 Nov 2016 03:41:37 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 24A9CED4; Fri, 11 Nov 2016 03:41:37 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB3faoY095522; Fri, 11 Nov 2016 03:41:36 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB3faiM095521; Fri, 11 Nov 2016 03:41:36 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110341.uAB3faiM095521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 03:41:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308498 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 03:41:37 -0000 Author: sephe Date: Fri Nov 11 03:41:36 2016 New Revision: 308498 URL: https://svnweb.freebsd.org/changeset/base/308498 Log: MFC 307844 hyperv/hn: Nuke unused forward declaration. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8314 Modified: stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 03:22:22 2016 (r308497) +++ stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 03:41:36 2016 (r308498) @@ -48,11 +48,6 @@ struct hn_send_ctx { void *hn_cbarg; }; -struct rndis_hash_info; -struct rndix_hash_value; -struct ndis_8021q_info_; -struct rndis_tcp_ip_csum_info_; - #define HN_NDIS_VLAN_INFO_INVALID 0xffffffff #define HN_NDIS_RXCSUM_INFO_INVALID 0 #define HN_NDIS_HASH_INFO_INVALID 0 From owner-svn-src-all@freebsd.org Fri Nov 11 03:43:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2E26C38CE9; Fri, 11 Nov 2016 03:43:07 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C20201213; Fri, 11 Nov 2016 03:43:07 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB3h7x4098710; Fri, 11 Nov 2016 03:43:07 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB3h6Y1098700; Fri, 11 Nov 2016 03:43:06 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110343.uAB3h6Y1098700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 03:43:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308499 - stable/10/sys/dev/hyperv/utilities X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 03:43:08 -0000 Author: sephe Date: Fri Nov 11 03:43:06 2016 New Revision: 308499 URL: https://svnweb.freebsd.org/changeset/base/308499 Log: MFC 307845 hyperv/ic: Rework framework/message version negotiation. Submitted by: Hongjiang Zhang Modified by: sephe Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8280 Modified: stable/10/sys/dev/hyperv/utilities/hv_heartbeat.c stable/10/sys/dev/hyperv/utilities/hv_kvp.c stable/10/sys/dev/hyperv/utilities/hv_kvp.h stable/10/sys/dev/hyperv/utilities/hv_shutdown.c stable/10/sys/dev/hyperv/utilities/hv_timesync.c stable/10/sys/dev/hyperv/utilities/hv_util.c stable/10/sys/dev/hyperv/utilities/hv_util.h stable/10/sys/dev/hyperv/utilities/hv_utilreg.h stable/10/sys/dev/hyperv/utilities/vmbus_icreg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_heartbeat.c Fri Nov 11 03:41:36 2016 (r308498) +++ stable/10/sys/dev/hyperv/utilities/hv_heartbeat.c Fri Nov 11 03:43:06 2016 (r308499) @@ -40,6 +40,14 @@ __FBSDID("$FreeBSD$"); #include "vmbus_if.h" +#define VMBUS_HEARTBEAT_FWVER_MAJOR 3 +#define VMBUS_HEARTBEAT_FWVER \ + VMBUS_IC_VERSION(VMBUS_HEARTBEAT_FWVER_MAJOR, 0) + +#define VMBUS_HEARTBEAT_MSGVER_MAJOR 3 +#define VMBUS_HEARTBEAT_MSGVER \ + VMBUS_IC_VERSION(VMBUS_HEARTBEAT_MSGVER_MAJOR, 0) + static const struct vmbus_ic_desc vmbus_heartbeat_descs[] = { { .ic_guid = { .hv_guid = { @@ -80,7 +88,8 @@ vmbus_heartbeat_cb(struct vmbus_channel */ switch (hdr->ic_type) { case VMBUS_ICMSG_TYPE_NEGOTIATE: - error = vmbus_ic_negomsg(sc, data, &dlen); + error = vmbus_ic_negomsg(sc, data, &dlen, + VMBUS_HEARTBEAT_FWVER, VMBUS_HEARTBEAT_MSGVER); if (error) return; break; Modified: stable/10/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_kvp.c Fri Nov 11 03:41:36 2016 (r308498) +++ stable/10/sys/dev/hyperv/utilities/hv_kvp.c Fri Nov 11 03:43:06 2016 (r308499) @@ -61,7 +61,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include "hv_util.h" #include "unicode.h" @@ -74,6 +76,12 @@ __FBSDID("$FreeBSD$"); #define KVP_ERROR 1 #define kvp_hdr hdr.kvp_hdr +#define KVP_FWVER_MAJOR 3 +#define KVP_FWVER VMBUS_IC_VERSION(KVP_FWVER_MAJOR, 0) + +#define KVP_MSGVER_MAJOR 4 +#define KVP_MSGVER VMBUS_IC_VERSION(KVP_MSGVER_MAJOR, 0) + /* hv_kvp debug control */ static int hv_kvp_log = 0; @@ -208,52 +216,10 @@ hv_kvp_transaction_init(hv_kvp_sc *sc, u sc->host_msg_id = request_id; sc->rcv_buf = rcv_buf; sc->host_kvp_msg = (struct hv_kvp_msg *)&rcv_buf[ - sizeof(struct hv_vmbus_pipe_hdr) + - sizeof(struct hv_vmbus_icmsg_hdr)]; + sizeof(struct hv_vmbus_pipe_hdr) + + sizeof(struct hv_vmbus_icmsg_hdr)]; } - -/* - * hv_kvp - version neogtiation function - */ -static void -hv_kvp_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf) -{ - struct hv_vmbus_icmsg_negotiate *negop; - int icframe_vercnt; - int icmsg_vercnt; - - icmsghdrp->icmsgsize = 0x10; - - negop = (struct hv_vmbus_icmsg_negotiate *)&buf[ - sizeof(struct hv_vmbus_pipe_hdr) + - sizeof(struct hv_vmbus_icmsg_hdr)]; - icframe_vercnt = negop->icframe_vercnt; - icmsg_vercnt = negop->icmsg_vercnt; - - /* - * Select the framework version number we will support - */ - if ((icframe_vercnt >= 2) && (negop->icversion_data[1].major == 3)) { - icframe_vercnt = 3; - if (icmsg_vercnt > 2) - icmsg_vercnt = 4; - else - icmsg_vercnt = 3; - } else { - icframe_vercnt = 1; - icmsg_vercnt = 1; - } - - negop->icframe_vercnt = 1; - negop->icmsg_vercnt = 1; - negop->icversion_data[0].major = icframe_vercnt; - negop->icversion_data[0].minor = 0; - negop->icversion_data[1].major = icmsg_vercnt; - negop->icversion_data[1].minor = 0; -} - - /* * Convert ip related info in umsg from utf8 to utf16 and store in hmsg */ @@ -578,7 +544,8 @@ hv_kvp_respond_host(hv_kvp_sc *sc, int e error = HV_KVP_E_FAIL; hv_icmsg_hdrp->status = error; - hv_icmsg_hdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | HV_ICMSGHDRFLAG_RESPONSE; + hv_icmsg_hdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | + HV_ICMSGHDRFLAG_RESPONSE; error = vmbus_chan_send(vmbus_get_channel(sc->dev), VMBUS_CHANPKT_TYPE_INBAND, 0, sc->rcv_buf, sc->host_msg_len, @@ -622,8 +589,8 @@ hv_kvp_process_request(void *context, in uint32_t recvlen = 0; uint64_t requestid; struct hv_vmbus_icmsg_hdr *icmsghdrp; - int ret = 0; - hv_kvp_sc *sc; + int ret = 0, error; + hv_kvp_sc *sc; hv_kvp_log_info("%s: entering hv_kvp_process_request\n", __func__); @@ -637,14 +604,15 @@ hv_kvp_process_request(void *context, in /* XXX check recvlen to make sure that it contains enough data */ while ((ret == 0) && (recvlen > 0)) { - icmsghdrp = (struct hv_vmbus_icmsg_hdr *) - &kvp_buf[sizeof(struct hv_vmbus_pipe_hdr)]; + &kvp_buf[sizeof(struct hv_vmbus_pipe_hdr)]; hv_kvp_transaction_init(sc, recvlen, requestid, kvp_buf); if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { - hv_kvp_negotiate_version(icmsghdrp, kvp_buf); - hv_kvp_respond_host(sc, ret); + error = vmbus_ic_negomsg(&sc->util_sc, + kvp_buf, &recvlen, KVP_FWVER, KVP_MSGVER); + /* XXX handle vmbus_ic_negomsg failure. */ + hv_kvp_respond_host(sc, error); /* * It is ok to not acquire the mutex before setting Modified: stable/10/sys/dev/hyperv/utilities/hv_kvp.h ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_kvp.h Fri Nov 11 03:41:36 2016 (r308498) +++ stable/10/sys/dev/hyperv/utilities/hv_kvp.h Fri Nov 11 03:43:06 2016 (r308499) @@ -28,7 +28,6 @@ #ifndef _KVP_H #define _KVP_H - /* * An implementation of HyperV key value pair (KVP) functionality for FreeBSD * @@ -178,9 +177,9 @@ struct hv_kvp_ipaddr_value { }__attribute__((packed)); struct hv_kvp_hdr { - uint8_t operation; - uint8_t pool; - uint16_t pad; + uint8_t operation; + uint8_t pool; + uint16_t pad; } __attribute__((packed)); struct hv_kvp_exchg_msg_value { Modified: stable/10/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_shutdown.c Fri Nov 11 03:41:36 2016 (r308498) +++ stable/10/sys/dev/hyperv/utilities/hv_shutdown.c Fri Nov 11 03:43:06 2016 (r308499) @@ -41,6 +41,14 @@ __FBSDID("$FreeBSD$"); #include "vmbus_if.h" +#define VMBUS_SHUTDOWN_FWVER_MAJOR 3 +#define VMBUS_SHUTDOWN_FWVER \ + VMBUS_IC_VERSION(VMBUS_SHUTDOWN_FWVER_MAJOR, 0) + +#define VMBUS_SHUTDOWN_MSGVER_MAJOR 3 +#define VMBUS_SHUTDOWN_MSGVER \ + VMBUS_IC_VERSION(VMBUS_SHUTDOWN_MSGVER_MAJOR, 0) + static const struct vmbus_ic_desc vmbus_shutdown_descs[] = { { .ic_guid = { .hv_guid = { @@ -82,7 +90,8 @@ vmbus_shutdown_cb(struct vmbus_channel * */ switch (hdr->ic_type) { case VMBUS_ICMSG_TYPE_NEGOTIATE: - error = vmbus_ic_negomsg(sc, data, &dlen); + error = vmbus_ic_negomsg(sc, data, &dlen, + VMBUS_SHUTDOWN_FWVER, VMBUS_SHUTDOWN_MSGVER); if (error) return; break; Modified: stable/10/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_timesync.c Fri Nov 11 03:41:36 2016 (r308498) +++ stable/10/sys/dev/hyperv/utilities/hv_timesync.c Fri Nov 11 03:43:06 2016 (r308499) @@ -42,6 +42,14 @@ __FBSDID("$FreeBSD$"); #include "vmbus_if.h" +#define VMBUS_TIMESYNC_FWVER_MAJOR 3 +#define VMBUS_TIMESYNC_FWVER \ + VMBUS_IC_VERSION(VMBUS_TIMESYNC_FWVER_MAJOR, 0) + +#define VMBUS_TIMESYNC_MSGVER_MAJOR 3 +#define VMBUS_TIMESYNC_MSGVER \ + VMBUS_IC_VERSION(VMBUS_TIMESYNC_MSGVER_MAJOR, 0) + static const struct vmbus_ic_desc vmbus_timesync_descs[] = { { .ic_guid = { .hv_guid = { @@ -162,7 +170,8 @@ vmbus_timesync_cb(struct vmbus_channel * */ switch (hdr->ic_type) { case VMBUS_ICMSG_TYPE_NEGOTIATE: - error = vmbus_ic_negomsg(sc, data, &dlen); + error = vmbus_ic_negomsg(sc, data, &dlen, + VMBUS_TIMESYNC_FWVER, VMBUS_TIMESYNC_MSGVER); if (error) return; break; Modified: stable/10/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_util.c Fri Nov 11 03:41:36 2016 (r308498) +++ stable/10/sys/dev/hyperv/utilities/hv_util.c Fri Nov 11 03:43:06 2016 (r308499) @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -53,52 +54,145 @@ __offsetof(struct vmbus_icmsg_negotiate, ic_ver[VMBUS_IC_VERCNT]) CTASSERT(VMBUS_IC_NEGOSZ < VMBUS_IC_BRSIZE); +static int vmbus_ic_fwver_sysctl(SYSCTL_HANDLER_ARGS); +static int vmbus_ic_msgver_sysctl(SYSCTL_HANDLER_ARGS); + int -vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen0) +vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen0, + uint32_t fw_ver, uint32_t msg_ver) { struct vmbus_icmsg_negotiate *nego; - int cnt, major, dlen = *dlen0; + int i, cnt, dlen = *dlen0, error; + uint32_t sel_fw_ver, sel_msg_ver; + bool has_fw_ver, has_msg_ver; /* - * Preliminary message size verification + * Preliminary message verification. */ if (dlen < sizeof(*nego)) { device_printf(sc->ic_dev, "truncated ic negotiate, len %d\n", dlen); - return EINVAL; + return (EINVAL); } nego = data; + if (nego->ic_fwver_cnt == 0) { + device_printf(sc->ic_dev, "ic negotiate does not contain " + "framework version %u\n", nego->ic_fwver_cnt); + return (EINVAL); + } + if (nego->ic_msgver_cnt == 0) { + device_printf(sc->ic_dev, "ic negotiate does not contain " + "message version %u\n", nego->ic_msgver_cnt); + return (EINVAL); + } + cnt = nego->ic_fwver_cnt + nego->ic_msgver_cnt; if (dlen < __offsetof(struct vmbus_icmsg_negotiate, ic_ver[cnt])) { device_printf(sc->ic_dev, "ic negotiate does not contain " "versions %d\n", dlen); - return EINVAL; + return (EINVAL); + } + + error = EOPNOTSUPP; + + /* + * Find the best match framework version. + */ + has_fw_ver = false; + for (i = 0; i < nego->ic_fwver_cnt; ++i) { + if (VMBUS_ICVER_LE(nego->ic_ver[i], fw_ver)) { + if (!has_fw_ver) { + sel_fw_ver = nego->ic_ver[i]; + has_fw_ver = true; + } else if (VMBUS_ICVER_GT(nego->ic_ver[i], + sel_fw_ver)) { + sel_fw_ver = nego->ic_ver[i]; + } + } + } + if (!has_fw_ver) { + device_printf(sc->ic_dev, "failed to select framework " + "version\n"); + goto done; + } + + /* + * Fine the best match message version. + */ + has_msg_ver = false; + for (i = nego->ic_fwver_cnt; + i < nego->ic_fwver_cnt + nego->ic_msgver_cnt; ++i) { + if (VMBUS_ICVER_LE(nego->ic_ver[i], msg_ver)) { + if (!has_msg_ver) { + sel_msg_ver = nego->ic_ver[i]; + has_msg_ver = true; + } else if (VMBUS_ICVER_GT(nego->ic_ver[i], + sel_msg_ver)) { + sel_msg_ver = nego->ic_ver[i]; + } + } + } + if (!has_msg_ver) { + device_printf(sc->ic_dev, "failed to select message " + "version\n"); + goto done; } - /* Select major version; XXX looks wrong. */ - if (nego->ic_fwver_cnt >= 2 && VMBUS_ICVER_MAJOR(nego->ic_ver[1]) == 3) - major = 3; - else - major = 1; + error = 0; +done: + if (bootverbose || !has_fw_ver || !has_msg_ver) { + if (has_fw_ver) { + device_printf(sc->ic_dev, "sel framework version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(sel_fw_ver), + VMBUS_ICVER_MINOR(sel_fw_ver)); + } + for (i = 0; i < nego->ic_fwver_cnt; i++) { + device_printf(sc->ic_dev, "supp framework version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(nego->ic_ver[i]), + VMBUS_ICVER_MINOR(nego->ic_ver[i])); + } + + if (has_msg_ver) { + device_printf(sc->ic_dev, "sel message version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(sel_msg_ver), + VMBUS_ICVER_MINOR(sel_msg_ver)); + } + for (i = nego->ic_fwver_cnt; + i < nego->ic_fwver_cnt + nego->ic_msgver_cnt; i++) { + device_printf(sc->ic_dev, "supp message version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(nego->ic_ver[i]), + VMBUS_ICVER_MINOR(nego->ic_ver[i])); + } + } + if (error) + return (error); + + /* Record the selected versions. */ + sc->ic_fwver = sel_fw_ver; + sc->ic_msgver = sel_msg_ver; - /* One framework version */ + /* One framework version. */ nego->ic_fwver_cnt = 1; - nego->ic_ver[0] = VMBUS_IC_VERSION(major, 0); + nego->ic_ver[0] = sel_fw_ver; - /* One message version */ + /* One message version. */ nego->ic_msgver_cnt = 1; - nego->ic_ver[1] = VMBUS_IC_VERSION(major, 0); + nego->ic_ver[1] = sel_msg_ver; - /* Update data size */ + /* Update data size. */ nego->ic_hdr.ic_dsize = VMBUS_IC_NEGOSZ - sizeof(struct vmbus_icmsg_hdr); - /* Update total size, if necessary */ + /* Update total size, if necessary. */ if (dlen < VMBUS_IC_NEGOSZ) *dlen0 = VMBUS_IC_NEGOSZ; - return 0; + return (0); } int @@ -124,6 +218,8 @@ hv_util_attach(device_t dev, vmbus_chan_ { struct hv_util_sc *sc = device_get_softc(dev); struct vmbus_channel *chan = vmbus_get_channel(dev); + struct sysctl_oid_list *child; + struct sysctl_ctx_list *ctx; int error; sc->ic_dev = dev; @@ -146,9 +242,41 @@ hv_util_attach(device_t dev, vmbus_chan_ free(sc->receive_buffer, M_DEVBUF); return (error); } + + ctx = device_get_sysctl_ctx(dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "fw_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + vmbus_ic_fwver_sysctl, "A", "framework version"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "msg_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + vmbus_ic_msgver_sysctl, "A", "message version"); + return (0); } +static int +vmbus_ic_fwver_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hv_util_sc *sc = arg1; + char verstr[16]; + + snprintf(verstr, sizeof(verstr), "%u.%u", + VMBUS_ICVER_MAJOR(sc->ic_fwver), VMBUS_ICVER_MINOR(sc->ic_fwver)); + return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); +} + +static int +vmbus_ic_msgver_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hv_util_sc *sc = arg1; + char verstr[16]; + + snprintf(verstr, sizeof(verstr), "%u.%u", + VMBUS_ICVER_MAJOR(sc->ic_msgver), VMBUS_ICVER_MINOR(sc->ic_msgver)); + return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); +} + int hv_util_detach(device_t dev) { Modified: stable/10/sys/dev/hyperv/utilities/hv_util.h ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_util.h Fri Nov 11 03:41:36 2016 (r308498) +++ stable/10/sys/dev/hyperv/utilities/hv_util.h Fri Nov 11 03:43:06 2016 (r308499) @@ -42,6 +42,8 @@ typedef struct hv_util_sc { device_t ic_dev; uint8_t *receive_buffer; int ic_buflen; + uint32_t ic_fwver; /* framework version */ + uint32_t ic_msgver; /* message version */ } hv_util_sc; struct vmbus_ic_desc { @@ -54,6 +56,7 @@ struct vmbus_ic_desc { int hv_util_attach(device_t dev, vmbus_chan_callback_t cb); int hv_util_detach(device_t dev); int vmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]); -int vmbus_ic_negomsg(struct hv_util_sc *, void *data, int *dlen); +int vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen, + uint32_t fw_ver, uint32_t msg_ver); #endif Modified: stable/10/sys/dev/hyperv/utilities/hv_utilreg.h ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_utilreg.h Fri Nov 11 03:41:36 2016 (r308498) +++ stable/10/sys/dev/hyperv/utilities/hv_utilreg.h Fri Nov 11 03:43:06 2016 (r308499) @@ -76,16 +76,4 @@ typedef struct hv_vmbus_icmsg_negotiate hv_vmbus_ic_version icversion_data[1]; /* any size array */ } __packed hv_vmbus_icmsg_negotiate; -typedef struct hv_vmbus_shutdown_msg_data { - uint32_t reason_code; - uint32_t timeout_seconds; - uint32_t flags; - uint8_t display_message[2048]; -} __packed hv_vmbus_shutdown_msg_data; - -typedef struct hv_vmbus_heartbeat_msg_data { - uint64_t seq_num; - uint32_t reserved[8]; -} __packed hv_vmbus_heartbeat_msg_data; - #endif /* !_HV_UTILREG_H_ */ Modified: stable/10/sys/dev/hyperv/utilities/vmbus_icreg.h ============================================================================== --- stable/10/sys/dev/hyperv/utilities/vmbus_icreg.h Fri Nov 11 03:41:36 2016 (r308498) +++ stable/10/sys/dev/hyperv/utilities/vmbus_icreg.h Fri Nov 11 03:43:06 2016 (r308499) @@ -42,6 +42,12 @@ #define VMBUS_IC_VERSION(major, minor) ((major) | (((uint32_t)(minor)) << 16)) #define VMBUS_ICVER_MAJOR(ver) ((ver) & 0xffff) #define VMBUS_ICVER_MINOR(ver) (((ver) & 0xffff0000) >> 16) +#define VMBUS_ICVER_SWAP(ver) \ + ((VMBUS_ICVER_MAJOR((ver)) << 16) | VMBUS_ICVER_MINOR((ver))) +#define VMBUS_ICVER_LE(v1, v2) \ + (VMBUS_ICVER_SWAP((v1)) <= VMBUS_ICVER_SWAP((v2))) +#define VMBUS_ICVER_GT(v1, v2) \ + (VMBUS_ICVER_SWAP((v1)) > VMBUS_ICVER_SWAP((v2))) struct vmbus_pipe_hdr { uint32_t ph_flags; From owner-svn-src-all@freebsd.org Fri Nov 11 04:33:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F28C1C398B1; Fri, 11 Nov 2016 04:33:44 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7C136C8; Fri, 11 Nov 2016 04:33:44 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB4XhjH018411; Fri, 11 Nov 2016 04:33:43 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB4Xhlq018410; Fri, 11 Nov 2016 04:33:43 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110433.uAB4Xhlq018410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 04:33:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308500 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 04:33:45 -0000 Author: sephe Date: Fri Nov 11 04:33:43 2016 New Revision: 308500 URL: https://svnweb.freebsd.org/changeset/base/308500 Log: MFC 307893 hyperv/hn: Set baudrate properly PR: 208931 Submitted by: Eugene Grosbein Reported by: Eugene Grosbein Sponsored by: Microsoft Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 03:43:06 2016 (r308499) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 04:33:43 2016 (r308500) @@ -805,6 +805,7 @@ netvsc_attach(device_t dev) * Setup the ifnet for this interface. */ + ifp->if_baudrate = IF_Gbps(10); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; ifp->if_init = hn_init; From owner-svn-src-all@freebsd.org Fri Nov 11 04:39:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1F88C39A1A; Fri, 11 Nov 2016 04:39:03 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A503C92E; Fri, 11 Nov 2016 04:39:03 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB4d2bu018669; Fri, 11 Nov 2016 04:39:02 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB4d2su018667; Fri, 11 Nov 2016 04:39:02 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110439.uAB4d2su018667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 04:39:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308501 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 04:39:04 -0000 Author: sephe Date: Fri Nov 11 04:39:02 2016 New Revision: 308501 URL: https://svnweb.freebsd.org/changeset/base/308501 Log: MFC 307952,307953,308278 307952 hyperv/vmbus: Add missing white space. Submitted by: QianYue You Sponsored by: Microsoft 307953 hyperv/vmbus: Implement vmbus_chan_printf. And use it for vmbus channel logging, which can log the channel owner's name properly, instead of vmbus0. Submitted by: QianYue You Sponsored by: Microsoft 308278 hyperv/vmbus: Reset ch_dev, once the child is deleted. So it will not be mis-used later on, e.g. in vmbus_chan_printf(). Submitted by: dexuan Reported by: dexuan Sponsored by: Microsoft Modified: stable/10/sys/dev/hyperv/vmbus/vmbus.c stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus.c Fri Nov 11 04:33:43 2016 (r308500) +++ stable/10/sys/dev/hyperv/vmbus/vmbus.c Fri Nov 11 04:39:02 2016 (r308501) @@ -948,7 +948,7 @@ vmbus_intr_setup(struct vmbus_softc *sc) device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); return ENXIO; } - if(bootverbose) { + if (bootverbose) { device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n", sc->vmbus_idtvec); } @@ -1036,6 +1036,7 @@ vmbus_delete_child(struct vmbus_channel if (chan->ch_dev != NULL) { error = device_delete_child(chan->ch_vmbus->vmbus_dev, chan->ch_dev); + chan->ch_dev = NULL; } mtx_unlock(&Giant); return (error); Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Nov 11 04:33:43 2016 (r308500) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Nov 11 04:39:02 2016 (r308501) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -39,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -90,6 +92,9 @@ static void vmbus_chan_msgproc_chresci struct vmbus_softc *, const struct vmbus_message *); +static int vmbus_chan_printf(const struct vmbus_channel *, + const char *, ...) __printflike(2, 3); + /* * Vmbus channel message processing. */ @@ -304,7 +309,7 @@ vmbus_chan_open(struct vmbus_channel *ch PAGE_SIZE, 0, txbr_size + rxbr_size, &chan->ch_bufring_dma, BUS_DMA_WAITOK); if (chan->ch_bufring == NULL) { - device_printf(chan->ch_dev, "bufring allocation failed\n"); + vmbus_chan_printf(chan, "bufring allocation failed\n"); return (ENOMEM); } @@ -336,7 +341,7 @@ vmbus_chan_open_br(struct vmbus_channel uint8_t *br; if (udlen > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { - device_printf(sc->vmbus_dev, + vmbus_chan_printf(chan, "invalid udata len %d for chan%u\n", udlen, chan->ch_id); return EINVAL; } @@ -386,7 +391,7 @@ vmbus_chan_open_br(struct vmbus_channel error = vmbus_chan_gpadl_connect(chan, cbr->cbr_paddr, txbr_size + rxbr_size, &chan->ch_bufring_gpadl); if (error) { - device_printf(sc->vmbus_dev, + vmbus_chan_printf(chan, "failed to connect bufring GPADL to chan%u\n", chan->ch_id); goto failed; } @@ -402,7 +407,7 @@ vmbus_chan_open_br(struct vmbus_channel */ mh = vmbus_msghc_get(sc, sizeof(*req)); if (mh == NULL) { - device_printf(sc->vmbus_dev, + vmbus_chan_printf(chan, "can not get msg hypercall for chopen(chan%u)\n", chan->ch_id); error = ENXIO; @@ -421,7 +426,7 @@ vmbus_chan_open_br(struct vmbus_channel error = vmbus_msghc_exec(sc, mh); if (error) { - device_printf(sc->vmbus_dev, + vmbus_chan_printf(chan, "chopen(chan%u) msg hypercall exec failed: %d\n", chan->ch_id, error); vmbus_msghc_put(sc, mh); @@ -436,13 +441,12 @@ vmbus_chan_open_br(struct vmbus_channel if (status == 0) { if (bootverbose) { - device_printf(sc->vmbus_dev, "chan%u opened\n", - chan->ch_id); + vmbus_chan_printf(chan, "chan%u opened\n", chan->ch_id); } return 0; } - device_printf(sc->vmbus_dev, "failed to open chan%u\n", chan->ch_id); + vmbus_chan_printf(chan, "failed to open chan%u\n", chan->ch_id); error = ENXIO; failed: @@ -485,7 +489,7 @@ vmbus_chan_gpadl_connect(struct vmbus_ch * We don't support multiple GPA ranges. */ if (range_len > UINT16_MAX) { - device_printf(sc->vmbus_dev, "GPA too large, %d pages\n", + vmbus_chan_printf(chan, "GPA too large, %d pages\n", page_count); return EOPNOTSUPP; } @@ -514,8 +518,8 @@ vmbus_chan_gpadl_connect(struct vmbus_ch chm_range.gpa_page[cnt]); mh = vmbus_msghc_get(sc, reqsz); if (mh == NULL) { - device_printf(sc->vmbus_dev, - "can not get msg hypercall for gpadl->chan%u\n", + vmbus_chan_printf(chan, + "can not get msg hypercall for gpadl_conn(chan%u)\n", chan->ch_id); return EIO; } @@ -533,8 +537,8 @@ vmbus_chan_gpadl_connect(struct vmbus_ch error = vmbus_msghc_exec(sc, mh); if (error) { - device_printf(sc->vmbus_dev, - "gpadl->chan%u msg hypercall exec failed: %d\n", + vmbus_chan_printf(chan, + "gpadl_conn(chan%u) msg hypercall exec failed: %d\n", chan->ch_id, error); vmbus_msghc_put(sc, mh); return error; @@ -570,13 +574,13 @@ vmbus_chan_gpadl_connect(struct vmbus_ch vmbus_msghc_put(sc, mh); if (status != 0) { - device_printf(sc->vmbus_dev, "gpadl->chan%u failed: " - "status %u\n", chan->ch_id, status); + vmbus_chan_printf(chan, "gpadl_conn(chan%u) failed: %u\n", + chan->ch_id, status); return EIO; } else { if (bootverbose) { - device_printf(sc->vmbus_dev, "gpadl->chan%u " - "succeeded\n", chan->ch_id); + vmbus_chan_printf(chan, + "gpadl_conn(chan%u) succeeded\n", chan->ch_id); } } return 0; @@ -595,8 +599,8 @@ vmbus_chan_gpadl_disconnect(struct vmbus mh = vmbus_msghc_get(sc, sizeof(*req)); if (mh == NULL) { - device_printf(sc->vmbus_dev, - "can not get msg hypercall for gpa x->chan%u\n", + vmbus_chan_printf(chan, + "can not get msg hypercall for gpadl_disconn(chan%u)\n", chan->ch_id); return EBUSY; } @@ -608,8 +612,8 @@ vmbus_chan_gpadl_disconnect(struct vmbus error = vmbus_msghc_exec(sc, mh); if (error) { - device_printf(sc->vmbus_dev, - "gpa x->chan%u msg hypercall exec failed: %d\n", + vmbus_chan_printf(chan, + "gpadl_disconn(chan%u) msg hypercall exec failed: %d\n", chan->ch_id, error); vmbus_msghc_put(sc, mh); return error; @@ -681,7 +685,7 @@ vmbus_chan_close_internal(struct vmbus_c */ mh = vmbus_msghc_get(sc, sizeof(*req)); if (mh == NULL) { - device_printf(sc->vmbus_dev, + vmbus_chan_printf(chan, "can not get msg hypercall for chclose(chan%u)\n", chan->ch_id); return; @@ -695,12 +699,12 @@ vmbus_chan_close_internal(struct vmbus_c vmbus_msghc_put(sc, mh); if (error) { - device_printf(sc->vmbus_dev, + vmbus_chan_printf(chan, "chclose(chan%u) msg hypercall exec failed: %d\n", chan->ch_id, error); return; } else if (bootverbose) { - device_printf(sc->vmbus_dev, "close chan%u\n", chan->ch_id); + vmbus_chan_printf(chan, "close chan%u\n", chan->ch_id); } /* @@ -890,13 +894,12 @@ vmbus_chan_recv(struct vmbus_channel *ch return (error); if (__predict_false(pkt.cph_hlen < VMBUS_CHANPKT_HLEN_MIN)) { - device_printf(chan->ch_dev, "invalid hlen %u\n", - pkt.cph_hlen); + vmbus_chan_printf(chan, "invalid hlen %u\n", pkt.cph_hlen); /* XXX this channel is dead actually. */ return (EIO); } if (__predict_false(pkt.cph_hlen > pkt.cph_tlen)) { - device_printf(chan->ch_dev, "invalid hlen %u and tlen %u\n", + vmbus_chan_printf(chan, "invalid hlen %u and tlen %u\n", pkt.cph_hlen, pkt.cph_tlen); /* XXX this channel is dead actually. */ return (EIO); @@ -933,13 +936,12 @@ vmbus_chan_recv_pkt(struct vmbus_channel return (error); if (__predict_false(pkt.cph_hlen < VMBUS_CHANPKT_HLEN_MIN)) { - device_printf(chan->ch_dev, "invalid hlen %u\n", - pkt.cph_hlen); + vmbus_chan_printf(chan, "invalid hlen %u\n", pkt.cph_hlen); /* XXX this channel is dead actually. */ return (EIO); } if (__predict_false(pkt.cph_hlen > pkt.cph_tlen)) { - device_printf(chan->ch_dev, "invalid hlen %u and tlen %u\n", + vmbus_chan_printf(chan, "invalid hlen %u and tlen %u\n", pkt.cph_hlen, pkt.cph_tlen); /* XXX this channel is dead actually. */ return (EIO); @@ -1082,8 +1084,8 @@ vmbus_chan_update_evtflagcnt(struct vmbu break; if (atomic_cmpset_int(flag_cnt_ptr, old_flag_cnt, flag_cnt)) { if (bootverbose) { - device_printf(sc->vmbus_dev, - "channel%u update cpu%d flag_cnt to %d\n", + vmbus_chan_printf(chan, + "chan%u update cpu%d flag_cnt to %d\n", chan->ch_id, chan->ch_cpuid, flag_cnt); } break; @@ -1154,11 +1156,6 @@ vmbus_chan_add(struct vmbus_channel *new return EINVAL; } - if (bootverbose) { - device_printf(sc->vmbus_dev, "chan%u subidx%u offer\n", - newchan->ch_id, newchan->ch_subidx); - } - mtx_lock(&sc->vmbus_prichan_lock); TAILQ_FOREACH(prichan, &sc->vmbus_prichans, ch_prilink) { /* @@ -1179,15 +1176,15 @@ vmbus_chan_add(struct vmbus_channel *new goto done; } else { mtx_unlock(&sc->vmbus_prichan_lock); - device_printf(sc->vmbus_dev, "duplicated primary " - "chan%u\n", newchan->ch_id); + device_printf(sc->vmbus_dev, + "duplicated primary chan%u\n", newchan->ch_id); return EINVAL; } } else { /* Sub-channel */ if (prichan == NULL) { mtx_unlock(&sc->vmbus_prichan_lock); - device_printf(sc->vmbus_dev, "no primary chan for " - "chan%u\n", newchan->ch_id); + device_printf(sc->vmbus_dev, + "no primary chan for chan%u\n", newchan->ch_id); return EINVAL; } /* @@ -1224,6 +1221,15 @@ done: mtx_lock(&sc->vmbus_chan_lock); vmbus_chan_ins_list(sc, newchan); mtx_unlock(&sc->vmbus_chan_lock); + + if (bootverbose) { + vmbus_chan_printf(newchan, "chan%u subidx%u offer\n", + newchan->ch_id, newchan->ch_subidx); + } + + /* Select default cpu for this channel. */ + vmbus_chan_cpu_default(newchan); + return 0; } @@ -1242,7 +1248,8 @@ vmbus_chan_cpu_set(struct vmbus_channel chan->ch_vcpuid = VMBUS_PCPU_GET(chan->ch_vmbus, vcpuid, cpu); if (bootverbose) { - printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", + vmbus_chan_printf(chan, + "chan%u assigned to cpu%u [vcpu%u]\n", chan->ch_id, chan->ch_cpuid, chan->ch_vcpuid); } } @@ -1338,9 +1345,6 @@ vmbus_chan_msgproc_choffer(struct vmbus_ TASK_INIT(&chan->ch_attach_task, 0, attach_fn, chan); TASK_INIT(&chan->ch_detach_task, 0, detach_fn, chan); - /* Select default cpu for this channel. */ - vmbus_chan_cpu_default(chan); - error = vmbus_chan_add(chan); if (error) { device_printf(sc->vmbus_dev, "add chan%u failed: %d\n", @@ -1365,11 +1369,6 @@ vmbus_chan_msgproc_chrescind(struct vmbu return; } - if (bootverbose) { - device_printf(sc->vmbus_dev, "chan%u rescinded\n", - note->chm_chanid); - } - /* * Find and remove the target channel from the channel list. */ @@ -1400,6 +1399,9 @@ vmbus_chan_msgproc_chrescind(struct vmbu mtx_unlock(&sc->vmbus_prichan_lock); } + if (bootverbose) + vmbus_chan_printf(chan, "chan%u rescinded\n", note->chm_chanid); + /* Detach the target channel. */ taskqueue_enqueue(chan->ch_mgmt_tq, &chan->ch_detach_task); } @@ -1414,8 +1416,9 @@ vmbus_chan_release(struct vmbus_channel mh = vmbus_msghc_get(sc, sizeof(*req)); if (mh == NULL) { - device_printf(sc->vmbus_dev, "can not get msg hypercall for " - "chfree(chan%u)\n", chan->ch_id); + vmbus_chan_printf(chan, + "can not get msg hypercall for chfree(chan%u)\n", + chan->ch_id); return (ENXIO); } @@ -1427,13 +1430,12 @@ vmbus_chan_release(struct vmbus_channel vmbus_msghc_put(sc, mh); if (error) { - device_printf(sc->vmbus_dev, "chfree(chan%u) failed: %d", + vmbus_chan_printf(chan, + "chfree(chan%u) msg hypercall exec failed: %d\n", chan->ch_id, error); } else { - if (bootverbose) { - device_printf(sc->vmbus_dev, "chan%u freed\n", - chan->ch_id); - } + if (bootverbose) + vmbus_chan_printf(chan, "chan%u freed\n", chan->ch_id); } return (error); } @@ -1714,6 +1716,26 @@ vmbus_chan_rx_empty(const struct vmbus_c return (vmbus_rxbr_empty(&chan->ch_rxbr)); } +static int +vmbus_chan_printf(const struct vmbus_channel *chan, const char *fmt, ...) +{ + va_list ap; + device_t dev; + int retval; + + if (chan->ch_dev == NULL || !device_is_alive(chan->ch_dev)) + dev = chan->ch_vmbus->vmbus_dev; + else + dev = chan->ch_dev; + + retval = device_print_prettyname(dev); + va_start(ap, fmt); + retval += vprintf(fmt, ap); + va_end(ap); + + return (retval); +} + void vmbus_chan_run_task(struct vmbus_channel *chan, struct task *task) { From owner-svn-src-all@freebsd.org Fri Nov 11 05:07:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E57C3C39FDB; Fri, 11 Nov 2016 05:07:26 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF7D13B1; Fri, 11 Nov 2016 05:07:26 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB57P46030469; Fri, 11 Nov 2016 05:07:25 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB57PAE030465; Fri, 11 Nov 2016 05:07:25 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110507.uAB57PAE030465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 05:07:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308502 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 05:07:27 -0000 Author: sephe Date: Fri Nov 11 05:07:25 2016 New Revision: 308502 URL: https://svnweb.freebsd.org/changeset/base/308502 Log: MFC 307983 hyperv/hn: Properly configure RSS according to RSS capabilities Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8338 Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/10/sys/dev/hyperv/netvsc/ndis.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 04:39:02 2016 (r308501) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 05:07:25 2016 (r308502) @@ -256,6 +256,8 @@ struct hn_softc { int hn_ndis_tso_szmax; int hn_ndis_tso_sgmin; + int hn_rss_ind_size; + uint32_t hn_rss_hash; /* NDIS_HASH_ */ struct ndis_rssprm_toeplitz hn_rss; }; Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 04:39:02 2016 (r308501) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 05:07:25 2016 (r308502) @@ -331,6 +331,7 @@ static int hn_hwassist_sysctl(SYSCTL_HAN static int hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS); static int hn_check_iplen(const struct mbuf *, int); static int hn_create_tx_ring(struct hn_softc *, int); static void hn_destroy_tx_ring(struct hn_tx_ring *); @@ -786,6 +787,11 @@ netvsc_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxfilter", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_rxfilter_sysctl, "A", "rxfilter"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_hash", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_rss_hash_sysctl, "A", "RSS hash"); + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "rss_ind_size", + CTLFLAG_RD, &sc->hn_rss_ind_size, 0, "RSS indirect entry count"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_key", CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, hn_rss_key_sysctl, "IU", "RSS key"); @@ -2499,6 +2505,20 @@ back: } static int +hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + char hash_str[128]; + uint32_t hash; + + HN_LOCK(sc); + hash = sc->hn_rss_hash; + HN_UNLOCK(sc); + snprintf(hash_str, sizeof(hash_str), "%b", hash, NDIS_HASH_BITS); + return sysctl_handle_string(oidp, hash_str, sizeof(hash_str), req); +} + +static int hn_check_iplen(const struct mbuf *m, int hoff) { const struct ip *ip; @@ -3662,6 +3682,10 @@ hn_synth_attach(struct hn_softc *sc, int old_caps = sc->hn_caps; sc->hn_caps = 0; + /* Clear RSS stuffs. */ + sc->hn_rss_ind_size = 0; + sc->hn_rss_hash = 0; + /* * Attach the primary channel _before_ attaching NVS and RNDIS. */ @@ -3736,7 +3760,6 @@ hn_synth_attach(struct hn_softc *sc, int if_printf(sc->hn_ifp, "setup default RSS indirect " "table\n"); } - /* TODO: Take ndis_rss_caps.ndis_nind into account. */ for (i = 0; i < NDIS_HASH_INDCNT; ++i) rss->rss_ind[i] = i % nchan; sc->hn_flags |= HN_FLAG_HAS_RSSIND; Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 04:39:02 2016 (r308501) +++ stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 05:07:25 2016 (r308502) @@ -748,13 +748,14 @@ done: } int -hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt) +hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt0) { struct ndis_rss_caps in, caps; size_t caps_len; - int error; + int error, indsz, rxr_cnt, hash_fnidx; + uint32_t hash_func = 0, hash_types = 0; - *rxr_cnt = 0; + *rxr_cnt0 = 0; if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_20) return (EOPNOTSUPP); @@ -793,18 +794,73 @@ hn_rndis_query_rsscaps(struct hn_softc * return (EINVAL); } + /* + * Save information for later RSS configuration. + */ if (caps.ndis_nrxr == 0) { if_printf(sc->hn_ifp, "0 RX rings!?\n"); return (EINVAL); } - *rxr_cnt = caps.ndis_nrxr; + if (bootverbose) + if_printf(sc->hn_ifp, "%u RX rings\n", caps.ndis_nrxr); + rxr_cnt = caps.ndis_nrxr; + + if (caps.ndis_hdr.ndis_size == NDIS_RSS_CAPS_SIZE && + caps.ndis_hdr.ndis_rev >= NDIS_RSS_CAPS_REV_2) { + if (caps.ndis_nind > NDIS_HASH_INDCNT) { + if_printf(sc->hn_ifp, + "too many RSS indirect table entries %u\n", + caps.ndis_nind); + return (EOPNOTSUPP); + } + if (!powerof2(caps.ndis_nind)) { + if_printf(sc->hn_ifp, "RSS indirect table size is not " + "power-of-2 %u\n", caps.ndis_nind); + } - if (caps.ndis_hdr.ndis_size == NDIS_RSS_CAPS_SIZE) { if (bootverbose) { if_printf(sc->hn_ifp, "RSS indirect table size %u\n", caps.ndis_nind); } + indsz = caps.ndis_nind; + } else { + indsz = NDIS_HASH_INDCNT; + } + if (indsz < rxr_cnt) { + if_printf(sc->hn_ifp, "# of RX rings (%d) > " + "RSS indirect table size %d\n", rxr_cnt, indsz); + rxr_cnt = indsz; } + + /* + * NOTE: + * Toeplitz is at the lowest bit, and it is prefered; so ffs(), + * instead of fls(), is used here. + */ + hash_fnidx = ffs(caps.ndis_caps & NDIS_RSS_CAP_HASHFUNC_MASK); + if (hash_fnidx == 0) { + if_printf(sc->hn_ifp, "no hash functions, caps 0x%08x\n", + caps.ndis_caps); + return (EOPNOTSUPP); + } + hash_func = 1 << (hash_fnidx - 1); /* ffs is 1-based */ + + if (caps.ndis_caps & NDIS_RSS_CAP_IPV4) + hash_types |= NDIS_HASH_IPV4 | NDIS_HASH_TCP_IPV4; + if (caps.ndis_caps & NDIS_RSS_CAP_IPV6) + hash_types |= NDIS_HASH_IPV6 | NDIS_HASH_TCP_IPV6; + if (caps.ndis_caps & NDIS_RSS_CAP_IPV6_EX) + hash_types |= NDIS_HASH_IPV6_EX | NDIS_HASH_TCP_IPV6_EX; + if (hash_types == 0) { + if_printf(sc->hn_ifp, "no hash types, caps 0x%08x\n", + caps.ndis_caps); + return (EOPNOTSUPP); + } + + /* Commit! */ + sc->hn_rss_ind_size = indsz; + sc->hn_rss_hash = hash_func | hash_types; + *rxr_cnt0 = rxr_cnt; return (0); } @@ -1034,7 +1090,7 @@ hn_rndis_conf_rss(struct hn_softc *sc, u { struct ndis_rssprm_toeplitz *rss = &sc->hn_rss; struct ndis_rss_params *prm = &rss->rss_params; - int error; + int error, rss_size; /* * Only NDIS 6.20+ is supported: @@ -1044,21 +1100,29 @@ hn_rndis_conf_rss(struct hn_softc *sc, u KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_20, ("NDIS 6.20+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); + /* XXX only one can be specified through, popcnt? */ + KASSERT((sc->hn_rss_hash & NDIS_HASH_FUNCTION_MASK), ("no hash func")); + KASSERT((sc->hn_rss_hash & NDIS_HASH_TYPE_MASK), ("no hash types")); + KASSERT(sc->hn_rss_ind_size > 0, ("no indirect table size")); + + if (bootverbose) { + if_printf(sc->hn_ifp, "RSS indirect table size %d, " + "hash 0x%08x\n", sc->hn_rss_ind_size, sc->hn_rss_hash); + } + /* * NOTE: * DO NOT whack rss_key and rss_ind, which are setup by the caller. */ memset(prm, 0, sizeof(*prm)); + rss_size = NDIS_RSSPRM_TOEPLITZ_SIZE(sc->hn_rss_ind_size); prm->ndis_hdr.ndis_type = NDIS_OBJTYPE_RSS_PARAMS; prm->ndis_hdr.ndis_rev = NDIS_RSS_PARAMS_REV_2; - prm->ndis_hdr.ndis_size = sizeof(*rss); + prm->ndis_hdr.ndis_size = rss_size; prm->ndis_flags = flags; - prm->ndis_hash = NDIS_HASH_FUNCTION_TOEPLITZ | - NDIS_HASH_IPV4 | NDIS_HASH_TCP_IPV4 | - NDIS_HASH_IPV6 | NDIS_HASH_TCP_IPV6; - /* TODO: Take ndis_rss_caps.ndis_nind into account */ - prm->ndis_indsize = sizeof(rss->rss_ind); + prm->ndis_hash = sc->hn_rss_hash; + prm->ndis_indsize = sizeof(rss->rss_ind[0]) * sc->hn_rss_ind_size; prm->ndis_indoffset = __offsetof(struct ndis_rssprm_toeplitz, rss_ind[0]); prm->ndis_keysize = sizeof(rss->rss_key); @@ -1066,7 +1130,7 @@ hn_rndis_conf_rss(struct hn_softc *sc, u __offsetof(struct ndis_rssprm_toeplitz, rss_key[0]); error = hn_rndis_set(sc, OID_GEN_RECEIVE_SCALE_PARAMETERS, - rss, sizeof(*rss)); + rss, rss_size); if (error) { if_printf(sc->hn_ifp, "RSS config failed: %d\n", error); } else { Modified: stable/10/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/ndis.h Fri Nov 11 04:39:02 2016 (r308501) +++ stable/10/sys/dev/hyperv/netvsc/ndis.h Fri Nov 11 05:07:25 2016 (r308502) @@ -57,6 +57,10 @@ #define NDIS_HASH_TCP_IPV6 0x00001000 #define NDIS_HASH_TCP_IPV6_EX 0x00002000 +/* Hash description for use with printf(9) %b identifier. */ +#define NDIS_HASH_BITS \ + "\20\1TOEPLITZ\11IP4\12TCP4\13IP6\14IP6EX\15TCP6\16TCP6EX" + #define NDIS_HASH_KEYSIZE_TOEPLITZ 40 #define NDIS_HASH_INDCNT 128 @@ -142,7 +146,7 @@ struct ndis_offload_params { */ struct ndis_rss_caps { struct ndis_object_hdr ndis_hdr; - uint32_t ndis_flags; /* NDIS_RSS_CAP_ */ + uint32_t ndis_caps; /* NDIS_RSS_CAP_ */ uint32_t ndis_nmsi; /* # of MSIs */ uint32_t ndis_nrxr; /* # of RX rings */ /* NDIS >= 6.30 */ @@ -165,7 +169,8 @@ struct ndis_rss_caps { #define NDIS_RSS_CAP_IPV4 0x00000100 #define NDIS_RSS_CAP_IPV6 0x00000200 #define NDIS_RSS_CAP_IPV6_EX 0x00000400 -#define NDIS_RSS_CAP_HASH_TOEPLITZ 0x00000001 +#define NDIS_RSS_CAP_HASH_TOEPLITZ NDIS_HASH_FUNCTION_TOEPLITZ +#define NDIS_RSS_CAP_HASHFUNC_MASK NDIS_HASH_FUNCTION_MASK /* * OID_GEN_RECEIVE_SCALE_PARAMETERS @@ -209,6 +214,9 @@ struct ndis_rssprm_toeplitz { uint32_t rss_ind[NDIS_HASH_INDCNT]; }; +#define NDIS_RSSPRM_TOEPLITZ_SIZE(nind) \ + __offsetof(struct ndis_rssprm_toeplitz, rss_ind[nind]) + /* * OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES * ndis_type: NDIS_OBJTYPE_OFFLOAD From owner-svn-src-all@freebsd.org Fri Nov 11 05:17:05 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75C04C3A2CC; Fri, 11 Nov 2016 05:17:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F044AE1; Fri, 11 Nov 2016 05:17:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB5H4ct034385; Fri, 11 Nov 2016 05:17:04 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB5H4IW034380; Fri, 11 Nov 2016 05:17:04 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110517.uAB5H4IW034380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 05:17:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308503 - in stable/10/sys: dev/hyperv/netvsc net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 05:17:05 -0000 Author: sephe Date: Fri Nov 11 05:17:03 2016 New Revision: 308503 URL: https://svnweb.freebsd.org/changeset/base/308503 Log: MFC 307985-307988 307985 hyperv/hn: Nuke unnecessary M_NETVSC Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8340 307986 hyperv/hn: Move %b format string for capabilities near their definition. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8341 307987 hyperv/hn: Define empty packet filter. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8342 307988 hyperv/hn: Shuffle chimney sending buffer alloc/free around. This paves way for more chimney sending buffer reorganization. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8343 Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/if_hnvar.h stable/10/sys/net/rndis.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Nov 11 05:07:25 2016 (r308502) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Nov 11 05:17:03 2016 (r308503) @@ -51,8 +51,6 @@ #include #include -MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper-V netvsc driver"); - /* * Forward declarations */ @@ -74,33 +72,6 @@ static const uint32_t hn_nvs_version[] HN_NVS_VERSION_1 }; -uint32_t -hn_chim_alloc(struct hn_softc *sc) -{ - int i, bmap_cnt = sc->hn_chim_bmap_cnt; - u_long *bmap = sc->hn_chim_bmap; - uint32_t ret = HN_NVS_CHIM_IDX_INVALID; - - for (i = 0; i < bmap_cnt; ++i) { - int idx; - - idx = ffsl(~bmap[i]); - if (idx == 0) - continue; - - --idx; /* ffsl is 1-based */ - KASSERT(i * LONG_BIT + idx < sc->hn_chim_cnt, - ("invalid i %d and idx %d", i, idx)); - - if (atomic_testandset_long(&bmap[i], idx)) - continue; - - ret = i * LONG_BIT + idx; - break; - } - return (ret); -} - static const void * hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, void *req, int reqlen, size_t *resplen0, uint32_t type) @@ -307,7 +278,7 @@ hn_nvs_conn_chim(struct hn_softc *sc) sc->hn_chim_bmap_cnt = sc->hn_chim_cnt / LONG_BIT; sc->hn_chim_bmap = malloc(sc->hn_chim_bmap_cnt * sizeof(u_long), - M_NETVSC, M_WAITOK | M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); /* Done! */ sc->hn_flags |= HN_FLAG_CHIM_CONNECTED; @@ -426,7 +397,7 @@ hn_nvs_disconn_chim(struct hn_softc *sc) } if (sc->hn_chim_bmap != NULL) { - free(sc->hn_chim_bmap, M_NETVSC); + free(sc->hn_chim_bmap, M_DEVBUF); sc->hn_chim_bmap = NULL; } return (0); @@ -649,25 +620,6 @@ hn_nvs_sent_none(struct hn_send_ctx *snd /* EMPTY */ } -void -hn_chim_free(struct hn_softc *sc, uint32_t chim_idx) -{ - u_long mask; - uint32_t idx; - - idx = chim_idx / LONG_BIT; - KASSERT(idx < sc->hn_chim_bmap_cnt, - ("invalid chimney index 0x%x", chim_idx)); - - mask = 1UL << (chim_idx % LONG_BIT); - KASSERT(sc->hn_chim_bmap[idx] & mask, - ("index bitmap 0x%lx, chimney index %u, " - "bitmap idx %d, bitmask 0x%lx", - sc->hn_chim_bmap[idx], chim_idx, idx, mask)); - - atomic_clear_long(&sc->hn_chim_bmap[idx], mask); -} - int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch0) { Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 05:07:25 2016 (r308502) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 05:17:03 2016 (r308503) @@ -66,8 +66,6 @@ #define HN_USE_TXDESC_BUFRING -MALLOC_DECLARE(M_NETVSC); - /* * The following arguably belongs in a separate header file */ @@ -278,6 +276,11 @@ struct hn_softc { #define HN_CAP_TSO6 0x0100 #define HN_CAP_HASHVAL 0x0200 +/* Capability description for use with printf(9) %b identifier. */ +#define HN_CAP_BITS \ + "\020\1VLAN\2MTU\3IPCS\4TCP4CS\5TCP6CS" \ + "\6UDP4CS\7UDP6CS\10TSO4\11TSO6\12HASHVAL" + #define HN_LINK_FLAG_LINKUP 0x0001 #define HN_LINK_FLAG_NETCHG 0x0002 Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 05:07:25 2016 (r308502) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 05:17:03 2016 (r308503) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -459,6 +460,52 @@ hn_sendpkt_rndis_chim(struct hn_tx_ring &rndis, sizeof(rndis), &txd->send_ctx)); } +static __inline uint32_t +hn_chim_alloc(struct hn_softc *sc) +{ + int i, bmap_cnt = sc->hn_chim_bmap_cnt; + u_long *bmap = sc->hn_chim_bmap; + uint32_t ret = HN_NVS_CHIM_IDX_INVALID; + + for (i = 0; i < bmap_cnt; ++i) { + int idx; + + idx = ffsl(~bmap[i]); + if (idx == 0) + continue; + + --idx; /* ffsl is 1-based */ + KASSERT(i * LONG_BIT + idx < sc->hn_chim_cnt, + ("invalid i %d and idx %d", i, idx)); + + if (atomic_testandset_long(&bmap[i], idx)) + continue; + + ret = i * LONG_BIT + idx; + break; + } + return (ret); +} + +static __inline void +hn_chim_free(struct hn_softc *sc, uint32_t chim_idx) +{ + u_long mask; + uint32_t idx; + + idx = chim_idx / LONG_BIT; + KASSERT(idx < sc->hn_chim_bmap_cnt, + ("invalid chimney index 0x%x", chim_idx)); + + mask = 1UL << (chim_idx % LONG_BIT); + KASSERT(sc->hn_chim_bmap[idx] & mask, + ("index bitmap 0x%lx, chimney index %u, " + "bitmap idx %d, bitmask 0x%lx", + sc->hn_chim_bmap[idx], chim_idx, idx, mask)); + + atomic_clear_long(&sc->hn_chim_bmap[idx], mask); +} + static int hn_set_rxfilter(struct hn_softc *sc) { @@ -2399,18 +2446,7 @@ hn_caps_sysctl(SYSCTL_HANDLER_ARGS) HN_LOCK(sc); caps = sc->hn_caps; HN_UNLOCK(sc); - snprintf(caps_str, sizeof(caps_str), "%b", caps, - "\020" - "\001VLAN" - "\002MTU" - "\003IPCS" - "\004TCP4CS" - "\005TCP6CS" - "\006UDP4CS" - "\007UDP6CS" - "\010TSO4" - "\011TSO6" - "\012HASHVAL"); + snprintf(caps_str, sizeof(caps_str), "%b", caps, HN_CAP_BITS); return sysctl_handle_string(oidp, caps_str, sizeof(caps_str), req); } @@ -2626,7 +2662,7 @@ hn_create_rx_data(struct hn_softc *sc, i sc->hn_rx_ring_inuse = sc->hn_rx_ring_cnt; sc->hn_rx_ring = malloc(sizeof(struct hn_rx_ring) * sc->hn_rx_ring_cnt, - M_NETVSC, M_WAITOK | M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); #if defined(INET) || defined(INET6) #if __FreeBSD_version >= 1100095 @@ -2667,7 +2703,7 @@ hn_create_rx_data(struct hn_softc *sc, i rxr->hn_ifp = sc->hn_ifp; if (i < sc->hn_tx_ring_cnt) rxr->hn_txr = &sc->hn_tx_ring[i]; - rxr->hn_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); + rxr->hn_rdbuf = malloc(NETVSC_PACKET_SIZE, M_DEVBUF, M_WAITOK); rxr->hn_rx_idx = i; rxr->hn_rxbuf = sc->hn_rxbuf; @@ -2814,9 +2850,9 @@ hn_destroy_rx_data(struct hn_softc *sc) #if defined(INET) || defined(INET6) tcp_lro_free(&rxr->hn_lro); #endif - free(rxr->hn_rdbuf, M_NETVSC); + free(rxr->hn_rdbuf, M_DEVBUF); } - free(sc->hn_rx_ring, M_NETVSC); + free(sc->hn_rx_ring, M_DEVBUF); sc->hn_rx_ring = NULL; sc->hn_rx_ring_cnt = 0; @@ -2841,11 +2877,11 @@ hn_create_tx_ring(struct hn_softc *sc, i txr->hn_txdesc_cnt = HN_TX_DESC_CNT; txr->hn_txdesc = malloc(sizeof(struct hn_txdesc) * txr->hn_txdesc_cnt, - M_NETVSC, M_WAITOK | M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); #ifndef HN_USE_TXDESC_BUFRING SLIST_INIT(&txr->hn_txlist); #else - txr->hn_txdesc_br = buf_ring_alloc(txr->hn_txdesc_cnt, M_NETVSC, + txr->hn_txdesc_br = buf_ring_alloc(txr->hn_txdesc_cnt, M_DEVBUF, M_WAITOK, &txr->hn_tx_lock); #endif @@ -2863,7 +2899,7 @@ hn_create_tx_ring(struct hn_softc *sc, i TASK_INIT(&txr->hn_txeof_task, 0, hn_xmit_txeof_taskfunc, txr); br_depth = hn_get_txswq_depth(txr); - txr->hn_mbuf_br = buf_ring_alloc(br_depth, M_NETVSC, + txr->hn_mbuf_br = buf_ring_alloc(br_depth, M_DEVBUF, M_WAITOK, &txr->hn_tx_lock); } @@ -3046,14 +3082,14 @@ hn_destroy_tx_ring(struct hn_tx_ring *tx bus_dma_tag_destroy(txr->hn_tx_rndis_dtag); #ifdef HN_USE_TXDESC_BUFRING - buf_ring_free(txr->hn_txdesc_br, M_NETVSC); + buf_ring_free(txr->hn_txdesc_br, M_DEVBUF); #endif - free(txr->hn_txdesc, M_NETVSC); + free(txr->hn_txdesc, M_DEVBUF); txr->hn_txdesc = NULL; if (txr->hn_mbuf_br != NULL) - buf_ring_free(txr->hn_mbuf_br, M_NETVSC); + buf_ring_free(txr->hn_mbuf_br, M_DEVBUF); #ifndef HN_USE_TXDESC_BUFRING mtx_destroy(&txr->hn_txlist_spin); @@ -3085,7 +3121,7 @@ hn_create_tx_data(struct hn_softc *sc, i sc->hn_tx_ring_inuse = sc->hn_tx_ring_cnt; sc->hn_tx_ring = malloc(sizeof(struct hn_tx_ring) * sc->hn_tx_ring_cnt, - M_NETVSC, M_WAITOK | M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); ctx = device_get_sysctl_ctx(sc->hn_dev); child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->hn_dev)); @@ -3245,7 +3281,7 @@ hn_destroy_tx_data(struct hn_softc *sc) for (i = 0; i < sc->hn_tx_ring_cnt; ++i) hn_destroy_tx_ring(&sc->hn_tx_ring[i]); - free(sc->hn_tx_ring, M_NETVSC); + free(sc->hn_tx_ring, M_DEVBUF); sc->hn_tx_ring = NULL; sc->hn_tx_ring_cnt = 0; @@ -3880,8 +3916,8 @@ hn_suspend_data(struct hn_softc *sc) /* * Disable RX by clearing RX filter. */ - hn_rndis_set_rxfilter(sc, 0); - sc->hn_rx_filter = 0; + sc->hn_rx_filter = NDIS_PACKET_TYPE_NONE; + hn_rndis_set_rxfilter(sc, sc->hn_rx_filter); /* * Give RNDIS enough time to flush all pending data packets. @@ -4195,12 +4231,12 @@ hn_chan_callback(struct vmbus_channel *c } else if (ret == ENOBUFS) { /* Handle large packet */ if (bufferlen > NETVSC_PACKET_SIZE) { - free(buffer, M_NETVSC); + free(buffer, M_DEVBUF); buffer = NULL; } /* alloc new buffer */ - buffer = malloc(bytes_rxed, M_NETVSC, M_NOWAIT); + buffer = malloc(bytes_rxed, M_DEVBUF, M_NOWAIT); if (buffer == NULL) { if_printf(rxr->hn_ifp, "hv_cb malloc buffer failed, len=%u\n", @@ -4216,7 +4252,7 @@ hn_chan_callback(struct vmbus_channel *c } while (1); if (bufferlen > NETVSC_PACKET_SIZE) - free(buffer, M_NETVSC); + free(buffer, M_DEVBUF); hv_rf_channel_rollup(rxr, rxr->hn_txr); } Modified: stable/10/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 05:07:25 2016 (r308502) +++ stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 05:17:03 2016 (r308503) @@ -94,9 +94,6 @@ hn_nvs_send_sglist(struct vmbus_channel struct vmbus_xact; struct rndis_packet_msg; -uint32_t hn_chim_alloc(struct hn_softc *sc); -void hn_chim_free(struct hn_softc *sc, uint32_t chim_idx); - int hn_rndis_attach(struct hn_softc *sc, int mtu); void hn_rndis_detach(struct hn_softc *sc); int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); @@ -106,7 +103,7 @@ int hn_rndis_query_rsscaps(struct hn_so int hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr); int hn_rndis_get_linkstatus(struct hn_softc *sc, uint32_t *link_status); -/* filter: NDIS_PACKET_TYPE_ or 0. */ +/* filter: NDIS_PACKET_TYPE_. */ int hn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter); int hn_nvs_attach(struct hn_softc *sc, int mtu); Modified: stable/10/sys/net/rndis.h ============================================================================== --- stable/10/sys/net/rndis.h Fri Nov 11 05:07:25 2016 (r308502) +++ stable/10/sys/net/rndis.h Fri Nov 11 05:17:03 2016 (r308503) @@ -352,6 +352,7 @@ struct rndis_keepalive_comp { }; /* Packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ +#define NDIS_PACKET_TYPE_NONE 0x00000000 #define NDIS_PACKET_TYPE_DIRECTED 0x00000001 #define NDIS_PACKET_TYPE_MULTICAST 0x00000002 #define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 From owner-svn-src-all@freebsd.org Fri Nov 11 05:37:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1A80C3AAF7; Fri, 11 Nov 2016 05:37:06 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5FFFE158A; Fri, 11 Nov 2016 05:37:06 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB5b5Pb042701; Fri, 11 Nov 2016 05:37:05 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB5b5x7042696; Fri, 11 Nov 2016 05:37:05 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110537.uAB5b5x7042696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 05:37:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308504 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 05:37:06 -0000 Author: sephe Date: Fri Nov 11 05:37:04 2016 New Revision: 308504 URL: https://svnweb.freebsd.org/changeset/base/308504 Log: MFC 307989-307991,308010 307989 hyperv/hn: Move hn_softc to if_hnvar.h While I'm here, use consistent macro names. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8345 307990 hyperv/hn: Move send context to NVS domain. Since all sends are encapsulated in NVS messages. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8346 307991 hyperv/hn: NVS inclusion cleanup and forward declare functions. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8347 308010 hyperv/hn: Change header guardian; in preparation for the upcoming rename. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8352 Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Nov 11 05:17:03 2016 (r308503) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Nov 11 05:37:04 2016 (r308504) @@ -24,46 +24,59 @@ * 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$ */ -/** - * HyperV vmbus network VSC (virtual services client) module - * +/* + * Network Virtualization Service. */ +#include +__FBSDID("$FreeBSD$"); + +#include "opt_inet6.h" +#include "opt_inet.h" #include #include -#include #include -#include +#include +#include +#include + #include #include -#include -#include +#include + +#include +#include #include +#include +#include #include -#include -#include + +#include #include #include +#include -/* - * Forward declarations - */ -static int hn_nvs_conn_chim(struct hn_softc *sc); -static int hn_nvs_conn_rxbuf(struct hn_softc *); -static int hn_nvs_disconn_chim(struct hn_softc *sc); -static int hn_nvs_disconn_rxbuf(struct hn_softc *sc); -static void hn_nvs_sent_none(struct hn_send_ctx *sndc, - struct hn_softc *, struct vmbus_channel *chan, - const void *, int); +static int hn_nvs_conn_chim(struct hn_softc *); +static int hn_nvs_conn_rxbuf(struct hn_softc *); +static int hn_nvs_disconn_chim(struct hn_softc *); +static int hn_nvs_disconn_rxbuf(struct hn_softc *); +static int hn_nvs_conf_ndis(struct hn_softc *, int); +static int hn_nvs_init_ndis(struct hn_softc *); +static int hn_nvs_doinit(struct hn_softc *, uint32_t); +static int hn_nvs_init(struct hn_softc *); +static const void *hn_nvs_xact_execute(struct hn_softc *, + struct vmbus_xact *, void *, int, + size_t *, uint32_t); +static void hn_nvs_sent_none(struct hn_nvs_sendctx *, + struct hn_softc *, struct vmbus_channel *, + const void *, int); -struct hn_send_ctx hn_send_ctx_none = - HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL); +struct hn_nvs_sendctx hn_nvs_sendctx_none = + HN_NVS_SENDCTX_INITIALIZER(hn_nvs_sent_none, NULL); static const uint32_t hn_nvs_version[] = { HN_NVS_VERSION_5, @@ -76,7 +89,7 @@ static const void * hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, void *req, int reqlen, size_t *resplen0, uint32_t type) { - struct hn_send_ctx sndc; + struct hn_nvs_sendctx sndc; size_t resplen, min_resplen = *resplen0; const struct hn_nvs_hdr *hdr; int error; @@ -87,7 +100,7 @@ hn_nvs_xact_execute(struct hn_softc *sc, /* * Execute the xact setup by the caller. */ - hn_send_ctx_init(&sndc, hn_nvs_sent_xact, xact); + hn_nvs_sendctx_init(&sndc, hn_nvs_sent_xact, xact); vmbus_xact_activate(xact); error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, @@ -120,7 +133,7 @@ hn_nvs_req_send(struct hn_softc *sc, voi { return (hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_NONE, - req, reqlen, &hn_send_ctx_none)); + req, reqlen, &hn_nvs_sendctx_none)); } static int @@ -137,9 +150,9 @@ hn_nvs_conn_rxbuf(struct hn_softc *sc) * Limit RXBUF size for old NVS. */ if (sc->hn_nvs_ver <= HN_NVS_VERSION_2) - rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY; + rxbuf_size = HN_RXBUF_SIZE_COMPAT; else - rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE; + rxbuf_size = HN_RXBUF_SIZE; /* * Connect the RXBUF GPADL to the primary channel. @@ -218,8 +231,7 @@ hn_nvs_conn_chim(struct hn_softc *sc) * Sub-channels just share this chimney sending buffer. */ error = vmbus_chan_gpadl_connect(sc->hn_prichan, - sc->hn_chim_dma.hv_paddr, NETVSC_SEND_BUFFER_SIZE, - &sc->hn_chim_gpadl); + sc->hn_chim_dma.hv_paddr, HN_CHIM_SIZE, &sc->hn_chim_gpadl); if (error) { if_printf(sc->hn_ifp, "chim gpadl conn failed: %d\n", error); goto cleanup; @@ -266,8 +278,8 @@ hn_nvs_conn_chim(struct hn_softc *sc) } sc->hn_chim_szmax = sectsz; - sc->hn_chim_cnt = NETVSC_SEND_BUFFER_SIZE / sc->hn_chim_szmax; - if (NETVSC_SEND_BUFFER_SIZE % sc->hn_chim_szmax != 0) { + sc->hn_chim_cnt = HN_CHIM_SIZE / sc->hn_chim_szmax; + if (HN_CHIM_SIZE % sc->hn_chim_szmax != 0) { if_printf(sc->hn_ifp, "chimney sending sections are " "not properly aligned\n"); } @@ -604,7 +616,7 @@ hn_nvs_detach(struct hn_softc *sc) } void -hn_nvs_sent_xact(struct hn_send_ctx *sndc, +hn_nvs_sent_xact(struct hn_nvs_sendctx *sndc, struct hn_softc *sc __unused, struct vmbus_channel *chan __unused, const void *data, int dlen) { @@ -613,7 +625,7 @@ hn_nvs_sent_xact(struct hn_send_ctx *snd } static void -hn_nvs_sent_none(struct hn_send_ctx *sndc __unused, +hn_nvs_sent_none(struct hn_nvs_sendctx *sndc __unused, struct hn_softc *sc __unused, struct vmbus_channel *chan __unused, const void *data __unused, int dlen __unused) { @@ -670,3 +682,12 @@ done: vmbus_xact_put(xact); return (error); } + +int +hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, + struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) +{ + + return hn_nvs_send_rndis_sglist(chan, HN_NVS_RNDIS_MTYPE_CTRL, + sndc, gpa, gpa_cnt); +} Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 05:17:03 2016 (r308503) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 05:37:04 2016 (r308504) @@ -28,261 +28,79 @@ * $FreeBSD$ */ -/* - * HyperV vmbus (virtual machine bus) network VSC (virtual services client) - * header file - * - * (Updated from unencumbered NvspProtocol.h) - */ - -#ifndef __HV_NET_VSC_H__ -#define __HV_NET_VSC_H__ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#define HN_USE_TXDESC_BUFRING - -/* - * The following arguably belongs in a separate header file - */ - -/* - * Defines - */ - -#define NETVSC_SEND_BUFFER_SIZE (1024*1024*15) /* 15M */ - -#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY (1024*1024*15) /* 15MB */ -#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*16) /* 16MB */ - -/* - * Maximum MTU we permit to be configured for a netvsc interface. - * When the code was developed, a max MTU of 12232 was tested and - * proven to work. 9K is a reasonable maximum for an Ethernet. - */ -#define NETVSC_MAX_CONFIGURABLE_MTU (9 * 1024) - -#define NETVSC_PACKET_SIZE PAGE_SIZE - -/* - * Data types - */ +#ifndef _HN_NVS_H_ +#define _HN_NVS_H_ +struct hn_nvs_sendctx; struct vmbus_channel; +struct hn_softc; -#define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) -#define NETVSC_PACKET_MAXPAGE 32 - -#define HN_XACT_REQ_PGCNT 2 -#define HN_XACT_RESP_PGCNT 2 -#define HN_XACT_REQ_SIZE (HN_XACT_REQ_PGCNT * PAGE_SIZE) -#define HN_XACT_RESP_SIZE (HN_XACT_RESP_PGCNT * PAGE_SIZE) - -struct hn_txdesc; -#ifndef HN_USE_TXDESC_BUFRING -SLIST_HEAD(hn_txdesc_list, hn_txdesc); -#else -struct buf_ring; -#endif - -struct hn_tx_ring; - -struct hn_rx_ring { - struct ifnet *hn_ifp; - struct hn_tx_ring *hn_txr; - void *hn_rdbuf; - uint8_t *hn_rxbuf; /* shadow sc->hn_rxbuf */ - int hn_rx_idx; - - /* Trust csum verification on host side */ - int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */ - struct lro_ctrl hn_lro; - - u_long hn_csum_ip; - u_long hn_csum_tcp; - u_long hn_csum_udp; - u_long hn_csum_trusted; - u_long hn_lro_tried; - u_long hn_small_pkts; - u_long hn_pkts; - u_long hn_rss_pkts; - - /* Rarely used stuffs */ - struct sysctl_oid *hn_rx_sysctl_tree; - int hn_rx_flags; - - void *hn_br; /* TX/RX bufring */ - struct hyperv_dma hn_br_dma; -} __aligned(CACHE_LINE_SIZE); - -#define HN_TRUST_HCSUM_IP 0x0001 -#define HN_TRUST_HCSUM_TCP 0x0002 -#define HN_TRUST_HCSUM_UDP 0x0004 - -#define HN_RX_FLAG_ATTACHED 0x1 - -struct hn_tx_ring { -#ifndef HN_USE_TXDESC_BUFRING - struct mtx hn_txlist_spin; - struct hn_txdesc_list hn_txlist; -#else - struct buf_ring *hn_txdesc_br; -#endif - int hn_txdesc_cnt; - int hn_txdesc_avail; - u_short hn_has_txeof; - u_short hn_txdone_cnt; - - int hn_sched_tx; - void (*hn_txeof)(struct hn_tx_ring *); - struct taskqueue *hn_tx_taskq; - struct task hn_tx_task; - struct task hn_txeof_task; - - struct buf_ring *hn_mbuf_br; - int hn_oactive; - int hn_tx_idx; - int hn_tx_flags; - - struct mtx hn_tx_lock; - struct hn_softc *hn_sc; - struct vmbus_channel *hn_chan; - - int hn_direct_tx_size; - int hn_chim_size; - bus_dma_tag_t hn_tx_data_dtag; - uint64_t hn_csum_assist; - - int (*hn_sendpkt)(struct hn_tx_ring *, struct hn_txdesc *); - int hn_suspended; - int hn_gpa_cnt; - struct vmbus_gpa hn_gpa[NETVSC_PACKET_MAXPAGE]; - - u_long hn_no_txdescs; - u_long hn_send_failed; - u_long hn_txdma_failed; - u_long hn_tx_collapsed; - u_long hn_tx_chimney_tried; - u_long hn_tx_chimney; - u_long hn_pkts; - - /* Rarely used stuffs */ - struct hn_txdesc *hn_txdesc; - bus_dma_tag_t hn_tx_rndis_dtag; - struct sysctl_oid *hn_tx_sysctl_tree; -} __aligned(CACHE_LINE_SIZE); - -#define HN_TX_FLAG_ATTACHED 0x1 -#define HN_TX_FLAG_HASHVAL 0x2 /* support HASHVAL pktinfo */ - -/* - * Device-specific softc structure - */ -struct hn_softc { - struct ifnet *hn_ifp; - struct arpcom arpcom; - struct ifmedia hn_media; - device_t hn_dev; - int hn_if_flags; - struct sx hn_lock; - struct vmbus_channel *hn_prichan; - - int hn_rx_ring_cnt; - int hn_rx_ring_inuse; - struct hn_rx_ring *hn_rx_ring; - - int hn_tx_ring_cnt; - int hn_tx_ring_inuse; - struct hn_tx_ring *hn_tx_ring; - - uint8_t *hn_chim; - u_long *hn_chim_bmap; - int hn_chim_bmap_cnt; - int hn_chim_cnt; - int hn_chim_szmax; - - int hn_cpu; - struct taskqueue *hn_tx_taskq; - struct sysctl_oid *hn_tx_sysctl_tree; - struct sysctl_oid *hn_rx_sysctl_tree; - struct vmbus_xact_ctx *hn_xact; - uint32_t hn_nvs_ver; - uint32_t hn_rx_filter; - - struct taskqueue *hn_mgmt_taskq; - struct taskqueue *hn_mgmt_taskq0; - struct task hn_link_task; - struct task hn_netchg_init; - struct timeout_task hn_netchg_status; - uint32_t hn_link_flags; /* HN_LINK_FLAG_ */ - - uint32_t hn_caps; /* HN_CAP_ */ - uint32_t hn_flags; /* HN_FLAG_ */ - void *hn_rxbuf; - uint32_t hn_rxbuf_gpadl; - struct hyperv_dma hn_rxbuf_dma; - - uint32_t hn_chim_gpadl; - struct hyperv_dma hn_chim_dma; - - uint32_t hn_rndis_rid; - uint32_t hn_ndis_ver; - int hn_ndis_tso_szmax; - int hn_ndis_tso_sgmin; - - int hn_rss_ind_size; - uint32_t hn_rss_hash; /* NDIS_HASH_ */ - struct ndis_rssprm_toeplitz hn_rss; +typedef void (*hn_nvs_sent_t) + (struct hn_nvs_sendctx *, struct hn_softc *, + struct vmbus_channel *, const void *, int); + +struct hn_nvs_sendctx { + hn_nvs_sent_t hn_cb; + void *hn_cbarg; }; -#define HN_FLAG_RXBUF_CONNECTED 0x0001 -#define HN_FLAG_CHIM_CONNECTED 0x0002 -#define HN_FLAG_HAS_RSSKEY 0x0004 -#define HN_FLAG_HAS_RSSIND 0x0008 -#define HN_FLAG_SYNTH_ATTACHED 0x0010 - -#define HN_CAP_VLAN 0x0001 -#define HN_CAP_MTU 0x0002 -#define HN_CAP_IPCS 0x0004 -#define HN_CAP_TCP4CS 0x0008 -#define HN_CAP_TCP6CS 0x0010 -#define HN_CAP_UDP4CS 0x0020 -#define HN_CAP_UDP6CS 0x0040 -#define HN_CAP_TSO4 0x0080 -#define HN_CAP_TSO6 0x0100 -#define HN_CAP_HASHVAL 0x0200 - -/* Capability description for use with printf(9) %b identifier. */ -#define HN_CAP_BITS \ - "\020\1VLAN\2MTU\3IPCS\4TCP4CS\5TCP6CS" \ - "\6UDP4CS\7UDP6CS\10TSO4\11TSO6\12HASHVAL" - -#define HN_LINK_FLAG_LINKUP 0x0001 -#define HN_LINK_FLAG_NETCHG 0x0002 +#define HN_NVS_SENDCTX_INITIALIZER(cb, cbarg) \ +{ \ + .hn_cb = cb, \ + .hn_cbarg = cbarg \ +} + +static __inline void +hn_nvs_sendctx_init(struct hn_nvs_sendctx *sndc, hn_nvs_sent_t cb, void *cbarg) +{ + + sndc->hn_cb = cb; + sndc->hn_cbarg = cbarg; +} + +static __inline int +hn_nvs_send(struct vmbus_channel *chan, uint16_t flags, + void *nvs_msg, int nvs_msglen, struct hn_nvs_sendctx *sndc) +{ + + return (vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, flags, + nvs_msg, nvs_msglen, (uint64_t)(uintptr_t)sndc)); +} + +static __inline int +hn_nvs_send_sglist(struct vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, + void *nvs_msg, int nvs_msglen, struct hn_nvs_sendctx *sndc) +{ + + return (vmbus_chan_send_sglist(chan, sg, sglen, nvs_msg, nvs_msglen, + (uint64_t)(uintptr_t)sndc)); +} + +static __inline int +hn_nvs_send_rndis_sglist(struct vmbus_channel *chan, uint32_t rndis_mtype, + struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) +{ + struct hn_nvs_rndis rndis; + + rndis.nvs_type = HN_NVS_TYPE_RNDIS; + rndis.nvs_rndis_mtype = rndis_mtype; + rndis.nvs_chim_idx = HN_NVS_CHIM_IDX_INVALID; + rndis.nvs_chim_sz = 0; + + return (hn_nvs_send_sglist(chan, gpa, gpa_cnt, + &rndis, sizeof(rndis), sndc)); +} + +int hn_nvs_attach(struct hn_softc *sc, int mtu); +void hn_nvs_detach(struct hn_softc *sc); +int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch); +void hn_nvs_sent_xact(struct hn_nvs_sendctx *sndc, + struct hn_softc *sc, struct vmbus_channel *chan, + const void *data, int dlen); +int hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, + struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, + int gpa_cnt); -#endif /* __HV_NET_VSC_H__ */ +extern struct hn_nvs_sendctx hn_nvs_sendctx_none; +#endif /* !_HN_NVS_H_ */ Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 05:17:03 2016 (r308503) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 05:37:04 2016 (r308504) @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -92,6 +93,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -118,11 +120,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include +#include +#include #include #include -#include #include "vmbus_if.h" @@ -157,7 +162,7 @@ __FBSDID("$FreeBSD$"); #define HN_TX_DATA_MAXSIZE IP_MAXPACKET #define HN_TX_DATA_SEGSIZE PAGE_SIZE /* -1 for RNDIS packet message */ -#define HN_TX_DATA_SEGCNT_MAX (NETVSC_PACKET_MAXPAGE - 1) +#define HN_TX_DATA_SEGCNT_MAX (HN_GPACNT_MAX - 1) #define HN_DIRECT_TX_SIZE_DEF 128 @@ -171,7 +176,7 @@ struct hn_txdesc { struct hn_tx_ring *txr; int refs; uint32_t flags; /* HN_TXD_FLAG_ */ - struct hn_send_ctx send_ctx; + struct hn_nvs_sendctx send_ctx; uint32_t chim_index; int chim_size; @@ -409,37 +414,13 @@ hn_set_lro_lenlim(struct hn_softc *sc, i } #endif -static __inline int -hn_nvs_send_rndis_sglist1(struct vmbus_channel *chan, uint32_t rndis_mtype, - struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) -{ - struct hn_nvs_rndis rndis; - - rndis.nvs_type = HN_NVS_TYPE_RNDIS; - rndis.nvs_rndis_mtype = rndis_mtype; - rndis.nvs_chim_idx = HN_NVS_CHIM_IDX_INVALID; - rndis.nvs_chim_sz = 0; - - return (hn_nvs_send_sglist(chan, gpa, gpa_cnt, - &rndis, sizeof(rndis), sndc)); -} - -int -hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, - struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) -{ - - return hn_nvs_send_rndis_sglist1(chan, HN_NVS_RNDIS_MTYPE_CTRL, - sndc, gpa, gpa_cnt); -} - static int hn_sendpkt_rndis_sglist(struct hn_tx_ring *txr, struct hn_txdesc *txd) { KASSERT(txd->chim_index == HN_NVS_CHIM_IDX_INVALID && txd->chim_size == 0, ("invalid rndis sglist txd")); - return (hn_nvs_send_rndis_sglist1(txr->hn_chan, HN_NVS_RNDIS_MTYPE_DATA, + return (hn_nvs_send_rndis_sglist(txr->hn_chan, HN_NVS_RNDIS_MTYPE_DATA, &txd->send_ctx, txr->hn_gpa, txr->hn_gpa_cnt)); } @@ -1201,7 +1182,7 @@ hn_txeof(struct hn_tx_ring *txr) } static void -hn_tx_done(struct hn_send_ctx *sndc, struct hn_softc *sc, +hn_tx_done(struct hn_nvs_sendctx *sndc, struct hn_softc *sc, struct vmbus_channel *chan, const void *data __unused, int dlen __unused) { struct hn_txdesc *txd = sndc->hn_cbarg; @@ -1446,7 +1427,7 @@ done: txd->m = m_head; /* Set the completion routine */ - hn_send_ctx_init(&txd->send_ctx, hn_tx_done, txd); + hn_nvs_sendctx_init(&txd->send_ctx, hn_tx_done, txd); return 0; } @@ -1875,7 +1856,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, switch (cmd) { case SIOCSIFMTU: - if (ifr->ifr_mtu > NETVSC_MAX_CONFIGURABLE_MTU) { + if (ifr->ifr_mtu > HN_MTU_MAX) { error = EINVAL; break; } @@ -2651,7 +2632,7 @@ hn_create_rx_data(struct hn_softc *sc, i * may further limit the usable space. */ sc->hn_rxbuf = hyperv_dmamem_alloc(bus_get_dma_tag(dev), - PAGE_SIZE, 0, NETVSC_RECEIVE_BUFFER_SIZE, &sc->hn_rxbuf_dma, + PAGE_SIZE, 0, HN_RXBUF_SIZE, &sc->hn_rxbuf_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); if (sc->hn_rxbuf == NULL) { device_printf(sc->hn_dev, "allocate rxbuf failed\n"); @@ -2685,9 +2666,7 @@ hn_create_rx_data(struct hn_softc *sc, i struct hn_rx_ring *rxr = &sc->hn_rx_ring[i]; rxr->hn_br = hyperv_dmamem_alloc(bus_get_dma_tag(dev), - PAGE_SIZE, 0, - NETVSC_DEVICE_RING_BUFFER_SIZE + - NETVSC_DEVICE_RING_BUFFER_SIZE, + PAGE_SIZE, 0, HN_TXBR_SIZE + HN_RXBR_SIZE, &rxr->hn_br_dma, BUS_DMA_WAITOK); if (rxr->hn_br == NULL) { device_printf(dev, "allocate bufring failed\n"); @@ -2703,7 +2682,7 @@ hn_create_rx_data(struct hn_softc *sc, i rxr->hn_ifp = sc->hn_ifp; if (i < sc->hn_tx_ring_cnt) rxr->hn_txr = &sc->hn_tx_ring[i]; - rxr->hn_rdbuf = malloc(NETVSC_PACKET_SIZE, M_DEVBUF, M_WAITOK); + rxr->hn_pktbuf = malloc(HN_PKTBUF_LEN, M_DEVBUF, M_WAITOK); rxr->hn_rx_idx = i; rxr->hn_rxbuf = sc->hn_rxbuf; @@ -2850,7 +2829,7 @@ hn_destroy_rx_data(struct hn_softc *sc) #if defined(INET) || defined(INET6) tcp_lro_free(&rxr->hn_lro); #endif - free(rxr->hn_rdbuf, M_DEVBUF); + free(rxr->hn_pktbuf, M_DEVBUF); } free(sc->hn_rx_ring, M_DEVBUF); sc->hn_rx_ring = NULL; @@ -3110,7 +3089,7 @@ hn_create_tx_data(struct hn_softc *sc, i * NOTE: It is shared by all channels. */ sc->hn_chim = hyperv_dmamem_alloc(bus_get_dma_tag(sc->hn_dev), - PAGE_SIZE, 0, NETVSC_SEND_BUFFER_SIZE, &sc->hn_chim_dma, + PAGE_SIZE, 0, HN_CHIM_SIZE, &sc->hn_chim_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); if (sc->hn_chim == NULL) { device_printf(sc->hn_dev, "allocate txbuf failed\n"); @@ -3528,8 +3507,8 @@ hn_chan_attach(struct hn_softc *sc, stru */ cbr.cbr = rxr->hn_br; cbr.cbr_paddr = rxr->hn_br_dma.hv_paddr; - cbr.cbr_txsz = NETVSC_DEVICE_RING_BUFFER_SIZE; - cbr.cbr_rxsz = NETVSC_DEVICE_RING_BUFFER_SIZE; + cbr.cbr_txsz = HN_TXBR_SIZE; + cbr.cbr_rxsz = HN_RXBR_SIZE; error = vmbus_chan_open_br(chan, &cbr, NULL, 0, hn_chan_callback, rxr); if (error) { if_printf(sc->hn_ifp, "open chan%u failed: %d\n", @@ -4087,9 +4066,9 @@ static void hn_nvs_handle_comp(struct hn_softc *sc, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkt) { - struct hn_send_ctx *sndc; + struct hn_nvs_sendctx *sndc; - sndc = (struct hn_send_ctx *)(uintptr_t)pkt->cph_xactid; + sndc = (struct hn_nvs_sendctx *)(uintptr_t)pkt->cph_xactid; sndc->hn_cb(sndc, sc, chan, VMBUS_CHANPKT_CONST_DATA(pkt), VMBUS_CHANPKT_DATALEN(pkt)); /* @@ -4146,7 +4125,7 @@ hn_nvs_handle_rxbuf(struct hn_softc *sc, ofs = pkt->cp_rxbuf[i].rb_ofs; len = pkt->cp_rxbuf[i].rb_len; - if (__predict_false(ofs + len > NETVSC_RECEIVE_BUFFER_SIZE)) { + if (__predict_false(ofs + len > HN_RXBUF_SIZE)) { if_printf(rxr->hn_ifp, "%dth RNDIS msg overflow rxbuf, " "ofs %d, len %d\n", i, ofs, len); continue; @@ -4201,9 +4180,9 @@ hn_chan_callback(struct vmbus_channel *c struct hn_rx_ring *rxr = xrxr; struct hn_softc *sc = rxr->hn_ifp->if_softc; void *buffer; - int bufferlen = NETVSC_PACKET_SIZE; + int bufferlen = HN_PKTBUF_LEN; - buffer = rxr->hn_rdbuf; + buffer = rxr->hn_pktbuf; do { struct vmbus_chanpkt_hdr *pkt = buffer; uint32_t bytes_rxed; @@ -4230,7 +4209,7 @@ hn_chan_callback(struct vmbus_channel *c } } else if (ret == ENOBUFS) { /* Handle large packet */ - if (bufferlen > NETVSC_PACKET_SIZE) { + if (bufferlen > HN_PKTBUF_LEN) { free(buffer, M_DEVBUF); buffer = NULL; } @@ -4251,7 +4230,7 @@ hn_chan_callback(struct vmbus_channel *c } } while (1); - if (bufferlen > NETVSC_PACKET_SIZE) + if (bufferlen > HN_PKTBUF_LEN) free(buffer, M_DEVBUF); hv_rf_channel_rollup(rxr, rxr->hn_txr); Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 05:17:03 2016 (r308503) +++ stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 05:37:04 2016 (r308504) @@ -35,26 +35,31 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include + +#include + +#include #include #include #include -#include +#include #include + #include #include -#include -#include -#include -#include -#include -#include +#include #include +#include +#include #include + +#include +#include +#include #include #include -#include -#include #define HV_RF_RECVINFO_VLAN 0x1 #define HV_RF_RECVINFO_CSUM 0x2 @@ -550,7 +555,7 @@ hn_rndis_get_linkstatus(struct hn_softc static const void * hn_rndis_xact_exec1(struct hn_softc *sc, struct vmbus_xact *xact, size_t reqlen, - struct hn_send_ctx *sndc, size_t *comp_len) + struct hn_nvs_sendctx *sndc, size_t *comp_len) { struct vmbus_gpa gpa[HN_XACT_REQ_PGCNT]; int gpa_cnt, error; @@ -609,7 +614,7 @@ hn_rndis_xact_execute(struct hn_softc *s /* * Execute the xact setup by the caller. */ - comp = hn_rndis_xact_exec1(sc, xact, reqlen, &hn_send_ctx_none, + comp = hn_rndis_xact_exec1(sc, xact, reqlen, &hn_nvs_sendctx_none, &comp_len); if (comp == NULL) return (NULL); @@ -1215,7 +1220,7 @@ hn_rndis_halt(struct hn_softc *sc) { struct vmbus_xact *xact; struct rndis_halt_req *halt; - struct hn_send_ctx sndc; + struct hn_nvs_sendctx sndc; size_t comp_len; xact = vmbus_xact_get(sc->hn_xact, sizeof(*halt)); @@ -1229,7 +1234,7 @@ hn_rndis_halt(struct hn_softc *sc) halt->rm_rid = hn_rndis_rid(sc); /* No RNDIS completion; rely on NVS message send completion */ - hn_send_ctx_init(&sndc, hn_nvs_sent_xact, xact); + hn_nvs_sendctx_init(&sndc, hn_nvs_sent_xact, xact); hn_rndis_xact_exec1(sc, xact, sizeof(*halt), &sndc, &comp_len); vmbus_xact_put(xact); Modified: stable/10/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 05:17:03 2016 (r308503) +++ stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 05:37:04 2016 (r308504) @@ -29,24 +29,27 @@ #ifndef _IF_HNVAR_H_ #define _IF_HNVAR_H_ -#include +#define HN_USE_TXDESC_BUFRING -#include -#include +#define HN_CHIM_SIZE (15 * 1024 * 1024) -struct hn_softc; +#define HN_RXBUF_SIZE (16 * 1024 * 1024) +#define HN_RXBUF_SIZE_COMPAT (15 * 1024 * 1024) -struct vmbus_channel; -struct hn_send_ctx; +/* Claimed to be 12232B */ +#define HN_MTU_MAX (9 * 1024) -typedef void (*hn_sent_callback_t) - (struct hn_send_ctx *, struct hn_softc *, - struct vmbus_channel *, const void *, int); +#define HN_PKTBUF_LEN 4096 -struct hn_send_ctx { - hn_sent_callback_t hn_cb; - void *hn_cbarg; -}; +#define HN_TXBR_SIZE (128 * PAGE_SIZE) +#define HN_RXBR_SIZE (128 * PAGE_SIZE) + +#define HN_XACT_REQ_PGCNT 2 +#define HN_XACT_RESP_PGCNT 2 +#define HN_XACT_REQ_SIZE (HN_XACT_REQ_PGCNT * PAGE_SIZE) +#define HN_XACT_RESP_SIZE (HN_XACT_RESP_PGCNT * PAGE_SIZE) + +#define HN_GPACNT_MAX 32 #define HN_NDIS_VLAN_INFO_INVALID 0xffffffff #define HN_NDIS_RXCSUM_INFO_INVALID 0 @@ -59,39 +62,187 @@ struct hn_recvinfo { uint32_t hash_value; }; -#define HN_SEND_CTX_INITIALIZER(cb, cbarg) \ -{ \ - .hn_cb = cb, \ - .hn_cbarg = cbarg \ -} - -static __inline void -hn_send_ctx_init(struct hn_send_ctx *sndc, hn_sent_callback_t cb, void *cbarg) -{ - - sndc->hn_cb = cb; - sndc->hn_cbarg = cbarg; -} - -static __inline int -hn_nvs_send(struct vmbus_channel *chan, uint16_t flags, - void *nvs_msg, int nvs_msglen, struct hn_send_ctx *sndc) -{ - - return (vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, flags, - nvs_msg, nvs_msglen, (uint64_t)(uintptr_t)sndc)); -} - -static __inline int -hn_nvs_send_sglist(struct vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, - void *nvs_msg, int nvs_msglen, struct hn_send_ctx *sndc) -{ - - return (vmbus_chan_send_sglist(chan, sg, sglen, nvs_msg, nvs_msglen, - (uint64_t)(uintptr_t)sndc)); -} +struct hn_txdesc; +#ifndef HN_USE_TXDESC_BUFRING +SLIST_HEAD(hn_txdesc_list, hn_txdesc); +#else +struct buf_ring; +#endif +struct hn_tx_ring; + +struct hn_rx_ring { + struct ifnet *hn_ifp; + struct hn_tx_ring *hn_txr; + void *hn_pktbuf; + uint8_t *hn_rxbuf; /* shadow sc->hn_rxbuf */ + int hn_rx_idx; + + /* Trust csum verification on host side */ + int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */ + struct lro_ctrl hn_lro; + + u_long hn_csum_ip; + u_long hn_csum_tcp; + u_long hn_csum_udp; + u_long hn_csum_trusted; + u_long hn_lro_tried; + u_long hn_small_pkts; + u_long hn_pkts; + u_long hn_rss_pkts; + + /* Rarely used stuffs */ + struct sysctl_oid *hn_rx_sysctl_tree; + int hn_rx_flags; + + void *hn_br; /* TX/RX bufring */ + struct hyperv_dma hn_br_dma; +} __aligned(CACHE_LINE_SIZE); + +#define HN_TRUST_HCSUM_IP 0x0001 +#define HN_TRUST_HCSUM_TCP 0x0002 +#define HN_TRUST_HCSUM_UDP 0x0004 + +#define HN_RX_FLAG_ATTACHED 0x1 + +struct hn_tx_ring { +#ifndef HN_USE_TXDESC_BUFRING + struct mtx hn_txlist_spin; + struct hn_txdesc_list hn_txlist; +#else + struct buf_ring *hn_txdesc_br; +#endif + int hn_txdesc_cnt; + int hn_txdesc_avail; + u_short hn_has_txeof; + u_short hn_txdone_cnt; + + int hn_sched_tx; + void (*hn_txeof)(struct hn_tx_ring *); + struct taskqueue *hn_tx_taskq; + struct task hn_tx_task; + struct task hn_txeof_task; + + struct buf_ring *hn_mbuf_br; + int hn_oactive; + int hn_tx_idx; + int hn_tx_flags; + + struct mtx hn_tx_lock; + struct hn_softc *hn_sc; + struct vmbus_channel *hn_chan; + + int hn_direct_tx_size; + int hn_chim_size; + bus_dma_tag_t hn_tx_data_dtag; + uint64_t hn_csum_assist; + + int (*hn_sendpkt)(struct hn_tx_ring *, struct hn_txdesc *); + int hn_suspended; + int hn_gpa_cnt; + struct vmbus_gpa hn_gpa[HN_GPACNT_MAX]; + + u_long hn_no_txdescs; + u_long hn_send_failed; + u_long hn_txdma_failed; + u_long hn_tx_collapsed; + u_long hn_tx_chimney_tried; + u_long hn_tx_chimney; + u_long hn_pkts; + + /* Rarely used stuffs */ + struct hn_txdesc *hn_txdesc; + bus_dma_tag_t hn_tx_rndis_dtag; + struct sysctl_oid *hn_tx_sysctl_tree; +} __aligned(CACHE_LINE_SIZE); + +#define HN_TX_FLAG_ATTACHED 0x1 +#define HN_TX_FLAG_HASHVAL 0x2 /* support HASHVAL pktinfo */ + +/* + * Device-specific softc structure + */ +struct hn_softc { + struct ifnet *hn_ifp; + struct arpcom arpcom; + struct ifmedia hn_media; + device_t hn_dev; + int hn_if_flags; + struct sx hn_lock; + struct vmbus_channel *hn_prichan; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Nov 11 05:53:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECE9BC3B038; Fri, 11 Nov 2016 05:53:59 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C067A1ECF; Fri, 11 Nov 2016 05:53:59 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB5rwQ0050271; Fri, 11 Nov 2016 05:53:58 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB5rwUU050264; Fri, 11 Nov 2016 05:53:58 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110553.uAB5rwUU050264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 05:53:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308505 - in stable/10/sys: conf dev/hyperv/netvsc modules/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 05:54:00 -0000 Author: sephe Date: Fri Nov 11 05:53:58 2016 New Revision: 308505 URL: https://svnweb.freebsd.org/changeset/base/308505 Log: MFC 308011,308012 308011 hyperv/hn: Rename cleaned up NVS header file. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8353 308012 hyperv/hn: Rename cleaned up NVS source file. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8354 Added: stable/10/sys/dev/hyperv/netvsc/hn_nvs.c - copied, changed from r308504, stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/10/sys/dev/hyperv/netvsc/hn_nvs.h - copied unchanged from r308504, stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Deleted: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Modified: stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/10/sys/modules/hyperv/netvsc/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Fri Nov 11 05:37:04 2016 (r308504) +++ stable/10/sys/conf/files.amd64 Fri Nov 11 05:53:58 2016 (r308505) @@ -261,7 +261,7 @@ dev/hwpmc/hwpmc_uncore.c optional hwpmc dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc -dev/hyperv/netvsc/hv_net_vsc.c optional hyperv +dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c optional hyperv dev/hyperv/netvsc/hv_rndis_filter.c optional hyperv dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c optional hyperv Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Fri Nov 11 05:37:04 2016 (r308504) +++ stable/10/sys/conf/files.i386 Fri Nov 11 05:53:58 2016 (r308505) @@ -238,7 +238,7 @@ dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_ppro.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc -dev/hyperv/netvsc/hv_net_vsc.c optional hyperv +dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c optional hyperv dev/hyperv/netvsc/hv_rndis_filter.c optional hyperv dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c optional hyperv Copied and modified: stable/10/sys/dev/hyperv/netvsc/hn_nvs.c (from r308504, stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c) ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Nov 11 05:37:04 2016 (r308504, copy source) +++ stable/10/sys/dev/hyperv/netvsc/hn_nvs.c Fri Nov 11 05:53:58 2016 (r308505) @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include static int hn_nvs_conn_chim(struct hn_softc *); static int hn_nvs_conn_rxbuf(struct hn_softc *); Copied: stable/10/sys/dev/hyperv/netvsc/hn_nvs.h (from r308504, stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/hyperv/netvsc/hn_nvs.h Fri Nov 11 05:53:58 2016 (r308505, copy of r308504, stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h) @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2010-2012 Citrix Inc. + * Copyright (c) 2012 NetApp Inc. + * 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 _HN_NVS_H_ +#define _HN_NVS_H_ + +struct hn_nvs_sendctx; +struct vmbus_channel; +struct hn_softc; + +typedef void (*hn_nvs_sent_t) + (struct hn_nvs_sendctx *, struct hn_softc *, + struct vmbus_channel *, const void *, int); + +struct hn_nvs_sendctx { + hn_nvs_sent_t hn_cb; + void *hn_cbarg; +}; + +#define HN_NVS_SENDCTX_INITIALIZER(cb, cbarg) \ +{ \ + .hn_cb = cb, \ + .hn_cbarg = cbarg \ +} + +static __inline void +hn_nvs_sendctx_init(struct hn_nvs_sendctx *sndc, hn_nvs_sent_t cb, void *cbarg) +{ + + sndc->hn_cb = cb; + sndc->hn_cbarg = cbarg; +} + +static __inline int +hn_nvs_send(struct vmbus_channel *chan, uint16_t flags, + void *nvs_msg, int nvs_msglen, struct hn_nvs_sendctx *sndc) +{ + + return (vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, flags, + nvs_msg, nvs_msglen, (uint64_t)(uintptr_t)sndc)); +} + +static __inline int +hn_nvs_send_sglist(struct vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, + void *nvs_msg, int nvs_msglen, struct hn_nvs_sendctx *sndc) +{ + + return (vmbus_chan_send_sglist(chan, sg, sglen, nvs_msg, nvs_msglen, + (uint64_t)(uintptr_t)sndc)); +} + +static __inline int +hn_nvs_send_rndis_sglist(struct vmbus_channel *chan, uint32_t rndis_mtype, + struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) +{ + struct hn_nvs_rndis rndis; + + rndis.nvs_type = HN_NVS_TYPE_RNDIS; + rndis.nvs_rndis_mtype = rndis_mtype; + rndis.nvs_chim_idx = HN_NVS_CHIM_IDX_INVALID; + rndis.nvs_chim_sz = 0; + + return (hn_nvs_send_sglist(chan, gpa, gpa_cnt, + &rndis, sizeof(rndis), sndc)); +} + +int hn_nvs_attach(struct hn_softc *sc, int mtu); +void hn_nvs_detach(struct hn_softc *sc); +int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch); +void hn_nvs_sent_xact(struct hn_nvs_sendctx *sndc, + struct hn_softc *sc, struct vmbus_channel *chan, + const void *data, int dlen); +int hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, + struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, + int gpa_cnt); + +extern struct hn_nvs_sendctx hn_nvs_sendctx_none; + +#endif /* !_HN_NVS_H_ */ Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 05:37:04 2016 (r308504) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 05:53:58 2016 (r308505) @@ -126,7 +126,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include "vmbus_if.h" Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 05:37:04 2016 (r308504) +++ stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 05:53:58 2016 (r308505) @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #define HV_RF_RECVINFO_VLAN 0x1 Modified: stable/10/sys/modules/hyperv/netvsc/Makefile ============================================================================== --- stable/10/sys/modules/hyperv/netvsc/Makefile Fri Nov 11 05:37:04 2016 (r308504) +++ stable/10/sys/modules/hyperv/netvsc/Makefile Fri Nov 11 05:53:58 2016 (r308505) @@ -4,7 +4,7 @@ ${.CURDIR}/../../../dev/hyperv/vmbus KMOD= hv_netvsc -SRCS= hv_net_vsc.c \ +SRCS= hn_nvs.c \ hv_netvsc_drv_freebsd.c \ hv_rndis_filter.c SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h vmbus_if.h From owner-svn-src-all@freebsd.org Fri Nov 11 06:23:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AD9CC3B861; Fri, 11 Nov 2016 06:23:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2686D1DEF; Fri, 11 Nov 2016 06:23:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB6N15L062432; Fri, 11 Nov 2016 06:23:01 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB6N1aI062429; Fri, 11 Nov 2016 06:23:01 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110623.uAB6N1aI062429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 06:23:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308506 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 06:23:02 -0000 Author: sephe Date: Fri Nov 11 06:23:01 2016 New Revision: 308506 URL: https://svnweb.freebsd.org/changeset/base/308506 Log: MFC 308013-308017 308013 hyperv/hn: Nuke unnecessary indirection. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8355 308014 hyperv/hn: Reorganize RX path; mainly pull non-control code path up Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8356 308015 hyperv/hn: Pull data path code up. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8357 308016 hyperv/hn: Cleanup RNDIS related files. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8358 308017 hyperv/hn: Change header guardian; in preparation for the upcoming rename. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8359 Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.h stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 05:53:58 2016 (r308505) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 06:23:01 2016 (r308506) @@ -168,6 +168,16 @@ __FBSDID("$FreeBSD$"); #define HN_EARLY_TXEOF_THRESH 8 +#define HN_RXINFO_VLAN 0x0001 +#define HN_RXINFO_CSUM 0x0002 +#define HN_RXINFO_HASHINF 0x0004 +#define HN_RXINFO_HASHVAL 0x0008 +#define HN_RXINFO_ALL \ + (HN_RXINFO_VLAN | \ + HN_RXINFO_CSUM | \ + HN_RXINFO_HASHINF | \ + HN_RXINFO_HASHVAL) + struct hn_txdesc { #ifndef HN_USE_TXDESC_BUFRING SLIST_ENTRY(hn_txdesc) link; @@ -190,6 +200,17 @@ struct hn_txdesc { #define HN_TXD_FLAG_ONLIST 0x1 #define HN_TXD_FLAG_DMAMAP 0x2 +#define HN_NDIS_VLAN_INFO_INVALID 0xffffffff +#define HN_NDIS_RXCSUM_INFO_INVALID 0 +#define HN_NDIS_HASH_INFO_INVALID 0 + +struct hn_rxinfo { + uint32_t vlan_info; + uint32_t csum_info; + uint32_t hash_info; + uint32_t hash_value; +}; + #define HN_LRO_LENLIM_MULTIRX_DEF (12 * ETHERMTU) #define HN_LRO_LENLIM_DEF (25 * ETHERMTU) /* YYY 2*MTU is a bit rough, but should be good enough. */ @@ -360,6 +381,7 @@ static void hn_chan_detach(struct hn_sof static int hn_attach_subchans(struct hn_softc *); static void hn_detach_allchans(struct hn_softc *); static void hn_chan_callback(struct vmbus_channel *chan, void *xrxr); +static void hn_chan_rollup(struct hn_rx_ring *, struct hn_tx_ring *); static void hn_set_ring_inuse(struct hn_softc *, int); static int hn_synth_attach(struct hn_softc *, int); static void hn_synth_detach(struct hn_softc *); @@ -378,12 +400,18 @@ static void hn_link_status(struct hn_sof static int hn_sendpkt_rndis_sglist(struct hn_tx_ring *, struct hn_txdesc *); static int hn_sendpkt_rndis_chim(struct hn_tx_ring *, struct hn_txdesc *); static int hn_set_rxfilter(struct hn_softc *); +static void hn_link_status_update(struct hn_softc *); +static void hn_network_change(struct hn_softc *); + +static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); +static void hn_rndis_rx_data(struct hn_rx_ring *, const void *, int); +static void hn_rndis_rx_status(struct hn_softc *, const void *, int); static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt); static void hn_nvs_handle_comp(struct hn_softc *sc, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkt); -static void hn_nvs_handle_rxbuf(struct hn_softc *sc, struct hn_rx_ring *rxr, +static void hn_nvs_handle_rxbuf(struct hn_rx_ring *rxr, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr); static void hn_nvs_ack_rxbuf(struct vmbus_channel *chan, uint64_t tid); @@ -1021,7 +1049,7 @@ hn_netchg_status_taskfunc(void *xsc, int hn_link_status(sc); } -void +static void hn_link_status_update(struct hn_softc *sc) { @@ -1029,7 +1057,7 @@ hn_link_status_update(struct hn_softc *s taskqueue_enqueue(sc->hn_mgmt_taskq, &sc->hn_link_task); } -void +static void hn_network_change(struct hn_softc *sc) { @@ -1204,7 +1232,7 @@ hn_tx_done(struct hn_nvs_sendctx *sndc, } } -void +static void hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) { #if defined(INET) || defined(INET6) @@ -1238,6 +1266,42 @@ hn_rndis_pktmsg_offset(uint32_t ofs) return (ofs - __offsetof(struct rndis_packet_msg, rm_dataoffset)); } +static __inline void * +hn_rndis_pktinfo_append(struct rndis_packet_msg *pkt, size_t pktsize, + size_t pi_dlen, uint32_t pi_type) +{ + const size_t pi_size = HN_RNDIS_PKTINFO_SIZE(pi_dlen); + struct rndis_pktinfo *pi; + + KASSERT((pi_size & RNDIS_PACKET_MSG_OFFSET_ALIGNMASK) == 0, + ("unaligned pktinfo size %zu, pktinfo dlen %zu", pi_size, pi_dlen)); + + /* + * Per-packet-info does not move; it only grows. + * + * NOTE: + * rm_pktinfooffset in this phase counts from the beginning + * of rndis_packet_msg. + */ + KASSERT(pkt->rm_pktinfooffset + pkt->rm_pktinfolen + pi_size <= pktsize, + ("%u pktinfo overflows RNDIS packet msg", pi_type)); + pi = (struct rndis_pktinfo *)((uint8_t *)pkt + pkt->rm_pktinfooffset + + pkt->rm_pktinfolen); + pkt->rm_pktinfolen += pi_size; + + pi->rm_size = pi_size; + pi->rm_type = pi_type; + pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; + + /* Data immediately follow per-packet-info. */ + pkt->rm_dataoffset += pi_size; + + /* Update RNDIS packet msg length */ + pkt->rm_len += pi_size; + + return (pi->rm_data); +} + /* * NOTE: * If this function fails, then both txd and m_head0 will be freed. @@ -1636,15 +1700,9 @@ hn_lro_rx(struct lro_ctrl *lc, struct mb } #endif -/* - * Called when we receive a data packet from the "wire" on the - * specified device - * - * Note: This is no longer used as a callback - */ -int +static int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, - const struct hn_recvinfo *info) + const struct hn_rxinfo *info) { struct ifnet *ifp = rxr->hn_ifp; struct mbuf *m_new; @@ -4044,6 +4102,325 @@ hn_resume(struct hn_softc *sc) hn_resume_mgmt(sc); } +static void +hn_rndis_rx_status(struct hn_softc *sc, const void *data, int dlen) +{ + const struct rndis_status_msg *msg; + int ofs; + + if (dlen < sizeof(*msg)) { + if_printf(sc->hn_ifp, "invalid RNDIS status\n"); + return; + } + msg = data; + + switch (msg->rm_status) { + case RNDIS_STATUS_MEDIA_CONNECT: + case RNDIS_STATUS_MEDIA_DISCONNECT: + hn_link_status_update(sc); + break; + + case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG: + /* Not really useful; ignore. */ + break; + + case RNDIS_STATUS_NETWORK_CHANGE: + ofs = RNDIS_STBUFOFFSET_ABS(msg->rm_stbufoffset); + if (dlen < ofs + msg->rm_stbuflen || + msg->rm_stbuflen < sizeof(uint32_t)) { + if_printf(sc->hn_ifp, "network changed\n"); + } else { + uint32_t change; + + memcpy(&change, ((const uint8_t *)msg) + ofs, + sizeof(change)); + if_printf(sc->hn_ifp, "network changed, change %u\n", + change); + } + hn_network_change(sc); + break; + + default: + if_printf(sc->hn_ifp, "unknown RNDIS status 0x%08x\n", + msg->rm_status); + break; + } +} + +static int +hn_rndis_rxinfo(const void *info_data, int info_dlen, struct hn_rxinfo *info) +{ + const struct rndis_pktinfo *pi = info_data; + uint32_t mask = 0; + + while (info_dlen != 0) { + const void *data; + uint32_t dlen; + + if (__predict_false(info_dlen < sizeof(*pi))) + return (EINVAL); + if (__predict_false(info_dlen < pi->rm_size)) + return (EINVAL); + info_dlen -= pi->rm_size; + + if (__predict_false(pi->rm_size & RNDIS_PKTINFO_SIZE_ALIGNMASK)) + return (EINVAL); + if (__predict_false(pi->rm_size < pi->rm_pktinfooffset)) + return (EINVAL); + dlen = pi->rm_size - pi->rm_pktinfooffset; + data = pi->rm_data; + + switch (pi->rm_type) { + case NDIS_PKTINFO_TYPE_VLAN: + if (__predict_false(dlen < NDIS_VLAN_INFO_SIZE)) + return (EINVAL); + info->vlan_info = *((const uint32_t *)data); + mask |= HN_RXINFO_VLAN; + break; + + case NDIS_PKTINFO_TYPE_CSUM: + if (__predict_false(dlen < NDIS_RXCSUM_INFO_SIZE)) + return (EINVAL); + info->csum_info = *((const uint32_t *)data); + mask |= HN_RXINFO_CSUM; + break; + + case HN_NDIS_PKTINFO_TYPE_HASHVAL: + if (__predict_false(dlen < HN_NDIS_HASH_VALUE_SIZE)) + return (EINVAL); + info->hash_value = *((const uint32_t *)data); + mask |= HN_RXINFO_HASHVAL; + break; + + case HN_NDIS_PKTINFO_TYPE_HASHINF: + if (__predict_false(dlen < HN_NDIS_HASH_INFO_SIZE)) + return (EINVAL); + info->hash_info = *((const uint32_t *)data); + mask |= HN_RXINFO_HASHINF; + break; + + default: + goto next; + } + + if (mask == HN_RXINFO_ALL) { + /* All found; done */ + break; + } +next: + pi = (const struct rndis_pktinfo *) + ((const uint8_t *)pi + pi->rm_size); + } + + /* + * Final fixup. + * - If there is no hash value, invalidate the hash info. + */ + if ((mask & HN_RXINFO_HASHVAL) == 0) + info->hash_info = HN_NDIS_HASH_INFO_INVALID; + return (0); +} + +static __inline bool +hn_rndis_check_overlap(int off, int len, int check_off, int check_len) +{ + + if (off < check_off) { + if (__predict_true(off + len <= check_off)) + return (false); + } else if (off > check_off) { + if (__predict_true(check_off + check_len <= off)) + return (false); + } + return (true); +} + +static void +hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) +{ + const struct rndis_packet_msg *pkt; + struct hn_rxinfo info; + int data_off, pktinfo_off, data_len, pktinfo_len; + + /* + * Check length. + */ + if (__predict_false(dlen < sizeof(*pkt))) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg\n"); + return; + } + pkt = data; + + if (__predict_false(dlen < pkt->rm_len)) { + if_printf(rxr->hn_ifp, "truncated RNDIS packet msg, " + "dlen %d, msglen %u\n", dlen, pkt->rm_len); + return; + } + if (__predict_false(pkt->rm_len < + pkt->rm_datalen + pkt->rm_oobdatalen + pkt->rm_pktinfolen)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msglen, " + "msglen %u, data %u, oob %u, pktinfo %u\n", + pkt->rm_len, pkt->rm_datalen, pkt->rm_oobdatalen, + pkt->rm_pktinfolen); + return; + } + if (__predict_false(pkt->rm_datalen == 0)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, no data\n"); + return; + } + + /* + * Check offests. + */ +#define IS_OFFSET_INVALID(ofs) \ + ((ofs) < RNDIS_PACKET_MSG_OFFSET_MIN || \ + ((ofs) & RNDIS_PACKET_MSG_OFFSET_ALIGNMASK)) + + /* XXX Hyper-V does not meet data offset alignment requirement */ + if (__predict_false(pkt->rm_dataoffset < RNDIS_PACKET_MSG_OFFSET_MIN)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "data offset %u\n", pkt->rm_dataoffset); + return; + } + if (__predict_false(pkt->rm_oobdataoffset > 0 && + IS_OFFSET_INVALID(pkt->rm_oobdataoffset))) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob offset %u\n", pkt->rm_oobdataoffset); + return; + } + if (__predict_true(pkt->rm_pktinfooffset > 0) && + __predict_false(IS_OFFSET_INVALID(pkt->rm_pktinfooffset))) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "pktinfo offset %u\n", pkt->rm_pktinfooffset); + return; + } + +#undef IS_OFFSET_INVALID + + data_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_dataoffset); + data_len = pkt->rm_datalen; + pktinfo_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_pktinfooffset); + pktinfo_len = pkt->rm_pktinfolen; + + /* + * Check OOB coverage. + */ + if (__predict_false(pkt->rm_oobdatalen != 0)) { + int oob_off, oob_len; + + if_printf(rxr->hn_ifp, "got oobdata\n"); + oob_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_oobdataoffset); + oob_len = pkt->rm_oobdatalen; + + if (__predict_false(oob_off + oob_len > pkt->rm_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob overflow, msglen %u, oob abs %d len %d\n", + pkt->rm_len, oob_off, oob_len); + return; + } + + /* + * Check against data. + */ + if (hn_rndis_check_overlap(oob_off, oob_len, + data_off, data_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob overlaps data, oob abs %d len %d, " + "data abs %d len %d\n", + oob_off, oob_len, data_off, data_len); + return; + } + + /* + * Check against pktinfo. + */ + if (pktinfo_len != 0 && + hn_rndis_check_overlap(oob_off, oob_len, + pktinfo_off, pktinfo_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob overlaps pktinfo, oob abs %d len %d, " + "pktinfo abs %d len %d\n", + oob_off, oob_len, pktinfo_off, pktinfo_len); + return; + } + } + + /* + * Check per-packet-info coverage and find useful per-packet-info. + */ + info.vlan_info = HN_NDIS_VLAN_INFO_INVALID; + info.csum_info = HN_NDIS_RXCSUM_INFO_INVALID; + info.hash_info = HN_NDIS_HASH_INFO_INVALID; + if (__predict_true(pktinfo_len != 0)) { + bool overlap; + int error; + + if (__predict_false(pktinfo_off + pktinfo_len > pkt->rm_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "pktinfo overflow, msglen %u, " + "pktinfo abs %d len %d\n", + pkt->rm_len, pktinfo_off, pktinfo_len); + return; + } + + /* + * Check packet info coverage. + */ + overlap = hn_rndis_check_overlap(pktinfo_off, pktinfo_len, + data_off, data_len); + if (__predict_false(overlap)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "pktinfo overlap data, pktinfo abs %d len %d, " + "data abs %d len %d\n", + pktinfo_off, pktinfo_len, data_off, data_len); + return; + } + + /* + * Find useful per-packet-info. + */ + error = hn_rndis_rxinfo(((const uint8_t *)pkt) + pktinfo_off, + pktinfo_len, &info); + if (__predict_false(error)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg " + "pktinfo\n"); + return; + } + } + + if (__predict_false(data_off + data_len > pkt->rm_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "data overflow, msglen %u, data abs %d len %d\n", + pkt->rm_len, data_off, data_len); + return; + } + hn_rxpkt(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); +} + +static __inline void +hn_rndis_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen) +{ + const struct rndis_msghdr *hdr; + + if (__predict_false(dlen < sizeof(*hdr))) { + if_printf(rxr->hn_ifp, "invalid RNDIS msg\n"); + return; + } + hdr = data; + + if (__predict_true(hdr->rm_type == REMOTE_NDIS_PACKET_MSG)) { + /* Hot data path. */ + hn_rndis_rx_data(rxr, data, dlen); + /* Done! */ + return; + } + + if (hdr->rm_type == REMOTE_NDIS_INDICATE_STATUS_MSG) + hn_rndis_rx_status(rxr->hn_ifp->if_softc, data, dlen); + else + hn_rndis_rx_ctrl(rxr->hn_ifp->if_softc, data, dlen); +} + static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) { @@ -4079,8 +4456,8 @@ hn_nvs_handle_comp(struct hn_softc *sc, } static void -hn_nvs_handle_rxbuf(struct hn_softc *sc, struct hn_rx_ring *rxr, - struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) +hn_nvs_handle_rxbuf(struct hn_rx_ring *rxr, struct vmbus_channel *chan, + const struct vmbus_chanpkt_hdr *pkthdr) { const struct vmbus_chanpkt_rxbuf *pkt; const struct hn_nvs_hdr *nvs_hdr; @@ -4130,9 +4507,9 @@ hn_nvs_handle_rxbuf(struct hn_softc *sc, "ofs %d, len %d\n", i, ofs, len); continue; } - hv_rf_on_receive(sc, rxr, rxr->hn_rxbuf + ofs, len); + hn_rndis_rxpkt(rxr, rxr->hn_rxbuf + ofs, len); } - + /* * Moved completion call back here so that all received * messages (not just data messages) will trigger a response @@ -4196,7 +4573,7 @@ hn_chan_callback(struct vmbus_channel *c hn_nvs_handle_comp(sc, chan, pkt); break; case VMBUS_CHANPKT_TYPE_RXBUF: - hn_nvs_handle_rxbuf(sc, rxr, chan, pkt); + hn_nvs_handle_rxbuf(rxr, chan, pkt); break; case VMBUS_CHANPKT_TYPE_INBAND: hn_nvs_handle_notify(sc, pkt); @@ -4233,7 +4610,7 @@ hn_chan_callback(struct vmbus_channel *c if (bufferlen > HN_PKTBUF_LEN) free(buffer, M_DEVBUF); - hv_rf_channel_rollup(rxr, rxr->hn_txr); + hn_chan_rollup(rxr, rxr->hn_txr); } static void Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 05:53:58 2016 (r308505) +++ stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 06:23:01 2016 (r308506) @@ -29,12 +29,12 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_inet6.h" +#include "opt_inet.h" + #include -#include -#include #include -#include -#include +#include #include #include @@ -61,16 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define HV_RF_RECVINFO_VLAN 0x1 -#define HV_RF_RECVINFO_CSUM 0x2 -#define HV_RF_RECVINFO_HASHINF 0x4 -#define HV_RF_RECVINFO_HASHVAL 0x8 -#define HV_RF_RECVINFO_ALL \ - (HV_RF_RECVINFO_VLAN | \ - HV_RF_RECVINFO_CSUM | \ - HV_RF_RECVINFO_HASHINF | \ - HV_RF_RECVINFO_HASHVAL) - #define HN_RNDIS_RID_COMPAT_MASK 0xffff #define HN_RNDIS_RID_COMPAT_MAX HN_RNDIS_RID_COMPAT_MASK @@ -88,24 +78,23 @@ __FBSDID("$FreeBSD$"); #define HN_NDIS_LSOV2_CAP_IP6 \ (NDIS_LSOV2_CAP_IP6EXT | NDIS_LSOV2_CAP_TCP6OPT) -/* - * Forward declarations - */ -static void hv_rf_receive_indicate_status(struct hn_softc *sc, - const void *data, int dlen); -static void hv_rf_receive_data(struct hn_rx_ring *rxr, - const void *data, int dlen); - -static int hn_rndis_query(struct hn_softc *sc, uint32_t oid, - const void *idata, size_t idlen, void *odata, size_t *odlen0); -static int hn_rndis_query2(struct hn_softc *sc, uint32_t oid, - const void *idata, size_t idlen, void *odata, size_t *odlen0, - size_t min_odlen); -static int hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data, - size_t dlen); -static int hn_rndis_conf_offload(struct hn_softc *sc, int mtu); -static int hn_rndis_query_hwcaps(struct hn_softc *sc, - struct ndis_offload *caps); +static const void *hn_rndis_xact_exec1(struct hn_softc *, + struct vmbus_xact *, size_t, + struct hn_nvs_sendctx *, size_t *); +static const void *hn_rndis_xact_execute(struct hn_softc *, + struct vmbus_xact *, uint32_t, size_t, size_t *, + uint32_t); +static int hn_rndis_query(struct hn_softc *, uint32_t, + const void *, size_t, void *, size_t *); +static int hn_rndis_query2(struct hn_softc *, uint32_t, + const void *, size_t, void *, size_t *, size_t); +static int hn_rndis_set(struct hn_softc *, uint32_t, + const void *, size_t); +static int hn_rndis_init(struct hn_softc *); +static int hn_rndis_halt(struct hn_softc *); +static int hn_rndis_conf_offload(struct hn_softc *, int); +static int hn_rndis_query_hwcaps(struct hn_softc *, + struct ndis_offload *); static __inline uint32_t hn_rndis_rid(struct hn_softc *sc) @@ -121,371 +110,22 @@ again: return ((rid & 0xffff) << 16); } -void * -hn_rndis_pktinfo_append(struct rndis_packet_msg *pkt, size_t pktsize, - size_t pi_dlen, uint32_t pi_type) -{ - const size_t pi_size = HN_RNDIS_PKTINFO_SIZE(pi_dlen); - struct rndis_pktinfo *pi; - - KASSERT((pi_size & RNDIS_PACKET_MSG_OFFSET_ALIGNMASK) == 0, - ("unaligned pktinfo size %zu, pktinfo dlen %zu", pi_size, pi_dlen)); - - /* - * Per-packet-info does not move; it only grows. - * - * NOTE: - * rm_pktinfooffset in this phase counts from the beginning - * of rndis_packet_msg. - */ - KASSERT(pkt->rm_pktinfooffset + pkt->rm_pktinfolen + pi_size <= pktsize, - ("%u pktinfo overflows RNDIS packet msg", pi_type)); - pi = (struct rndis_pktinfo *)((uint8_t *)pkt + pkt->rm_pktinfooffset + - pkt->rm_pktinfolen); - pkt->rm_pktinfolen += pi_size; - - pi->rm_size = pi_size; - pi->rm_type = pi_type; - pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; - - /* Data immediately follow per-packet-info. */ - pkt->rm_dataoffset += pi_size; - - /* Update RNDIS packet msg length */ - pkt->rm_len += pi_size; - - return (pi->rm_data); -} - -/* - * RNDIS filter receive indicate status - */ -static void -hv_rf_receive_indicate_status(struct hn_softc *sc, const void *data, int dlen) -{ - const struct rndis_status_msg *msg; - int ofs; - - if (dlen < sizeof(*msg)) { - if_printf(sc->hn_ifp, "invalid RNDIS status\n"); - return; - } - msg = data; - - switch (msg->rm_status) { - case RNDIS_STATUS_MEDIA_CONNECT: - case RNDIS_STATUS_MEDIA_DISCONNECT: - hn_link_status_update(sc); - break; - - case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG: - /* Not really useful; ignore. */ - break; - - case RNDIS_STATUS_NETWORK_CHANGE: - ofs = RNDIS_STBUFOFFSET_ABS(msg->rm_stbufoffset); - if (dlen < ofs + msg->rm_stbuflen || - msg->rm_stbuflen < sizeof(uint32_t)) { - if_printf(sc->hn_ifp, "network changed\n"); - } else { - uint32_t change; - - memcpy(&change, ((const uint8_t *)msg) + ofs, - sizeof(change)); - if_printf(sc->hn_ifp, "network changed, change %u\n", - change); - } - hn_network_change(sc); - break; - - default: - /* TODO: */ - if_printf(sc->hn_ifp, "unknown RNDIS status 0x%08x\n", - msg->rm_status); - break; - } -} - -static int -hn_rndis_rxinfo(const void *info_data, int info_dlen, struct hn_recvinfo *info) -{ - const struct rndis_pktinfo *pi = info_data; - uint32_t mask = 0; - - while (info_dlen != 0) { - const void *data; - uint32_t dlen; - - if (__predict_false(info_dlen < sizeof(*pi))) - return (EINVAL); - if (__predict_false(info_dlen < pi->rm_size)) - return (EINVAL); - info_dlen -= pi->rm_size; - - if (__predict_false(pi->rm_size & RNDIS_PKTINFO_SIZE_ALIGNMASK)) - return (EINVAL); - if (__predict_false(pi->rm_size < pi->rm_pktinfooffset)) - return (EINVAL); - dlen = pi->rm_size - pi->rm_pktinfooffset; - data = pi->rm_data; - - switch (pi->rm_type) { - case NDIS_PKTINFO_TYPE_VLAN: - if (__predict_false(dlen < NDIS_VLAN_INFO_SIZE)) - return (EINVAL); - info->vlan_info = *((const uint32_t *)data); - mask |= HV_RF_RECVINFO_VLAN; - break; - - case NDIS_PKTINFO_TYPE_CSUM: - if (__predict_false(dlen < NDIS_RXCSUM_INFO_SIZE)) - return (EINVAL); - info->csum_info = *((const uint32_t *)data); - mask |= HV_RF_RECVINFO_CSUM; - break; - - case HN_NDIS_PKTINFO_TYPE_HASHVAL: - if (__predict_false(dlen < HN_NDIS_HASH_VALUE_SIZE)) - return (EINVAL); - info->hash_value = *((const uint32_t *)data); - mask |= HV_RF_RECVINFO_HASHVAL; - break; - - case HN_NDIS_PKTINFO_TYPE_HASHINF: - if (__predict_false(dlen < HN_NDIS_HASH_INFO_SIZE)) - return (EINVAL); - info->hash_info = *((const uint32_t *)data); - mask |= HV_RF_RECVINFO_HASHINF; - break; - - default: - goto next; - } - - if (mask == HV_RF_RECVINFO_ALL) { - /* All found; done */ - break; - } -next: - pi = (const struct rndis_pktinfo *) - ((const uint8_t *)pi + pi->rm_size); - } - - /* - * Final fixup. - * - If there is no hash value, invalidate the hash info. - */ - if ((mask & HV_RF_RECVINFO_HASHVAL) == 0) - info->hash_info = HN_NDIS_HASH_INFO_INVALID; - return (0); -} - -static __inline bool -hn_rndis_check_overlap(int off, int len, int check_off, int check_len) -{ - - if (off < check_off) { - if (__predict_true(off + len <= check_off)) - return (false); - } else if (off > check_off) { - if (__predict_true(check_off + check_len <= off)) - return (false); - } - return (true); -} - -/* - * RNDIS filter receive data - */ -static void -hv_rf_receive_data(struct hn_rx_ring *rxr, const void *data, int dlen) -{ - const struct rndis_packet_msg *pkt; - struct hn_recvinfo info; - int data_off, pktinfo_off, data_len, pktinfo_len; - - /* - * Check length. - */ - if (__predict_false(dlen < sizeof(*pkt))) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg\n"); - return; - } - pkt = data; - - if (__predict_false(dlen < pkt->rm_len)) { - if_printf(rxr->hn_ifp, "truncated RNDIS packet msg, " - "dlen %d, msglen %u\n", dlen, pkt->rm_len); - return; - } - if (__predict_false(pkt->rm_len < - pkt->rm_datalen + pkt->rm_oobdatalen + pkt->rm_pktinfolen)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msglen, " - "msglen %u, data %u, oob %u, pktinfo %u\n", - pkt->rm_len, pkt->rm_datalen, pkt->rm_oobdatalen, - pkt->rm_pktinfolen); - return; - } - if (__predict_false(pkt->rm_datalen == 0)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, no data\n"); - return; - } - - /* - * Check offests. - */ -#define IS_OFFSET_INVALID(ofs) \ - ((ofs) < RNDIS_PACKET_MSG_OFFSET_MIN || \ - ((ofs) & RNDIS_PACKET_MSG_OFFSET_ALIGNMASK)) - - /* XXX Hyper-V does not meet data offset alignment requirement */ - if (__predict_false(pkt->rm_dataoffset < RNDIS_PACKET_MSG_OFFSET_MIN)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "data offset %u\n", pkt->rm_dataoffset); - return; - } - if (__predict_false(pkt->rm_oobdataoffset > 0 && - IS_OFFSET_INVALID(pkt->rm_oobdataoffset))) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "oob offset %u\n", pkt->rm_oobdataoffset); - return; - } - if (__predict_true(pkt->rm_pktinfooffset > 0) && - __predict_false(IS_OFFSET_INVALID(pkt->rm_pktinfooffset))) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "pktinfo offset %u\n", pkt->rm_pktinfooffset); - return; - } - -#undef IS_OFFSET_INVALID - - data_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_dataoffset); - data_len = pkt->rm_datalen; - pktinfo_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_pktinfooffset); - pktinfo_len = pkt->rm_pktinfolen; - - /* - * Check OOB coverage. - */ - if (__predict_false(pkt->rm_oobdatalen != 0)) { - int oob_off, oob_len; - - if_printf(rxr->hn_ifp, "got oobdata\n"); - oob_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_oobdataoffset); - oob_len = pkt->rm_oobdatalen; - - if (__predict_false(oob_off + oob_len > pkt->rm_len)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "oob overflow, msglen %u, oob abs %d len %d\n", - pkt->rm_len, oob_off, oob_len); - return; - } - - /* - * Check against data. - */ - if (hn_rndis_check_overlap(oob_off, oob_len, - data_off, data_len)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "oob overlaps data, oob abs %d len %d, " - "data abs %d len %d\n", - oob_off, oob_len, data_off, data_len); - return; - } - - /* - * Check against pktinfo. - */ - if (pktinfo_len != 0 && - hn_rndis_check_overlap(oob_off, oob_len, - pktinfo_off, pktinfo_len)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "oob overlaps pktinfo, oob abs %d len %d, " - "pktinfo abs %d len %d\n", - oob_off, oob_len, pktinfo_off, pktinfo_len); - return; - } - } - - /* - * Check per-packet-info coverage and find useful per-packet-info. - */ - info.vlan_info = HN_NDIS_VLAN_INFO_INVALID; - info.csum_info = HN_NDIS_RXCSUM_INFO_INVALID; - info.hash_info = HN_NDIS_HASH_INFO_INVALID; - if (__predict_true(pktinfo_len != 0)) { - bool overlap; - int error; - - if (__predict_false(pktinfo_off + pktinfo_len > pkt->rm_len)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "pktinfo overflow, msglen %u, " - "pktinfo abs %d len %d\n", - pkt->rm_len, pktinfo_off, pktinfo_len); - return; - } - - /* - * Check packet info coverage. - */ - overlap = hn_rndis_check_overlap(pktinfo_off, pktinfo_len, - data_off, data_len); - if (__predict_false(overlap)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "pktinfo overlap data, pktinfo abs %d len %d, " - "data abs %d len %d\n", - pktinfo_off, pktinfo_len, data_off, data_len); - return; - } - - /* - * Find useful per-packet-info. - */ - error = hn_rndis_rxinfo(((const uint8_t *)pkt) + pktinfo_off, - pktinfo_len, &info); - if (__predict_false(error)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg " - "pktinfo\n"); - return; - } - } - - if (__predict_false(data_off + data_len > pkt->rm_len)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "data overflow, msglen %u, data abs %d len %d\n", - pkt->rm_len, data_off, data_len); - return; - } - hn_rxpkt(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); -} - -/* - * RNDIS filter on receive - */ void -hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, - const void *data, int dlen) +hn_rndis_rx_ctrl(struct hn_softc *sc, const void *data, int dlen) { const struct rndis_comp_hdr *comp; const struct rndis_msghdr *hdr; - if (__predict_false(dlen < sizeof(*hdr))) { - if_printf(rxr->hn_ifp, "invalid RNDIS msg\n"); - return; - } + KASSERT(dlen >= sizeof(*hdr), ("invalid RNDIS msg\n")); hdr = data; switch (hdr->rm_type) { - case REMOTE_NDIS_PACKET_MSG: - hv_rf_receive_data(rxr, data, dlen); - break; - case REMOTE_NDIS_INITIALIZE_CMPLT: case REMOTE_NDIS_QUERY_CMPLT: case REMOTE_NDIS_SET_CMPLT: case REMOTE_NDIS_KEEPALIVE_CMPLT: /* unused */ if (dlen < sizeof(*comp)) { - if_printf(rxr->hn_ifp, "invalid RNDIS cmplt\n"); + if_printf(sc->hn_ifp, "invalid RNDIS cmplt\n"); return; } comp = data; @@ -495,10 +135,6 @@ hv_rf_on_receive(struct hn_softc *sc, st vmbus_xact_ctx_wakeup(sc->hn_xact, comp, dlen); break; - case REMOTE_NDIS_INDICATE_STATUS_MSG: - hv_rf_receive_indicate_status(sc, data, dlen); - break; - case REMOTE_NDIS_RESET_CMPLT: /* * Reset completed, no rid. @@ -507,11 +143,11 @@ hv_rf_on_receive(struct hn_softc *sc, st * RESET is not issued by hn(4), so this message should * _not_ be observed. */ - if_printf(rxr->hn_ifp, "RESET cmplt received\n"); + if_printf(sc->hn_ifp, "RESET cmplt received\n"); break; default: - if_printf(rxr->hn_ifp, "unknown RNDIS msg 0x%x\n", + if_printf(sc->hn_ifp, "unknown RNDIS msg 0x%x\n", hdr->rm_type); break; } @@ -1354,10 +990,3 @@ hn_rndis_detach(struct hn_softc *sc) /* Halt the RNDIS. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Nov 11 06:26:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A05BAC3B92C; Fri, 11 Nov 2016 06:26:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 685C71FA7; Fri, 11 Nov 2016 06:26:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB6QYqo062587; Fri, 11 Nov 2016 06:26:34 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB6QYRb062585; Fri, 11 Nov 2016 06:26:34 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110626.uAB6QYRb062585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 06:26:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308507 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 06:26:35 -0000 Author: sephe Date: Fri Nov 11 06:26:34 2016 New Revision: 308507 URL: https://svnweb.freebsd.org/changeset/base/308507 Log: hyperv/hn: Fix i386 build; if_baudrate is 32bits on i386 on stable/10 This is a direct commit. Sponsored by: Microsoft Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 06:23:01 2016 (r308506) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 06:26:34 2016 (r308507) @@ -867,7 +867,12 @@ netvsc_attach(device_t dev) * Setup the ifnet for this interface. */ +#ifdef __LP64__ ifp->if_baudrate = IF_Gbps(10); +#else + /* if_baudrate is 32bits on 32bit system. */ + ifp->if_baudrate = IF_Gbps(1); +#endif ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; ifp->if_init = hn_init; From owner-svn-src-all@freebsd.org Fri Nov 11 06:42:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C21B6C3BD6A; Fri, 11 Nov 2016 06:42:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B735186A; Fri, 11 Nov 2016 06:42:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB6gkxr070532; Fri, 11 Nov 2016 06:42:46 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB6gkZX070526; Fri, 11 Nov 2016 06:42:46 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110642.uAB6gkZX070526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 06:42:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308508 - in stable/10/sys: conf dev/hyperv/netvsc modules/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 06:42:47 -0000 Author: sephe Date: Fri Nov 11 06:42:46 2016 New Revision: 308508 URL: https://svnweb.freebsd.org/changeset/base/308508 Log: MFC 308018,308116 308018 hyeprv/hn: Rename cleaned up RNDIS header file. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8360 308116 hyperv/hn: Rename cleaned up RNDIS source file. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8361 Added: stable/10/sys/dev/hyperv/netvsc/hn_rndis.c - copied, changed from r308507, stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/10/sys/dev/hyperv/netvsc/hn_rndis.h - copied unchanged from r308507, stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.h Deleted: stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.h Modified: stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/modules/hyperv/netvsc/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Fri Nov 11 06:26:34 2016 (r308507) +++ stable/10/sys/conf/files.amd64 Fri Nov 11 06:42:46 2016 (r308508) @@ -262,8 +262,8 @@ dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc dev/hyperv/netvsc/hn_nvs.c optional hyperv +dev/hyperv/netvsc/hn_rndis.c optional hyperv dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c optional hyperv -dev/hyperv/netvsc/hv_rndis_filter.c optional hyperv dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c optional hyperv dev/hyperv/utilities/hv_heartbeat.c optional hyperv dev/hyperv/utilities/hv_kvp.c optional hyperv Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Fri Nov 11 06:26:34 2016 (r308507) +++ stable/10/sys/conf/files.i386 Fri Nov 11 06:42:46 2016 (r308508) @@ -239,8 +239,8 @@ dev/hwpmc/hwpmc_ppro.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc dev/hyperv/netvsc/hn_nvs.c optional hyperv +dev/hyperv/netvsc/hn_rndis.c optional hyperv dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c optional hyperv -dev/hyperv/netvsc/hv_rndis_filter.c optional hyperv dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c optional hyperv dev/hyperv/utilities/hv_heartbeat.c optional hyperv dev/hyperv/utilities/hv_kvp.c optional hyperv Copied and modified: stable/10/sys/dev/hyperv/netvsc/hn_rndis.c (from r308507, stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c) ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 06:26:34 2016 (r308507, copy source) +++ stable/10/sys/dev/hyperv/netvsc/hn_rndis.c Fri Nov 11 06:42:46 2016 (r308508) @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #define HN_RNDIS_RID_COMPAT_MASK 0xffff #define HN_RNDIS_RID_COMPAT_MAX HN_RNDIS_RID_COMPAT_MASK Copied: stable/10/sys/dev/hyperv/netvsc/hn_rndis.h (from r308507, stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/hyperv/netvsc/hn_rndis.h Fri Nov 11 06:42:46 2016 (r308508, copy of r308507, stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.h) @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2010-2012 Citrix Inc. + * Copyright (c) 2012 NetApp Inc. + * 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 _HN_RNDIS_H_ +#define _HN_RNDIS_H_ + +struct hn_softc; + +int hn_rndis_attach(struct hn_softc *sc, int mtu); +void hn_rndis_detach(struct hn_softc *sc); +int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); +int hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt); +int hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr); +/* link_status: NDIS_MEDIA_STATE_ */ +int hn_rndis_get_linkstatus(struct hn_softc *sc, + uint32_t *link_status); +/* filter: NDIS_PACKET_TYPE_. */ +int hn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter); +void hn_rndis_rx_ctrl(struct hn_softc *sc, const void *data, + int dlen); + +#endif /* !_HN_RNDIS_H_ */ Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 06:26:34 2016 (r308507) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 06:42:46 2016 (r308508) @@ -127,7 +127,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include "vmbus_if.h" Modified: stable/10/sys/modules/hyperv/netvsc/Makefile ============================================================================== --- stable/10/sys/modules/hyperv/netvsc/Makefile Fri Nov 11 06:26:34 2016 (r308507) +++ stable/10/sys/modules/hyperv/netvsc/Makefile Fri Nov 11 06:42:46 2016 (r308508) @@ -4,9 +4,7 @@ ${.CURDIR}/../../../dev/hyperv/vmbus KMOD= hv_netvsc -SRCS= hn_nvs.c \ - hv_netvsc_drv_freebsd.c \ - hv_rndis_filter.c +SRCS= hn_nvs.c hn_rndis.c hv_netvsc_drv_freebsd.c SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h vmbus_if.h CFLAGS+= -I${.CURDIR}/../../../dev/hyperv/netvsc From owner-svn-src-all@freebsd.org Fri Nov 11 06:53:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 706AAC3A133; Fri, 11 Nov 2016 06:53:31 +0000 (UTC) (envelope-from kczekirda@gmail.com) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 91F131DE0; Fri, 11 Nov 2016 06:53:30 +0000 (UTC) (envelope-from kczekirda@gmail.com) Received: by mail-wm0-x22d.google.com with SMTP id t79so74618315wmt.0; Thu, 10 Nov 2016 22:53:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=I2Gxi2aufU1la1gjYrB+iy68aZUvDPXPeQJSl8eneqc=; b=Si47b9vndS1z5eTMqLqfbKxkZI0ufB9PgE6L1i6ZzUULxYXldp+HP3ME8SP4Dm5/gr ePFbwyqgzKf6XCuI2RqzgozGAevwGtrOUXMHI94FkHTos/uaA7ytGXpTUKEPq2DSrrpP Jhrs18yHqcCv6IZGj3eRo2TcjAa1s62TxUGzszfdoaOZONFDFNrHeiig3c0Ti9mCDOZ0 UoS6HTqcLGDaJgt/1gncJ9XM1V554TnETxoNWlQGMx5243BmwXiMcf4oA3GMqvfQzWDY 8CuMHPIIyBAZs67NUcFruvZvLcgM4yVTFquWGSwlrqsjHY8f7qzJtKrJtHLwSYUxDsFr OlWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=I2Gxi2aufU1la1gjYrB+iy68aZUvDPXPeQJSl8eneqc=; b=Sn9TLVCzwDIWbvgSKUcGAKdXKVD29ILJz+KscLAyQ9uLEUJN09/4UeuN8AHKBUBRm5 anV5qkET0pZ0T91Kv6bjU1fTf6qz+fxGkSHY17YpX/fBvHsic+C1W5IG2vew2g3oGTEw s3V8Z4wC1E68V7BiDynw8kaAHB8wAWSw8F1Q1MmNUEZWkDhJwxhctpFnAF/Z6frE2Xlt W2AXR7uv7Rfg7Agx3ldH4u0GuQKc0U9ub9fDMmVamv5Twea7Uz0vCiT6IRI0DEJ5exga diPHcbASD1jfU3N2aDsvn4iOHGNU30ONc1YNeFnGZJhjvZYFWBszkG2c7nYb6fDmYKoM cVMg== X-Gm-Message-State: ABUngvcojalP88ArHhK8Wn5MTWo0GXsvYDPd3gIFnYLR8hiyfOyqBCYu2uhxg2xPe7aGBpx5A3aXRXFbpNAMPQ== X-Received: by 10.28.54.161 with SMTP id y33mr10240811wmh.122.1478847208773; Thu, 10 Nov 2016 22:53:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.49.137 with HTTP; Thu, 10 Nov 2016 22:52:57 -0800 (PST) In-Reply-To: <8E0E5C94-EFD7-4008-B563-FF080A98F23D@me.com> References: <201611080650.uA86oJ7W056026@repo.freebsd.org> <8E0E5C94-EFD7-4008-B563-FF080A98F23D@me.com> From: Kamil Czekirda Date: Fri, 11 Nov 2016 07:52:57 +0100 Message-ID: Subject: Re: svn commit: r308434 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sys... To: Toomas Soome Cc: Toomas Soome , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 06:53:31 -0000 cp /usr/src/lib/libstand/libstand.h /usr/include/stand.h fixed that thanks 2016-11-10 23:28 GMT+01:00 Toomas Soome : > the patch does update the lib/libstand/stand.h to have: > > struct devsw { > . . . > int (*dv_print)(int verbose); > > it was void before; from your svnlite log I can see the > lib/libstand/stand.h is updated, could you confirm if it is int now? if i= t > is, I suspect the build is getting the old stand.h from somewhere in the > tree and not your /lib/libstand. > > if so, does the build has target to copy headers in place? I=E2=80=99m so= rry, I > don't know all the tricks the build system does as part of the buildworld= .. > > rgds, > toomas > > > On 11. nov 2016, at 0:21, Kamil Czekirda wrote: > > Hi, > > I got the following: > > root@current:/usr/src # svnlite up -r r308434 > Updating '.': > U lib/libstand/stand.h > U sys/boot/common/dev_net.c > U sys/boot/common/module.c > U sys/boot/common/part.c > U sys/boot/common/util.c > U sys/boot/common/util.h > U sys/boot/efi/libefi/efinet.c > U sys/boot/efi/libefi/efipart.c > U sys/boot/efi/loader/main.c > U sys/boot/i386/libfirewire/firewire.c > U sys/boot/i386/libi386/bioscd.c > U sys/boot/i386/libi386/biosdisk.c > U sys/boot/mips/beri/loader/beri_disk_cfi.c > U sys/boot/mips/beri/loader/beri_disk_sdcard.c > U sys/boot/ofw/libofw/ofw_disk.c > U sys/boot/pc98/libpc98/bioscd.c > U sys/boot/pc98/libpc98/biosdisk.c > U sys/boot/powerpc/kboot/hostdisk.c > U sys/boot/powerpc/ps3/ps3cdrom.c > U sys/boot/powerpc/ps3/ps3disk.c > U sys/boot/uboot/lib/disk.c > U sys/boot/usb/storage/umass_loader.c > U sys/boot/userboot/userboot/host.c > U sys/boot/userboot/userboot/userboot_disk.c > U sys/boot/zfs/zfs.c > U sys/boot/zfs/zfsimpl.c > U sys/boot/i386/libi386/pxe.c > Updated to revision 308434. > root@current:/usr/src # cd sys/boot/ > root@current:/usr/src/sys/boot # make clean > (...) > root@current:/usr/src/sys/boot # make obj > (...) > root@current:/usr/src/sys/boot # make > (...) > cc -O2 -pipe -DSKEIN_LOOP=3D111 -fPIC -I/usr/src/sys/boot/efi/loader > -I/usr/src/sys/boot/efi/loader/arch/amd64 -I/usr/src/sys/boot/efi/loader/= ../include > -I/usr/src/sys/boot/efi/loader/../include/amd64 > -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include > -I/usr/src/sys/boot/efi/loader/../../.. -I/usr/src/sys/boot/efi/loader/..= /../i386/libi386 > -I/usr/src/sys/boot/efi/loader/../../zfs -I/usr/src/sys/boot/efi/loader/.= ./../../cddl/boot/zfs > -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT > -DNO_PCI -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH > -I/usr/src/sys/boot/efi/loader/../../ficl -I/usr/src/sys/boot/efi/loader/= ../../ficl/amd64 > -DLOADER_DISK_SUPPORT -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC > -I/usr/src/sys/boot/ficl -I/usr/src/sys/boot/ficl/amd64 > -I/usr/src/sys/boot/ficl/../common -I/usr/src/sys/boot/efi/loader/../../= common > -ffreestanding -Wformat -msoft-float -mno-mmx -mno-sse -mno-avx > -fshort-wchar -mno-red-zone -mno-aes -g -MD -MF.depend.vers.o -MTvers.o > -std=3Dgnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W > -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes > -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body > -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare > -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function > -Wno-enum-conversion -Wno-unused-local-typedef -Qunused-arguments -c > vers.c -o vers.o > cc -O2 -pipe -DSKEIN_LOOP=3D111 -fPIC -I/usr/src/sys/boot/efi/loader > -I/usr/src/sys/boot/efi/loader/arch/amd64 -I/usr/src/sys/boot/efi/loader/= ../include > -I/usr/src/sys/boot/efi/loader/../include/amd64 > -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include > -I/usr/src/sys/boot/efi/loader/../../.. -I/usr/src/sys/boot/efi/loader/..= /../i386/libi386 > -I/usr/src/sys/boot/efi/loader/../../zfs -I/usr/src/sys/boot/efi/loader/.= ./../../cddl/boot/zfs > -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT > -DNO_PCI -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH > -I/usr/src/sys/boot/efi/loader/../../ficl -I/usr/src/sys/boot/efi/loader/= ../../ficl/amd64 > -DLOADER_DISK_SUPPORT -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC > -I/usr/src/sys/boot/ficl -I/usr/src/sys/boot/ficl/amd64 > -I/usr/src/sys/boot/ficl/../common -I/usr/src/sys/boot/efi/loader/../../= common > -ffreestanding -Wformat -msoft-float -mno-mmx -mno-sse -mno-avx > -fshort-wchar -mno-red-zone -mno-aes -g -MD -MF.depend.zfs.o -MTzfs.o > -std=3Dgnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W > -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes > -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body > -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare > -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function > -Wno-enum-conversion -Wno-unused-local-typedef -Wno-sign-compare > -Wno-array-bounds -Wno-missing-prototypes -Qunused-arguments -c > /usr/src/sys/boot/efi/loader/../../zfs/zfs.c -o zfs.o > /usr/src/sys/boot/efi/loader/../../zfs/zfs.c:599:14: error: incompatible > pointer types initializing 'void (*)(int)' with an expression of type 'in= t > (int)' [-Werror,-Wincompatible-pointer-types] > .dv_print =3D zfs_dev_print, > ^~~~~~~~~~~~~ > 1 error generated. > *** Error code 1 > > Stop. > make[2]: stopped in /usr/src/sys/boot/efi/loader > *** Error code 1 > > Stop. > make[1]: stopped in /usr/src/sys/boot/efi > *** Error code 1 > > Stop. > make: stopped in /usr/src/sys/boot > > > Kamil > > 2016-11-08 7:50 GMT+01:00 Toomas Soome : > >> Author: tsoome >> Date: Tue Nov 8 06:50:18 2016 >> New Revision: 308434 >> URL: https://svnweb.freebsd.org/changeset/base/308434 >> >> Log: >> Loader paged/pageable data is not always paged. >> >> This change does modify devsw dv_print() to return the int value, >> enabling walkers to interrupt the walk on non zero value from >> dv_print(). >> >> This will allow the pager_print actually to stop displaying data on >> user input, and additionally pager is used in various *dev_print >> callbacks, >> where it was missing. >> >> For test, lsdev [-v] command should display data by screenfuls and >> should >> stop when the key 'q' is pressed on pager prompt. >> >> Reviewed by: allanjude >> Approved by: allanjude (mentor) >> Differential Revision: https://reviews.freebsd.org/D5461 >> >> Modified: >> head/lib/libstand/stand.h >> head/sys/boot/common/dev_net.c >> head/sys/boot/common/module.c >> head/sys/boot/common/part.c >> head/sys/boot/common/util.c >> head/sys/boot/common/util.h >> head/sys/boot/efi/libefi/efinet.c >> head/sys/boot/efi/libefi/efipart.c >> head/sys/boot/efi/loader/main.c >> head/sys/boot/i386/libfirewire/firewire.c >> head/sys/boot/i386/libi386/bioscd.c >> head/sys/boot/i386/libi386/biosdisk.c >> head/sys/boot/i386/libi386/pxe.c >> head/sys/boot/mips/beri/loader/beri_disk_cfi.c >> head/sys/boot/mips/beri/loader/beri_disk_sdcard.c >> head/sys/boot/ofw/libofw/ofw_disk.c >> head/sys/boot/pc98/libpc98/bioscd.c >> head/sys/boot/pc98/libpc98/biosdisk.c >> head/sys/boot/powerpc/kboot/hostdisk.c >> head/sys/boot/powerpc/ps3/ps3cdrom.c >> head/sys/boot/powerpc/ps3/ps3disk.c >> head/sys/boot/uboot/lib/disk.c >> head/sys/boot/usb/storage/umass_loader.c >> head/sys/boot/userboot/userboot/host.c >> head/sys/boot/userboot/userboot/userboot_disk.c >> head/sys/boot/zfs/zfs.c >> head/sys/boot/zfs/zfsimpl.c >> >> Modified: head/lib/libstand/stand.h >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/lib/libstand/stand.h Tue Nov 8 06:13:22 2016 (r308433= ) >> +++ head/lib/libstand/stand.h Tue Nov 8 06:50:18 2016 (r308434= ) >> @@ -143,7 +143,7 @@ struct devsw { >> int (*dv_open)(struct open_file *f, ...); >> int (*dv_close)(struct open_file *f); >> int (*dv_ioctl)(struct open_file *f, u_long cmd, voi= d >> *data); >> - void (*dv_print)(int verbose); /* print device >> information */ >> + int (*dv_print)(int verbose); /* print device >> information */ >> void (*dv_cleanup)(void); >> }; >> >> >> Modified: head/sys/boot/common/dev_net.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/common/dev_net.c Tue Nov 8 06:13:22 2016 >> (r308433) >> +++ head/sys/boot/common/dev_net.c Tue Nov 8 06:50:18 2016 >> (r308434) >> @@ -80,7 +80,7 @@ static int net_open(struct open_file *, >> static int net_close(struct open_file *); >> static void net_cleanup(void); >> static int net_strategy(); >> -static void net_print(int); >> +static int net_print(int); >> >> static int net_getparams(int sock); >> >> @@ -325,23 +325,27 @@ exit: >> return (0); >> } >> >> -static void >> +static int >> net_print(int verbose) >> { >> struct netif_driver *drv; >> int i, d, cnt; >> + int ret =3D 0; >> >> cnt =3D 0; >> for (d =3D 0; netif_drivers[d]; d++) { >> drv =3D netif_drivers[d]; >> for (i =3D 0; i < drv->netif_nifs; i++) { >> printf("\t%s%d:", "net", cnt++); >> - if (verbose) >> + if (verbose) { >> printf(" (%s%d)", drv->netif_bname, >> drv->netif_ifs[i].dif_unit); >> + } >> + if ((ret =3D pager_output("\n")) !=3D 0) >> + return (ret); >> } >> } >> - printf("\n"); >> + return (ret); >> } >> >> /* >> >> Modified: head/sys/boot/common/module.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/common/module.c Tue Nov 8 06:13:22 2016 >> (r308433) >> +++ head/sys/boot/common/module.c Tue Nov 8 06:50:18 2016 >> (r308434) >> @@ -254,7 +254,7 @@ command_lsmod(int argc, char *argv[]) >> struct kernel_module *mp; >> struct file_metadata *md; >> char lbuf[80]; >> - int ch, verbose; >> + int ch, verbose, ret =3D 0; >> >> verbose =3D 0; >> optind =3D 1; >> @@ -273,11 +273,13 @@ command_lsmod(int argc, char *argv[]) >> >> pager_open(); >> for (fp =3D preloaded_files; fp; fp =3D fp->f_next) { >> - sprintf(lbuf, " %p: ", (void *) fp->f_addr); >> + snprintf(lbuf, sizeof(lbuf), " %p: ", (void *) fp->f_addr); >> pager_output(lbuf); >> pager_output(fp->f_name); >> - sprintf(lbuf, " (%s, 0x%lx)\n", fp->f_type, (long)fp->f_size); >> - pager_output(lbuf); >> + snprintf(lbuf, sizeof(lbuf), " (%s, 0x%lx)\n", fp->f_type, >> + (long)fp->f_size); >> + if (pager_output(lbuf)) >> + break; >> if (fp->f_args !=3D NULL) { >> pager_output(" args: "); >> pager_output(fp->f_args); >> @@ -287,7 +289,8 @@ command_lsmod(int argc, char *argv[]) >> if (fp->f_modules) { >> pager_output(" modules: "); >> for (mp =3D fp->f_modules; mp; mp =3D mp->m_next) { >> - sprintf(lbuf, "%s.%d ", mp->m_name, mp->m_version); >> + snprintf(lbuf, sizeof(lbuf), "%s.%d ", mp->m_name, >> + mp->m_version); >> pager_output(lbuf); >> } >> if (pager_output("\n")) >> @@ -296,11 +299,14 @@ command_lsmod(int argc, char *argv[]) >> if (verbose) { >> /* XXX could add some formatting smarts here to display some >> better */ >> for (md =3D fp->f_metadata; md !=3D NULL; md =3D md->md_next= ) { >> - sprintf(lbuf, " 0x%04x, 0x%lx\n", md->md_type, >> (long) md->md_size); >> + snprintf(lbuf, sizeof(lbuf), " 0x%04x, 0x%lx\n", >> + md->md_type, (long) md->md_size); >> if (pager_output(lbuf)) >> break; >> } >> } >> + if (ret) >> + break; >> } >> pager_close(); >> return(CMD_OK); >> >> Modified: head/sys/boot/common/part.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/common/part.c Tue Nov 8 06:13:22 2016 (r308433= ) >> +++ head/sys/boot/common/part.c Tue Nov 8 06:50:18 2016 (r308434= ) >> @@ -834,6 +834,7 @@ ptable_iterate(const struct ptable *tabl >> { >> struct pentry *entry; >> char name[32]; >> + int ret =3D 0; >> >> name[0] =3D '\0'; >> STAILQ_FOREACH(entry, &table->entries, entry) { >> @@ -856,9 +857,8 @@ ptable_iterate(const struct ptable *tabl >> if (table->type =3D=3D PTABLE_BSD) >> sprintf(name, "%c", (u_char) 'a' + >> entry->part.index); >> - if (iter(arg, name, &entry->part)) >> - return 1; >> + if ((ret =3D iter(arg, name, &entry->part)) !=3D 0) >> + return (ret); >> } >> - return 0; >> + return (ret); >> } >> - >> >> Modified: head/sys/boot/common/util.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/common/util.c Tue Nov 8 06:13:22 2016 (r308433= ) >> +++ head/sys/boot/common/util.c Tue Nov 8 06:50:18 2016 (r308434= ) >> @@ -114,7 +114,7 @@ strlen(const char *s) >> return (len); >> } >> >> -void >> +int >> printf(const char *fmt, ...) >> { >> va_list ap; >> @@ -178,4 +178,5 @@ nextfmt: >> } >> } >> va_end(ap); >> + return (0); >> } >> >> Modified: head/sys/boot/common/util.h >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/common/util.h Tue Nov 8 06:13:22 2016 (r308433= ) >> +++ head/sys/boot/common/util.h Tue Nov 8 06:50:18 2016 (r308434= ) >> @@ -48,6 +48,6 @@ void strcat(char *dst, const char *src); >> char *strchr(const char *s, char ch); >> size_t strlen(const char *s); >> >> -void printf(const char *fmt, ...); >> +int printf(const char *fmt, ...); >> >> #endif /* !_UTIL_H_ */ >> >> Modified: head/sys/boot/efi/libefi/efinet.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/efi/libefi/efinet.c Tue Nov 8 06:13:22 2016 >> (r308433) >> +++ head/sys/boot/efi/libefi/efinet.c Tue Nov 8 06:50:18 2016 >> (r308434) >> @@ -252,7 +252,7 @@ efinet_end(struct netif *nif) >> } >> >> static int efinet_dev_init(void); >> -static void efinet_dev_print(int); >> +static int efinet_dev_print(int); >> >> struct devsw efinet_dev =3D { >> .dv_name =3D "net", >> @@ -346,14 +346,13 @@ efinet_dev_init() >> return (0); >> } >> >> -static void >> +static int >> efinet_dev_print(int verbose) >> { >> CHAR16 *text; >> EFI_HANDLE h; >> - int unit; >> + int unit, ret =3D 0; >> >> - pager_open(); >> for (unit =3D 0, h =3D efi_find_handle(&efinet_dev, 0); >> h !=3D NULL; h =3D efi_find_handle(&efinet_dev, ++unit)) { >> printf(" %s%d:", efinet_dev.dv_name, unit); >> @@ -364,8 +363,8 @@ efinet_dev_print(int verbose) >> efi_free_devpath_name(text); >> } >> } >> - if (pager_output("\n")) >> + if ((ret =3D pager_output("\n")) !=3D 0) >> break; >> } >> - pager_close(); >> + return (ret); >> } >> >> Modified: head/sys/boot/efi/libefi/efipart.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/efi/libefi/efipart.c Tue Nov 8 06:13:22 2016 >> (r308433) >> +++ head/sys/boot/efi/libefi/efipart.c Tue Nov 8 06:50:18 2016 >> (r308434) >> @@ -47,7 +47,7 @@ static int efipart_realstrategy(void *, >> size_t *); >> static int efipart_open(struct open_file *, ...); >> static int efipart_close(struct open_file *); >> -static void efipart_print(int); >> +static int efipart_print(int); >> >> struct devsw efipart_dev =3D { >> .dv_name =3D "part", >> @@ -162,7 +162,7 @@ efipart_init(void) >> return (err); >> } >> >> -static void >> +static int >> efipart_print(int verbose) >> { >> char line[80]; >> @@ -170,28 +170,29 @@ efipart_print(int verbose) >> EFI_HANDLE h; >> EFI_STATUS status; >> u_int unit; >> + int ret =3D 0; >> >> - pager_open(); >> for (unit =3D 0, h =3D efi_find_handle(&efipart_dev, 0); >> h !=3D NULL; h =3D efi_find_handle(&efipart_dev, ++unit)) { >> - sprintf(line, " %s%d:", efipart_dev.dv_name, unit); >> - if (pager_output(line)) >> + snprintf(line, sizeof(line), " %s%d:", >> + efipart_dev.dv_name, unit); >> + if ((ret =3D pager_output(line)) !=3D 0) >> break; >> >> status =3D BS->HandleProtocol(h, &blkio_guid, (void >> **)&blkio); >> if (!EFI_ERROR(status)) { >> - sprintf(line, " %llu blocks", >> + snprintf(line, sizeof(line), " %llu blocks", >> (unsigned long long)(blkio->Media->LastBlock >> + 1)); >> - if (pager_output(line)) >> + if ((ret =3D pager_output(line)) !=3D 0) >> break; >> if (blkio->Media->RemovableMedia) >> - if (pager_output(" (removable)")) >> + if ((ret =3D pager_output(" (removable)"= )) >> !=3D 0) >> break; >> } >> - if (pager_output("\n")) >> + if ((ret =3D pager_output("\n")) !=3D 0) >> break; >> } >> - pager_close(); >> + return (ret); >> } >> >> static int >> >> Modified: head/sys/boot/efi/loader/main.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/efi/loader/main.c Tue Nov 8 06:13:22 2016 >> (r308433) >> +++ head/sys/boot/efi/loader/main.c Tue Nov 8 06:50:18 2016 >> (r308434) >> @@ -533,6 +533,7 @@ command_memmap(int argc, char *argv[]) >> UINT32 dver; >> EFI_STATUS status; >> int i, ndesc; >> + char line[80]; >> static char *types[] =3D { >> "Reserved", >> "LoaderCode", >> @@ -564,14 +565,19 @@ command_memmap(int argc, char *argv[]) >> } >> >> ndesc =3D sz / dsz; >> - printf("%23s %12s %12s %8s %4s\n", >> + snprintf(line, sizeof(line), "%23s %12s %12s %8s %4s\n", >> "Type", "Physical", "Virtual", "#Pages", "Attr"); >> + pager_open(); >> + if (pager_output(line)) { >> + pager_close(); >> + return (CMD_OK); >> + } >> >> for (i =3D 0, p =3D map; i < ndesc; >> i++, p =3D NextMemoryDescriptor(p, dsz)) { >> printf("%23s %012jx %012jx %08jx ", types[p->Type], >> - (uintmax_t)p->PhysicalStart, >> (uintmax_t)p->VirtualStart, >> - (uintmax_t)p->NumberOfPages); >> + (uintmax_t)p->PhysicalStart, >> (uintmax_t)p->VirtualStart, >> + (uintmax_t)p->NumberOfPages); >> if (p->Attribute & EFI_MEMORY_UC) >> printf("UC "); >> if (p->Attribute & EFI_MEMORY_WC) >> @@ -588,9 +594,11 @@ command_memmap(int argc, char *argv[]) >> printf("RP "); >> if (p->Attribute & EFI_MEMORY_XP) >> printf("XP "); >> - printf("\n"); >> + if (pager_output("\n")) >> + break; >> } >> >> + pager_close(); >> return (CMD_OK); >> } >> >> @@ -612,10 +620,17 @@ guid_to_string(EFI_GUID *guid) >> static int >> command_configuration(int argc, char *argv[]) >> { >> + char line[80]; >> UINTN i; >> >> - printf("NumberOfTableEntries=3D%lu\n", >> + snprintf(line, sizeof(line), "NumberOfTableEntries=3D%lu\n", >> (unsigned long)ST->NumberOfTableEntries); >> + pager_open(); >> + if (pager_output(line)) { >> + pager_close(); >> + return (CMD_OK); >> + } >> + >> for (i =3D 0; i < ST->NumberOfTableEntries; i++) { >> EFI_GUID *guid; >> >> @@ -642,9 +657,13 @@ command_configuration(int argc, char *ar >> printf("FDT Table"); >> else >> printf("Unknown Table (%s)", >> guid_to_string(guid)); >> - printf(" at %p\n", ST->ConfigurationTable[i].Vend >> orTable); >> + snprintf(line, sizeof(line), " at %p\n", >> + ST->ConfigurationTable[i].VendorTable); >> + if (pager_output(line)) >> + break; >> } >> >> + pager_close(); >> return (CMD_OK); >> } >> >> >> Modified: head/sys/boot/i386/libfirewire/firewire.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/i386/libfirewire/firewire.c Tue Nov 8 06:13:22 >> 2016 (r308433) >> +++ head/sys/boot/i386/libfirewire/firewire.c Tue Nov 8 06:50:18 >> 2016 (r308434) >> @@ -69,7 +69,7 @@ static int fw_strategy(void *devdata, in >> size_t offset, size_t size, char *buf, size_t *rsize= ); >> static int fw_open(struct open_file *f, ...); >> static int fw_close(struct open_file *f); >> -static void fw_print(int verbose); >> +static int fw_print(int verbose); >> static void fw_cleanup(void); >> >> void fw_enable(void); >> @@ -148,21 +148,26 @@ fw_init(void) >> /* >> * Print information about OHCI chips >> */ >> -static void >> +static int >> fw_print(int verbose) >> { >> - int i; >> + char line[80]; >> + int i, ret =3D 0; >> struct fwohci_softc *sc; >> >> for (i =3D 0; i < MAX_OHCI; i ++) { >> sc =3D &fwinfo[i]; >> if (sc->state =3D=3D FWOHCI_STATE_DEAD) >> break; >> - printf("%d: locator=3D0x%04x devid=3D0x%08x" >> + snprintf(line, sizeof(line), "%d: locator=3D0x%04x >> devid=3D0x%08x" >> " base_addr=3D0x%08x handle=3D0x%08x bus_id=3D0x= %08x\n", >> i, sc->locator, sc->devid, >> sc->base_addr, sc->handle, sc->bus_id); >> + ret =3D pager_output(line); >> + if (ret !=3D 0) >> + break; >> } >> + return (ret); >> } >> >> static int >> >> Modified: head/sys/boot/i386/libi386/bioscd.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/i386/libi386/bioscd.c Tue Nov 8 06:13:22 2016 >> (r308433) >> +++ head/sys/boot/i386/libi386/bioscd.c Tue Nov 8 06:50:18 2016 >> (r308434) >> @@ -100,7 +100,7 @@ static int bc_realstrategy(void *devdata >> size_t offset, size_t size, char *buf, size_t *rsize); >> static int bc_open(struct open_file *f, ...); >> static int bc_close(struct open_file *f); >> -static void bc_print(int verbose); >> +static int bc_print(int verbose); >> >> struct devsw bioscd =3D { >> "cd", >> @@ -177,20 +177,19 @@ bc_add(int biosdev) >> /* >> * Print information about disks >> */ >> -static void >> +static int >> bc_print(int verbose) >> { >> char line[80]; >> - int i; >> + int i, ret =3D 0; >> >> - pager_open(); >> for (i =3D 0; i < nbcinfo; i++) { >> - sprintf(line, " cd%d: Device 0x%x\n", i, >> + snprintf(line, sizeof(line), " cd%d: Device 0x%x\n", = i, >> bcinfo[i].bc_sp.sp_devicespec); >> - if (pager_output(line)) >> + if ((ret =3D pager_output(line)) !=3D 0) >> break; >> } >> - pager_close(); >> + return (ret); >> } >> >> /* >> >> Modified: head/sys/boot/i386/libi386/biosdisk.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/i386/libi386/biosdisk.c Tue Nov 8 06:13:22 >> 2016 (r308433) >> +++ head/sys/boot/i386/libi386/biosdisk.c Tue Nov 8 06:50:18 >> 2016 (r308434) >> @@ -135,7 +135,7 @@ static int bd_realstrategy(void *devdata >> static int bd_open(struct open_file *f, ...); >> static int bd_close(struct open_file *f); >> static int bd_ioctl(struct open_file *f, u_long cmd, void *data); >> -static void bd_print(int verbose); >> +static int bd_print(int verbose); >> static void bd_cleanup(void); >> >> #ifdef LOADER_GELI_SUPPORT >> @@ -321,21 +321,21 @@ bd_int13probe(struct bdinfo *bd) >> /* >> * Print information about disks >> */ >> -static void >> +static int >> bd_print(int verbose) >> { >> static char line[80]; >> struct disk_devdesc dev; >> - int i; >> + int i, ret =3D 0; >> >> - pager_open(); >> for (i =3D 0; i < nbdinfo; i++) { >> - sprintf(line, " disk%d: BIOS drive %c (%ju X >> %u):\n", i, >> + snprintf(line, sizeof(line), >> + " disk%d: BIOS drive %c (%ju X %u):\n", i, >> (bdinfo[i].bd_unit < 0x80) ? ('A' + >> bdinfo[i].bd_unit): >> ('C' + bdinfo[i].bd_unit - 0x80), >> (uintmax_t)bdinfo[i].bd_sectors, >> bdinfo[i].bd_sectorsize); >> - if (pager_output(line)) >> + if ((ret =3D pager_output(line)) !=3D 0) >> break; >> dev.d_dev =3D &biosdisk; >> dev.d_unit =3D i; >> @@ -346,12 +346,14 @@ bd_print(int verbose) >> bdinfo[i].bd_sectorsize, >> (bdinfo[i].bd_flags & BD_FLOPPY) ? >> DISK_F_NOCACHE: 0) =3D=3D 0) { >> - sprintf(line, " disk%d", i); >> - disk_print(&dev, line, verbose); >> + snprintf(line, sizeof(line), " disk%d", i); >> + ret =3D disk_print(&dev, line, verbose); >> disk_close(&dev); >> + if (ret !=3D 0) >> + return (ret); >> } >> } >> - pager_close(); >> + return (ret); >> } >> >> /* >> >> Modified: head/sys/boot/i386/libi386/pxe.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/i386/libi386/pxe.c Tue Nov 8 06:13:22 2016 >> (r308433) >> +++ head/sys/boot/i386/libi386/pxe.c Tue Nov 8 06:50:18 2016 >> (r308434) >> @@ -75,7 +75,7 @@ static int pxe_strategy(void *devdata, i >> size_t offset, size_t size, char *buf, >> size_t *rsize); >> static int pxe_open(struct open_file *f, ...); >> static int pxe_close(struct open_file *f); >> -static void pxe_print(int verbose); >> +static int pxe_print(int verbose); >> static void pxe_cleanup(void); >> static void pxe_setnfshandle(char *rootpath); >> >> @@ -381,14 +381,20 @@ pxe_close(struct open_file *f) >> return (0); >> } >> >> -static void >> +static int >> pxe_print(int verbose) >> { >> - >> + char line[255]; >> if (pxe_call =3D=3D NULL) >> - return; >> + return (0); >> >> - printf(" pxe0: %s:%s\n", inet_ntoa(rootip), rootpath); >> + if (verbose) { >> + snprintf(line, sizeof(line), " pxe0: %s:%s\n", >> + inet_ntoa(rootip), rootpath); >> + } else { >> + snprintf(line, sizeof(line), " pxe0:\n"); >> + } >> + return (pager_output(line)); >> } >> >> static void >> >> Modified: head/sys/boot/mips/beri/loader/beri_disk_cfi.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Nov 8 >> 06:13:22 2016 (r308433) >> +++ head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Nov 8 >> 06:50:18 2016 (r308434) >> @@ -47,7 +47,7 @@ static int beri_cfi_disk_close(struct op >> static void beri_cfi_disk_cleanup(void); >> static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t, >> size_t, >> char *, size_t *); >> -static void beri_cfi_disk_print(int); >> +static int beri_cfi_disk_print(int); >> >> struct devsw beri_cfi_disk =3D { >> .dv_name =3D "cfi", >> @@ -112,25 +112,29 @@ beri_cfi_disk_close(struct open_file *f) >> return (disk_close(dev)); >> } >> >> -static void >> +static int >> beri_cfi_disk_print(int verbose) >> { >> struct disk_devdesc dev; >> char line[80]; >> + int ret; >> >> - sprintf(line, " cfi%d CFI flash device\n", 0); >> - pager_output(line); >> + snprintf(line, sizeof(line), " cfi%d CFI flash device\n", 0= ); >> + ret =3D pager_output(line); >> + if (ret !=3D 0) >> + return (ret); >> dev.d_dev =3D &beri_cfi_disk; >> dev.d_unit =3D 0; >> dev.d_slice =3D -1; >> dev.d_partition =3D -1; >> if (disk_open(&dev, cfi_get_mediasize(), >> cfi_get_sectorsize(), 0) =3D=3D 0) { >> - sprintf(line, " cfi%d", 0); >> - disk_print(&dev, line, verbose); >> + snprintf(line, sizeof(line), " cfi%d", 0); >> + ret =3D disk_print(&dev, line, verbose); >> disk_close(&dev); >> } >> >> + return (ret); >> } >> >> static void >> >> Modified: head/sys/boot/mips/beri/loader/beri_disk_sdcard.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Nov 8 >> 06:13:22 2016 (r308433) >> +++ head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Nov 8 >> 06:50:18 2016 (r308434) >> @@ -47,7 +47,7 @@ static int beri_sdcard_disk_close(struct >> static void beri_sdcard_disk_cleanup(void); >> static int beri_sdcard_disk_strategy(void *, int, daddr_t, size_t, >> size_t, >> char *, size_t *); >> -static void beri_sdcard_disk_print(int); >> +static int beri_sdcard_disk_print(int); >> >> struct devsw beri_sdcard_disk =3D { >> .dv_name =3D "sdcard", >> @@ -123,19 +123,23 @@ beri_sdcard_disk_print(int verbose) >> { >> struct disk_devdesc dev; >> char line[80]; >> + int ret; >> >> - sprintf(line, " sdcard%d Altera SD card drive\n", 0); >> - pager_output(line); >> + snprintf(line, sizeof(line), " sdcard%d Altera SD card >> drive\n", 0); >> + ret =3D pager_output(line); >> + if (ret !=3D 0) >> + return (ret); >> dev.d_dev =3D &beri_sdcard_disk; >> dev.d_unit =3D 0; >> dev.d_slice =3D -1; >> dev.d_partition =3D -1; >> if (disk_open(&dev, altera_sdcard_get_mediasize(), >> altera_sdcard_get_sectorsize(), 0) =3D=3D 0) { >> - sprintf(line, " sdcard%d", 0); >> - disk_print(&dev, line, verbose); >> + snprintf(line, sizeof(line), " sdcard%d", 0); >> + ret =3D disk_print(&dev, line, verbose); >> disk_close(&dev); >> } >> + return (ret); >> } >> >> static void >> >> Modified: head/sys/boot/ofw/libofw/ofw_disk.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/ofw/libofw/ofw_disk.c Tue Nov 8 06:13:22 2016 >> (r308433) >> +++ head/sys/boot/ofw/libofw/ofw_disk.c Tue Nov 8 06:50:18 2016 >> (r308434) >> @@ -47,7 +47,7 @@ static int ofwd_strategy(void *devdata, >> static int ofwd_open(struct open_file *f, ...); >> static int ofwd_close(struct open_file *f); >> static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data); >> -static void ofwd_print(int verbose); >> +static int ofwd_print(int verbose); >> >> struct devsw ofwdisk =3D { >> "block", >> @@ -161,8 +161,8 @@ ofwd_ioctl(struct open_file *f __unused, >> return (EINVAL); >> } >> >> -static void >> +static int >> ofwd_print(int verbose __unused) >> { >> - >> + return (0); >> } >> >> Modified: head/sys/boot/pc98/libpc98/bioscd.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/pc98/libpc98/bioscd.c Tue Nov 8 06:13:22 2016 >> (r308433) >> +++ head/sys/boot/pc98/libpc98/bioscd.c Tue Nov 8 06:50:18 2016 >> (r308434) >> @@ -99,7 +99,7 @@ static int bc_realstrategy(void *devdata >> size_t offset, size_t size, char *buf, size_t *rsize= ); >> static int bc_open(struct open_file *f, ...); >> static int bc_close(struct open_file *f); >> -static void bc_print(int verbose); >> +static int bc_print(int verbose); >> >> struct devsw bioscd =3D { >> "cd", >> @@ -173,20 +173,19 @@ bc_add(int biosdev) >> /* >> * Print information about disks >> */ >> -static void >> +static int >> bc_print(int verbose) >> { >> char line[80]; >> - int i; >> + int i, ret =3D 0; >> >> - pager_open(); >> for (i =3D 0; i < nbcinfo; i++) { >> sprintf(line, " cd%d: Device 0x%x\n", i, >> bcinfo[i].bc_sp.sp_devicespec); >> - if (pager_output(line)) >> + if ((ret =3D pager_output(line)) !=3D 0) >> break; >> } >> - pager_close(); >> + return (ret); >> } >> >> /* >> >> Modified: head/sys/boot/pc98/libpc98/biosdisk.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/pc98/libpc98/biosdisk.c Tue Nov 8 06:13:22 >> 2016 (r308433) >> +++ head/sys/boot/pc98/libpc98/biosdisk.c Tue Nov 8 06:50:18 >> 2016 (r308434) >> @@ -123,7 +123,7 @@ static int bd_realstrategy(void *devdata >> size_t offset, size_t size, char *buf, size_t *rsize= ); >> static int bd_open(struct open_file *f, ...); >> static int bd_close(struct open_file *f); >> -static void bd_print(int verbose); >> +static int bd_print(int verbose); >> >> struct devsw biosdisk =3D { >> "disk", >> @@ -249,21 +249,20 @@ bd_int13probe(struct bdinfo *bd) >> /* >> * Print information about disks >> */ >> -static void >> +static int >> bd_print(int verbose) >> { >> - int i, j, done; >> + int i, j, ret =3D 0; >> char line[80]; >> struct i386_devdesc dev; >> struct open_disk *od; >> struct pc98_partition *dptr; >> >> - pager_open(); >> - done =3D 0; >> - for (i =3D 0; i < nbdinfo && !done; i++) { >> - sprintf(line, " disk%d: BIOS drive %c:\n", i, 'A' + i); >> - if (pager_output(line)) >> - break; >> + for (i =3D 0; i < nbdinfo; i++) { >> + snprintf(line, sizeof(line), " disk%d: BIOS drive %c:\n", >> + i, 'A' + i); >> + if ((ret =3D pager_output(line)) !=3D 0) >> + break; >> >> /* try to open the whole disk */ >> dev.d_unit =3D i; >> @@ -278,17 +277,17 @@ bd_print(int verbose) >> >> /* Check for a "dedicated" disk */ >> for (j =3D 0; j < od->od_nslices; j++) { >> - sprintf(line, " disk%ds%d", i, j + 1); >> - if (bd_printslice(od, &dptr[j], line, verbose)) { >> - done =3D 1; >> - break; >> - } >> + snprintf(line, sizeof(line), " disk%ds%d", i, j >> + 1); >> + if ((ret =3D bd_printslice(od, &dptr[j], line, >> verbose)) !=3D 0) >> + break; >> } >> } >> bd_closedisk(od); >> + if (ret !=3D 0) >> + break; >> } >> } >> - pager_close(); >> + return (ret); >> } >> >> /* Given a size in 512 byte sectors, convert it to a human-readable >> number. */ >> >> Modified: head/sys/boot/powerpc/kboot/hostdisk.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/powerpc/kboot/hostdisk.c Tue Nov 8 06:13:22 >> 2016 (r308433) >> +++ head/sys/boot/powerpc/kboot/hostdisk.c Tue Nov 8 06:50:18 >> 2016 (r308434) >> @@ -37,7 +37,7 @@ static int hostdisk_strategy(void *devda >> static int hostdisk_open(struct open_file *f, ...); >> static int hostdisk_close(struct open_file *f); >> static int hostdisk_ioctl(struct open_file *f, u_long cmd, void *data); >> -static void hostdisk_print(int verbose); >> +static int hostdisk_print(int verbose); >> >> struct devsw hostdisk =3D { >> "/dev", >> @@ -117,9 +117,9 @@ hostdisk_ioctl(struct open_file *f, u_lo >> return (EINVAL); >> } >> >> -static void >> +static int >> hostdisk_print(int verbose) >> { >> - >> + return (0); >> } >> >> >> Modified: head/sys/boot/powerpc/ps3/ps3cdrom.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Nov 8 06:13:22 >> 2016 (r308433) >> +++ head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Nov 8 06:50:18 >> 2016 (r308434) >> @@ -49,7 +49,7 @@ static int ps3cdrom_strategy(void *devda >> size_t offset, size_t size, char *buf, size_t *rsize); >> static int ps3cdrom_open(struct open_file *f, ...); >> static int ps3cdrom_close(struct open_file *f); >> -static void ps3cdrom_print(int verbose); >> +static int ps3cdrom_print(int verbose); >> >> struct devsw ps3cdrom =3D { >> "cd", >> @@ -149,6 +149,7 @@ static int ps3cdrom_close(struct open_fi >> return 0; >> } >> >> -static void ps3cdrom_print(int verbose) >> +static int ps3cdrom_print(int verbose) >> { >> + return (0); >> } >> >> Modified: head/sys/boot/powerpc/ps3/ps3disk.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/powerpc/ps3/ps3disk.c Tue Nov 8 06:13:22 2016 >> (r308433) >> +++ head/sys/boot/powerpc/ps3/ps3disk.c Tue Nov 8 06:50:18 2016 >> (r308434) >> @@ -61,7 +61,7 @@ static int ps3disk_strategy(void *devdat >> size_t offset, size_t size, char *buf, size_t *rsize); >> static int ps3disk_open(struct open_file *f, ...); >> static int ps3disk_close(struct open_file *f); >> -static void ps3disk_print(int verbose); >> +static int ps3disk_print(int verbose); >> >> struct devsw ps3disk =3D { >> "disk", >> @@ -186,8 +186,9 @@ static int ps3disk_close(struct open_fil >> return 0; >> } >> >> -static void ps3disk_print(int verbose) >> +static int ps3disk_print(int verbose) >> { >> + return (0); >> } >> >> static int ps3disk_open_gpt(struct ps3_devdesc *dev, struct open_dev *o= d) >> >> Modified: head/sys/boot/uboot/lib/disk.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/uboot/lib/disk.c Tue Nov 8 06:13:22 2016 >> (r308433) >> +++ head/sys/boot/uboot/lib/disk.c Tue Nov 8 06:50:18 2016 >> (r308434) >> @@ -78,7 +78,7 @@ static int stor_strategy(void *, int, da >> static int stor_open(struct open_file *, ...); >> static int stor_close(struct open_file *); >> static int stor_ioctl(struct open_file *f, u_long cmd, void *data); >> -static void stor_print(int); >> +static int stor_print(int); >> static void stor_cleanup(void); >> >> struct devsw uboot_storage =3D { >> @@ -238,30 +238,31 @@ stor_readdev(struct disk_devdesc *dev, d >> return (err); >> } >> >> -static void >> +static int >> stor_print(int verbose) >> { >> struct disk_devdesc dev; >> static char line[80]; >> - int i; >> + int i, ret =3D 0; >> >> - pager_open(); >> for (i =3D 0; i < stor_info_no; i++) { >> dev.d_dev =3D &uboot_storage; >> dev.d_unit =3D i; >> dev.d_slice =3D -1; >> dev.d_partition =3D -1; >> - sprintf(line, "\tdisk%d (%s)\n", i, >> + snprintf(line, sizeof(line), "\tdisk%d (%s)\n", i, >> ub_stor_type(SI(&dev).type)); >> - if (pager_output(line)) >> + if ((ret =3D pager_output(line)) !=3D 0) >> break; >> if (stor_opendev(&dev) =3D=3D 0) { >> sprintf(line, "\tdisk%d", i); >> - disk_print(&dev, line, verbose); >> + ret =3D disk_print(&dev, line, verbose); >> disk_close(&dev); >> + if (ret !=3D 0) >> + break; >> } >> } >> - pager_close(); >> + return (ret); >> } >> >> static int >> >> Modified: head/sys/boot/usb/storage/umass_loader.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/usb/storage/umass_loader.c Tue Nov 8 06:13:22 >> 2016 (r308433) >> +++ head/sys/boot/usb/storage/umass_loader.c Tue Nov 8 06:50:18 >> 2016 (r308434) >> @@ -50,7 +50,7 @@ static void umass_disk_cleanup(void); >> static int umass_disk_ioctl(struct open_file *, u_long, void *); >> static int umass_disk_strategy(void *, int, daddr_t, size_t, size_t, >> char *, >> size_t *); >> -static void umass_disk_print(int); >> +static int umass_disk_print(int); >> >> struct devsw umass_disk =3D { >> .dv_name =3D "umass", >> @@ -170,23 +170,26 @@ umass_disk_close(struct open_file *f) >> return (disk_close(dev)); >> } >> >> -static void >> +static int >> umass_disk_print(int verbose) >> { >> struct disk_devdesc dev; >> >> memset(&dev, 0, sizeof(dev)); >> >> - pager_output(" umass0 UMASS device\n"); >> + ret =3D pager_output(" umass0 UMASS device\n"); >> + if (ret !=3D 0) >> + return (ret); >> dev.d_dev =3D &umass_disk; >> dev.d_unit =3D 0; >> dev.d_slice =3D -1; >> dev.d_partition =3D -1; >> >> if (umass_disk_open_sub(&dev) =3D=3D 0) { >> - disk_print(&dev, " umass0", verbose); >> + ret =3D disk_print(&dev, " umass0", verbose); >> disk_close(&dev); >> } >> + return (ret); >> } >> >> static void >> >> Modified: head/sys/boot/userboot/userboot/host.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/userboot/userboot/host.c Tue Nov 8 06:13:22 >> 2016 (r308433) >> +++ head/sys/boot/userboot/userboot/host.c Tue Nov 8 06:50:18 >> 2016 (r308434) >> @@ -134,13 +134,13 @@ host_dev_init(void) >> return (0); >> } >> >> -static void >> +static int >> host_dev_print(int verbose) >> { >> char line[80]; >> >> - sprintf(line, " host%d: Host filesystem\n", 0); >> - pager_output(line); >> + snprintf(line, sizeof(line), " host%d: Host filesystem\n", >> 0); >> + return (pager_output(line)); >> } >> >> /* >> >> Modified: head/sys/boot/userboot/userboot/userboot_disk.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/userboot/userboot/userboot_disk.c Tue Nov 8 >> 06:13:22 2016 (r308433) >> +++ head/sys/boot/userboot/userboot/userboot_disk.c Tue Nov 8 >> 06:50:18 2016 (r308434) >> @@ -60,7 +60,7 @@ static int userdisk_realstrategy(void *d >> static int userdisk_open(struct open_file *f, ...); >> static int userdisk_close(struct open_file *f); >> static int userdisk_ioctl(struct open_file *f, u_long cmd, void >> *data); >> -static void userdisk_print(int verbose); >> +static int userdisk_print(int verbose); >> >> struct devsw userboot_disk =3D { >> "disk", >> @@ -116,27 +116,33 @@ userdisk_cleanup(void) >> /* >> * Print information about disks >> */ >> -static void >> +static int >> userdisk_print(int verbose) >> { >> struct disk_devdesc dev; >> char line[80]; >> - int i; >> + int i, ret =3D 0; >> >> for (i =3D 0; i < userdisk_maxunit; i++) { >> - sprintf(line, " disk%d: Guest drive image\n", i); >> - pager_output(line); >> + snprintf(line, sizeof(line), >> + " disk%d: Guest drive image\n", i); >> + ret =3D pager_output(line); >> + if (ret !=3D 0) >> + break; >> dev.d_dev =3D &userboot_disk; >> dev.d_unit =3D i; >> dev.d_slice =3D -1; >> dev.d_partition =3D -1; >> if (disk_open(&dev, ud_info[i].mediasize, >> ud_info[i].sectorsize, 0) =3D=3D 0) { >> - sprintf(line, " disk%d", i); >> - disk_print(&dev, line, verbose); >> + snprintf(line, sizeof(line), " disk%d", i); >> + ret =3D disk_print(&dev, line, verbose); >> disk_close(&dev); >> + if (ret !=3D 0) >> + break; >> } >> } >> + return (ret); >> } >> >> /* >> >> Modified: head/sys/boot/zfs/zfs.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/zfs/zfs.c Tue Nov 8 06:13:22 2016 (r308433= ) >> +++ head/sys/boot/zfs/zfs.c Tue Nov 8 06:50:18 2016 (r308434= ) >> @@ -514,20 +514,23 @@ zfs_probe_dev(const char *devname, uint6 >> /* >> * Print information about ZFS pools >> */ >> -static void >> +static int >> zfs_dev_print(int verbose) >> { >> spa_t *spa; >> char line[80]; >> + int ret =3D 0; >> >> if (verbose) { >> - spa_all_status(); >> - return; >> + return (spa_all_status()); >> } >> STAILQ_FOREACH(spa, &zfs_pools, spa_link) { >> - sprintf(line, " zfs:%s\n", spa->spa_name); >> - pager_output(line); >> + snprintf(line, sizeof(line), " zfs:%s\n", >> spa->spa_name); >> + ret =3D pager_output(line); >> + if (ret !=3D 0) >> + break; >> } >> + return (ret); >> } >> >> /* >> >> Modified: head/sys/boot/zfs/zfsimpl.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/boot/zfs/zfsimpl.c Tue Nov 8 06:13:22 2016 (r308433= ) >> +++ head/sys/boot/zfs/zfsimpl.c Tue Nov 8 06:50:18 2016 (r308434= ) >> @@ -780,7 +780,7 @@ state_name(vdev_state_t state) >> >> #else >> >> -static void >> +static int >> pager_printf(const char *fmt, ...) >> { >> char line[80]; >> @@ -789,14 +789,14 @@ pager_printf(const char *fmt, ...) >> va_start(args, fmt); >> vsprintf(line, fmt, args); >> va_end(args); >> - pager_output(line); >> + return (pager_output(line)); >> } >> >> #endif >> >> #define STATUS_FORMAT " %s %s\n" >> >> -static void >> +static int >> print_state(int indent, const char *name, vdev_state_t state) >> { >> int i; >> @@ -806,40 +806,56 @@ print_state(int indent, const char *name >> for (i =3D 0; i < indent; i++) >> strcat(buf, " "); >> strcat(buf, name); >> >> *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** >> _______________________________________________ >> svn-src-head@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/svn-src-head >> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" >> > > > From owner-svn-src-all@freebsd.org Fri Nov 11 07:01:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34CFDC3A3CA; Fri, 11 Nov 2016 07:01:52 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ECF2112F0; Fri, 11 Nov 2016 07:01:51 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB71p0l074901; Fri, 11 Nov 2016 07:01:51 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB71pYk074899; Fri, 11 Nov 2016 07:01:51 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110701.uAB71pYk074899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 07:01:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308509 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 07:01:52 -0000 Author: sephe Date: Fri Nov 11 07:01:50 2016 New Revision: 308509 URL: https://svnweb.freebsd.org/changeset/base/308509 Log: MFC 308117-308120 308117 hyperv/hn: Rework temporary channel packet buffer expanding. And use large default temporary channel packer buffer; we really don't want it to be expanded at run time. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8367 308118 hyperv/hn: Cleanup RXBUF ack processing. - Increase the # of retries. - Add comment. - Log error, if RXBUF ack fails. - Add stat for RXBUF ack failures. RXBUF ack really should _not_ fail... Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8368 308119 hyperv/hn: Reset do_lro, if the hash types are not TCP related. Mainly because the host side only set TCPCS and IPCS even for UDP datagrams. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8369 308120 hyperv/hn: Don't start shared TX taskq, if the hypervisor is not Hyper-V. - Move the SYSINIT to DRIVER/SECOND, i.e. after the vm_guest becomes determistic. - Minor style changes. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8370 Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 06:42:46 2016 (r308508) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 07:01:50 2016 (r308509) @@ -178,6 +178,8 @@ __FBSDID("$FreeBSD$"); HN_RXINFO_HASHINF | \ HN_RXINFO_HASHVAL) +#define HN_PKTBUF_LEN_DEF (16 * 1024) + struct hn_txdesc { #ifndef HN_USE_TXDESC_BUFRING SLIST_ENTRY(hn_txdesc) link; @@ -414,7 +416,8 @@ static void hn_nvs_handle_comp(struct hn static void hn_nvs_handle_rxbuf(struct hn_rx_ring *rxr, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr); -static void hn_nvs_ack_rxbuf(struct vmbus_channel *chan, uint64_t tid); +static void hn_nvs_ack_rxbuf(struct hn_rx_ring *, struct vmbus_channel *, + uint64_t); static int hn_transmit(struct ifnet *, struct mbuf *); static void hn_xmit_qflush(struct ifnet *); @@ -1778,6 +1781,13 @@ hn_rxpkt(struct hn_rx_ring *rxr, const v rxr->hn_csum_udp++; } + /* + * XXX + * As of this write (Oct 28th, 2016), host side will turn + * on only TCPCS_OK and IPCS_OK even for UDP datagrams, so + * the do_lro setting here is actually _not_ accurate. We + * depend on the RSS hash type check to reset do_lro. + */ if ((info->csum_info & (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) == (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) @@ -1851,9 +1861,16 @@ skip: NDIS_HASH_FUNCTION_TOEPLITZ) { uint32_t type = (info->hash_info & NDIS_HASH_TYPE_MASK); + /* + * NOTE: + * do_lro is resetted, if the hash types are not TCP + * related. See the comment in the above csum_flags + * setup section. + */ switch (type) { case NDIS_HASH_IPV4: hash_type = M_HASHTYPE_RSS_IPV4; + do_lro = 0; break; case NDIS_HASH_TCP_IPV4: @@ -1862,10 +1879,12 @@ skip: case NDIS_HASH_IPV6: hash_type = M_HASHTYPE_RSS_IPV6; + do_lro = 0; break; case NDIS_HASH_IPV6_EX: hash_type = M_HASHTYPE_RSS_IPV6_EX; + do_lro = 0; break; case NDIS_HASH_TCP_IPV6: @@ -2745,7 +2764,8 @@ hn_create_rx_data(struct hn_softc *sc, i rxr->hn_ifp = sc->hn_ifp; if (i < sc->hn_tx_ring_cnt) rxr->hn_txr = &sc->hn_tx_ring[i]; - rxr->hn_pktbuf = malloc(HN_PKTBUF_LEN, M_DEVBUF, M_WAITOK); + rxr->hn_pktbuf_len = HN_PKTBUF_LEN_DEF; + rxr->hn_pktbuf = malloc(rxr->hn_pktbuf_len, M_DEVBUF, M_WAITOK); rxr->hn_rx_idx = i; rxr->hn_rxbuf = sc->hn_rxbuf; @@ -2788,6 +2808,11 @@ hn_create_rx_data(struct hn_softc *sc, i OID_AUTO, "rss_pkts", CTLFLAG_RW, &rxr->hn_rss_pkts, "# of packets w/ RSS info received"); + SYSCTL_ADD_INT(ctx, + SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), + OID_AUTO, "pktbuf_len", CTLFLAG_RD, + &rxr->hn_pktbuf_len, 0, + "Temporary channel packet buffer length"); } } } @@ -2860,6 +2885,10 @@ hn_create_rx_data(struct hn_softc *sc, i CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_rx_ring, hn_small_pkts), hn_rx_stat_ulong_sysctl, "LU", "# of small packets received"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rx_ack_failed", + CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, + __offsetof(struct hn_rx_ring, hn_ack_failed), + hn_rx_stat_ulong_sysctl, "LU", "# of RXBUF ack failures"); SYSCTL_ADD_INT(ctx, child, OID_AUTO, "rx_ring_cnt", CTLFLAG_RD, &sc->hn_rx_ring_cnt, 0, "# created RX rings"); SYSCTL_ADD_INT(ctx, child, OID_AUTO, "rx_ring_inuse", @@ -4516,43 +4545,43 @@ hn_nvs_handle_rxbuf(struct hn_rx_ring *r } /* - * Moved completion call back here so that all received - * messages (not just data messages) will trigger a response - * message back to the host. + * Ack the consumed RXBUF associated w/ this channel packet, + * so that this RXBUF can be recycled by the hypervisor. */ - hn_nvs_ack_rxbuf(chan, pkt->cp_hdr.cph_xactid); + hn_nvs_ack_rxbuf(rxr, chan, pkt->cp_hdr.cph_xactid); } -/* - * Net VSC on receive completion - * - * Send a receive completion packet to RNDIS device (ie NetVsp) - */ static void -hn_nvs_ack_rxbuf(struct vmbus_channel *chan, uint64_t tid) +hn_nvs_ack_rxbuf(struct hn_rx_ring *rxr, struct vmbus_channel *chan, + uint64_t tid) { struct hn_nvs_rndis_ack ack; - int retries = 0; - int ret = 0; + int retries, error; ack.nvs_type = HN_NVS_TYPE_RNDIS_ACK; ack.nvs_status = HN_NVS_STATUS_OK; -retry_send_cmplt: - /* Send the completion */ - ret = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_COMP, + retries = 0; +again: + error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_COMP, VMBUS_CHANPKT_FLAG_NONE, &ack, sizeof(ack), tid); - if (ret == 0) { - /* success */ - /* no-op */ - } else if (ret == EAGAIN) { - /* no more room... wait a bit and attempt to retry 3 times */ + if (__predict_false(error == EAGAIN)) { + /* + * NOTE: + * This should _not_ happen in real world, since the + * consumption of the TX bufring from the TX path is + * controlled. + */ + if (rxr->hn_ack_failed == 0) + if_printf(rxr->hn_ifp, "RXBUF ack retry\n"); + rxr->hn_ack_failed++; retries++; - - if (retries < 4) { + if (retries < 10) { DELAY(100); - goto retry_send_cmplt; + goto again; } + /* RXBUF leaks! */ + if_printf(rxr->hn_ifp, "RXBUF ack failed\n"); } } @@ -4561,66 +4590,72 @@ hn_chan_callback(struct vmbus_channel *c { struct hn_rx_ring *rxr = xrxr; struct hn_softc *sc = rxr->hn_ifp->if_softc; - void *buffer; - int bufferlen = HN_PKTBUF_LEN; - buffer = rxr->hn_pktbuf; - do { - struct vmbus_chanpkt_hdr *pkt = buffer; - uint32_t bytes_rxed; - int ret; - - bytes_rxed = bufferlen; - ret = vmbus_chan_recv_pkt(chan, pkt, &bytes_rxed); - if (ret == 0) { - switch (pkt->cph_type) { - case VMBUS_CHANPKT_TYPE_COMP: - hn_nvs_handle_comp(sc, chan, pkt); - break; - case VMBUS_CHANPKT_TYPE_RXBUF: - hn_nvs_handle_rxbuf(rxr, chan, pkt); - break; - case VMBUS_CHANPKT_TYPE_INBAND: - hn_nvs_handle_notify(sc, pkt); - break; - default: - if_printf(rxr->hn_ifp, - "unknown chan pkt %u\n", - pkt->cph_type); - break; - } - } else if (ret == ENOBUFS) { - /* Handle large packet */ - if (bufferlen > HN_PKTBUF_LEN) { - free(buffer, M_DEVBUF); - buffer = NULL; - } + for (;;) { + struct vmbus_chanpkt_hdr *pkt = rxr->hn_pktbuf; + int error, pktlen; + + pktlen = rxr->hn_pktbuf_len; + error = vmbus_chan_recv_pkt(chan, pkt, &pktlen); + if (__predict_false(error == ENOBUFS)) { + void *nbuf; + int nlen; - /* alloc new buffer */ - buffer = malloc(bytes_rxed, M_DEVBUF, M_NOWAIT); - if (buffer == NULL) { - if_printf(rxr->hn_ifp, - "hv_cb malloc buffer failed, len=%u\n", - bytes_rxed); - bufferlen = 0; - break; - } - bufferlen = bytes_rxed; - } else { - /* No more packets */ + /* + * Expand channel packet buffer. + * + * XXX + * Use M_WAITOK here, since allocation failure + * is fatal. + */ + nlen = rxr->hn_pktbuf_len * 2; + while (nlen < pktlen) + nlen *= 2; + nbuf = malloc(nlen, M_DEVBUF, M_WAITOK); + + if_printf(rxr->hn_ifp, "expand pktbuf %d -> %d\n", + rxr->hn_pktbuf_len, nlen); + + free(rxr->hn_pktbuf, M_DEVBUF); + rxr->hn_pktbuf = nbuf; + rxr->hn_pktbuf_len = nlen; + /* Retry! */ + continue; + } else if (__predict_false(error == EAGAIN)) { + /* No more channel packets; done! */ break; } - } while (1); + KASSERT(!error, ("vmbus_chan_recv_pkt failed: %d", error)); - if (bufferlen > HN_PKTBUF_LEN) - free(buffer, M_DEVBUF); + switch (pkt->cph_type) { + case VMBUS_CHANPKT_TYPE_COMP: + hn_nvs_handle_comp(sc, chan, pkt); + break; + + case VMBUS_CHANPKT_TYPE_RXBUF: + hn_nvs_handle_rxbuf(rxr, chan, pkt); + break; + case VMBUS_CHANPKT_TYPE_INBAND: + hn_nvs_handle_notify(sc, pkt); + break; + + default: + if_printf(rxr->hn_ifp, "unknown chan pkt %u\n", + pkt->cph_type); + break; + } + } hn_chan_rollup(rxr, rxr->hn_txr); } static void hn_tx_taskq_create(void *arg __unused) { + + if (vm_guest != VM_GUEST_HV) + return; + if (!hn_share_tx_taskq) return; @@ -4640,16 +4675,17 @@ hn_tx_taskq_create(void *arg __unused) taskqueue_drain(hn_tx_taskq, &cpuset_task); } } -SYSINIT(hn_txtq_create, SI_SUB_DRIVERS, SI_ORDER_FIRST, +SYSINIT(hn_txtq_create, SI_SUB_DRIVERS, SI_ORDER_SECOND, hn_tx_taskq_create, NULL); static void hn_tx_taskq_destroy(void *arg __unused) { + if (hn_tx_taskq != NULL) taskqueue_free(hn_tx_taskq); } -SYSUNINIT(hn_txtq_destroy, SI_SUB_DRIVERS, SI_ORDER_FIRST, +SYSUNINIT(hn_txtq_destroy, SI_SUB_DRIVERS, SI_ORDER_SECOND, hn_tx_taskq_destroy, NULL); static device_method_t netvsc_methods[] = { Modified: stable/10/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 06:42:46 2016 (r308508) +++ stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 07:01:50 2016 (r308509) @@ -39,8 +39,6 @@ /* Claimed to be 12232B */ #define HN_MTU_MAX (9 * 1024) -#define HN_PKTBUF_LEN 4096 - #define HN_TXBR_SIZE (128 * PAGE_SIZE) #define HN_RXBR_SIZE (128 * PAGE_SIZE) @@ -63,6 +61,7 @@ struct hn_rx_ring { struct ifnet *hn_ifp; struct hn_tx_ring *hn_txr; void *hn_pktbuf; + int hn_pktbuf_len; uint8_t *hn_rxbuf; /* shadow sc->hn_rxbuf */ int hn_rx_idx; @@ -78,6 +77,7 @@ struct hn_rx_ring { u_long hn_small_pkts; u_long hn_pkts; u_long hn_rss_pkts; + u_long hn_ack_failed; /* Rarely used stuffs */ struct sysctl_oid *hn_rx_sysctl_tree; From owner-svn-src-all@freebsd.org Fri Nov 11 07:13:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00C95C3A7DC; Fri, 11 Nov 2016 07:13:19 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0D3E1C0B; Fri, 11 Nov 2016 07:13:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB7DIF0082632; Fri, 11 Nov 2016 07:13:18 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB7DIfv082631; Fri, 11 Nov 2016 07:13:18 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110713.uAB7DIfv082631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 07:13:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308510 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 07:13:19 -0000 Author: sephe Date: Fri Nov 11 07:13:17 2016 New Revision: 308510 URL: https://svnweb.freebsd.org/changeset/base/308510 Log: MFC 308162 hyperv/hn: Cosmetic cleanup; no functional changes. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8389 Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 07:01:50 2016 (r308509) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 07:13:17 2016 (r308510) @@ -59,64 +59,44 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include -#include -#include +#include +#include #include -#include #include +#include #include -#include -#include #include #include #include -#include #include +#include +#include +#include #include -#include +#include #include +#include +#include +#include + +#include +#include #include #include -#include -#include #include -#include -#include - #include +#include #include -#include +#include #include #include #include -#include +#include #include #include #include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include #include #include @@ -131,24 +111,11 @@ __FBSDID("$FreeBSD$"); #include "vmbus_if.h" -/* Short for Hyper-V network interface */ -#define NETVSC_DEVNAME "hn" - -/* - * It looks like offset 0 of buf is reserved to hold the softc pointer. - * The sc pointer evidently not needed, and is not presently populated. - * The packet offset is where the netvsc_packet starts in the buffer. - */ -#define HV_NV_SC_PTR_OFFSET_IN_BUF 0 -#define HV_NV_PACKET_OFFSET_IN_BUF 16 +#define HN_RING_CNT_DEF_MAX 8 /* YYY should get it from the underlying channel */ #define HN_TX_DESC_CNT 512 -#define HN_LROENT_CNT_DEF 128 - -#define HN_RING_CNT_DEF_MAX 8 - #define HN_RNDIS_PKT_LEN \ (sizeof(struct rndis_packet_msg) + \ HN_RNDIS_PKTINFO_SIZE(HN_NDIS_HASH_VALUE_SIZE) + \ @@ -168,50 +135,9 @@ __FBSDID("$FreeBSD$"); #define HN_EARLY_TXEOF_THRESH 8 -#define HN_RXINFO_VLAN 0x0001 -#define HN_RXINFO_CSUM 0x0002 -#define HN_RXINFO_HASHINF 0x0004 -#define HN_RXINFO_HASHVAL 0x0008 -#define HN_RXINFO_ALL \ - (HN_RXINFO_VLAN | \ - HN_RXINFO_CSUM | \ - HN_RXINFO_HASHINF | \ - HN_RXINFO_HASHVAL) - #define HN_PKTBUF_LEN_DEF (16 * 1024) -struct hn_txdesc { -#ifndef HN_USE_TXDESC_BUFRING - SLIST_ENTRY(hn_txdesc) link; -#endif - struct mbuf *m; - struct hn_tx_ring *txr; - int refs; - uint32_t flags; /* HN_TXD_FLAG_ */ - struct hn_nvs_sendctx send_ctx; - uint32_t chim_index; - int chim_size; - - bus_dmamap_t data_dmap; - - bus_addr_t rndis_pkt_paddr; - struct rndis_packet_msg *rndis_pkt; - bus_dmamap_t rndis_pkt_dmap; -}; - -#define HN_TXD_FLAG_ONLIST 0x1 -#define HN_TXD_FLAG_DMAMAP 0x2 - -#define HN_NDIS_VLAN_INFO_INVALID 0xffffffff -#define HN_NDIS_RXCSUM_INFO_INVALID 0 -#define HN_NDIS_HASH_INFO_INVALID 0 - -struct hn_rxinfo { - uint32_t vlan_info; - uint32_t csum_info; - uint32_t hash_info; - uint32_t hash_value; -}; +#define HN_LROENT_CNT_DEF 128 #define HN_LRO_LENLIM_MULTIRX_DEF (12 * ETHERMTU) #define HN_LRO_LENLIM_DEF (25 * ETHERMTU) @@ -222,8 +148,8 @@ struct hn_rxinfo { #define HN_LOCK_INIT(sc) \ sx_init(&(sc)->hn_lock, device_get_nameunit((sc)->hn_dev)) -#define HN_LOCK_ASSERT(sc) sx_assert(&(sc)->hn_lock, SA_XLOCKED) #define HN_LOCK_DESTROY(sc) sx_destroy(&(sc)->hn_lock) +#define HN_LOCK_ASSERT(sc) sx_assert(&(sc)->hn_lock, SA_XLOCKED) #define HN_LOCK(sc) sx_xlock(&(sc)->hn_lock) #define HN_UNLOCK(sc) sx_xunlock(&(sc)->hn_lock) @@ -234,199 +160,276 @@ struct hn_rxinfo { #define HN_CSUM_IP6_HWASSIST(sc) \ ((sc)->hn_tx_ring[0].hn_csum_assist & HN_CSUM_IP6_MASK) -/* - * Globals - */ +struct hn_txdesc { +#ifndef HN_USE_TXDESC_BUFRING + SLIST_ENTRY(hn_txdesc) link; +#endif + struct mbuf *m; + struct hn_tx_ring *txr; + int refs; + uint32_t flags; /* HN_TXD_FLAG_ */ + struct hn_nvs_sendctx send_ctx; + uint32_t chim_index; + int chim_size; + + bus_dmamap_t data_dmap; + + bus_addr_t rndis_pkt_paddr; + struct rndis_packet_msg *rndis_pkt; + bus_dmamap_t rndis_pkt_dmap; +}; + +#define HN_TXD_FLAG_ONLIST 0x0001 +#define HN_TXD_FLAG_DMAMAP 0x0002 + +struct hn_rxinfo { + uint32_t vlan_info; + uint32_t csum_info; + uint32_t hash_info; + uint32_t hash_value; +}; + +#define HN_RXINFO_VLAN 0x0001 +#define HN_RXINFO_CSUM 0x0002 +#define HN_RXINFO_HASHINF 0x0004 +#define HN_RXINFO_HASHVAL 0x0008 +#define HN_RXINFO_ALL \ + (HN_RXINFO_VLAN | \ + HN_RXINFO_CSUM | \ + HN_RXINFO_HASHINF | \ + HN_RXINFO_HASHVAL) + +#define HN_NDIS_VLAN_INFO_INVALID 0xffffffff +#define HN_NDIS_RXCSUM_INFO_INVALID 0 +#define HN_NDIS_HASH_INFO_INVALID 0 + +static int hn_probe(device_t); +static int hn_attach(device_t); +static int hn_detach(device_t); +static int hn_shutdown(device_t); +static void hn_chan_callback(struct vmbus_channel *, + void *); + +static void hn_init(void *); +static int hn_ioctl(struct ifnet *, u_long, caddr_t); +static void hn_start(struct ifnet *); +static int hn_transmit(struct ifnet *, struct mbuf *); +static void hn_xmit_qflush(struct ifnet *); +static int hn_ifmedia_upd(struct ifnet *); +static void hn_ifmedia_sts(struct ifnet *, + struct ifmediareq *); + +static int hn_rndis_rxinfo(const void *, int, + struct hn_rxinfo *); +static void hn_rndis_rx_data(struct hn_rx_ring *, + const void *, int); +static void hn_rndis_rx_status(struct hn_softc *, + const void *, int); + +static void hn_nvs_handle_notify(struct hn_softc *, + const struct vmbus_chanpkt_hdr *); +static void hn_nvs_handle_comp(struct hn_softc *, + struct vmbus_channel *, + const struct vmbus_chanpkt_hdr *); +static void hn_nvs_handle_rxbuf(struct hn_rx_ring *, + struct vmbus_channel *, + const struct vmbus_chanpkt_hdr *); +static void hn_nvs_ack_rxbuf(struct hn_rx_ring *, + struct vmbus_channel *, uint64_t); + +#if __FreeBSD_version >= 1100099 +static int hn_lro_lenlim_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_lro_ackcnt_sysctl(SYSCTL_HANDLER_ARGS); +#endif +static int hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_chim_size_sysctl(SYSCTL_HANDLER_ARGS); +#if __FreeBSD_version < 1100095 +static int hn_rx_stat_int_sysctl(SYSCTL_HANDLER_ARGS); +#else +static int hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS); +#endif +static int hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_caps_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_hwassist_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS); + +static void hn_stop(struct hn_softc *); +static void hn_init_locked(struct hn_softc *); +static int hn_chan_attach(struct hn_softc *, + struct vmbus_channel *); +static void hn_chan_detach(struct hn_softc *, + struct vmbus_channel *); +static int hn_attach_subchans(struct hn_softc *); +static void hn_detach_allchans(struct hn_softc *); +static void hn_chan_rollup(struct hn_rx_ring *, + struct hn_tx_ring *); +static void hn_set_ring_inuse(struct hn_softc *, int); +static int hn_synth_attach(struct hn_softc *, int); +static void hn_synth_detach(struct hn_softc *); +static int hn_synth_alloc_subchans(struct hn_softc *, + int *); +static void hn_suspend(struct hn_softc *); +static void hn_suspend_data(struct hn_softc *); +static void hn_suspend_mgmt(struct hn_softc *); +static void hn_resume(struct hn_softc *); +static void hn_resume_data(struct hn_softc *); +static void hn_resume_mgmt(struct hn_softc *); +static void hn_suspend_mgmt_taskfunc(void *, int); +static void hn_chan_drain(struct vmbus_channel *); + +static void hn_update_link_status(struct hn_softc *); +static void hn_change_network(struct hn_softc *); +static void hn_link_taskfunc(void *, int); +static void hn_netchg_init_taskfunc(void *, int); +static void hn_netchg_status_taskfunc(void *, int); +static void hn_link_status(struct hn_softc *); + +static int hn_create_rx_data(struct hn_softc *, int); +static void hn_destroy_rx_data(struct hn_softc *); +static int hn_check_iplen(const struct mbuf *, int); +static int hn_set_rxfilter(struct hn_softc *); +static int hn_rss_reconfig(struct hn_softc *); +static void hn_rss_ind_fixup(struct hn_softc *, int); +static int hn_rxpkt(struct hn_rx_ring *, const void *, + int, const struct hn_rxinfo *); + +static int hn_tx_ring_create(struct hn_softc *, int); +static void hn_tx_ring_destroy(struct hn_tx_ring *); +static int hn_create_tx_data(struct hn_softc *, int); +static void hn_fixup_tx_data(struct hn_softc *); +static void hn_destroy_tx_data(struct hn_softc *); +static void hn_txdesc_dmamap_destroy(struct hn_txdesc *); +static int hn_encap(struct hn_tx_ring *, + struct hn_txdesc *, struct mbuf **); +static int hn_txpkt(struct ifnet *, struct hn_tx_ring *, + struct hn_txdesc *); +static void hn_set_chim_size(struct hn_softc *, int); +static void hn_set_tso_maxsize(struct hn_softc *, int, int); +static bool hn_tx_ring_pending(struct hn_tx_ring *); +static void hn_tx_ring_qflush(struct hn_tx_ring *); +static void hn_resume_tx(struct hn_softc *, int); +static int hn_get_txswq_depth(const struct hn_tx_ring *); +static void hn_txpkt_done(struct hn_nvs_sendctx *, + struct hn_softc *, struct vmbus_channel *, + const void *, int); +static int hn_txpkt_sglist(struct hn_tx_ring *, + struct hn_txdesc *); +static int hn_txpkt_chim(struct hn_tx_ring *, + struct hn_txdesc *); +static int hn_xmit(struct hn_tx_ring *, int); +static void hn_xmit_taskfunc(void *, int); +static void hn_xmit_txeof(struct hn_tx_ring *); +static void hn_xmit_txeof_taskfunc(void *, int); +static int hn_start_locked(struct hn_tx_ring *, int); +static void hn_start_taskfunc(void *, int); +static void hn_start_txeof(struct hn_tx_ring *); +static void hn_start_txeof_taskfunc(void *, int); SYSCTL_NODE(_hw, OID_AUTO, hn, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Hyper-V network interface"); /* Trust tcp segements verification on host side. */ -static int hn_trust_hosttcp = 1; +static int hn_trust_hosttcp = 1; SYSCTL_INT(_hw_hn, OID_AUTO, trust_hosttcp, CTLFLAG_RDTUN, &hn_trust_hosttcp, 0, "Trust tcp segement verification on host side, " "when csum info is missing (global setting)"); /* Trust udp datagrams verification on host side. */ -static int hn_trust_hostudp = 1; +static int hn_trust_hostudp = 1; SYSCTL_INT(_hw_hn, OID_AUTO, trust_hostudp, CTLFLAG_RDTUN, &hn_trust_hostudp, 0, "Trust udp datagram verification on host side, " "when csum info is missing (global setting)"); /* Trust ip packets verification on host side. */ -static int hn_trust_hostip = 1; +static int hn_trust_hostip = 1; SYSCTL_INT(_hw_hn, OID_AUTO, trust_hostip, CTLFLAG_RDTUN, &hn_trust_hostip, 0, "Trust ip packet verification on host side, " "when csum info is missing (global setting)"); /* Limit TSO burst size */ -static int hn_tso_maxlen = IP_MAXPACKET; +static int hn_tso_maxlen = IP_MAXPACKET; SYSCTL_INT(_hw_hn, OID_AUTO, tso_maxlen, CTLFLAG_RDTUN, &hn_tso_maxlen, 0, "TSO burst limit"); /* Limit chimney send size */ -static int hn_tx_chimney_size = 0; +static int hn_tx_chimney_size = 0; SYSCTL_INT(_hw_hn, OID_AUTO, tx_chimney_size, CTLFLAG_RDTUN, &hn_tx_chimney_size, 0, "Chimney send packet size limit"); /* Limit the size of packet for direct transmission */ -static int hn_direct_tx_size = HN_DIRECT_TX_SIZE_DEF; +static int hn_direct_tx_size = HN_DIRECT_TX_SIZE_DEF; SYSCTL_INT(_hw_hn, OID_AUTO, direct_tx_size, CTLFLAG_RDTUN, &hn_direct_tx_size, 0, "Size of the packet for direct transmission"); +/* # of LRO entries per RX ring */ #if defined(INET) || defined(INET6) #if __FreeBSD_version >= 1100095 -static int hn_lro_entry_count = HN_LROENT_CNT_DEF; +static int hn_lro_entry_count = HN_LROENT_CNT_DEF; SYSCTL_INT(_hw_hn, OID_AUTO, lro_entry_count, CTLFLAG_RDTUN, &hn_lro_entry_count, 0, "LRO entry count"); #endif #endif -static int hn_share_tx_taskq = 0; +/* Use shared TX taskqueue */ +static int hn_share_tx_taskq = 0; SYSCTL_INT(_hw_hn, OID_AUTO, share_tx_taskq, CTLFLAG_RDTUN, &hn_share_tx_taskq, 0, "Enable shared TX taskqueue"); -static struct taskqueue *hn_tx_taskq; - #ifndef HN_USE_TXDESC_BUFRING -static int hn_use_txdesc_bufring = 0; +static int hn_use_txdesc_bufring = 0; #else -static int hn_use_txdesc_bufring = 1; +static int hn_use_txdesc_bufring = 1; #endif SYSCTL_INT(_hw_hn, OID_AUTO, use_txdesc_bufring, CTLFLAG_RD, &hn_use_txdesc_bufring, 0, "Use buf_ring for TX descriptors"); -static int hn_bind_tx_taskq = -1; +/* Bind TX taskqueue to the target CPU */ +static int hn_bind_tx_taskq = -1; SYSCTL_INT(_hw_hn, OID_AUTO, bind_tx_taskq, CTLFLAG_RDTUN, &hn_bind_tx_taskq, 0, "Bind TX taskqueue to the specified cpu"); -static int hn_use_if_start = 0; +/* Use ifnet.if_start instead of ifnet.if_transmit */ +static int hn_use_if_start = 0; SYSCTL_INT(_hw_hn, OID_AUTO, use_if_start, CTLFLAG_RDTUN, &hn_use_if_start, 0, "Use if_start TX method"); -static int hn_chan_cnt = 0; +/* # of channels to use */ +static int hn_chan_cnt = 0; SYSCTL_INT(_hw_hn, OID_AUTO, chan_cnt, CTLFLAG_RDTUN, &hn_chan_cnt, 0, "# of channels to use; each channel has one RX ring and one TX ring"); -static int hn_tx_ring_cnt = 0; +/* # of transmit rings to use */ +static int hn_tx_ring_cnt = 0; SYSCTL_INT(_hw_hn, OID_AUTO, tx_ring_cnt, CTLFLAG_RDTUN, &hn_tx_ring_cnt, 0, "# of TX rings to use"); -static int hn_tx_swq_depth = 0; +/* Software TX ring deptch */ +static int hn_tx_swq_depth = 0; SYSCTL_INT(_hw_hn, OID_AUTO, tx_swq_depth, CTLFLAG_RDTUN, &hn_tx_swq_depth, 0, "Depth of IFQ or BUFRING"); +/* Enable sorted LRO, and the depth of the per-channel mbuf queue */ #if __FreeBSD_version >= 1100095 -static u_int hn_lro_mbufq_depth = 0; +static u_int hn_lro_mbufq_depth = 0; SYSCTL_UINT(_hw_hn, OID_AUTO, lro_mbufq_depth, CTLFLAG_RDTUN, &hn_lro_mbufq_depth, 0, "Depth of LRO mbuf queue"); #endif -static u_int hn_cpu_index; - -/* - * Forward declarations - */ -static void hn_stop(struct hn_softc *sc); -static void hn_init_locked(struct hn_softc *sc); -static void hn_init(void *xsc); -static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); -static int hn_start_locked(struct hn_tx_ring *txr, int len); -static void hn_start(struct ifnet *ifp); -static void hn_start_txeof(struct hn_tx_ring *); -static int hn_ifmedia_upd(struct ifnet *ifp); -static void hn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr); -#if __FreeBSD_version >= 1100099 -static int hn_lro_lenlim_sysctl(SYSCTL_HANDLER_ARGS); -static int hn_lro_ackcnt_sysctl(SYSCTL_HANDLER_ARGS); -#endif -static int hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARGS); -static int hn_chim_size_sysctl(SYSCTL_HANDLER_ARGS); -#if __FreeBSD_version < 1100095 -static int hn_rx_stat_int_sysctl(SYSCTL_HANDLER_ARGS); -#else -static int hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS); -#endif -static int hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS); -static int hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS); -static int hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARGS); -static int hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS); -static int hn_caps_sysctl(SYSCTL_HANDLER_ARGS); -static int hn_hwassist_sysctl(SYSCTL_HANDLER_ARGS); -static int hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS); -static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS); -static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); -static int hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS); -static int hn_check_iplen(const struct mbuf *, int); -static int hn_create_tx_ring(struct hn_softc *, int); -static void hn_destroy_tx_ring(struct hn_tx_ring *); -static int hn_create_tx_data(struct hn_softc *, int); -static void hn_fixup_tx_data(struct hn_softc *); -static void hn_destroy_tx_data(struct hn_softc *); -static void hn_start_taskfunc(void *, int); -static void hn_start_txeof_taskfunc(void *, int); -static void hn_link_taskfunc(void *, int); -static void hn_netchg_init_taskfunc(void *, int); -static void hn_netchg_status_taskfunc(void *, int); -static void hn_suspend_mgmt_taskfunc(void *, int); -static int hn_encap(struct hn_tx_ring *, struct hn_txdesc *, struct mbuf **); -static int hn_create_rx_data(struct hn_softc *sc, int); -static void hn_destroy_rx_data(struct hn_softc *sc); -static void hn_set_chim_size(struct hn_softc *, int); -static void hn_set_tso_maxsize(struct hn_softc *, int, int); -static int hn_chan_attach(struct hn_softc *, struct vmbus_channel *); -static void hn_chan_detach(struct hn_softc *, struct vmbus_channel *); -static int hn_attach_subchans(struct hn_softc *); -static void hn_detach_allchans(struct hn_softc *); -static void hn_chan_callback(struct vmbus_channel *chan, void *xrxr); -static void hn_chan_rollup(struct hn_rx_ring *, struct hn_tx_ring *); -static void hn_set_ring_inuse(struct hn_softc *, int); -static int hn_synth_attach(struct hn_softc *, int); -static void hn_synth_detach(struct hn_softc *); -static bool hn_tx_ring_pending(struct hn_tx_ring *); -static void hn_suspend(struct hn_softc *); -static void hn_suspend_data(struct hn_softc *); -static void hn_suspend_mgmt(struct hn_softc *); -static void hn_resume(struct hn_softc *); -static void hn_resume_data(struct hn_softc *); -static void hn_resume_mgmt(struct hn_softc *); -static void hn_rx_drain(struct vmbus_channel *); -static void hn_tx_resume(struct hn_softc *, int); -static void hn_tx_ring_qflush(struct hn_tx_ring *); -static int netvsc_detach(device_t dev); -static void hn_link_status(struct hn_softc *); -static int hn_sendpkt_rndis_sglist(struct hn_tx_ring *, struct hn_txdesc *); -static int hn_sendpkt_rndis_chim(struct hn_tx_ring *, struct hn_txdesc *); -static int hn_set_rxfilter(struct hn_softc *); -static void hn_link_status_update(struct hn_softc *); -static void hn_network_change(struct hn_softc *); - -static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); -static void hn_rndis_rx_data(struct hn_rx_ring *, const void *, int); -static void hn_rndis_rx_status(struct hn_softc *, const void *, int); - -static void hn_nvs_handle_notify(struct hn_softc *sc, - const struct vmbus_chanpkt_hdr *pkt); -static void hn_nvs_handle_comp(struct hn_softc *sc, struct vmbus_channel *chan, - const struct vmbus_chanpkt_hdr *pkt); -static void hn_nvs_handle_rxbuf(struct hn_rx_ring *rxr, - struct vmbus_channel *chan, - const struct vmbus_chanpkt_hdr *pkthdr); -static void hn_nvs_ack_rxbuf(struct hn_rx_ring *, struct vmbus_channel *, - uint64_t); - -static int hn_transmit(struct ifnet *, struct mbuf *); -static void hn_xmit_qflush(struct ifnet *); -static int hn_xmit(struct hn_tx_ring *, int); -static void hn_xmit_txeof(struct hn_tx_ring *); -static void hn_xmit_taskfunc(void *, int); -static void hn_xmit_txeof_taskfunc(void *, int); +static u_int hn_cpu_index; /* next CPU for channel */ +static struct taskqueue *hn_tx_taskq; /* shared TX taskqueue */ -static const uint8_t hn_rss_key_default[NDIS_HASH_KEYSIZE_TOEPLITZ] = { +static const uint8_t +hn_rss_key_default[NDIS_HASH_KEYSIZE_TOEPLITZ] = { 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4, @@ -434,6 +437,27 @@ static const uint8_t hn_rss_key_default[ 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa }; +static device_method_t hn_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, hn_probe), + DEVMETHOD(device_attach, hn_attach), + DEVMETHOD(device_detach, hn_detach), + DEVMETHOD(device_shutdown, hn_shutdown), + DEVMETHOD_END +}; + +static driver_t hn_driver = { + "hn", + hn_methods, + sizeof(struct hn_softc) +}; + +static devclass_t hn_devclass; + +DRIVER_MODULE(hn, vmbus, hn_driver, hn_devclass, 0, 0); +MODULE_VERSION(hn, 1); +MODULE_DEPEND(hn, vmbus, 1, 1, 1); + #if __FreeBSD_version >= 1100099 static void hn_set_lro_lenlim(struct hn_softc *sc, int lenlim) @@ -446,7 +470,7 @@ hn_set_lro_lenlim(struct hn_softc *sc, i #endif static int -hn_sendpkt_rndis_sglist(struct hn_tx_ring *txr, struct hn_txdesc *txd) +hn_txpkt_sglist(struct hn_tx_ring *txr, struct hn_txdesc *txd) { KASSERT(txd->chim_index == HN_NVS_CHIM_IDX_INVALID && @@ -456,7 +480,7 @@ hn_sendpkt_rndis_sglist(struct hn_tx_rin } static int -hn_sendpkt_rndis_chim(struct hn_tx_ring *txr, struct hn_txdesc *txd) +hn_txpkt_chim(struct hn_tx_ring *txr, struct hn_txdesc *txd) { struct hn_nvs_rndis rndis; @@ -655,13 +679,10 @@ static const struct hyperv_guid g_net_vs 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E} }; -/* - * Standard probe entry point. - * - */ static int -netvsc_probe(device_t dev) +hn_probe(device_t dev) { + if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &g_net_vsc_device_type) == 0) { device_set_desc(dev, "Hyper-V Network Interface"); @@ -683,14 +704,8 @@ hn_cpuset_setthread_task(void *xmask, in } } -/* - * Standard attach entry point. - * - * Called when the driver is loaded. It allocates needed resources, - * and initializes the "hardware" and software. - */ static int -netvsc_attach(device_t dev) +hn_attach(device_t dev) { struct hn_softc *sc = device_get_softc(dev); struct sysctl_oid_list *child; @@ -938,18 +953,18 @@ netvsc_attach(device_t dev) * Kick off link status check. */ sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; - hn_link_status_update(sc); + hn_update_link_status(sc); return (0); failed: if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) hn_synth_detach(sc); - netvsc_detach(dev); + hn_detach(dev); return (error); } static int -netvsc_detach(device_t dev) +hn_detach(device_t dev) { struct hn_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc->hn_ifp; @@ -988,12 +1003,10 @@ netvsc_detach(device_t dev) return (0); } -/* - * Standard shutdown entry point - */ static int -netvsc_shutdown(device_t dev) +hn_shutdown(device_t dev) { + return (0); } @@ -1058,7 +1071,7 @@ hn_netchg_status_taskfunc(void *xsc, int } static void -hn_link_status_update(struct hn_softc *sc) +hn_update_link_status(struct hn_softc *sc) { if (sc->hn_mgmt_taskq != NULL) @@ -1066,7 +1079,7 @@ hn_link_status_update(struct hn_softc *s } static void -hn_network_change(struct hn_softc *sc) +hn_change_network(struct hn_softc *sc) { if (sc->hn_mgmt_taskq != NULL) @@ -1218,7 +1231,7 @@ hn_txeof(struct hn_tx_ring *txr) } static void -hn_tx_done(struct hn_nvs_sendctx *sndc, struct hn_softc *sc, +hn_txpkt_done(struct hn_nvs_sendctx *sndc, struct hn_softc *sc, struct vmbus_channel *chan, const void *data __unused, int dlen __unused) { struct hn_txdesc *txd = sndc->hn_cbarg; @@ -1447,7 +1460,7 @@ hn_encap(struct hn_tx_ring *txr, struct txd->chim_size = pkt->rm_len; txr->hn_gpa_cnt = 0; txr->hn_tx_chimney++; - txr->hn_sendpkt = hn_sendpkt_rndis_chim; + txr->hn_sendpkt = hn_txpkt_chim; goto done; } } @@ -1494,12 +1507,12 @@ hn_encap(struct hn_tx_ring *txr, struct txd->chim_index = HN_NVS_CHIM_IDX_INVALID; txd->chim_size = 0; - txr->hn_sendpkt = hn_sendpkt_rndis_sglist; + txr->hn_sendpkt = hn_txpkt_sglist; done: txd->m = m_head; /* Set the completion routine */ - hn_nvs_sendctx_init(&txd->send_ctx, hn_tx_done, txd); + hn_nvs_sendctx_init(&txd->send_ctx, hn_txpkt_done, txd); return 0; } @@ -1510,7 +1523,7 @@ done: * associated w/ the txd will _not_ be freed. */ static int -hn_send_pkt(struct ifnet *ifp, struct hn_tx_ring *txr, struct hn_txdesc *txd) +hn_txpkt(struct ifnet *ifp, struct hn_tx_ring *txr, struct hn_txdesc *txd) { int error, send_failed = 0; @@ -1626,7 +1639,7 @@ hn_start_locked(struct hn_tx_ring *txr, continue; } - error = hn_send_pkt(ifp, txr, txd); + error = hn_txpkt(ifp, txr, txd); if (__predict_false(error)) { /* txd is freed, but m_head is not */ IFQ_DRV_PREPEND(&ifp->if_snd, m_head); @@ -2139,9 +2152,6 @@ hn_stop(struct hn_softc *sc) sc->hn_tx_ring[i].hn_oactive = 0; } -/* - * FreeBSD transmit entry point - */ static void hn_start(struct ifnet *ifp) { @@ -2220,7 +2230,7 @@ hn_init_locked(struct hn_softc *sc) sc->hn_tx_ring[i].hn_oactive = 0; /* Clear TX 'suspended' bit. */ - hn_tx_resume(sc, sc->hn_tx_ring_inuse); + hn_resume_tx(sc, sc->hn_tx_ring_inuse); /* Everything is ready; unleash! */ atomic_set_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); @@ -2236,20 +2246,6 @@ hn_init(void *xsc) HN_UNLOCK(sc); } -#ifdef LATER -/* - * - */ -static void -hn_watchdog(struct ifnet *ifp) -{ - - if_printf(ifp, "watchdog timeout -- resetting\n"); - hn_init(ifp->if_softc); /* XXX */ - ifp->if_oerrors++; -} -#endif - #if __FreeBSD_version >= 1100099 static int @@ -2931,7 +2927,7 @@ hn_destroy_rx_data(struct hn_softc *sc) } static int -hn_create_tx_ring(struct hn_softc *sc, int id) +hn_tx_ring_create(struct hn_softc *sc, int id) { struct hn_tx_ring *txr = &sc->hn_tx_ring[id]; device_t dev = sc->hn_dev; @@ -3128,7 +3124,7 @@ hn_txdesc_dmamap_destroy(struct hn_txdes } static void -hn_destroy_tx_ring(struct hn_tx_ring *txr) +hn_tx_ring_destroy(struct hn_tx_ring *txr) { struct hn_txdesc *txd; @@ -3204,7 +3200,7 @@ hn_create_tx_data(struct hn_softc *sc, i for (i = 0; i < sc->hn_tx_ring_cnt; ++i) { int error; - error = hn_create_tx_ring(sc, i); + error = hn_tx_ring_create(sc, i); if (error) return error; } @@ -3350,7 +3346,7 @@ hn_destroy_tx_data(struct hn_softc *sc) return; for (i = 0; i < sc->hn_tx_ring_cnt; ++i) - hn_destroy_tx_ring(&sc->hn_tx_ring[i]); + hn_tx_ring_destroy(&sc->hn_tx_ring[i]); free(sc->hn_tx_ring, M_DEVBUF); sc->hn_tx_ring = NULL; @@ -3426,7 +3422,7 @@ hn_xmit(struct hn_tx_ring *txr, int len) continue; } - error = hn_send_pkt(ifp, txr, txd); + error = hn_txpkt(ifp, txr, txd); if (__predict_false(error)) { /* txd is freed, but m_head is not */ drbr_putback(ifp, txr->hn_mbuf_br, m_head); @@ -3949,7 +3945,7 @@ hn_set_ring_inuse(struct hn_softc *sc, i } static void -hn_rx_drain(struct vmbus_channel *chan) +hn_chan_drain(struct vmbus_channel *chan) { while (!vmbus_chan_rx_empty(chan) || !vmbus_chan_tx_empty(chan)) @@ -4004,9 +4000,9 @@ hn_suspend_data(struct hn_softc *sc) if (subch != NULL) { for (i = 0; i < nsubch; ++i) - hn_rx_drain(subch[i]); + hn_chan_drain(subch[i]); } - hn_rx_drain(sc->hn_prichan); + hn_chan_drain(sc->hn_prichan); if (subch != NULL) vmbus_subchan_rel(subch, nsubch); @@ -4051,7 +4047,7 @@ hn_suspend(struct hn_softc *sc) } static void -hn_tx_resume(struct hn_softc *sc, int tx_ring_cnt) +hn_resume_tx(struct hn_softc *sc, int tx_ring_cnt) { int i; @@ -4084,7 +4080,7 @@ hn_resume_data(struct hn_softc *sc) * since hn_tx_ring_inuse can be changed after * hn_suspend_data(). */ - hn_tx_resume(sc, sc->hn_tx_ring_cnt); + hn_resume_tx(sc, sc->hn_tx_ring_cnt); if (!hn_use_if_start) { /* @@ -4122,9 +4118,9 @@ hn_resume_mgmt(struct hn_softc *sc) * detection. */ if (sc->hn_link_flags & HN_LINK_FLAG_NETCHG) - hn_network_change(sc); + hn_change_network(sc); else - hn_link_status_update(sc); + hn_update_link_status(sc); } static void @@ -4151,7 +4147,7 @@ hn_rndis_rx_status(struct hn_softc *sc, switch (msg->rm_status) { case RNDIS_STATUS_MEDIA_CONNECT: case RNDIS_STATUS_MEDIA_DISCONNECT: - hn_link_status_update(sc); + hn_update_link_status(sc); break; case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG: @@ -4171,7 +4167,7 @@ hn_rndis_rx_status(struct hn_softc *sc, if_printf(sc->hn_ifp, "network changed, change %u\n", change); } - hn_network_change(sc); + hn_change_network(sc); break; default: @@ -4687,25 +4683,3 @@ hn_tx_taskq_destroy(void *arg __unused) } SYSUNINIT(hn_txtq_destroy, SI_SUB_DRIVERS, SI_ORDER_SECOND, hn_tx_taskq_destroy, NULL); - -static device_method_t netvsc_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, netvsc_probe), - DEVMETHOD(device_attach, netvsc_attach), - DEVMETHOD(device_detach, netvsc_detach), - DEVMETHOD(device_shutdown, netvsc_shutdown), - - { 0, 0 } -}; - -static driver_t netvsc_driver = { - NETVSC_DEVNAME, - netvsc_methods, - sizeof(struct hn_softc) -}; - -static devclass_t netvsc_devclass; - -DRIVER_MODULE(hn, vmbus, netvsc_driver, netvsc_devclass, 0, 0); -MODULE_VERSION(hn, 1); -MODULE_DEPEND(hn, vmbus, 1, 1, 1); From owner-svn-src-all@freebsd.org Fri Nov 11 07:25:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BAE2C3AAFC; Fri, 11 Nov 2016 07:25:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C8AA1238; Fri, 11 Nov 2016 07:25:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB7PEeb087138; Fri, 11 Nov 2016 07:25:14 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB7PEvt087134; Fri, 11 Nov 2016 07:25:14 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110725.uAB7PEvt087134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 07:25:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308511 - in stable/10/sys: conf dev/hyperv/netvsc modules/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 07:25:15 -0000 Author: sephe Date: Fri Nov 11 07:25:14 2016 New Revision: 308511 URL: https://svnweb.freebsd.org/changeset/base/308511 Log: MFC 308163 hyperv/hn: Rename cleaned up file. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8390 Added: stable/10/sys/dev/hyperv/netvsc/if_hn.c - copied unchanged from r308510, stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Deleted: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Modified: stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/modules/hyperv/netvsc/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Fri Nov 11 07:13:17 2016 (r308510) +++ stable/10/sys/conf/files.amd64 Fri Nov 11 07:25:14 2016 (r308511) @@ -263,7 +263,7 @@ dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hn_rndis.c optional hyperv -dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c optional hyperv +dev/hyperv/netvsc/if_hn.c optional hyperv dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c optional hyperv dev/hyperv/utilities/hv_heartbeat.c optional hyperv dev/hyperv/utilities/hv_kvp.c optional hyperv Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Fri Nov 11 07:13:17 2016 (r308510) +++ stable/10/sys/conf/files.i386 Fri Nov 11 07:25:14 2016 (r308511) @@ -240,7 +240,7 @@ dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hn_rndis.c optional hyperv -dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c optional hyperv +dev/hyperv/netvsc/if_hn.c optional hyperv dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c optional hyperv dev/hyperv/utilities/hv_heartbeat.c optional hyperv dev/hyperv/utilities/hv_kvp.c optional hyperv Copied: stable/10/sys/dev/hyperv/netvsc/if_hn.c (from r308510, stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/hyperv/netvsc/if_hn.c Fri Nov 11 07:25:14 2016 (r308511, copy of r308510, stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c) @@ -0,0 +1,4685 @@ +/*- + * Copyright (c) 2010-2012 Citrix Inc. + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2012 NetApp Inc. + * 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. + */ + +/*- + * Copyright (c) 2004-2006 Kip Macy + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_inet6.h" +#include "opt_inet.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "vmbus_if.h" + +#define HN_RING_CNT_DEF_MAX 8 + +/* YYY should get it from the underlying channel */ +#define HN_TX_DESC_CNT 512 + +#define HN_RNDIS_PKT_LEN \ + (sizeof(struct rndis_packet_msg) + \ + HN_RNDIS_PKTINFO_SIZE(HN_NDIS_HASH_VALUE_SIZE) + \ + HN_RNDIS_PKTINFO_SIZE(NDIS_VLAN_INFO_SIZE) + \ + HN_RNDIS_PKTINFO_SIZE(NDIS_LSO2_INFO_SIZE) + \ + HN_RNDIS_PKTINFO_SIZE(NDIS_TXCSUM_INFO_SIZE)) +#define HN_RNDIS_PKT_BOUNDARY PAGE_SIZE +#define HN_RNDIS_PKT_ALIGN CACHE_LINE_SIZE + +#define HN_TX_DATA_BOUNDARY PAGE_SIZE +#define HN_TX_DATA_MAXSIZE IP_MAXPACKET +#define HN_TX_DATA_SEGSIZE PAGE_SIZE +/* -1 for RNDIS packet message */ +#define HN_TX_DATA_SEGCNT_MAX (HN_GPACNT_MAX - 1) + +#define HN_DIRECT_TX_SIZE_DEF 128 + +#define HN_EARLY_TXEOF_THRESH 8 + +#define HN_PKTBUF_LEN_DEF (16 * 1024) + +#define HN_LROENT_CNT_DEF 128 + +#define HN_LRO_LENLIM_MULTIRX_DEF (12 * ETHERMTU) +#define HN_LRO_LENLIM_DEF (25 * ETHERMTU) +/* YYY 2*MTU is a bit rough, but should be good enough. */ +#define HN_LRO_LENLIM_MIN(ifp) (2 * (ifp)->if_mtu) + +#define HN_LRO_ACKCNT_DEF 1 + +#define HN_LOCK_INIT(sc) \ + sx_init(&(sc)->hn_lock, device_get_nameunit((sc)->hn_dev)) +#define HN_LOCK_DESTROY(sc) sx_destroy(&(sc)->hn_lock) +#define HN_LOCK_ASSERT(sc) sx_assert(&(sc)->hn_lock, SA_XLOCKED) +#define HN_LOCK(sc) sx_xlock(&(sc)->hn_lock) +#define HN_UNLOCK(sc) sx_xunlock(&(sc)->hn_lock) + +#define HN_CSUM_IP_MASK (CSUM_IP | CSUM_IP_TCP | CSUM_IP_UDP) +#define HN_CSUM_IP6_MASK (CSUM_IP6_TCP | CSUM_IP6_UDP) +#define HN_CSUM_IP_HWASSIST(sc) \ + ((sc)->hn_tx_ring[0].hn_csum_assist & HN_CSUM_IP_MASK) +#define HN_CSUM_IP6_HWASSIST(sc) \ + ((sc)->hn_tx_ring[0].hn_csum_assist & HN_CSUM_IP6_MASK) + +struct hn_txdesc { +#ifndef HN_USE_TXDESC_BUFRING + SLIST_ENTRY(hn_txdesc) link; +#endif + struct mbuf *m; + struct hn_tx_ring *txr; + int refs; + uint32_t flags; /* HN_TXD_FLAG_ */ + struct hn_nvs_sendctx send_ctx; + uint32_t chim_index; + int chim_size; + + bus_dmamap_t data_dmap; + + bus_addr_t rndis_pkt_paddr; + struct rndis_packet_msg *rndis_pkt; + bus_dmamap_t rndis_pkt_dmap; +}; + +#define HN_TXD_FLAG_ONLIST 0x0001 +#define HN_TXD_FLAG_DMAMAP 0x0002 + +struct hn_rxinfo { + uint32_t vlan_info; + uint32_t csum_info; + uint32_t hash_info; + uint32_t hash_value; +}; + +#define HN_RXINFO_VLAN 0x0001 +#define HN_RXINFO_CSUM 0x0002 +#define HN_RXINFO_HASHINF 0x0004 +#define HN_RXINFO_HASHVAL 0x0008 +#define HN_RXINFO_ALL \ + (HN_RXINFO_VLAN | \ + HN_RXINFO_CSUM | \ + HN_RXINFO_HASHINF | \ + HN_RXINFO_HASHVAL) + +#define HN_NDIS_VLAN_INFO_INVALID 0xffffffff +#define HN_NDIS_RXCSUM_INFO_INVALID 0 +#define HN_NDIS_HASH_INFO_INVALID 0 + +static int hn_probe(device_t); +static int hn_attach(device_t); +static int hn_detach(device_t); +static int hn_shutdown(device_t); +static void hn_chan_callback(struct vmbus_channel *, + void *); + +static void hn_init(void *); +static int hn_ioctl(struct ifnet *, u_long, caddr_t); +static void hn_start(struct ifnet *); +static int hn_transmit(struct ifnet *, struct mbuf *); +static void hn_xmit_qflush(struct ifnet *); +static int hn_ifmedia_upd(struct ifnet *); +static void hn_ifmedia_sts(struct ifnet *, + struct ifmediareq *); + +static int hn_rndis_rxinfo(const void *, int, + struct hn_rxinfo *); +static void hn_rndis_rx_data(struct hn_rx_ring *, + const void *, int); +static void hn_rndis_rx_status(struct hn_softc *, + const void *, int); + +static void hn_nvs_handle_notify(struct hn_softc *, + const struct vmbus_chanpkt_hdr *); +static void hn_nvs_handle_comp(struct hn_softc *, + struct vmbus_channel *, + const struct vmbus_chanpkt_hdr *); +static void hn_nvs_handle_rxbuf(struct hn_rx_ring *, + struct vmbus_channel *, + const struct vmbus_chanpkt_hdr *); +static void hn_nvs_ack_rxbuf(struct hn_rx_ring *, + struct vmbus_channel *, uint64_t); + +#if __FreeBSD_version >= 1100099 +static int hn_lro_lenlim_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_lro_ackcnt_sysctl(SYSCTL_HANDLER_ARGS); +#endif +static int hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_chim_size_sysctl(SYSCTL_HANDLER_ARGS); +#if __FreeBSD_version < 1100095 +static int hn_rx_stat_int_sysctl(SYSCTL_HANDLER_ARGS); +#else +static int hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS); +#endif +static int hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_caps_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_hwassist_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS); + +static void hn_stop(struct hn_softc *); +static void hn_init_locked(struct hn_softc *); +static int hn_chan_attach(struct hn_softc *, + struct vmbus_channel *); +static void hn_chan_detach(struct hn_softc *, + struct vmbus_channel *); +static int hn_attach_subchans(struct hn_softc *); +static void hn_detach_allchans(struct hn_softc *); +static void hn_chan_rollup(struct hn_rx_ring *, + struct hn_tx_ring *); +static void hn_set_ring_inuse(struct hn_softc *, int); +static int hn_synth_attach(struct hn_softc *, int); +static void hn_synth_detach(struct hn_softc *); +static int hn_synth_alloc_subchans(struct hn_softc *, + int *); +static void hn_suspend(struct hn_softc *); +static void hn_suspend_data(struct hn_softc *); +static void hn_suspend_mgmt(struct hn_softc *); +static void hn_resume(struct hn_softc *); +static void hn_resume_data(struct hn_softc *); +static void hn_resume_mgmt(struct hn_softc *); +static void hn_suspend_mgmt_taskfunc(void *, int); +static void hn_chan_drain(struct vmbus_channel *); + +static void hn_update_link_status(struct hn_softc *); +static void hn_change_network(struct hn_softc *); +static void hn_link_taskfunc(void *, int); +static void hn_netchg_init_taskfunc(void *, int); +static void hn_netchg_status_taskfunc(void *, int); +static void hn_link_status(struct hn_softc *); + +static int hn_create_rx_data(struct hn_softc *, int); +static void hn_destroy_rx_data(struct hn_softc *); +static int hn_check_iplen(const struct mbuf *, int); +static int hn_set_rxfilter(struct hn_softc *); +static int hn_rss_reconfig(struct hn_softc *); +static void hn_rss_ind_fixup(struct hn_softc *, int); +static int hn_rxpkt(struct hn_rx_ring *, const void *, + int, const struct hn_rxinfo *); + +static int hn_tx_ring_create(struct hn_softc *, int); +static void hn_tx_ring_destroy(struct hn_tx_ring *); +static int hn_create_tx_data(struct hn_softc *, int); +static void hn_fixup_tx_data(struct hn_softc *); +static void hn_destroy_tx_data(struct hn_softc *); +static void hn_txdesc_dmamap_destroy(struct hn_txdesc *); +static int hn_encap(struct hn_tx_ring *, + struct hn_txdesc *, struct mbuf **); +static int hn_txpkt(struct ifnet *, struct hn_tx_ring *, + struct hn_txdesc *); +static void hn_set_chim_size(struct hn_softc *, int); +static void hn_set_tso_maxsize(struct hn_softc *, int, int); +static bool hn_tx_ring_pending(struct hn_tx_ring *); +static void hn_tx_ring_qflush(struct hn_tx_ring *); +static void hn_resume_tx(struct hn_softc *, int); +static int hn_get_txswq_depth(const struct hn_tx_ring *); +static void hn_txpkt_done(struct hn_nvs_sendctx *, + struct hn_softc *, struct vmbus_channel *, + const void *, int); +static int hn_txpkt_sglist(struct hn_tx_ring *, + struct hn_txdesc *); +static int hn_txpkt_chim(struct hn_tx_ring *, + struct hn_txdesc *); +static int hn_xmit(struct hn_tx_ring *, int); +static void hn_xmit_taskfunc(void *, int); +static void hn_xmit_txeof(struct hn_tx_ring *); +static void hn_xmit_txeof_taskfunc(void *, int); +static int hn_start_locked(struct hn_tx_ring *, int); +static void hn_start_taskfunc(void *, int); +static void hn_start_txeof(struct hn_tx_ring *); +static void hn_start_txeof_taskfunc(void *, int); + +SYSCTL_NODE(_hw, OID_AUTO, hn, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, + "Hyper-V network interface"); + +/* Trust tcp segements verification on host side. */ +static int hn_trust_hosttcp = 1; +SYSCTL_INT(_hw_hn, OID_AUTO, trust_hosttcp, CTLFLAG_RDTUN, + &hn_trust_hosttcp, 0, + "Trust tcp segement verification on host side, " + "when csum info is missing (global setting)"); + +/* Trust udp datagrams verification on host side. */ +static int hn_trust_hostudp = 1; +SYSCTL_INT(_hw_hn, OID_AUTO, trust_hostudp, CTLFLAG_RDTUN, + &hn_trust_hostudp, 0, + "Trust udp datagram verification on host side, " + "when csum info is missing (global setting)"); + +/* Trust ip packets verification on host side. */ +static int hn_trust_hostip = 1; +SYSCTL_INT(_hw_hn, OID_AUTO, trust_hostip, CTLFLAG_RDTUN, + &hn_trust_hostip, 0, + "Trust ip packet verification on host side, " + "when csum info is missing (global setting)"); + +/* Limit TSO burst size */ +static int hn_tso_maxlen = IP_MAXPACKET; +SYSCTL_INT(_hw_hn, OID_AUTO, tso_maxlen, CTLFLAG_RDTUN, + &hn_tso_maxlen, 0, "TSO burst limit"); + +/* Limit chimney send size */ +static int hn_tx_chimney_size = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, tx_chimney_size, CTLFLAG_RDTUN, + &hn_tx_chimney_size, 0, "Chimney send packet size limit"); + +/* Limit the size of packet for direct transmission */ +static int hn_direct_tx_size = HN_DIRECT_TX_SIZE_DEF; +SYSCTL_INT(_hw_hn, OID_AUTO, direct_tx_size, CTLFLAG_RDTUN, + &hn_direct_tx_size, 0, "Size of the packet for direct transmission"); + +/* # of LRO entries per RX ring */ +#if defined(INET) || defined(INET6) +#if __FreeBSD_version >= 1100095 +static int hn_lro_entry_count = HN_LROENT_CNT_DEF; +SYSCTL_INT(_hw_hn, OID_AUTO, lro_entry_count, CTLFLAG_RDTUN, + &hn_lro_entry_count, 0, "LRO entry count"); +#endif +#endif + +/* Use shared TX taskqueue */ +static int hn_share_tx_taskq = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, share_tx_taskq, CTLFLAG_RDTUN, + &hn_share_tx_taskq, 0, "Enable shared TX taskqueue"); + +#ifndef HN_USE_TXDESC_BUFRING +static int hn_use_txdesc_bufring = 0; +#else +static int hn_use_txdesc_bufring = 1; +#endif +SYSCTL_INT(_hw_hn, OID_AUTO, use_txdesc_bufring, CTLFLAG_RD, + &hn_use_txdesc_bufring, 0, "Use buf_ring for TX descriptors"); + +/* Bind TX taskqueue to the target CPU */ +static int hn_bind_tx_taskq = -1; +SYSCTL_INT(_hw_hn, OID_AUTO, bind_tx_taskq, CTLFLAG_RDTUN, + &hn_bind_tx_taskq, 0, "Bind TX taskqueue to the specified cpu"); + +/* Use ifnet.if_start instead of ifnet.if_transmit */ +static int hn_use_if_start = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, use_if_start, CTLFLAG_RDTUN, + &hn_use_if_start, 0, "Use if_start TX method"); + +/* # of channels to use */ +static int hn_chan_cnt = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, chan_cnt, CTLFLAG_RDTUN, + &hn_chan_cnt, 0, + "# of channels to use; each channel has one RX ring and one TX ring"); + +/* # of transmit rings to use */ +static int hn_tx_ring_cnt = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, tx_ring_cnt, CTLFLAG_RDTUN, + &hn_tx_ring_cnt, 0, "# of TX rings to use"); + +/* Software TX ring deptch */ +static int hn_tx_swq_depth = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, tx_swq_depth, CTLFLAG_RDTUN, + &hn_tx_swq_depth, 0, "Depth of IFQ or BUFRING"); + +/* Enable sorted LRO, and the depth of the per-channel mbuf queue */ +#if __FreeBSD_version >= 1100095 +static u_int hn_lro_mbufq_depth = 0; +SYSCTL_UINT(_hw_hn, OID_AUTO, lro_mbufq_depth, CTLFLAG_RDTUN, + &hn_lro_mbufq_depth, 0, "Depth of LRO mbuf queue"); +#endif + +static u_int hn_cpu_index; /* next CPU for channel */ +static struct taskqueue *hn_tx_taskq; /* shared TX taskqueue */ + +static const uint8_t +hn_rss_key_default[NDIS_HASH_KEYSIZE_TOEPLITZ] = { + 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, + 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, + 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4, + 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c, + 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa +}; + +static device_method_t hn_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, hn_probe), + DEVMETHOD(device_attach, hn_attach), + DEVMETHOD(device_detach, hn_detach), + DEVMETHOD(device_shutdown, hn_shutdown), + DEVMETHOD_END +}; + +static driver_t hn_driver = { + "hn", + hn_methods, + sizeof(struct hn_softc) +}; + +static devclass_t hn_devclass; + +DRIVER_MODULE(hn, vmbus, hn_driver, hn_devclass, 0, 0); +MODULE_VERSION(hn, 1); +MODULE_DEPEND(hn, vmbus, 1, 1, 1); + +#if __FreeBSD_version >= 1100099 +static void +hn_set_lro_lenlim(struct hn_softc *sc, int lenlim) +{ + int i; + + for (i = 0; i < sc->hn_rx_ring_inuse; ++i) + sc->hn_rx_ring[i].hn_lro.lro_length_lim = lenlim; +} +#endif + +static int +hn_txpkt_sglist(struct hn_tx_ring *txr, struct hn_txdesc *txd) +{ + + KASSERT(txd->chim_index == HN_NVS_CHIM_IDX_INVALID && + txd->chim_size == 0, ("invalid rndis sglist txd")); + return (hn_nvs_send_rndis_sglist(txr->hn_chan, HN_NVS_RNDIS_MTYPE_DATA, + &txd->send_ctx, txr->hn_gpa, txr->hn_gpa_cnt)); +} + +static int +hn_txpkt_chim(struct hn_tx_ring *txr, struct hn_txdesc *txd) +{ + struct hn_nvs_rndis rndis; + + KASSERT(txd->chim_index != HN_NVS_CHIM_IDX_INVALID && + txd->chim_size > 0, ("invalid rndis chim txd")); + + rndis.nvs_type = HN_NVS_TYPE_RNDIS; + rndis.nvs_rndis_mtype = HN_NVS_RNDIS_MTYPE_DATA; + rndis.nvs_chim_idx = txd->chim_index; + rndis.nvs_chim_sz = txd->chim_size; + + return (hn_nvs_send(txr->hn_chan, VMBUS_CHANPKT_FLAG_RC, + &rndis, sizeof(rndis), &txd->send_ctx)); +} + +static __inline uint32_t +hn_chim_alloc(struct hn_softc *sc) +{ + int i, bmap_cnt = sc->hn_chim_bmap_cnt; + u_long *bmap = sc->hn_chim_bmap; + uint32_t ret = HN_NVS_CHIM_IDX_INVALID; + + for (i = 0; i < bmap_cnt; ++i) { + int idx; + + idx = ffsl(~bmap[i]); + if (idx == 0) + continue; + + --idx; /* ffsl is 1-based */ + KASSERT(i * LONG_BIT + idx < sc->hn_chim_cnt, + ("invalid i %d and idx %d", i, idx)); + + if (atomic_testandset_long(&bmap[i], idx)) + continue; + + ret = i * LONG_BIT + idx; + break; + } + return (ret); +} + +static __inline void +hn_chim_free(struct hn_softc *sc, uint32_t chim_idx) +{ + u_long mask; + uint32_t idx; + + idx = chim_idx / LONG_BIT; + KASSERT(idx < sc->hn_chim_bmap_cnt, + ("invalid chimney index 0x%x", chim_idx)); + + mask = 1UL << (chim_idx % LONG_BIT); + KASSERT(sc->hn_chim_bmap[idx] & mask, + ("index bitmap 0x%lx, chimney index %u, " + "bitmap idx %d, bitmask 0x%lx", + sc->hn_chim_bmap[idx], chim_idx, idx, mask)); + + atomic_clear_long(&sc->hn_chim_bmap[idx], mask); +} + +static int +hn_set_rxfilter(struct hn_softc *sc) +{ + struct ifnet *ifp = sc->hn_ifp; + uint32_t filter; + int error = 0; + + HN_LOCK_ASSERT(sc); + + if (ifp->if_flags & IFF_PROMISC) { + filter = NDIS_PACKET_TYPE_PROMISCUOUS; + } else { + filter = NDIS_PACKET_TYPE_DIRECTED; + if (ifp->if_flags & IFF_BROADCAST) + filter |= NDIS_PACKET_TYPE_BROADCAST; +#ifdef notyet + /* + * See the comment in SIOCADDMULTI/SIOCDELMULTI. + */ + /* TODO: support multicast list */ + if ((ifp->if_flags & IFF_ALLMULTI) || + !TAILQ_EMPTY(&ifp->if_multiaddrs)) + filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; +#else + /* Always enable ALLMULTI */ + filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; +#endif + } + + if (sc->hn_rx_filter != filter) { + error = hn_rndis_set_rxfilter(sc, filter); + if (!error) + sc->hn_rx_filter = filter; + } + return (error); +} + +static int +hn_get_txswq_depth(const struct hn_tx_ring *txr) +{ + + KASSERT(txr->hn_txdesc_cnt > 0, ("tx ring is not setup yet")); + if (hn_tx_swq_depth < txr->hn_txdesc_cnt) + return txr->hn_txdesc_cnt; + return hn_tx_swq_depth; +} + +static int +hn_rss_reconfig(struct hn_softc *sc) +{ + int error; + + HN_LOCK_ASSERT(sc); + + if ((sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) == 0) + return (ENXIO); + + /* + * Disable RSS first. + * + * NOTE: + * Direct reconfiguration by setting the UNCHG flags does + * _not_ work properly. + */ + if (bootverbose) + if_printf(sc->hn_ifp, "disable RSS\n"); + error = hn_rndis_conf_rss(sc, NDIS_RSS_FLAG_DISABLE); + if (error) { + if_printf(sc->hn_ifp, "RSS disable failed\n"); + return (error); + } + + /* + * Reenable the RSS w/ the updated RSS key or indirect + * table. + */ + if (bootverbose) + if_printf(sc->hn_ifp, "reconfig RSS\n"); + error = hn_rndis_conf_rss(sc, NDIS_RSS_FLAG_NONE); + if (error) { + if_printf(sc->hn_ifp, "RSS reconfig failed\n"); + return (error); + } + return (0); +} + +static void +hn_rss_ind_fixup(struct hn_softc *sc, int nchan) +{ + struct ndis_rssprm_toeplitz *rss = &sc->hn_rss; + int i; + + KASSERT(nchan > 1, ("invalid # of channels %d", nchan)); + + /* + * Check indirect table to make sure that all channels in it + * can be used. + */ + for (i = 0; i < NDIS_HASH_INDCNT; ++i) { + if (rss->rss_ind[i] >= nchan) { + if_printf(sc->hn_ifp, + "RSS indirect table %d fixup: %u -> %d\n", + i, rss->rss_ind[i], nchan - 1); + rss->rss_ind[i] = nchan - 1; + } + } +} + +static int +hn_ifmedia_upd(struct ifnet *ifp __unused) +{ + + return EOPNOTSUPP; +} + +static void +hn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + struct hn_softc *sc = ifp->if_softc; + + ifmr->ifm_status = IFM_AVALID; + ifmr->ifm_active = IFM_ETHER; + + if ((sc->hn_link_flags & HN_LINK_FLAG_LINKUP) == 0) { + ifmr->ifm_active |= IFM_NONE; + return; + } + ifmr->ifm_status |= IFM_ACTIVE; + ifmr->ifm_active |= IFM_10G_T | IFM_FDX; +} + +/* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ +static const struct hyperv_guid g_net_vsc_device_type = { + .hv_guid = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, + 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E} +}; + +static int +hn_probe(device_t dev) +{ + + if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, + &g_net_vsc_device_type) == 0) { + device_set_desc(dev, "Hyper-V Network Interface"); + return BUS_PROBE_DEFAULT; + } + return ENXIO; +} + +static void +hn_cpuset_setthread_task(void *xmask, int pending __unused) +{ + cpuset_t *mask = xmask; + int error; + + error = cpuset_setthread(curthread->td_tid, mask); + if (error) { + panic("curthread=%ju: can't pin; error=%d", + (uintmax_t)curthread->td_tid, error); + } +} + +static int +hn_attach(device_t dev) +{ + struct hn_softc *sc = device_get_softc(dev); + struct sysctl_oid_list *child; + struct sysctl_ctx_list *ctx; + uint8_t eaddr[ETHER_ADDR_LEN]; + struct ifnet *ifp = NULL; + int error, ring_cnt, tx_ring_cnt; + + sc->hn_dev = dev; + sc->hn_prichan = vmbus_get_channel(dev); + HN_LOCK_INIT(sc); + + /* + * Setup taskqueue for transmission. + */ + if (hn_tx_taskq == NULL) { + sc->hn_tx_taskq = taskqueue_create("hn_tx", M_WAITOK, + taskqueue_thread_enqueue, &sc->hn_tx_taskq); + taskqueue_start_threads(&sc->hn_tx_taskq, 1, PI_NET, "%s tx", + device_get_nameunit(dev)); + if (hn_bind_tx_taskq >= 0) { + int cpu = hn_bind_tx_taskq; + struct task cpuset_task; + cpuset_t cpu_set; + + if (cpu > mp_ncpus - 1) + cpu = mp_ncpus - 1; + CPU_SETOF(cpu, &cpu_set); + TASK_INIT(&cpuset_task, 0, hn_cpuset_setthread_task, + &cpu_set); + taskqueue_enqueue(sc->hn_tx_taskq, &cpuset_task); + taskqueue_drain(sc->hn_tx_taskq, &cpuset_task); + } + } else { + sc->hn_tx_taskq = hn_tx_taskq; + } + + /* + * Setup taskqueue for mangement tasks, e.g. link status. + */ + sc->hn_mgmt_taskq0 = taskqueue_create("hn_mgmt", M_WAITOK, + taskqueue_thread_enqueue, &sc->hn_mgmt_taskq0); + taskqueue_start_threads(&sc->hn_mgmt_taskq0, 1, PI_NET, "%s mgmt", + device_get_nameunit(dev)); + TASK_INIT(&sc->hn_link_task, 0, hn_link_taskfunc, sc); + TASK_INIT(&sc->hn_netchg_init, 0, hn_netchg_init_taskfunc, sc); + TIMEOUT_TASK_INIT(sc->hn_mgmt_taskq0, &sc->hn_netchg_status, 0, + hn_netchg_status_taskfunc, sc); + + /* + * Allocate ifnet and setup its name earlier, so that if_printf + * can be used by functions, which will be called after + * ether_ifattach(). + */ + ifp = sc->hn_ifp = sc->arpcom.ac_ifp = if_alloc(IFT_ETHER); + ifp->if_softc = sc; + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + + /* + * Initialize ifmedia earlier so that it can be unconditionally + * destroyed, if error happened later on. + */ + ifmedia_init(&sc->hn_media, 0, hn_ifmedia_upd, hn_ifmedia_sts); + + /* + * Figure out the # of RX rings (ring_cnt) and the # of TX rings + * to use (tx_ring_cnt). + * + * NOTE: + * The # of RX rings to use is same as the # of channels to use. + */ + ring_cnt = hn_chan_cnt; + if (ring_cnt <= 0) { + /* Default */ + ring_cnt = mp_ncpus; + if (ring_cnt > HN_RING_CNT_DEF_MAX) + ring_cnt = HN_RING_CNT_DEF_MAX; + } else if (ring_cnt > mp_ncpus) { + ring_cnt = mp_ncpus; + } + + tx_ring_cnt = hn_tx_ring_cnt; + if (tx_ring_cnt <= 0 || tx_ring_cnt > ring_cnt) + tx_ring_cnt = ring_cnt; + if (hn_use_if_start) { + /* ifnet.if_start only needs one TX ring. */ + tx_ring_cnt = 1; + } + + /* + * Set the leader CPU for channels. + */ + sc->hn_cpu = atomic_fetchadd_int(&hn_cpu_index, ring_cnt) % mp_ncpus; + + /* + * Create enough TX/RX rings, even if only limited number of + * channels can be allocated. + */ + error = hn_create_tx_data(sc, tx_ring_cnt); + if (error) + goto failed; + error = hn_create_rx_data(sc, ring_cnt); + if (error) + goto failed; + + /* + * Create transaction context for NVS and RNDIS transactions. + */ + sc->hn_xact = vmbus_xact_ctx_create(bus_get_dma_tag(dev), + HN_XACT_REQ_SIZE, HN_XACT_RESP_SIZE, 0); + if (sc->hn_xact == NULL) + goto failed; + + /* + * Attach the synthetic parts, i.e. NVS and RNDIS. + */ + error = hn_synth_attach(sc, ETHERMTU); + if (error) + goto failed; + + error = hn_rndis_get_eaddr(sc, eaddr); + if (error) + goto failed; + +#if __FreeBSD_version >= 1100099 + if (sc->hn_rx_ring_inuse > 1) { + /* + * Reduce TCP segment aggregation limit for multiple + * RX rings to increase ACK timeliness. + */ + hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MULTIRX_DEF); + } +#endif + + /* + * Fixup TX stuffs after synthetic parts are attached. + */ + hn_fixup_tx_data(sc); + + ctx = device_get_sysctl_ctx(dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "nvs_version", CTLFLAG_RD, + &sc->hn_nvs_ver, 0, "NVS version"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "ndis_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_ndis_version_sysctl, "A", "NDIS version"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "caps", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_caps_sysctl, "A", "capabilities"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "hwassist", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_hwassist_sysctl, "A", "hwassist"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxfilter", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_rxfilter_sysctl, "A", "rxfilter"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_hash", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_rss_hash_sysctl, "A", "RSS hash"); + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "rss_ind_size", + CTLFLAG_RD, &sc->hn_rss_ind_size, 0, "RSS indirect entry count"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_key", + CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + hn_rss_key_sysctl, "IU", "RSS key"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_ind", + CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + hn_rss_ind_sysctl, "IU", "RSS indirect table"); + + /* + * Setup the ifmedia, which has been initialized earlier. + */ + ifmedia_add(&sc->hn_media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->hn_media, IFM_ETHER | IFM_AUTO); + /* XXX ifmedia_set really should do this for us */ + sc->hn_media.ifm_media = sc->hn_media.ifm_cur->ifm_media; + + /* + * Setup the ifnet for this interface. + */ + +#ifdef __LP64__ + ifp->if_baudrate = IF_Gbps(10); +#else + /* if_baudrate is 32bits on 32bit system. */ + ifp->if_baudrate = IF_Gbps(1); +#endif + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = hn_ioctl; + ifp->if_init = hn_init; + if (hn_use_if_start) { + int qdepth = hn_get_txswq_depth(&sc->hn_tx_ring[0]); + + ifp->if_start = hn_start; + IFQ_SET_MAXLEN(&ifp->if_snd, qdepth); + ifp->if_snd.ifq_drv_maxlen = qdepth - 1; + IFQ_SET_READY(&ifp->if_snd); + } else { + ifp->if_transmit = hn_transmit; + ifp->if_qflush = hn_xmit_qflush; + } + + ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_LRO; +#ifdef foo + /* We can't diff IPv6 packets from IPv4 packets on RX path. */ + ifp->if_capabilities |= IFCAP_RXCSUM_IPV6; +#endif + if (sc->hn_caps & HN_CAP_VLAN) { + /* XXX not sure about VLAN_MTU. */ + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + } + + ifp->if_hwassist = sc->hn_tx_ring[0].hn_csum_assist; + if (ifp->if_hwassist & HN_CSUM_IP_MASK) + ifp->if_capabilities |= IFCAP_TXCSUM; + if (ifp->if_hwassist & HN_CSUM_IP6_MASK) + ifp->if_capabilities |= IFCAP_TXCSUM_IPV6; + if (sc->hn_caps & HN_CAP_TSO4) { + ifp->if_capabilities |= IFCAP_TSO4; + ifp->if_hwassist |= CSUM_IP_TSO; + } + if (sc->hn_caps & HN_CAP_TSO6) { + ifp->if_capabilities |= IFCAP_TSO6; + ifp->if_hwassist |= CSUM_IP6_TSO; + } + + /* Enable all available capabilities by default. */ + ifp->if_capenable = ifp->if_capabilities; + + if (ifp->if_capabilities & (IFCAP_TSO6 | IFCAP_TSO4)) { + hn_set_tso_maxsize(sc, hn_tso_maxlen, ETHERMTU); + ifp->if_hw_tsomaxsegcount = HN_TX_DATA_SEGCNT_MAX; + ifp->if_hw_tsomaxsegsize = PAGE_SIZE; + } + + ether_ifattach(ifp, eaddr); + + if ((ifp->if_capabilities & (IFCAP_TSO6 | IFCAP_TSO4)) && bootverbose) { + if_printf(ifp, "TSO segcnt %u segsz %u\n", + ifp->if_hw_tsomaxsegcount, ifp->if_hw_tsomaxsegsize); + } + + /* Inform the upper layer about the long frame support. */ + ifp->if_hdrlen = sizeof(struct ether_vlan_header); + + /* + * Kick off link status check. + */ + sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; + hn_update_link_status(sc); + + return (0); +failed: + if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) + hn_synth_detach(sc); + hn_detach(dev); + return (error); +} + +static int +hn_detach(device_t dev) +{ + struct hn_softc *sc = device_get_softc(dev); + struct ifnet *ifp = sc->hn_ifp; + + if (device_is_attached(dev)) { + HN_LOCK(sc); + if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Nov 11 07:33:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F87BC3ADE2; Fri, 11 Nov 2016 07:33:45 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 196861703; Fri, 11 Nov 2016 07:33:45 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB7XiSI090875; Fri, 11 Nov 2016 07:33:44 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB7XiD6090874; Fri, 11 Nov 2016 07:33:44 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110733.uAB7XiD6090874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 07:33:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308512 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 07:33:45 -0000 Author: sephe Date: Fri Nov 11 07:33:44 2016 New Revision: 308512 URL: https://svnweb.freebsd.org/changeset/base/308512 Log: MFC 308164 hyperv/hn: Regroup if_start related functions. And put them under HN_IFSTART_SUPPORT, which is by default on until we whack the if_start related bits from base system. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8392 Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hn.c Fri Nov 11 07:25:14 2016 (r308511) +++ stable/10/sys/dev/hyperv/netvsc/if_hn.c Fri Nov 11 07:33:44 2016 (r308512) @@ -111,6 +111,8 @@ __FBSDID("$FreeBSD$"); #include "vmbus_if.h" +#define HN_IFSTART_SUPPORT + #define HN_RING_CNT_DEF_MAX 8 /* YYY should get it from the underlying channel */ @@ -212,7 +214,9 @@ static void hn_chan_callback(struct vm static void hn_init(void *); static int hn_ioctl(struct ifnet *, u_long, caddr_t); +#ifdef HN_IFSTART_SUPPORT static void hn_start(struct ifnet *); +#endif static int hn_transmit(struct ifnet *, struct mbuf *); static void hn_xmit_qflush(struct ifnet *); static int hn_ifmedia_upd(struct ifnet *); @@ -326,10 +330,12 @@ static int hn_xmit(struct hn_tx_ring * static void hn_xmit_taskfunc(void *, int); static void hn_xmit_txeof(struct hn_tx_ring *); static void hn_xmit_txeof_taskfunc(void *, int); +#ifdef HN_IFSTART_SUPPORT static int hn_start_locked(struct hn_tx_ring *, int); static void hn_start_taskfunc(void *, int); static void hn_start_txeof(struct hn_tx_ring *); static void hn_start_txeof_taskfunc(void *, int); +#endif SYSCTL_NODE(_hw, OID_AUTO, hn, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Hyper-V network interface"); @@ -397,10 +403,12 @@ static int hn_bind_tx_taskq = -1; SYSCTL_INT(_hw_hn, OID_AUTO, bind_tx_taskq, CTLFLAG_RDTUN, &hn_bind_tx_taskq, 0, "Bind TX taskqueue to the specified cpu"); +#ifdef HN_IFSTART_SUPPORT /* Use ifnet.if_start instead of ifnet.if_transmit */ static int hn_use_if_start = 0; SYSCTL_INT(_hw_hn, OID_AUTO, use_if_start, CTLFLAG_RDTUN, &hn_use_if_start, 0, "Use if_start TX method"); +#endif /* # of channels to use */ static int hn_chan_cnt = 0; @@ -790,10 +798,12 @@ hn_attach(device_t dev) tx_ring_cnt = hn_tx_ring_cnt; if (tx_ring_cnt <= 0 || tx_ring_cnt > ring_cnt) tx_ring_cnt = ring_cnt; +#ifdef HN_IFSTART_SUPPORT if (hn_use_if_start) { /* ifnet.if_start only needs one TX ring. */ tx_ring_cnt = 1; } +#endif /* * Set the leader CPU for channels. @@ -894,6 +904,7 @@ hn_attach(device_t dev) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; ifp->if_init = hn_init; +#ifdef HN_IFSTART_SUPPORT if (hn_use_if_start) { int qdepth = hn_get_txswq_depth(&sc->hn_tx_ring[0]); @@ -901,7 +912,9 @@ hn_attach(device_t dev) IFQ_SET_MAXLEN(&ifp->if_snd, qdepth); ifp->if_snd.ifq_drv_maxlen = qdepth - 1; IFQ_SET_READY(&ifp->if_snd); - } else { + } else +#endif + { ifp->if_transmit = hn_transmit; ifp->if_qflush = hn_xmit_qflush; } @@ -1536,7 +1549,10 @@ again: if (!error) { ETHER_BPF_MTAP(ifp, txd->m); if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); - if (!hn_use_if_start) { +#ifdef HN_IFSTART_SUPPORT + if (!hn_use_if_start) +#endif + { if_inc_counter(ifp, IFCOUNTER_OBYTES, txd->m->m_pkthdr.len); if (txd->m->m_flags & M_MCAST) @@ -1586,71 +1602,6 @@ again: } /* - * Start a transmit of one or more packets - */ -static int -hn_start_locked(struct hn_tx_ring *txr, int len) -{ - struct hn_softc *sc = txr->hn_sc; - struct ifnet *ifp = sc->hn_ifp; - - KASSERT(hn_use_if_start, - ("hn_start_locked is called, when if_start is disabled")); - KASSERT(txr == &sc->hn_tx_ring[0], ("not the first TX ring")); - mtx_assert(&txr->hn_tx_lock, MA_OWNED); - - if (__predict_false(txr->hn_suspended)) - return 0; - - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING) - return 0; - - while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { - struct hn_txdesc *txd; - struct mbuf *m_head; - int error; - - IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); - if (m_head == NULL) - break; - - if (len > 0 && m_head->m_pkthdr.len > len) { - /* - * This sending could be time consuming; let callers - * dispatch this packet sending (and sending of any - * following up packets) to tx taskqueue. - */ - IFQ_DRV_PREPEND(&ifp->if_snd, m_head); - return 1; - } - - txd = hn_txdesc_get(txr); - if (txd == NULL) { - txr->hn_no_txdescs++; - IFQ_DRV_PREPEND(&ifp->if_snd, m_head); - atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); - break; - } - - error = hn_encap(txr, txd, &m_head); - if (error) { - /* Both txd and m_head are freed */ - continue; - } - - error = hn_txpkt(ifp, txr, txd); - if (__predict_false(error)) { - /* txd is freed, but m_head is not */ - IFQ_DRV_PREPEND(&ifp->if_snd, m_head); - atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); - break; - } - } - return 0; -} - -/* * Append the specified data to the indicated mbuf chain, * Extend the mbuf chain if the new data does not fit in * existing space. @@ -2153,61 +2104,6 @@ hn_stop(struct hn_softc *sc) } static void -hn_start(struct ifnet *ifp) -{ - struct hn_softc *sc = ifp->if_softc; - struct hn_tx_ring *txr = &sc->hn_tx_ring[0]; - - if (txr->hn_sched_tx) - goto do_sched; - - if (mtx_trylock(&txr->hn_tx_lock)) { - int sched; - - sched = hn_start_locked(txr, txr->hn_direct_tx_size); - mtx_unlock(&txr->hn_tx_lock); - if (!sched) - return; - } -do_sched: - taskqueue_enqueue(txr->hn_tx_taskq, &txr->hn_tx_task); -} - -static void -hn_start_txeof(struct hn_tx_ring *txr) -{ - struct hn_softc *sc = txr->hn_sc; - struct ifnet *ifp = sc->hn_ifp; - - KASSERT(txr == &sc->hn_tx_ring[0], ("not the first TX ring")); - - if (txr->hn_sched_tx) - goto do_sched; - - if (mtx_trylock(&txr->hn_tx_lock)) { - int sched; - - atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); - sched = hn_start_locked(txr, txr->hn_direct_tx_size); - mtx_unlock(&txr->hn_tx_lock); - if (sched) { - taskqueue_enqueue(txr->hn_tx_taskq, - &txr->hn_tx_task); - } - } else { -do_sched: - /* - * Release the OACTIVE earlier, with the hope, that - * others could catch up. The task will clear the - * flag again with the hn_tx_lock to avoid possible - * races. - */ - atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); - taskqueue_enqueue(txr->hn_tx_taskq, &txr->hn_txeof_task); - } -} - -static void hn_init_locked(struct hn_softc *sc) { struct ifnet *ifp = sc->hn_ifp; @@ -2954,11 +2850,14 @@ hn_tx_ring_create(struct hn_softc *sc, i txr->hn_tx_taskq = sc->hn_tx_taskq; +#ifdef HN_IFSTART_SUPPORT if (hn_use_if_start) { txr->hn_txeof = hn_start_txeof; TASK_INIT(&txr->hn_tx_task, 0, hn_start_taskfunc, txr); TASK_INIT(&txr->hn_txeof_task, 0, hn_start_txeof_taskfunc, txr); - } else { + } else +#endif + { int br_depth; txr->hn_txeof = hn_xmit_txeof; @@ -3095,7 +2994,10 @@ hn_tx_ring_create(struct hn_softc *sc, i SYSCTL_ADD_INT(ctx, child, OID_AUTO, "txdesc_avail", CTLFLAG_RD, &txr->hn_txdesc_avail, 0, "# of available TX descs"); - if (!hn_use_if_start) { +#ifdef HN_IFSTART_SUPPORT + if (!hn_use_if_start) +#endif + { SYSCTL_ADD_INT(ctx, child, OID_AUTO, "oactive", CTLFLAG_RD, &txr->hn_oactive, 0, "over active"); @@ -3355,6 +3257,8 @@ hn_destroy_tx_data(struct hn_softc *sc) sc->hn_tx_ring_inuse = 0; } +#ifdef HN_IFSTART_SUPPORT + static void hn_start_taskfunc(void *xtxr, int pending __unused) { @@ -3365,6 +3269,89 @@ hn_start_taskfunc(void *xtxr, int pendin mtx_unlock(&txr->hn_tx_lock); } +static int +hn_start_locked(struct hn_tx_ring *txr, int len) +{ + struct hn_softc *sc = txr->hn_sc; + struct ifnet *ifp = sc->hn_ifp; + + KASSERT(hn_use_if_start, + ("hn_start_locked is called, when if_start is disabled")); + KASSERT(txr == &sc->hn_tx_ring[0], ("not the first TX ring")); + mtx_assert(&txr->hn_tx_lock, MA_OWNED); + + if (__predict_false(txr->hn_suspended)) + return 0; + + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) + return 0; + + while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { + struct hn_txdesc *txd; + struct mbuf *m_head; + int error; + + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); + if (m_head == NULL) + break; + + if (len > 0 && m_head->m_pkthdr.len > len) { + /* + * This sending could be time consuming; let callers + * dispatch this packet sending (and sending of any + * following up packets) to tx taskqueue. + */ + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + return 1; + } + + txd = hn_txdesc_get(txr); + if (txd == NULL) { + txr->hn_no_txdescs++; + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); + break; + } + + error = hn_encap(txr, txd, &m_head); + if (error) { + /* Both txd and m_head are freed */ + continue; + } + + error = hn_txpkt(ifp, txr, txd); + if (__predict_false(error)) { + /* txd is freed, but m_head is not */ + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); + break; + } + } + return 0; +} + +static void +hn_start(struct ifnet *ifp) +{ + struct hn_softc *sc = ifp->if_softc; + struct hn_tx_ring *txr = &sc->hn_tx_ring[0]; + + if (txr->hn_sched_tx) + goto do_sched; + + if (mtx_trylock(&txr->hn_tx_lock)) { + int sched; + + sched = hn_start_locked(txr, txr->hn_direct_tx_size); + mtx_unlock(&txr->hn_tx_lock); + if (!sched) + return; + } +do_sched: + taskqueue_enqueue(txr->hn_tx_taskq, &txr->hn_tx_task); +} + static void hn_start_txeof_taskfunc(void *xtxr, int pending __unused) { @@ -3376,6 +3363,42 @@ hn_start_txeof_taskfunc(void *xtxr, int mtx_unlock(&txr->hn_tx_lock); } +static void +hn_start_txeof(struct hn_tx_ring *txr) +{ + struct hn_softc *sc = txr->hn_sc; + struct ifnet *ifp = sc->hn_ifp; + + KASSERT(txr == &sc->hn_tx_ring[0], ("not the first TX ring")); + + if (txr->hn_sched_tx) + goto do_sched; + + if (mtx_trylock(&txr->hn_tx_lock)) { + int sched; + + atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); + sched = hn_start_locked(txr, txr->hn_direct_tx_size); + mtx_unlock(&txr->hn_tx_lock); + if (sched) { + taskqueue_enqueue(txr->hn_tx_taskq, + &txr->hn_tx_task); + } + } else { +do_sched: + /* + * Release the OACTIVE earlier, with the hope, that + * others could catch up. The task will clear the + * flag again with the hn_tx_lock to avoid possible + * races. + */ + atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); + taskqueue_enqueue(txr->hn_tx_taskq, &txr->hn_txeof_task); + } +} + +#endif /* HN_IFSTART_SUPPORT */ + static int hn_xmit(struct hn_tx_ring *txr, int len) { @@ -3384,8 +3407,10 @@ hn_xmit(struct hn_tx_ring *txr, int len) struct mbuf *m_head; mtx_assert(&txr->hn_tx_lock, MA_OWNED); +#ifdef HN_IFSTART_SUPPORT KASSERT(hn_use_if_start == 0, ("hn_xmit is called, when if_start is enabled")); +#endif if (__predict_false(txr->hn_suspended)) return 0; @@ -4082,7 +4107,10 @@ hn_resume_data(struct hn_softc *sc) */ hn_resume_tx(sc, sc->hn_tx_ring_cnt); - if (!hn_use_if_start) { +#ifdef HN_IFSTART_SUPPORT + if (!hn_use_if_start) +#endif + { /* * Flush unused drbrs, since hn_tx_ring_inuse may be * reduced. From owner-svn-src-all@freebsd.org Fri Nov 11 07:41:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC800C3AFD2; Fri, 11 Nov 2016 07:41:39 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6EA1B1AC6; Fri, 11 Nov 2016 07:41:39 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB7fcXN092543; Fri, 11 Nov 2016 07:41:38 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB7fcFf092542; Fri, 11 Nov 2016 07:41:38 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110741.uAB7fcFf092542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 07:41:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308513 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 07:41:39 -0000 Author: sephe Date: Fri Nov 11 07:41:38 2016 New Revision: 308513 URL: https://svnweb.freebsd.org/changeset/base/308513 Log: MFC 308166,308167 308166 hyperv/hn: Move TSO packet fixup to an earlier place for if_transmit. While TSO packet header may be still cache-hot. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8393 308167 hyperv/hn: Directly fill chimney sending buffer for small packets. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8394 Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hn.c Fri Nov 11 07:33:44 2016 (r308512) +++ stable/10/sys/dev/hyperv/netvsc/if_hn.c Fri Nov 11 07:41:38 2016 (r308513) @@ -550,6 +550,80 @@ hn_chim_free(struct hn_softc *sc, uint32 atomic_clear_long(&sc->hn_chim_bmap[idx], mask); } +#if defined(INET6) || defined(INET) +/* + * NOTE: If this function failed, the m_head would be freed. + */ +static __inline struct mbuf * +hn_tso_fixup(struct mbuf *m_head) +{ + struct ether_vlan_header *evl; + struct tcphdr *th; + int ehlen; + + KASSERT(M_WRITABLE(m_head), ("TSO mbuf not writable")); + +#define PULLUP_HDR(m, len) \ +do { \ + if (__predict_false((m)->m_len < (len))) { \ + (m) = m_pullup((m), (len)); \ + if ((m) == NULL) \ + return (NULL); \ + } \ +} while (0) + + PULLUP_HDR(m_head, sizeof(*evl)); + evl = mtod(m_head, struct ether_vlan_header *); + if (evl->evl_encap_proto == ntohs(ETHERTYPE_VLAN)) + ehlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + else + ehlen = ETHER_HDR_LEN; + +#ifdef INET + if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) { + struct ip *ip; + int iphlen; + + PULLUP_HDR(m_head, ehlen + sizeof(*ip)); + ip = mtodo(m_head, ehlen); + iphlen = ip->ip_hl << 2; + + PULLUP_HDR(m_head, ehlen + iphlen + sizeof(*th)); + th = mtodo(m_head, ehlen + iphlen); + + ip->ip_len = 0; + ip->ip_sum = 0; + th->th_sum = in_pseudo(ip->ip_src.s_addr, + ip->ip_dst.s_addr, htons(IPPROTO_TCP)); + } +#endif +#if defined(INET6) && defined(INET) + else +#endif +#ifdef INET6 + { + struct ip6_hdr *ip6; + + PULLUP_HDR(m_head, ehlen + sizeof(*ip6)); + ip6 = mtodo(m_head, ehlen); + if (ip6->ip6_nxt != IPPROTO_TCP) { + m_freem(m_head); + return (NULL); + } + + PULLUP_HDR(m_head, ehlen + sizeof(*ip6) + sizeof(*th)); + th = mtodo(m_head, ehlen + sizeof(*ip6)); + + ip6->ip6_plen = 0; + th->th_sum = in6_cksum_pseudo(ip6, 0, IPPROTO_TCP, 0); + } +#endif + return (m_head); + +#undef PULLUP_HDR +} +#endif /* INET6 || INET */ + static int hn_set_rxfilter(struct hn_softc *sc) { @@ -1348,15 +1422,28 @@ hn_encap(struct hn_tx_ring *txr, struct struct mbuf *m_head = *m_head0; struct rndis_packet_msg *pkt; uint32_t *pi_data; + void *chim = NULL; int pktlen; - /* - * extension points to the area reserved for the - * rndis_filter_packet, which is placed just after - * the netvsc_packet (and rppi struct, if present; - * length is updated later). - */ pkt = txd->rndis_pkt; + if (m_head->m_pkthdr.len + HN_RNDIS_PKT_LEN < txr->hn_chim_size) { + /* + * This packet is small enough to fit into a chimney sending + * buffer. Try allocating one chimney sending buffer now. + */ + txr->hn_tx_chimney_tried++; + txd->chim_index = hn_chim_alloc(txr->hn_sc); + if (txd->chim_index != HN_NVS_CHIM_IDX_INVALID) { + chim = txr->hn_sc->hn_chim + + (txd->chim_index * txr->hn_sc->hn_chim_szmax); + /* + * Directly fill the chimney sending buffer w/ the + * RNDIS packet message. + */ + pkt = chim; + } + } + pkt->rm_type = REMOTE_NDIS_PACKET_MSG; pkt->rm_len = sizeof(*pkt) + m_head->m_pkthdr.len; pkt->rm_dataoffset = sizeof(*pkt); @@ -1386,32 +1473,10 @@ hn_encap(struct hn_tx_ring *txr, struct if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { #if defined(INET6) || defined(INET) - struct ether_vlan_header *eh; - int ether_len; - - /* - * XXX need m_pullup and use mtodo - */ - eh = mtod(m_head, struct ether_vlan_header*); - if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) - ether_len = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; - else - ether_len = ETHER_HDR_LEN; - pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, NDIS_LSO2_INFO_SIZE, NDIS_PKTINFO_TYPE_LSO); #ifdef INET if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) { - struct ip *ip = - (struct ip *)(m_head->m_data + ether_len); - unsigned long iph_len = ip->ip_hl << 2; - struct tcphdr *th = - (struct tcphdr *)((caddr_t)ip + iph_len); - - ip->ip_len = 0; - ip->ip_sum = 0; - th->th_sum = in_pseudo(ip->ip_src.s_addr, - ip->ip_dst.s_addr, htons(IPPROTO_TCP)); *pi_data = NDIS_LSO2_INFO_MAKEIPV4(0, m_head->m_pkthdr.tso_segsz); } @@ -1421,12 +1486,6 @@ hn_encap(struct hn_tx_ring *txr, struct #endif #ifdef INET6 { - struct ip6_hdr *ip6 = (struct ip6_hdr *) - (m_head->m_data + ether_len); - struct tcphdr *th = (struct tcphdr *)(ip6 + 1); - - ip6->ip6_plen = 0; - th->th_sum = in6_cksum_pseudo(ip6, 0, IPPROTO_TCP, 0); *pi_data = NDIS_LSO2_INFO_MAKEIPV6(0, m_head->m_pkthdr.tso_segsz); } @@ -1457,26 +1516,25 @@ hn_encap(struct hn_tx_ring *txr, struct pkt->rm_pktinfooffset = hn_rndis_pktmsg_offset(pkt->rm_pktinfooffset); /* - * Chimney send, if the packet could fit into one chimney buffer. + * Fast path: Chimney sending. */ - if (pkt->rm_len < txr->hn_chim_size) { - txr->hn_tx_chimney_tried++; - txd->chim_index = hn_chim_alloc(txr->hn_sc); - if (txd->chim_index != HN_NVS_CHIM_IDX_INVALID) { - uint8_t *dest = txr->hn_sc->hn_chim + - (txd->chim_index * txr->hn_sc->hn_chim_szmax); - - memcpy(dest, pkt, pktlen); - dest += pktlen; - m_copydata(m_head, 0, m_head->m_pkthdr.len, dest); - - txd->chim_size = pkt->rm_len; - txr->hn_gpa_cnt = 0; - txr->hn_tx_chimney++; - txr->hn_sendpkt = hn_txpkt_chim; - goto done; - } - } + if (chim != NULL) { + KASSERT(txd->chim_index != HN_NVS_CHIM_IDX_INVALID, + ("chimney buffer is not used")); + KASSERT(pkt == chim, ("RNDIS pkt not in chimney buffer")); + + m_copydata(m_head, 0, m_head->m_pkthdr.len, + ((uint8_t *)chim) + pktlen); + + txd->chim_size = pkt->rm_len; + txr->hn_gpa_cnt = 0; + txr->hn_tx_chimney++; + txr->hn_sendpkt = hn_txpkt_chim; + goto done; + } + KASSERT(txd->chim_index == HN_NVS_CHIM_IDX_INVALID, + ("chimney buffer is used")); + KASSERT(pkt == txd->rndis_pkt, ("RNDIS pkt not in txdesc")); error = hn_txdesc_dmamap_load(txr, txd, &m_head, segs, &nsegs); if (error) { @@ -3306,6 +3364,16 @@ hn_start_locked(struct hn_tx_ring *txr, return 1; } +#if defined(INET6) || defined(INET) + if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + m_head = hn_tso_fixup(m_head); + if (__predict_false(m_head == NULL)) { + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + continue; + } + } +#endif + txd = hn_txdesc_get(txr); if (txd == NULL) { txr->hn_no_txdescs++; @@ -3468,6 +3536,20 @@ hn_transmit(struct ifnet *ifp, struct mb struct hn_tx_ring *txr; int error, idx = 0; +#if defined(INET6) || defined(INET) + /* + * Perform TSO packet header fixup now, since the TSO + * packet header should be cache-hot. + */ + if (m->m_pkthdr.csum_flags & CSUM_TSO) { + m = hn_tso_fixup(m); + if (__predict_false(m == NULL)) { + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + return EIO; + } + } +#endif + /* * Select the TX ring based on flowid */ From owner-svn-src-all@freebsd.org Fri Nov 11 07:45:05 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 004D7C3B075; Fri, 11 Nov 2016 07:45:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7D941D54; Fri, 11 Nov 2016 07:45:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB7j3sI094787; Fri, 11 Nov 2016 07:45:03 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB7j3na094786; Fri, 11 Nov 2016 07:45:03 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110745.uAB7j3na094786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 07:45:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308514 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 07:45:05 -0000 Author: sephe Date: Fri Nov 11 07:45:03 2016 New Revision: 308514 URL: https://svnweb.freebsd.org/changeset/base/308514 Log: MFC 308168 hyperv/vmbus: Avoid extra header copy. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8395 Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Nov 11 07:41:38 2016 (r308513) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Nov 11 07:45:03 2016 (r308514) @@ -926,28 +926,28 @@ vmbus_chan_recv(struct vmbus_channel *ch int vmbus_chan_recv_pkt(struct vmbus_channel *chan, - struct vmbus_chanpkt_hdr *pkt0, int *pktlen0) + struct vmbus_chanpkt_hdr *pkt, int *pktlen0) { - struct vmbus_chanpkt_hdr pkt; - int error, pktlen; + int error, pktlen, pkt_hlen; - error = vmbus_rxbr_peek(&chan->ch_rxbr, &pkt, sizeof(pkt)); + pkt_hlen = sizeof(*pkt); + error = vmbus_rxbr_peek(&chan->ch_rxbr, pkt, pkt_hlen); if (error) return (error); - if (__predict_false(pkt.cph_hlen < VMBUS_CHANPKT_HLEN_MIN)) { - vmbus_chan_printf(chan, "invalid hlen %u\n", pkt.cph_hlen); + if (__predict_false(pkt->cph_hlen < VMBUS_CHANPKT_HLEN_MIN)) { + vmbus_chan_printf(chan, "invalid hlen %u\n", pkt->cph_hlen); /* XXX this channel is dead actually. */ return (EIO); } - if (__predict_false(pkt.cph_hlen > pkt.cph_tlen)) { + if (__predict_false(pkt->cph_hlen > pkt->cph_tlen)) { vmbus_chan_printf(chan, "invalid hlen %u and tlen %u\n", - pkt.cph_hlen, pkt.cph_tlen); + pkt->cph_hlen, pkt->cph_tlen); /* XXX this channel is dead actually. */ return (EIO); } - pktlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen); + pktlen = VMBUS_CHANPKT_GETLEN(pkt->cph_tlen); if (*pktlen0 < pktlen) { /* Return the size of this packet. */ *pktlen0 = pktlen; @@ -955,8 +955,12 @@ vmbus_chan_recv_pkt(struct vmbus_channel } *pktlen0 = pktlen; - /* Include packet header */ - error = vmbus_rxbr_read(&chan->ch_rxbr, pkt0, pktlen, 0); + /* + * Skip the fixed-size packet header, which has been filled + * by the above vmbus_rxbr_peek(). + */ + error = vmbus_rxbr_read(&chan->ch_rxbr, pkt + 1, + pktlen - pkt_hlen, pkt_hlen); KASSERT(!error, ("vmbus_rxbr_read failed")); return (0); From owner-svn-src-all@freebsd.org Fri Nov 11 07:52:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C185DC3B2E4; Fri, 11 Nov 2016 07:52:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9093C1250; Fri, 11 Nov 2016 07:52:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB7qTuj098945; Fri, 11 Nov 2016 07:52:29 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB7qTUv098941; Fri, 11 Nov 2016 07:52:29 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110752.uAB7qTUv098941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 07:52:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308515 - in stable/10/sys/dev/hyperv: include vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 07:52:30 -0000 Author: sephe Date: Fri Nov 11 07:52:29 2016 New Revision: 308515 URL: https://svnweb.freebsd.org/changeset/base/308515 Log: MFC 308194 hyperv: GC unused functions. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8406 Modified: stable/10/sys/dev/hyperv/include/hyperv.h stable/10/sys/dev/hyperv/include/vmbus.h stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/10/sys/dev/hyperv/include/hyperv.h Fri Nov 11 07:45:03 2016 (r308514) +++ stable/10/sys/dev/hyperv/include/hyperv.h Fri Nov 11 07:52:29 2016 (r308515) @@ -44,15 +44,4 @@ struct hyperv_guid { int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); -/** - * @brief Get physical address from virtual - */ -static inline unsigned long -hv_get_phys_addr(void *virt) -{ - unsigned long ret; - ret = (vtophys(virt) | ((vm_offset_t) virt & PAGE_MASK)); - return (ret); -} - #endif /* _HYPERV_H_ */ Modified: stable/10/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/10/sys/dev/hyperv/include/vmbus.h Fri Nov 11 07:45:03 2016 (r308514) +++ stable/10/sys/dev/hyperv/include/vmbus.h Fri Nov 11 07:52:29 2016 (r308515) @@ -147,8 +147,6 @@ int vmbus_chan_gpadl_disconnect(struct void vmbus_chan_cpu_set(struct vmbus_channel *chan, int cpu); void vmbus_chan_cpu_rr(struct vmbus_channel *chan); -struct vmbus_channel * - vmbus_chan_cpu2chan(struct vmbus_channel *chan, int cpu); void vmbus_chan_set_readbatch(struct vmbus_channel *chan, bool on); struct vmbus_channel ** Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Nov 11 07:45:03 2016 (r308514) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Nov 11 07:52:29 2016 (r308515) @@ -1534,65 +1534,6 @@ vmbus_chan_destroy_all(struct vmbus_soft } } -/* - * The channel whose vcpu binding is closest to the currect vcpu will - * be selected. - * If no multi-channel, always select primary channel. - */ -struct vmbus_channel * -vmbus_chan_cpu2chan(struct vmbus_channel *prichan, int cpu) -{ - struct vmbus_channel *sel, *chan; - uint32_t vcpu, sel_dist; - - KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpuid %d", cpu)); - if (TAILQ_EMPTY(&prichan->ch_subchans)) - return prichan; - - vcpu = VMBUS_PCPU_GET(prichan->ch_vmbus, vcpuid, cpu); - -#define CHAN_VCPU_DIST(ch, vcpu) \ - (((ch)->ch_vcpuid > (vcpu)) ? \ - ((ch)->ch_vcpuid - (vcpu)) : ((vcpu) - (ch)->ch_vcpuid)) - -#define CHAN_SELECT(ch) \ -do { \ - sel = ch; \ - sel_dist = CHAN_VCPU_DIST(ch, vcpu); \ -} while (0) - - CHAN_SELECT(prichan); - - mtx_lock(&prichan->ch_subchan_lock); - TAILQ_FOREACH(chan, &prichan->ch_subchans, ch_sublink) { - uint32_t dist; - - KASSERT(chan->ch_stflags & VMBUS_CHAN_ST_OPENED, - ("chan%u is not opened", chan->ch_id)); - - if (chan->ch_vcpuid == vcpu) { - /* Exact match; done */ - CHAN_SELECT(chan); - break; - } - - dist = CHAN_VCPU_DIST(chan, vcpu); - if (sel_dist <= dist) { - /* Far or same distance; skip */ - continue; - } - - /* Select the closer channel. */ - CHAN_SELECT(chan); - } - mtx_unlock(&prichan->ch_subchan_lock); - -#undef CHAN_SELECT -#undef CHAN_VCPU_DIST - - return sel; -} - struct vmbus_channel ** vmbus_subchan_get(struct vmbus_channel *pri_chan, int subchan_cnt) { From owner-svn-src-all@freebsd.org Fri Nov 11 08:04:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26ABAC3B6D7; Fri, 11 Nov 2016 08:04:26 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5EA01738; Fri, 11 Nov 2016 08:04:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB84Pxg003885; Fri, 11 Nov 2016 08:04:25 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB84O3e003881; Fri, 11 Nov 2016 08:04:24 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110804.uAB84O3e003881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 08:04:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308516 - in stable/10: contrib/hyperv/tools sys/dev/hyperv/utilities X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 08:04:26 -0000 Author: sephe Date: Fri Nov 11 08:04:24 2016 New Revision: 308516 URL: https://svnweb.freebsd.org/changeset/base/308516 Log: MFC 308201 hyperv/kvp: Don't mix message status codes and function return values. While I'm here, move message status codes to hv_utilreg.h, since they will be used by the upcoming VSS stuffs. Submitted by: Hongjiang Zhang Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8391 Modified: stable/10/contrib/hyperv/tools/hv_kvp_daemon.c stable/10/sys/dev/hyperv/utilities/hv_kvp.c stable/10/sys/dev/hyperv/utilities/hv_kvp.h stable/10/sys/dev/hyperv/utilities/hv_utilreg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/hyperv/tools/hv_kvp_daemon.c ============================================================================== --- stable/10/contrib/hyperv/tools/hv_kvp_daemon.c Fri Nov 11 07:52:29 2016 (r308515) +++ stable/10/contrib/hyperv/tools/hv_kvp_daemon.c Fri Nov 11 08:04:24 2016 (r308516) @@ -52,9 +52,10 @@ #include #include #include +#include #include "hv_kvp.h" - +#include "hv_utilreg.h" typedef uint8_t __u8; typedef uint16_t __u16; typedef uint32_t __u32; @@ -684,18 +685,16 @@ kvp_get_ipconfig_info(char *if_name, str */ kvp_process_ipconfig_file(cmd, (char *)buffer->gate_way, (MAX_GATEWAY_SIZE * 2), INET_ADDRSTRLEN, 0); - /* * Retrieve the IPV6 address of default gateway. */ - snprintf(cmd, sizeof(cmd), "netstat -rn inet6 | grep %s | awk '/default/ {print $2 }", if_name); + snprintf(cmd, sizeof(cmd), "netstat -rn inet6 | grep %s | awk '/default/ {print $2 }'", if_name); /* * Execute the command to gather gateway IPV6 info. */ kvp_process_ipconfig_file(cmd, (char *)buffer->gate_way, (MAX_GATEWAY_SIZE * 2), INET6_ADDRSTRLEN, 1); - /* * we just invoke an external script to get the DNS info. * @@ -782,11 +781,11 @@ kvp_process_ip_address(void *addrp, } if ((length - *offset) < addr_length + 1) { - return (HV_KVP_E_FAIL); + return (EINVAL); } if (str == NULL) { strlcpy(buffer, "inet_ntop failed\n", length); - return (HV_KVP_E_FAIL); + return (errno); } if (*offset == 0) { strlcpy(buffer, tmp, length); @@ -832,7 +831,7 @@ kvp_get_ip_info(int family, char *if_nam if (getifaddrs(&ifap)) { strlcpy(buffer, "getifaddrs failed\n", buffer_length); - return (HV_KVP_E_FAIL); + return (errno); } curp = ifap; @@ -924,7 +923,6 @@ kvp_get_ip_info(int family, char *if_nam /* * Collect other ip configuration info. */ - kvp_get_ipconfig_info(if_name, ip_buffer); } @@ -954,7 +952,7 @@ kvp_write_file(FILE *f, const char *s1, ret = fprintf(f, "%s%s%s%s\n", s1, s2, "=", s3); if (ret < 0) { - return (HV_KVP_E_FAIL); + return (EIO); } return (0); @@ -979,7 +977,7 @@ kvp_set_ip_info(char *if_name, struct hv if (file == NULL) { KVP_LOG(LOG_ERR, "FreeBSD Failed to open config file\n"); - return (HV_KVP_E_FAIL); + return (errno); } /* @@ -988,7 +986,7 @@ kvp_set_ip_info(char *if_name, struct hv mac_addr = kvp_if_name_to_mac(if_name); if (mac_addr == NULL) { - error = HV_KVP_E_FAIL; + error = EINVAL; goto kvp_set_ip_info_error; } /* MAC Address */ @@ -1091,28 +1089,30 @@ kvp_op_getipinfo(struct hv_kvp_msg *op_m { struct hv_kvp_ipaddr_value *ip_val; char *if_name; + int error = 0; assert(op_msg != NULL); KVP_LOG(LOG_DEBUG, "In kvp_op_getipinfo.\n"); ip_val = &op_msg->body.kvp_ip_val; - op_msg->hdr.error = HV_KVP_S_OK; + op_msg->hdr.error = HV_S_OK; if_name = kvp_mac_to_if_name((char *)ip_val->adapter_id); if (if_name == NULL) { /* No interface found with the mac address. */ - op_msg->hdr.error = HV_KVP_E_FAIL; + op_msg->hdr.error = HV_E_FAIL; goto kvp_op_getipinfo_done; } - op_msg->hdr.error = kvp_get_ip_info(0, if_name, + error = kvp_get_ip_info(0, if_name, HV_KVP_OP_GET_IP_INFO, ip_val, (MAX_IP_ADDR_SIZE * 2)); - + if (error) + op_msg->hdr.error = HV_E_FAIL; free(if_name); kvp_op_getipinfo_done: - return(op_msg->hdr.error); + return (error); } @@ -1121,25 +1121,27 @@ kvp_op_setipinfo(struct hv_kvp_msg *op_m { struct hv_kvp_ipaddr_value *ip_val; char *if_name; + int error = 0; assert(op_msg != NULL); KVP_LOG(LOG_DEBUG, "In kvp_op_setipinfo.\n"); ip_val = &op_msg->body.kvp_ip_val; - op_msg->hdr.error = HV_KVP_S_OK; + op_msg->hdr.error = HV_S_OK; if_name = (char *)ip_val->adapter_id; if (if_name == NULL) { /* No adapter provided. */ - op_msg->hdr.error = HV_KVP_GUID_NOTFOUND; + op_msg->hdr.error = HV_GUID_NOTFOUND; goto kvp_op_setipinfo_done; } - op_msg->hdr.error = kvp_set_ip_info(if_name, ip_val); - + error = kvp_set_ip_info(if_name, ip_val); + if (error) + op_msg->hdr.error = HV_E_FAIL; kvp_op_setipinfo_done: - return(op_msg->hdr.error); + return (error); } @@ -1154,7 +1156,7 @@ kvp_op_setgetdel(struct hv_kvp_msg *op_m assert(op_hdlr != NULL); op_pool = op_msg->hdr.kvp_hdr.pool; - op_msg->hdr.error = HV_KVP_S_OK; + op_msg->hdr.error = HV_S_OK; switch(op_hdlr->kvp_op_key) { case HV_KVP_OP_SET: @@ -1198,8 +1200,7 @@ kvp_op_setgetdel(struct hv_kvp_msg *op_m } if (error != 0) - op_msg->hdr.error = HV_KVP_S_CONT; - + op_msg->hdr.error = HV_S_CONT; return(error); } @@ -1216,7 +1217,7 @@ kvp_op_enumerate(struct hv_kvp_msg *op_m op = op_msg->hdr.kvp_hdr.operation; op_pool = op_msg->hdr.kvp_hdr.pool; - op_msg->hdr.error = HV_KVP_S_OK; + op_msg->hdr.error = HV_S_OK; /* * If the pool is not HV_KVP_POOL_AUTO, read from the appropriate @@ -1229,7 +1230,7 @@ kvp_op_enumerate(struct hv_kvp_msg *op_m HV_KVP_EXCHANGE_MAX_KEY_SIZE, op_msg->body.kvp_enum_data.data.msg_value.value, HV_KVP_EXCHANGE_MAX_VALUE_SIZE)) { - op_msg->hdr.error = HV_KVP_S_CONT; + op_msg->hdr.error = HV_S_CONT; error = -1; } goto kvp_op_enumerate_done; @@ -1298,12 +1299,14 @@ kvp_op_enumerate(struct hv_kvp_msg *op_m KVP_LOG(LOG_ERR, "Auto pool Index %d not found.\n", op_msg->body.kvp_enum_data.index); #endif - op_msg->hdr.error = HV_KVP_S_CONT; + op_msg->hdr.error = HV_S_CONT; error = -1; break; } kvp_op_enumerate_done: + if (error != 0) + op_msg->hdr.error = HV_S_CONT; return(error); } @@ -1496,10 +1499,13 @@ main(int argc, char *argv[]) */ error = kvp_op_hdlrs[op].kvp_op_exec(hv_msg, (void *)&kvp_op_hdlrs[op]); - if (error != 0 && hv_msg->hdr.error != HV_KVP_S_CONT) - KVP_LOG(LOG_WARNING, - "Operation failed OP = %d, error = 0x%x\n", - op, error); + if (error != 0) { + assert(hv_msg->hdr.error != HV_S_OK); + if (hv_msg->hdr.error != HV_S_CONT) + KVP_LOG(LOG_WARNING, + "Operation failed OP = %d, error = 0x%x\n", + op, error); + } } /* Modified: stable/10/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_kvp.c Fri Nov 11 07:52:29 2016 (r308515) +++ stable/10/sys/dev/hyperv/utilities/hv_kvp.c Fri Nov 11 08:04:24 2016 (r308516) @@ -72,8 +72,6 @@ __FBSDID("$FreeBSD$"); /* hv_kvp defines */ #define BUFFERSIZE sizeof(struct hv_kvp_msg) -#define KVP_SUCCESS 0 -#define KVP_ERROR 1 #define kvp_hdr hdr.kvp_hdr #define KVP_FWVER_MAJOR 3 @@ -480,7 +478,7 @@ hv_kvp_convert_usermsg_to_hostmsg(struct case HV_KVP_OP_SET_IP_INFO: case HV_KVP_OP_SET: case HV_KVP_OP_DELETE: - return (KVP_SUCCESS); + return (0); case HV_KVP_OP_ENUMERATE: host_exchg_data = &hmsg->body.kvp_enum_data.data; @@ -501,9 +499,9 @@ hv_kvp_convert_usermsg_to_hostmsg(struct host_exchg_data->value_type = HV_REG_SZ; if ((hkey_len < 0) || (hvalue_len < 0)) - return (HV_KVP_E_FAIL); + return (EINVAL); - return (KVP_SUCCESS); + return (0); case HV_KVP_OP_GET: host_exchg_data = &hmsg->body.kvp_get.data; @@ -519,12 +517,12 @@ hv_kvp_convert_usermsg_to_hostmsg(struct host_exchg_data->value_type = HV_REG_SZ; if ((hkey_len < 0) || (hvalue_len < 0)) - return (HV_KVP_E_FAIL); + return (EINVAL); - return (KVP_SUCCESS); + return (0); default: - return (HV_KVP_E_FAIL); + return (EINVAL); } } @@ -533,16 +531,13 @@ hv_kvp_convert_usermsg_to_hostmsg(struct * Send the response back to the host. */ static void -hv_kvp_respond_host(hv_kvp_sc *sc, int error) +hv_kvp_respond_host(hv_kvp_sc *sc, uint32_t error) { struct hv_vmbus_icmsg_hdr *hv_icmsg_hdrp; hv_icmsg_hdrp = (struct hv_vmbus_icmsg_hdr *) &sc->rcv_buf[sizeof(struct hv_vmbus_pipe_hdr)]; - if (error) - error = HV_KVP_E_FAIL; - hv_icmsg_hdrp->status = error; hv_icmsg_hdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | HV_ICMSGHDRFLAG_RESPONSE; @@ -612,8 +607,10 @@ hv_kvp_process_request(void *context, in error = vmbus_ic_negomsg(&sc->util_sc, kvp_buf, &recvlen, KVP_FWVER, KVP_MSGVER); /* XXX handle vmbus_ic_negomsg failure. */ - hv_kvp_respond_host(sc, error); - + if (!error) + hv_kvp_respond_host(sc, HV_S_OK); + else + hv_kvp_respond_host(sc, HV_E_FAIL); /* * It is ok to not acquire the mutex before setting * req_in_progress here because negotiation is the @@ -657,7 +654,7 @@ hv_kvp_process_request(void *context, in */ if (hv_kvp_req_in_progress(sc)) { hv_kvp_log_info("%s: request was still active after wait so failing\n", __func__); - hv_kvp_respond_host(sc, HV_KVP_E_FAIL); + hv_kvp_respond_host(sc, HV_E_FAIL); sc->req_in_progress = false; } @@ -737,9 +734,9 @@ hv_kvp_dev_daemon_read(struct cdev *dev, struct hv_kvp_msg *hv_kvp_dev_buf; hv_kvp_sc *sc = (hv_kvp_sc*)dev->si_drv1; - /* Check hv_kvp daemon registration status*/ + /* Read is not allowed util registering is done. */ if (!sc->register_done) - return (KVP_ERROR); + return (EPERM); sema_wait(&sc->dev_sema); @@ -789,7 +786,7 @@ hv_kvp_dev_daemon_write(struct cdev *dev } else { hv_kvp_log_info("%s, KVP Registration Failed\n", __func__); - return (KVP_ERROR); + return (EINVAL); } } else { @@ -799,10 +796,15 @@ hv_kvp_dev_daemon_write(struct cdev *dev struct hv_kvp_msg *hmsg = sc->host_kvp_msg; struct hv_kvp_msg *umsg = &sc->daemon_kvp_msg; - hv_kvp_convert_usermsg_to_hostmsg(umsg, hmsg); - hv_kvp_respond_host(sc, KVP_SUCCESS); + error = hv_kvp_convert_usermsg_to_hostmsg(umsg, hmsg); + hv_kvp_respond_host(sc, umsg->hdr.error); wakeup(sc); sc->req_in_progress = false; + if (umsg->hdr.error != HV_S_OK) + hv_kvp_log_info("%s, Error 0x%x from daemon\n", + __func__, umsg->hdr.error); + if (error) + hv_kvp_log_info("%s, Error from convert\n", __func__); } sc->daemon_busy = false; @@ -865,7 +867,7 @@ hv_kvp_attach(device_t dev) child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); SYSCTL_ADD_INT(ctx, child, OID_AUTO, "hv_kvp_log", - CTLFLAG_RW, &hv_kvp_log, 0, "Hyperv KVP service log level"); + CTLFLAG_RWTUN, &hv_kvp_log, 0, "Hyperv KVP service log level"); TASK_INIT(&sc->task, 0, hv_kvp_process_request, sc); Modified: stable/10/sys/dev/hyperv/utilities/hv_kvp.h ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_kvp.h Fri Nov 11 07:52:29 2016 (r308515) +++ stable/10/sys/dev/hyperv/utilities/hv_kvp.h Fri Nov 11 08:04:24 2016 (r308516) @@ -144,19 +144,6 @@ enum hv_kvp_exchg_pool { HV_KVP_POOL_COUNT /* Number of pools, must be last. */ }; - -/* - * Some Hyper-V status codes. - */ -#define HV_KVP_S_OK 0x00000000 -#define HV_KVP_E_FAIL 0x80004005 -#define HV_KVP_S_CONT 0x80070103 -#define HV_ERROR_NOT_SUPPORTED 0x80070032 -#define HV_ERROR_MACHINE_LOCKED 0x800704F7 -#define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F -#define HV_INVALIDARG 0x80070057 -#define HV_KVP_GUID_NOTFOUND 0x80041002 - #define ADDR_FAMILY_NONE 0x00 #define ADDR_FAMILY_IPV4 0x01 #define ADDR_FAMILY_IPV6 0x02 Modified: stable/10/sys/dev/hyperv/utilities/hv_utilreg.h ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_utilreg.h Fri Nov 11 07:52:29 2016 (r308515) +++ stable/10/sys/dev/hyperv/utilities/hv_utilreg.h Fri Nov 11 08:04:24 2016 (r308516) @@ -29,10 +29,17 @@ #ifndef _HV_UTILREG_H_ #define _HV_UTILREG_H_ -#define HV_S_OK 0x00000000 -#define HV_E_FAIL 0x80004005 -#define HV_ERROR_NOT_SUPPORTED 0x80070032 -#define HV_ERROR_MACHINE_LOCKED 0x800704F7 +/* + * Some Hyper-V status codes. + */ +#define HV_S_OK 0x00000000 +#define HV_E_FAIL 0x80004005 +#define HV_S_CONT 0x80070103 +#define HV_ERROR_NOT_SUPPORTED 0x80070032 +#define HV_ERROR_MACHINE_LOCKED 0x800704F7 +#define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F +#define HV_INVALIDARG 0x80070057 +#define HV_GUID_NOTFOUND 0x80041002 /* * Common defines for Hyper-V ICs From owner-svn-src-all@freebsd.org Fri Nov 11 08:43:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 035F7C3A642; Fri, 11 Nov 2016 08:43:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C61B31F0F; Fri, 11 Nov 2016 08:43:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB8hYQ4019916; Fri, 11 Nov 2016 08:43:34 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB8hYJE019914; Fri, 11 Nov 2016 08:43:34 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110843.uAB8hYJE019914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 08:43:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308517 - in stable/11/sys/dev/hyperv: include vmbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 08:43:36 -0000 Author: sephe Date: Fri Nov 11 08:43:34 2016 New Revision: 308517 URL: https://svnweb.freebsd.org/changeset/base/308517 Log: MFC 307624 hyperv/vmbus: Expose channel management taskqueue for driver to use. MFC after: 3 days Sponsored by: Microsoft Modified: stable/11/sys/dev/hyperv/include/vmbus.h stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/11/sys/dev/hyperv/include/vmbus.h Fri Nov 11 08:04:24 2016 (r308516) +++ stable/11/sys/dev/hyperv/include/vmbus.h Fri Nov 11 08:43:34 2016 (r308517) @@ -118,6 +118,7 @@ struct vmbus_chan_br { struct vmbus_channel; struct hyperv_guid; struct task; +struct taskqueue; typedef void (*vmbus_chan_callback_t)(struct vmbus_channel *, void *); @@ -179,5 +180,7 @@ int vmbus_chan_prplist_nelem(int br_siz int dlen_max); bool vmbus_chan_rx_empty(const struct vmbus_channel *chan); bool vmbus_chan_tx_empty(const struct vmbus_channel *chan); +struct taskqueue * + vmbus_chan_mgmt_tq(const struct vmbus_channel *chan); #endif /* !_VMBUS_H_ */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Nov 11 08:04:24 2016 (r308516) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Nov 11 08:43:34 2016 (r308517) @@ -1721,3 +1721,10 @@ vmbus_chan_run_task(struct vmbus_channel taskqueue_enqueue(chan->ch_tq, task); taskqueue_drain(chan->ch_tq, task); } + +struct taskqueue * +vmbus_chan_mgmt_tq(const struct vmbus_channel *chan) +{ + + return (chan->ch_mgmt_tq); +} From owner-svn-src-all@freebsd.org Fri Nov 11 08:49:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FF8FC3A743; Fri, 11 Nov 2016 08:49:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E29410D9; Fri, 11 Nov 2016 08:49:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB8nTCb020210; Fri, 11 Nov 2016 08:49:29 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB8nSfY020202; Fri, 11 Nov 2016 08:49:28 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110849.uAB8nSfY020202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 08:49:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308518 - in stable/11/sys: dev/hyperv/netvsc net X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 08:49:30 -0000 Author: sephe Date: Fri Nov 11 08:49:28 2016 New Revision: 308518 URL: https://svnweb.freebsd.org/changeset/base/308518 Log: MFC 307710-307712,307714 307710 hyperv/hn: Always query RSS capabilities. - This avoid distributing NDIS version check. - Only NDIS 6.20 required (earlier NDIS uses different indirect table format). Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8291 307711 hyperv/hn: Check NVS version for HASHVAL pktinfo on sending path. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8293 307712 hyperv/hn: Add network change support. Currently the network change is simulated by link status changes. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8295 307714 hyperv/hn: Function renaming; consistent w/ hardware capabilities query. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8296 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/if_hnreg.h stable/11/sys/dev/hyperv/netvsc/if_hnvar.h stable/11/sys/dev/hyperv/netvsc/ndis.h stable/11/sys/net/rndis.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Nov 11 08:43:34 2016 (r308517) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Nov 11 08:49:28 2016 (r308518) @@ -544,8 +544,9 @@ hn_nvs_init(struct hn_softc *sc) if (error) { if_printf(sc->hn_ifp, "reinit NVS version 0x%x " "failed: %d\n", sc->hn_nvs_ver, error); + return (error); } - return (error); + goto done; } /* @@ -567,11 +568,16 @@ hn_nvs_init(struct hn_softc *sc) HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver), HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver)); } - return (0); + goto done; } } if_printf(sc->hn_ifp, "no NVS available\n"); return (ENXIO); + +done: + if (sc->hn_nvs_ver >= HN_NVS_VERSION_5) + sc->hn_caps |= HN_CAP_HASHVAL; + return (0); } int Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 08:43:34 2016 (r308517) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 08:49:28 2016 (r308518) @@ -207,7 +207,6 @@ struct hn_softc { struct ifnet *hn_ifp; struct ifmedia hn_media; device_t hn_dev; - int hn_carrier; int hn_if_flags; struct sx hn_lock; struct vmbus_channel *hn_prichan; @@ -236,6 +235,9 @@ struct hn_softc { struct taskqueue *hn_mgmt_taskq; struct taskqueue *hn_mgmt_taskq0; struct task hn_link_task; + struct task hn_netchg_init; + struct timeout_task hn_netchg_status; + uint32_t hn_link_flags; /* HN_LINK_FLAG_ */ uint32_t hn_caps; /* HN_CAP_ */ uint32_t hn_flags; /* HN_FLAG_ */ @@ -269,6 +271,10 @@ struct hn_softc { #define HN_CAP_UDP6CS 0x0040 #define HN_CAP_TSO4 0x0080 #define HN_CAP_TSO6 0x0100 +#define HN_CAP_HASHVAL 0x0200 + +#define HN_LINK_FLAG_LINKUP 0x0001 +#define HN_LINK_FLAG_NETCHG 0x0002 /* * Externs Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 08:43:34 2016 (r308517) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 08:49:28 2016 (r308518) @@ -335,6 +335,8 @@ static void hn_destroy_tx_data(struct hn static void hn_start_taskfunc(void *, int); static void hn_start_txeof_taskfunc(void *, int); static void hn_link_taskfunc(void *, int); +static void hn_netchg_init_taskfunc(void *, int); +static void hn_netchg_status_taskfunc(void *, int); static void hn_suspend_mgmt_taskfunc(void *, int); static int hn_encap(struct hn_tx_ring *, struct hn_txdesc *, struct mbuf **); static int hn_create_rx_data(struct hn_softc *sc, int); @@ -360,6 +362,7 @@ static void hn_rx_drain(struct vmbus_cha static void hn_tx_resume(struct hn_softc *, int); static void hn_tx_ring_qflush(struct hn_tx_ring *); static int netvsc_detach(device_t dev); +static void hn_link_status(struct hn_softc *); static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt); @@ -482,7 +485,7 @@ hn_ifmedia_sts(struct ifnet *ifp, struct ifmr->ifm_status = IFM_AVALID; ifmr->ifm_active = IFM_ETHER; - if (!sc->hn_carrier) { + if ((sc->hn_link_flags & HN_LINK_FLAG_LINKUP) == 0) { ifmr->ifm_active |= IFM_NONE; return; } @@ -563,6 +566,9 @@ netvsc_attach(device_t dev) taskqueue_start_threads(&sc->hn_mgmt_taskq0, 1, PI_NET, "%s mgmt", device_get_nameunit(dev)); TASK_INIT(&sc->hn_link_task, 0, hn_link_taskfunc, sc); + TASK_INIT(&sc->hn_netchg_init, 0, hn_netchg_init_taskfunc, sc); + TIMEOUT_TASK_INIT(sc->hn_mgmt_taskq0, &sc->hn_netchg_status, 0, + hn_netchg_status_taskfunc, sc); /* * Allocate ifnet and setup its name earlier, so that if_printf @@ -808,10 +814,8 @@ netvsc_shutdown(device_t dev) } static void -hn_link_taskfunc(void *xsc, int pending __unused) +hn_link_status(struct hn_softc *sc) { - struct hn_softc *sc = xsc; - struct ifnet *ifp = sc->hn_ifp; uint32_t link_status; int error; @@ -822,11 +826,51 @@ hn_link_taskfunc(void *xsc, int pending } if (link_status == NDIS_MEDIA_STATE_CONNECTED) - sc->hn_carrier = 1; + sc->hn_link_flags |= HN_LINK_FLAG_LINKUP; else - sc->hn_carrier = 0; - if_link_state_change(ifp, - sc->hn_carrier ? LINK_STATE_UP : LINK_STATE_DOWN); + sc->hn_link_flags &= ~HN_LINK_FLAG_LINKUP; + if_link_state_change(sc->hn_ifp, + (sc->hn_link_flags & HN_LINK_FLAG_LINKUP) ? + LINK_STATE_UP : LINK_STATE_DOWN); +} + +static void +hn_link_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + + if (sc->hn_link_flags & HN_LINK_FLAG_NETCHG) + return; + hn_link_status(sc); +} + +static void +hn_netchg_init_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + + /* Prevent any link status checks from running. */ + sc->hn_link_flags |= HN_LINK_FLAG_NETCHG; + + /* + * Fake up a [link down --> link up] state change; 5 seconds + * delay is used, which closely simulates miibus reaction + * upon link down event. + */ + sc->hn_link_flags &= ~HN_LINK_FLAG_LINKUP; + if_link_state_change(sc->hn_ifp, LINK_STATE_DOWN); + taskqueue_enqueue_timeout(sc->hn_mgmt_taskq0, + &sc->hn_netchg_status, 5 * hz); +} + +static void +hn_netchg_status_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + + /* Re-allow link status checks. */ + sc->hn_link_flags &= ~HN_LINK_FLAG_NETCHG; + hn_link_status(sc); } void @@ -837,6 +881,14 @@ hn_link_status_update(struct hn_softc *s taskqueue_enqueue(sc->hn_mgmt_taskq, &sc->hn_link_task); } +void +hn_network_change(struct hn_softc *sc) +{ + + if (sc->hn_mgmt_taskq != NULL) + taskqueue_enqueue(sc->hn_mgmt_taskq, &sc->hn_netchg_init); +} + static __inline int hn_txdesc_dmamap_load(struct hn_tx_ring *txr, struct hn_txdesc *txd, struct mbuf **m_head, bus_dma_segment_t *segs, int *nsegs) @@ -2233,7 +2285,8 @@ hn_caps_sysctl(SYSCTL_HANDLER_ARGS) "\006UDP4CS" "\007UDP6CS" "\010TSO4" - "\011TSO6"); + "\011TSO6" + "\012HASHVAL"); return sysctl_handle_string(oidp, caps_str, sizeof(caps_str), req); } @@ -3008,12 +3061,15 @@ hn_fixup_tx_data(struct hn_softc *sc) if (sc->hn_caps & HN_CAP_UDP6CS) csum_assist |= CSUM_IP6_UDP; #endif - for (i = 0; i < sc->hn_tx_ring_cnt; ++i) sc->hn_tx_ring[i].hn_csum_assist = csum_assist; - if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30) { - /* Support HASHVAL pktinfo on TX path. */ + if (sc->hn_caps & HN_CAP_HASHVAL) { + /* + * Support HASHVAL pktinfo on TX path. + */ + if (bootverbose) + if_printf(sc->hn_ifp, "support HASHVAL pktinfo\n"); for (i = 0; i < sc->hn_tx_ring_cnt; ++i) sc->hn_tx_ring[i].hn_tx_flags |= HN_TX_FLAG_HASHVAL; } @@ -3408,20 +3464,19 @@ hn_synth_alloc_subchans(struct hn_softc int nchan, rxr_cnt, error; nchan = *nsubch + 1; - if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30 || nchan == 1) { + if (nchan == 1) { /* - * Either RSS is not supported, or multiple RX/TX rings - * are not requested. + * Multiple RX/TX rings are not requested. */ *nsubch = 0; return (0); } /* - * Get RSS capabilities, e.g. # of RX rings, and # of indirect + * Query RSS capabilities, e.g. # of RX rings, and # of indirect * table entries. */ - error = hn_rndis_get_rsscaps(sc, &rxr_cnt); + error = hn_rndis_query_rsscaps(sc, &rxr_cnt); if (error) { /* No RSS; this is benign. */ *nsubch = 0; @@ -3716,6 +3771,8 @@ hn_suspend_mgmt(struct hn_softc *sc) /* * Make sure that all pending management tasks are completed. */ + taskqueue_drain(sc->hn_mgmt_taskq0, &sc->hn_netchg_init); + taskqueue_drain_timeout(sc->hn_mgmt_taskq0, &sc->hn_netchg_status); taskqueue_drain_all(sc->hn_mgmt_taskq0); } @@ -3793,10 +3850,11 @@ hn_resume_mgmt(struct hn_softc *sc) { /* - * Kick off link status check. + * Kick off network change detection, which will + * do link status check too. */ sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; - hn_link_status_update(sc); + hn_network_change(sc); } static void Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 08:43:34 2016 (r308517) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 08:49:28 2016 (r308518) @@ -158,6 +158,7 @@ static void hv_rf_receive_indicate_status(struct hn_softc *sc, const void *data, int dlen) { const struct rndis_status_msg *msg; + int ofs; if (dlen < sizeof(*msg)) { if_printf(sc->hn_ifp, "invalid RNDIS status\n"); @@ -176,8 +177,19 @@ hv_rf_receive_indicate_status(struct hn_ break; case RNDIS_STATUS_NETWORK_CHANGE: - /* TODO */ - if_printf(sc->hn_ifp, "network changed\n"); + ofs = RNDIS_STBUFOFFSET_ABS(msg->rm_stbufoffset); + if (dlen < ofs + msg->rm_stbuflen || + msg->rm_stbuflen < sizeof(uint32_t)) { + if_printf(sc->hn_ifp, "network changed\n"); + } else { + uint32_t change; + + memcpy(&change, ((const uint8_t *)msg) + ofs, + sizeof(change)); + if_printf(sc->hn_ifp, "network changed, change %u\n", + change); + } + hn_network_change(sc); break; default: @@ -736,7 +748,7 @@ done: } int -hn_rndis_get_rsscaps(struct hn_softc *sc, int *rxr_cnt) +hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt) { struct ndis_rss_caps in, caps; size_t caps_len; @@ -744,15 +756,13 @@ hn_rndis_get_rsscaps(struct hn_softc *sc *rxr_cnt = 0; + if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_20) + return (EOPNOTSUPP); + memset(&in, 0, sizeof(in)); in.ndis_hdr.ndis_type = NDIS_OBJTYPE_RSS_CAPS; - if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30) { - in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_1; - in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE_6_0; - } else { - in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_2; - in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE; - } + in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_2; + in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE; caps_len = NDIS_RSS_CAPS_SIZE; error = hn_rndis_query2(sc, OID_GEN_RECEIVE_SCALE_CAPABILITIES, @@ -1027,10 +1037,12 @@ hn_rndis_conf_rss(struct hn_softc *sc, u int error; /* - * Only NDIS 6.30+ is supported. + * Only NDIS 6.20+ is supported: + * We only support 4bytes element in indirect table, which has been + * adopted since NDIS 6.20. */ - KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30, - ("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); + KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_20, + ("NDIS 6.20+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); /* * NOTE: Modified: stable/11/sys/dev/hyperv/netvsc/if_hnreg.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnreg.h Fri Nov 11 08:43:34 2016 (r308517) +++ stable/11/sys/dev/hyperv/netvsc/if_hnreg.h Fri Nov 11 08:49:28 2016 (r308518) @@ -36,6 +36,7 @@ * NDIS protocol version numbers */ #define HN_NDIS_VERSION_6_1 0x00060001 +#define HN_NDIS_VERSION_6_20 0x00060014 #define HN_NDIS_VERSION_6_30 0x0006001e #define HN_NDIS_VERSION_MAJOR(ver) (((ver) & 0xffff0000) >> 16) #define HN_NDIS_VERSION_MINOR(ver) ((ver) & 0xffff) Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 08:43:34 2016 (r308517) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 08:49:28 2016 (r308518) @@ -122,7 +122,7 @@ void hn_rndis_detach(struct hn_softc *s int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); void *hn_rndis_pktinfo_append(struct rndis_packet_msg *, size_t pktsize, size_t pi_dlen, uint32_t pi_type); -int hn_rndis_get_rsscaps(struct hn_softc *sc, int *rxr_cnt); +int hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt); int hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr); int hn_rndis_get_linkstatus(struct hn_softc *sc, uint32_t *link_status); @@ -139,6 +139,7 @@ int hn_rxpkt(struct hn_rx_ring *rxr, co const struct hn_recvinfo *info); void hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); void hn_link_status_update(struct hn_softc *sc); +void hn_network_change(struct hn_softc *sc); extern struct hn_send_ctx hn_send_ctx_none; Modified: stable/11/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/ndis.h Fri Nov 11 08:43:34 2016 (r308517) +++ stable/11/sys/dev/hyperv/netvsc/ndis.h Fri Nov 11 08:49:28 2016 (r308518) @@ -32,6 +32,10 @@ #define NDIS_MEDIA_STATE_CONNECTED 0 #define NDIS_MEDIA_STATE_DISCONNECTED 1 +#define NDIS_NETCHANGE_TYPE_POSSIBLE 1 +#define NDIS_NETCHANGE_TYPE_DEFINITE 2 +#define NDIS_NETCHANGE_TYPE_FROMMEDIA 3 + #define NDIS_OFFLOAD_SET_NOCHG 0 #define NDIS_OFFLOAD_SET_ON 1 #define NDIS_OFFLOAD_SET_OFF 2 Modified: stable/11/sys/net/rndis.h ============================================================================== --- stable/11/sys/net/rndis.h Fri Nov 11 08:43:34 2016 (r308517) +++ stable/11/sys/net/rndis.h Fri Nov 11 08:49:28 2016 (r308518) @@ -320,6 +320,10 @@ struct rndis_status_msg { /* rndis_diag_info */ }; +/* stbuf offset from the beginning of rndis_status_msg. */ +#define RNDIS_STBUFOFFSET_ABS(ofs) \ + ((ofs) + __offsetof(struct rndis_status_msg, rm_status)) + /* * Immediately after rndis_status_msg.rm_stbufoffset, if a control * message is malformatted, or a packet message contains inappropriate From owner-svn-src-all@freebsd.org Fri Nov 11 08:52:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BB91C3A8FE; Fri, 11 Nov 2016 08:52:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8435152F; Fri, 11 Nov 2016 08:52:24 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB8qOD5023788; Fri, 11 Nov 2016 08:52:24 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB8qNF3023772; Fri, 11 Nov 2016 08:52:23 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110852.uAB8qNF3023772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 08:52:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308519 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 08:52:25 -0000 Author: sephe Date: Fri Nov 11 08:52:23 2016 New Revision: 308519 URL: https://svnweb.freebsd.org/changeset/base/308519 Log: MFC 307838,307839 307838 hyperv/hn: Move chimney buffer index and size to txdesc. All RNDIS control messages have used SG list for a while. This makes the send context suitable for further refactoring. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8308 307839 hyperv/hn: Fix chimney sending buffer leakage upon NVS sending failure. This will not happen in real world, since TX consumption of the vmbus TX bufring is limitted. Better safe than sorry. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8309 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Nov 11 08:49:28 2016 (r308518) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Nov 11 08:52:23 2016 (r308519) @@ -117,7 +117,7 @@ hn_nvs_xact_execute(struct hn_softc *sc, /* * Execute the xact setup by the caller. */ - hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); + hn_send_ctx_init(&sndc, hn_nvs_sent_xact, xact); vmbus_xact_activate(xact); error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, @@ -669,34 +669,6 @@ hn_chim_free(struct hn_softc *sc, uint32 atomic_clear_long(&sc->hn_chim_bmap[idx], mask); } -/* - * Net VSC on send - * Sends a packet on the specified Hyper-V device. - * Returns 0 on success, non-zero on failure. - */ -int -hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, - struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) -{ - struct hn_nvs_rndis rndis; - int ret; - - rndis.nvs_type = HN_NVS_TYPE_RNDIS; - rndis.nvs_rndis_mtype = rndis_mtype; - rndis.nvs_chim_idx = sndc->hn_chim_idx; - rndis.nvs_chim_sz = sndc->hn_chim_sz; - - if (gpa_cnt) { - ret = hn_nvs_send_sglist(chan, gpa, gpa_cnt, - &rndis, sizeof(rndis), sndc); - } else { - ret = hn_nvs_send(chan, VMBUS_CHANPKT_FLAG_RC, - &rndis, sizeof(rndis), sndc); - } - - return (ret); -} - int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch0) { Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 08:49:28 2016 (r308518) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 08:52:23 2016 (r308519) @@ -104,8 +104,8 @@ struct vmbus_channel; #define HN_XACT_REQ_SIZE (HN_XACT_REQ_PGCNT * PAGE_SIZE) #define HN_XACT_RESP_SIZE (HN_XACT_RESP_PGCNT * PAGE_SIZE) -#ifndef HN_USE_TXDESC_BUFRING struct hn_txdesc; +#ifndef HN_USE_TXDESC_BUFRING SLIST_HEAD(hn_txdesc_list, hn_txdesc); #else struct buf_ring; @@ -179,6 +179,7 @@ struct hn_tx_ring { bus_dma_tag_t hn_tx_data_dtag; uint64_t hn_csum_assist; + int (*hn_sendpkt)(struct hn_tx_ring *, struct hn_txdesc *); int hn_suspended; int hn_gpa_cnt; struct vmbus_gpa hn_gpa[NETVSC_PACKET_MAXPAGE]; @@ -276,13 +277,5 @@ struct hn_softc { #define HN_LINK_FLAG_LINKUP 0x0001 #define HN_LINK_FLAG_NETCHG 0x0002 -/* - * Externs - */ -struct hn_send_ctx; - -int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, - struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); - #endif /* __HV_NET_VSC_H__ */ Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 08:49:28 2016 (r308518) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 08:52:23 2016 (r308519) @@ -169,6 +169,8 @@ struct hn_txdesc { int refs; uint32_t flags; /* HN_TXD_FLAG_ */ struct hn_send_ctx send_ctx; + uint32_t chim_index; + int chim_size; bus_dmamap_t data_dmap; @@ -363,6 +365,8 @@ static void hn_tx_resume(struct hn_softc static void hn_tx_ring_qflush(struct hn_tx_ring *); static int netvsc_detach(device_t dev); static void hn_link_status(struct hn_softc *); +static int hn_sendpkt_rndis_sglist(struct hn_tx_ring *, struct hn_txdesc *); +static int hn_sendpkt_rndis_chim(struct hn_tx_ring *, struct hn_txdesc *); static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt); @@ -399,6 +403,57 @@ hn_set_lro_lenlim(struct hn_softc *sc, i } #endif +static __inline int +hn_nvs_send_rndis_sglist1(struct vmbus_channel *chan, uint32_t rndis_mtype, + struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) +{ + struct hn_nvs_rndis rndis; + + rndis.nvs_type = HN_NVS_TYPE_RNDIS; + rndis.nvs_rndis_mtype = rndis_mtype; + rndis.nvs_chim_idx = HN_NVS_CHIM_IDX_INVALID; + rndis.nvs_chim_sz = 0; + + return (hn_nvs_send_sglist(chan, gpa, gpa_cnt, + &rndis, sizeof(rndis), sndc)); +} + +int +hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, + struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) +{ + + return hn_nvs_send_rndis_sglist1(chan, HN_NVS_RNDIS_MTYPE_CTRL, + sndc, gpa, gpa_cnt); +} + +static int +hn_sendpkt_rndis_sglist(struct hn_tx_ring *txr, struct hn_txdesc *txd) +{ + + KASSERT(txd->chim_index == HN_NVS_CHIM_IDX_INVALID && + txd->chim_size == 0, ("invalid rndis sglist txd")); + return (hn_nvs_send_rndis_sglist1(txr->hn_chan, HN_NVS_RNDIS_MTYPE_DATA, + &txd->send_ctx, txr->hn_gpa, txr->hn_gpa_cnt)); +} + +static int +hn_sendpkt_rndis_chim(struct hn_tx_ring *txr, struct hn_txdesc *txd) +{ + struct hn_nvs_rndis rndis; + + KASSERT(txd->chim_index != HN_NVS_CHIM_IDX_INVALID && + txd->chim_size > 0, ("invalid rndis chim txd")); + + rndis.nvs_type = HN_NVS_TYPE_RNDIS; + rndis.nvs_rndis_mtype = HN_NVS_RNDIS_MTYPE_DATA; + rndis.nvs_chim_idx = txd->chim_index; + rndis.nvs_chim_sz = txd->chim_size; + + return (hn_nvs_send(txr->hn_chan, VMBUS_CHANPKT_FLAG_RC, + &rndis, sizeof(rndis), &txd->send_ctx)); +} + static int hn_get_txswq_depth(const struct hn_tx_ring *txr) { @@ -896,6 +951,8 @@ hn_txdesc_dmamap_load(struct hn_tx_ring struct mbuf *m = *m_head; int error; + KASSERT(txd->chim_index == HN_NVS_CHIM_IDX_INVALID, ("txd uses chim")); + error = bus_dmamap_load_mbuf_sg(txr->hn_tx_data_dtag, txd->data_dmap, m, segs, nsegs, BUS_DMA_NOWAIT); if (error == EFBIG) { @@ -919,19 +976,6 @@ hn_txdesc_dmamap_load(struct hn_tx_ring return error; } -static __inline void -hn_txdesc_dmamap_unload(struct hn_tx_ring *txr, struct hn_txdesc *txd) -{ - - if (txd->flags & HN_TXD_FLAG_DMAMAP) { - bus_dmamap_sync(txr->hn_tx_data_dtag, - txd->data_dmap, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(txr->hn_tx_data_dtag, - txd->data_dmap); - txd->flags &= ~HN_TXD_FLAG_DMAMAP; - } -} - static __inline int hn_txdesc_put(struct hn_tx_ring *txr, struct hn_txdesc *txd) { @@ -943,14 +987,25 @@ hn_txdesc_put(struct hn_tx_ring *txr, st if (atomic_fetchadd_int(&txd->refs, -1) != 1) return 0; - hn_txdesc_dmamap_unload(txr, txd); + if (txd->chim_index != HN_NVS_CHIM_IDX_INVALID) { + KASSERT((txd->flags & HN_TXD_FLAG_DMAMAP) == 0, + ("chim txd uses dmamap")); + hn_chim_free(txr->hn_sc, txd->chim_index); + txd->chim_index = HN_NVS_CHIM_IDX_INVALID; + } else if (txd->flags & HN_TXD_FLAG_DMAMAP) { + bus_dmamap_sync(txr->hn_tx_data_dtag, + txd->data_dmap, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(txr->hn_tx_data_dtag, + txd->data_dmap); + txd->flags &= ~HN_TXD_FLAG_DMAMAP; + } + if (txd->m != NULL) { m_freem(txd->m); txd->m = NULL; } txd->flags |= HN_TXD_FLAG_ONLIST; - #ifndef HN_USE_TXDESC_BUFRING mtx_lock_spin(&txr->hn_txlist_spin); KASSERT(txr->hn_txdesc_avail >= 0 && @@ -991,7 +1046,9 @@ hn_txdesc_get(struct hn_tx_ring *txr) atomic_subtract_int(&txr->hn_txdesc_avail, 1); #endif KASSERT(txd->m == NULL && txd->refs == 0 && - (txd->flags & HN_TXD_FLAG_ONLIST), ("invalid txd")); + txd->chim_index == HN_NVS_CHIM_IDX_INVALID && + (txd->flags & HN_TXD_FLAG_ONLIST) && + (txd->flags & HN_TXD_FLAG_DMAMAP) == 0, ("invalid txd")); txd->flags &= ~HN_TXD_FLAG_ONLIST; txd->refs = 1; } @@ -1038,9 +1095,6 @@ hn_tx_done(struct hn_send_ctx *sndc, str struct hn_txdesc *txd = sndc->hn_cbarg; struct hn_tx_ring *txr; - if (sndc->hn_chim_idx != HN_NVS_CHIM_IDX_INVALID) - hn_chim_free(sc, sndc->hn_chim_idx); - txr = txd->txr; KASSERT(txr->hn_chan == chan, ("channel mismatch, on chan%u, should be chan%u", @@ -1096,9 +1150,8 @@ hn_encap(struct hn_tx_ring *txr, struct int error, nsegs, i; struct mbuf *m_head = *m_head0; struct rndis_packet_msg *pkt; - uint32_t send_buf_section_idx; - int send_buf_section_size, pktlen; uint32_t *pi_data; + int pktlen; /* * extension points to the area reserved for the @@ -1211,18 +1264,19 @@ hn_encap(struct hn_tx_ring *txr, struct */ if (pkt->rm_len < txr->hn_chim_size) { txr->hn_tx_chimney_tried++; - send_buf_section_idx = hn_chim_alloc(txr->hn_sc); - if (send_buf_section_idx != HN_NVS_CHIM_IDX_INVALID) { + txd->chim_index = hn_chim_alloc(txr->hn_sc); + if (txd->chim_index != HN_NVS_CHIM_IDX_INVALID) { uint8_t *dest = txr->hn_sc->hn_chim + - (send_buf_section_idx * txr->hn_sc->hn_chim_szmax); + (txd->chim_index * txr->hn_sc->hn_chim_szmax); memcpy(dest, pkt, pktlen); dest += pktlen; m_copydata(m_head, 0, m_head->m_pkthdr.len, dest); - send_buf_section_size = pkt->rm_len; + txd->chim_size = pkt->rm_len; txr->hn_gpa_cnt = 0; txr->hn_tx_chimney++; + txr->hn_sendpkt = hn_sendpkt_rndis_chim; goto done; } } @@ -1267,14 +1321,14 @@ hn_encap(struct hn_tx_ring *txr, struct gpa->gpa_len = segs[i].ds_len; } - send_buf_section_idx = HN_NVS_CHIM_IDX_INVALID; - send_buf_section_size = 0; + txd->chim_index = HN_NVS_CHIM_IDX_INVALID; + txd->chim_size = 0; + txr->hn_sendpkt = hn_sendpkt_rndis_sglist; done: txd->m = m_head; /* Set the completion routine */ - hn_send_ctx_init(&txd->send_ctx, hn_tx_done, txd, - send_buf_section_idx, send_buf_section_size); + hn_send_ctx_init(&txd->send_ctx, hn_tx_done, txd); return 0; } @@ -1294,8 +1348,7 @@ again: * Make sure that txd is not freed before ETHER_BPF_MTAP. */ hn_txdesc_hold(txd); - error = hv_nv_on_send(txr->hn_chan, HN_NVS_RNDIS_MTYPE_DATA, - &txd->send_ctx, txr->hn_gpa, txr->hn_gpa_cnt); + error = txr->hn_sendpkt(txr, txd); if (!error) { ETHER_BPF_MTAP(ifp, txd->m); if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); @@ -2766,6 +2819,7 @@ hn_create_tx_ring(struct hn_softc *sc, i struct hn_txdesc *txd = &txr->hn_txdesc[i]; txd->txr = txr; + txd->chim_index = HN_NVS_CHIM_IDX_INVALID; /* * Allocate and load RNDIS packet message. Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 08:49:28 2016 (r308518) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Nov 11 08:52:23 2016 (r308519) @@ -585,8 +585,7 @@ hn_rndis_xact_exec1(struct hn_softc *sc, * message. */ vmbus_xact_activate(xact); - error = hv_nv_on_send(sc->hn_prichan, HN_NVS_RNDIS_MTYPE_CTRL, sndc, - gpa, gpa_cnt); + error = hn_nvs_send_rndis_ctrl(sc->hn_prichan, sndc, gpa, gpa_cnt); if (error) { vmbus_xact_deactivate(xact); if_printf(sc->hn_ifp, "RNDIS ctrl send failed: %d\n", error); @@ -1165,7 +1164,7 @@ hn_rndis_halt(struct hn_softc *sc) halt->rm_rid = hn_rndis_rid(sc); /* No RNDIS completion; rely on NVS message send completion */ - hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); + hn_send_ctx_init(&sndc, hn_nvs_sent_xact, xact); hn_rndis_xact_exec1(sc, xact, sizeof(*halt), &sndc, &comp_len); vmbus_xact_put(xact); Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 08:49:28 2016 (r308518) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 08:52:23 2016 (r308519) @@ -46,8 +46,6 @@ typedef void (*hn_sent_callback_t) struct hn_send_ctx { hn_sent_callback_t hn_cb; void *hn_cbarg; - uint32_t hn_chim_idx; - int hn_chim_sz; }; struct rndis_hash_info; @@ -66,31 +64,18 @@ struct hn_recvinfo { uint32_t hash_value; }; -#define HN_SEND_CTX_INITIALIZER(cb, cbarg) \ -{ \ - .hn_cb = cb, \ - .hn_cbarg = cbarg, \ - .hn_chim_idx = HN_NVS_CHIM_IDX_INVALID, \ - .hn_chim_sz = 0 \ +#define HN_SEND_CTX_INITIALIZER(cb, cbarg) \ +{ \ + .hn_cb = cb, \ + .hn_cbarg = cbarg \ } static __inline void -hn_send_ctx_init(struct hn_send_ctx *sndc, hn_sent_callback_t cb, - void *cbarg, uint32_t chim_idx, int chim_sz) +hn_send_ctx_init(struct hn_send_ctx *sndc, hn_sent_callback_t cb, void *cbarg) { sndc->hn_cb = cb; sndc->hn_cbarg = cbarg; - sndc->hn_chim_idx = chim_idx; - sndc->hn_chim_sz = chim_sz; -} - -static __inline void -hn_send_ctx_init_simple(struct hn_send_ctx *sndc, hn_sent_callback_t cb, - void *cbarg) -{ - - hn_send_ctx_init(sndc, cb, cbarg, HN_NVS_CHIM_IDX_INVALID, 0); } static __inline int @@ -134,6 +119,9 @@ void hn_nvs_detach(struct hn_softc *sc) int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch); void hn_nvs_sent_xact(struct hn_send_ctx *sndc, struct hn_softc *sc, struct vmbus_channel *chan, const void *data, int dlen); +int hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, + struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, + int gpa_cnt); int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, const struct hn_recvinfo *info); From owner-svn-src-all@freebsd.org Fri Nov 11 08:55:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 617A4C3AAC3; Fri, 11 Nov 2016 08:55:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 20B351750; Fri, 11 Nov 2016 08:55:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB8tjgn024025; Fri, 11 Nov 2016 08:55:45 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB8tjao024024; Fri, 11 Nov 2016 08:55:45 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110855.uAB8tjao024024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 08:55:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308520 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 08:55:46 -0000 Author: sephe Date: Fri Nov 11 08:55:45 2016 New Revision: 308520 URL: https://svnweb.freebsd.org/changeset/base/308520 Log: MFC 307840,307842 307840 hyperv/hn: Properly handle synthetic parts reattach failure. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8310 307842 hyperv/hn: Start link status check, if no network changes were pending. Link status check is much more lightweight than network change detection. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8311 Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 08:52:23 2016 (r308519) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 08:55:45 2016 (r308520) @@ -1783,19 +1783,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, break; } - /* Obtain and record requested MTU */ - ifp->if_mtu = ifr->ifr_mtu; - -#if __FreeBSD_version >= 1100099 - /* - * Make sure that LRO aggregation length limit is still - * valid, after the MTU change. - */ - if (sc->hn_rx_ring[0].hn_lro.lro_length_lim < - HN_LRO_LENLIM_MIN(ifp)) - hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); -#endif - /* * Suspend this interface before the synthetic parts * are ripped. @@ -1810,13 +1797,31 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, /* * Reattach the synthetic parts, i.e. NVS and RNDIS, * with the new MTU setting. - * XXX check error. */ - hn_synth_attach(sc, ifr->ifr_mtu); + error = hn_synth_attach(sc, ifr->ifr_mtu); + if (error) { + HN_UNLOCK(sc); + break; + } + /* + * Commit the requested MTU, after the synthetic parts + * have been successfully attached. + */ + ifp->if_mtu = ifr->ifr_mtu; + + /* + * Make sure that various parameters based on MTU are + * still valid, after the MTU change. + */ if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax) hn_set_chim_size(sc, sc->hn_chim_szmax); - hn_set_tso_maxsize(sc, hn_tso_maxlen, ifr->ifr_mtu); + hn_set_tso_maxsize(sc, hn_tso_maxlen, ifp->if_mtu); +#if __FreeBSD_version >= 1100099 + if (sc->hn_rx_ring[0].hn_lro.lro_length_lim < + HN_LRO_LENLIM_MIN(ifp)) + hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); +#endif /* * All done! Resume the interface now. @@ -3903,12 +3908,18 @@ static void hn_resume_mgmt(struct hn_softc *sc) { + sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; + /* - * Kick off network change detection, which will - * do link status check too. + * Kick off network change detection, if it was pending. + * If no network change was pending, start link status + * checks, which is more lightweight than network change + * detection. */ - sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; - hn_network_change(sc); + if (sc->hn_link_flags & HN_LINK_FLAG_NETCHG) + hn_network_change(sc); + else + hn_link_status_update(sc); } static void From owner-svn-src-all@freebsd.org Fri Nov 11 08:57:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A3C0C3AB8C; Fri, 11 Nov 2016 08:57:54 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED5B019CA; Fri, 11 Nov 2016 08:57:53 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB8vrlh024279; Fri, 11 Nov 2016 08:57:53 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB8vqG0024276; Fri, 11 Nov 2016 08:57:52 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110857.uAB8vqG0024276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 08:57:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308521 - in stable/11/sys: dev/hyperv/netvsc net X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 08:57:54 -0000 Author: sephe Date: Fri Nov 11 08:57:52 2016 New Revision: 308521 URL: https://svnweb.freebsd.org/changeset/base/308521 Log: MFC 307843 hyperv/hn: Fix RX filter settings. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8313 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/net/rndis.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 08:55:45 2016 (r308520) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Nov 11 08:57:52 2016 (r308521) @@ -232,6 +232,7 @@ struct hn_softc { struct sysctl_oid *hn_rx_sysctl_tree; struct vmbus_xact_ctx *hn_xact; uint32_t hn_nvs_ver; + uint32_t hn_rx_filter; struct taskqueue *hn_mgmt_taskq; struct taskqueue *hn_mgmt_taskq0; Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 08:55:45 2016 (r308520) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 08:57:52 2016 (r308521) @@ -326,6 +326,7 @@ static int hn_tx_conf_int_sysctl(SYSCTL_ static int hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS); static int hn_caps_sysctl(SYSCTL_HANDLER_ARGS); static int hn_hwassist_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); static int hn_check_iplen(const struct mbuf *, int); @@ -367,6 +368,7 @@ static int netvsc_detach(device_t dev); static void hn_link_status(struct hn_softc *); static int hn_sendpkt_rndis_sglist(struct hn_tx_ring *, struct hn_txdesc *); static int hn_sendpkt_rndis_chim(struct hn_tx_ring *, struct hn_txdesc *); +static int hn_set_rxfilter(struct hn_softc *); static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt); @@ -455,6 +457,43 @@ hn_sendpkt_rndis_chim(struct hn_tx_ring } static int +hn_set_rxfilter(struct hn_softc *sc) +{ + struct ifnet *ifp = sc->hn_ifp; + uint32_t filter; + int error = 0; + + HN_LOCK_ASSERT(sc); + + if (ifp->if_flags & IFF_PROMISC) { + filter = NDIS_PACKET_TYPE_PROMISCUOUS; + } else { + filter = NDIS_PACKET_TYPE_DIRECTED; + if (ifp->if_flags & IFF_BROADCAST) + filter |= NDIS_PACKET_TYPE_BROADCAST; +#ifdef notyet + /* + * See the comment in SIOCADDMULTI/SIOCDELMULTI. + */ + /* TODO: support multicast list */ + if ((ifp->if_flags & IFF_ALLMULTI) || + !TAILQ_EMPTY(&ifp->if_multiaddrs)) + filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; +#else + /* Always enable ALLMULTI */ + filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; +#endif + } + + if (sc->hn_rx_filter != filter) { + error = hn_rndis_set_rxfilter(sc, filter); + if (!error) + sc->hn_rx_filter = filter; + } + return (error); +} + +static int hn_get_txswq_depth(const struct hn_tx_ring *txr) { @@ -728,6 +767,9 @@ netvsc_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "hwassist", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_hwassist_sysctl, "A", "hwassist"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxfilter", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_rxfilter_sysctl, "A", "rxfilter"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_key", CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, hn_rss_key_sysctl, "IU", "RSS key"); @@ -1840,31 +1882,13 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, } if (ifp->if_flags & IFF_UP) { - /* - * If only the state of the PROMISC flag changed, - * then just use the 'set promisc mode' command - * instead of reinitializing the entire NIC. Doing - * a full re-init means reloading the firmware and - * waiting for it to start up, which may take a - * second or two. - */ -#ifdef notyet - /* Fixme: Promiscuous mode? */ - if (ifp->if_drv_flags & IFF_DRV_RUNNING && - ifp->if_flags & IFF_PROMISC && - !(sc->hn_if_flags & IFF_PROMISC)) { - /* do something here for Hyper-V */ - } else if (ifp->if_drv_flags & IFF_DRV_RUNNING && - !(ifp->if_flags & IFF_PROMISC) && - sc->hn_if_flags & IFF_PROMISC) { - /* do something here for Hyper-V */ - } else -#endif + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + hn_set_rxfilter(sc); + else hn_init_locked(sc); } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) hn_stop(sc); - } } sc->hn_if_flags = ifp->if_flags; @@ -1922,12 +1946,27 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, case SIOCADDMULTI: case SIOCDELMULTI: - /* Always all-multi */ +#ifdef notyet /* - * TODO: - * Enable/disable all-multi according to the emptiness of - * the mcast address list. + * XXX + * Multicast uses mutex, while RNDIS RX filter setting + * sleeps. We workaround this by always enabling + * ALLMULTI. ALLMULTI would actually always be on, even + * if we supported the SIOCADDMULTI/SIOCDELMULTI, since + * we don't support multicast address list configuration + * for this driver. */ + HN_LOCK(sc); + + if ((sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) == 0) { + HN_UNLOCK(sc); + break; + } + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + hn_set_rxfilter(sc); + + HN_UNLOCK(sc); +#endif break; case SIOCSIFMEDIA: @@ -2035,8 +2074,8 @@ hn_init_locked(struct hn_softc *sc) if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; - /* TODO: add hn_rx_filter */ - hn_rndis_set_rxfilter(sc, NDIS_PACKET_TYPE_PROMISCUOUS); + /* Configure RX filter */ + hn_set_rxfilter(sc); /* Clear OACTIVE bit. */ atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); @@ -2363,6 +2402,21 @@ hn_hwassist_sysctl(SYSCTL_HANDLER_ARGS) } static int +hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + char filter_str[128]; + uint32_t filter; + + HN_LOCK(sc); + filter = sc->hn_rx_filter; + HN_UNLOCK(sc); + snprintf(filter_str, sizeof(filter_str), "%b", filter, + NDIS_PACKET_TYPES); + return sysctl_handle_string(oidp, filter_str, sizeof(filter_str), req); +} + +static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS) { struct hn_softc *sc = arg1; @@ -3783,6 +3837,7 @@ hn_suspend_data(struct hn_softc *sc) * Disable RX by clearing RX filter. */ hn_rndis_set_rxfilter(sc, 0); + sc->hn_rx_filter = 0; /* * Give RNDIS enough time to flush all pending data packets. @@ -3870,9 +3925,8 @@ hn_resume_data(struct hn_softc *sc) /* * Re-enable RX. - * TODO: add hn_rx_filter. */ - hn_rndis_set_rxfilter(sc, NDIS_PACKET_TYPE_PROMISCUOUS); + hn_set_rxfilter(sc); /* * Make sure to clear suspend status on "all" TX rings, Modified: stable/11/sys/net/rndis.h ============================================================================== --- stable/11/sys/net/rndis.h Fri Nov 11 08:55:45 2016 (r308520) +++ stable/11/sys/net/rndis.h Fri Nov 11 08:57:52 2016 (r308521) @@ -351,7 +351,7 @@ struct rndis_keepalive_comp { uint32_t rm_status; }; -/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ +/* Packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ #define NDIS_PACKET_TYPE_DIRECTED 0x00000001 #define NDIS_PACKET_TYPE_MULTICAST 0x00000002 #define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 @@ -365,6 +365,14 @@ struct rndis_keepalive_comp { #define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000 #define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000 +/* + * Packet filter description for use with printf(9) %b identifier. + */ +#define NDIS_PACKET_TYPES \ + "\20\1DIRECT\2MULTICAST\3ALLMULTI\4BROADCAST" \ + "\5SRCROUTE\6PROMISC\7SMT\10ALLLOCAL" \ + "\11GROUP\12ALLFUNC\13FUNC\14MACFRAME" + /* RNDIS offsets */ #define RNDIS_HEADER_OFFSET ((uint32_t)sizeof(struct rndis_msghdr)) #define RNDIS_DATA_OFFSET \ From owner-svn-src-all@freebsd.org Fri Nov 11 09:00:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDB1BC3AEC9; Fri, 11 Nov 2016 09:00:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F5F71D2B; Fri, 11 Nov 2016 09:00:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB90T2r024665; Fri, 11 Nov 2016 09:00:29 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB90T7b024664; Fri, 11 Nov 2016 09:00:29 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110900.uAB90T7b024664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 09:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308522 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 09:00:30 -0000 Author: sephe Date: Fri Nov 11 09:00:29 2016 New Revision: 308522 URL: https://svnweb.freebsd.org/changeset/base/308522 Log: MFC 307844 hyperv/hn: Nuke unused forward declaration. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8314 Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 08:57:52 2016 (r308521) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Fri Nov 11 09:00:29 2016 (r308522) @@ -48,11 +48,6 @@ struct hn_send_ctx { void *hn_cbarg; }; -struct rndis_hash_info; -struct rndix_hash_value; -struct ndis_8021q_info_; -struct rndis_tcp_ip_csum_info_; - #define HN_NDIS_VLAN_INFO_INVALID 0xffffffff #define HN_NDIS_RXCSUM_INFO_INVALID 0 #define HN_NDIS_HASH_INFO_INVALID 0 From owner-svn-src-all@freebsd.org Fri Nov 11 09:03:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35883C390BD; Fri, 11 Nov 2016 09:03:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06725115B; Fri, 11 Nov 2016 09:03:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAB93ETC028196; Fri, 11 Nov 2016 09:03:14 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAB93DWx028187; Fri, 11 Nov 2016 09:03:13 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611110903.uAB93DWx028187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 11 Nov 2016 09:03:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308523 - stable/11/sys/dev/hyperv/utilities X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 09:03:15 -0000 Author: sephe Date: Fri Nov 11 09:03:13 2016 New Revision: 308523 URL: https://svnweb.freebsd.org/changeset/base/308523 Log: MFC 307845 hyperv/ic: Rework framework/message version negotiation. Submitted by: Hongjiang Zhang Modified by: sephe Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8280 Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c stable/11/sys/dev/hyperv/utilities/hv_kvp.c stable/11/sys/dev/hyperv/utilities/hv_kvp.h stable/11/sys/dev/hyperv/utilities/hv_shutdown.c stable/11/sys/dev/hyperv/utilities/hv_timesync.c stable/11/sys/dev/hyperv/utilities/hv_util.c stable/11/sys/dev/hyperv/utilities/hv_util.h stable/11/sys/dev/hyperv/utilities/hv_utilreg.h stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Fri Nov 11 09:00:29 2016 (r308522) +++ stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Fri Nov 11 09:03:13 2016 (r308523) @@ -40,6 +40,14 @@ __FBSDID("$FreeBSD$"); #include "vmbus_if.h" +#define VMBUS_HEARTBEAT_FWVER_MAJOR 3 +#define VMBUS_HEARTBEAT_FWVER \ + VMBUS_IC_VERSION(VMBUS_HEARTBEAT_FWVER_MAJOR, 0) + +#define VMBUS_HEARTBEAT_MSGVER_MAJOR 3 +#define VMBUS_HEARTBEAT_MSGVER \ + VMBUS_IC_VERSION(VMBUS_HEARTBEAT_MSGVER_MAJOR, 0) + static const struct vmbus_ic_desc vmbus_heartbeat_descs[] = { { .ic_guid = { .hv_guid = { @@ -80,7 +88,8 @@ vmbus_heartbeat_cb(struct vmbus_channel */ switch (hdr->ic_type) { case VMBUS_ICMSG_TYPE_NEGOTIATE: - error = vmbus_ic_negomsg(sc, data, &dlen); + error = vmbus_ic_negomsg(sc, data, &dlen, + VMBUS_HEARTBEAT_FWVER, VMBUS_HEARTBEAT_MSGVER); if (error) return; break; Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_kvp.c Fri Nov 11 09:00:29 2016 (r308522) +++ stable/11/sys/dev/hyperv/utilities/hv_kvp.c Fri Nov 11 09:03:13 2016 (r308523) @@ -61,7 +61,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include "hv_util.h" #include "unicode.h" @@ -74,6 +76,12 @@ __FBSDID("$FreeBSD$"); #define KVP_ERROR 1 #define kvp_hdr hdr.kvp_hdr +#define KVP_FWVER_MAJOR 3 +#define KVP_FWVER VMBUS_IC_VERSION(KVP_FWVER_MAJOR, 0) + +#define KVP_MSGVER_MAJOR 4 +#define KVP_MSGVER VMBUS_IC_VERSION(KVP_MSGVER_MAJOR, 0) + /* hv_kvp debug control */ static int hv_kvp_log = 0; @@ -208,52 +216,10 @@ hv_kvp_transaction_init(hv_kvp_sc *sc, u sc->host_msg_id = request_id; sc->rcv_buf = rcv_buf; sc->host_kvp_msg = (struct hv_kvp_msg *)&rcv_buf[ - sizeof(struct hv_vmbus_pipe_hdr) + - sizeof(struct hv_vmbus_icmsg_hdr)]; + sizeof(struct hv_vmbus_pipe_hdr) + + sizeof(struct hv_vmbus_icmsg_hdr)]; } - -/* - * hv_kvp - version neogtiation function - */ -static void -hv_kvp_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf) -{ - struct hv_vmbus_icmsg_negotiate *negop; - int icframe_vercnt; - int icmsg_vercnt; - - icmsghdrp->icmsgsize = 0x10; - - negop = (struct hv_vmbus_icmsg_negotiate *)&buf[ - sizeof(struct hv_vmbus_pipe_hdr) + - sizeof(struct hv_vmbus_icmsg_hdr)]; - icframe_vercnt = negop->icframe_vercnt; - icmsg_vercnt = negop->icmsg_vercnt; - - /* - * Select the framework version number we will support - */ - if ((icframe_vercnt >= 2) && (negop->icversion_data[1].major == 3)) { - icframe_vercnt = 3; - if (icmsg_vercnt > 2) - icmsg_vercnt = 4; - else - icmsg_vercnt = 3; - } else { - icframe_vercnt = 1; - icmsg_vercnt = 1; - } - - negop->icframe_vercnt = 1; - negop->icmsg_vercnt = 1; - negop->icversion_data[0].major = icframe_vercnt; - negop->icversion_data[0].minor = 0; - negop->icversion_data[1].major = icmsg_vercnt; - negop->icversion_data[1].minor = 0; -} - - /* * Convert ip related info in umsg from utf8 to utf16 and store in hmsg */ @@ -578,7 +544,8 @@ hv_kvp_respond_host(hv_kvp_sc *sc, int e error = HV_KVP_E_FAIL; hv_icmsg_hdrp->status = error; - hv_icmsg_hdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | HV_ICMSGHDRFLAG_RESPONSE; + hv_icmsg_hdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | + HV_ICMSGHDRFLAG_RESPONSE; error = vmbus_chan_send(vmbus_get_channel(sc->dev), VMBUS_CHANPKT_TYPE_INBAND, 0, sc->rcv_buf, sc->host_msg_len, @@ -622,8 +589,8 @@ hv_kvp_process_request(void *context, in uint32_t recvlen = 0; uint64_t requestid; struct hv_vmbus_icmsg_hdr *icmsghdrp; - int ret = 0; - hv_kvp_sc *sc; + int ret = 0, error; + hv_kvp_sc *sc; hv_kvp_log_info("%s: entering hv_kvp_process_request\n", __func__); @@ -637,14 +604,15 @@ hv_kvp_process_request(void *context, in /* XXX check recvlen to make sure that it contains enough data */ while ((ret == 0) && (recvlen > 0)) { - icmsghdrp = (struct hv_vmbus_icmsg_hdr *) - &kvp_buf[sizeof(struct hv_vmbus_pipe_hdr)]; + &kvp_buf[sizeof(struct hv_vmbus_pipe_hdr)]; hv_kvp_transaction_init(sc, recvlen, requestid, kvp_buf); if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { - hv_kvp_negotiate_version(icmsghdrp, kvp_buf); - hv_kvp_respond_host(sc, ret); + error = vmbus_ic_negomsg(&sc->util_sc, + kvp_buf, &recvlen, KVP_FWVER, KVP_MSGVER); + /* XXX handle vmbus_ic_negomsg failure. */ + hv_kvp_respond_host(sc, error); /* * It is ok to not acquire the mutex before setting Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.h ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_kvp.h Fri Nov 11 09:00:29 2016 (r308522) +++ stable/11/sys/dev/hyperv/utilities/hv_kvp.h Fri Nov 11 09:03:13 2016 (r308523) @@ -28,7 +28,6 @@ #ifndef _KVP_H #define _KVP_H - /* * An implementation of HyperV key value pair (KVP) functionality for FreeBSD * @@ -178,9 +177,9 @@ struct hv_kvp_ipaddr_value { }__attribute__((packed)); struct hv_kvp_hdr { - uint8_t operation; - uint8_t pool; - uint16_t pad; + uint8_t operation; + uint8_t pool; + uint16_t pad; } __attribute__((packed)); struct hv_kvp_exchg_msg_value { Modified: stable/11/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Fri Nov 11 09:00:29 2016 (r308522) +++ stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Fri Nov 11 09:03:13 2016 (r308523) @@ -41,6 +41,14 @@ __FBSDID("$FreeBSD$"); #include "vmbus_if.h" +#define VMBUS_SHUTDOWN_FWVER_MAJOR 3 +#define VMBUS_SHUTDOWN_FWVER \ + VMBUS_IC_VERSION(VMBUS_SHUTDOWN_FWVER_MAJOR, 0) + +#define VMBUS_SHUTDOWN_MSGVER_MAJOR 3 +#define VMBUS_SHUTDOWN_MSGVER \ + VMBUS_IC_VERSION(VMBUS_SHUTDOWN_MSGVER_MAJOR, 0) + static const struct vmbus_ic_desc vmbus_shutdown_descs[] = { { .ic_guid = { .hv_guid = { @@ -82,7 +90,8 @@ vmbus_shutdown_cb(struct vmbus_channel * */ switch (hdr->ic_type) { case VMBUS_ICMSG_TYPE_NEGOTIATE: - error = vmbus_ic_negomsg(sc, data, &dlen); + error = vmbus_ic_negomsg(sc, data, &dlen, + VMBUS_SHUTDOWN_FWVER, VMBUS_SHUTDOWN_MSGVER); if (error) return; break; Modified: stable/11/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_timesync.c Fri Nov 11 09:00:29 2016 (r308522) +++ stable/11/sys/dev/hyperv/utilities/hv_timesync.c Fri Nov 11 09:03:13 2016 (r308523) @@ -42,6 +42,14 @@ __FBSDID("$FreeBSD$"); #include "vmbus_if.h" +#define VMBUS_TIMESYNC_FWVER_MAJOR 3 +#define VMBUS_TIMESYNC_FWVER \ + VMBUS_IC_VERSION(VMBUS_TIMESYNC_FWVER_MAJOR, 0) + +#define VMBUS_TIMESYNC_MSGVER_MAJOR 3 +#define VMBUS_TIMESYNC_MSGVER \ + VMBUS_IC_VERSION(VMBUS_TIMESYNC_MSGVER_MAJOR, 0) + static const struct vmbus_ic_desc vmbus_timesync_descs[] = { { .ic_guid = { .hv_guid = { @@ -162,7 +170,8 @@ vmbus_timesync_cb(struct vmbus_channel * */ switch (hdr->ic_type) { case VMBUS_ICMSG_TYPE_NEGOTIATE: - error = vmbus_ic_negomsg(sc, data, &dlen); + error = vmbus_ic_negomsg(sc, data, &dlen, + VMBUS_TIMESYNC_FWVER, VMBUS_TIMESYNC_MSGVER); if (error) return; break; Modified: stable/11/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_util.c Fri Nov 11 09:00:29 2016 (r308522) +++ stable/11/sys/dev/hyperv/utilities/hv_util.c Fri Nov 11 09:03:13 2016 (r308523) @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -53,52 +54,145 @@ __offsetof(struct vmbus_icmsg_negotiate, ic_ver[VMBUS_IC_VERCNT]) CTASSERT(VMBUS_IC_NEGOSZ < VMBUS_IC_BRSIZE); +static int vmbus_ic_fwver_sysctl(SYSCTL_HANDLER_ARGS); +static int vmbus_ic_msgver_sysctl(SYSCTL_HANDLER_ARGS); + int -vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen0) +vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen0, + uint32_t fw_ver, uint32_t msg_ver) { struct vmbus_icmsg_negotiate *nego; - int cnt, major, dlen = *dlen0; + int i, cnt, dlen = *dlen0, error; + uint32_t sel_fw_ver, sel_msg_ver; + bool has_fw_ver, has_msg_ver; /* - * Preliminary message size verification + * Preliminary message verification. */ if (dlen < sizeof(*nego)) { device_printf(sc->ic_dev, "truncated ic negotiate, len %d\n", dlen); - return EINVAL; + return (EINVAL); } nego = data; + if (nego->ic_fwver_cnt == 0) { + device_printf(sc->ic_dev, "ic negotiate does not contain " + "framework version %u\n", nego->ic_fwver_cnt); + return (EINVAL); + } + if (nego->ic_msgver_cnt == 0) { + device_printf(sc->ic_dev, "ic negotiate does not contain " + "message version %u\n", nego->ic_msgver_cnt); + return (EINVAL); + } + cnt = nego->ic_fwver_cnt + nego->ic_msgver_cnt; if (dlen < __offsetof(struct vmbus_icmsg_negotiate, ic_ver[cnt])) { device_printf(sc->ic_dev, "ic negotiate does not contain " "versions %d\n", dlen); - return EINVAL; + return (EINVAL); + } + + error = EOPNOTSUPP; + + /* + * Find the best match framework version. + */ + has_fw_ver = false; + for (i = 0; i < nego->ic_fwver_cnt; ++i) { + if (VMBUS_ICVER_LE(nego->ic_ver[i], fw_ver)) { + if (!has_fw_ver) { + sel_fw_ver = nego->ic_ver[i]; + has_fw_ver = true; + } else if (VMBUS_ICVER_GT(nego->ic_ver[i], + sel_fw_ver)) { + sel_fw_ver = nego->ic_ver[i]; + } + } + } + if (!has_fw_ver) { + device_printf(sc->ic_dev, "failed to select framework " + "version\n"); + goto done; + } + + /* + * Fine the best match message version. + */ + has_msg_ver = false; + for (i = nego->ic_fwver_cnt; + i < nego->ic_fwver_cnt + nego->ic_msgver_cnt; ++i) { + if (VMBUS_ICVER_LE(nego->ic_ver[i], msg_ver)) { + if (!has_msg_ver) { + sel_msg_ver = nego->ic_ver[i]; + has_msg_ver = true; + } else if (VMBUS_ICVER_GT(nego->ic_ver[i], + sel_msg_ver)) { + sel_msg_ver = nego->ic_ver[i]; + } + } + } + if (!has_msg_ver) { + device_printf(sc->ic_dev, "failed to select message " + "version\n"); + goto done; } - /* Select major version; XXX looks wrong. */ - if (nego->ic_fwver_cnt >= 2 && VMBUS_ICVER_MAJOR(nego->ic_ver[1]) == 3) - major = 3; - else - major = 1; + error = 0; +done: + if (bootverbose || !has_fw_ver || !has_msg_ver) { + if (has_fw_ver) { + device_printf(sc->ic_dev, "sel framework version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(sel_fw_ver), + VMBUS_ICVER_MINOR(sel_fw_ver)); + } + for (i = 0; i < nego->ic_fwver_cnt; i++) { + device_printf(sc->ic_dev, "supp framework version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(nego->ic_ver[i]), + VMBUS_ICVER_MINOR(nego->ic_ver[i])); + } + + if (has_msg_ver) { + device_printf(sc->ic_dev, "sel message version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(sel_msg_ver), + VMBUS_ICVER_MINOR(sel_msg_ver)); + } + for (i = nego->ic_fwver_cnt; + i < nego->ic_fwver_cnt + nego->ic_msgver_cnt; i++) { + device_printf(sc->ic_dev, "supp message version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(nego->ic_ver[i]), + VMBUS_ICVER_MINOR(nego->ic_ver[i])); + } + } + if (error) + return (error); + + /* Record the selected versions. */ + sc->ic_fwver = sel_fw_ver; + sc->ic_msgver = sel_msg_ver; - /* One framework version */ + /* One framework version. */ nego->ic_fwver_cnt = 1; - nego->ic_ver[0] = VMBUS_IC_VERSION(major, 0); + nego->ic_ver[0] = sel_fw_ver; - /* One message version */ + /* One message version. */ nego->ic_msgver_cnt = 1; - nego->ic_ver[1] = VMBUS_IC_VERSION(major, 0); + nego->ic_ver[1] = sel_msg_ver; - /* Update data size */ + /* Update data size. */ nego->ic_hdr.ic_dsize = VMBUS_IC_NEGOSZ - sizeof(struct vmbus_icmsg_hdr); - /* Update total size, if necessary */ + /* Update total size, if necessary. */ if (dlen < VMBUS_IC_NEGOSZ) *dlen0 = VMBUS_IC_NEGOSZ; - return 0; + return (0); } int @@ -124,6 +218,8 @@ hv_util_attach(device_t dev, vmbus_chan_ { struct hv_util_sc *sc = device_get_softc(dev); struct vmbus_channel *chan = vmbus_get_channel(dev); + struct sysctl_oid_list *child; + struct sysctl_ctx_list *ctx; int error; sc->ic_dev = dev; @@ -146,9 +242,41 @@ hv_util_attach(device_t dev, vmbus_chan_ free(sc->receive_buffer, M_DEVBUF); return (error); } + + ctx = device_get_sysctl_ctx(dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "fw_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + vmbus_ic_fwver_sysctl, "A", "framework version"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "msg_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + vmbus_ic_msgver_sysctl, "A", "message version"); + return (0); } +static int +vmbus_ic_fwver_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hv_util_sc *sc = arg1; + char verstr[16]; + + snprintf(verstr, sizeof(verstr), "%u.%u", + VMBUS_ICVER_MAJOR(sc->ic_fwver), VMBUS_ICVER_MINOR(sc->ic_fwver)); + return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); +} + +static int +vmbus_ic_msgver_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hv_util_sc *sc = arg1; + char verstr[16]; + + snprintf(verstr, sizeof(verstr), "%u.%u", + VMBUS_ICVER_MAJOR(sc->ic_msgver), VMBUS_ICVER_MINOR(sc->ic_msgver)); + return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); +} + int hv_util_detach(device_t dev) { Modified: stable/11/sys/dev/hyperv/utilities/hv_util.h ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_util.h Fri Nov 11 09:00:29 2016 (r308522) +++ stable/11/sys/dev/hyperv/utilities/hv_util.h Fri Nov 11 09:03:13 2016 (r308523) @@ -42,6 +42,8 @@ typedef struct hv_util_sc { device_t ic_dev; uint8_t *receive_buffer; int ic_buflen; + uint32_t ic_fwver; /* framework version */ + uint32_t ic_msgver; /* message version */ } hv_util_sc; struct vmbus_ic_desc { @@ -54,6 +56,7 @@ struct vmbus_ic_desc { int hv_util_attach(device_t dev, vmbus_chan_callback_t cb); int hv_util_detach(device_t dev); int vmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]); -int vmbus_ic_negomsg(struct hv_util_sc *, void *data, int *dlen); +int vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen, + uint32_t fw_ver, uint32_t msg_ver); #endif Modified: stable/11/sys/dev/hyperv/utilities/hv_utilreg.h ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_utilreg.h Fri Nov 11 09:00:29 2016 (r308522) +++ stable/11/sys/dev/hyperv/utilities/hv_utilreg.h Fri Nov 11 09:03:13 2016 (r308523) @@ -76,16 +76,4 @@ typedef struct hv_vmbus_icmsg_negotiate hv_vmbus_ic_version icversion_data[1]; /* any size array */ } __packed hv_vmbus_icmsg_negotiate; -typedef struct hv_vmbus_shutdown_msg_data { - uint32_t reason_code; - uint32_t timeout_seconds; - uint32_t flags; - uint8_t display_message[2048]; -} __packed hv_vmbus_shutdown_msg_data; - -typedef struct hv_vmbus_heartbeat_msg_data { - uint64_t seq_num; - uint32_t reserved[8]; -} __packed hv_vmbus_heartbeat_msg_data; - #endif /* !_HV_UTILREG_H_ */ Modified: stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h ============================================================================== --- stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h Fri Nov 11 09:00:29 2016 (r308522) +++ stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h Fri Nov 11 09:03:13 2016 (r308523) @@ -42,6 +42,12 @@ #define VMBUS_IC_VERSION(major, minor) ((major) | (((uint32_t)(minor)) << 16)) #define VMBUS_ICVER_MAJOR(ver) ((ver) & 0xffff) #define VMBUS_ICVER_MINOR(ver) (((ver) & 0xffff0000) >> 16) +#define VMBUS_ICVER_SWAP(ver) \ + ((VMBUS_ICVER_MAJOR((ver)) << 16) | VMBUS_ICVER_MINOR((ver))) +#define VMBUS_ICVER_LE(v1, v2) \ + (VMBUS_ICVER_SWAP((v1)) <= VMBUS_ICVER_SWAP((v2))) +#define VMBUS_ICVER_GT(v1, v2) \ + (VMBUS_ICVER_SWAP((v1)) > VMBUS_ICVER_SWAP((v2))) struct vmbus_pipe_hdr { uint32_t ph_flags; From owner-svn-src-all@freebsd.org Fri Nov 11 14:19:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27DEEC3B497; Fri, 11 Nov 2016 14:19:14 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E869B199B; Fri, 11 Nov 2016 14:19:13 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABEJDap059398; Fri, 11 Nov 2016 14:19:13 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABEJDKH059397; Fri, 11 Nov 2016 14:19:13 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611111419.uABEJDKH059397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 11 Nov 2016 14:19:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308524 - head/sys/dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 14:19:14 -0000 Author: andrew Date: Fri Nov 11 14:19:12 2016 New Revision: 308524 URL: https://svnweb.freebsd.org/changeset/base/308524 Log: Replace OF_getprop ... fdt32_to_cpu with OF_getencprop. The latter correctly adjusts for the endian. MFC after: 1 week Sponsored by: ABT Systems Ltd Modified: head/sys/dev/fdt/fdt_common.c Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Fri Nov 11 09:03:13 2016 (r308523) +++ head/sys/dev/fdt/fdt_common.c Fri Nov 11 14:19:12 2016 (r308524) @@ -419,13 +419,13 @@ fdt_addrsize_cells(phandle_t node, int * * Retrieve #{address,size}-cells. */ cell_size = sizeof(cell); - if (OF_getprop(node, "#address-cells", &cell, cell_size) < cell_size) - cell = 2; - *addr_cells = fdt32_to_cpu((int)cell); + if (OF_getencprop(node, "#address-cells", &cell, cell_size) < cell_size) + *addr_cells = 2; + *addr_cells = (int)cell; - if (OF_getprop(node, "#size-cells", &cell, cell_size) < cell_size) + if (OF_getencprop(node, "#size-cells", &cell, cell_size) < cell_size) cell = 1; - *size_cells = fdt32_to_cpu((int)cell); + *size_cells = (int)cell; if (*addr_cells > 3 || *size_cells > 2) return (ERANGE); @@ -540,11 +540,11 @@ fdt_get_phyaddr(phandle_t node, device_t phy_node = OF_node_from_xref(phy_handle); - if (OF_getprop(phy_node, "reg", (void *)&phy_reg, + if (OF_getencprop(phy_node, "reg", (void *)&phy_reg, sizeof(phy_reg)) <= 0) return (ENXIO); - *phy_addr = fdt32_to_cpu(phy_reg); + *phy_addr = phy_reg; /* * Search for softc used to communicate with phy. From owner-svn-src-all@freebsd.org Fri Nov 11 14:22:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D698AC3B621; Fri, 11 Nov 2016 14:22:36 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A601D1DC0; Fri, 11 Nov 2016 14:22:36 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABEMZb4062977; Fri, 11 Nov 2016 14:22:35 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABEMZEp062972; Fri, 11 Nov 2016 14:22:35 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611111422.uABEMZEp062972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 11 Nov 2016 14:22:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308525 - in head/sys/arm: altera/socfpga freescale/vybrid rockchip samsung/exynos xilinx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 14:22:36 -0000 Author: andrew Date: Fri Nov 11 14:22:35 2016 New Revision: 308525 URL: https://svnweb.freebsd.org/changeset/base/308525 Log: Remove more unneeded users of the fdt_pic_decode_t table. Sponsored by: ABT Systems Ltd Deleted: head/sys/arm/rockchip/rk30xx_common.c Modified: head/sys/arm/altera/socfpga/socfpga_common.c head/sys/arm/freescale/vybrid/vf_common.c head/sys/arm/rockchip/files.rk30xx head/sys/arm/samsung/exynos/exynos5_common.c head/sys/arm/xilinx/zy7_machdep.c Modified: head/sys/arm/altera/socfpga/socfpga_common.c ============================================================================== --- head/sys/arm/altera/socfpga/socfpga_common.c Fri Nov 11 14:19:12 2016 (r308524) +++ head/sys/arm/altera/socfpga/socfpga_common.c Fri Nov 11 14:22:35 2016 (r308525) @@ -69,24 +69,3 @@ cpu_reset(void) end: while (1); } - -#ifndef INTRNG -static int -fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, - int *pol) -{ - - if (!fdt_is_compatible(node, "arm,gic")) - return (ENXIO); - - *interrupt = fdt32_to_cpu(intr[0]); - *trig = INTR_TRIGGER_CONFORM; - *pol = INTR_POLARITY_CONFORM; - return (0); -} - -fdt_pic_decode_t fdt_pic_table[] = { - &fdt_pic_decode_ic, - NULL -}; -#endif Modified: head/sys/arm/freescale/vybrid/vf_common.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_common.c Fri Nov 11 14:19:12 2016 (r308524) +++ head/sys/arm/freescale/vybrid/vf_common.c Fri Nov 11 14:22:35 2016 (r308525) @@ -61,24 +61,3 @@ cpu_reset(void) end: while (1); } - -#ifndef INTRNG -static int -fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, - int *pol) -{ - - if (!fdt_is_compatible(node, "arm,gic")) - return (ENXIO); - - *interrupt = fdt32_to_cpu(intr[0]); - *trig = INTR_TRIGGER_CONFORM; - *pol = INTR_POLARITY_CONFORM; - return (0); -} - -fdt_pic_decode_t fdt_pic_table[] = { - &fdt_pic_decode_ic, - NULL -}; -#endif Modified: head/sys/arm/rockchip/files.rk30xx ============================================================================== --- head/sys/arm/rockchip/files.rk30xx Fri Nov 11 14:19:12 2016 (r308524) +++ head/sys/arm/rockchip/files.rk30xx Fri Nov 11 14:22:35 2016 (r308525) @@ -1,7 +1,6 @@ # $FreeBSD$ kern/kern_clocksource.c standard -arm/rockchip/rk30xx_common.c standard arm/rockchip/rk30xx_machdep.c standard arm/rockchip/rk30xx_pmu.c standard arm/rockchip/rk30xx_grf.c standard Modified: head/sys/arm/samsung/exynos/exynos5_common.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_common.c Fri Nov 11 14:19:12 2016 (r308524) +++ head/sys/arm/samsung/exynos/exynos5_common.c Fri Nov 11 14:22:35 2016 (r308525) @@ -48,24 +48,3 @@ cpu_reset(void) while (1); } - -#ifndef INTRNG -static int -fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, - int *pol) -{ - - if (!fdt_is_compatible(node, "arm,gic")) - return (ENXIO); - - *interrupt = fdt32_to_cpu(intr[0]); - *trig = INTR_TRIGGER_CONFORM; - *pol = INTR_POLARITY_CONFORM; - return (0); -} - -fdt_pic_decode_t fdt_pic_table[] = { - &fdt_pic_decode_ic, - NULL -}; -#endif Modified: head/sys/arm/xilinx/zy7_machdep.c ============================================================================== --- head/sys/arm/xilinx/zy7_machdep.c Fri Nov 11 14:19:12 2016 (r308524) +++ head/sys/arm/xilinx/zy7_machdep.c Fri Nov 11 14:22:35 2016 (r308525) @@ -92,29 +92,6 @@ platform_devmap_init(void) return (0); } - -#ifndef INTRNG -static int -fdt_gic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, - int *pol) -{ - - if (!fdt_is_compatible(node, "arm,gic")) - return (ENXIO); - - *interrupt = fdt32_to_cpu(intr[0]); - *trig = INTR_TRIGGER_CONFORM; - *pol = INTR_POLARITY_CONFORM; - - return (0); -} - -fdt_pic_decode_t fdt_pic_table[] = { - &fdt_gic_decode_ic, - NULL -}; -#endif - void cpu_reset() { From owner-svn-src-all@freebsd.org Fri Nov 11 14:30:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32FACC3B72A; Fri, 11 Nov 2016 14:30:10 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04E55100F; Fri, 11 Nov 2016 14:30:09 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABEU9mw063311; Fri, 11 Nov 2016 14:30:09 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABEU9CM063310; Fri, 11 Nov 2016 14:30:09 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611111430.uABEU9CM063310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 11 Nov 2016 14:30:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308526 - head/sys/arm/at91 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 14:30:10 -0000 Author: andrew Date: Fri Nov 11 14:30:09 2016 New Revision: 308526 URL: https://svnweb.freebsd.org/changeset/base/308526 Log: Fix ata_at91_alloc_resource to use rman_res_t. Sponsored by: ABT Systems Ltd Modified: head/sys/arm/at91/at91_cfata.c Modified: head/sys/arm/at91/at91_cfata.c ============================================================================== --- head/sys/arm/at91/at91_cfata.c Fri Nov 11 14:22:35 2016 (r308525) +++ head/sys/arm/at91/at91_cfata.c Fri Nov 11 14:30:09 2016 (r308526) @@ -114,7 +114,7 @@ at91_cfata_detach(device_t dev) static struct resource * ata_at91_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct at91_cfata_softc *sc = device_get_softc(dev); From owner-svn-src-all@freebsd.org Fri Nov 11 14:41:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85F92C3BAC5; Fri, 11 Nov 2016 14:41:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 471A21716; Fri, 11 Nov 2016 14:41:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABEf2k7068389; Fri, 11 Nov 2016 14:41:02 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABEf2S3068387; Fri, 11 Nov 2016 14:41:02 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611111441.uABEf2S3068387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 11 Nov 2016 14:41:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308527 - head/sys/dev/smbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 14:41:03 -0000 Author: avg Date: Fri Nov 11 14:41:02 2016 New Revision: 308527 URL: https://svnweb.freebsd.org/changeset/base/308527 Log: smb: fix SMB_READB, SMB_READW, SMB_PCALL to work as documented Previously, those ioctls were defined as 'in' only, so rdata.byte and rdata.word were never updated in the userland. The read data went only to rbuf if it was provided. Thus, consumers were forced to always use it. Now the ioctls are marked as in-out. Compatibility handlers are provided for old ioctls. PR: 213481 Reported by: Lewis Donzis MFC after: 2 weeks Relnotes: maybe Differential Revision: https://reviews.freebsd.org/D8430 Modified: head/sys/dev/smbus/smb.c head/sys/dev/smbus/smb.h Modified: head/sys/dev/smbus/smb.c ============================================================================== --- head/sys/dev/smbus/smb.c Fri Nov 11 14:30:09 2016 (r308526) +++ head/sys/dev/smbus/smb.c Fri Nov 11 14:41:02 2016 (r308527) @@ -41,7 +41,9 @@ #include "smbus_if.h" -#define BUFSIZE 1024 +#define SMB_OLD_READB _IOW('i', 7, struct smbcmd) +#define SMB_OLD_READW _IOW('i', 8, struct smbcmd) +#define SMB_OLD_PCALL _IOW('i', 9, struct smbcmd) struct smb_softc { device_t sc_dev; @@ -224,7 +226,9 @@ smbioctl(struct cdev *dev, u_long cmd, c s->cmd, s->wdata.word)); break; + case SMB_OLD_READB: case SMB_READB: + /* NB: for SMB_OLD_READB the read data goes to rbuf only. */ error = smbus_error(smbus_readb(parent, s->slave, s->cmd, &s->rdata.byte)); if (error) @@ -235,7 +239,9 @@ smbioctl(struct cdev *dev, u_long cmd, c } break; + case SMB_OLD_READW: case SMB_READW: + /* NB: for SMB_OLD_READW the read data goes to rbuf only. */ error = smbus_error(smbus_readw(parent, s->slave, s->cmd, &s->rdata.word)); if (error) @@ -248,7 +254,9 @@ smbioctl(struct cdev *dev, u_long cmd, c } break; + case SMB_OLD_PCALL: case SMB_PCALL: + /* NB: for SMB_OLD_PCALL the read data goes to rbuf only. */ error = smbus_error(smbus_pcall(parent, s->slave, s->cmd, s->wdata.word, &s->rdata.word)); if (error) Modified: head/sys/dev/smbus/smb.h ============================================================================== --- head/sys/dev/smbus/smb.h Fri Nov 11 14:30:09 2016 (r308526) +++ head/sys/dev/smbus/smb.h Fri Nov 11 14:41:02 2016 (r308527) @@ -63,11 +63,10 @@ struct smbcmd { #define SMB_RECVB _IOWR('i', 4, struct smbcmd) #define SMB_WRITEB _IOW('i', 5, struct smbcmd) #define SMB_WRITEW _IOW('i', 6, struct smbcmd) -#define SMB_READB _IOW('i', 7, struct smbcmd) -#define SMB_READW _IOW('i', 8, struct smbcmd) -#define SMB_PCALL _IOW('i', 9, struct smbcmd) +#define SMB_READB _IOWR('i', 7, struct smbcmd) +#define SMB_READW _IOWR('i', 8, struct smbcmd) +#define SMB_PCALL _IOWR('i', 9, struct smbcmd) #define SMB_BWRITE _IOW('i', 10, struct smbcmd) -#define SMB_OLD_BREAD _IOW('i', 11, struct smbcmd) #define SMB_BREAD _IOWR('i', 11, struct smbcmd) #define SMB_OLD_TRANS _IOWR('i', 12, struct smbcmd) From owner-svn-src-all@freebsd.org Fri Nov 11 15:00:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14635C3B1B3; Fri, 11 Nov 2016 15:00:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C234A1149; Fri, 11 Nov 2016 15:00:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABF0ERZ075962; Fri, 11 Nov 2016 15:00:14 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABF0Eqi075961; Fri, 11 Nov 2016 15:00:14 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611111500.uABF0Eqi075961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 11 Nov 2016 15:00:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308528 - head/usr.sbin/smbmsg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 15:00:15 -0000 Author: avg Date: Fri Nov 11 15:00:13 2016 New Revision: 308528 URL: https://svnweb.freebsd.org/changeset/base/308528 Log: smbmsg: use a more convenient way of accessing data read from a slave Developers writing code for accessing /dev/smb may use this base utility as an example. Now that SMB_READB, SMB_READW, SMB_PCALL behave as documented, wwe can use them in a more convenient way than before. MFC after: 4 weeks X-MFC after: r308527 Modified: head/usr.sbin/smbmsg/smbmsg.c Modified: head/usr.sbin/smbmsg/smbmsg.c ============================================================================== --- head/usr.sbin/smbmsg/smbmsg.c Fri Nov 11 14:41:02 2016 (r308527) +++ head/usr.sbin/smbmsg/smbmsg.c Fri Nov 11 15:00:13 2016 (r308528) @@ -61,7 +61,7 @@ static int wflag; /* word IO */ static unsigned char ibuf[SMB_MAXBLOCKSIZE]; static unsigned char obuf[SMB_MAXBLOCKSIZE]; -static unsigned short oword, iword; +static unsigned short oword; /* * The I2C specs say that all addresses below 16 and above or equal @@ -135,6 +135,8 @@ do_io(void) c.slave = slave; c.cmd = cflag; + c.rcount = 0; + c.wcount = 0; if (fmt == NULL && iflag > 0) fmt = wflag? wordfmt: bytefmt; @@ -163,11 +165,9 @@ do_io(void) } if (iflag == 1 && oflag == -1) { /* command + 1 byte input: read byte op. */ - c.rbuf = ibuf; - c.rcount = iflag; if (ioctl(fd, SMB_READB, &c) == -1) return (-1); - printf(fmt, (int)(unsigned char)ibuf[0]); + printf(fmt, (unsigned char)c.rdata.byte); putchar('\n'); return (0); } else if (iflag == -1 && oflag == 1) { @@ -176,11 +176,9 @@ do_io(void) return (ioctl(fd, SMB_WRITEB, &c)); } else if (wflag && iflag == 2 && oflag == -1) { /* command + 2 bytes input: read word op. */ - c.rbuf = (char*) &iword; - c.rcount = iflag; if (ioctl(fd, SMB_READW, &c) == -1) return (-1); - printf(fmt, (int)(unsigned short)iword); + printf(fmt, (unsigned short)c.rdata.word); putchar('\n'); return (0); } else if (wflag && iflag == -1 && oflag == 2) { @@ -193,11 +191,9 @@ do_io(void) * "process call" op. */ c.wdata.word = oword; - c.rbuf = (char*) &iword; - c.rcount = iflag; if (ioctl(fd, SMB_PCALL, &c) == -1) return (-1); - printf(fmt, (int)(unsigned short)iword); + printf(fmt, (unsigned short)c.rdata.word); putchar('\n'); return (0); } else if (iflag > 1 && oflag == -1) { @@ -206,7 +202,7 @@ do_io(void) c.rcount = iflag; if (ioctl(fd, SMB_BREAD, &c) == -1) return (-1); - for (i = 0; i < iflag; i++) { + for (i = 0; i < c.rcount; i++) { if (i != 0) putchar(' '); printf(fmt, ibuf[i]); From owner-svn-src-all@freebsd.org Fri Nov 11 15:08:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5900AC3B4D4; Fri, 11 Nov 2016 15:08:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19B7318DB; Fri, 11 Nov 2016 15:08:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABF8Cmu080005; Fri, 11 Nov 2016 15:08:12 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABF8CR9080004; Fri, 11 Nov 2016 15:08:12 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611111508.uABF8CR9080004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 11 Nov 2016 15:08:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308529 - head/sys/dev/intpm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 15:08:13 -0000 Author: avg Date: Fri Nov 11 15:08:12 2016 New Revision: 308529 URL: https://svnweb.freebsd.org/changeset/base/308529 Log: intpm: clean up intsmb_bread and intsmb_pcall The hardware does not implement SMBus Process Call command, so remove ifdef-ed out code from intsmb_pcall. The code used exactly the same start sequence as for Write Word command. intsmb_bread code used to access an in value of the count parameter, but that parameter is supposed to be an out only parameter. For example, smb(4) does not initialize it before calling smbus_bread. MFC after: 3 weeks Modified: head/sys/dev/intpm/intpm.c Modified: head/sys/dev/intpm/intpm.c ============================================================================== --- head/sys/dev/intpm/intpm.c Fri Nov 11 15:00:13 2016 (r308528) +++ head/sys/dev/intpm/intpm.c Fri Nov 11 15:08:12 2016 (r308529) @@ -785,39 +785,11 @@ intsmb_readw(device_t dev, u_char slave, return (error); } -/* - * Data sheet claims that it implements all function, but also claims - * that it implements 7 function and not mention PCALL. So I don't know - * whether it will work. - */ static int intsmb_pcall(device_t dev, u_char slave, char cmd, short sdata, short *rdata) { -#ifdef PROCCALL_TEST - struct intsmb_softc *sc = device_get_softc(dev); - int error; - INTSMB_LOCK(sc); - error = intsmb_free(sc); - if (error) { - INTSMB_UNLOCK(sc); - return (error); - } - bus_write_1(sc->io_res, PIIX4_SMBHSTADD, slave & ~LSB); - bus_write_1(sc->io_res, PIIX4_SMBHSTCMD, cmd); - bus_write_1(sc->io_res, PIIX4_SMBHSTDAT0, sdata & 0xff); - bus_write_1(sc->io_res, PIIX4_SMBHSTDAT1, (sdata & 0xff) >> 8); - intsmb_start(sc, PIIX4_SMBHSTCNT_PROT_WDATA, 0); - error = intsmb_stop(sc); - if (error == 0) { - *rdata = bus_read_1(sc->io_res, PIIX4_SMBHSTDAT0); - *rdata |= bus_read_1(sc->io_res, PIIX4_SMBHSTDAT1) << 8; - } - INTSMB_UNLOCK(sc); - return (error); -#else return (SMB_ENOTSUPP); -#endif } static int @@ -857,9 +829,6 @@ intsmb_bread(device_t dev, u_char slave, int error, i; u_char data, nread; - if (*count > SMBBLOCKTRANS_MAX || *count == 0) - return (SMB_EINVAL); - INTSMB_LOCK(sc); error = intsmb_free(sc); if (error) { @@ -872,18 +841,14 @@ intsmb_bread(device_t dev, u_char slave, bus_write_1(sc->io_res, PIIX4_SMBHSTADD, slave | LSB); bus_write_1(sc->io_res, PIIX4_SMBHSTCMD, cmd); - bus_write_1(sc->io_res, PIIX4_SMBHSTDAT0, *count); intsmb_start(sc, PIIX4_SMBHSTCNT_PROT_BLOCK, 0); error = intsmb_stop(sc); if (error == 0) { nread = bus_read_1(sc->io_res, PIIX4_SMBHSTDAT0); if (nread != 0 && nread <= SMBBLOCKTRANS_MAX) { - for (i = 0; i < nread; i++) { - data = bus_read_1(sc->io_res, PIIX4_SMBBLKDAT); - if (i < *count) - buf[i] = data; - } *count = nread; + for (i = 0; i < nread; i++) + data = bus_read_1(sc->io_res, PIIX4_SMBBLKDAT); } else error = SMB_EBUSERR; } From owner-svn-src-all@freebsd.org Fri Nov 11 15:11:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0367AC3B638; Fri, 11 Nov 2016 15:11:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F2EE1DFC; Fri, 11 Nov 2016 15:11:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABFBscx081662; Fri, 11 Nov 2016 15:11:54 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABFBsbQ081661; Fri, 11 Nov 2016 15:11:54 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611111511.uABFBsbQ081661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 11 Nov 2016 15:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308530 - head/sys/dev/iicbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 15:11:56 -0000 Author: avg Date: Fri Nov 11 15:11:54 2016 New Revision: 308530 URL: https://svnweb.freebsd.org/changeset/base/308530 Log: iicsmb: SMB_MAXBLOCKSIZE can be used again The constant was set to the correct value in r308242. While there, fix iicsmb_bread() to not use a value of an out parameter 'count'. MFC after: 3 weeks X-MFC after: r308242 Modified: head/sys/dev/iicbus/iicsmb.c Modified: head/sys/dev/iicbus/iicsmb.c ============================================================================== --- head/sys/dev/iicbus/iicsmb.c Fri Nov 11 15:08:12 2016 (r308529) +++ head/sys/dev/iicbus/iicsmb.c Fri Nov 11 15:11:54 2016 (r308530) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "iicbus_if.h" @@ -432,7 +433,7 @@ iicsmb_bwrite(device_t dev, u_char slave }; int error; - if (count > 32 || count == 0) + if (count > SMB_MAXBLOCKSIZE || count == 0) return (SMB_EINVAL); error = TRANSFER_MSGS(dev, msgs); return (iic2smb_error(error)); @@ -450,12 +451,6 @@ iicsmb_bread(device_t dev, u_char slave, }; device_t parent = device_get_parent(dev); int error; - u_char bufsz; - - /* Stash output buffer size before overwriting it. */ - bufsz = *count; - if (bufsz == 0) - return (SMB_EINVAL); /* Have to do this because the command is split in two transfers. */ error = iicbus_request_bus(parent, dev, IIC_WAIT); @@ -465,18 +460,13 @@ iicsmb_bread(device_t dev, u_char slave, /* * If the slave offers an empty or a too long reply, * read one byte to generate the stop or abort. - * XXX 32 is hardcoded until SMB_MAXBLOCKSIZE is restored - * to sanity. */ - if (*count > 32 || *count == 0) + if (*count > SMB_MAXBLOCKSIZE || *count == 0) block_msg[0].len = 1; - /* If longer than the buffer, then clamp at the buffer size. */ - if (*count > bufsz) - block_msg[0].len = bufsz; else block_msg[0].len = *count; error = TRANSFER_MSGS(dev, block_msg); - if (*count > 32 || *count == 0) + if (*count > SMB_MAXBLOCKSIZE || *count == 0) error = SMB_EINVAL; } (void)iicbus_release_bus(parent, dev); From owner-svn-src-all@freebsd.org Fri Nov 11 15:13:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACCD6C3B85C; Fri, 11 Nov 2016 15:13:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E4B510B4; Fri, 11 Nov 2016 15:13:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABFDVnJ084023; Fri, 11 Nov 2016 15:13:31 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABFDUdM084010; Fri, 11 Nov 2016 15:13:30 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611111513.uABFDUdM084010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 11 Nov 2016 15:13:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308531 - in head/sys/arm: allwinner annapurna/alpine arm at91 broadcom/bcm2835 lpc mv rockchip ti/am335x versatile X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 15:13:32 -0000 Author: andrew Date: Fri Nov 11 15:13:30 2016 New Revision: 308531 URL: https://svnweb.freebsd.org/changeset/base/308531 Log: Use the modern spelling of ofw_bus_node_is_compatible in sys/arm. Sponsored by: ABT Systems Ltd Modified: head/sys/arm/allwinner/aw_ccu.c head/sys/arm/annapurna/alpine/alpine_machdep_mp.c head/sys/arm/arm/gic.c head/sys/arm/at91/at91_common.c head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c head/sys/arm/lpc/lpc_intc.c head/sys/arm/mv/gpio.c head/sys/arm/mv/mv_common.c head/sys/arm/mv/mv_machdep.c head/sys/arm/mv/mv_pci.c head/sys/arm/rockchip/rk30xx_gpio.c head/sys/arm/ti/am335x/am335x_lcd_syscons.c head/sys/arm/versatile/versatile_common.c Modified: head/sys/arm/allwinner/aw_ccu.c ============================================================================== --- head/sys/arm/allwinner/aw_ccu.c Fri Nov 11 15:11:54 2016 (r308530) +++ head/sys/arm/allwinner/aw_ccu.c Fri Nov 11 15:13:30 2016 (r308531) @@ -195,7 +195,7 @@ aw_ccu_search_compatible(void) root = OF_finddevice("/"); for (compat = compat_data; compat->ocd_str != NULL; compat++) - if (fdt_is_compatible(root, compat->ocd_str)) + if (ofw_bus_node_is_compatible(root, compat->ocd_str)) break; return (compat); Modified: head/sys/arm/annapurna/alpine/alpine_machdep_mp.c ============================================================================== --- head/sys/arm/annapurna/alpine/alpine_machdep_mp.c Fri Nov 11 15:11:54 2016 (r308530) +++ head/sys/arm/annapurna/alpine/alpine_machdep_mp.c Fri Nov 11 15:13:30 2016 (r308531) @@ -81,7 +81,7 @@ static boolean_t alpine_validate_cpu(u_i static boolean_t alpine_validate_cpu(u_int id, phandle_t child, u_int addr_cell, pcell_t *reg) { - return fdt_is_compatible(child, "arm,cortex-a15"); + return ofw_bus_node_is_compatible(child, "arm,cortex-a15"); } static int Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Fri Nov 11 15:11:54 2016 (r308530) +++ head/sys/arm/arm/gic.c Fri Nov 11 15:13:30 2016 (r308531) @@ -312,7 +312,7 @@ gic_decode_fdt(phandle_t iparent, pcell_ if (self == 0) { for (ocd = compat_data; ocd->ocd_str != NULL; ocd++) { - if (fdt_is_compatible(iparent, ocd->ocd_str)) { + if (ofw_bus_node_is_compatible(iparent, ocd->ocd_str)) { self = iparent; break; } Modified: head/sys/arm/at91/at91_common.c ============================================================================== --- head/sys/arm/at91/at91_common.c Fri Nov 11 15:11:54 2016 (r308530) +++ head/sys/arm/at91/at91_common.c Fri Nov 11 15:13:30 2016 (r308531) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include @@ -56,7 +57,7 @@ fdt_aic_decode_ic(phandle_t node, pcell_ { int offset; - if (fdt_is_compatible(node, "atmel,at91rm9200-aic")) + if (ofw_bus_node_is_compatible(node, "atmel,at91rm9200-aic")) offset = 0; else return (ENXIO); Modified: head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Fri Nov 11 15:11:54 2016 (r308530) +++ head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Fri Nov 11 15:13:30 2016 (r308531) @@ -1261,7 +1261,7 @@ bcm2835_cpufreq_identify(driver_t *drive root = OF_finddevice("/"); for (compat = compat_data; compat->ocd_str != NULL; compat++) - if (fdt_is_compatible(root, compat->ocd_str)) + if (ofw_bus_node_is_compatible(root, compat->ocd_str)) break; if (compat->ocd_data == 0) Modified: head/sys/arm/lpc/lpc_intc.c ============================================================================== --- head/sys/arm/lpc/lpc_intc.c Fri Nov 11 15:11:54 2016 (r308530) +++ head/sys/arm/lpc/lpc_intc.c Fri Nov 11 15:13:30 2016 (r308531) @@ -232,7 +232,7 @@ static int fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, int *pol) { - if (!fdt_is_compatible(node, "lpc,pic")) + if (!ofw_bus_node_is_compatible(node, "lpc,pic")) return (ENXIO); *interrupt = fdt32_to_cpu(intr[0]); Modified: head/sys/arm/mv/gpio.c ============================================================================== --- head/sys/arm/mv/gpio.c Fri Nov 11 15:11:54 2016 (r308530) +++ head/sys/arm/mv/gpio.c Fri Nov 11 15:13:30 2016 (r308531) @@ -643,7 +643,7 @@ mv_gpio_init(void) */ ctrl = OF_node_from_xref(fdt32_to_cpu(gpios[0])); - if (fdt_is_compatible(ctrl, e->compat)) + if (ofw_bus_node_is_compatible(ctrl, e->compat)) /* Call a handler. */ if ((rv = e->handler(ctrl, (pcell_t *)&gpios, len))) Modified: head/sys/arm/mv/mv_common.c ============================================================================== --- head/sys/arm/mv/mv_common.c Fri Nov 11 15:11:54 2016 (r308530) +++ head/sys/arm/mv/mv_common.c Fri Nov 11 15:13:30 2016 (r308531) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -230,7 +231,8 @@ fdt_pm(phandle_t node) if (dev_mask & (1 << i)) continue; - compat = fdt_is_compatible(node, fdt_pm_mask_table[i].compat); + compat = ofw_bus_node_is_compatible(node, + fdt_pm_mask_table[i].compat); #if defined(SOC_MV_KIRKWOOD) if (compat && (cpu_pm_ctrl & fdt_pm_mask_table[i].mask)) { dev_mask |= (1 << i); @@ -2092,7 +2094,7 @@ win_cpu_from_dt(void) * Retrieve CESA SRAM data. */ if ((node = OF_finddevice("sram")) != -1) - if (fdt_is_compatible(node, "mrvl,cesa-sram")) + if (ofw_bus_node_is_compatible(node, "mrvl,cesa-sram")) goto moveon; if ((node = OF_finddevice("/")) == 0) @@ -2120,7 +2122,7 @@ moveon: /* Check if there is a second CESA node */ while ((node = OF_peer(node)) != 0) { - if (fdt_is_compatible(node, "mrvl,cesa-sram")) { + if (ofw_bus_node_is_compatible(node, "mrvl,cesa-sram")) { if (fdt_regsize(node, &sram_base, &sram_size) != 0) return (EINVAL); break; @@ -2170,7 +2172,7 @@ fdt_win_setup(void) soc_node = &soc_nodes[i]; - if (!fdt_is_compatible(child, soc_node->compat)) + if (!ofw_bus_node_is_compatible(child,soc_node->compat)) continue; err = fdt_regsize(child, &base, &size); @@ -2319,8 +2321,8 @@ fdt_pic_decode_ic(phandle_t node, pcell_ int *pol) { - if (!fdt_is_compatible(node, "mrvl,pic") && - !fdt_is_compatible(node, "mrvl,mpic")) + if (!ofw_bus_node_is_compatible(node, "mrvl,pic") && + !ofw_bus_node_is_compatible(node, "mrvl,mpic")) return (ENXIO); *interrupt = fdt32_to_cpu(intr[0]); Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Fri Nov 11 15:11:54 2016 (r308530) +++ head/sys/arm/mv/mv_machdep.c Fri Nov 11 15:13:30 2016 (r308531) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include static int platform_mpp_init(void); #if defined(SOC_MV_ARMADAXP) @@ -103,7 +104,7 @@ platform_mpp_init(void) * Try to access the MPP node directly i.e. through /aliases/mpp. */ if ((node = OF_finddevice("mpp")) != -1) - if (fdt_is_compatible(node, "mrvl,mpp")) + if (ofw_bus_node_is_compatible(node, "mrvl,mpp")) goto moveon; /* * Find the node the long way. @@ -290,8 +291,8 @@ platform_sram_devmap(struct devmap_entry * SRAM range. */ if ((child = OF_finddevice("/sram")) != 0) - if (fdt_is_compatible(child, "mrvl,cesa-sram") || - fdt_is_compatible(child, "mrvl,scratchpad")) + if (ofw_bus_node_is_compatible(child, "mrvl,cesa-sram") || + ofw_bus_node_is_compatible(child, "mrvl,scratchpad")) goto moveon; if ((root = OF_finddevice("/")) == 0) @@ -406,7 +407,7 @@ platform_devmap_init(void) i += 2; } - if (fdt_is_compatible(child, "mrvl,lbc")) { + if (ofw_bus_node_is_compatible(child, "mrvl,lbc")) { /* Check available space */ if (OF_getprop(child, "bank-count", (void *)&bank_count, sizeof(bank_count)) <= 0) Modified: head/sys/arm/mv/mv_pci.c ============================================================================== --- head/sys/arm/mv/mv_pci.c Fri Nov 11 15:11:54 2016 (r308530) +++ head/sys/arm/mv/mv_pci.c Fri Nov 11 15:13:30 2016 (r308531) @@ -429,12 +429,12 @@ mv_pcib_attach(device_t self) node = ofw_bus_get_node(self); parnode = OF_parent(node); - if (fdt_is_compatible(node, "mrvl,pcie")) { + if (ofw_bus_node_is_compatible(node, "mrvl,pcie")) { sc->sc_type = MV_TYPE_PCIE; sc->sc_win_target = MV_WIN_PCIE_TARGET(unit); sc->sc_mem_win_attr = MV_WIN_PCIE_MEM_ATTR(unit); sc->sc_io_win_attr = MV_WIN_PCIE_IO_ATTR(unit); - } else if (fdt_is_compatible(node, "mrvl,pci")) { + } else if (ofw_bus_node_is_compatible(node, "mrvl,pci")) { sc->sc_type = MV_TYPE_PCI; sc->sc_win_target = MV_WIN_PCI_TARGET; sc->sc_mem_win_attr = MV_WIN_PCI_MEM_ATTR; Modified: head/sys/arm/rockchip/rk30xx_gpio.c ============================================================================== --- head/sys/arm/rockchip/rk30xx_gpio.c Fri Nov 11 15:11:54 2016 (r308530) +++ head/sys/arm/rockchip/rk30xx_gpio.c Fri Nov 11 15:13:30 2016 (r308531) @@ -614,7 +614,7 @@ rk30_gpio_init(void) */ ctrl = OF_node_from_xref(fdt32_to_cpu(gpios[0])); - if (fdt_is_compatible(ctrl, e->compat)) + if (ofw_bus_node_is_compatible(ctrl, e->compat)) /* Call a handler. */ if ((rv = e->handler(ctrl, (pcell_t *)&gpios, len))) Modified: head/sys/arm/ti/am335x/am335x_lcd_syscons.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_lcd_syscons.c Fri Nov 11 15:11:54 2016 (r308530) +++ head/sys/arm/ti/am335x/am335x_lcd_syscons.c Fri Nov 11 15:13:30 2016 (r308531) @@ -351,7 +351,7 @@ am335x_syscons_find_panel_node(phandle_t phandle_t result; for (child = OF_child(start); child != 0; child = OF_peer(child)) { - if (fdt_is_compatible(child, "ti,am335x-lcd")) + if (ofw_bus_node_is_compatible(child, "ti,am335x-lcd")) return (child); if ((result = am335x_syscons_find_panel_node(child))) return (result); Modified: head/sys/arm/versatile/versatile_common.c ============================================================================== --- head/sys/arm/versatile/versatile_common.c Fri Nov 11 15:11:54 2016 (r308530) +++ head/sys/arm/versatile/versatile_common.c Fri Nov 11 15:13:30 2016 (r308531) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -52,7 +53,7 @@ fdt_intc_decode_ic(phandle_t node, pcell int *pol) { - if (!fdt_is_compatible(node, "arm,versatile-vic")) + if (!ofw_bus_node_is_compatible(node, "arm,versatile-vic")) return (ENXIO); *interrupt = fdt32_to_cpu(intr[0]); From owner-svn-src-all@freebsd.org Fri Nov 11 15:16:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C4C9C3B930; Fri, 11 Nov 2016 15:16:38 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F273312C1; Fri, 11 Nov 2016 15:16:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABFGbLE084180; Fri, 11 Nov 2016 15:16:37 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABFGbHr084179; Fri, 11 Nov 2016 15:16:37 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611111516.uABFGbHr084179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 11 Nov 2016 15:16:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308532 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 15:16:38 -0000 Author: avg Date: Fri Nov 11 15:16:37 2016 New Revision: 308532 URL: https://svnweb.freebsd.org/changeset/base/308532 Log: update SMB_BWRITE documentation, clarify SMB_BREAD After removal of SMB_TRANS some information in the description of SMB_BWRITE has become stale. E.g., the maximum block size has been restored to 32. Also, the descriptions of SMB_BREAD and SMB_BWRITE had some incorrect information on the SMBus protocol details. MFC after: 1 week X-MFC with: r308242 Differential Revision: https://reviews.freebsd.org/D8431 Modified: head/share/man/man4/smb.4 Modified: head/share/man/man4/smb.4 ============================================================================== --- head/share/man/man4/smb.4 Fri Nov 11 15:13:30 2016 (r308531) +++ head/share/man/man4/smb.4 Fri Nov 11 15:16:37 2016 (r308532) @@ -141,26 +141,25 @@ in .Em BlockWrite first sends the byte from .Fa cmd -to the device, followed by +to the device, then the byte from +.Fa wcount +followed by .Fa wcount bytes of data that are taken from the buffer pointed to by .Fa wbuf . The SMBus specification mandates that no more than 32 bytes of -data can be transferred in a single block read or write command, -but since -.Xr smbus 4 -is also used to access I2C devices, the limit has been increased -to 1024. +data can be transferred in a single block read or write command. This value can be read from the constant .Dv SMB_MAXBLOCKSIZE . .It Dv SMB_BREAD Ta .Em BlockRead first sends the byte from .Fa cmd -to the device, then reads -.Fa rcount -bytes of data that from the device. -This data is returned in the buffer pointed to by +to the device, then reads a count of data bytes that the device +is going to provide and then reads that many bytes. +The count is returned in +.Fa rcount. +The data is returned in the buffer pointed to by .Fa rbuf . .El .Pp From owner-svn-src-all@freebsd.org Fri Nov 11 15:42:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11844C3A215; Fri, 11 Nov 2016 15:42:14 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B97CA12E1; Fri, 11 Nov 2016 15:42:13 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABFgCt5095620; Fri, 11 Nov 2016 15:42:12 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABFgCsZ095617; Fri, 11 Nov 2016 15:42:12 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611111542.uABFgCsZ095617@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 11 Nov 2016 15:42:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308533 - in head/sys/dev: fdt uart usb/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 15:42:14 -0000 Author: andrew Date: Fri Nov 11 15:42:12 2016 New Revision: 308533 URL: https://svnweb.freebsd.org/changeset/base/308533 Log: Use ofw_bus_node_is_compatible in more drivers used on arm. Sponsored by: ABT Systems Ltd Modified: head/sys/dev/fdt/fdt_arm_platform.c head/sys/dev/uart/uart_bus_fdt.c head/sys/dev/usb/net/if_smsc.c Modified: head/sys/dev/fdt/fdt_arm_platform.c ============================================================================== --- head/sys/dev/fdt/fdt_arm_platform.c Fri Nov 11 15:16:37 2016 (r308532) +++ head/sys/dev/fdt/fdt_arm_platform.c Fri Nov 11 15:42:12 2016 (r308533) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "platform_if.h" @@ -58,7 +59,7 @@ fdt_platform_probe(platform_t plat) /* Is the device is compatible? */ root = OF_finddevice("/"); compat = FDT_PLATFORM(plat)->fdt_compatible; - if (fdt_is_compatible(root, compat) != 0) + if (ofw_bus_node_is_compatible(root, compat) != 0) return 0; /* Not compatible, return an error */ Modified: head/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- head/sys/dev/uart/uart_bus_fdt.c Fri Nov 11 15:16:37 2016 (r308532) +++ head/sys/dev/uart/uart_bus_fdt.c Fri Nov 11 15:42:12 2016 (r308533) @@ -123,7 +123,7 @@ uart_fdt_find_compatible(phandle_t node, const struct ofw_compat_data *ocd; for (ocd = cd; ocd->ocd_str != NULL; ocd++) { - if (fdt_is_compatible(node, ocd->ocd_str)) + if (ofw_bus_node_is_compatible(node, ocd->ocd_str)) return (ocd); } return (NULL); Modified: head/sys/dev/usb/net/if_smsc.c ============================================================================== --- head/sys/dev/usb/net/if_smsc.c Fri Nov 11 15:16:37 2016 (r308532) +++ head/sys/dev/usb/net/if_smsc.c Fri Nov 11 15:42:12 2016 (r308533) @@ -1566,8 +1566,8 @@ smsc_fdt_find_eth_node(phandle_t start) /* Traverse through entire tree to find usb ethernet nodes. */ for (node = OF_child(start); node != 0; node = OF_peer(node)) { - if (fdt_is_compatible(node, "net,ethernet") && - fdt_is_compatible(node, "usb,device")) + if (ofw_bus_node_is_compatible(node, "net,ethernet") && + ofw_bus_node_is_compatible(node, "usb,device")) return (node); child = smsc_fdt_find_eth_node(node); if (child != -1) From owner-svn-src-all@freebsd.org Fri Nov 11 16:59:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3846CC3B61C; Fri, 11 Nov 2016 16:59:27 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A15819A0; Fri, 11 Nov 2016 16:59:26 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABGxQDj023893; Fri, 11 Nov 2016 16:59:26 GMT (envelope-from stevek@FreeBSD.org) Received: (from stevek@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABGxQ74023892; Fri, 11 Nov 2016 16:59:26 GMT (envelope-from stevek@FreeBSD.org) Message-Id: <201611111659.uABGxQ74023892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: stevek set sender to stevek@FreeBSD.org using -f From: "Stephen J. Kiernan" Date: Fri, 11 Nov 2016 16:59:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308534 - head/sys/boot/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 16:59:27 -0000 Author: stevek Date: Fri Nov 11 16:59:26 2016 New Revision: 308534 URL: https://svnweb.freebsd.org/changeset/base/308534 Log: The file_loadraw function grew an argument, update install function accordingly. Reviewed by: imp Approved by: sjg (mentor) MFC after: 2 weeks Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D8494 Modified: head/sys/boot/common/install.c Modified: head/sys/boot/common/install.c ============================================================================== --- head/sys/boot/common/install.c Fri Nov 11 15:42:12 2016 (r308533) +++ head/sys/boot/common/install.c Fri Nov 11 16:59:26 2016 (r308534) @@ -286,7 +286,7 @@ install(char *pkgname) } s = (inst_rootfs == NULL) ? "/install.iso" : inst_rootfs; - if (file_loadraw(s, "mfs_root") == NULL) { + if (file_loadraw(s, "mfs_root", 1) == NULL) { error = errno; command_errmsg = "cannot load root file system"; goto fail; From owner-svn-src-all@freebsd.org Fri Nov 11 17:08:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D68DC3BBDE for ; Fri, 11 Nov 2016 17:08:51 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x235.google.com (mail-it0-x235.google.com [IPv6:2607:f8b0:4001:c0b::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EE3191093 for ; Fri, 11 Nov 2016 17:08:50 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x235.google.com with SMTP id q124so134159558itd.1 for ; Fri, 11 Nov 2016 09:08:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=inzpxZ/Ntzrs7WGulQ5IOEftR0CLuWDt7gPmI3O06lQ=; b=zM9s5gvSUbEuds43QVrdDXWqijuoCKiVZHfFQwKRNSQnmFB6Uh/2RtoLFoAD472Wgk HnoCrTJi18vmijSaQIuQbD9P5kyf6yDq46ipkIu21xQS5m0937lP+sErwXGwJn7AjMUY B8RX8tNMN7T54/ZH2gRA1APbSr/SIQDKQ+eUaeOTdhQWuP5vdCKS1VRDMwb5bhJQqY4R NkwzEyeWO3fWLI0Ec3/QZ7+gMeOHBIzwbxkjQTtEeMlwVUZj4+oQ320hDaF6OUFXD+MS OgpKKZx9a5RTDa2b+SFoa2LZFp4JgTJgv1zMYn+2X0GuYDcYQYYBRkAoPCJr0WdVrUNF dIcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=inzpxZ/Ntzrs7WGulQ5IOEftR0CLuWDt7gPmI3O06lQ=; b=HpLkFJLQ4cYgWtACafWCxMBQHo4pTlWCzKHU7of8Uq5uB9i5iAQQsVAZCFN3dpffGp mmSZHKmXH2a1x7ltdf2BgD8Z1+rT5V9xhGcVfGcdn8BWUEx4HvhgcIXSDfe1CpxLdu/1 K7uuBXMWyDZw7YpSNhugB4EG3waP0NiSPtuIMHgnY6U/MvPo786DnE/LjQhcCd8y6dbf C5O/llaMpBdYcSu53NRjh+mS816lztjw3JDPb8ugaj7ACjEbeIG6+IkgrRE2w2KXcjN6 ydms/9E9AFbHPUY8E9PTDKfu/vHvAWSVB1RoZk7iHtt69kw035Q/SCr4DJmPkYT4oB4y e+/w== X-Gm-Message-State: ABUngvc1nmSa7cvNnnghbf7lYMTRNjVm30j4budTcHdrmiuYFJekGzYGpNK+WrYROD60UsacgiJJLRJGWLv5fQ== X-Received: by 10.107.132.74 with SMTP id g71mr12928467iod.19.1478884128965; Fri, 11 Nov 2016 09:08:48 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.134.66 with HTTP; Fri, 11 Nov 2016 09:08:47 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: References: <201611080650.uA86oJ7W056026@repo.freebsd.org> <8E0E5C94-EFD7-4008-B563-FF080A98F23D@me.com> From: Warner Losh Date: Fri, 11 Nov 2016 10:08:47 -0700 X-Google-Sender-Auth: H1oKtb4qlVm9Y56Zd9EYjrYJIkA Message-ID: Subject: Re: svn commit: r308434 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sys... To: Kamil Czekirda Cc: Toomas Soome , Toomas Soome , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 17:08:51 -0000 This suggests we've created an update / upgrade problem. Do we? Warner On Thu, Nov 10, 2016 at 11:52 PM, Kamil Czekirda wrot= e: > cp /usr/src/lib/libstand/libstand.h /usr/include/stand.h fixed that > > thanks > > 2016-11-10 23:28 GMT+01:00 Toomas Soome : >> >> the patch does update the lib/libstand/stand.h to have: >> >> struct devsw { >> . . . >> int (*dv_print)(int verbose); >> >> it was void before; from your svnlite log I can see the >> lib/libstand/stand.h is updated, could you confirm if it is int now? if = it >> is, I suspect the build is getting the old stand.h from somewhere in the >> tree and not your /lib/libstand. >> >> if so, does the build has target to copy headers in place? I=E2=80=99m s= orry, I >> don't know all the tricks the build system does as part of the buildworl= d.. >> >> rgds, >> toomas >> >> >> On 11. nov 2016, at 0:21, Kamil Czekirda wrote: >> >> Hi, >> >> I got the following: >> >> root@current:/usr/src # svnlite up -r r308434 >> Updating '.': >> U lib/libstand/stand.h >> U sys/boot/common/dev_net.c >> U sys/boot/common/module.c >> U sys/boot/common/part.c >> U sys/boot/common/util.c >> U sys/boot/common/util.h >> U sys/boot/efi/libefi/efinet.c >> U sys/boot/efi/libefi/efipart.c >> U sys/boot/efi/loader/main.c >> U sys/boot/i386/libfirewire/firewire.c >> U sys/boot/i386/libi386/bioscd.c >> U sys/boot/i386/libi386/biosdisk.c >> U sys/boot/mips/beri/loader/beri_disk_cfi.c >> U sys/boot/mips/beri/loader/beri_disk_sdcard.c >> U sys/boot/ofw/libofw/ofw_disk.c >> U sys/boot/pc98/libpc98/bioscd.c >> U sys/boot/pc98/libpc98/biosdisk.c >> U sys/boot/powerpc/kboot/hostdisk.c >> U sys/boot/powerpc/ps3/ps3cdrom.c >> U sys/boot/powerpc/ps3/ps3disk.c >> U sys/boot/uboot/lib/disk.c >> U sys/boot/usb/storage/umass_loader.c >> U sys/boot/userboot/userboot/host.c >> U sys/boot/userboot/userboot/userboot_disk.c >> U sys/boot/zfs/zfs.c >> U sys/boot/zfs/zfsimpl.c >> U sys/boot/i386/libi386/pxe.c >> Updated to revision 308434. >> root@current:/usr/src # cd sys/boot/ >> root@current:/usr/src/sys/boot # make clean >> (...) >> root@current:/usr/src/sys/boot # make obj >> (...) >> root@current:/usr/src/sys/boot # make >> (...) >> cc -O2 -pipe -DSKEIN_LOOP=3D111 -fPIC -I/usr/src/sys/boot/efi/loader >> -I/usr/src/sys/boot/efi/loader/arch/amd64 >> -I/usr/src/sys/boot/efi/loader/../include >> -I/usr/src/sys/boot/efi/loader/../include/amd64 >> -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include >> -I/usr/src/sys/boot/efi/loader/../../.. >> -I/usr/src/sys/boot/efi/loader/../../i386/libi386 >> -I/usr/src/sys/boot/efi/loader/../../zfs >> -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs >> -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT -DNO= _PCI >> -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH >> -I/usr/src/sys/boot/efi/loader/../../ficl >> -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 -DLOADER_DISK_SUPPORT >> -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC -I/usr/src/sys/boot/ficl >> -I/usr/src/sys/boot/ficl/amd64 -I/usr/src/sys/boot/ficl/../common >> -I/usr/src/sys/boot/efi/loader/../../common -ffreestanding -Wformat >> -msoft-float -mno-mmx -mno-sse -mno-avx -fshort-wchar -mno-red-zone -mno= -aes >> -g -MD -MF.depend.vers.o -MTvers.o -std=3Dgnu99 -Wsystem-headers -Werro= r >> -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes >> -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sig= n >> -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable >> -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality >> -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef >> -Qunused-arguments -c vers.c -o vers.o >> cc -O2 -pipe -DSKEIN_LOOP=3D111 -fPIC -I/usr/src/sys/boot/efi/loader >> -I/usr/src/sys/boot/efi/loader/arch/amd64 >> -I/usr/src/sys/boot/efi/loader/../include >> -I/usr/src/sys/boot/efi/loader/../include/amd64 >> -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include >> -I/usr/src/sys/boot/efi/loader/../../.. >> -I/usr/src/sys/boot/efi/loader/../../i386/libi386 >> -I/usr/src/sys/boot/efi/loader/../../zfs >> -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs >> -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT -DNO= _PCI >> -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH >> -I/usr/src/sys/boot/efi/loader/../../ficl >> -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 -DLOADER_DISK_SUPPORT >> -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC -I/usr/src/sys/boot/ficl >> -I/usr/src/sys/boot/ficl/amd64 -I/usr/src/sys/boot/ficl/../common >> -I/usr/src/sys/boot/efi/loader/../../common -ffreestanding -Wformat >> -msoft-float -mno-mmx -mno-sse -mno-avx -fshort-wchar -mno-red-zone -mno= -aes >> -g -MD -MF.depend.zfs.o -MTzfs.o -std=3Dgnu99 -Wsystem-headers -Werror = -Wall >> -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes >> -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sig= n >> -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable >> -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality >> -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef >> -Wno-sign-compare -Wno-array-bounds -Wno-missing-prototypes >> -Qunused-arguments -c /usr/src/sys/boot/efi/loader/../../zfs/zfs.c -o z= fs.o >> /usr/src/sys/boot/efi/loader/../../zfs/zfs.c:599:14: error: incompatible >> pointer types initializing 'void (*)(int)' with an expression of type 'i= nt >> (int)' [-Werror,-Wincompatible-pointer-types] >> .dv_print =3D zfs_dev_print, >> ^~~~~~~~~~~~~ >> 1 error generated. >> *** Error code 1 >> >> Stop. >> make[2]: stopped in /usr/src/sys/boot/efi/loader >> *** Error code 1 >> >> Stop. >> make[1]: stopped in /usr/src/sys/boot/efi >> *** Error code 1 >> >> Stop. >> make: stopped in /usr/src/sys/boot >> >> >> Kamil >> >> 2016-11-08 7:50 GMT+01:00 Toomas Soome : >>> >>> Author: tsoome >>> Date: Tue Nov 8 06:50:18 2016 >>> New Revision: 308434 >>> URL: https://svnweb.freebsd.org/changeset/base/308434 >>> >>> Log: >>> Loader paged/pageable data is not always paged. >>> >>> This change does modify devsw dv_print() to return the int value, >>> enabling walkers to interrupt the walk on non zero value from >>> dv_print(). >>> >>> This will allow the pager_print actually to stop displaying data on >>> user input, and additionally pager is used in various *dev_print >>> callbacks, >>> where it was missing. >>> >>> For test, lsdev [-v] command should display data by screenfuls and >>> should >>> stop when the key 'q' is pressed on pager prompt. >>> >>> Reviewed by: allanjude >>> Approved by: allanjude (mentor) >>> Differential Revision: https://reviews.freebsd.org/D5461 >>> >>> Modified: >>> head/lib/libstand/stand.h >>> head/sys/boot/common/dev_net.c >>> head/sys/boot/common/module.c >>> head/sys/boot/common/part.c >>> head/sys/boot/common/util.c >>> head/sys/boot/common/util.h >>> head/sys/boot/efi/libefi/efinet.c >>> head/sys/boot/efi/libefi/efipart.c >>> head/sys/boot/efi/loader/main.c >>> head/sys/boot/i386/libfirewire/firewire.c >>> head/sys/boot/i386/libi386/bioscd.c >>> head/sys/boot/i386/libi386/biosdisk.c >>> head/sys/boot/i386/libi386/pxe.c >>> head/sys/boot/mips/beri/loader/beri_disk_cfi.c >>> head/sys/boot/mips/beri/loader/beri_disk_sdcard.c >>> head/sys/boot/ofw/libofw/ofw_disk.c >>> head/sys/boot/pc98/libpc98/bioscd.c >>> head/sys/boot/pc98/libpc98/biosdisk.c >>> head/sys/boot/powerpc/kboot/hostdisk.c >>> head/sys/boot/powerpc/ps3/ps3cdrom.c >>> head/sys/boot/powerpc/ps3/ps3disk.c >>> head/sys/boot/uboot/lib/disk.c >>> head/sys/boot/usb/storage/umass_loader.c >>> head/sys/boot/userboot/userboot/host.c >>> head/sys/boot/userboot/userboot/userboot_disk.c >>> head/sys/boot/zfs/zfs.c >>> head/sys/boot/zfs/zfsimpl.c >>> >>> Modified: head/lib/libstand/stand.h >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/lib/libstand/stand.h Tue Nov 8 06:13:22 2016 (r30843= 3) >>> +++ head/lib/libstand/stand.h Tue Nov 8 06:50:18 2016 (r30843= 4) >>> @@ -143,7 +143,7 @@ struct devsw { >>> int (*dv_open)(struct open_file *f, ...); >>> int (*dv_close)(struct open_file *f); >>> int (*dv_ioctl)(struct open_file *f, u_long cmd, vo= id >>> *data); >>> - void (*dv_print)(int verbose); /* print device >>> information */ >>> + int (*dv_print)(int verbose); /* print device >>> information */ >>> void (*dv_cleanup)(void); >>> }; >>> >>> >>> Modified: head/sys/boot/common/dev_net.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/common/dev_net.c Tue Nov 8 06:13:22 2016 >>> (r308433) >>> +++ head/sys/boot/common/dev_net.c Tue Nov 8 06:50:18 2016 >>> (r308434) >>> @@ -80,7 +80,7 @@ static int net_open(struct open_file *, >>> static int net_close(struct open_file *); >>> static void net_cleanup(void); >>> static int net_strategy(); >>> -static void net_print(int); >>> +static int net_print(int); >>> >>> static int net_getparams(int sock); >>> >>> @@ -325,23 +325,27 @@ exit: >>> return (0); >>> } >>> >>> -static void >>> +static int >>> net_print(int verbose) >>> { >>> struct netif_driver *drv; >>> int i, d, cnt; >>> + int ret =3D 0; >>> >>> cnt =3D 0; >>> for (d =3D 0; netif_drivers[d]; d++) { >>> drv =3D netif_drivers[d]; >>> for (i =3D 0; i < drv->netif_nifs; i++) { >>> printf("\t%s%d:", "net", cnt++); >>> - if (verbose) >>> + if (verbose) { >>> printf(" (%s%d)", drv->netif_bname, >>> drv->netif_ifs[i].dif_unit); >>> + } >>> + if ((ret =3D pager_output("\n")) !=3D 0) >>> + return (ret); >>> } >>> } >>> - printf("\n"); >>> + return (ret); >>> } >>> >>> /* >>> >>> Modified: head/sys/boot/common/module.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/common/module.c Tue Nov 8 06:13:22 2016 >>> (r308433) >>> +++ head/sys/boot/common/module.c Tue Nov 8 06:50:18 2016 >>> (r308434) >>> @@ -254,7 +254,7 @@ command_lsmod(int argc, char *argv[]) >>> struct kernel_module *mp; >>> struct file_metadata *md; >>> char lbuf[80]; >>> - int ch, verbose; >>> + int ch, verbose, ret =3D 0; >>> >>> verbose =3D 0; >>> optind =3D 1; >>> @@ -273,11 +273,13 @@ command_lsmod(int argc, char *argv[]) >>> >>> pager_open(); >>> for (fp =3D preloaded_files; fp; fp =3D fp->f_next) { >>> - sprintf(lbuf, " %p: ", (void *) fp->f_addr); >>> + snprintf(lbuf, sizeof(lbuf), " %p: ", (void *) fp->f_addr); >>> pager_output(lbuf); >>> pager_output(fp->f_name); >>> - sprintf(lbuf, " (%s, 0x%lx)\n", fp->f_type, (long)fp->f_size); >>> - pager_output(lbuf); >>> + snprintf(lbuf, sizeof(lbuf), " (%s, 0x%lx)\n", fp->f_type, >>> + (long)fp->f_size); >>> + if (pager_output(lbuf)) >>> + break; >>> if (fp->f_args !=3D NULL) { >>> pager_output(" args: "); >>> pager_output(fp->f_args); >>> @@ -287,7 +289,8 @@ command_lsmod(int argc, char *argv[]) >>> if (fp->f_modules) { >>> pager_output(" modules: "); >>> for (mp =3D fp->f_modules; mp; mp =3D mp->m_next) { >>> - sprintf(lbuf, "%s.%d ", mp->m_name, mp->m_version); >>> + snprintf(lbuf, sizeof(lbuf), "%s.%d ", mp->m_name, >>> + mp->m_version); >>> pager_output(lbuf); >>> } >>> if (pager_output("\n")) >>> @@ -296,11 +299,14 @@ command_lsmod(int argc, char *argv[]) >>> if (verbose) { >>> /* XXX could add some formatting smarts here to display som= e >>> better */ >>> for (md =3D fp->f_metadata; md !=3D NULL; md =3D md->md_nex= t) { >>> - sprintf(lbuf, " 0x%04x, 0x%lx\n", md->md_type, >>> (long) md->md_size); >>> + snprintf(lbuf, sizeof(lbuf), " 0x%04x, 0x%lx\n", >>> + md->md_type, (long) md->md_size); >>> if (pager_output(lbuf)) >>> break; >>> } >>> } >>> + if (ret) >>> + break; >>> } >>> pager_close(); >>> return(CMD_OK); >>> >>> Modified: head/sys/boot/common/part.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/common/part.c Tue Nov 8 06:13:22 2016 (r30843= 3) >>> +++ head/sys/boot/common/part.c Tue Nov 8 06:50:18 2016 (r30843= 4) >>> @@ -834,6 +834,7 @@ ptable_iterate(const struct ptable *tabl >>> { >>> struct pentry *entry; >>> char name[32]; >>> + int ret =3D 0; >>> >>> name[0] =3D '\0'; >>> STAILQ_FOREACH(entry, &table->entries, entry) { >>> @@ -856,9 +857,8 @@ ptable_iterate(const struct ptable *tabl >>> if (table->type =3D=3D PTABLE_BSD) >>> sprintf(name, "%c", (u_char) 'a' + >>> entry->part.index); >>> - if (iter(arg, name, &entry->part)) >>> - return 1; >>> + if ((ret =3D iter(arg, name, &entry->part)) !=3D 0) >>> + return (ret); >>> } >>> - return 0; >>> + return (ret); >>> } >>> - >>> >>> Modified: head/sys/boot/common/util.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/common/util.c Tue Nov 8 06:13:22 2016 (r30843= 3) >>> +++ head/sys/boot/common/util.c Tue Nov 8 06:50:18 2016 (r30843= 4) >>> @@ -114,7 +114,7 @@ strlen(const char *s) >>> return (len); >>> } >>> >>> -void >>> +int >>> printf(const char *fmt, ...) >>> { >>> va_list ap; >>> @@ -178,4 +178,5 @@ nextfmt: >>> } >>> } >>> va_end(ap); >>> + return (0); >>> } >>> >>> Modified: head/sys/boot/common/util.h >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/common/util.h Tue Nov 8 06:13:22 2016 (r30843= 3) >>> +++ head/sys/boot/common/util.h Tue Nov 8 06:50:18 2016 (r30843= 4) >>> @@ -48,6 +48,6 @@ void strcat(char *dst, const char *src); >>> char *strchr(const char *s, char ch); >>> size_t strlen(const char *s); >>> >>> -void printf(const char *fmt, ...); >>> +int printf(const char *fmt, ...); >>> >>> #endif /* !_UTIL_H_ */ >>> >>> Modified: head/sys/boot/efi/libefi/efinet.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/efi/libefi/efinet.c Tue Nov 8 06:13:22 2016 >>> (r308433) >>> +++ head/sys/boot/efi/libefi/efinet.c Tue Nov 8 06:50:18 2016 >>> (r308434) >>> @@ -252,7 +252,7 @@ efinet_end(struct netif *nif) >>> } >>> >>> static int efinet_dev_init(void); >>> -static void efinet_dev_print(int); >>> +static int efinet_dev_print(int); >>> >>> struct devsw efinet_dev =3D { >>> .dv_name =3D "net", >>> @@ -346,14 +346,13 @@ efinet_dev_init() >>> return (0); >>> } >>> >>> -static void >>> +static int >>> efinet_dev_print(int verbose) >>> { >>> CHAR16 *text; >>> EFI_HANDLE h; >>> - int unit; >>> + int unit, ret =3D 0; >>> >>> - pager_open(); >>> for (unit =3D 0, h =3D efi_find_handle(&efinet_dev, 0); >>> h !=3D NULL; h =3D efi_find_handle(&efinet_dev, ++unit)) { >>> printf(" %s%d:", efinet_dev.dv_name, unit); >>> @@ -364,8 +363,8 @@ efinet_dev_print(int verbose) >>> efi_free_devpath_name(text); >>> } >>> } >>> - if (pager_output("\n")) >>> + if ((ret =3D pager_output("\n")) !=3D 0) >>> break; >>> } >>> - pager_close(); >>> + return (ret); >>> } >>> >>> Modified: head/sys/boot/efi/libefi/efipart.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/efi/libefi/efipart.c Tue Nov 8 06:13:22 2016 >>> (r308433) >>> +++ head/sys/boot/efi/libefi/efipart.c Tue Nov 8 06:50:18 2016 >>> (r308434) >>> @@ -47,7 +47,7 @@ static int efipart_realstrategy(void *, >>> size_t *); >>> static int efipart_open(struct open_file *, ...); >>> static int efipart_close(struct open_file *); >>> -static void efipart_print(int); >>> +static int efipart_print(int); >>> >>> struct devsw efipart_dev =3D { >>> .dv_name =3D "part", >>> @@ -162,7 +162,7 @@ efipart_init(void) >>> return (err); >>> } >>> >>> -static void >>> +static int >>> efipart_print(int verbose) >>> { >>> char line[80]; >>> @@ -170,28 +170,29 @@ efipart_print(int verbose) >>> EFI_HANDLE h; >>> EFI_STATUS status; >>> u_int unit; >>> + int ret =3D 0; >>> >>> - pager_open(); >>> for (unit =3D 0, h =3D efi_find_handle(&efipart_dev, 0); >>> h !=3D NULL; h =3D efi_find_handle(&efipart_dev, ++unit)) { >>> - sprintf(line, " %s%d:", efipart_dev.dv_name, unit); >>> - if (pager_output(line)) >>> + snprintf(line, sizeof(line), " %s%d:", >>> + efipart_dev.dv_name, unit); >>> + if ((ret =3D pager_output(line)) !=3D 0) >>> break; >>> >>> status =3D BS->HandleProtocol(h, &blkio_guid, (void >>> **)&blkio); >>> if (!EFI_ERROR(status)) { >>> - sprintf(line, " %llu blocks", >>> + snprintf(line, sizeof(line), " %llu blocks", >>> (unsigned long long)(blkio->Media->LastBloc= k >>> + 1)); >>> - if (pager_output(line)) >>> + if ((ret =3D pager_output(line)) !=3D 0) >>> break; >>> if (blkio->Media->RemovableMedia) >>> - if (pager_output(" (removable)")) >>> + if ((ret =3D pager_output(" (removable)= ")) >>> !=3D 0) >>> break; >>> } >>> - if (pager_output("\n")) >>> + if ((ret =3D pager_output("\n")) !=3D 0) >>> break; >>> } >>> - pager_close(); >>> + return (ret); >>> } >>> >>> static int >>> >>> Modified: head/sys/boot/efi/loader/main.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/efi/loader/main.c Tue Nov 8 06:13:22 2016 >>> (r308433) >>> +++ head/sys/boot/efi/loader/main.c Tue Nov 8 06:50:18 2016 >>> (r308434) >>> @@ -533,6 +533,7 @@ command_memmap(int argc, char *argv[]) >>> UINT32 dver; >>> EFI_STATUS status; >>> int i, ndesc; >>> + char line[80]; >>> static char *types[] =3D { >>> "Reserved", >>> "LoaderCode", >>> @@ -564,14 +565,19 @@ command_memmap(int argc, char *argv[]) >>> } >>> >>> ndesc =3D sz / dsz; >>> - printf("%23s %12s %12s %8s %4s\n", >>> + snprintf(line, sizeof(line), "%23s %12s %12s %8s %4s\n", >>> "Type", "Physical", "Virtual", "#Pages", "Attr"); >>> + pager_open(); >>> + if (pager_output(line)) { >>> + pager_close(); >>> + return (CMD_OK); >>> + } >>> >>> for (i =3D 0, p =3D map; i < ndesc; >>> i++, p =3D NextMemoryDescriptor(p, dsz)) { >>> printf("%23s %012jx %012jx %08jx ", types[p->Type], >>> - (uintmax_t)p->PhysicalStart, >>> (uintmax_t)p->VirtualStart, >>> - (uintmax_t)p->NumberOfPages); >>> + (uintmax_t)p->PhysicalStart, >>> (uintmax_t)p->VirtualStart, >>> + (uintmax_t)p->NumberOfPages); >>> if (p->Attribute & EFI_MEMORY_UC) >>> printf("UC "); >>> if (p->Attribute & EFI_MEMORY_WC) >>> @@ -588,9 +594,11 @@ command_memmap(int argc, char *argv[]) >>> printf("RP "); >>> if (p->Attribute & EFI_MEMORY_XP) >>> printf("XP "); >>> - printf("\n"); >>> + if (pager_output("\n")) >>> + break; >>> } >>> >>> + pager_close(); >>> return (CMD_OK); >>> } >>> >>> @@ -612,10 +620,17 @@ guid_to_string(EFI_GUID *guid) >>> static int >>> command_configuration(int argc, char *argv[]) >>> { >>> + char line[80]; >>> UINTN i; >>> >>> - printf("NumberOfTableEntries=3D%lu\n", >>> + snprintf(line, sizeof(line), "NumberOfTableEntries=3D%lu\n", >>> (unsigned long)ST->NumberOfTableEntries); >>> + pager_open(); >>> + if (pager_output(line)) { >>> + pager_close(); >>> + return (CMD_OK); >>> + } >>> + >>> for (i =3D 0; i < ST->NumberOfTableEntries; i++) { >>> EFI_GUID *guid; >>> >>> @@ -642,9 +657,13 @@ command_configuration(int argc, char *ar >>> printf("FDT Table"); >>> else >>> printf("Unknown Table (%s)", >>> guid_to_string(guid)); >>> - printf(" at %p\n", >>> ST->ConfigurationTable[i].VendorTable); >>> + snprintf(line, sizeof(line), " at %p\n", >>> + ST->ConfigurationTable[i].VendorTable); >>> + if (pager_output(line)) >>> + break; >>> } >>> >>> + pager_close(); >>> return (CMD_OK); >>> } >>> >>> >>> Modified: head/sys/boot/i386/libfirewire/firewire.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/i386/libfirewire/firewire.c Tue Nov 8 06:13:22 201= 6 >>> (r308433) >>> +++ head/sys/boot/i386/libfirewire/firewire.c Tue Nov 8 06:50:18 201= 6 >>> (r308434) >>> @@ -69,7 +69,7 @@ static int fw_strategy(void *devdata, in >>> size_t offset, size_t size, char *buf, size_t >>> *rsize); >>> static int fw_open(struct open_file *f, ...); >>> static int fw_close(struct open_file *f); >>> -static void fw_print(int verbose); >>> +static int fw_print(int verbose); >>> static void fw_cleanup(void); >>> >>> void fw_enable(void); >>> @@ -148,21 +148,26 @@ fw_init(void) >>> /* >>> * Print information about OHCI chips >>> */ >>> -static void >>> +static int >>> fw_print(int verbose) >>> { >>> - int i; >>> + char line[80]; >>> + int i, ret =3D 0; >>> struct fwohci_softc *sc; >>> >>> for (i =3D 0; i < MAX_OHCI; i ++) { >>> sc =3D &fwinfo[i]; >>> if (sc->state =3D=3D FWOHCI_STATE_DEAD) >>> break; >>> - printf("%d: locator=3D0x%04x devid=3D0x%08x" >>> + snprintf(line, sizeof(line), "%d: locator=3D0x%04x >>> devid=3D0x%08x" >>> " base_addr=3D0x%08x handle=3D0x%08x >>> bus_id=3D0x%08x\n", >>> i, sc->locator, sc->devid, >>> sc->base_addr, sc->handle, sc->bus_id); >>> + ret =3D pager_output(line); >>> + if (ret !=3D 0) >>> + break; >>> } >>> + return (ret); >>> } >>> >>> static int >>> >>> Modified: head/sys/boot/i386/libi386/bioscd.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/i386/libi386/bioscd.c Tue Nov 8 06:13:22 2016 >>> (r308433) >>> +++ head/sys/boot/i386/libi386/bioscd.c Tue Nov 8 06:50:18 2016 >>> (r308434) >>> @@ -100,7 +100,7 @@ static int bc_realstrategy(void *devdata >>> size_t offset, size_t size, char *buf, size_t *rsize); >>> static int bc_open(struct open_file *f, ...); >>> static int bc_close(struct open_file *f); >>> -static void bc_print(int verbose); >>> +static int bc_print(int verbose); >>> >>> struct devsw bioscd =3D { >>> "cd", >>> @@ -177,20 +177,19 @@ bc_add(int biosdev) >>> /* >>> * Print information about disks >>> */ >>> -static void >>> +static int >>> bc_print(int verbose) >>> { >>> char line[80]; >>> - int i; >>> + int i, ret =3D 0; >>> >>> - pager_open(); >>> for (i =3D 0; i < nbcinfo; i++) { >>> - sprintf(line, " cd%d: Device 0x%x\n", i, >>> + snprintf(line, sizeof(line), " cd%d: Device 0x%x\n", >>> i, >>> bcinfo[i].bc_sp.sp_devicespec); >>> - if (pager_output(line)) >>> + if ((ret =3D pager_output(line)) !=3D 0) >>> break; >>> } >>> - pager_close(); >>> + return (ret); >>> } >>> >>> /* >>> >>> Modified: head/sys/boot/i386/libi386/biosdisk.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/i386/libi386/biosdisk.c Tue Nov 8 06:13:22 201= 6 >>> (r308433) >>> +++ head/sys/boot/i386/libi386/biosdisk.c Tue Nov 8 06:50:18 201= 6 >>> (r308434) >>> @@ -135,7 +135,7 @@ static int bd_realstrategy(void *devdata >>> static int bd_open(struct open_file *f, ...); >>> static int bd_close(struct open_file *f); >>> static int bd_ioctl(struct open_file *f, u_long cmd, void *data); >>> -static void bd_print(int verbose); >>> +static int bd_print(int verbose); >>> static void bd_cleanup(void); >>> >>> #ifdef LOADER_GELI_SUPPORT >>> @@ -321,21 +321,21 @@ bd_int13probe(struct bdinfo *bd) >>> /* >>> * Print information about disks >>> */ >>> -static void >>> +static int >>> bd_print(int verbose) >>> { >>> static char line[80]; >>> struct disk_devdesc dev; >>> - int i; >>> + int i, ret =3D 0; >>> >>> - pager_open(); >>> for (i =3D 0; i < nbdinfo; i++) { >>> - sprintf(line, " disk%d: BIOS drive %c (%ju X >>> %u):\n", i, >>> + snprintf(line, sizeof(line), >>> + " disk%d: BIOS drive %c (%ju X %u):\n", i, >>> (bdinfo[i].bd_unit < 0x80) ? ('A' + >>> bdinfo[i].bd_unit): >>> ('C' + bdinfo[i].bd_unit - 0x80), >>> (uintmax_t)bdinfo[i].bd_sectors, >>> bdinfo[i].bd_sectorsize); >>> - if (pager_output(line)) >>> + if ((ret =3D pager_output(line)) !=3D 0) >>> break; >>> dev.d_dev =3D &biosdisk; >>> dev.d_unit =3D i; >>> @@ -346,12 +346,14 @@ bd_print(int verbose) >>> bdinfo[i].bd_sectorsize, >>> (bdinfo[i].bd_flags & BD_FLOPPY) ? >>> DISK_F_NOCACHE: 0) =3D=3D 0) { >>> - sprintf(line, " disk%d", i); >>> - disk_print(&dev, line, verbose); >>> + snprintf(line, sizeof(line), " disk%d", i); >>> + ret =3D disk_print(&dev, line, verbose); >>> disk_close(&dev); >>> + if (ret !=3D 0) >>> + return (ret); >>> } >>> } >>> - pager_close(); >>> + return (ret); >>> } >>> >>> /* >>> >>> Modified: head/sys/boot/i386/libi386/pxe.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/i386/libi386/pxe.c Tue Nov 8 06:13:22 2016 >>> (r308433) >>> +++ head/sys/boot/i386/libi386/pxe.c Tue Nov 8 06:50:18 2016 >>> (r308434) >>> @@ -75,7 +75,7 @@ static int pxe_strategy(void *devdata, i >>> size_t offset, size_t size, char *buf, >>> size_t *rsize); >>> static int pxe_open(struct open_file *f, ...); >>> static int pxe_close(struct open_file *f); >>> -static void pxe_print(int verbose); >>> +static int pxe_print(int verbose); >>> static void pxe_cleanup(void); >>> static void pxe_setnfshandle(char *rootpath); >>> >>> @@ -381,14 +381,20 @@ pxe_close(struct open_file *f) >>> return (0); >>> } >>> >>> -static void >>> +static int >>> pxe_print(int verbose) >>> { >>> - >>> + char line[255]; >>> if (pxe_call =3D=3D NULL) >>> - return; >>> + return (0); >>> >>> - printf(" pxe0: %s:%s\n", inet_ntoa(rootip), rootpath); >>> + if (verbose) { >>> + snprintf(line, sizeof(line), " pxe0: %s:%s\n", >>> + inet_ntoa(rootip), rootpath); >>> + } else { >>> + snprintf(line, sizeof(line), " pxe0:\n"); >>> + } >>> + return (pager_output(line)); >>> } >>> >>> static void >>> >>> Modified: head/sys/boot/mips/beri/loader/beri_disk_cfi.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Nov 8 >>> 06:13:22 2016 (r308433) >>> +++ head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Nov 8 >>> 06:50:18 2016 (r308434) >>> @@ -47,7 +47,7 @@ static int beri_cfi_disk_close(struct op >>> static void beri_cfi_disk_cleanup(void); >>> static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t, >>> size_t, >>> char *, size_t *); >>> -static void beri_cfi_disk_print(int); >>> +static int beri_cfi_disk_print(int); >>> >>> struct devsw beri_cfi_disk =3D { >>> .dv_name =3D "cfi", >>> @@ -112,25 +112,29 @@ beri_cfi_disk_close(struct open_file *f) >>> return (disk_close(dev)); >>> } >>> >>> -static void >>> +static int >>> beri_cfi_disk_print(int verbose) >>> { >>> struct disk_devdesc dev; >>> char line[80]; >>> + int ret; >>> >>> - sprintf(line, " cfi%d CFI flash device\n", 0); >>> - pager_output(line); >>> + snprintf(line, sizeof(line), " cfi%d CFI flash device\n", >>> 0); >>> + ret =3D pager_output(line); >>> + if (ret !=3D 0) >>> + return (ret); >>> dev.d_dev =3D &beri_cfi_disk; >>> dev.d_unit =3D 0; >>> dev.d_slice =3D -1; >>> dev.d_partition =3D -1; >>> if (disk_open(&dev, cfi_get_mediasize(), >>> cfi_get_sectorsize(), 0) =3D=3D 0) { >>> - sprintf(line, " cfi%d", 0); >>> - disk_print(&dev, line, verbose); >>> + snprintf(line, sizeof(line), " cfi%d", 0); >>> + ret =3D disk_print(&dev, line, verbose); >>> disk_close(&dev); >>> } >>> >>> + return (ret); >>> } >>> >>> static void >>> >>> Modified: head/sys/boot/mips/beri/loader/beri_disk_sdcard.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Nov 8 >>> 06:13:22 2016 (r308433) >>> +++ head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Nov 8 >>> 06:50:18 2016 (r308434) >>> @@ -47,7 +47,7 @@ static int beri_sdcard_disk_close(struct >>> static void beri_sdcard_disk_cleanup(void); >>> static int beri_sdcard_disk_strategy(void *, int, daddr_t, size_t, >>> size_t, >>> char *, size_t *); >>> -static void beri_sdcard_disk_print(int); >>> +static int beri_sdcard_disk_print(int); >>> >>> struct devsw beri_sdcard_disk =3D { >>> .dv_name =3D "sdcard", >>> @@ -123,19 +123,23 @@ beri_sdcard_disk_print(int verbose) >>> { >>> struct disk_devdesc dev; >>> char line[80]; >>> + int ret; >>> >>> - sprintf(line, " sdcard%d Altera SD card drive\n", 0); >>> - pager_output(line); >>> + snprintf(line, sizeof(line), " sdcard%d Altera SD card >>> drive\n", 0); >>> + ret =3D pager_output(line); >>> + if (ret !=3D 0) >>> + return (ret); >>> dev.d_dev =3D &beri_sdcard_disk; >>> dev.d_unit =3D 0; >>> dev.d_slice =3D -1; >>> dev.d_partition =3D -1; >>> if (disk_open(&dev, altera_sdcard_get_mediasize(), >>> altera_sdcard_get_sectorsize(), 0) =3D=3D 0) { >>> - sprintf(line, " sdcard%d", 0); >>> - disk_print(&dev, line, verbose); >>> + snprintf(line, sizeof(line), " sdcard%d", 0); >>> + ret =3D disk_print(&dev, line, verbose); >>> disk_close(&dev); >>> } >>> + return (ret); >>> } >>> >>> static void >>> >>> Modified: head/sys/boot/ofw/libofw/ofw_disk.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/ofw/libofw/ofw_disk.c Tue Nov 8 06:13:22 2016 >>> (r308433) >>> +++ head/sys/boot/ofw/libofw/ofw_disk.c Tue Nov 8 06:50:18 2016 >>> (r308434) >>> @@ -47,7 +47,7 @@ static int ofwd_strategy(void *devdata, >>> static int ofwd_open(struct open_file *f, ...); >>> static int ofwd_close(struct open_file *f); >>> static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data)= ; >>> -static void ofwd_print(int verbose); >>> +static int ofwd_print(int verbose); >>> >>> struct devsw ofwdisk =3D { >>> "block", >>> @@ -161,8 +161,8 @@ ofwd_ioctl(struct open_file *f __unused, >>> return (EINVAL); >>> } >>> >>> -static void >>> +static int >>> ofwd_print(int verbose __unused) >>> { >>> - >>> + return (0); >>> } >>> >>> Modified: head/sys/boot/pc98/libpc98/bioscd.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/pc98/libpc98/bioscd.c Tue Nov 8 06:13:22 2016 >>> (r308433) >>> +++ head/sys/boot/pc98/libpc98/bioscd.c Tue Nov 8 06:50:18 2016 >>> (r308434) >>> @@ -99,7 +99,7 @@ static int bc_realstrategy(void *devdata >>> size_t offset, size_t size, char *buf, size_t >>> *rsize); >>> static int bc_open(struct open_file *f, ...); >>> static int bc_close(struct open_file *f); >>> -static void bc_print(int verbose); >>> +static int bc_print(int verbose); >>> >>> struct devsw bioscd =3D { >>> "cd", >>> @@ -173,20 +173,19 @@ bc_add(int biosdev) >>> /* >>> * Print information about disks >>> */ >>> -static void >>> +static int >>> bc_print(int verbose) >>> { >>> char line[80]; >>> - int i; >>> + int i, ret =3D 0; >>> >>> - pager_open(); >>> for (i =3D 0; i < nbcinfo; i++) { >>> sprintf(line, " cd%d: Device 0x%x\n", i, >>> bcinfo[i].bc_sp.sp_devicespec); >>> - if (pager_output(line)) >>> + if ((ret =3D pager_output(line)) !=3D 0) >>> break; >>> } >>> - pager_close(); >>> + return (ret); >>> } >>> >>> /* >>> >>> Modified: head/sys/boot/pc98/libpc98/biosdisk.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/pc98/libpc98/biosdisk.c Tue Nov 8 06:13:22 201= 6 >>> (r308433) >>> +++ head/sys/boot/pc98/libpc98/biosdisk.c Tue Nov 8 06:50:18 201= 6 >>> (r308434) >>> @@ -123,7 +123,7 @@ static int bd_realstrategy(void *devdata >>> size_t offset, size_t size, char *buf, size_t >>> *rsize); >>> static int bd_open(struct open_file *f, ...); >>> static int bd_close(struct open_file *f); >>> -static void bd_print(int verbose); >>> +static int bd_print(int verbose); >>> >>> struct devsw biosdisk =3D { >>> "disk", >>> @@ -249,21 +249,20 @@ bd_int13probe(struct bdinfo *bd) >>> /* >>> * Print information about disks >>> */ >>> -static void >>> +static int >>> bd_print(int verbose) >>> { >>> - int i, j, done; >>> + int i, j, ret =3D 0; >>> char line[80]; >>> struct i386_devdesc dev; >>> struct open_disk *od; >>> struct pc98_partition *dptr; >>> >>> - pager_open(); >>> - done =3D 0; >>> - for (i =3D 0; i < nbdinfo && !done; i++) { >>> - sprintf(line, " disk%d: BIOS drive %c:\n", i, 'A' + i); >>> - if (pager_output(line)) >>> - break; >>> + for (i =3D 0; i < nbdinfo; i++) { >>> + snprintf(line, sizeof(line), " disk%d: BIOS drive %c:\n", >>> + i, 'A' + i); >>> + if ((ret =3D pager_output(line)) !=3D 0) >>> + break; >>> >>> /* try to open the whole disk */ >>> dev.d_unit =3D i; >>> @@ -278,17 +277,17 @@ bd_print(int verbose) >>> >>> /* Check for a "dedicated" disk */ >>> for (j =3D 0; j < od->od_nslices; j++) { >>> - sprintf(line, " disk%ds%d", i, j + 1); >>> - if (bd_printslice(od, &dptr[j], line, verbose)) { >>> - done =3D 1; >>> - break; >>> - } >>> + snprintf(line, sizeof(line), " disk%ds%d", i, = j >>> + 1); >>> + if ((ret =3D bd_printslice(od, &dptr[j], line, >>> verbose)) !=3D 0) >>> + break; >>> } >>> } >>> bd_closedisk(od); >>> + if (ret !=3D 0) >>> + break; >>> } >>> } >>> - pager_close(); >>> + return (ret); >>> } >>> >>> /* Given a size in 512 byte sectors, convert it to a human-readable >>> number. */ >>> >>> Modified: head/sys/boot/powerpc/kboot/hostdisk.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/powerpc/kboot/hostdisk.c Tue Nov 8 06:13:22 201= 6 >>> (r308433) >>> +++ head/sys/boot/powerpc/kboot/hostdisk.c Tue Nov 8 06:50:18 201= 6 >>> (r308434) >>> @@ -37,7 +37,7 @@ static int hostdisk_strategy(void *devda >>> static int hostdisk_open(struct open_file *f, ...); >>> static int hostdisk_close(struct open_file *f); >>> static int hostdisk_ioctl(struct open_file *f, u_long cmd, void *data)= ; >>> -static void hostdisk_print(int verbose); >>> +static int hostdisk_print(int verbose); >>> >>> struct devsw hostdisk =3D { >>> "/dev", >>> @@ -117,9 +117,9 @@ hostdisk_ioctl(struct open_file *f, u_lo >>> return (EINVAL); >>> } >>> >>> -static void >>> +static int >>> hostdisk_print(int verbose) >>> { >>> - >>> + return (0); >>> } >>> >>> >>> Modified: head/sys/boot/powerpc/ps3/ps3cdrom.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Nov 8 06:13:22 201= 6 >>> (r308433) >>> +++ head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Nov 8 06:50:18 201= 6 >>> (r308434) >>> @@ -49,7 +49,7 @@ static int ps3cdrom_strategy(void *devda >>> size_t offset, size_t size, char *buf, size_t *rsize); >>> static int ps3cdrom_open(struct open_file *f, ...); >>> static int ps3cdrom_close(struct open_file *f); >>> -static void ps3cdrom_print(int verbose); >>> +static int ps3cdrom_print(int verbose); >>> >>> struct devsw ps3cdrom =3D { >>> "cd", >>> @@ -149,6 +149,7 @@ static int ps3cdrom_close(struct open_fi >>> return 0; >>> } >>> >>> -static void ps3cdrom_print(int verbose) >>> +static int ps3cdrom_print(int verbose) >>> { >>> + return (0); >>> } >>> >>> Modified: head/sys/boot/powerpc/ps3/ps3disk.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/powerpc/ps3/ps3disk.c Tue Nov 8 06:13:22 2016 >>> (r308433) >>> +++ head/sys/boot/powerpc/ps3/ps3disk.c Tue Nov 8 06:50:18 2016 >>> (r308434) >>> @@ -61,7 +61,7 @@ static int ps3disk_strategy(void *devdat >>> size_t offset, size_t size, char *buf, size_t *rsize); >>> static int ps3disk_open(struct open_file *f, ...); >>> static int ps3disk_close(struct open_file *f); >>> -static void ps3disk_print(int verbose); >>> +static int ps3disk_print(int verbose); >>> >>> struct devsw ps3disk =3D { >>> "disk", >>> @@ -186,8 +186,9 @@ static int ps3disk_close(struct open_fil >>> return 0; >>> } >>> >>> -static void ps3disk_print(int verbose) >>> +static int ps3disk_print(int verbose) >>> { >>> + return (0); >>> } >>> >>> static int ps3disk_open_gpt(struct ps3_devdesc *dev, struct open_dev >>> *od) >>> >>> Modified: head/sys/boot/uboot/lib/disk.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/uboot/lib/disk.c Tue Nov 8 06:13:22 2016 >>> (r308433) >>> +++ head/sys/boot/uboot/lib/disk.c Tue Nov 8 06:50:18 2016 >>> (r308434) >>> @@ -78,7 +78,7 @@ static int stor_strategy(void *, int, da >>> static int stor_open(struct open_file *, ...); >>> static int stor_close(struct open_file *); >>> static int stor_ioctl(struct open_file *f, u_long cmd, void *data); >>> -static void stor_print(int); >>> +static int stor_print(int); >>> static void stor_cleanup(void); >>> >>> struct devsw uboot_storage =3D { >>> @@ -238,30 +238,31 @@ stor_readdev(struct disk_devdesc *dev, d >>> return (err); >>> } >>> >>> -static void >>> +static int >>> stor_print(int verbose) >>> { >>> struct disk_devdesc dev; >>> static char line[80]; >>> - int i; >>> + int i, ret =3D 0; >>> >>> - pager_open(); >>> for (i =3D 0; i < stor_info_no; i++) { >>> dev.d_dev =3D &uboot_storage; >>> dev.d_unit =3D i; >>> dev.d_slice =3D -1; >>> dev.d_partition =3D -1; >>> - sprintf(line, "\tdisk%d (%s)\n", i, >>> + snprintf(line, sizeof(line), "\tdisk%d (%s)\n", i, >>> ub_stor_type(SI(&dev).type)); >>> - if (pager_output(line)) >>> + if ((ret =3D pager_output(line)) !=3D 0) >>> break; >>> if (stor_opendev(&dev) =3D=3D 0) { >>> sprintf(line, "\tdisk%d", i); >>> - disk_print(&dev, line, verbose); >>> + ret =3D disk_print(&dev, line, verbose); >>> disk_close(&dev); >>> + if (ret !=3D 0) >>> + break; >>> } >>> } >>> - pager_close(); >>> + return (ret); >>> } >>> >>> static int >>> >>> Modified: head/sys/boot/usb/storage/umass_loader.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/usb/storage/umass_loader.c Tue Nov 8 06:13:22 201= 6 >>> (r308433) >>> +++ head/sys/boot/usb/storage/umass_loader.c Tue Nov 8 06:50:18 201= 6 >>> (r308434) >>> @@ -50,7 +50,7 @@ static void umass_disk_cleanup(void); >>> static int umass_disk_ioctl(struct open_file *, u_long, void *); >>> static int umass_disk_strategy(void *, int, daddr_t, size_t, size_t, >>> char *, >>> size_t *); >>> -static void umass_disk_print(int); >>> +static int umass_disk_print(int); >>> >>> struct devsw umass_disk =3D { >>> .dv_name =3D "umass", >>> @@ -170,23 +170,26 @@ umass_disk_close(struct open_file *f) >>> return (disk_close(dev)); >>> } >>> >>> -static void >>> +static int >>> umass_disk_print(int verbose) >>> { >>> struct disk_devdesc dev; >>> >>> memset(&dev, 0, sizeof(dev)); >>> >>> - pager_output(" umass0 UMASS device\n"); >>> + ret =3D pager_output(" umass0 UMASS device\n"); >>> + if (ret !=3D 0) >>> + return (ret); >>> dev.d_dev =3D &umass_disk; >>> dev.d_unit =3D 0; >>> dev.d_slice =3D -1; >>> dev.d_partition =3D -1; >>> >>> if (umass_disk_open_sub(&dev) =3D=3D 0) { >>> - disk_print(&dev, " umass0", verbose); >>> + ret =3D disk_print(&dev, " umass0", verbose); >>> disk_close(&dev); >>> } >>> + return (ret); >>> } >>> >>> static void >>> >>> Modified: head/sys/boot/userboot/userboot/host.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/userboot/userboot/host.c Tue Nov 8 06:13:22 201= 6 >>> (r308433) >>> +++ head/sys/boot/userboot/userboot/host.c Tue Nov 8 06:50:18 201= 6 >>> (r308434) >>> @@ -134,13 +134,13 @@ host_dev_init(void) >>> return (0); >>> } >>> >>> -static void >>> +static int >>> host_dev_print(int verbose) >>> { >>> char line[80]; >>> >>> - sprintf(line, " host%d: Host filesystem\n", 0); >>> - pager_output(line); >>> + snprintf(line, sizeof(line), " host%d: Host filesystem\n", >>> 0); >>> + return (pager_output(line)); >>> } >>> >>> /* >>> >>> Modified: head/sys/boot/userboot/userboot/userboot_disk.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/userboot/userboot/userboot_disk.c Tue Nov 8 >>> 06:13:22 2016 (r308433) >>> +++ head/sys/boot/userboot/userboot/userboot_disk.c Tue Nov 8 >>> 06:50:18 2016 (r308434) >>> @@ -60,7 +60,7 @@ static int userdisk_realstrategy(void *d >>> static int userdisk_open(struct open_file *f, ...); >>> static int userdisk_close(struct open_file *f); >>> static int userdisk_ioctl(struct open_file *f, u_long cmd, void >>> *data); >>> -static void userdisk_print(int verbose); >>> +static int userdisk_print(int verbose); >>> >>> struct devsw userboot_disk =3D { >>> "disk", >>> @@ -116,27 +116,33 @@ userdisk_cleanup(void) >>> /* >>> * Print information about disks >>> */ >>> -static void >>> +static int >>> userdisk_print(int verbose) >>> { >>> struct disk_devdesc dev; >>> char line[80]; >>> - int i; >>> + int i, ret =3D 0; >>> >>> for (i =3D 0; i < userdisk_maxunit; i++) { >>> - sprintf(line, " disk%d: Guest drive image\n", i); >>> - pager_output(line); >>> + snprintf(line, sizeof(line), >>> + " disk%d: Guest drive image\n", i); >>> + ret =3D pager_output(line); >>> + if (ret !=3D 0) >>> + break; >>> dev.d_dev =3D &userboot_disk; >>> dev.d_unit =3D i; >>> dev.d_slice =3D -1; >>> dev.d_partition =3D -1; >>> if (disk_open(&dev, ud_info[i].mediasize, >>> ud_info[i].sectorsize, 0) =3D=3D 0) { >>> - sprintf(line, " disk%d", i); >>> - disk_print(&dev, line, verbose); >>> + snprintf(line, sizeof(line), " disk%d", i); >>> + ret =3D disk_print(&dev, line, verbose); >>> disk_close(&dev); >>> + if (ret !=3D 0) >>> + break; >>> } >>> } >>> + return (ret); >>> } >>> >>> /* >>> >>> Modified: head/sys/boot/zfs/zfs.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/zfs/zfs.c Tue Nov 8 06:13:22 2016 (r30843= 3) >>> +++ head/sys/boot/zfs/zfs.c Tue Nov 8 06:50:18 2016 (r30843= 4) >>> @@ -514,20 +514,23 @@ zfs_probe_dev(const char *devname, uint6 >>> /* >>> * Print information about ZFS pools >>> */ >>> -static void >>> +static int >>> zfs_dev_print(int verbose) >>> { >>> spa_t *spa; >>> char line[80]; >>> + int ret =3D 0; >>> >>> if (verbose) { >>> - spa_all_status(); >>> - return; >>> + return (spa_all_status()); >>> } >>> STAILQ_FOREACH(spa, &zfs_pools, spa_link) { >>> - sprintf(line, " zfs:%s\n", spa->spa_name); >>> - pager_output(line); >>> + snprintf(line, sizeof(line), " zfs:%s\n", >>> spa->spa_name); >>> + ret =3D pager_output(line); >>> + if (ret !=3D 0) >>> + break; >>> } >>> + return (ret); >>> } >>> >>> /* >>> >>> Modified: head/sys/boot/zfs/zfsimpl.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/boot/zfs/zfsimpl.c Tue Nov 8 06:13:22 2016 (r30843= 3) >>> +++ head/sys/boot/zfs/zfsimpl.c Tue Nov 8 06:50:18 2016 (r30843= 4) >>> @@ -780,7 +780,7 @@ state_name(vdev_state_t state) >>> >>> #else >>> >>> -static void >>> +static int >>> pager_printf(const char *fmt, ...) >>> { >>> char line[80]; >>> @@ -789,14 +789,14 @@ pager_printf(const char *fmt, ...) >>> va_start(args, fmt); >>> vsprintf(line, fmt, args); >>> va_end(args); >>> - pager_output(line); >>> + return (pager_output(line)); >>> } >>> >>> #endif >>> >>> #define STATUS_FORMAT " %s %s\n" >>> >>> -static void >>> +static int >>> print_state(int indent, const char *name, vdev_state_t state) >>> { >>> int i; >>> @@ -806,40 +806,56 @@ print_state(int indent, const char *name >>> for (i =3D 0; i < indent; i++) >>> strcat(buf, " "); >>> strcat(buf, name); >>> >>> *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** >>> _______________________________________________ >>> svn-src-head@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/svn-src-head >>> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" >> >> >> > From owner-svn-src-all@freebsd.org Fri Nov 11 17:24:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD6EBC3C129 for ; Fri, 11 Nov 2016 17:24:15 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x229.google.com (mail-it0-x229.google.com [IPv6:2607:f8b0:4001:c0b::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 83A2D1AFD for ; Fri, 11 Nov 2016 17:24:15 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x229.google.com with SMTP id u205so136465923itc.0 for ; Fri, 11 Nov 2016 09:24:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=oAimcw16Iwq8qq6++g4O2Gi2AO8lVietfE/NZtwfZFA=; b=s78XNgOemw4KNe59AJSVBbic3ZeeQewhCwywDzZAfRQQtrfF12gR3KEPf4yrXHctoT 6JyNPvf+E0K1SVLMzGdQh2AmI+fp2isBp/Z0HroRT2XB9gGoFGsLuR9zBOAQLRljRWEM ffxHIA4l1yLHi2G7BW9j68BHJ251U/aWIxuWOgTSpuIGQ5LH4DmUsHRG/1lJB2BmCZbC y3GwcG6A9SD0t6MQNIcO5g3dTmqXNInane1QPZ8HH+Cw5PlUvzffLvHRCWMWVb7kaCcV tMsVzyHeLFNzuoJR3iSr8dQqknBZNhQEetYDitrerw1uy4zT/+ERDfVuTa0iYWLBDleJ GSeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=oAimcw16Iwq8qq6++g4O2Gi2AO8lVietfE/NZtwfZFA=; b=XNwoYXEjieLN3vwP58HNQ5zYSuFPCC6j08fhc7sLzNsn0qbL+2IGMIvqx8fmhhYSMM C5LrM4Ng1aUwRJPXrYUfsuQlxMGWWpccTP6rcUZkUK6gi/hmUJyVDWt6l9dUWfNLfZxz aAUEf9amyo+GPb3jBxwXQbzgvzBW7Y+mQf9YZ6+uNMfUHj+Dq6X+jcVdeX3kOq/DTIgJ e7Y5xaUKdpwvNgklnHiwkp7Vt6VgFm915h7sxpUo0vURPCNxFb2KrxcORe+35I9gzMD4 piRD/Wr+hLxrpSjdZ6O1GCI0nFoqbNmPLrDd9QjhJRViz4N3TmxAyKSwegnY30LltnIz HfBg== X-Gm-Message-State: ABUngvfw7l8nSqIFpwkCcGOav2zp2n8WX5J6XBexaHHPnJmn70h1Fwrg7g4jlPrTvmC8bbuY/6/IsewdiQPxjg== X-Received: by 10.36.93.193 with SMTP id w184mr22725268ita.85.1478885053522; Fri, 11 Nov 2016 09:24:13 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.134.66 with HTTP; Fri, 11 Nov 2016 09:24:12 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <0B89F169-9FAB-4FEA-BBBE-0000DE54F09A@me.com> References: <201611080650.uA86oJ7W056026@repo.freebsd.org> <8E0E5C94-EFD7-4008-B563-FF080A98F23D@me.com> <0B89F169-9FAB-4FEA-BBBE-0000DE54F09A@me.com> From: Warner Losh Date: Fri, 11 Nov 2016 10:24:12 -0700 X-Google-Sender-Auth: 0-WLjdHkm5TDEpYXe90enSuJtkY Message-ID: Subject: Re: svn commit: r308434 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sys... To: Toomas Soome Cc: Kamil Czekirda , Toomas Soome , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 17:24:15 -0000 On Fri, Nov 11, 2016 at 10:20 AM, Toomas Soome wrote: > >> On 11. nov 2016, at 19:08, Warner Losh wrote: >> >> This suggests we've created an update / upgrade problem. Do we? >> >> Warner > > > Not if the normal build suggestion (make buildworld buildkernel) is follo= wed, as then the headers from the source tree are put in proper place as pa= rt of the build procedure - in this case the source was fetched by svn upda= te and attempt was made to build part of the fetched tree. > > In that sense, I don=E2=80=99t see the problem, as direct build without s= cene setup is not really supported. Or am I wrong? The same issue will happ= en with any header change, as you can not really build new source with usin= g old headers. OK. Nah, this is cool. libstand's API is somewhat unstable and not needed in the upgrade path. Warner > rgds, > toomas > >> >> On Thu, Nov 10, 2016 at 11:52 PM, Kamil Czekirda w= rote: >>> cp /usr/src/lib/libstand/libstand.h /usr/include/stand.h fixed that >>> >>> thanks >>> >>> 2016-11-10 23:28 GMT+01:00 Toomas Soome : >>>> >>>> the patch does update the lib/libstand/stand.h to have: >>>> >>>> struct devsw { >>>> . . . >>>> int (*dv_print)(int verbose); >>>> >>>> it was void before; from your svnlite log I can see the >>>> lib/libstand/stand.h is updated, could you confirm if it is int now? i= f it >>>> is, I suspect the build is getting the old stand.h from somewhere in t= he >>>> tree and not your /lib/libstand. >>>> >>>> if so, does the build has target to copy headers in place? I=E2=80=99m= sorry, I >>>> don't know all the tricks the build system does as part of the buildwo= rld.. >>>> >>>> rgds, >>>> toomas >>>> >>>> >>>> On 11. nov 2016, at 0:21, Kamil Czekirda wrote: >>>> >>>> Hi, >>>> >>>> I got the following: >>>> >>>> root@current:/usr/src # svnlite up -r r308434 >>>> Updating '.': >>>> U lib/libstand/stand.h >>>> U sys/boot/common/dev_net.c >>>> U sys/boot/common/module.c >>>> U sys/boot/common/part.c >>>> U sys/boot/common/util.c >>>> U sys/boot/common/util.h >>>> U sys/boot/efi/libefi/efinet.c >>>> U sys/boot/efi/libefi/efipart.c >>>> U sys/boot/efi/loader/main.c >>>> U sys/boot/i386/libfirewire/firewire.c >>>> U sys/boot/i386/libi386/bioscd.c >>>> U sys/boot/i386/libi386/biosdisk.c >>>> U sys/boot/mips/beri/loader/beri_disk_cfi.c >>>> U sys/boot/mips/beri/loader/beri_disk_sdcard.c >>>> U sys/boot/ofw/libofw/ofw_disk.c >>>> U sys/boot/pc98/libpc98/bioscd.c >>>> U sys/boot/pc98/libpc98/biosdisk.c >>>> U sys/boot/powerpc/kboot/hostdisk.c >>>> U sys/boot/powerpc/ps3/ps3cdrom.c >>>> U sys/boot/powerpc/ps3/ps3disk.c >>>> U sys/boot/uboot/lib/disk.c >>>> U sys/boot/usb/storage/umass_loader.c >>>> U sys/boot/userboot/userboot/host.c >>>> U sys/boot/userboot/userboot/userboot_disk.c >>>> U sys/boot/zfs/zfs.c >>>> U sys/boot/zfs/zfsimpl.c >>>> U sys/boot/i386/libi386/pxe.c >>>> Updated to revision 308434. >>>> root@current:/usr/src # cd sys/boot/ >>>> root@current:/usr/src/sys/boot # make clean >>>> (...) >>>> root@current:/usr/src/sys/boot # make obj >>>> (...) >>>> root@current:/usr/src/sys/boot # make >>>> (...) >>>> cc -O2 -pipe -DSKEIN_LOOP=3D111 -fPIC -I/usr/src/sys/boot/efi/loade= r >>>> -I/usr/src/sys/boot/efi/loader/arch/amd64 >>>> -I/usr/src/sys/boot/efi/loader/../include >>>> -I/usr/src/sys/boot/efi/loader/../include/amd64 >>>> -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include >>>> -I/usr/src/sys/boot/efi/loader/../../.. >>>> -I/usr/src/sys/boot/efi/loader/../../i386/libi386 >>>> -I/usr/src/sys/boot/efi/loader/../../zfs >>>> -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs >>>> -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT -D= NO_PCI >>>> -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH >>>> -I/usr/src/sys/boot/efi/loader/../../ficl >>>> -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 -DLOADER_DISK_SUPPORT >>>> -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC -I/usr/src/sys/boot/fi= cl >>>> -I/usr/src/sys/boot/ficl/amd64 -I/usr/src/sys/boot/ficl/../common >>>> -I/usr/src/sys/boot/efi/loader/../../common -ffreestanding -Wformat >>>> -msoft-float -mno-mmx -mno-sse -mno-avx -fshort-wchar -mno-red-zone -m= no-aes >>>> -g -MD -MF.depend.vers.o -MTvers.o -std=3Dgnu99 -Wsystem-headers -Wer= ror >>>> -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes >>>> -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-s= ign >>>> -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable >>>> -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality >>>> -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef >>>> -Qunused-arguments -c vers.c -o vers.o >>>> cc -O2 -pipe -DSKEIN_LOOP=3D111 -fPIC -I/usr/src/sys/boot/efi/loade= r >>>> -I/usr/src/sys/boot/efi/loader/arch/amd64 >>>> -I/usr/src/sys/boot/efi/loader/../include >>>> -I/usr/src/sys/boot/efi/loader/../include/amd64 >>>> -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include >>>> -I/usr/src/sys/boot/efi/loader/../../.. >>>> -I/usr/src/sys/boot/efi/loader/../../i386/libi386 >>>> -I/usr/src/sys/boot/efi/loader/../../zfs >>>> -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs >>>> -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT -D= NO_PCI >>>> -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH >>>> -I/usr/src/sys/boot/efi/loader/../../ficl >>>> -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 -DLOADER_DISK_SUPPORT >>>> -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC -I/usr/src/sys/boot/fi= cl >>>> -I/usr/src/sys/boot/ficl/amd64 -I/usr/src/sys/boot/ficl/../common >>>> -I/usr/src/sys/boot/efi/loader/../../common -ffreestanding -Wformat >>>> -msoft-float -mno-mmx -mno-sse -mno-avx -fshort-wchar -mno-red-zone -m= no-aes >>>> -g -MD -MF.depend.zfs.o -MTzfs.o -std=3Dgnu99 -Wsystem-headers -Werro= r -Wall >>>> -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes >>>> -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-s= ign >>>> -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable >>>> -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality >>>> -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef >>>> -Wno-sign-compare -Wno-array-bounds -Wno-missing-prototypes >>>> -Qunused-arguments -c /usr/src/sys/boot/efi/loader/../../zfs/zfs.c -o= zfs.o >>>> /usr/src/sys/boot/efi/loader/../../zfs/zfs.c:599:14: error: incompatib= le >>>> pointer types initializing 'void (*)(int)' with an expression of type = 'int >>>> (int)' [-Werror,-Wincompatible-pointer-types] >>>> .dv_print =3D zfs_dev_print, >>>> ^~~~~~~~~~~~~ >>>> 1 error generated. >>>> *** Error code 1 >>>> >>>> Stop. >>>> make[2]: stopped in /usr/src/sys/boot/efi/loader >>>> *** Error code 1 >>>> >>>> Stop. >>>> make[1]: stopped in /usr/src/sys/boot/efi >>>> *** Error code 1 >>>> >>>> Stop. >>>> make: stopped in /usr/src/sys/boot >>>> >>>> >>>> Kamil >>>> >>>> 2016-11-08 7:50 GMT+01:00 Toomas Soome : >>>>> >>>>> Author: tsoome >>>>> Date: Tue Nov 8 06:50:18 2016 >>>>> New Revision: 308434 >>>>> URL: https://svnweb.freebsd.org/changeset/base/308434 >>>>> >>>>> Log: >>>>> Loader paged/pageable data is not always paged. >>>>> >>>>> This change does modify devsw dv_print() to return the int value, >>>>> enabling walkers to interrupt the walk on non zero value from >>>>> dv_print(). >>>>> >>>>> This will allow the pager_print actually to stop displaying data on >>>>> user input, and additionally pager is used in various *dev_print >>>>> callbacks, >>>>> where it was missing. >>>>> >>>>> For test, lsdev [-v] command should display data by screenfuls and >>>>> should >>>>> stop when the key 'q' is pressed on pager prompt. >>>>> >>>>> Reviewed by: allanjude >>>>> Approved by: allanjude (mentor) >>>>> Differential Revision: https://reviews.freebsd.org/D5461 >>>>> >>>>> Modified: >>>>> head/lib/libstand/stand.h >>>>> head/sys/boot/common/dev_net.c >>>>> head/sys/boot/common/module.c >>>>> head/sys/boot/common/part.c >>>>> head/sys/boot/common/util.c >>>>> head/sys/boot/common/util.h >>>>> head/sys/boot/efi/libefi/efinet.c >>>>> head/sys/boot/efi/libefi/efipart.c >>>>> head/sys/boot/efi/loader/main.c >>>>> head/sys/boot/i386/libfirewire/firewire.c >>>>> head/sys/boot/i386/libi386/bioscd.c >>>>> head/sys/boot/i386/libi386/biosdisk.c >>>>> head/sys/boot/i386/libi386/pxe.c >>>>> head/sys/boot/mips/beri/loader/beri_disk_cfi.c >>>>> head/sys/boot/mips/beri/loader/beri_disk_sdcard.c >>>>> head/sys/boot/ofw/libofw/ofw_disk.c >>>>> head/sys/boot/pc98/libpc98/bioscd.c >>>>> head/sys/boot/pc98/libpc98/biosdisk.c >>>>> head/sys/boot/powerpc/kboot/hostdisk.c >>>>> head/sys/boot/powerpc/ps3/ps3cdrom.c >>>>> head/sys/boot/powerpc/ps3/ps3disk.c >>>>> head/sys/boot/uboot/lib/disk.c >>>>> head/sys/boot/usb/storage/umass_loader.c >>>>> head/sys/boot/userboot/userboot/host.c >>>>> head/sys/boot/userboot/userboot/userboot_disk.c >>>>> head/sys/boot/zfs/zfs.c >>>>> head/sys/boot/zfs/zfsimpl.c >>>>> >>>>> Modified: head/lib/libstand/stand.h >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/lib/libstand/stand.h Tue Nov 8 06:13:22 2016 (r308= 433) >>>>> +++ head/lib/libstand/stand.h Tue Nov 8 06:50:18 2016 (r308= 434) >>>>> @@ -143,7 +143,7 @@ struct devsw { >>>>> int (*dv_open)(struct open_file *f, ...); >>>>> int (*dv_close)(struct open_file *f); >>>>> int (*dv_ioctl)(struct open_file *f, u_long cmd, v= oid >>>>> *data); >>>>> - void (*dv_print)(int verbose); /* print device >>>>> information */ >>>>> + int (*dv_print)(int verbose); /* print devi= ce >>>>> information */ >>>>> void (*dv_cleanup)(void); >>>>> }; >>>>> >>>>> >>>>> Modified: head/sys/boot/common/dev_net.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/common/dev_net.c Tue Nov 8 06:13:22 2016 >>>>> (r308433) >>>>> +++ head/sys/boot/common/dev_net.c Tue Nov 8 06:50:18 2016 >>>>> (r308434) >>>>> @@ -80,7 +80,7 @@ static int net_open(struct open_file *, >>>>> static int net_close(struct open_file *); >>>>> static void net_cleanup(void); >>>>> static int net_strategy(); >>>>> -static void net_print(int); >>>>> +static int net_print(int); >>>>> >>>>> static int net_getparams(int sock); >>>>> >>>>> @@ -325,23 +325,27 @@ exit: >>>>> return (0); >>>>> } >>>>> >>>>> -static void >>>>> +static int >>>>> net_print(int verbose) >>>>> { >>>>> struct netif_driver *drv; >>>>> int i, d, cnt; >>>>> + int ret =3D 0; >>>>> >>>>> cnt =3D 0; >>>>> for (d =3D 0; netif_drivers[d]; d++) { >>>>> drv =3D netif_drivers[d]; >>>>> for (i =3D 0; i < drv->netif_nifs; i++) { >>>>> printf("\t%s%d:", "net", cnt++); >>>>> - if (verbose) >>>>> + if (verbose) { >>>>> printf(" (%s%d)", drv->netif_bname, >>>>> drv->netif_ifs[i].dif_unit); >>>>> + } >>>>> + if ((ret =3D pager_output("\n")) !=3D 0) >>>>> + return (ret); >>>>> } >>>>> } >>>>> - printf("\n"); >>>>> + return (ret); >>>>> } >>>>> >>>>> /* >>>>> >>>>> Modified: head/sys/boot/common/module.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/common/module.c Tue Nov 8 06:13:22 2016 >>>>> (r308433) >>>>> +++ head/sys/boot/common/module.c Tue Nov 8 06:50:18 2016 >>>>> (r308434) >>>>> @@ -254,7 +254,7 @@ command_lsmod(int argc, char *argv[]) >>>>> struct kernel_module *mp; >>>>> struct file_metadata *md; >>>>> char lbuf[80]; >>>>> - int ch, verbose; >>>>> + int ch, verbose, ret =3D 0; >>>>> >>>>> verbose =3D 0; >>>>> optind =3D 1; >>>>> @@ -273,11 +273,13 @@ command_lsmod(int argc, char *argv[]) >>>>> >>>>> pager_open(); >>>>> for (fp =3D preloaded_files; fp; fp =3D fp->f_next) { >>>>> - sprintf(lbuf, " %p: ", (void *) fp->f_addr); >>>>> + snprintf(lbuf, sizeof(lbuf), " %p: ", (void *) fp->f_addr); >>>>> pager_output(lbuf); >>>>> pager_output(fp->f_name); >>>>> - sprintf(lbuf, " (%s, 0x%lx)\n", fp->f_type, (long)fp->f_size)= ; >>>>> - pager_output(lbuf); >>>>> + snprintf(lbuf, sizeof(lbuf), " (%s, 0x%lx)\n", fp->f_type, >>>>> + (long)fp->f_size); >>>>> + if (pager_output(lbuf)) >>>>> + break; >>>>> if (fp->f_args !=3D NULL) { >>>>> pager_output(" args: "); >>>>> pager_output(fp->f_args); >>>>> @@ -287,7 +289,8 @@ command_lsmod(int argc, char *argv[]) >>>>> if (fp->f_modules) { >>>>> pager_output(" modules: "); >>>>> for (mp =3D fp->f_modules; mp; mp =3D mp->m_next) { >>>>> - sprintf(lbuf, "%s.%d ", mp->m_name, mp->m_version); >>>>> + snprintf(lbuf, sizeof(lbuf), "%s.%d ", mp->m_name, >>>>> + mp->m_version); >>>>> pager_output(lbuf); >>>>> } >>>>> if (pager_output("\n")) >>>>> @@ -296,11 +299,14 @@ command_lsmod(int argc, char *argv[]) >>>>> if (verbose) { >>>>> /* XXX could add some formatting smarts here to display so= me >>>>> better */ >>>>> for (md =3D fp->f_metadata; md !=3D NULL; md =3D md->md_ne= xt) { >>>>> - sprintf(lbuf, " 0x%04x, 0x%lx\n", md->md_type, >>>>> (long) md->md_size); >>>>> + snprintf(lbuf, sizeof(lbuf), " 0x%04x, 0x%lx\n", >>>>> + md->md_type, (long) md->md_size); >>>>> if (pager_output(lbuf)) >>>>> break; >>>>> } >>>>> } >>>>> + if (ret) >>>>> + break; >>>>> } >>>>> pager_close(); >>>>> return(CMD_OK); >>>>> >>>>> Modified: head/sys/boot/common/part.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/common/part.c Tue Nov 8 06:13:22 2016 (r308= 433) >>>>> +++ head/sys/boot/common/part.c Tue Nov 8 06:50:18 2016 (r308= 434) >>>>> @@ -834,6 +834,7 @@ ptable_iterate(const struct ptable *tabl >>>>> { >>>>> struct pentry *entry; >>>>> char name[32]; >>>>> + int ret =3D 0; >>>>> >>>>> name[0] =3D '\0'; >>>>> STAILQ_FOREACH(entry, &table->entries, entry) { >>>>> @@ -856,9 +857,8 @@ ptable_iterate(const struct ptable *tabl >>>>> if (table->type =3D=3D PTABLE_BSD) >>>>> sprintf(name, "%c", (u_char) 'a' + >>>>> entry->part.index); >>>>> - if (iter(arg, name, &entry->part)) >>>>> - return 1; >>>>> + if ((ret =3D iter(arg, name, &entry->part)) !=3D 0) >>>>> + return (ret); >>>>> } >>>>> - return 0; >>>>> + return (ret); >>>>> } >>>>> - >>>>> >>>>> Modified: head/sys/boot/common/util.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/common/util.c Tue Nov 8 06:13:22 2016 (r308= 433) >>>>> +++ head/sys/boot/common/util.c Tue Nov 8 06:50:18 2016 (r308= 434) >>>>> @@ -114,7 +114,7 @@ strlen(const char *s) >>>>> return (len); >>>>> } >>>>> >>>>> -void >>>>> +int >>>>> printf(const char *fmt, ...) >>>>> { >>>>> va_list ap; >>>>> @@ -178,4 +178,5 @@ nextfmt: >>>>> } >>>>> } >>>>> va_end(ap); >>>>> + return (0); >>>>> } >>>>> >>>>> Modified: head/sys/boot/common/util.h >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/common/util.h Tue Nov 8 06:13:22 2016 (r308= 433) >>>>> +++ head/sys/boot/common/util.h Tue Nov 8 06:50:18 2016 (r308= 434) >>>>> @@ -48,6 +48,6 @@ void strcat(char *dst, const char *src); >>>>> char *strchr(const char *s, char ch); >>>>> size_t strlen(const char *s); >>>>> >>>>> -void printf(const char *fmt, ...); >>>>> +int printf(const char *fmt, ...); >>>>> >>>>> #endif /* !_UTIL_H_ */ >>>>> >>>>> Modified: head/sys/boot/efi/libefi/efinet.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/efi/libefi/efinet.c Tue Nov 8 06:13:22 2016 >>>>> (r308433) >>>>> +++ head/sys/boot/efi/libefi/efinet.c Tue Nov 8 06:50:18 2016 >>>>> (r308434) >>>>> @@ -252,7 +252,7 @@ efinet_end(struct netif *nif) >>>>> } >>>>> >>>>> static int efinet_dev_init(void); >>>>> -static void efinet_dev_print(int); >>>>> +static int efinet_dev_print(int); >>>>> >>>>> struct devsw efinet_dev =3D { >>>>> .dv_name =3D "net", >>>>> @@ -346,14 +346,13 @@ efinet_dev_init() >>>>> return (0); >>>>> } >>>>> >>>>> -static void >>>>> +static int >>>>> efinet_dev_print(int verbose) >>>>> { >>>>> CHAR16 *text; >>>>> EFI_HANDLE h; >>>>> - int unit; >>>>> + int unit, ret =3D 0; >>>>> >>>>> - pager_open(); >>>>> for (unit =3D 0, h =3D efi_find_handle(&efinet_dev, 0); >>>>> h !=3D NULL; h =3D efi_find_handle(&efinet_dev, ++unit)) { >>>>> printf(" %s%d:", efinet_dev.dv_name, unit); >>>>> @@ -364,8 +363,8 @@ efinet_dev_print(int verbose) >>>>> efi_free_devpath_name(text); >>>>> } >>>>> } >>>>> - if (pager_output("\n")) >>>>> + if ((ret =3D pager_output("\n")) !=3D 0) >>>>> break; >>>>> } >>>>> - pager_close(); >>>>> + return (ret); >>>>> } >>>>> >>>>> Modified: head/sys/boot/efi/libefi/efipart.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/efi/libefi/efipart.c Tue Nov 8 06:13:22 2016 >>>>> (r308433) >>>>> +++ head/sys/boot/efi/libefi/efipart.c Tue Nov 8 06:50:18 2016 >>>>> (r308434) >>>>> @@ -47,7 +47,7 @@ static int efipart_realstrategy(void *, >>>>> size_t *); >>>>> static int efipart_open(struct open_file *, ...); >>>>> static int efipart_close(struct open_file *); >>>>> -static void efipart_print(int); >>>>> +static int efipart_print(int); >>>>> >>>>> struct devsw efipart_dev =3D { >>>>> .dv_name =3D "part", >>>>> @@ -162,7 +162,7 @@ efipart_init(void) >>>>> return (err); >>>>> } >>>>> >>>>> -static void >>>>> +static int >>>>> efipart_print(int verbose) >>>>> { >>>>> char line[80]; >>>>> @@ -170,28 +170,29 @@ efipart_print(int verbose) >>>>> EFI_HANDLE h; >>>>> EFI_STATUS status; >>>>> u_int unit; >>>>> + int ret =3D 0; >>>>> >>>>> - pager_open(); >>>>> for (unit =3D 0, h =3D efi_find_handle(&efipart_dev, 0); >>>>> h !=3D NULL; h =3D efi_find_handle(&efipart_dev, ++unit)) = { >>>>> - sprintf(line, " %s%d:", efipart_dev.dv_name, unit)= ; >>>>> - if (pager_output(line)) >>>>> + snprintf(line, sizeof(line), " %s%d:", >>>>> + efipart_dev.dv_name, unit); >>>>> + if ((ret =3D pager_output(line)) !=3D 0) >>>>> break; >>>>> >>>>> status =3D BS->HandleProtocol(h, &blkio_guid, (void >>>>> **)&blkio); >>>>> if (!EFI_ERROR(status)) { >>>>> - sprintf(line, " %llu blocks", >>>>> + snprintf(line, sizeof(line), " %llu blocks= ", >>>>> (unsigned long long)(blkio->Media->LastBlo= ck >>>>> + 1)); >>>>> - if (pager_output(line)) >>>>> + if ((ret =3D pager_output(line)) !=3D 0) >>>>> break; >>>>> if (blkio->Media->RemovableMedia) >>>>> - if (pager_output(" (removable)")) >>>>> + if ((ret =3D pager_output(" (removabl= e)")) >>>>> !=3D 0) >>>>> break; >>>>> } >>>>> - if (pager_output("\n")) >>>>> + if ((ret =3D pager_output("\n")) !=3D 0) >>>>> break; >>>>> } >>>>> - pager_close(); >>>>> + return (ret); >>>>> } >>>>> >>>>> static int >>>>> >>>>> Modified: head/sys/boot/efi/loader/main.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/efi/loader/main.c Tue Nov 8 06:13:22 2016 >>>>> (r308433) >>>>> +++ head/sys/boot/efi/loader/main.c Tue Nov 8 06:50:18 2016 >>>>> (r308434) >>>>> @@ -533,6 +533,7 @@ command_memmap(int argc, char *argv[]) >>>>> UINT32 dver; >>>>> EFI_STATUS status; >>>>> int i, ndesc; >>>>> + char line[80]; >>>>> static char *types[] =3D { >>>>> "Reserved", >>>>> "LoaderCode", >>>>> @@ -564,14 +565,19 @@ command_memmap(int argc, char *argv[]) >>>>> } >>>>> >>>>> ndesc =3D sz / dsz; >>>>> - printf("%23s %12s %12s %8s %4s\n", >>>>> + snprintf(line, sizeof(line), "%23s %12s %12s %8s %4s\n", >>>>> "Type", "Physical", "Virtual", "#Pages", "Attr"); >>>>> + pager_open(); >>>>> + if (pager_output(line)) { >>>>> + pager_close(); >>>>> + return (CMD_OK); >>>>> + } >>>>> >>>>> for (i =3D 0, p =3D map; i < ndesc; >>>>> i++, p =3D NextMemoryDescriptor(p, dsz)) { >>>>> printf("%23s %012jx %012jx %08jx ", types[p->Type], >>>>> - (uintmax_t)p->PhysicalStart, >>>>> (uintmax_t)p->VirtualStart, >>>>> - (uintmax_t)p->NumberOfPages); >>>>> + (uintmax_t)p->PhysicalStart, >>>>> (uintmax_t)p->VirtualStart, >>>>> + (uintmax_t)p->NumberOfPages); >>>>> if (p->Attribute & EFI_MEMORY_UC) >>>>> printf("UC "); >>>>> if (p->Attribute & EFI_MEMORY_WC) >>>>> @@ -588,9 +594,11 @@ command_memmap(int argc, char *argv[]) >>>>> printf("RP "); >>>>> if (p->Attribute & EFI_MEMORY_XP) >>>>> printf("XP "); >>>>> - printf("\n"); >>>>> + if (pager_output("\n")) >>>>> + break; >>>>> } >>>>> >>>>> + pager_close(); >>>>> return (CMD_OK); >>>>> } >>>>> >>>>> @@ -612,10 +620,17 @@ guid_to_string(EFI_GUID *guid) >>>>> static int >>>>> command_configuration(int argc, char *argv[]) >>>>> { >>>>> + char line[80]; >>>>> UINTN i; >>>>> >>>>> - printf("NumberOfTableEntries=3D%lu\n", >>>>> + snprintf(line, sizeof(line), "NumberOfTableEntries=3D%lu\n", >>>>> (unsigned long)ST->NumberOfTableEntries); >>>>> + pager_open(); >>>>> + if (pager_output(line)) { >>>>> + pager_close(); >>>>> + return (CMD_OK); >>>>> + } >>>>> + >>>>> for (i =3D 0; i < ST->NumberOfTableEntries; i++) { >>>>> EFI_GUID *guid; >>>>> >>>>> @@ -642,9 +657,13 @@ command_configuration(int argc, char *ar >>>>> printf("FDT Table"); >>>>> else >>>>> printf("Unknown Table (%s)", >>>>> guid_to_string(guid)); >>>>> - printf(" at %p\n", >>>>> ST->ConfigurationTable[i].VendorTable); >>>>> + snprintf(line, sizeof(line), " at %p\n", >>>>> + ST->ConfigurationTable[i].VendorTable); >>>>> + if (pager_output(line)) >>>>> + break; >>>>> } >>>>> >>>>> + pager_close(); >>>>> return (CMD_OK); >>>>> } >>>>> >>>>> >>>>> Modified: head/sys/boot/i386/libfirewire/firewire.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/i386/libfirewire/firewire.c Tue Nov 8 06:13:22 2= 016 >>>>> (r308433) >>>>> +++ head/sys/boot/i386/libfirewire/firewire.c Tue Nov 8 06:50:18 2= 016 >>>>> (r308434) >>>>> @@ -69,7 +69,7 @@ static int fw_strategy(void *devdata, in >>>>> size_t offset, size_t size, char *buf, size_t >>>>> *rsize); >>>>> static int fw_open(struct open_file *f, ...); >>>>> static int fw_close(struct open_file *f); >>>>> -static void fw_print(int verbose); >>>>> +static int fw_print(int verbose); >>>>> static void fw_cleanup(void); >>>>> >>>>> void fw_enable(void); >>>>> @@ -148,21 +148,26 @@ fw_init(void) >>>>> /* >>>>> * Print information about OHCI chips >>>>> */ >>>>> -static void >>>>> +static int >>>>> fw_print(int verbose) >>>>> { >>>>> - int i; >>>>> + char line[80]; >>>>> + int i, ret =3D 0; >>>>> struct fwohci_softc *sc; >>>>> >>>>> for (i =3D 0; i < MAX_OHCI; i ++) { >>>>> sc =3D &fwinfo[i]; >>>>> if (sc->state =3D=3D FWOHCI_STATE_DEAD) >>>>> break; >>>>> - printf("%d: locator=3D0x%04x devid=3D0x%08x" >>>>> + snprintf(line, sizeof(line), "%d: locator=3D0x%04x >>>>> devid=3D0x%08x" >>>>> " base_addr=3D0x%08x handle=3D0x%08x >>>>> bus_id=3D0x%08x\n", >>>>> i, sc->locator, sc->devid, >>>>> sc->base_addr, sc->handle, sc->bus_id); >>>>> + ret =3D pager_output(line); >>>>> + if (ret !=3D 0) >>>>> + break; >>>>> } >>>>> + return (ret); >>>>> } >>>>> >>>>> static int >>>>> >>>>> Modified: head/sys/boot/i386/libi386/bioscd.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/i386/libi386/bioscd.c Tue Nov 8 06:13:22 2016 >>>>> (r308433) >>>>> +++ head/sys/boot/i386/libi386/bioscd.c Tue Nov 8 06:50:18 2016 >>>>> (r308434) >>>>> @@ -100,7 +100,7 @@ static int bc_realstrategy(void *devdata >>>>> size_t offset, size_t size, char *buf, size_t *rsize); >>>>> static int bc_open(struct open_file *f, ...); >>>>> static int bc_close(struct open_file *f); >>>>> -static void bc_print(int verbose); >>>>> +static int bc_print(int verbose); >>>>> >>>>> struct devsw bioscd =3D { >>>>> "cd", >>>>> @@ -177,20 +177,19 @@ bc_add(int biosdev) >>>>> /* >>>>> * Print information about disks >>>>> */ >>>>> -static void >>>>> +static int >>>>> bc_print(int verbose) >>>>> { >>>>> char line[80]; >>>>> - int i; >>>>> + int i, ret =3D 0; >>>>> >>>>> - pager_open(); >>>>> for (i =3D 0; i < nbcinfo; i++) { >>>>> - sprintf(line, " cd%d: Device 0x%x\n", i, >>>>> + snprintf(line, sizeof(line), " cd%d: Device 0x%x\n= ", >>>>> i, >>>>> bcinfo[i].bc_sp.sp_devicespec); >>>>> - if (pager_output(line)) >>>>> + if ((ret =3D pager_output(line)) !=3D 0) >>>>> break; >>>>> } >>>>> - pager_close(); >>>>> + return (ret); >>>>> } >>>>> >>>>> /* >>>>> >>>>> Modified: head/sys/boot/i386/libi386/biosdisk.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/i386/libi386/biosdisk.c Tue Nov 8 06:13:22 2= 016 >>>>> (r308433) >>>>> +++ head/sys/boot/i386/libi386/biosdisk.c Tue Nov 8 06:50:18 2= 016 >>>>> (r308434) >>>>> @@ -135,7 +135,7 @@ static int bd_realstrategy(void *devdata >>>>> static int bd_open(struct open_file *f, ...); >>>>> static int bd_close(struct open_file *f); >>>>> static int bd_ioctl(struct open_file *f, u_long cmd, void *data); >>>>> -static void bd_print(int verbose); >>>>> +static int bd_print(int verbose); >>>>> static void bd_cleanup(void); >>>>> >>>>> #ifdef LOADER_GELI_SUPPORT >>>>> @@ -321,21 +321,21 @@ bd_int13probe(struct bdinfo *bd) >>>>> /* >>>>> * Print information about disks >>>>> */ >>>>> -static void >>>>> +static int >>>>> bd_print(int verbose) >>>>> { >>>>> static char line[80]; >>>>> struct disk_devdesc dev; >>>>> - int i; >>>>> + int i, ret =3D 0; >>>>> >>>>> - pager_open(); >>>>> for (i =3D 0; i < nbdinfo; i++) { >>>>> - sprintf(line, " disk%d: BIOS drive %c (%ju X >>>>> %u):\n", i, >>>>> + snprintf(line, sizeof(line), >>>>> + " disk%d: BIOS drive %c (%ju X %u):\n", i, >>>>> (bdinfo[i].bd_unit < 0x80) ? ('A' + >>>>> bdinfo[i].bd_unit): >>>>> ('C' + bdinfo[i].bd_unit - 0x80), >>>>> (uintmax_t)bdinfo[i].bd_sectors, >>>>> bdinfo[i].bd_sectorsize); >>>>> - if (pager_output(line)) >>>>> + if ((ret =3D pager_output(line)) !=3D 0) >>>>> break; >>>>> dev.d_dev =3D &biosdisk; >>>>> dev.d_unit =3D i; >>>>> @@ -346,12 +346,14 @@ bd_print(int verbose) >>>>> bdinfo[i].bd_sectorsize, >>>>> (bdinfo[i].bd_flags & BD_FLOPPY) ? >>>>> DISK_F_NOCACHE: 0) =3D=3D 0) { >>>>> - sprintf(line, " disk%d", i); >>>>> - disk_print(&dev, line, verbose); >>>>> + snprintf(line, sizeof(line), " disk%d", i)= ; >>>>> + ret =3D disk_print(&dev, line, verbose); >>>>> disk_close(&dev); >>>>> + if (ret !=3D 0) >>>>> + return (ret); >>>>> } >>>>> } >>>>> - pager_close(); >>>>> + return (ret); >>>>> } >>>>> >>>>> /* >>>>> >>>>> Modified: head/sys/boot/i386/libi386/pxe.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/i386/libi386/pxe.c Tue Nov 8 06:13:22 2016 >>>>> (r308433) >>>>> +++ head/sys/boot/i386/libi386/pxe.c Tue Nov 8 06:50:18 2016 >>>>> (r308434) >>>>> @@ -75,7 +75,7 @@ static int pxe_strategy(void *devdata, i >>>>> size_t offset, size_t size, char *buf, >>>>> size_t *rsize); >>>>> static int pxe_open(struct open_file *f, ...); >>>>> static int pxe_close(struct open_file *f); >>>>> -static void pxe_print(int verbose); >>>>> +static int pxe_print(int verbose); >>>>> static void pxe_cleanup(void); >>>>> static void pxe_setnfshandle(char *rootpath); >>>>> >>>>> @@ -381,14 +381,20 @@ pxe_close(struct open_file *f) >>>>> return (0); >>>>> } >>>>> >>>>> -static void >>>>> +static int >>>>> pxe_print(int verbose) >>>>> { >>>>> - >>>>> + char line[255]; >>>>> if (pxe_call =3D=3D NULL) >>>>> - return; >>>>> + return (0); >>>>> >>>>> - printf(" pxe0: %s:%s\n", inet_ntoa(rootip), rootpath); >>>>> + if (verbose) { >>>>> + snprintf(line, sizeof(line), " pxe0: %s:%s\n", >>>>> + inet_ntoa(rootip), rootpath); >>>>> + } else { >>>>> + snprintf(line, sizeof(line), " pxe0:\n"); >>>>> + } >>>>> + return (pager_output(line)); >>>>> } >>>>> >>>>> static void >>>>> >>>>> Modified: head/sys/boot/mips/beri/loader/beri_disk_cfi.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Nov 8 >>>>> 06:13:22 2016 (r308433) >>>>> +++ head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Nov 8 >>>>> 06:50:18 2016 (r308434) >>>>> @@ -47,7 +47,7 @@ static int beri_cfi_disk_close(struct op >>>>> static void beri_cfi_disk_cleanup(void); >>>>> static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t, >>>>> size_t, >>>>> char *, size_t *); >>>>> -static void beri_cfi_disk_print(int); >>>>> +static int beri_cfi_disk_print(int); >>>>> >>>>> struct devsw beri_cfi_disk =3D { >>>>> .dv_name =3D "cfi", >>>>> @@ -112,25 +112,29 @@ beri_cfi_disk_close(struct open_file *f) >>>>> return (disk_close(dev)); >>>>> } >>>>> >>>>> -static void >>>>> +static int >>>>> beri_cfi_disk_print(int verbose) >>>>> { >>>>> struct disk_devdesc dev; >>>>> char line[80]; >>>>> + int ret; >>>>> >>>>> - sprintf(line, " cfi%d CFI flash device\n", 0); >>>>> - pager_output(line); >>>>> + snprintf(line, sizeof(line), " cfi%d CFI flash device\n"= , >>>>> 0); >>>>> + ret =3D pager_output(line); >>>>> + if (ret !=3D 0) >>>>> + return (ret); >>>>> dev.d_dev =3D &beri_cfi_disk; >>>>> dev.d_unit =3D 0; >>>>> dev.d_slice =3D -1; >>>>> dev.d_partition =3D -1; >>>>> if (disk_open(&dev, cfi_get_mediasize(), >>>>> cfi_get_sectorsize(), 0) =3D=3D 0) { >>>>> - sprintf(line, " cfi%d", 0); >>>>> - disk_print(&dev, line, verbose); >>>>> + snprintf(line, sizeof(line), " cfi%d", 0); >>>>> + ret =3D disk_print(&dev, line, verbose); >>>>> disk_close(&dev); >>>>> } >>>>> >>>>> + return (ret); >>>>> } >>>>> >>>>> static void >>>>> >>>>> Modified: head/sys/boot/mips/beri/loader/beri_disk_sdcard.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Nov 8 >>>>> 06:13:22 2016 (r308433) >>>>> +++ head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Nov 8 >>>>> 06:50:18 2016 (r308434) >>>>> @@ -47,7 +47,7 @@ static int beri_sdcard_disk_close(struct >>>>> static void beri_sdcard_disk_cleanup(void); >>>>> static int beri_sdcard_disk_strategy(void *, int, daddr_t, size_t= , >>>>> size_t, >>>>> char *, size_t *); >>>>> -static void beri_sdcard_disk_print(int); >>>>> +static int beri_sdcard_disk_print(int); >>>>> >>>>> struct devsw beri_sdcard_disk =3D { >>>>> .dv_name =3D "sdcard", >>>>> @@ -123,19 +123,23 @@ beri_sdcard_disk_print(int verbose) >>>>> { >>>>> struct disk_devdesc dev; >>>>> char line[80]; >>>>> + int ret; >>>>> >>>>> - sprintf(line, " sdcard%d Altera SD card drive\n", 0); >>>>> - pager_output(line); >>>>> + snprintf(line, sizeof(line), " sdcard%d Altera SD card >>>>> drive\n", 0); >>>>> + ret =3D pager_output(line); >>>>> + if (ret !=3D 0) >>>>> + return (ret); >>>>> dev.d_dev =3D &beri_sdcard_disk; >>>>> dev.d_unit =3D 0; >>>>> dev.d_slice =3D -1; >>>>> dev.d_partition =3D -1; >>>>> if (disk_open(&dev, altera_sdcard_get_mediasize(), >>>>> altera_sdcard_get_sectorsize(), 0) =3D=3D 0) { >>>>> - sprintf(line, " sdcard%d", 0); >>>>> - disk_print(&dev, line, verbose); >>>>> + snprintf(line, sizeof(line), " sdcard%d", 0); >>>>> + ret =3D disk_print(&dev, line, verbose); >>>>> disk_close(&dev); >>>>> } >>>>> + return (ret); >>>>> } >>>>> >>>>> static void >>>>> >>>>> Modified: head/sys/boot/ofw/libofw/ofw_disk.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/ofw/libofw/ofw_disk.c Tue Nov 8 06:13:22 2016 >>>>> (r308433) >>>>> +++ head/sys/boot/ofw/libofw/ofw_disk.c Tue Nov 8 06:50:18 2016 >>>>> (r308434) >>>>> @@ -47,7 +47,7 @@ static int ofwd_strategy(void *devdata, >>>>> static int ofwd_open(struct open_file *f, ...); >>>>> static int ofwd_close(struct open_file *f); >>>>> static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data= ); >>>>> -static void ofwd_print(int verbose); >>>>> +static int ofwd_print(int verbose); >>>>> >>>>> struct devsw ofwdisk =3D { >>>>> "block", >>>>> @@ -161,8 +161,8 @@ ofwd_ioctl(struct open_file *f __unused, >>>>> return (EINVAL); >>>>> } >>>>> >>>>> -static void >>>>> +static int >>>>> ofwd_print(int verbose __unused) >>>>> { >>>>> - >>>>> + return (0); >>>>> } >>>>> >>>>> Modified: head/sys/boot/pc98/libpc98/bioscd.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/pc98/libpc98/bioscd.c Tue Nov 8 06:13:22 2016 >>>>> (r308433) >>>>> +++ head/sys/boot/pc98/libpc98/bioscd.c Tue Nov 8 06:50:18 2016 >>>>> (r308434) >>>>> @@ -99,7 +99,7 @@ static int bc_realstrategy(void *devdata >>>>> size_t offset, size_t size, char *buf, size_t >>>>> *rsize); >>>>> static int bc_open(struct open_file *f, ...); >>>>> static int bc_close(struct open_file *f); >>>>> -static void bc_print(int verbose); >>>>> +static int bc_print(int verbose); >>>>> >>>>> struct devsw bioscd =3D { >>>>> "cd", >>>>> @@ -173,20 +173,19 @@ bc_add(int biosdev) >>>>> /* >>>>> * Print information about disks >>>>> */ >>>>> -static void >>>>> +static int >>>>> bc_print(int verbose) >>>>> { >>>>> char line[80]; >>>>> - int i; >>>>> + int i, ret =3D 0; >>>>> >>>>> - pager_open(); >>>>> for (i =3D 0; i < nbcinfo; i++) { >>>>> sprintf(line, " cd%d: Device 0x%x\n", i, >>>>> bcinfo[i].bc_sp.sp_devicespec); >>>>> - if (pager_output(line)) >>>>> + if ((ret =3D pager_output(line)) !=3D 0) >>>>> break; >>>>> } >>>>> - pager_close(); >>>>> + return (ret); >>>>> } >>>>> >>>>> /* >>>>> >>>>> Modified: head/sys/boot/pc98/libpc98/biosdisk.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/pc98/libpc98/biosdisk.c Tue Nov 8 06:13:22 2= 016 >>>>> (r308433) >>>>> +++ head/sys/boot/pc98/libpc98/biosdisk.c Tue Nov 8 06:50:18 2= 016 >>>>> (r308434) >>>>> @@ -123,7 +123,7 @@ static int bd_realstrategy(void *devdata >>>>> size_t offset, size_t size, char *buf, size_t >>>>> *rsize); >>>>> static int bd_open(struct open_file *f, ...); >>>>> static int bd_close(struct open_file *f); >>>>> -static void bd_print(int verbose); >>>>> +static int bd_print(int verbose); >>>>> >>>>> struct devsw biosdisk =3D { >>>>> "disk", >>>>> @@ -249,21 +249,20 @@ bd_int13probe(struct bdinfo *bd) >>>>> /* >>>>> * Print information about disks >>>>> */ >>>>> -static void >>>>> +static int >>>>> bd_print(int verbose) >>>>> { >>>>> - int i, j, done; >>>>> + int i, j, ret =3D 0; >>>>> char line[80]; >>>>> struct i386_devdesc dev; >>>>> struct open_disk *od; >>>>> struct pc98_partition *dptr; >>>>> >>>>> - pager_open(); >>>>> - done =3D 0; >>>>> - for (i =3D 0; i < nbdinfo && !done; i++) { >>>>> - sprintf(line, " disk%d: BIOS drive %c:\n", i, 'A' + i); >>>>> - if (pager_output(line)) >>>>> - break; >>>>> + for (i =3D 0; i < nbdinfo; i++) { >>>>> + snprintf(line, sizeof(line), " disk%d: BIOS drive %c:\n"= , >>>>> + i, 'A' + i); >>>>> + if ((ret =3D pager_output(line)) !=3D 0) >>>>> + break; >>>>> >>>>> /* try to open the whole disk */ >>>>> dev.d_unit =3D i; >>>>> @@ -278,17 +277,17 @@ bd_print(int verbose) >>>>> >>>>> /* Check for a "dedicated" disk */ >>>>> for (j =3D 0; j < od->od_nslices; j++) { >>>>> - sprintf(line, " disk%ds%d", i, j + 1); >>>>> - if (bd_printslice(od, &dptr[j], line, verbose)) { >>>>> - done =3D 1; >>>>> - break; >>>>> - } >>>>> + snprintf(line, sizeof(line), " disk%ds%d", i= , j >>>>> + 1); >>>>> + if ((ret =3D bd_printslice(od, &dptr[j], line, >>>>> verbose)) !=3D 0) >>>>> + break; >>>>> } >>>>> } >>>>> bd_closedisk(od); >>>>> + if (ret !=3D 0) >>>>> + break; >>>>> } >>>>> } >>>>> - pager_close(); >>>>> + return (ret); >>>>> } >>>>> >>>>> /* Given a size in 512 byte sectors, convert it to a human-readable >>>>> number. */ >>>>> >>>>> Modified: head/sys/boot/powerpc/kboot/hostdisk.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/powerpc/kboot/hostdisk.c Tue Nov 8 06:13:22 2= 016 >>>>> (r308433) >>>>> +++ head/sys/boot/powerpc/kboot/hostdisk.c Tue Nov 8 06:50:18 2= 016 >>>>> (r308434) >>>>> @@ -37,7 +37,7 @@ static int hostdisk_strategy(void *devda >>>>> static int hostdisk_open(struct open_file *f, ...); >>>>> static int hostdisk_close(struct open_file *f); >>>>> static int hostdisk_ioctl(struct open_file *f, u_long cmd, void *data= ); >>>>> -static void hostdisk_print(int verbose); >>>>> +static int hostdisk_print(int verbose); >>>>> >>>>> struct devsw hostdisk =3D { >>>>> "/dev", >>>>> @@ -117,9 +117,9 @@ hostdisk_ioctl(struct open_file *f, u_lo >>>>> return (EINVAL); >>>>> } >>>>> >>>>> -static void >>>>> +static int >>>>> hostdisk_print(int verbose) >>>>> { >>>>> - >>>>> + return (0); >>>>> } >>>>> >>>>> >>>>> Modified: head/sys/boot/powerpc/ps3/ps3cdrom.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Nov 8 06:13:22 2= 016 >>>>> (r308433) >>>>> +++ head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Nov 8 06:50:18 2= 016 >>>>> (r308434) >>>>> @@ -49,7 +49,7 @@ static int ps3cdrom_strategy(void *devda >>>>> size_t offset, size_t size, char *buf, size_t *rsize); >>>>> static int ps3cdrom_open(struct open_file *f, ...); >>>>> static int ps3cdrom_close(struct open_file *f); >>>>> -static void ps3cdrom_print(int verbose); >>>>> +static int ps3cdrom_print(int verbose); >>>>> >>>>> struct devsw ps3cdrom =3D { >>>>> "cd", >>>>> @@ -149,6 +149,7 @@ static int ps3cdrom_close(struct open_fi >>>>> return 0; >>>>> } >>>>> >>>>> -static void ps3cdrom_print(int verbose) >>>>> +static int ps3cdrom_print(int verbose) >>>>> { >>>>> + return (0); >>>>> } >>>>> >>>>> Modified: head/sys/boot/powerpc/ps3/ps3disk.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/powerpc/ps3/ps3disk.c Tue Nov 8 06:13:22 2016 >>>>> (r308433) >>>>> +++ head/sys/boot/powerpc/ps3/ps3disk.c Tue Nov 8 06:50:18 2016 >>>>> (r308434) >>>>> @@ -61,7 +61,7 @@ static int ps3disk_strategy(void *devdat >>>>> size_t offset, size_t size, char *buf, size_t *rsize); >>>>> static int ps3disk_open(struct open_file *f, ...); >>>>> static int ps3disk_close(struct open_file *f); >>>>> -static void ps3disk_print(int verbose); >>>>> +static int ps3disk_print(int verbose); >>>>> >>>>> struct devsw ps3disk =3D { >>>>> "disk", >>>>> @@ -186,8 +186,9 @@ static int ps3disk_close(struct open_fil >>>>> return 0; >>>>> } >>>>> >>>>> -static void ps3disk_print(int verbose) >>>>> +static int ps3disk_print(int verbose) >>>>> { >>>>> + return (0); >>>>> } >>>>> >>>>> static int ps3disk_open_gpt(struct ps3_devdesc *dev, struct open_dev >>>>> *od) >>>>> >>>>> Modified: head/sys/boot/uboot/lib/disk.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/uboot/lib/disk.c Tue Nov 8 06:13:22 2016 >>>>> (r308433) >>>>> +++ head/sys/boot/uboot/lib/disk.c Tue Nov 8 06:50:18 2016 >>>>> (r308434) >>>>> @@ -78,7 +78,7 @@ static int stor_strategy(void *, int, da >>>>> static int stor_open(struct open_file *, ...); >>>>> static int stor_close(struct open_file *); >>>>> static int stor_ioctl(struct open_file *f, u_long cmd, void *data); >>>>> -static void stor_print(int); >>>>> +static int stor_print(int); >>>>> static void stor_cleanup(void); >>>>> >>>>> struct devsw uboot_storage =3D { >>>>> @@ -238,30 +238,31 @@ stor_readdev(struct disk_devdesc *dev, d >>>>> return (err); >>>>> } >>>>> >>>>> -static void >>>>> +static int >>>>> stor_print(int verbose) >>>>> { >>>>> struct disk_devdesc dev; >>>>> static char line[80]; >>>>> - int i; >>>>> + int i, ret =3D 0; >>>>> >>>>> - pager_open(); >>>>> for (i =3D 0; i < stor_info_no; i++) { >>>>> dev.d_dev =3D &uboot_storage; >>>>> dev.d_unit =3D i; >>>>> dev.d_slice =3D -1; >>>>> dev.d_partition =3D -1; >>>>> - sprintf(line, "\tdisk%d (%s)\n", i, >>>>> + snprintf(line, sizeof(line), "\tdisk%d (%s)\n", i, >>>>> ub_stor_type(SI(&dev).type)); >>>>> - if (pager_output(line)) >>>>> + if ((ret =3D pager_output(line)) !=3D 0) >>>>> break; >>>>> if (stor_opendev(&dev) =3D=3D 0) { >>>>> sprintf(line, "\tdisk%d", i); >>>>> - disk_print(&dev, line, verbose); >>>>> + ret =3D disk_print(&dev, line, verbose); >>>>> disk_close(&dev); >>>>> + if (ret !=3D 0) >>>>> + break; >>>>> } >>>>> } >>>>> - pager_close(); >>>>> + return (ret); >>>>> } >>>>> >>>>> static int >>>>> >>>>> Modified: head/sys/boot/usb/storage/umass_loader.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/usb/storage/umass_loader.c Tue Nov 8 06:13:22 2= 016 >>>>> (r308433) >>>>> +++ head/sys/boot/usb/storage/umass_loader.c Tue Nov 8 06:50:18 2= 016 >>>>> (r308434) >>>>> @@ -50,7 +50,7 @@ static void umass_disk_cleanup(void); >>>>> static int umass_disk_ioctl(struct open_file *, u_long, void *); >>>>> static int umass_disk_strategy(void *, int, daddr_t, size_t, size_t, >>>>> char *, >>>>> size_t *); >>>>> -static void umass_disk_print(int); >>>>> +static int umass_disk_print(int); >>>>> >>>>> struct devsw umass_disk =3D { >>>>> .dv_name =3D "umass", >>>>> @@ -170,23 +170,26 @@ umass_disk_close(struct open_file *f) >>>>> return (disk_close(dev)); >>>>> } >>>>> >>>>> -static void >>>>> +static int >>>>> umass_disk_print(int verbose) >>>>> { >>>>> struct disk_devdesc dev; >>>>> >>>>> memset(&dev, 0, sizeof(dev)); >>>>> >>>>> - pager_output(" umass0 UMASS device\n"); >>>>> + ret =3D pager_output(" umass0 UMASS device\n"); >>>>> + if (ret !=3D 0) >>>>> + return (ret); >>>>> dev.d_dev =3D &umass_disk; >>>>> dev.d_unit =3D 0; >>>>> dev.d_slice =3D -1; >>>>> dev.d_partition =3D -1; >>>>> >>>>> if (umass_disk_open_sub(&dev) =3D=3D 0) { >>>>> - disk_print(&dev, " umass0", verbose); >>>>> + ret =3D disk_print(&dev, " umass0", verbose); >>>>> disk_close(&dev); >>>>> } >>>>> + return (ret); >>>>> } >>>>> >>>>> static void >>>>> >>>>> Modified: head/sys/boot/userboot/userboot/host.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/userboot/userboot/host.c Tue Nov 8 06:13:22 2= 016 >>>>> (r308433) >>>>> +++ head/sys/boot/userboot/userboot/host.c Tue Nov 8 06:50:18 2= 016 >>>>> (r308434) >>>>> @@ -134,13 +134,13 @@ host_dev_init(void) >>>>> return (0); >>>>> } >>>>> >>>>> -static void >>>>> +static int >>>>> host_dev_print(int verbose) >>>>> { >>>>> char line[80]; >>>>> >>>>> - sprintf(line, " host%d: Host filesystem\n", 0); >>>>> - pager_output(line); >>>>> + snprintf(line, sizeof(line), " host%d: Host filesystem\n= ", >>>>> 0); >>>>> + return (pager_output(line)); >>>>> } >>>>> >>>>> /* >>>>> >>>>> Modified: head/sys/boot/userboot/userboot/userboot_disk.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/userboot/userboot/userboot_disk.c Tue Nov 8 >>>>> 06:13:22 2016 (r308433) >>>>> +++ head/sys/boot/userboot/userboot/userboot_disk.c Tue Nov 8 >>>>> 06:50:18 2016 (r308434) >>>>> @@ -60,7 +60,7 @@ static int userdisk_realstrategy(void *d >>>>> static int userdisk_open(struct open_file *f, ...); >>>>> static int userdisk_close(struct open_file *f); >>>>> static int userdisk_ioctl(struct open_file *f, u_long cmd, void >>>>> *data); >>>>> -static void userdisk_print(int verbose); >>>>> +static int userdisk_print(int verbose); >>>>> >>>>> struct devsw userboot_disk =3D { >>>>> "disk", >>>>> @@ -116,27 +116,33 @@ userdisk_cleanup(void) >>>>> /* >>>>> * Print information about disks >>>>> */ >>>>> -static void >>>>> +static int >>>>> userdisk_print(int verbose) >>>>> { >>>>> struct disk_devdesc dev; >>>>> char line[80]; >>>>> - int i; >>>>> + int i, ret =3D 0; >>>>> >>>>> for (i =3D 0; i < userdisk_maxunit; i++) { >>>>> - sprintf(line, " disk%d: Guest drive image\n", i)= ; >>>>> - pager_output(line); >>>>> + snprintf(line, sizeof(line), >>>>> + " disk%d: Guest drive image\n", i); >>>>> + ret =3D pager_output(line); >>>>> + if (ret !=3D 0) >>>>> + break; >>>>> dev.d_dev =3D &userboot_disk; >>>>> dev.d_unit =3D i; >>>>> dev.d_slice =3D -1; >>>>> dev.d_partition =3D -1; >>>>> if (disk_open(&dev, ud_info[i].mediasize, >>>>> ud_info[i].sectorsize, 0) =3D=3D 0) { >>>>> - sprintf(line, " disk%d", i); >>>>> - disk_print(&dev, line, verbose); >>>>> + snprintf(line, sizeof(line), " disk%d", i)= ; >>>>> + ret =3D disk_print(&dev, line, verbose); >>>>> disk_close(&dev); >>>>> + if (ret !=3D 0) >>>>> + break; >>>>> } >>>>> } >>>>> + return (ret); >>>>> } >>>>> >>>>> /* >>>>> >>>>> Modified: head/sys/boot/zfs/zfs.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/zfs/zfs.c Tue Nov 8 06:13:22 2016 (r308= 433) >>>>> +++ head/sys/boot/zfs/zfs.c Tue Nov 8 06:50:18 2016 (r308= 434) >>>>> @@ -514,20 +514,23 @@ zfs_probe_dev(const char *devname, uint6 >>>>> /* >>>>> * Print information about ZFS pools >>>>> */ >>>>> -static void >>>>> +static int >>>>> zfs_dev_print(int verbose) >>>>> { >>>>> spa_t *spa; >>>>> char line[80]; >>>>> + int ret =3D 0; >>>>> >>>>> if (verbose) { >>>>> - spa_all_status(); >>>>> - return; >>>>> + return (spa_all_status()); >>>>> } >>>>> STAILQ_FOREACH(spa, &zfs_pools, spa_link) { >>>>> - sprintf(line, " zfs:%s\n", spa->spa_name); >>>>> - pager_output(line); >>>>> + snprintf(line, sizeof(line), " zfs:%s\n", >>>>> spa->spa_name); >>>>> + ret =3D pager_output(line); >>>>> + if (ret !=3D 0) >>>>> + break; >>>>> } >>>>> + return (ret); >>>>> } >>>>> >>>>> /* >>>>> >>>>> Modified: head/sys/boot/zfs/zfsimpl.c >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- head/sys/boot/zfs/zfsimpl.c Tue Nov 8 06:13:22 2016 (r308= 433) >>>>> +++ head/sys/boot/zfs/zfsimpl.c Tue Nov 8 06:50:18 2016 (r308= 434) >>>>> @@ -780,7 +780,7 @@ state_name(vdev_state_t state) >>>>> >>>>> #else >>>>> >>>>> -static void >>>>> +static int >>>>> pager_printf(const char *fmt, ...) >>>>> { >>>>> char line[80]; >>>>> @@ -789,14 +789,14 @@ pager_printf(const char *fmt, ...) >>>>> va_start(args, fmt); >>>>> vsprintf(line, fmt, args); >>>>> va_end(args); >>>>> - pager_output(line); >>>>> + return (pager_output(line)); >>>>> } >>>>> >>>>> #endif >>>>> >>>>> #define STATUS_FORMAT " %s %s\n" >>>>> >>>>> -static void >>>>> +static int >>>>> print_state(int indent, const char *name, vdev_state_t state) >>>>> { >>>>> int i; >>>>> @@ -806,40 +806,56 @@ print_state(int indent, const char *name >>>>> for (i =3D 0; i < indent; i++) >>>>> strcat(buf, " "); >>>>> strcat(buf, name); >>>>> >>>>> *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** >>>>> _______________________________________________ >>>>> svn-src-head@freebsd.org mailing list >>>>> https://lists.freebsd.org/mailman/listinfo/svn-src-head >>>>> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.or= g" >>>> >>>> >>>> >>> > From owner-svn-src-all@freebsd.org Fri Nov 11 17:41:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65163C3C4CB; Fri, 11 Nov 2016 17:41:18 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A8B813DB; Fri, 11 Nov 2016 17:41:18 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABHfHci046813; Fri, 11 Nov 2016 17:41:17 GMT (envelope-from stevek@FreeBSD.org) Received: (from stevek@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABHfHLq046812; Fri, 11 Nov 2016 17:41:17 GMT (envelope-from stevek@FreeBSD.org) Message-Id: <201611111741.uABHfHLq046812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: stevek set sender to stevek@FreeBSD.org using -f From: "Stephen J. Kiernan" Date: Fri, 11 Nov 2016 17:41:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308535 - head/sys/boot/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 17:41:18 -0000 Author: stevek Date: Fri Nov 11 17:41:17 2016 New Revision: 308535 URL: https://svnweb.freebsd.org/changeset/base/308535 Log: Add support for LOADER_RC setting in the pkgfs manifest (defaults to /loader.rc) to specify a Forth file to read from the pkgfs tarball and process by Ficl. This allows for the tarball to do runtime things like load a platform-specific FDT blob, among other things. Reviewed by: imp Approved by: sjg (mentor) MFC after: 2 weeks Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D8494 Modified: head/sys/boot/common/install.c Modified: head/sys/boot/common/install.c ============================================================================== --- head/sys/boot/common/install.c Fri Nov 11 16:59:26 2016 (r308534) +++ head/sys/boot/common/install.c Fri Nov 11 17:41:17 2016 (r308535) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" -extern struct in_addr rootip; extern struct in_addr servip; extern int pkgfs_init(const char *, struct fs_ops *); @@ -50,6 +49,7 @@ COMMAND_SET(install, "install", "install static char *inst_kernel; static char **inst_modules; static char *inst_rootfs; +static char *inst_loader_rc; static int setpath(char **what, char *val) @@ -146,6 +146,8 @@ read_metatags(int fd) error = setmultipath(&inst_modules, val); else if (strcmp(tag, "ROOTFS") == 0) error = setpath(&inst_rootfs, val); + else if (strcmp(tag, "LOADER_RC") == 0) + error = setpath(&inst_loader_rc, val); tag = p; } @@ -173,6 +175,10 @@ cleanup(void) free(inst_rootfs); inst_rootfs = NULL; } + if (inst_loader_rc != NULL) { + free(inst_loader_rc); + inst_loader_rc = NULL; + } pkgfs_cleanup(); } @@ -275,6 +281,16 @@ install(char *pkgname) goto fail; } + /* If there is a loader.rc in the package, execute it */ + s = (inst_loader_rc == NULL) ? "/loader.rc" : inst_loader_rc; + fd = open(s, O_RDONLY); + if (fd != -1) { + close(fd); + error = include(s); + if (error == CMD_ERROR) + goto fail; + } + i = 0; while (inst_modules != NULL && inst_modules[i] != NULL) { error = mod_loadkld(inst_modules[i], 0, NULL); From owner-svn-src-all@freebsd.org Fri Nov 11 18:10:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D91EC3C9FF; Fri, 11 Nov 2016 18:10:15 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DEBE91260; Fri, 11 Nov 2016 18:10:14 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABIAEh4062908; Fri, 11 Nov 2016 18:10:14 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABIADni062903; Fri, 11 Nov 2016 18:10:13 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201611111810.uABIADni062903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 11 Nov 2016 18:10:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308536 - head/sys/dev/dpaa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 18:10:15 -0000 Author: jhibbits Date: Fri Nov 11 18:10:13 2016 New Revision: 308536 URL: https://svnweb.freebsd.org/changeset/base/308536 Log: Use ofw_bus_node_is_compatible() instead of fdt_is_compatible() No need to have two functions that do the same thing, let's let fdt_* go away, and use ofw_bus_* equivalents instead. Requested by: andrew Modified: head/sys/dev/dpaa/bman_fdt.c head/sys/dev/dpaa/if_dtsec_fdt.c head/sys/dev/dpaa/qman_fdt.c Modified: head/sys/dev/dpaa/bman_fdt.c ============================================================================== --- head/sys/dev/dpaa/bman_fdt.c Fri Nov 11 17:41:17 2016 (r308535) +++ head/sys/dev/dpaa/bman_fdt.c Fri Nov 11 18:10:13 2016 (r308536) @@ -36,8 +36,6 @@ __FBSDID("$FreeBSD$"); #include -#include - #include #include #include @@ -154,7 +152,7 @@ bman_portals_fdt_attach(device_t dev) /* Find portals tied to CPUs */ for (child = OF_child(node); child != 0; child = OF_peer(child)) { - if (!fdt_is_compatible(child, "fsl,bman-portal")) { + if (!ofw_bus_node_is_compatible(child, "fsl,bman-portal")) { continue; } /* Checkout related cpu */ Modified: head/sys/dev/dpaa/if_dtsec_fdt.c ============================================================================== --- head/sys/dev/dpaa/if_dtsec_fdt.c Fri Nov 11 17:41:17 2016 (r308535) +++ head/sys/dev/dpaa/if_dtsec_fdt.c Fri Nov 11 18:10:13 2016 (r308536) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -156,9 +155,9 @@ dtsec_fdt_attach(device_t dev) } /* Get link speed */ - if (fdt_is_compatible(enet_node, "fsl,fman-1g-mac") != 0) + if (ofw_bus_node_is_compatible(enet_node, "fsl,fman-1g-mac") != 0) sc->sc_eth_dev_type = ETH_DTSEC; - else if (fdt_is_compatible(enet_node, "fsl,fman-10g-mac") != 0) + else if (ofw_bus_node_is_compatible(enet_node, "fsl,fman-10g-mac") != 0) sc->sc_eth_dev_type = ETH_10GSEC; else return(ENXIO); @@ -211,10 +210,12 @@ dtsec_fdt_attach(device_t dev) fman_rxtx_node[0] = OF_instance_to_package(fman_rxtx_node[0]); fman_rxtx_node[1] = OF_instance_to_package(fman_rxtx_node[1]); - if (fdt_is_compatible(fman_rxtx_node[0], "fsl,fman-port-1g-rx") == 0) + if (ofw_bus_node_is_compatible(fman_rxtx_node[0], + "fsl,fman-port-1g-rx") == 0) return (ENXIO); - if (fdt_is_compatible(fman_rxtx_node[1], "fsl,fman-port-1g-tx") == 0) + if (ofw_bus_node_is_compatible(fman_rxtx_node[1], + "fsl,fman-port-1g-tx") == 0) return (ENXIO); /* Get RX port HW id */ Modified: head/sys/dev/dpaa/qman_fdt.c ============================================================================== --- head/sys/dev/dpaa/qman_fdt.c Fri Nov 11 17:41:17 2016 (r308535) +++ head/sys/dev/dpaa/qman_fdt.c Fri Nov 11 18:10:13 2016 (r308536) @@ -36,8 +36,6 @@ __FBSDID("$FreeBSD$"); #include -#include - #include #include #include @@ -154,7 +152,7 @@ qman_portals_fdt_attach(device_t dev) /* Find portals tied to CPUs */ for (child = OF_child(node); child != 0; child = OF_peer(child)) { - if (!fdt_is_compatible(child, "fsl,qman-portal")) { + if (!ofw_bus_node_is_compatible(child, "fsl,qman-portal")) { continue; } /* Checkout related cpu */ From owner-svn-src-all@freebsd.org Fri Nov 11 18:20:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3637FC3CFA2; Fri, 11 Nov 2016 18:20:59 +0000 (UTC) (envelope-from tsoome@me.com) Received: from st13p35im-asmtp004.me.com (st13p35im-asmtp004.me.com [17.164.199.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ECD981A34; Fri, 11 Nov 2016 18:20:58 +0000 (UTC) (envelope-from tsoome@me.com) Received: from process-dkim-sign-daemon.st13p35im-asmtp004.me.com by st13p35im-asmtp004.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OGH00800ML0W300@st13p35im-asmtp004.me.com>; Fri, 11 Nov 2016 17:20:51 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=4d515a; t=1478884851; bh=1FYsWbe5woVwZDqtmWJIgikyDXFxu1DivHlDR0810no=; h=Content-type:MIME-version:Subject:From:Date:Message-id:To; b=Mp9+MZIkwkJQBzdMVcA9wPHo6bpdaIkz64SPmEydF9zlLkCWq3E0BXmtrDb2loG/K awzGOVH+cbY3hZ3hGhMwhwUL78Arp0UxkZrMRzuLKTwrnNsXAYpKOba5vcmTQMHQAu WUlS2MwrJl87g+3+Ui7rLgla70u9MlFSbZ2+ThHm3VRZGOZvtZH34r3LglI8160A/Y /ZE5KBw8KWIvk8bT6ioeG7QlHI7ABa+qIo+tt6fX9h6JS0dArIVAaREjuz9pey0sGX v1zr/j65jXzqfFWQmctWvvKKjZHADEYHP+Da9/rWo9CwREMHd6YERbOcoe2GkhrALs sINpYAQec9XNA== Received: from nazgul.lan (220-90-235-80.dyn.estpak.ee [80.235.90.220]) by st13p35im-asmtp004.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OGH008DEMUNPU00@st13p35im-asmtp004.me.com>; Fri, 11 Nov 2016 17:20:51 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-11_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=27 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1611110306 Content-type: text/plain; charset=utf-8 MIME-version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r308434 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sys... From: Toomas Soome In-reply-to: Date: Fri, 11 Nov 2016 19:20:46 +0200 Cc: Kamil Czekirda , Toomas Soome , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-transfer-encoding: quoted-printable Message-id: <0B89F169-9FAB-4FEA-BBBE-0000DE54F09A@me.com> References: <201611080650.uA86oJ7W056026@repo.freebsd.org> <8E0E5C94-EFD7-4008-B563-FF080A98F23D@me.com> To: Warner Losh X-Mailer: Apple Mail (2.3251) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 18:20:59 -0000 > On 11. nov 2016, at 19:08, Warner Losh wrote: >=20 > This suggests we've created an update / upgrade problem. Do we? >=20 > Warner Not if the normal build suggestion (make buildworld buildkernel) is = followed, as then the headers from the source tree are put in proper = place as part of the build procedure - in this case the source was = fetched by svn update and attempt was made to build part of the fetched = tree. In that sense, I don=E2=80=99t see the problem, as direct build without = scene setup is not really supported. Or am I wrong? The same issue will = happen with any header change, as you can not really build new source = with using old headers. rgds, toomas >=20 > On Thu, Nov 10, 2016 at 11:52 PM, Kamil Czekirda = wrote: >> cp /usr/src/lib/libstand/libstand.h /usr/include/stand.h fixed that >>=20 >> thanks >>=20 >> 2016-11-10 23:28 GMT+01:00 Toomas Soome : >>>=20 >>> the patch does update the lib/libstand/stand.h to have: >>>=20 >>> struct devsw { >>> . . . >>> int (*dv_print)(int verbose); >>>=20 >>> it was void before; from your svnlite log I can see the >>> lib/libstand/stand.h is updated, could you confirm if it is int now? = if it >>> is, I suspect the build is getting the old stand.h from somewhere in = the >>> tree and not your /lib/libstand. >>>=20 >>> if so, does the build has target to copy headers in place? I=E2=80=99m= sorry, I >>> don't know all the tricks the build system does as part of the = buildworld.. >>>=20 >>> rgds, >>> toomas >>>=20 >>>=20 >>> On 11. nov 2016, at 0:21, Kamil Czekirda = wrote: >>>=20 >>> Hi, >>>=20 >>> I got the following: >>>=20 >>> root@current:/usr/src # svnlite up -r r308434 >>> Updating '.': >>> U lib/libstand/stand.h >>> U sys/boot/common/dev_net.c >>> U sys/boot/common/module.c >>> U sys/boot/common/part.c >>> U sys/boot/common/util.c >>> U sys/boot/common/util.h >>> U sys/boot/efi/libefi/efinet.c >>> U sys/boot/efi/libefi/efipart.c >>> U sys/boot/efi/loader/main.c >>> U sys/boot/i386/libfirewire/firewire.c >>> U sys/boot/i386/libi386/bioscd.c >>> U sys/boot/i386/libi386/biosdisk.c >>> U sys/boot/mips/beri/loader/beri_disk_cfi.c >>> U sys/boot/mips/beri/loader/beri_disk_sdcard.c >>> U sys/boot/ofw/libofw/ofw_disk.c >>> U sys/boot/pc98/libpc98/bioscd.c >>> U sys/boot/pc98/libpc98/biosdisk.c >>> U sys/boot/powerpc/kboot/hostdisk.c >>> U sys/boot/powerpc/ps3/ps3cdrom.c >>> U sys/boot/powerpc/ps3/ps3disk.c >>> U sys/boot/uboot/lib/disk.c >>> U sys/boot/usb/storage/umass_loader.c >>> U sys/boot/userboot/userboot/host.c >>> U sys/boot/userboot/userboot/userboot_disk.c >>> U sys/boot/zfs/zfs.c >>> U sys/boot/zfs/zfsimpl.c >>> U sys/boot/i386/libi386/pxe.c >>> Updated to revision 308434. >>> root@current:/usr/src # cd sys/boot/ >>> root@current:/usr/src/sys/boot # make clean >>> (...) >>> root@current:/usr/src/sys/boot # make obj >>> (...) >>> root@current:/usr/src/sys/boot # make >>> (...) >>> cc -O2 -pipe -DSKEIN_LOOP=3D111 -fPIC = -I/usr/src/sys/boot/efi/loader >>> -I/usr/src/sys/boot/efi/loader/arch/amd64 >>> -I/usr/src/sys/boot/efi/loader/../include >>> -I/usr/src/sys/boot/efi/loader/../include/amd64 >>> -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include >>> -I/usr/src/sys/boot/efi/loader/../../.. >>> -I/usr/src/sys/boot/efi/loader/../../i386/libi386 >>> -I/usr/src/sys/boot/efi/loader/../../zfs >>> -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs >>> -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT = -DNO_PCI >>> -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH >>> -I/usr/src/sys/boot/efi/loader/../../ficl >>> -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 = -DLOADER_DISK_SUPPORT >>> -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC = -I/usr/src/sys/boot/ficl >>> -I/usr/src/sys/boot/ficl/amd64 -I/usr/src/sys/boot/ficl/../common >>> -I/usr/src/sys/boot/efi/loader/../../common -ffreestanding -Wformat >>> -msoft-float -mno-mmx -mno-sse -mno-avx -fshort-wchar -mno-red-zone = -mno-aes >>> -g -MD -MF.depend.vers.o -MTvers.o -std=3Dgnu99 -Wsystem-headers = -Werror >>> -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes >>> -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized = -Wno-pointer-sign >>> -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable >>> -Wno-tautological-compare -Wno-unused-value = -Wno-parentheses-equality >>> -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef >>> -Qunused-arguments -c vers.c -o vers.o >>> cc -O2 -pipe -DSKEIN_LOOP=3D111 -fPIC = -I/usr/src/sys/boot/efi/loader >>> -I/usr/src/sys/boot/efi/loader/arch/amd64 >>> -I/usr/src/sys/boot/efi/loader/../include >>> -I/usr/src/sys/boot/efi/loader/../include/amd64 >>> -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include >>> -I/usr/src/sys/boot/efi/loader/../../.. >>> -I/usr/src/sys/boot/efi/loader/../../i386/libi386 >>> -I/usr/src/sys/boot/efi/loader/../../zfs >>> -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs >>> -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT = -DNO_PCI >>> -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH >>> -I/usr/src/sys/boot/efi/loader/../../ficl >>> -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 = -DLOADER_DISK_SUPPORT >>> -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC = -I/usr/src/sys/boot/ficl >>> -I/usr/src/sys/boot/ficl/amd64 -I/usr/src/sys/boot/ficl/../common >>> -I/usr/src/sys/boot/efi/loader/../../common -ffreestanding -Wformat >>> -msoft-float -mno-mmx -mno-sse -mno-avx -fshort-wchar -mno-red-zone = -mno-aes >>> -g -MD -MF.depend.zfs.o -MTzfs.o -std=3Dgnu99 -Wsystem-headers = -Werror -Wall >>> -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes >>> -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized = -Wno-pointer-sign >>> -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable >>> -Wno-tautological-compare -Wno-unused-value = -Wno-parentheses-equality >>> -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef >>> -Wno-sign-compare -Wno-array-bounds -Wno-missing-prototypes >>> -Qunused-arguments -c /usr/src/sys/boot/efi/loader/../../zfs/zfs.c = -o zfs.o >>> /usr/src/sys/boot/efi/loader/../../zfs/zfs.c:599:14: error: = incompatible >>> pointer types initializing 'void (*)(int)' with an expression of = type 'int >>> (int)' [-Werror,-Wincompatible-pointer-types] >>> .dv_print =3D zfs_dev_print, >>> ^~~~~~~~~~~~~ >>> 1 error generated. >>> *** Error code 1 >>>=20 >>> Stop. >>> make[2]: stopped in /usr/src/sys/boot/efi/loader >>> *** Error code 1 >>>=20 >>> Stop. >>> make[1]: stopped in /usr/src/sys/boot/efi >>> *** Error code 1 >>>=20 >>> Stop. >>> make: stopped in /usr/src/sys/boot >>>=20 >>>=20 >>> Kamil >>>=20 >>> 2016-11-08 7:50 GMT+01:00 Toomas Soome : >>>>=20 >>>> Author: tsoome >>>> Date: Tue Nov 8 06:50:18 2016 >>>> New Revision: 308434 >>>> URL: https://svnweb.freebsd.org/changeset/base/308434 >>>>=20 >>>> Log: >>>> Loader paged/pageable data is not always paged. >>>>=20 >>>> This change does modify devsw dv_print() to return the int value, >>>> enabling walkers to interrupt the walk on non zero value from >>>> dv_print(). >>>>=20 >>>> This will allow the pager_print actually to stop displaying data = on >>>> user input, and additionally pager is used in various *dev_print >>>> callbacks, >>>> where it was missing. >>>>=20 >>>> For test, lsdev [-v] command should display data by screenfuls and >>>> should >>>> stop when the key 'q' is pressed on pager prompt. >>>>=20 >>>> Reviewed by: allanjude >>>> Approved by: allanjude (mentor) >>>> Differential Revision: https://reviews.freebsd.org/D5461 >>>>=20 >>>> Modified: >>>> head/lib/libstand/stand.h >>>> head/sys/boot/common/dev_net.c >>>> head/sys/boot/common/module.c >>>> head/sys/boot/common/part.c >>>> head/sys/boot/common/util.c >>>> head/sys/boot/common/util.h >>>> head/sys/boot/efi/libefi/efinet.c >>>> head/sys/boot/efi/libefi/efipart.c >>>> head/sys/boot/efi/loader/main.c >>>> head/sys/boot/i386/libfirewire/firewire.c >>>> head/sys/boot/i386/libi386/bioscd.c >>>> head/sys/boot/i386/libi386/biosdisk.c >>>> head/sys/boot/i386/libi386/pxe.c >>>> head/sys/boot/mips/beri/loader/beri_disk_cfi.c >>>> head/sys/boot/mips/beri/loader/beri_disk_sdcard.c >>>> head/sys/boot/ofw/libofw/ofw_disk.c >>>> head/sys/boot/pc98/libpc98/bioscd.c >>>> head/sys/boot/pc98/libpc98/biosdisk.c >>>> head/sys/boot/powerpc/kboot/hostdisk.c >>>> head/sys/boot/powerpc/ps3/ps3cdrom.c >>>> head/sys/boot/powerpc/ps3/ps3disk.c >>>> head/sys/boot/uboot/lib/disk.c >>>> head/sys/boot/usb/storage/umass_loader.c >>>> head/sys/boot/userboot/userboot/host.c >>>> head/sys/boot/userboot/userboot/userboot_disk.c >>>> head/sys/boot/zfs/zfs.c >>>> head/sys/boot/zfs/zfsimpl.c >>>>=20 >>>> Modified: head/lib/libstand/stand.h >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/lib/libstand/stand.h Tue Nov 8 06:13:22 2016 = (r308433) >>>> +++ head/lib/libstand/stand.h Tue Nov 8 06:50:18 2016 = (r308434) >>>> @@ -143,7 +143,7 @@ struct devsw { >>>> int (*dv_open)(struct open_file *f, ...); >>>> int (*dv_close)(struct open_file *f); >>>> int (*dv_ioctl)(struct open_file *f, u_long cmd, = void >>>> *data); >>>> - void (*dv_print)(int verbose); /* print device >>>> information */ >>>> + int (*dv_print)(int verbose); /* print = device >>>> information */ >>>> void (*dv_cleanup)(void); >>>> }; >>>>=20 >>>>=20 >>>> Modified: head/sys/boot/common/dev_net.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/common/dev_net.c Tue Nov 8 06:13:22 2016 >>>> (r308433) >>>> +++ head/sys/boot/common/dev_net.c Tue Nov 8 06:50:18 2016 >>>> (r308434) >>>> @@ -80,7 +80,7 @@ static int net_open(struct open_file *, >>>> static int net_close(struct open_file *); >>>> static void net_cleanup(void); >>>> static int net_strategy(); >>>> -static void net_print(int); >>>> +static int net_print(int); >>>>=20 >>>> static int net_getparams(int sock); >>>>=20 >>>> @@ -325,23 +325,27 @@ exit: >>>> return (0); >>>> } >>>>=20 >>>> -static void >>>> +static int >>>> net_print(int verbose) >>>> { >>>> struct netif_driver *drv; >>>> int i, d, cnt; >>>> + int ret =3D 0; >>>>=20 >>>> cnt =3D 0; >>>> for (d =3D 0; netif_drivers[d]; d++) { >>>> drv =3D netif_drivers[d]; >>>> for (i =3D 0; i < drv->netif_nifs; i++) { >>>> printf("\t%s%d:", "net", cnt++); >>>> - if (verbose) >>>> + if (verbose) { >>>> printf(" (%s%d)", drv->netif_bname, >>>> drv->netif_ifs[i].dif_unit); >>>> + } >>>> + if ((ret =3D pager_output("\n")) !=3D 0) >>>> + return (ret); >>>> } >>>> } >>>> - printf("\n"); >>>> + return (ret); >>>> } >>>>=20 >>>> /* >>>>=20 >>>> Modified: head/sys/boot/common/module.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/common/module.c Tue Nov 8 06:13:22 2016 >>>> (r308433) >>>> +++ head/sys/boot/common/module.c Tue Nov 8 06:50:18 2016 >>>> (r308434) >>>> @@ -254,7 +254,7 @@ command_lsmod(int argc, char *argv[]) >>>> struct kernel_module *mp; >>>> struct file_metadata *md; >>>> char lbuf[80]; >>>> - int ch, verbose; >>>> + int ch, verbose, ret =3D 0; >>>>=20 >>>> verbose =3D 0; >>>> optind =3D 1; >>>> @@ -273,11 +273,13 @@ command_lsmod(int argc, char *argv[]) >>>>=20 >>>> pager_open(); >>>> for (fp =3D preloaded_files; fp; fp =3D fp->f_next) { >>>> - sprintf(lbuf, " %p: ", (void *) fp->f_addr); >>>> + snprintf(lbuf, sizeof(lbuf), " %p: ", (void *) fp->f_addr); >>>> pager_output(lbuf); >>>> pager_output(fp->f_name); >>>> - sprintf(lbuf, " (%s, 0x%lx)\n", fp->f_type, = (long)fp->f_size); >>>> - pager_output(lbuf); >>>> + snprintf(lbuf, sizeof(lbuf), " (%s, 0x%lx)\n", fp->f_type, >>>> + (long)fp->f_size); >>>> + if (pager_output(lbuf)) >>>> + break; >>>> if (fp->f_args !=3D NULL) { >>>> pager_output(" args: "); >>>> pager_output(fp->f_args); >>>> @@ -287,7 +289,8 @@ command_lsmod(int argc, char *argv[]) >>>> if (fp->f_modules) { >>>> pager_output(" modules: "); >>>> for (mp =3D fp->f_modules; mp; mp =3D mp->m_next) { >>>> - sprintf(lbuf, "%s.%d ", mp->m_name, mp->m_version); >>>> + snprintf(lbuf, sizeof(lbuf), "%s.%d ", mp->m_name, >>>> + mp->m_version); >>>> pager_output(lbuf); >>>> } >>>> if (pager_output("\n")) >>>> @@ -296,11 +299,14 @@ command_lsmod(int argc, char *argv[]) >>>> if (verbose) { >>>> /* XXX could add some formatting smarts here to display = some >>>> better */ >>>> for (md =3D fp->f_metadata; md !=3D NULL; md =3D = md->md_next) { >>>> - sprintf(lbuf, " 0x%04x, 0x%lx\n", md->md_type, >>>> (long) md->md_size); >>>> + snprintf(lbuf, sizeof(lbuf), " 0x%04x, = 0x%lx\n", >>>> + md->md_type, (long) md->md_size); >>>> if (pager_output(lbuf)) >>>> break; >>>> } >>>> } >>>> + if (ret) >>>> + break; >>>> } >>>> pager_close(); >>>> return(CMD_OK); >>>>=20 >>>> Modified: head/sys/boot/common/part.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/common/part.c Tue Nov 8 06:13:22 2016 = (r308433) >>>> +++ head/sys/boot/common/part.c Tue Nov 8 06:50:18 2016 = (r308434) >>>> @@ -834,6 +834,7 @@ ptable_iterate(const struct ptable *tabl >>>> { >>>> struct pentry *entry; >>>> char name[32]; >>>> + int ret =3D 0; >>>>=20 >>>> name[0] =3D '\0'; >>>> STAILQ_FOREACH(entry, &table->entries, entry) { >>>> @@ -856,9 +857,8 @@ ptable_iterate(const struct ptable *tabl >>>> if (table->type =3D=3D PTABLE_BSD) >>>> sprintf(name, "%c", (u_char) 'a' + >>>> entry->part.index); >>>> - if (iter(arg, name, &entry->part)) >>>> - return 1; >>>> + if ((ret =3D iter(arg, name, &entry->part)) !=3D 0) >>>> + return (ret); >>>> } >>>> - return 0; >>>> + return (ret); >>>> } >>>> - >>>>=20 >>>> Modified: head/sys/boot/common/util.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/common/util.c Tue Nov 8 06:13:22 2016 = (r308433) >>>> +++ head/sys/boot/common/util.c Tue Nov 8 06:50:18 2016 = (r308434) >>>> @@ -114,7 +114,7 @@ strlen(const char *s) >>>> return (len); >>>> } >>>>=20 >>>> -void >>>> +int >>>> printf(const char *fmt, ...) >>>> { >>>> va_list ap; >>>> @@ -178,4 +178,5 @@ nextfmt: >>>> } >>>> } >>>> va_end(ap); >>>> + return (0); >>>> } >>>>=20 >>>> Modified: head/sys/boot/common/util.h >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/common/util.h Tue Nov 8 06:13:22 2016 = (r308433) >>>> +++ head/sys/boot/common/util.h Tue Nov 8 06:50:18 2016 = (r308434) >>>> @@ -48,6 +48,6 @@ void strcat(char *dst, const char *src); >>>> char *strchr(const char *s, char ch); >>>> size_t strlen(const char *s); >>>>=20 >>>> -void printf(const char *fmt, ...); >>>> +int printf(const char *fmt, ...); >>>>=20 >>>> #endif /* !_UTIL_H_ */ >>>>=20 >>>> Modified: head/sys/boot/efi/libefi/efinet.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/efi/libefi/efinet.c Tue Nov 8 06:13:22 2016 >>>> (r308433) >>>> +++ head/sys/boot/efi/libefi/efinet.c Tue Nov 8 06:50:18 2016 >>>> (r308434) >>>> @@ -252,7 +252,7 @@ efinet_end(struct netif *nif) >>>> } >>>>=20 >>>> static int efinet_dev_init(void); >>>> -static void efinet_dev_print(int); >>>> +static int efinet_dev_print(int); >>>>=20 >>>> struct devsw efinet_dev =3D { >>>> .dv_name =3D "net", >>>> @@ -346,14 +346,13 @@ efinet_dev_init() >>>> return (0); >>>> } >>>>=20 >>>> -static void >>>> +static int >>>> efinet_dev_print(int verbose) >>>> { >>>> CHAR16 *text; >>>> EFI_HANDLE h; >>>> - int unit; >>>> + int unit, ret =3D 0; >>>>=20 >>>> - pager_open(); >>>> for (unit =3D 0, h =3D efi_find_handle(&efinet_dev, 0); >>>> h !=3D NULL; h =3D efi_find_handle(&efinet_dev, ++unit)) = { >>>> printf(" %s%d:", efinet_dev.dv_name, unit); >>>> @@ -364,8 +363,8 @@ efinet_dev_print(int verbose) >>>> efi_free_devpath_name(text); >>>> } >>>> } >>>> - if (pager_output("\n")) >>>> + if ((ret =3D pager_output("\n")) !=3D 0) >>>> break; >>>> } >>>> - pager_close(); >>>> + return (ret); >>>> } >>>>=20 >>>> Modified: head/sys/boot/efi/libefi/efipart.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/efi/libefi/efipart.c Tue Nov 8 06:13:22 2016 >>>> (r308433) >>>> +++ head/sys/boot/efi/libefi/efipart.c Tue Nov 8 06:50:18 2016 >>>> (r308434) >>>> @@ -47,7 +47,7 @@ static int efipart_realstrategy(void *, >>>> size_t *); >>>> static int efipart_open(struct open_file *, ...); >>>> static int efipart_close(struct open_file *); >>>> -static void efipart_print(int); >>>> +static int efipart_print(int); >>>>=20 >>>> struct devsw efipart_dev =3D { >>>> .dv_name =3D "part", >>>> @@ -162,7 +162,7 @@ efipart_init(void) >>>> return (err); >>>> } >>>>=20 >>>> -static void >>>> +static int >>>> efipart_print(int verbose) >>>> { >>>> char line[80]; >>>> @@ -170,28 +170,29 @@ efipart_print(int verbose) >>>> EFI_HANDLE h; >>>> EFI_STATUS status; >>>> u_int unit; >>>> + int ret =3D 0; >>>>=20 >>>> - pager_open(); >>>> for (unit =3D 0, h =3D efi_find_handle(&efipart_dev, 0); >>>> h !=3D NULL; h =3D efi_find_handle(&efipart_dev, = ++unit)) { >>>> - sprintf(line, " %s%d:", efipart_dev.dv_name, = unit); >>>> - if (pager_output(line)) >>>> + snprintf(line, sizeof(line), " %s%d:", >>>> + efipart_dev.dv_name, unit); >>>> + if ((ret =3D pager_output(line)) !=3D 0) >>>> break; >>>>=20 >>>> status =3D BS->HandleProtocol(h, &blkio_guid, (void >>>> **)&blkio); >>>> if (!EFI_ERROR(status)) { >>>> - sprintf(line, " %llu blocks", >>>> + snprintf(line, sizeof(line), " %llu = blocks", >>>> (unsigned long = long)(blkio->Media->LastBlock >>>> + 1)); >>>> - if (pager_output(line)) >>>> + if ((ret =3D pager_output(line)) !=3D 0) >>>> break; >>>> if (blkio->Media->RemovableMedia) >>>> - if (pager_output(" (removable)")) >>>> + if ((ret =3D pager_output(" = (removable)")) >>>> !=3D 0) >>>> break; >>>> } >>>> - if (pager_output("\n")) >>>> + if ((ret =3D pager_output("\n")) !=3D 0) >>>> break; >>>> } >>>> - pager_close(); >>>> + return (ret); >>>> } >>>>=20 >>>> static int >>>>=20 >>>> Modified: head/sys/boot/efi/loader/main.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/efi/loader/main.c Tue Nov 8 06:13:22 2016 >>>> (r308433) >>>> +++ head/sys/boot/efi/loader/main.c Tue Nov 8 06:50:18 2016 >>>> (r308434) >>>> @@ -533,6 +533,7 @@ command_memmap(int argc, char *argv[]) >>>> UINT32 dver; >>>> EFI_STATUS status; >>>> int i, ndesc; >>>> + char line[80]; >>>> static char *types[] =3D { >>>> "Reserved", >>>> "LoaderCode", >>>> @@ -564,14 +565,19 @@ command_memmap(int argc, char *argv[]) >>>> } >>>>=20 >>>> ndesc =3D sz / dsz; >>>> - printf("%23s %12s %12s %8s %4s\n", >>>> + snprintf(line, sizeof(line), "%23s %12s %12s %8s %4s\n", >>>> "Type", "Physical", "Virtual", "#Pages", "Attr"); >>>> + pager_open(); >>>> + if (pager_output(line)) { >>>> + pager_close(); >>>> + return (CMD_OK); >>>> + } >>>>=20 >>>> for (i =3D 0, p =3D map; i < ndesc; >>>> i++, p =3D NextMemoryDescriptor(p, dsz)) { >>>> printf("%23s %012jx %012jx %08jx ", types[p->Type], >>>> - (uintmax_t)p->PhysicalStart, >>>> (uintmax_t)p->VirtualStart, >>>> - (uintmax_t)p->NumberOfPages); >>>> + (uintmax_t)p->PhysicalStart, >>>> (uintmax_t)p->VirtualStart, >>>> + (uintmax_t)p->NumberOfPages); >>>> if (p->Attribute & EFI_MEMORY_UC) >>>> printf("UC "); >>>> if (p->Attribute & EFI_MEMORY_WC) >>>> @@ -588,9 +594,11 @@ command_memmap(int argc, char *argv[]) >>>> printf("RP "); >>>> if (p->Attribute & EFI_MEMORY_XP) >>>> printf("XP "); >>>> - printf("\n"); >>>> + if (pager_output("\n")) >>>> + break; >>>> } >>>>=20 >>>> + pager_close(); >>>> return (CMD_OK); >>>> } >>>>=20 >>>> @@ -612,10 +620,17 @@ guid_to_string(EFI_GUID *guid) >>>> static int >>>> command_configuration(int argc, char *argv[]) >>>> { >>>> + char line[80]; >>>> UINTN i; >>>>=20 >>>> - printf("NumberOfTableEntries=3D%lu\n", >>>> + snprintf(line, sizeof(line), "NumberOfTableEntries=3D%lu\n", >>>> (unsigned long)ST->NumberOfTableEntries); >>>> + pager_open(); >>>> + if (pager_output(line)) { >>>> + pager_close(); >>>> + return (CMD_OK); >>>> + } >>>> + >>>> for (i =3D 0; i < ST->NumberOfTableEntries; i++) { >>>> EFI_GUID *guid; >>>>=20 >>>> @@ -642,9 +657,13 @@ command_configuration(int argc, char *ar >>>> printf("FDT Table"); >>>> else >>>> printf("Unknown Table (%s)", >>>> guid_to_string(guid)); >>>> - printf(" at %p\n", >>>> ST->ConfigurationTable[i].VendorTable); >>>> + snprintf(line, sizeof(line), " at %p\n", >>>> + ST->ConfigurationTable[i].VendorTable); >>>> + if (pager_output(line)) >>>> + break; >>>> } >>>>=20 >>>> + pager_close(); >>>> return (CMD_OK); >>>> } >>>>=20 >>>>=20 >>>> Modified: head/sys/boot/i386/libfirewire/firewire.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/i386/libfirewire/firewire.c Tue Nov 8 06:13:22 = 2016 >>>> (r308433) >>>> +++ head/sys/boot/i386/libfirewire/firewire.c Tue Nov 8 06:50:18 = 2016 >>>> (r308434) >>>> @@ -69,7 +69,7 @@ static int fw_strategy(void *devdata, in >>>> size_t offset, size_t size, char *buf, size_t >>>> *rsize); >>>> static int fw_open(struct open_file *f, ...); >>>> static int fw_close(struct open_file *f); >>>> -static void fw_print(int verbose); >>>> +static int fw_print(int verbose); >>>> static void fw_cleanup(void); >>>>=20 >>>> void fw_enable(void); >>>> @@ -148,21 +148,26 @@ fw_init(void) >>>> /* >>>> * Print information about OHCI chips >>>> */ >>>> -static void >>>> +static int >>>> fw_print(int verbose) >>>> { >>>> - int i; >>>> + char line[80]; >>>> + int i, ret =3D 0; >>>> struct fwohci_softc *sc; >>>>=20 >>>> for (i =3D 0; i < MAX_OHCI; i ++) { >>>> sc =3D &fwinfo[i]; >>>> if (sc->state =3D=3D FWOHCI_STATE_DEAD) >>>> break; >>>> - printf("%d: locator=3D0x%04x devid=3D0x%08x" >>>> + snprintf(line, sizeof(line), "%d: locator=3D0x%04x >>>> devid=3D0x%08x" >>>> " base_addr=3D0x%08x handle=3D0x%08x >>>> bus_id=3D0x%08x\n", >>>> i, sc->locator, sc->devid, >>>> sc->base_addr, sc->handle, sc->bus_id); >>>> + ret =3D pager_output(line); >>>> + if (ret !=3D 0) >>>> + break; >>>> } >>>> + return (ret); >>>> } >>>>=20 >>>> static int >>>>=20 >>>> Modified: head/sys/boot/i386/libi386/bioscd.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/i386/libi386/bioscd.c Tue Nov 8 06:13:22 2016 >>>> (r308433) >>>> +++ head/sys/boot/i386/libi386/bioscd.c Tue Nov 8 06:50:18 2016 >>>> (r308434) >>>> @@ -100,7 +100,7 @@ static int bc_realstrategy(void *devdata >>>> size_t offset, size_t size, char *buf, size_t *rsize); >>>> static int bc_open(struct open_file *f, ...); >>>> static int bc_close(struct open_file *f); >>>> -static void bc_print(int verbose); >>>> +static int bc_print(int verbose); >>>>=20 >>>> struct devsw bioscd =3D { >>>> "cd", >>>> @@ -177,20 +177,19 @@ bc_add(int biosdev) >>>> /* >>>> * Print information about disks >>>> */ >>>> -static void >>>> +static int >>>> bc_print(int verbose) >>>> { >>>> char line[80]; >>>> - int i; >>>> + int i, ret =3D 0; >>>>=20 >>>> - pager_open(); >>>> for (i =3D 0; i < nbcinfo; i++) { >>>> - sprintf(line, " cd%d: Device 0x%x\n", i, >>>> + snprintf(line, sizeof(line), " cd%d: Device = 0x%x\n", >>>> i, >>>> bcinfo[i].bc_sp.sp_devicespec); >>>> - if (pager_output(line)) >>>> + if ((ret =3D pager_output(line)) !=3D 0) >>>> break; >>>> } >>>> - pager_close(); >>>> + return (ret); >>>> } >>>>=20 >>>> /* >>>>=20 >>>> Modified: head/sys/boot/i386/libi386/biosdisk.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/i386/libi386/biosdisk.c Tue Nov 8 06:13:22 = 2016 >>>> (r308433) >>>> +++ head/sys/boot/i386/libi386/biosdisk.c Tue Nov 8 06:50:18 = 2016 >>>> (r308434) >>>> @@ -135,7 +135,7 @@ static int bd_realstrategy(void *devdata >>>> static int bd_open(struct open_file *f, ...); >>>> static int bd_close(struct open_file *f); >>>> static int bd_ioctl(struct open_file *f, u_long cmd, void *data); >>>> -static void bd_print(int verbose); >>>> +static int bd_print(int verbose); >>>> static void bd_cleanup(void); >>>>=20 >>>> #ifdef LOADER_GELI_SUPPORT >>>> @@ -321,21 +321,21 @@ bd_int13probe(struct bdinfo *bd) >>>> /* >>>> * Print information about disks >>>> */ >>>> -static void >>>> +static int >>>> bd_print(int verbose) >>>> { >>>> static char line[80]; >>>> struct disk_devdesc dev; >>>> - int i; >>>> + int i, ret =3D 0; >>>>=20 >>>> - pager_open(); >>>> for (i =3D 0; i < nbdinfo; i++) { >>>> - sprintf(line, " disk%d: BIOS drive %c (%ju X >>>> %u):\n", i, >>>> + snprintf(line, sizeof(line), >>>> + " disk%d: BIOS drive %c (%ju X %u):\n", i, >>>> (bdinfo[i].bd_unit < 0x80) ? ('A' + >>>> bdinfo[i].bd_unit): >>>> ('C' + bdinfo[i].bd_unit - 0x80), >>>> (uintmax_t)bdinfo[i].bd_sectors, >>>> bdinfo[i].bd_sectorsize); >>>> - if (pager_output(line)) >>>> + if ((ret =3D pager_output(line)) !=3D 0) >>>> break; >>>> dev.d_dev =3D &biosdisk; >>>> dev.d_unit =3D i; >>>> @@ -346,12 +346,14 @@ bd_print(int verbose) >>>> bdinfo[i].bd_sectorsize, >>>> (bdinfo[i].bd_flags & BD_FLOPPY) ? >>>> DISK_F_NOCACHE: 0) =3D=3D 0) { >>>> - sprintf(line, " disk%d", i); >>>> - disk_print(&dev, line, verbose); >>>> + snprintf(line, sizeof(line), " disk%d", = i); >>>> + ret =3D disk_print(&dev, line, verbose); >>>> disk_close(&dev); >>>> + if (ret !=3D 0) >>>> + return (ret); >>>> } >>>> } >>>> - pager_close(); >>>> + return (ret); >>>> } >>>>=20 >>>> /* >>>>=20 >>>> Modified: head/sys/boot/i386/libi386/pxe.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/i386/libi386/pxe.c Tue Nov 8 06:13:22 2016 >>>> (r308433) >>>> +++ head/sys/boot/i386/libi386/pxe.c Tue Nov 8 06:50:18 2016 >>>> (r308434) >>>> @@ -75,7 +75,7 @@ static int pxe_strategy(void *devdata, i >>>> size_t offset, size_t size, char *buf, >>>> size_t *rsize); >>>> static int pxe_open(struct open_file *f, ...); >>>> static int pxe_close(struct open_file *f); >>>> -static void pxe_print(int verbose); >>>> +static int pxe_print(int verbose); >>>> static void pxe_cleanup(void); >>>> static void pxe_setnfshandle(char *rootpath); >>>>=20 >>>> @@ -381,14 +381,20 @@ pxe_close(struct open_file *f) >>>> return (0); >>>> } >>>>=20 >>>> -static void >>>> +static int >>>> pxe_print(int verbose) >>>> { >>>> - >>>> + char line[255]; >>>> if (pxe_call =3D=3D NULL) >>>> - return; >>>> + return (0); >>>>=20 >>>> - printf(" pxe0: %s:%s\n", inet_ntoa(rootip), = rootpath); >>>> + if (verbose) { >>>> + snprintf(line, sizeof(line), " pxe0: = %s:%s\n", >>>> + inet_ntoa(rootip), rootpath); >>>> + } else { >>>> + snprintf(line, sizeof(line), " pxe0:\n"); >>>> + } >>>> + return (pager_output(line)); >>>> } >>>>=20 >>>> static void >>>>=20 >>>> Modified: head/sys/boot/mips/beri/loader/beri_disk_cfi.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Nov 8 >>>> 06:13:22 2016 (r308433) >>>> +++ head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Nov 8 >>>> 06:50:18 2016 (r308434) >>>> @@ -47,7 +47,7 @@ static int beri_cfi_disk_close(struct op >>>> static void beri_cfi_disk_cleanup(void); >>>> static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t, >>>> size_t, >>>> char *, size_t *); >>>> -static void beri_cfi_disk_print(int); >>>> +static int beri_cfi_disk_print(int); >>>>=20 >>>> struct devsw beri_cfi_disk =3D { >>>> .dv_name =3D "cfi", >>>> @@ -112,25 +112,29 @@ beri_cfi_disk_close(struct open_file *f) >>>> return (disk_close(dev)); >>>> } >>>>=20 >>>> -static void >>>> +static int >>>> beri_cfi_disk_print(int verbose) >>>> { >>>> struct disk_devdesc dev; >>>> char line[80]; >>>> + int ret; >>>>=20 >>>> - sprintf(line, " cfi%d CFI flash device\n", 0); >>>> - pager_output(line); >>>> + snprintf(line, sizeof(line), " cfi%d CFI flash = device\n", >>>> 0); >>>> + ret =3D pager_output(line); >>>> + if (ret !=3D 0) >>>> + return (ret); >>>> dev.d_dev =3D &beri_cfi_disk; >>>> dev.d_unit =3D 0; >>>> dev.d_slice =3D -1; >>>> dev.d_partition =3D -1; >>>> if (disk_open(&dev, cfi_get_mediasize(), >>>> cfi_get_sectorsize(), 0) =3D=3D 0) { >>>> - sprintf(line, " cfi%d", 0); >>>> - disk_print(&dev, line, verbose); >>>> + snprintf(line, sizeof(line), " cfi%d", 0); >>>> + ret =3D disk_print(&dev, line, verbose); >>>> disk_close(&dev); >>>> } >>>>=20 >>>> + return (ret); >>>> } >>>>=20 >>>> static void >>>>=20 >>>> Modified: head/sys/boot/mips/beri/loader/beri_disk_sdcard.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Nov 8 >>>> 06:13:22 2016 (r308433) >>>> +++ head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Nov 8 >>>> 06:50:18 2016 (r308434) >>>> @@ -47,7 +47,7 @@ static int beri_sdcard_disk_close(struct >>>> static void beri_sdcard_disk_cleanup(void); >>>> static int beri_sdcard_disk_strategy(void *, int, daddr_t, = size_t, >>>> size_t, >>>> char *, size_t *); >>>> -static void beri_sdcard_disk_print(int); >>>> +static int beri_sdcard_disk_print(int); >>>>=20 >>>> struct devsw beri_sdcard_disk =3D { >>>> .dv_name =3D "sdcard", >>>> @@ -123,19 +123,23 @@ beri_sdcard_disk_print(int verbose) >>>> { >>>> struct disk_devdesc dev; >>>> char line[80]; >>>> + int ret; >>>>=20 >>>> - sprintf(line, " sdcard%d Altera SD card drive\n", 0); >>>> - pager_output(line); >>>> + snprintf(line, sizeof(line), " sdcard%d Altera SD card >>>> drive\n", 0); >>>> + ret =3D pager_output(line); >>>> + if (ret !=3D 0) >>>> + return (ret); >>>> dev.d_dev =3D &beri_sdcard_disk; >>>> dev.d_unit =3D 0; >>>> dev.d_slice =3D -1; >>>> dev.d_partition =3D -1; >>>> if (disk_open(&dev, altera_sdcard_get_mediasize(), >>>> altera_sdcard_get_sectorsize(), 0) =3D=3D 0) { >>>> - sprintf(line, " sdcard%d", 0); >>>> - disk_print(&dev, line, verbose); >>>> + snprintf(line, sizeof(line), " sdcard%d", 0); >>>> + ret =3D disk_print(&dev, line, verbose); >>>> disk_close(&dev); >>>> } >>>> + return (ret); >>>> } >>>>=20 >>>> static void >>>>=20 >>>> Modified: head/sys/boot/ofw/libofw/ofw_disk.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/ofw/libofw/ofw_disk.c Tue Nov 8 06:13:22 2016 >>>> (r308433) >>>> +++ head/sys/boot/ofw/libofw/ofw_disk.c Tue Nov 8 06:50:18 2016 >>>> (r308434) >>>> @@ -47,7 +47,7 @@ static int ofwd_strategy(void *devdata, >>>> static int ofwd_open(struct open_file *f, ...); >>>> static int ofwd_close(struct open_file *f); >>>> static int ofwd_ioctl(struct open_file *f, u_long cmd, void = *data); >>>> -static void ofwd_print(int verbose); >>>> +static int ofwd_print(int verbose); >>>>=20 >>>> struct devsw ofwdisk =3D { >>>> "block", >>>> @@ -161,8 +161,8 @@ ofwd_ioctl(struct open_file *f __unused, >>>> return (EINVAL); >>>> } >>>>=20 >>>> -static void >>>> +static int >>>> ofwd_print(int verbose __unused) >>>> { >>>> - >>>> + return (0); >>>> } >>>>=20 >>>> Modified: head/sys/boot/pc98/libpc98/bioscd.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/pc98/libpc98/bioscd.c Tue Nov 8 06:13:22 2016 >>>> (r308433) >>>> +++ head/sys/boot/pc98/libpc98/bioscd.c Tue Nov 8 06:50:18 2016 >>>> (r308434) >>>> @@ -99,7 +99,7 @@ static int bc_realstrategy(void *devdata >>>> size_t offset, size_t size, char *buf, size_t >>>> *rsize); >>>> static int bc_open(struct open_file *f, ...); >>>> static int bc_close(struct open_file *f); >>>> -static void bc_print(int verbose); >>>> +static int bc_print(int verbose); >>>>=20 >>>> struct devsw bioscd =3D { >>>> "cd", >>>> @@ -173,20 +173,19 @@ bc_add(int biosdev) >>>> /* >>>> * Print information about disks >>>> */ >>>> -static void >>>> +static int >>>> bc_print(int verbose) >>>> { >>>> char line[80]; >>>> - int i; >>>> + int i, ret =3D 0; >>>>=20 >>>> - pager_open(); >>>> for (i =3D 0; i < nbcinfo; i++) { >>>> sprintf(line, " cd%d: Device 0x%x\n", i, >>>> bcinfo[i].bc_sp.sp_devicespec); >>>> - if (pager_output(line)) >>>> + if ((ret =3D pager_output(line)) !=3D 0) >>>> break; >>>> } >>>> - pager_close(); >>>> + return (ret); >>>> } >>>>=20 >>>> /* >>>>=20 >>>> Modified: head/sys/boot/pc98/libpc98/biosdisk.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/pc98/libpc98/biosdisk.c Tue Nov 8 06:13:22 = 2016 >>>> (r308433) >>>> +++ head/sys/boot/pc98/libpc98/biosdisk.c Tue Nov 8 06:50:18 = 2016 >>>> (r308434) >>>> @@ -123,7 +123,7 @@ static int bd_realstrategy(void *devdata >>>> size_t offset, size_t size, char *buf, size_t >>>> *rsize); >>>> static int bd_open(struct open_file *f, ...); >>>> static int bd_close(struct open_file *f); >>>> -static void bd_print(int verbose); >>>> +static int bd_print(int verbose); >>>>=20 >>>> struct devsw biosdisk =3D { >>>> "disk", >>>> @@ -249,21 +249,20 @@ bd_int13probe(struct bdinfo *bd) >>>> /* >>>> * Print information about disks >>>> */ >>>> -static void >>>> +static int >>>> bd_print(int verbose) >>>> { >>>> - int i, j, done; >>>> + int i, j, ret =3D 0; >>>> char line[80]; >>>> struct i386_devdesc dev; >>>> struct open_disk *od; >>>> struct pc98_partition *dptr; >>>>=20 >>>> - pager_open(); >>>> - done =3D 0; >>>> - for (i =3D 0; i < nbdinfo && !done; i++) { >>>> - sprintf(line, " disk%d: BIOS drive %c:\n", i, 'A' + = i); >>>> - if (pager_output(line)) >>>> - break; >>>> + for (i =3D 0; i < nbdinfo; i++) { >>>> + snprintf(line, sizeof(line), " disk%d: BIOS drive = %c:\n", >>>> + i, 'A' + i); >>>> + if ((ret =3D pager_output(line)) !=3D 0) >>>> + break; >>>>=20 >>>> /* try to open the whole disk */ >>>> dev.d_unit =3D i; >>>> @@ -278,17 +277,17 @@ bd_print(int verbose) >>>>=20 >>>> /* Check for a "dedicated" disk */ >>>> for (j =3D 0; j < od->od_nslices; j++) { >>>> - sprintf(line, " disk%ds%d", i, j + 1); >>>> - if (bd_printslice(od, &dptr[j], line, verbose)) = { >>>> - done =3D 1; >>>> - break; >>>> - } >>>> + snprintf(line, sizeof(line), " disk%ds%d", = i, j >>>> + 1); >>>> + if ((ret =3D bd_printslice(od, &dptr[j], line, >>>> verbose)) !=3D 0) >>>> + break; >>>> } >>>> } >>>> bd_closedisk(od); >>>> + if (ret !=3D 0) >>>> + break; >>>> } >>>> } >>>> - pager_close(); >>>> + return (ret); >>>> } >>>>=20 >>>> /* Given a size in 512 byte sectors, convert it to a human-readable >>>> number. */ >>>>=20 >>>> Modified: head/sys/boot/powerpc/kboot/hostdisk.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/powerpc/kboot/hostdisk.c Tue Nov 8 06:13:22 = 2016 >>>> (r308433) >>>> +++ head/sys/boot/powerpc/kboot/hostdisk.c Tue Nov 8 06:50:18 = 2016 >>>> (r308434) >>>> @@ -37,7 +37,7 @@ static int hostdisk_strategy(void *devda >>>> static int hostdisk_open(struct open_file *f, ...); >>>> static int hostdisk_close(struct open_file *f); >>>> static int hostdisk_ioctl(struct open_file *f, u_long cmd, void = *data); >>>> -static void hostdisk_print(int verbose); >>>> +static int hostdisk_print(int verbose); >>>>=20 >>>> struct devsw hostdisk =3D { >>>> "/dev", >>>> @@ -117,9 +117,9 @@ hostdisk_ioctl(struct open_file *f, u_lo >>>> return (EINVAL); >>>> } >>>>=20 >>>> -static void >>>> +static int >>>> hostdisk_print(int verbose) >>>> { >>>> - >>>> + return (0); >>>> } >>>>=20 >>>>=20 >>>> Modified: head/sys/boot/powerpc/ps3/ps3cdrom.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Nov 8 06:13:22 = 2016 >>>> (r308433) >>>> +++ head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Nov 8 06:50:18 = 2016 >>>> (r308434) >>>> @@ -49,7 +49,7 @@ static int ps3cdrom_strategy(void *devda >>>> size_t offset, size_t size, char *buf, size_t *rsize); >>>> static int ps3cdrom_open(struct open_file *f, ...); >>>> static int ps3cdrom_close(struct open_file *f); >>>> -static void ps3cdrom_print(int verbose); >>>> +static int ps3cdrom_print(int verbose); >>>>=20 >>>> struct devsw ps3cdrom =3D { >>>> "cd", >>>> @@ -149,6 +149,7 @@ static int ps3cdrom_close(struct open_fi >>>> return 0; >>>> } >>>>=20 >>>> -static void ps3cdrom_print(int verbose) >>>> +static int ps3cdrom_print(int verbose) >>>> { >>>> + return (0); >>>> } >>>>=20 >>>> Modified: head/sys/boot/powerpc/ps3/ps3disk.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/powerpc/ps3/ps3disk.c Tue Nov 8 06:13:22 2016 >>>> (r308433) >>>> +++ head/sys/boot/powerpc/ps3/ps3disk.c Tue Nov 8 06:50:18 2016 >>>> (r308434) >>>> @@ -61,7 +61,7 @@ static int ps3disk_strategy(void *devdat >>>> size_t offset, size_t size, char *buf, size_t *rsize); >>>> static int ps3disk_open(struct open_file *f, ...); >>>> static int ps3disk_close(struct open_file *f); >>>> -static void ps3disk_print(int verbose); >>>> +static int ps3disk_print(int verbose); >>>>=20 >>>> struct devsw ps3disk =3D { >>>> "disk", >>>> @@ -186,8 +186,9 @@ static int ps3disk_close(struct open_fil >>>> return 0; >>>> } >>>>=20 >>>> -static void ps3disk_print(int verbose) >>>> +static int ps3disk_print(int verbose) >>>> { >>>> + return (0); >>>> } >>>>=20 >>>> static int ps3disk_open_gpt(struct ps3_devdesc *dev, struct = open_dev >>>> *od) >>>>=20 >>>> Modified: head/sys/boot/uboot/lib/disk.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/uboot/lib/disk.c Tue Nov 8 06:13:22 2016 >>>> (r308433) >>>> +++ head/sys/boot/uboot/lib/disk.c Tue Nov 8 06:50:18 2016 >>>> (r308434) >>>> @@ -78,7 +78,7 @@ static int stor_strategy(void *, int, da >>>> static int stor_open(struct open_file *, ...); >>>> static int stor_close(struct open_file *); >>>> static int stor_ioctl(struct open_file *f, u_long cmd, void *data); >>>> -static void stor_print(int); >>>> +static int stor_print(int); >>>> static void stor_cleanup(void); >>>>=20 >>>> struct devsw uboot_storage =3D { >>>> @@ -238,30 +238,31 @@ stor_readdev(struct disk_devdesc *dev, d >>>> return (err); >>>> } >>>>=20 >>>> -static void >>>> +static int >>>> stor_print(int verbose) >>>> { >>>> struct disk_devdesc dev; >>>> static char line[80]; >>>> - int i; >>>> + int i, ret =3D 0; >>>>=20 >>>> - pager_open(); >>>> for (i =3D 0; i < stor_info_no; i++) { >>>> dev.d_dev =3D &uboot_storage; >>>> dev.d_unit =3D i; >>>> dev.d_slice =3D -1; >>>> dev.d_partition =3D -1; >>>> - sprintf(line, "\tdisk%d (%s)\n", i, >>>> + snprintf(line, sizeof(line), "\tdisk%d (%s)\n", i, >>>> ub_stor_type(SI(&dev).type)); >>>> - if (pager_output(line)) >>>> + if ((ret =3D pager_output(line)) !=3D 0) >>>> break; >>>> if (stor_opendev(&dev) =3D=3D 0) { >>>> sprintf(line, "\tdisk%d", i); >>>> - disk_print(&dev, line, verbose); >>>> + ret =3D disk_print(&dev, line, verbose); >>>> disk_close(&dev); >>>> + if (ret !=3D 0) >>>> + break; >>>> } >>>> } >>>> - pager_close(); >>>> + return (ret); >>>> } >>>>=20 >>>> static int >>>>=20 >>>> Modified: head/sys/boot/usb/storage/umass_loader.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/usb/storage/umass_loader.c Tue Nov 8 06:13:22 = 2016 >>>> (r308433) >>>> +++ head/sys/boot/usb/storage/umass_loader.c Tue Nov 8 06:50:18 = 2016 >>>> (r308434) >>>> @@ -50,7 +50,7 @@ static void umass_disk_cleanup(void); >>>> static int umass_disk_ioctl(struct open_file *, u_long, void *); >>>> static int umass_disk_strategy(void *, int, daddr_t, size_t, = size_t, >>>> char *, >>>> size_t *); >>>> -static void umass_disk_print(int); >>>> +static int umass_disk_print(int); >>>>=20 >>>> struct devsw umass_disk =3D { >>>> .dv_name =3D "umass", >>>> @@ -170,23 +170,26 @@ umass_disk_close(struct open_file *f) >>>> return (disk_close(dev)); >>>> } >>>>=20 >>>> -static void >>>> +static int >>>> umass_disk_print(int verbose) >>>> { >>>> struct disk_devdesc dev; >>>>=20 >>>> memset(&dev, 0, sizeof(dev)); >>>>=20 >>>> - pager_output(" umass0 UMASS device\n"); >>>> + ret =3D pager_output(" umass0 UMASS device\n"); >>>> + if (ret !=3D 0) >>>> + return (ret); >>>> dev.d_dev =3D &umass_disk; >>>> dev.d_unit =3D 0; >>>> dev.d_slice =3D -1; >>>> dev.d_partition =3D -1; >>>>=20 >>>> if (umass_disk_open_sub(&dev) =3D=3D 0) { >>>> - disk_print(&dev, " umass0", verbose); >>>> + ret =3D disk_print(&dev, " umass0", verbose); >>>> disk_close(&dev); >>>> } >>>> + return (ret); >>>> } >>>>=20 >>>> static void >>>>=20 >>>> Modified: head/sys/boot/userboot/userboot/host.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/userboot/userboot/host.c Tue Nov 8 06:13:22 = 2016 >>>> (r308433) >>>> +++ head/sys/boot/userboot/userboot/host.c Tue Nov 8 06:50:18 = 2016 >>>> (r308434) >>>> @@ -134,13 +134,13 @@ host_dev_init(void) >>>> return (0); >>>> } >>>>=20 >>>> -static void >>>> +static int >>>> host_dev_print(int verbose) >>>> { >>>> char line[80]; >>>>=20 >>>> - sprintf(line, " host%d: Host filesystem\n", 0); >>>> - pager_output(line); >>>> + snprintf(line, sizeof(line), " host%d: Host = filesystem\n", >>>> 0); >>>> + return (pager_output(line)); >>>> } >>>>=20 >>>> /* >>>>=20 >>>> Modified: head/sys/boot/userboot/userboot/userboot_disk.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/userboot/userboot/userboot_disk.c Tue Nov 8 >>>> 06:13:22 2016 (r308433) >>>> +++ head/sys/boot/userboot/userboot/userboot_disk.c Tue Nov 8 >>>> 06:50:18 2016 (r308434) >>>> @@ -60,7 +60,7 @@ static int userdisk_realstrategy(void *d >>>> static int userdisk_open(struct open_file *f, ...); >>>> static int userdisk_close(struct open_file *f); >>>> static int userdisk_ioctl(struct open_file *f, u_long cmd, void >>>> *data); >>>> -static void userdisk_print(int verbose); >>>> +static int userdisk_print(int verbose); >>>>=20 >>>> struct devsw userboot_disk =3D { >>>> "disk", >>>> @@ -116,27 +116,33 @@ userdisk_cleanup(void) >>>> /* >>>> * Print information about disks >>>> */ >>>> -static void >>>> +static int >>>> userdisk_print(int verbose) >>>> { >>>> struct disk_devdesc dev; >>>> char line[80]; >>>> - int i; >>>> + int i, ret =3D 0; >>>>=20 >>>> for (i =3D 0; i < userdisk_maxunit; i++) { >>>> - sprintf(line, " disk%d: Guest drive image\n", = i); >>>> - pager_output(line); >>>> + snprintf(line, sizeof(line), >>>> + " disk%d: Guest drive image\n", i); >>>> + ret =3D pager_output(line); >>>> + if (ret !=3D 0) >>>> + break; >>>> dev.d_dev =3D &userboot_disk; >>>> dev.d_unit =3D i; >>>> dev.d_slice =3D -1; >>>> dev.d_partition =3D -1; >>>> if (disk_open(&dev, ud_info[i].mediasize, >>>> ud_info[i].sectorsize, 0) =3D=3D 0) { >>>> - sprintf(line, " disk%d", i); >>>> - disk_print(&dev, line, verbose); >>>> + snprintf(line, sizeof(line), " disk%d", = i); >>>> + ret =3D disk_print(&dev, line, verbose); >>>> disk_close(&dev); >>>> + if (ret !=3D 0) >>>> + break; >>>> } >>>> } >>>> + return (ret); >>>> } >>>>=20 >>>> /* >>>>=20 >>>> Modified: head/sys/boot/zfs/zfs.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/zfs/zfs.c Tue Nov 8 06:13:22 2016 = (r308433) >>>> +++ head/sys/boot/zfs/zfs.c Tue Nov 8 06:50:18 2016 = (r308434) >>>> @@ -514,20 +514,23 @@ zfs_probe_dev(const char *devname, uint6 >>>> /* >>>> * Print information about ZFS pools >>>> */ >>>> -static void >>>> +static int >>>> zfs_dev_print(int verbose) >>>> { >>>> spa_t *spa; >>>> char line[80]; >>>> + int ret =3D 0; >>>>=20 >>>> if (verbose) { >>>> - spa_all_status(); >>>> - return; >>>> + return (spa_all_status()); >>>> } >>>> STAILQ_FOREACH(spa, &zfs_pools, spa_link) { >>>> - sprintf(line, " zfs:%s\n", spa->spa_name); >>>> - pager_output(line); >>>> + snprintf(line, sizeof(line), " zfs:%s\n", >>>> spa->spa_name); >>>> + ret =3D pager_output(line); >>>> + if (ret !=3D 0) >>>> + break; >>>> } >>>> + return (ret); >>>> } >>>>=20 >>>> /* >>>>=20 >>>> Modified: head/sys/boot/zfs/zfsimpl.c >>>>=20 >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/boot/zfs/zfsimpl.c Tue Nov 8 06:13:22 2016 = (r308433) >>>> +++ head/sys/boot/zfs/zfsimpl.c Tue Nov 8 06:50:18 2016 = (r308434) >>>> @@ -780,7 +780,7 @@ state_name(vdev_state_t state) >>>>=20 >>>> #else >>>>=20 >>>> -static void >>>> +static int >>>> pager_printf(const char *fmt, ...) >>>> { >>>> char line[80]; >>>> @@ -789,14 +789,14 @@ pager_printf(const char *fmt, ...) >>>> va_start(args, fmt); >>>> vsprintf(line, fmt, args); >>>> va_end(args); >>>> - pager_output(line); >>>> + return (pager_output(line)); >>>> } >>>>=20 >>>> #endif >>>>=20 >>>> #define STATUS_FORMAT " %s %s\n" >>>>=20 >>>> -static void >>>> +static int >>>> print_state(int indent, const char *name, vdev_state_t state) >>>> { >>>> int i; >>>> @@ -806,40 +806,56 @@ print_state(int indent, const char *name >>>> for (i =3D 0; i < indent; i++) >>>> strcat(buf, " "); >>>> strcat(buf, name); >>>>=20 >>>> *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** >>>> _______________________________________________ >>>> svn-src-head@freebsd.org mailing list >>>> https://lists.freebsd.org/mailman/listinfo/svn-src-head >>>> To unsubscribe, send any mail to = "svn-src-head-unsubscribe@freebsd.org" >>>=20 >>>=20 >>>=20 >>=20 From owner-svn-src-all@freebsd.org Fri Nov 11 18:47:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AFFDC3B460; Fri, 11 Nov 2016 18:47:54 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 181C31942; Fri, 11 Nov 2016 18:47:54 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABIlrdq079718; Fri, 11 Nov 2016 18:47:53 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABIlrxf079717; Fri, 11 Nov 2016 18:47:53 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201611111847.uABIlrxf079717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 11 Nov 2016 18:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308537 - head/lib/libgcc_s X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 18:47:54 -0000 Author: gjb Date: Fri Nov 11 18:47:53 2016 New Revision: 308537 URL: https://svnweb.freebsd.org/changeset/base/308537 Log: Spell 'PACKAGE' correctly. Submitted by: Kyle Evans, emaste MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/lib/libgcc_s/Makefile Modified: head/lib/libgcc_s/Makefile ============================================================================== --- head/lib/libgcc_s/Makefile Fri Nov 11 18:10:13 2016 (r308536) +++ head/lib/libgcc_s/Makefile Fri Nov 11 18:47:53 2016 (r308537) @@ -1,6 +1,6 @@ # $FreeBSD$ -PKG= clibs +PACKAGE= clibs SHLIB_NAME= libgcc_s.so.1 SHLIBDIR?= /lib From owner-svn-src-all@freebsd.org Fri Nov 11 18:57:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77871C3B6EE; Fri, 11 Nov 2016 18:57:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 392061FE0; Fri, 11 Nov 2016 18:57:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABIvfSO083722; Fri, 11 Nov 2016 18:57:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABIvfp8083721; Fri, 11 Nov 2016 18:57:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611111857.uABIvfp8083721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 18:57:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308538 - head/sys/dev/cpuctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 18:57:42 -0000 Author: kib Date: Fri Nov 11 18:57:41 2016 New Revision: 308538 URL: https://svnweb.freebsd.org/changeset/base/308538 Log: Increase the max allowed size of the microcode update blob for x86. Newer CPUs (SkyLakes) have updates of 100K size, which is bigger than current limit 32K. Increase it to 4M but leave the check around to prevent kernel memory allocator abuse. Some time ago, the memory for update was allocated by contigmalloc(9), and it was reasonable to be conservative as much as possible. Since all uses of contigmalloc(9) appear to be either misunderstanding or too cautious, and were removed, provide more slack than strictly neccessary. Submitted by: Oliver Pinter MFC after: 1 week Differential revision: https://reviews.freebsd.org/D8486 Modified: head/sys/dev/cpuctl/cpuctl.c Modified: head/sys/dev/cpuctl/cpuctl.c ============================================================================== --- head/sys/dev/cpuctl/cpuctl.c Fri Nov 11 18:47:53 2016 (r308537) +++ head/sys/dev/cpuctl/cpuctl.c Fri Nov 11 18:57:41 2016 (r308538) @@ -63,7 +63,7 @@ static d_ioctl_t cpuctl_ioctl; # define DPRINTF(...) #endif -#define UCODE_SIZE_MAX (32 * 1024) +#define UCODE_SIZE_MAX (4 * 1024 * 1024) static int cpuctl_do_msr(int cpu, cpuctl_msr_args_t *data, u_long cmd, struct thread *td); From owner-svn-src-all@freebsd.org Fri Nov 11 19:26:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE61AC3BEE8; Fri, 11 Nov 2016 19:26:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7CFAC1D45; Fri, 11 Nov 2016 19:26:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABJQfdG095912; Fri, 11 Nov 2016 19:26:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABJQfXT095911; Fri, 11 Nov 2016 19:26:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611111926.uABJQfXT095911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 19:26:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308539 - stable/11/sys/fs/msdosfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 19:26:42 -0000 Author: kib Date: Fri Nov 11 19:26:41 2016 New Revision: 308539 URL: https://svnweb.freebsd.org/changeset/base/308539 Log: MFC r308019: Remove useless NULL check. Modified: stable/11/sys/fs/msdosfs/msdosfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_vfsops.c Fri Nov 11 18:57:41 2016 (r308538) +++ stable/11/sys/fs/msdosfs/msdosfs_vfsops.c Fri Nov 11 19:26:41 2016 (r308539) @@ -760,8 +760,7 @@ error_exit: } if (pmp) { lockdestroy(&pmp->pm_fatlock); - if (pmp->pm_inusemap) - free(pmp->pm_inusemap, M_MSDOSFSFAT); + free(pmp->pm_inusemap, M_MSDOSFSFAT); free(pmp, M_MSDOSFSMNT); mp->mnt_data = NULL; } From owner-svn-src-all@freebsd.org Fri Nov 11 19:29:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BCC4C3BF5A; Fri, 11 Nov 2016 19:29:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 282C41EBC; Fri, 11 Nov 2016 19:29:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABJT1mC096072; Fri, 11 Nov 2016 19:29:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABJT1nB096071; Fri, 11 Nov 2016 19:29:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611111929.uABJT1nB096071@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 19:29:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308540 - stable/11/sys/fs/msdosfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 19:29:02 -0000 Author: kib Date: Fri Nov 11 19:29:01 2016 New Revision: 308540 URL: https://svnweb.freebsd.org/changeset/base/308540 Log: MFC r308020: Fix comment formatting. Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:26:41 2016 (r308539) +++ stable/11/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:29:01 2016 (r308540) @@ -972,12 +972,14 @@ extendfile(struct denode *dep, u_long co while (count > 0) { /* * Allocate a new cluster chain and cat onto the end of the - * file. * If the file is empty we make de_StartCluster point - * to the new block. Note that de_StartCluster being 0 is - * sufficient to be sure the file is empty since we exclude - * attempts to extend the root directory above, and the root - * dir is the only file with a startcluster of 0 that has - * blocks allocated (sort of). + * file. + * If the file is empty we make de_StartCluster point + * to the new block. Note that de_StartCluster being + * 0 is sufficient to be sure the file is empty since + * we exclude attempts to extend the root directory + * above, and the root dir is the only file with a + * startcluster of 0 that has blocks allocated (sort + * of). */ if (dep->de_StartCluster == 0) cn = 0; From owner-svn-src-all@freebsd.org Fri Nov 11 19:31:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F0B3C3C00D; Fri, 11 Nov 2016 19:31:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4EE7D10E8; Fri, 11 Nov 2016 19:31:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABJV6aP096234; Fri, 11 Nov 2016 19:31:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABJV6t7096233; Fri, 11 Nov 2016 19:31:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611111931.uABJV6t7096233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 19:31:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308541 - stable/11/sys/fs/msdosfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 19:31:07 -0000 Author: kib Date: Fri Nov 11 19:31:06 2016 New Revision: 308541 URL: https://svnweb.freebsd.org/changeset/base/308541 Log: MFC r308021: Use symbolic name for the free cluster number. Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:29:01 2016 (r308540) +++ stable/11/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:31:06 2016 (r308541) @@ -908,7 +908,7 @@ fillinusemap(struct msdosfsmount *pmp) readcn >>= 4; readcn &= pmp->pm_fatmask; - if (readcn == 0) + if (readcn == CLUST_FREE) usemap_free(pmp, cn); } if (bp != NULL) From owner-svn-src-all@freebsd.org Fri Nov 11 19:33:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90DA8C3C153; Fri, 11 Nov 2016 19:33:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43BF71520; Fri, 11 Nov 2016 19:33:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABJXQPf099776; Fri, 11 Nov 2016 19:33:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABJXQB0099775; Fri, 11 Nov 2016 19:33:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611111933.uABJXQB0099775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 19:33:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308542 - stable/11/sys/fs/msdosfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 19:33:27 -0000 Author: kib Date: Fri Nov 11 19:33:26 2016 New Revision: 308542 URL: https://svnweb.freebsd.org/changeset/base/308542 Log: MFC r308022: Use symbolic name for the value of fully free word in pm_inusemap. Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:31:06 2016 (r308541) +++ stable/11/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:33:26 2016 (r308542) @@ -60,6 +60,8 @@ #include #include +#define FULL_RUN ((u_int)0xffffffff) + static int chainalloc(struct msdosfsmount *pmp, u_long start, u_long count, u_long fillwith, u_long *retcluster, u_long *got); @@ -752,8 +754,8 @@ clusteralloc1(struct msdosfsmount *pmp, idx = cn / N_INUSEBITS; map = pmp->pm_inusemap[idx]; map |= (1 << (cn % N_INUSEBITS)) - 1; - if (map != (u_int)-1) { - cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1; + if (map != FULL_RUN) { + cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1; if ((l = chainlength(pmp, cn, count)) >= count) return (chainalloc(pmp, cn, count, fillwith, retcluster, got)); if (l > foundl) { @@ -769,8 +771,8 @@ clusteralloc1(struct msdosfsmount *pmp, idx = cn / N_INUSEBITS; map = pmp->pm_inusemap[idx]; map |= (1 << (cn % N_INUSEBITS)) - 1; - if (map != (u_int)-1) { - cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1; + if (map != FULL_RUN) { + cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1; if ((l = chainlength(pmp, cn, count)) >= count) return (chainalloc(pmp, cn, count, fillwith, retcluster, got)); if (l > foundl) { @@ -878,7 +880,7 @@ fillinusemap(struct msdosfsmount *pmp) * loop further down. */ for (cn = 0; cn < (pmp->pm_maxcluster + N_INUSEBITS) / N_INUSEBITS; cn++) - pmp->pm_inusemap[cn] = (u_int)-1; + pmp->pm_inusemap[cn] = FULL_RUN; /* * Figure how many free clusters are in the filesystem by ripping From owner-svn-src-all@freebsd.org Fri Nov 11 19:35:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B397CC3C1F9; Fri, 11 Nov 2016 19:35:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8534617AD; Fri, 11 Nov 2016 19:35:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABJZw4P000201; Fri, 11 Nov 2016 19:35:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABJZwbK000200; Fri, 11 Nov 2016 19:35:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611111935.uABJZwbK000200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 19:35:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308543 - stable/11/sys/fs/msdosfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 19:35:59 -0000 Author: kib Date: Fri Nov 11 19:35:58 2016 New Revision: 308543 URL: https://svnweb.freebsd.org/changeset/base/308543 Log: MFC r308023: If the fatchain() call in chainalloc() returned an error, revert marking the cluster run as in-use. Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:33:26 2016 (r308542) +++ stable/11/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:35:58 2016 (r308543) @@ -691,8 +691,11 @@ chainalloc(struct msdosfsmount *pmp, u_l pmp->pm_nxtfree = CLUST_FIRST; pmp->pm_flags |= MSDOSFS_FSIMOD; error = fatchain(pmp, start, count, fillwith); - if (error != 0) + if (error != 0) { + for (cl = start, n = count; n-- > 0;) + usemap_free(pmp, cl++); return (error); + } #ifdef MSDOSFS_DEBUG printf("clusteralloc(): allocated cluster chain at %lu (%lu clusters)\n", start, count); From owner-svn-src-all@freebsd.org Fri Nov 11 19:37:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F02EC3C25E; Fri, 11 Nov 2016 19:37:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1464C1946; Fri, 11 Nov 2016 19:37:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABJbpkD000333; Fri, 11 Nov 2016 19:37:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABJbpOj000332; Fri, 11 Nov 2016 19:37:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611111937.uABJbpOj000332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 19:37:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308544 - stable/11/sys/fs/msdosfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 19:37:52 -0000 Author: kib Date: Fri Nov 11 19:37:51 2016 New Revision: 308544 URL: https://svnweb.freebsd.org/changeset/base/308544 Log: MFC r308024: Ensure that cluster allocations never allocate clusters outside the volume limits. Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:35:58 2016 (r308543) +++ stable/11/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:37:51 2016 (r308544) @@ -382,6 +382,8 @@ usemap_alloc(struct msdosfsmount *pmp, u MSDOSFS_ASSERT_MP_LOCKED(pmp); + KASSERT(cn <= pmp->pm_maxcluster, ("cn too large %lu %lu", cn, + pmp->pm_maxcluster)); KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0, ("usemap_alloc on ro msdosfs mount")); KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) @@ -398,6 +400,9 @@ usemap_free(struct msdosfsmount *pmp, u_ { MSDOSFS_ASSERT_MP_LOCKED(pmp); + + KASSERT(cn <= pmp->pm_maxcluster, ("cn too large %lu %lu", cn, + pmp->pm_maxcluster)); KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0, ("usemap_free on ro msdosfs mount")); pmp->pm_freeclustercount++; @@ -637,6 +642,8 @@ chainlength(struct msdosfsmount *pmp, u_ MSDOSFS_ASSERT_MP_LOCKED(pmp); + if (start > pmp->pm_maxcluster) + return (0); max_idx = pmp->pm_maxcluster / N_INUSEBITS; idx = start / N_INUSEBITS; start %= N_INUSEBITS; @@ -644,11 +651,18 @@ chainlength(struct msdosfsmount *pmp, u_ map &= ~((1 << start) - 1); if (map) { len = ffs(map) - 1 - start; - return (len > count ? count : len); + len = MIN(len, count); + if (start + len > pmp->pm_maxcluster) + len = pmp->pm_maxcluster - start + 1; + return (len); } len = N_INUSEBITS - start; - if (len >= count) - return (count); + if (len >= count) { + len = count; + if (start + len > pmp->pm_maxcluster) + len = pmp->pm_maxcluster - start + 1; + return (len); + } while (++idx <= max_idx) { if (len >= count) break; @@ -659,7 +673,10 @@ chainlength(struct msdosfsmount *pmp, u_ } len += N_INUSEBITS; } - return (len > count ? count : len); + len = MIN(len, count); + if (start + len > pmp->pm_maxcluster) + len = pmp->pm_maxcluster - start + 1; + return (len); } /* @@ -918,6 +935,11 @@ fillinusemap(struct msdosfsmount *pmp) } if (bp != NULL) brelse(bp); + + for (cn = pmp->pm_maxcluster + 1; cn < (pmp->pm_maxcluster + + N_INUSEBITS) / N_INUSEBITS; cn++) + pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS); + return (0); } From owner-svn-src-all@freebsd.org Fri Nov 11 19:40:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71C8AC3C2DB; Fri, 11 Nov 2016 19:40:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 286C91ACC; Fri, 11 Nov 2016 19:40:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABJeY0Y000532; Fri, 11 Nov 2016 19:40:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABJeYra000529; Fri, 11 Nov 2016 19:40:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611111940.uABJeYra000529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 19:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308545 - stable/11/sys/fs/msdosfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 19:40:35 -0000 Author: kib Date: Fri Nov 11 19:40:34 2016 New Revision: 308545 URL: https://svnweb.freebsd.org/changeset/base/308545 Log: MFC r308025: Enable vn_io_fault() deadlock avoidance for msdosfs. Modified: stable/11/sys/fs/msdosfs/msdosfs_vfsops.c stable/11/sys/fs/msdosfs/msdosfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_vfsops.c Fri Nov 11 19:37:51 2016 (r308544) +++ stable/11/sys/fs/msdosfs/msdosfs_vfsops.c Fri Nov 11 19:40:34 2016 (r308545) @@ -742,7 +742,7 @@ mountmsdosfs(struct vnode *devvp, struct mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_USES_BCACHE; + mp->mnt_kern_flag |= MNTK_USES_BCACHE | MNTK_NO_IOPF; MNT_IUNLOCK(mp); if (pmp->pm_flags & MSDOSFS_LARGEFS) Modified: stable/11/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_vnops.c Fri Nov 11 19:37:51 2016 (r308544) +++ stable/11/sys/fs/msdosfs/msdosfs_vnops.c Fri Nov 11 19:40:34 2016 (r308545) @@ -593,7 +593,7 @@ msdosfs_read(struct vop_read_args *ap) diff = blsize - bp->b_resid; if (diff < n) n = diff; - error = uiomove(bp->b_data + on, (int) n, uio); + error = vn_io_fault_uiomove(bp->b_data + on, (int) n, uio); brelse(bp); } while (error == 0 && uio->uio_resid > 0 && n != 0); if (!isadir && (error == 0 || uio->uio_resid != orig_resid) && @@ -723,6 +723,12 @@ msdosfs_write(struct vop_write_args *ap) * then no need to read data from disk. */ bp = getblk(thisvp, bn, pmp->pm_bpcluster, 0, 0, 0); + /* + * This call to vfs_bio_clrbuf() ensures that + * even if vn_io_fault_uiomove() below faults, + * garbage from the newly instantiated buffer + * is not exposed to the userspace via mmap(). + */ vfs_bio_clrbuf(bp); /* * Do the bmap now, since pcbmap needs buffers @@ -760,7 +766,7 @@ msdosfs_write(struct vop_write_args *ap) /* * Copy the data from user space into the buf header. */ - error = uiomove(bp->b_data + croffset, n, uio); + error = vn_io_fault_uiomove(bp->b_data + croffset, n, uio); if (error) { brelse(bp); break; From owner-svn-src-all@freebsd.org Fri Nov 11 19:57:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB967C3C62B; Fri, 11 Nov 2016 19:57:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A92D313C8; Fri, 11 Nov 2016 19:57:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABJvAM9009521; Fri, 11 Nov 2016 19:57:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABJvAi2009520; Fri, 11 Nov 2016 19:57:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611111957.uABJvAi2009520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 19:57:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308546 - stable/10/sys/fs/msdosfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 19:57:12 -0000 Author: kib Date: Fri Nov 11 19:57:10 2016 New Revision: 308546 URL: https://svnweb.freebsd.org/changeset/base/308546 Log: MFC r308019: Remove useless NULL check. Modified: stable/10/sys/fs/msdosfs/msdosfs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/10/sys/fs/msdosfs/msdosfs_vfsops.c Fri Nov 11 19:40:34 2016 (r308545) +++ stable/10/sys/fs/msdosfs/msdosfs_vfsops.c Fri Nov 11 19:57:10 2016 (r308546) @@ -763,8 +763,7 @@ error_exit: } if (pmp) { lockdestroy(&pmp->pm_fatlock); - if (pmp->pm_inusemap) - free(pmp->pm_inusemap, M_MSDOSFSFAT); + free(pmp->pm_inusemap, M_MSDOSFSFAT); free(pmp, M_MSDOSFSMNT); mp->mnt_data = NULL; } From owner-svn-src-all@freebsd.org Fri Nov 11 19:58:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 282F7C3C694; Fri, 11 Nov 2016 19:58:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8C1615C7; Fri, 11 Nov 2016 19:58:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABJwQnY009680; Fri, 11 Nov 2016 19:58:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABJwQHd009679; Fri, 11 Nov 2016 19:58:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611111958.uABJwQHd009679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 19:58:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308547 - stable/10/sys/fs/msdosfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 19:58:27 -0000 Author: kib Date: Fri Nov 11 19:58:25 2016 New Revision: 308547 URL: https://svnweb.freebsd.org/changeset/base/308547 Log: MFC r308020: Fix comment formatting. Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/10/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:57:10 2016 (r308546) +++ stable/10/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:58:25 2016 (r308547) @@ -1019,12 +1019,14 @@ extendfile(dep, count, bpp, ncp, flags) while (count > 0) { /* * Allocate a new cluster chain and cat onto the end of the - * file. * If the file is empty we make de_StartCluster point - * to the new block. Note that de_StartCluster being 0 is - * sufficient to be sure the file is empty since we exclude - * attempts to extend the root directory above, and the root - * dir is the only file with a startcluster of 0 that has - * blocks allocated (sort of). + * file. + * If the file is empty we make de_StartCluster point + * to the new block. Note that de_StartCluster being + * 0 is sufficient to be sure the file is empty since + * we exclude attempts to extend the root directory + * above, and the root dir is the only file with a + * startcluster of 0 that has blocks allocated (sort + * of). */ if (dep->de_StartCluster == 0) cn = 0; From owner-svn-src-all@freebsd.org Fri Nov 11 19:59:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 631B3C3C6FD; Fri, 11 Nov 2016 19:59:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34BC71724; Fri, 11 Nov 2016 19:59:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABJxgea009838; Fri, 11 Nov 2016 19:59:42 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABJxgfX009837; Fri, 11 Nov 2016 19:59:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611111959.uABJxgfX009837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 19:59:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308548 - stable/10/sys/fs/msdosfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 19:59:43 -0000 Author: kib Date: Fri Nov 11 19:59:42 2016 New Revision: 308548 URL: https://svnweb.freebsd.org/changeset/base/308548 Log: MFC r308021: Use symbolic name for the free cluster number. Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/10/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:58:25 2016 (r308547) +++ stable/10/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:59:42 2016 (r308548) @@ -951,7 +951,7 @@ fillinusemap(pmp) readcn >>= 4; readcn &= pmp->pm_fatmask; - if (readcn == 0) + if (readcn == CLUST_FREE) usemap_free(pmp, cn); } if (bp != NULL) From owner-svn-src-all@freebsd.org Fri Nov 11 20:01:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35177C3C861; Fri, 11 Nov 2016 20:01:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE5DC19E7; Fri, 11 Nov 2016 20:01:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABK1vhQ013503; Fri, 11 Nov 2016 20:01:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABK1vLe013502; Fri, 11 Nov 2016 20:01:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611112001.uABK1vLe013502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 20:01:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308549 - stable/10/sys/fs/msdosfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 20:01:58 -0000 Author: kib Date: Fri Nov 11 20:01:56 2016 New Revision: 308549 URL: https://svnweb.freebsd.org/changeset/base/308549 Log: MFC r308022: Use symbolic name for the value of fully free word in pm_inusemap. Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/10/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 19:59:42 2016 (r308548) +++ stable/10/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 20:01:56 2016 (r308549) @@ -60,6 +60,8 @@ #include #include +#define FULL_RUN ((u_int)0xffffffff) + static int chainalloc(struct msdosfsmount *pmp, u_long start, u_long count, u_long fillwith, u_long *retcluster, u_long *got); @@ -792,8 +794,8 @@ clusteralloc1(struct msdosfsmount *pmp, idx = cn / N_INUSEBITS; map = pmp->pm_inusemap[idx]; map |= (1 << (cn % N_INUSEBITS)) - 1; - if (map != (u_int)-1) { - cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1; + if (map != FULL_RUN) { + cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1; if ((l = chainlength(pmp, cn, count)) >= count) return (chainalloc(pmp, cn, count, fillwith, retcluster, got)); if (l > foundl) { @@ -809,8 +811,8 @@ clusteralloc1(struct msdosfsmount *pmp, idx = cn / N_INUSEBITS; map = pmp->pm_inusemap[idx]; map |= (1 << (cn % N_INUSEBITS)) - 1; - if (map != (u_int)-1) { - cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1; + if (map != FULL_RUN) { + cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1; if ((l = chainlength(pmp, cn, count)) >= count) return (chainalloc(pmp, cn, count, fillwith, retcluster, got)); if (l > foundl) { @@ -921,7 +923,7 @@ fillinusemap(pmp) * loop further down. */ for (cn = 0; cn < (pmp->pm_maxcluster + N_INUSEBITS) / N_INUSEBITS; cn++) - pmp->pm_inusemap[cn] = (u_int)-1; + pmp->pm_inusemap[cn] = FULL_RUN; /* * Figure how many free clusters are in the filesystem by ripping From owner-svn-src-all@freebsd.org Fri Nov 11 20:04:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F1D6C3C8CE; Fri, 11 Nov 2016 20:04:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 130771CE3; Fri, 11 Nov 2016 20:04:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABK4J2o013751; Fri, 11 Nov 2016 20:04:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABK4JvP013750; Fri, 11 Nov 2016 20:04:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611112004.uABK4JvP013750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 20:04:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308550 - stable/10/sys/fs/msdosfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 20:04:20 -0000 Author: kib Date: Fri Nov 11 20:04:19 2016 New Revision: 308550 URL: https://svnweb.freebsd.org/changeset/base/308550 Log: MFC r308023: If the fatchain() call in chainalloc() returned an error, revert marking the cluster run as in-use. Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/10/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 20:01:56 2016 (r308549) +++ stable/10/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 20:04:19 2016 (r308550) @@ -731,8 +731,11 @@ chainalloc(pmp, start, count, fillwith, pmp->pm_nxtfree = CLUST_FIRST; pmp->pm_flags |= MSDOSFS_FSIMOD; error = fatchain(pmp, start, count, fillwith); - if (error != 0) + if (error != 0) { + for (cl = start, n = count; n-- > 0;) + usemap_free(pmp, cl++); return (error); + } #ifdef MSDOSFS_DEBUG printf("clusteralloc(): allocated cluster chain at %lu (%lu clusters)\n", start, count); From owner-svn-src-all@freebsd.org Fri Nov 11 20:06:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A3DFC3C93F; Fri, 11 Nov 2016 20:06:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 326031E76; Fri, 11 Nov 2016 20:06:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABK67vO013945; Fri, 11 Nov 2016 20:06:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABK672K013944; Fri, 11 Nov 2016 20:06:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611112006.uABK672K013944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 20:06:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308551 - stable/10/sys/fs/msdosfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 20:06:08 -0000 Author: kib Date: Fri Nov 11 20:06:07 2016 New Revision: 308551 URL: https://svnweb.freebsd.org/changeset/base/308551 Log: MFC r308024: Ensure that cluster allocations never allocate clusters outside the volume limits. Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/10/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 20:04:19 2016 (r308550) +++ stable/10/sys/fs/msdosfs/msdosfs_fat.c Fri Nov 11 20:06:07 2016 (r308551) @@ -401,6 +401,8 @@ usemap_alloc(pmp, cn) MSDOSFS_ASSERT_MP_LOCKED(pmp); + KASSERT(cn <= pmp->pm_maxcluster, ("cn too large %lu %lu", cn, + pmp->pm_maxcluster)); KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0, ("usemap_alloc on ro msdosfs mount")); KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) @@ -419,6 +421,9 @@ usemap_free(pmp, cn) { MSDOSFS_ASSERT_MP_LOCKED(pmp); + + KASSERT(cn <= pmp->pm_maxcluster, ("cn too large %lu %lu", cn, + pmp->pm_maxcluster)); KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0, ("usemap_free on ro msdosfs mount")); pmp->pm_freeclustercount++; @@ -672,6 +677,8 @@ chainlength(pmp, start, count) MSDOSFS_ASSERT_MP_LOCKED(pmp); + if (start > pmp->pm_maxcluster) + return (0); max_idx = pmp->pm_maxcluster / N_INUSEBITS; idx = start / N_INUSEBITS; start %= N_INUSEBITS; @@ -679,11 +686,18 @@ chainlength(pmp, start, count) map &= ~((1 << start) - 1); if (map) { len = ffs(map) - 1 - start; - return (len > count ? count : len); + len = MIN(len, count); + if (start + len > pmp->pm_maxcluster) + len = pmp->pm_maxcluster - start + 1; + return (len); } len = N_INUSEBITS - start; - if (len >= count) - return (count); + if (len >= count) { + len = count; + if (start + len > pmp->pm_maxcluster) + len = pmp->pm_maxcluster - start + 1; + return (len); + } while (++idx <= max_idx) { if (len >= count) break; @@ -694,7 +708,10 @@ chainlength(pmp, start, count) } len += N_INUSEBITS; } - return (len > count ? count : len); + len = MIN(len, count); + if (start + len > pmp->pm_maxcluster) + len = pmp->pm_maxcluster - start + 1; + return (len); } /* @@ -961,6 +978,11 @@ fillinusemap(pmp) } if (bp != NULL) brelse(bp); + + for (cn = pmp->pm_maxcluster + 1; cn < (pmp->pm_maxcluster + + N_INUSEBITS) / N_INUSEBITS; cn++) + pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS); + return (0); } From owner-svn-src-all@freebsd.org Fri Nov 11 20:08:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BB22C3C9FA; Fri, 11 Nov 2016 20:08:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0307510DB; Fri, 11 Nov 2016 20:08:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABK8koS014307; Fri, 11 Nov 2016 20:08:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABK8k29014305; Fri, 11 Nov 2016 20:08:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611112008.uABK8k29014305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 20:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308552 - stable/10/sys/fs/msdosfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 20:08:47 -0000 Author: kib Date: Fri Nov 11 20:08:45 2016 New Revision: 308552 URL: https://svnweb.freebsd.org/changeset/base/308552 Log: MFC r308025: Enable vn_io_fault() deadlock avoidance for msdosfs. Modified: stable/10/sys/fs/msdosfs/msdosfs_vfsops.c stable/10/sys/fs/msdosfs/msdosfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/10/sys/fs/msdosfs/msdosfs_vfsops.c Fri Nov 11 20:06:07 2016 (r308551) +++ stable/10/sys/fs/msdosfs/msdosfs_vfsops.c Fri Nov 11 20:08:45 2016 (r308552) @@ -743,7 +743,7 @@ mountmsdosfs(struct vnode *devvp, struct mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_USES_BCACHE; + mp->mnt_kern_flag |= MNTK_USES_BCACHE | MNTK_NO_IOPF; MNT_IUNLOCK(mp); if (pmp->pm_flags & MSDOSFS_LARGEFS) Modified: stable/10/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- stable/10/sys/fs/msdosfs/msdosfs_vnops.c Fri Nov 11 20:06:07 2016 (r308551) +++ stable/10/sys/fs/msdosfs/msdosfs_vnops.c Fri Nov 11 20:08:45 2016 (r308552) @@ -640,7 +640,7 @@ msdosfs_read(ap) diff = blsize - bp->b_resid; if (diff < n) n = diff; - error = uiomove(bp->b_data + on, (int) n, uio); + error = vn_io_fault_uiomove(bp->b_data + on, (int) n, uio); brelse(bp); } while (error == 0 && uio->uio_resid > 0 && n != 0); if (!isadir && (error == 0 || uio->uio_resid != orig_resid) && @@ -776,6 +776,12 @@ msdosfs_write(ap) * then no need to read data from disk. */ bp = getblk(thisvp, bn, pmp->pm_bpcluster, 0, 0, 0); + /* + * This call to vfs_bio_clrbuf() ensures that + * even if vn_io_fault_uiomove() below faults, + * garbage from the newly instantiated buffer + * is not exposed to the userspace via mmap(). + */ vfs_bio_clrbuf(bp); /* * Do the bmap now, since pcbmap needs buffers @@ -813,7 +819,7 @@ msdosfs_write(ap) /* * Copy the data from user space into the buf header. */ - error = uiomove(bp->b_data + croffset, n, uio); + error = vn_io_fault_uiomove(bp->b_data + croffset, n, uio); if (error) { brelse(bp); break; From owner-svn-src-all@freebsd.org Fri Nov 11 20:09:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0EFD8C3CA6E; Fri, 11 Nov 2016 20:09:56 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1C8E1287; Fri, 11 Nov 2016 20:09:55 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABK9t5Q014439; Fri, 11 Nov 2016 20:09:55 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABK9t0i014438; Fri, 11 Nov 2016 20:09:55 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201611112009.uABK9t0i014438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Fri, 11 Nov 2016 20:09:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308553 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 20:09:56 -0000 Author: cem Date: Fri Nov 11 20:09:54 2016 New Revision: 308553 URL: https://svnweb.freebsd.org/changeset/base/308553 Log: ioat(4): Fix race between process_events and reset_hw In the case where a hardware error is detected during ioat_process_events, hardware may advance (by one descriptor, probably) and a subsequent ioat_process_events may race the intended ioat_reset_hw followup. In that case, the second process_events would observe a completion update that does not match the software "last_seen" status, and attempt to successfully complete already-failed descriptors. Guard against this race with the resetting_cleanup flag. Reviewed by: bdrewery, markj Sponsored by: Dell EMC Isilon Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Fri Nov 11 20:08:45 2016 (r308552) +++ head/sys/dev/ioat/ioat.c Fri Nov 11 20:09:54 2016 (r308553) @@ -765,6 +765,15 @@ out: mtx_lock(&ioat->submit_lock); mtx_lock(&ioat->cleanup_lock); ioat->quiescing = TRUE; + /* + * This is safe to do here because we have both locks and the submit + * queue is quiesced. We know that we will drain all outstanding + * events, so ioat_reset_hw can't deadlock. It is necessary to + * protect other ioat_process_event threads from racing ioat_reset_hw, + * reading an indeterminate hw state, and attempting to continue + * issuing completions. + */ + ioat->resetting_cleanup = TRUE; chanerr = ioat_read_4(ioat, IOAT_CHANERR_OFFSET); if (1 <= g_ioat_debug_level) From owner-svn-src-all@freebsd.org Fri Nov 11 20:18:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D07AC3CC14; Fri, 11 Nov 2016 20:18:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D9AC1723; Fri, 11 Nov 2016 20:18:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABKI9rS018735; Fri, 11 Nov 2016 20:18:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABKI9uh018732; Fri, 11 Nov 2016 20:18:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611112018.uABKI9uh018732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 20:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308554 - in stable/11/sys: kern sys ufs/ffs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 20:18:10 -0000 Author: kib Date: Fri Nov 11 20:18:08 2016 New Revision: 308554 URL: https://svnweb.freebsd.org/changeset/base/308554 Log: MFC r308026: Generalize UFS buffer pager. MFC r308442: Tweaks for the buffer pager. Modified: stable/11/sys/kern/vfs_bio.c stable/11/sys/sys/buf.h stable/11/sys/ufs/ffs/ffs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_bio.c ============================================================================== --- stable/11/sys/kern/vfs_bio.c Fri Nov 11 20:09:54 2016 (r308553) +++ stable/11/sys/kern/vfs_bio.c Fri Nov 11 20:18:08 2016 (r308554) @@ -75,9 +75,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include +#include +#include +#include #include #include #include @@ -4691,6 +4692,165 @@ bdata2bio(struct buf *bp, struct bio *bi } } +static int buf_pager_relbuf; +SYSCTL_INT(_vfs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN, + &buf_pager_relbuf, 0, + "Make buffer pager release buffers after reading"); + +/* + * The buffer pager. It uses buffer reads to validate pages. + * + * In contrast to the generic local pager from vm/vnode_pager.c, this + * pager correctly and easily handles volumes where the underlying + * device block size is greater than the machine page size. The + * buffer cache transparently extends the requested page run to be + * aligned at the block boundary, and does the necessary bogus page + * replacements in the addends to avoid obliterating already valid + * pages. + * + * The only non-trivial issue is that the exclusive busy state for + * pages, which is assumed by the vm_pager_getpages() interface, is + * incompatible with the VMIO buffer cache's desire to share-busy the + * pages. This function performs a trivial downgrade of the pages' + * state before reading buffers, and a less trivial upgrade from the + * shared-busy to excl-busy state after the read. + */ +int +vfs_bio_getpages(struct vnode *vp, vm_page_t *ma, int count, + int *rbehind, int *rahead, vbg_get_lblkno_t get_lblkno, + vbg_get_blksize_t get_blksize) +{ + vm_page_t m; + vm_object_t object; + struct buf *bp; + struct mount *mp; + daddr_t lbn, lbnp; + vm_ooffset_t la, lb, poff, poffe; + long bsize; + int bo_bs, br_flags, error, i; + bool redo, lpart; + + object = vp->v_object; + mp = vp->v_mount; + la = IDX_TO_OFF(ma[count - 1]->pindex); + if (la >= object->un_pager.vnp.vnp_size) + return (VM_PAGER_BAD); + lpart = la + PAGE_SIZE > object->un_pager.vnp.vnp_size; + bo_bs = get_blksize(vp, get_lblkno(vp, IDX_TO_OFF(ma[0]->pindex))); + if (rbehind != NULL) { + lb = IDX_TO_OFF(ma[0]->pindex); + *rbehind = OFF_TO_IDX(lb - rounddown2(lb, bo_bs)); + } + if (rahead != NULL) { + *rahead = OFF_TO_IDX(roundup2(la, bo_bs) - la); + if (la + IDX_TO_OFF(*rahead) >= object->un_pager.vnp.vnp_size) { + *rahead = OFF_TO_IDX(roundup2(object->un_pager. + vnp.vnp_size, PAGE_SIZE) - la); + } + } + br_flags = (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMAPPED_BUFS) + != 0) ? GB_UNMAPPED : 0; + VM_OBJECT_WLOCK(object); +again: + for (i = 0; i < count; i++) + vm_page_busy_downgrade(ma[i]); + VM_OBJECT_WUNLOCK(object); + + lbnp = -1; + for (i = 0; i < count; i++) { + m = ma[i]; + + /* + * Pages are shared busy and the object lock is not + * owned, which together allow for the pages' + * invalidation. The racy test for validity avoids + * useless creation of the buffer for the most typical + * case when invalidation is not used in redo or for + * parallel read. The shared->excl upgrade loop at + * the end of the function catches the race in a + * reliable way (protected by the object lock). + */ + if (m->valid == VM_PAGE_BITS_ALL) + continue; + + poff = IDX_TO_OFF(m->pindex); + poffe = MIN(poff + PAGE_SIZE, object->un_pager.vnp.vnp_size); + for (; poff < poffe; poff += bsize) { + lbn = get_lblkno(vp, poff); + if (lbn == lbnp) + goto next_page; + lbnp = lbn; + + bsize = get_blksize(vp, lbn); + error = bread_gb(vp, lbn, bsize, curthread->td_ucred, + br_flags, &bp); + if (error != 0) + goto end_pages; + if (LIST_EMPTY(&bp->b_dep)) { + /* + * Invalidation clears m->valid, but + * may leave B_CACHE flag if the + * buffer existed at the invalidation + * time. In this case, recycle the + * buffer to do real read on next + * bread() after redo. + * + * Otherwise B_RELBUF is not strictly + * necessary, enable to reduce buf + * cache pressure. + */ + if (buf_pager_relbuf || + m->valid != VM_PAGE_BITS_ALL) + bp->b_flags |= B_RELBUF; + + bp->b_flags &= ~B_NOCACHE; + brelse(bp); + } else { + bqrelse(bp); + } + } + KASSERT(1 /* racy, enable for debugging */ || + m->valid == VM_PAGE_BITS_ALL || i == count - 1, + ("buf %d %p invalid", i, m)); + if (i == count - 1 && lpart) { + VM_OBJECT_WLOCK(object); + if (m->valid != 0 && + m->valid != VM_PAGE_BITS_ALL) + vm_page_zero_invalid(m, TRUE); + VM_OBJECT_WUNLOCK(object); + } +next_page:; + } +end_pages: + + VM_OBJECT_WLOCK(object); + redo = false; + for (i = 0; i < count; i++) { + vm_page_sunbusy(ma[i]); + ma[i] = vm_page_grab(object, ma[i]->pindex, VM_ALLOC_NORMAL); + + /* + * Since the pages were only sbusy while neither the + * buffer nor the object lock was held by us, or + * reallocated while vm_page_grab() slept for busy + * relinguish, they could have been invalidated. + * Recheck the valid bits and re-read as needed. + * + * Note that the last page is made fully valid in the + * read loop, and partial validity for the page at + * index count - 1 could mean that the page was + * invalidated or removed, so we must restart for + * safety as well. + */ + if (ma[i]->valid != VM_PAGE_BITS_ALL) + redo = true; + } + if (redo && error == 0) + goto again; + VM_OBJECT_WUNLOCK(object); + return (error != 0 ? VM_PAGER_ERROR : VM_PAGER_OK); +} + #include "opt_ddb.h" #ifdef DDB #include Modified: stable/11/sys/sys/buf.h ============================================================================== --- stable/11/sys/sys/buf.h Fri Nov 11 20:09:54 2016 (r308553) +++ stable/11/sys/sys/buf.h Fri Nov 11 20:18:08 2016 (r308554) @@ -68,6 +68,7 @@ extern struct bio_ops { } bioops; struct vm_object; +struct vm_page; typedef unsigned char b_xflags_t; @@ -547,6 +548,12 @@ void bpin(struct buf *); void bunpin(struct buf *); void bunpin_wait(struct buf *); +typedef daddr_t (vbg_get_lblkno_t)(struct vnode *, vm_ooffset_t); +typedef int (vbg_get_blksize_t)(struct vnode *, daddr_t); +int vfs_bio_getpages(struct vnode *vp, struct vm_page **ma, int count, + int *rbehind, int *rahead, vbg_get_lblkno_t get_lblkno, + vbg_get_blksize_t get_blksize); + #endif /* _KERNEL */ #endif /* !_SYS_BUF_H_ */ Modified: stable/11/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_vnops.c Fri Nov 11 20:09:54 2016 (r308553) +++ stable/11/sys/ufs/ffs/ffs_vnops.c Fri Nov 11 20:18:08 2016 (r308554) @@ -87,7 +87,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -1791,160 +1790,33 @@ SYSCTL_DECL(_vfs_ffs); static int use_buf_pager = 0; SYSCTL_INT(_vfs_ffs, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN, &use_buf_pager, 0, "Always use buffer pager instead of bmap"); -static int buf_pager_relbuf; -SYSCTL_INT(_vfs_ffs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN, - &buf_pager_relbuf, 0, - "Make buffer pager release buffers after reading"); -/* - * The FFS pager. It uses buffer reads to validate pages. - * - * In contrast to the generic local pager from vm/vnode_pager.c, this - * pager correctly and easily handles volumes where the underlying - * device block size is greater than the machine page size. The - * buffer cache transparently extends the requested page run to be - * aligned at the block boundary, and does the necessary bogus page - * replacements in the addends to avoid obliterating already valid - * pages. - * - * The only non-trivial issue is that the exclusive busy state for - * pages, which is assumed by the vm_pager_getpages() interface, is - * incompatible with the VMIO buffer cache's desire to share-busy the - * pages. This function performs a trivial downgrade of the pages' - * state before reading buffers, and a less trivial upgrade from the - * shared-busy to excl-busy state after the read. - */ +static daddr_t +ffs_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) +{ + + return (lblkno(VFSTOUFS(vp->v_mount)->um_fs, off)); +} + +static int +ffs_gbp_getblksz(struct vnode *vp, daddr_t lbn) +{ + + return (blksize(VFSTOUFS(vp->v_mount)->um_fs, VTOI(vp), lbn)); +} + static int ffs_getpages(struct vop_getpages_args *ap) { struct vnode *vp; - vm_page_t *ma, m; - vm_object_t object; - struct buf *bp; struct ufsmount *um; - ufs_lbn_t lbn, lbnp; - vm_ooffset_t la, lb; - long bsize; - int bo_bs, count, error, i; - bool redo, lpart; vp = ap->a_vp; - ma = ap->a_m; - count = ap->a_count; + um = VFSTOUFS(vp->v_mount); - um = VFSTOUFS(ap->a_vp->v_mount); - bo_bs = um->um_devvp->v_bufobj.bo_bsize; - if (!use_buf_pager && bo_bs <= PAGE_SIZE) - return (vnode_pager_generic_getpages(vp, ma, count, + if (!use_buf_pager && um->um_devvp->v_bufobj.bo_bsize <= PAGE_SIZE) + return (vnode_pager_generic_getpages(vp, ap->a_m, ap->a_count, ap->a_rbehind, ap->a_rahead, NULL, NULL)); - - object = vp->v_object; - la = IDX_TO_OFF(ma[count - 1]->pindex); - if (la >= object->un_pager.vnp.vnp_size) - return (VM_PAGER_BAD); - lpart = la + PAGE_SIZE > object->un_pager.vnp.vnp_size; - if (ap->a_rbehind != NULL) { - lb = IDX_TO_OFF(ma[0]->pindex); - *ap->a_rbehind = OFF_TO_IDX(lb - rounddown2(lb, bo_bs)); - } - if (ap->a_rahead != NULL) { - *ap->a_rahead = OFF_TO_IDX(roundup2(la, bo_bs) - la); - if (la + IDX_TO_OFF(*ap->a_rahead) >= - object->un_pager.vnp.vnp_size) { - *ap->a_rahead = OFF_TO_IDX(roundup2(object->un_pager. - vnp.vnp_size, PAGE_SIZE) - la); - } - } - VM_OBJECT_WLOCK(object); -again: - for (i = 0; i < count; i++) - vm_page_busy_downgrade(ma[i]); - VM_OBJECT_WUNLOCK(object); - - lbnp = -1; - for (i = 0; i < count; i++) { - m = ma[i]; - - /* - * Pages are shared busy and the object lock is not - * owned, which together allow for the pages' - * invalidation. The racy test for validity avoids - * useless creation of the buffer for the most typical - * case when invalidation is not used in redo or for - * parallel read. The shared->excl upgrade loop at - * the end of the function catches the race in a - * reliable way (protected by the object lock). - */ - if (m->valid == VM_PAGE_BITS_ALL) - continue; - - lbn = lblkno(um->um_fs, IDX_TO_OFF(m->pindex)); - if (lbn != lbnp) { - bsize = blksize(um->um_fs, VTOI(vp), lbn); - error = bread_gb(vp, lbn, bsize, NOCRED, GB_UNMAPPED, - &bp); - if (error != 0) - break; - KASSERT(1 /* racy, enable for debugging */ || - m->valid == VM_PAGE_BITS_ALL || i == count - 1, - ("buf %d %p invalid", i, m)); - if (i == count - 1 && lpart) { - VM_OBJECT_WLOCK(object); - if (m->valid != 0 && - m->valid != VM_PAGE_BITS_ALL) - vm_page_zero_invalid(m, TRUE); - VM_OBJECT_WUNLOCK(object); - } - if (LIST_EMPTY(&bp->b_dep)) { - /* - * Invalidation clears m->valid, but - * may leave B_CACHE flag if the - * buffer existed at the invalidation - * time. In this case, recycle the - * buffer to do real read on next - * bread() after redo. - * - * Otherwise B_RELBUF is not strictly - * necessary, enable to reduce buf - * cache pressure. - */ - if (buf_pager_relbuf || - m->valid != VM_PAGE_BITS_ALL) - bp->b_flags |= B_RELBUF; - - bp->b_flags &= ~B_NOCACHE; - brelse(bp); - } else { - bqrelse(bp); - } - lbnp = lbn; - } - } - - VM_OBJECT_WLOCK(object); - redo = false; - for (i = 0; i < count; i++) { - vm_page_sunbusy(ma[i]); - ma[i] = vm_page_grab(object, ma[i]->pindex, VM_ALLOC_NORMAL); - - /* - * Since the pages were only sbusy while neither the - * buffer nor the object lock was held by us, or - * reallocated while vm_page_grab() slept for busy - * relinguish, they could have been invalidated. - * Recheck the valid bits and re-read as needed. - * - * Note that the last page is made fully valid in the - * read loop, and partial validity for the page at - * index count - 1 could mean that the page was - * invalidated or removed, so we must restart for - * safety as well. - */ - if (ma[i]->valid != VM_PAGE_BITS_ALL) - redo = true; - } - if (redo && error == 0) - goto again; - VM_OBJECT_WUNLOCK(object); - return (error != 0 ? VM_PAGER_ERROR : VM_PAGER_OK); + return (vfs_bio_getpages(vp, ap->a_m, ap->a_count, ap->a_rbehind, + ap->a_rahead, ffs_gbp_getblkno, ffs_gbp_getblksz)); } From owner-svn-src-all@freebsd.org Fri Nov 11 20:24:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86D55C3CD96; Fri, 11 Nov 2016 20:24:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E4501B52; Fri, 11 Nov 2016 20:24:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABKOspB022891; Fri, 11 Nov 2016 20:24:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABKOstU022890; Fri, 11 Nov 2016 20:24:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611112024.uABKOstU022890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 20:24:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308555 - stable/11/sys/fs/msdosfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 20:24:55 -0000 Author: kib Date: Fri Nov 11 20:24:54 2016 New Revision: 308555 URL: https://svnweb.freebsd.org/changeset/base/308555 Log: MFC r308027: Use buffer pager for msdosfs. For now, on stable/11, default is to use generic getpages() as before. Modified: stable/11/sys/fs/msdosfs/msdosfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_vnops.c Fri Nov 11 20:18:08 2016 (r308554) +++ stable/11/sys/fs/msdosfs/msdosfs_vnops.c Fri Nov 11 20:24:54 2016 (r308555) @@ -62,11 +62,13 @@ #include #include #include +#include #include #include #include #include +#include #include #include @@ -97,6 +99,7 @@ static vop_rmdir_t msdosfs_rmdir; static vop_symlink_t msdosfs_symlink; static vop_readdir_t msdosfs_readdir; static vop_bmap_t msdosfs_bmap; +static vop_getpages_t msdosfs_getpages; static vop_strategy_t msdosfs_strategy; static vop_print_t msdosfs_print; static vop_pathconf_t msdosfs_pathconf; @@ -1798,6 +1801,38 @@ msdosfs_bmap(struct vop_bmap_args *ap) return (0); } +SYSCTL_NODE(_vfs, OID_AUTO, msdosfs, CTLFLAG_RW, 0, "msdos filesystem"); +static int use_buf_pager = 0; +SYSCTL_INT(_vfs_msdosfs, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN, + &use_buf_pager, 0, + "Use buffer pager instead of bmap"); + +static daddr_t +msdosfs_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) +{ + + return (de_cluster(VTODE(vp)->de_pmp, off)); +} + +static int +msdosfs_gbp_getblksz(struct vnode *vp, daddr_t lbn) +{ + + return (VTODE(vp)->de_pmp->pm_bpcluster); +} + +static int +msdosfs_getpages(struct vop_getpages_args *ap) +{ + + if (use_buf_pager) + return (vfs_bio_getpages(ap->a_vp, ap->a_m, ap->a_count, + ap->a_rbehind, ap->a_rahead, msdosfs_gbp_getblkno, + msdosfs_gbp_getblksz)); + return (vnode_pager_generic_getpages(ap->a_vp, ap->a_m, ap->a_count, + ap->a_rbehind, ap->a_rahead, NULL, NULL)); +} + static int msdosfs_strategy(struct vop_strategy_args *ap) { @@ -1898,6 +1933,7 @@ struct vop_vector msdosfs_vnodeops = { .vop_access = msdosfs_access, .vop_bmap = msdosfs_bmap, + .vop_getpages = msdosfs_getpages, .vop_cachedlookup = msdosfs_lookup, .vop_open = msdosfs_open, .vop_close = msdosfs_close, From owner-svn-src-all@freebsd.org Fri Nov 11 20:27:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A07F9C3CE04; Fri, 11 Nov 2016 20:27:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 579A21CF3; Fri, 11 Nov 2016 20:27:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABKR0mf023107; Fri, 11 Nov 2016 20:27:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABKR0b1023106; Fri, 11 Nov 2016 20:27:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611112027.uABKR0b1023106@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 20:27:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308556 - stable/11/sys/fs/cd9660 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 20:27:01 -0000 Author: kib Date: Fri Nov 11 20:27:00 2016 New Revision: 308556 URL: https://svnweb.freebsd.org/changeset/base/308556 Log: MFC r308028: Use buffer pager for cd9660. For now, on stable/11, default is to use generic getpages() as before. Modified: stable/11/sys/fs/cd9660/cd9660_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/cd9660/cd9660_vnops.c ============================================================================== --- stable/11/sys/fs/cd9660/cd9660_vnops.c Fri Nov 11 20:24:54 2016 (r308555) +++ stable/11/sys/fs/cd9660/cd9660_vnops.c Fri Nov 11 20:27:00 2016 (r308556) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -74,6 +75,7 @@ static vop_readdir_t cd9660_readdir; static vop_readlink_t cd9660_readlink; static vop_strategy_t cd9660_strategy; static vop_vptofh_t cd9660_vptofh; +static vop_getpages_t cd9660_getpages; /* * Setattr call. Only allowed for block and character special devices. @@ -836,6 +838,45 @@ cd9660_vptofh(ap) return (0); } +SYSCTL_NODE(_vfs, OID_AUTO, cd9660, CTLFLAG_RW, 0, "cd9660 filesystem"); +static int use_buf_pager = 0; +SYSCTL_INT(_vfs_cd9660, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN, + &use_buf_pager, 0, + "Use buffer pager instead of bmap"); + +static daddr_t +cd9660_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) +{ + + return (lblkno(VTOI(vp)->i_mnt, off)); +} + +static int +cd9660_gbp_getblksz(struct vnode *vp, daddr_t lbn) +{ + struct iso_node *ip; + + ip = VTOI(vp); + return (blksize(ip->i_mnt, ip, lbn)); +} + +static int +cd9660_getpages(struct vop_getpages_args *ap) +{ + struct vnode *vp; + + vp = ap->a_vp; + if (vp->v_type == VCHR || vp->v_type == VBLK) + return (EOPNOTSUPP); + + if (use_buf_pager) + return (vfs_bio_getpages(vp, ap->a_m, ap->a_count, + ap->a_rbehind, ap->a_rahead, cd9660_gbp_getblkno, + cd9660_gbp_getblksz)); + return (vnode_pager_generic_getpages(vp, ap->a_m, ap->a_count, + ap->a_rbehind, ap->a_rahead, NULL, NULL)); +} + /* * Global vfs data structures for cd9660 */ @@ -857,6 +898,7 @@ struct vop_vector cd9660_vnodeops = { .vop_setattr = cd9660_setattr, .vop_strategy = cd9660_strategy, .vop_vptofh = cd9660_vptofh, + .vop_getpages = cd9660_getpages, }; /* From owner-svn-src-all@freebsd.org Fri Nov 11 20:31:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACD7DC3CF60; Fri, 11 Nov 2016 20:31:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6130D103B; Fri, 11 Nov 2016 20:31:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABKVNdN026999; Fri, 11 Nov 2016 20:31:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABKVNpg026998; Fri, 11 Nov 2016 20:31:23 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611112031.uABKVNpg026998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Nov 2016 20:31:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308557 - stable/11/sys/i386/i386 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 20:31:24 -0000 Author: kib Date: Fri Nov 11 20:31:23 2016 New Revision: 308557 URL: https://svnweb.freebsd.org/changeset/base/308557 Log: MFC r308029: Handle pmap_enter() over an existing 4/2M page in KVA on i386. Modified: stable/11/sys/i386/i386/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/i386/i386/pmap.c ============================================================================== --- stable/11/sys/i386/i386/pmap.c Fri Nov 11 20:27:00 2016 (r308556) +++ stable/11/sys/i386/i386/pmap.c Fri Nov 11 20:31:23 2016 (r308557) @@ -3466,11 +3466,14 @@ pmap_enter(pmap_t pmap, vm_offset_t va, PMAP_LOCK(pmap); sched_pin(); - /* - * In the case that a page table page is not - * resident, we are creating it here. - */ + pde = pmap_pde(pmap, va); if (va < VM_MAXUSER_ADDRESS) { + /* + * va is for UVA. + * In the case that a page table page is not resident, + * we are creating it here. pmap_allocpte() handles + * demotion. + */ mpte = pmap_allocpte(pmap, va, flags); if (mpte == NULL) { KASSERT((flags & PMAP_ENTER_NOSLEEP) != 0, @@ -3480,19 +3483,28 @@ pmap_enter(pmap_t pmap, vm_offset_t va, PMAP_UNLOCK(pmap); return (KERN_RESOURCE_SHORTAGE); } + } else { + /* + * va is for KVA, so pmap_demote_pde() will never fail + * to install a page table page. PG_V is also + * asserted by pmap_demote_pde(). + */ + KASSERT(pde != NULL && (*pde & PG_V) != 0, + ("KVA %#x invalid pde pdir %#jx", va, + (uintmax_t)pmap->pm_pdir[PTDPTDI])); + if ((*pde & PG_PS) != 0) + pmap_demote_pde(pmap, pde, va); } - - pde = pmap_pde(pmap, va); - if ((*pde & PG_PS) != 0) - panic("pmap_enter: attempted pmap_enter on 4MB page"); pte = pmap_pte_quick(pmap, va); /* - * Page Directory table entry not valid, we need a new PT page + * Page Directory table entry is not valid, which should not + * happen. We should have either allocated the page table + * page or demoted the existing mapping above. */ if (pte == NULL) { panic("pmap_enter: invalid page directory pdir=%#jx, va=%#x", - (uintmax_t)pmap->pm_pdir[PTDPTDI], va); + (uintmax_t)pmap->pm_pdir[PTDPTDI], va); } pa = VM_PAGE_TO_PHYS(m); From owner-svn-src-all@freebsd.org Fri Nov 11 20:44:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C22D0C3B388; Fri, 11 Nov 2016 20:44:34 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9BA231792; Fri, 11 Nov 2016 20:44:34 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABKiXJW030934; Fri, 11 Nov 2016 20:44:33 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABKiXat030933; Fri, 11 Nov 2016 20:44:33 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201611112044.uABKiXat030933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Fri, 11 Nov 2016 20:44:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308558 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 20:44:34 -0000 Author: cem Date: Fri Nov 11 20:44:33 2016 New Revision: 308558 URL: https://svnweb.freebsd.org/changeset/base/308558 Log: queue.3: Document existing QMD_* macros Feedback from: bapt, bdrewery, emaste Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D3983 Modified: head/sys/sys/queue.h Modified: head/sys/sys/queue.h ============================================================================== --- head/sys/sys/queue.h Fri Nov 11 20:31:23 2016 (r308557) +++ head/sys/sys/queue.h Fri Nov 11 20:44:33 2016 (r308558) @@ -472,6 +472,12 @@ struct { \ */ #if (defined(_KERNEL) && defined(INVARIANTS)) +/* + * QMD_LIST_CHECK_HEAD(LIST_HEAD *head, LIST_ENTRY NAME) + * + * If the list is non-empty, validates that the first element of the list + * points back at 'head.' + */ #define QMD_LIST_CHECK_HEAD(head, field) do { \ if (LIST_FIRST((head)) != NULL && \ LIST_FIRST((head))->field.le_prev != \ @@ -479,6 +485,12 @@ struct { \ panic("Bad list head %p first->prev != head", (head)); \ } while (0) +/* + * QMD_LIST_CHECK_NEXT(TYPE *elm, LIST_ENTRY NAME) + * + * If an element follows 'elm' in the list, validates that the next element + * points back at 'elm.' + */ #define QMD_LIST_CHECK_NEXT(elm, field) do { \ if (LIST_NEXT((elm), field) != NULL && \ LIST_NEXT((elm), field)->field.le_prev != \ @@ -486,6 +498,11 @@ struct { \ panic("Bad link elm %p next->prev != elm", (elm)); \ } while (0) +/* + * QMD_LIST_CHECK_PREV(TYPE *elm, LIST_ENTRY NAME) + * + * Validates that the previous element (or head of the list) points to 'elm.' + */ #define QMD_LIST_CHECK_PREV(elm, field) do { \ if (*(elm)->field.le_prev != (elm)) \ panic("Bad link elm %p prev->next != elm", (elm)); \ @@ -634,6 +651,12 @@ struct { \ * Tail queue functions. */ #if (defined(_KERNEL) && defined(INVARIANTS)) +/* + * QMD_TAILQ_CHECK_HEAD(TAILQ_HEAD *head, TAILQ_ENTRY NAME) + * + * If the tailq is non-empty, validates that the first element of the tailq + * points back at 'head.' + */ #define QMD_TAILQ_CHECK_HEAD(head, field) do { \ if (!TAILQ_EMPTY(head) && \ TAILQ_FIRST((head))->field.tqe_prev != \ @@ -641,11 +664,22 @@ struct { \ panic("Bad tailq head %p first->prev != head", (head)); \ } while (0) +/* + * QMD_TAILQ_CHECK_TAIL(TAILQ_HEAD *head, TAILQ_ENTRY NAME) + * + * Validates that the tail of the tailq is a pointer to pointer to NULL. + */ #define QMD_TAILQ_CHECK_TAIL(head, field) do { \ if (*(head)->tqh_last != NULL) \ panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \ } while (0) +/* + * QMD_TAILQ_CHECK_NEXT(TYPE *elm, TAILQ_ENTRY NAME) + * + * If an element follows 'elm' in the tailq, validates that the next element + * points back at 'elm.' + */ #define QMD_TAILQ_CHECK_NEXT(elm, field) do { \ if (TAILQ_NEXT((elm), field) != NULL && \ TAILQ_NEXT((elm), field)->field.tqe_prev != \ @@ -653,6 +687,11 @@ struct { \ panic("Bad link elm %p next->prev != elm", (elm)); \ } while (0) +/* + * QMD_TAILQ_CHECK_PREV(TYPE *elm, TAILQ_ENTRY NAME) + * + * Validates that the previous element (or head of the tailq) points to 'elm.' + */ #define QMD_TAILQ_CHECK_PREV(elm, field) do { \ if (*(elm)->field.tqe_prev != (elm)) \ panic("Bad link elm %p prev->next != elm", (elm)); \ From owner-svn-src-all@freebsd.org Fri Nov 11 21:01:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DA6DC3B67B; Fri, 11 Nov 2016 21:01:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D39B21E88; Fri, 11 Nov 2016 21:01:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABL1kG1038133; Fri, 11 Nov 2016 21:01:46 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABL1koq038132; Fri, 11 Nov 2016 21:01:46 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201611112101.uABL1koq038132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 11 Nov 2016 21:01:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308559 - head/contrib/llvm/lib/Target/AArch64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 21:01:47 -0000 Author: dim Date: Fri Nov 11 21:01:45 2016 New Revision: 308559 URL: https://svnweb.freebsd.org/changeset/base/308559 Log: Pull in r263169 from upstream llvm trunk (by Tim Northover): AArch64: only try to use scaled fcvt ops on legal vector types. Before we ended up calling getSimpleVectorType on a <3 x float>, which asserted. This fixes an assertion when building the print/ghostscript9-agpl-base port for AArch64. PR: 213865 MFC after: 3 days Modified: head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Modified: head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Fri Nov 11 20:44:33 2016 (r308558) +++ head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Fri Nov 11 21:01:45 2016 (r308559) @@ -7581,7 +7581,8 @@ static SDValue performFpToIntCombine(SDN return SDValue(); SDValue Op = N->getOperand(0); - if (!Op.getValueType().isVector() || Op.getOpcode() != ISD::FMUL) + if (!Op.getValueType().isVector() || !Op.getValueType().isSimple() || + Op.getOpcode() != ISD::FMUL) return SDValue(); SDValue ConstVec = Op->getOperand(1); From owner-svn-src-all@freebsd.org Fri Nov 11 21:29:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F322C3BD5E; Fri, 11 Nov 2016 21:29:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F4261BFD; Fri, 11 Nov 2016 21:29:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABLTmk5047222; Fri, 11 Nov 2016 21:29:48 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABLTmgA047221; Fri, 11 Nov 2016 21:29:48 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201611112129.uABLTmgA047221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 11 Nov 2016 21:29:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308560 - head/sys/dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 21:29:49 -0000 Author: jhibbits Date: Fri Nov 11 21:29:48 2016 New Revision: 308560 URL: https://svnweb.freebsd.org/changeset/base/308560 Log: Replace another fdt_is_compatible() call. Modified: head/sys/dev/fdt/fdt_powerpc.c Modified: head/sys/dev/fdt/fdt_powerpc.c ============================================================================== --- head/sys/dev/fdt/fdt_powerpc.c Fri Nov 11 21:01:45 2016 (r308559) +++ head/sys/dev/fdt/fdt_powerpc.c Fri Nov 11 21:29:48 2016 (r308560) @@ -112,7 +112,7 @@ fdt_fixup_fman(phandle_t root) * That frequency is equal to /soc node bus-frequency. */ for (node = OF_child(node); node != 0; node = OF_peer(node)) { - if (fdt_is_compatible(node, "fsl,fman") == 0) + if (ofw_bus_node_is_compatible(node, "fsl,fman") == 0) continue; if (OF_setprop(node, "clock-frequency", (void *)&freq, From owner-svn-src-all@freebsd.org Fri Nov 11 21:53:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83B07C3C51F; Fri, 11 Nov 2016 21:53:39 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53BBB19F2; Fri, 11 Nov 2016 21:53:39 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABLrcVh058887; Fri, 11 Nov 2016 21:53:38 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABLrcQa058886; Fri, 11 Nov 2016 21:53:38 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201611112153.uABLrcQa058886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Fri, 11 Nov 2016 21:53:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308561 - head/usr.sbin/bsnmpd/modules/snmp_bridge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 21:53:39 -0000 Author: gavin Date: Fri Nov 11 21:53:38 2016 New Revision: 308561 URL: https://svnweb.freebsd.org/changeset/base/308561 Log: Correct spelling in syslog: getttimeofday -> gettimeofday Modified: head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c Modified: head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c Fri Nov 11 21:29:48 2016 (r308560) +++ head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c Fri Nov 11 21:53:38 2016 (r308561) @@ -356,7 +356,7 @@ bridge_get_time_since_tc(struct bridge_i if (gettimeofday(&ct, NULL) < 0) { syslog(LOG_ERR, "bridge get time since last TC:" - "getttimeofday failed: %s", strerror(errno)); + "gettimeofday failed: %s", strerror(errno)); return (-1); } From owner-svn-src-all@freebsd.org Fri Nov 11 23:07:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8174DC3915F; Fri, 11 Nov 2016 23:07:32 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DFED1763; Fri, 11 Nov 2016 23:07:32 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABN7VMb086636; Fri, 11 Nov 2016 23:07:31 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABN7V6U086633; Fri, 11 Nov 2016 23:07:31 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201611112307.uABN7V6U086633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Fri, 11 Nov 2016 23:07:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308562 - head/tools/tools/git X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 23:07:32 -0000 Author: rstone Date: Fri Nov 11 23:07:31 2016 New Revision: 308562 URL: https://svnweb.freebsd.org/changeset/base/308562 Log: Fix git tools when run against a worktree In a git worktree, the gitdir is in an entirely different location. In arcgit, use git rev-parse --git-dir to get the correct path to it always. When running git from outside of the work tree, as in importgit, the path provided by git rev-parse --git-dir can be either a relative or absolute path depending on the work tree. Rather than trying to deal with that, just use git -C. Differential Revision: https://reviews.freebsd.org/D8501 Reviewed by: markj Modified: head/tools/tools/git/arcgit head/tools/tools/git/importgit Modified: head/tools/tools/git/arcgit ============================================================================== --- head/tools/tools/git/arcgit Fri Nov 11 21:53:38 2016 (r308561) +++ head/tools/tools/git/arcgit Fri Nov 11 23:07:31 2016 (r308562) @@ -69,7 +69,7 @@ create_review() git checkout $commit > /dev/null || error "Could not checkout $commit" - arc_dir="$(git rev-parse --show-toplevel)/.git/arc" + arc_dir="$(git rev-parse --git-dir)/arc" arc_msg="$arc_dir/create-message" mkdir -p $arc_dir git show -s --format='%B' HEAD > $arc_msg Modified: head/tools/tools/git/importgit ============================================================================== --- head/tools/tools/git/importgit Fri Nov 11 21:53:38 2016 (r308561) +++ head/tools/tools/git/importgit Fri Nov 11 23:07:31 2016 (r308562) @@ -50,7 +50,7 @@ error() exit 1 } -unset git range commit dry_run +unset git_repo range commit dry_run while getopts ":c:g:nr:" o do @@ -95,16 +95,16 @@ then error -u "-g argument is mandatory" fi -git="$git_repo/.git" - -if [ ! -d "$git" ] +if ! type git > /dev/null 2> /dev/null then - error "$git_repo does not seem to be a git repo" + error "Install devel/git first" fi -if ! type git > /dev/null 2> /dev/null +GIT="git -C $git_repo" + +if ! $GIT rev-parse --git-dir 2> /dev/null > /dev/null then - error "Install devel/git first" + error "$git_repo does not seem to be a git repo" fi if ! type svn > /dev/null 2> /dev/null @@ -122,21 +122,21 @@ then error "Could not communicate with svn server. Is your ssh key loaded?" fi -git --git-dir=$git log --format=%H $range | tail -r | while read -r commit +$GIT log --format=%H $range | tail -r | while read -r commit do - echo "Applying `git --git-dir=$git show -s --oneline $commit`" + echo "Applying `$GIT show -s --oneline $commit`" - if [ -n "$(git --git-dir=$git show --diff-filter=CDRTUXB $commit)" ] + if [ -n "$($GIT show --diff-filter=CDRTUXB $commit)" ] then error "Commit performed unsupported change (e.g. delete/rename)" fi - if [ "$(git --git-dir=$git show -s --format=%P $commit | wc -w)" -ne 1 ] + if [ "$($GIT show -s --format=%P $commit | wc -w)" -ne 1 ] then error "Cannot import merge commits" fi - git --git-dir=$git diff --diff-filter=A --name-only \ + $GIT diff --diff-filter=A --name-only \ ${commit}~..$commit | while read -r newfile do if [ -f "$newfile" ] @@ -158,10 +158,10 @@ do continue fi - git --git-dir=$git show $commit | patch -p 1 -s || \ + $GIT show $commit | patch -p 1 -s || \ error "Failed to apply patch" - git --git-dir=$git diff --diff-filter=A --name-only \ + $GIT diff --diff-filter=A --name-only \ ${commit}~..$commit | while read -r newfile do svn add --parents --depth=infinity $newfile || \ @@ -176,7 +176,7 @@ do exit $ret fi - git --git-dir=$git show -s --format='%B' $commit | svn commit -F - || \ + $GIT show -s --format='%B' $commit | svn commit -F - || \ error "Failed to commit" done From owner-svn-src-all@freebsd.org Fri Nov 11 23:28:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DB45C394CC; Fri, 11 Nov 2016 23:28:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1EFF51F4D; Fri, 11 Nov 2016 23:28:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uABNS8DY094714; Fri, 11 Nov 2016 23:28:08 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uABNS831094712; Fri, 11 Nov 2016 23:28:08 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201611112328.uABNS831094712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 11 Nov 2016 23:28:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308563 - in head/lib: libgcc_eh libgcc_s X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 23:28:09 -0000 Author: emaste Date: Fri Nov 11 23:28:07 2016 New Revision: 308563 URL: https://svnweb.freebsd.org/changeset/base/308563 Log: libcc_{s,eh}: build without SSP As in the gnu/lib/libgcc Makefile: libgcc is linked in last and thus cannot depend on ssp symbols coming from earlier libraries. Disable stack protection for this library. Reviewed by: dim Sponsored by: The FreeBSD Foundation Modified: head/lib/libgcc_eh/Makefile head/lib/libgcc_s/Makefile Modified: head/lib/libgcc_eh/Makefile ============================================================================== --- head/lib/libgcc_eh/Makefile Fri Nov 11 23:07:31 2016 (r308562) +++ head/lib/libgcc_eh/Makefile Fri Nov 11 23:28:07 2016 (r308563) @@ -5,6 +5,7 @@ PACKAGE= clibs LIB= gcc_eh NO_PIC= +MK_SSP= no WARNS?= 2 .include "Makefile.inc" Modified: head/lib/libgcc_s/Makefile ============================================================================== --- head/lib/libgcc_s/Makefile Fri Nov 11 23:07:31 2016 (r308562) +++ head/lib/libgcc_s/Makefile Fri Nov 11 23:28:07 2016 (r308563) @@ -4,6 +4,7 @@ PACKAGE= clibs SHLIB_NAME= libgcc_s.so.1 SHLIBDIR?= /lib +MK_SSP= no WARNS?= 2 LDFLAGS+= -nodefaultlibs From owner-svn-src-all@freebsd.org Fri Nov 11 23:36:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BA17C3978D; Fri, 11 Nov 2016 23:36:18 +0000 (UTC) (envelope-from joerg@bec.de) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [IPv6:2001:4b98:c:538::195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B5BA144E; Fri, 11 Nov 2016 23:36:17 +0000 (UTC) (envelope-from joerg@bec.de) Received: from britannica.bec.de (p200300D2ABC8E8104639C4FFFE599710.dip0.t-ipconnect.de [IPv6:2003:d2:abc8:e810:4639:c4ff:fe59:9710]) (Authenticated sender: joerg@bec.de) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id E045AA80C0; Sat, 12 Nov 2016 00:36:13 +0100 (CET) Date: Sat, 12 Nov 2016 00:36:12 +0100 From: Joerg Sonnenberger To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308563 - in head/lib: libgcc_eh libgcc_s Message-ID: <20161111233612.GA28088@britannica.bec.de> References: <201611112328.uABNS831094712@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201611112328.uABNS831094712@repo.freebsd.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 23:36:18 -0000 On Fri, Nov 11, 2016 at 11:28:08PM +0000, Ed Maste wrote: > Author: emaste > Date: Fri Nov 11 23:28:07 2016 > New Revision: 308563 > URL: https://svnweb.freebsd.org/changeset/base/308563 > > Log: > libcc_{s,eh}: build without SSP > > As in the gnu/lib/libgcc Makefile: > libgcc is linked in last and thus cannot depend on ssp > symbols coming from earlier libraries. Disable stack protection > for this library. That doesn't make sense to me given that libgcc_s at least definitely depends on libc for the system calls? Joerg From owner-svn-src-all@freebsd.org Sat Nov 12 00:14:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 347F2C3A69E; Sat, 12 Nov 2016 00:14:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 116C8C14; Sat, 12 Nov 2016 00:14:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAC0EDAt014780; Sat, 12 Nov 2016 00:14:13 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAC0EDQs014779; Sat, 12 Nov 2016 00:14:13 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611120014.uAC0EDQs014779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 12 Nov 2016 00:14:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308564 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 00:14:14 -0000 Author: jhb Date: Sat Nov 12 00:14:13 2016 New Revision: 308564 URL: https://svnweb.freebsd.org/changeset/base/308564 Log: Don't place threads on the run queue after waking up other CPUs. The other CPU might resume and see a still-empty runq and go back to sleep before sched_add() adds the thread to the runq. This results in a lost wakeup and a potential hang if the system is otherwise completely idle. The race originated due to a micro-optimization (my fault) in 4BSD in that it avoided putting a thread on the run queue if the scheduler was going to preempt to the new thread. To avoid complexity while fixing this race, just drop this optimization. 4BSD now always sets the "owepreempt" flag when a preemption is warranted and defers the actual preemption to the thread_unlock of the caller the same as ULE. MFC after: 2 weeks Sponsored by: Netflix Modified: head/sys/kern/sched_4bsd.c Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Fri Nov 11 23:28:07 2016 (r308563) +++ head/sys/kern/sched_4bsd.c Sat Nov 12 00:14:13 2016 (r308564) @@ -308,9 +308,8 @@ maybe_resched(struct thread *td) /* * This function is called when a thread is about to be put on run queue * because it has been made runnable or its priority has been adjusted. It - * determines if the new thread should be immediately preempted to. If so, - * it switches to it and eventually returns true. If not, it returns false - * so that the caller may place the thread on an appropriate run queue. + * determines if the new thread should preempt the current thread. If so, + * it sets td_owepreempt to request a preemption. */ int maybe_preempt(struct thread *td) @@ -356,29 +355,8 @@ maybe_preempt(struct thread *td) return (0); #endif - if (ctd->td_critnest > 1) { - CTR1(KTR_PROC, "maybe_preempt: in critical section %d", - ctd->td_critnest); - ctd->td_owepreempt = 1; - return (0); - } - /* - * Thread is runnable but not yet put on system run queue. - */ - MPASS(ctd->td_lock == td->td_lock); - MPASS(TD_ON_RUNQ(td)); - TD_SET_RUNNING(td); - CTR3(KTR_PROC, "preempting to thread %p (pid %d, %s)\n", td, - td->td_proc->p_pid, td->td_name); - mi_switch(SW_INVOL | SW_PREEMPT | SWT_PREEMPT, td); - /* - * td's lock pointer may have changed. We have to return with it - * locked. - */ - spinlock_enter(); - thread_unlock(ctd); - thread_lock(td); - spinlock_exit(); + CTR0(KTR_PROC, "maybe_preempt: scheduling preemption"); + ctd->td_owepreempt = 1; return (1); #else return (0); @@ -1332,6 +1310,12 @@ sched_add(struct thread *td, int flags) ts->ts_runq = &runq; } + if ((td->td_flags & TDF_NOLOAD) == 0) + sched_load_add(); + runq_add(ts->ts_runq, td, flags); + if (cpu != NOCPU) + runq_length[cpu]++; + cpuid = PCPU_GET(cpuid); if (single_cpu && cpu != cpuid) { kick_other_cpu(td->td_priority, cpu); @@ -1348,18 +1332,10 @@ sched_add(struct thread *td, int flags) } if (!forwarded) { - if ((flags & SRQ_YIELDING) == 0 && maybe_preempt(td)) - return; - else + if (!maybe_preempt(td)) maybe_resched(td); } } - - if ((td->td_flags & TDF_NOLOAD) == 0) - sched_load_add(); - runq_add(ts->ts_runq, td, flags); - if (cpu != NOCPU) - runq_length[cpu]++; } #else /* SMP */ { @@ -1393,23 +1369,11 @@ sched_add(struct thread *td, int flags) CTR2(KTR_RUNQ, "sched_add: adding td_sched:%p (td:%p) to runq", ts, td); ts->ts_runq = &runq; - /* - * If we are yielding (on the way out anyhow) or the thread - * being saved is US, then don't try be smart about preemption - * or kicking off another CPU as it won't help and may hinder. - * In the YIEDLING case, we are about to run whoever is being - * put in the queue anyhow, and in the OURSELF case, we are - * putting ourself on the run queue which also only happens - * when we are about to yield. - */ - if ((flags & SRQ_YIELDING) == 0) { - if (maybe_preempt(td)) - return; - } if ((td->td_flags & TDF_NOLOAD) == 0) sched_load_add(); runq_add(ts->ts_runq, td, flags); - maybe_resched(td); + if (!maybe_preempt(td)) + maybe_resched(td); } #endif /* SMP */ From owner-svn-src-all@freebsd.org Sat Nov 12 00:23:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD08BC3A93A; Sat, 12 Nov 2016 00:23:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F0451185; Sat, 12 Nov 2016 00:23:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAC0N9vj018533; Sat, 12 Nov 2016 00:23:09 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAC0N9fe018532; Sat, 12 Nov 2016 00:23:09 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611120023.uAC0N9fe018532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 12 Nov 2016 00:23:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308565 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 00:23:10 -0000 Author: jhb Date: Sat Nov 12 00:23:09 2016 New Revision: 308565 URL: https://svnweb.freebsd.org/changeset/base/308565 Log: Allow scheduling during early boot. - Send IPI wakeups once SMP is started even if cold is true. - Permit preemptions when cold is true. These changes are needed for EARLY_AP_STARTUP. MFC after: 2 weeks Sponsored by: Netflix Modified: head/sys/kern/sched_4bsd.c Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Sat Nov 12 00:14:13 2016 (r308564) +++ head/sys/kern/sched_4bsd.c Sat Nov 12 00:23:09 2016 (r308565) @@ -326,7 +326,6 @@ maybe_preempt(struct thread *td) * - The current thread has a higher (numerically lower) or * equivalent priority. Note that this prevents curthread from * trying to preempt to itself. - * - It is too early in the boot for context switches (cold is set). * - The current thread has an inhibitor set or is in the process of * exiting. In this case, the current thread is about to switch * out anyways, so there's no point in preempting. If we did, @@ -347,7 +346,7 @@ maybe_preempt(struct thread *td) ("maybe_preempt: trying to run inhibited thread")); pri = td->td_priority; cpri = ctd->td_priority; - if (panicstr != NULL || pri >= cpri || cold /* || dumping */ || + if (panicstr != NULL || pri >= cpri /* || dumping */ || TD_IS_INHIBITED(ctd)) return (0); #ifndef FULL_PREEMPTION @@ -1105,7 +1104,7 @@ forward_wakeup(int cpunum) if ((!forward_wakeup_enabled) || (forward_wakeup_use_mask == 0 && forward_wakeup_use_loop == 0)) return (0); - if (!smp_started || cold || panicstr) + if (!smp_started || panicstr) return (0); forward_wakeups_requested++; From owner-svn-src-all@freebsd.org Sat Nov 12 01:41:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A87F5C3AF1D; Sat, 12 Nov 2016 01:41:44 +0000 (UTC) (envelope-from jceel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 75A5E1DE6; Sat, 12 Nov 2016 01:41:44 +0000 (UTC) (envelope-from jceel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAC1fh8L049370; Sat, 12 Nov 2016 01:41:43 GMT (envelope-from jceel@FreeBSD.org) Received: (from jceel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAC1fh2J049369; Sat, 12 Nov 2016 01:41:43 GMT (envelope-from jceel@FreeBSD.org) Message-Id: <201611120141.uAC1fh2J049369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jceel set sender to jceel@FreeBSD.org using -f From: Jakub Wojciech Klama Date: Sat, 12 Nov 2016 01:41:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308566 - head/sys/dev/virtio/console X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 01:41:44 -0000 Author: jceel Date: Sat Nov 12 01:41:43 2016 New Revision: 308566 URL: https://svnweb.freebsd.org/changeset/base/308566 Log: Reserve space for control message payload (currently a port name). Approved by: trasz (mentor) Sponsored by: iXsystems, Inc. Modified: head/sys/dev/virtio/console/virtio_console.c Modified: head/sys/dev/virtio/console/virtio_console.c ============================================================================== --- head/sys/dev/virtio/console/virtio_console.c Sat Nov 12 00:23:09 2016 (r308565) +++ head/sys/dev/virtio/console/virtio_console.c Sat Nov 12 01:41:43 2016 (r308566) @@ -600,7 +600,7 @@ vtcon_ctrl_event_enqueue(struct vtcon_so sglist_init(&sg, 2, segs); error = sglist_append(&sg, control, - sizeof(struct virtio_console_control)); + sizeof(struct virtio_console_control) + VTCON_BULK_BUFSZ); KASSERT(error == 0, ("%s: error %d adding control to sglist", __func__, error)); @@ -633,7 +633,8 @@ vtcon_ctrl_event_requeue(struct vtcon_so { int error; - bzero(control, sizeof(struct virtio_console_control)); + bzero(control, sizeof(struct virtio_console_control) + + VTCON_BULK_BUFSZ); error = vtcon_ctrl_event_enqueue(sc, control); KASSERT(error == 0, From owner-svn-src-all@freebsd.org Sat Nov 12 03:07:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76520C3C1FC; Sat, 12 Nov 2016 03:07:42 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47F291840; Sat, 12 Nov 2016 03:07:42 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAC37fYp083244; Sat, 12 Nov 2016 03:07:41 GMT (envelope-from lidl@FreeBSD.org) Received: (from lidl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAC37f2S083243; Sat, 12 Nov 2016 03:07:41 GMT (envelope-from lidl@FreeBSD.org) Message-Id: <201611120307.uAC37f2S083243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lidl set sender to lidl@FreeBSD.org using -f From: Kurt Lidl Date: Sat, 12 Nov 2016 03:07:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308567 - head/libexec/ftpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 03:07:42 -0000 Author: lidl Date: Sat Nov 12 03:07:41 2016 New Revision: 308567 URL: https://svnweb.freebsd.org/changeset/base/308567 Log: Fix build when WITHOUT_BLACKLIST=yes is specified PR: 214409 Submitted by: matthew Reported by: matteo MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/libexec/ftpd/ftpd.c Modified: head/libexec/ftpd/ftpd.c ============================================================================== --- head/libexec/ftpd/ftpd.c Sat Nov 12 01:41:43 2016 (r308566) +++ head/libexec/ftpd/ftpd.c Sat Nov 12 03:07:41 2016 (r308567) @@ -93,10 +93,7 @@ __FBSDID("$FreeBSD$"); #include #endif -#ifdef USE_BLACKLIST #include "blacklist_client.h" -#endif - #include "pathnames.h" #include "extern.h" From owner-svn-src-all@freebsd.org Sat Nov 12 03:10:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70E98C3C37D; Sat, 12 Nov 2016 03:10:31 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from hydra.pix.net (hydra.pix.net [IPv6:2001:470:e254:11::4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.pix.net", Issuer "Pix.Com Technologies LLC CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4199C1A94; Sat, 12 Nov 2016 03:10:31 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from torb.pix.net (torb.pix.net [192.168.16.32]) (authenticated bits=0) by hydra.pix.net (8.16.0.19/8.15.2) with ESMTPA id uAC3ATcQ053656; Fri, 11 Nov 2016 22:10:29 -0500 (EST) (envelope-from lidl@FreeBSD.org) Reply-To: lidl@FreeBSD.org Subject: Re: svn commit: r308175 - head/libexec/ftpd References: <201611011818.uA1II9oe069262@repo.freebsd.org> To: Matteo Riondato Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Kurt Lidl Message-ID: Date: Fri, 11 Nov 2016 22:10:29 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 03:10:31 -0000 On 11/10/16 4:25 PM, Matteo Riondato wrote: > >> On Nov 1, 2016, at 2:18 PM, Kurt Lidl wrote: >> >> Author: lidl >> Date: Tue Nov 1 18:18:09 2016 >> New Revision: 308175 >> URL: https://svnweb.freebsd.org/changeset/base/308175 >> >> Log: >> Revisit blacklistd support in ftpd > > This commit is breaking buildworld for me with WITHOUT_BLACKLIST=y in src.conf : Oops. Should be fixed in r308567. -Kurt From owner-svn-src-all@freebsd.org Sat Nov 12 05:09:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D58EC3D62C; Sat, 12 Nov 2016 05:09:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD7C61B4A; Sat, 12 Nov 2016 05:09:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAC59e7W030457; Sat, 12 Nov 2016 05:09:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAC59eCd030456; Sat, 12 Nov 2016 05:09:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611120509.uAC59eCd030456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Nov 2016 05:09:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308568 - head/sys/dev/acpi_support X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 05:09:41 -0000 Author: mav Date: Sat Nov 12 05:09:39 2016 New Revision: 308568 URL: https://svnweb.freebsd.org/changeset/base/308568 Log: Set of improvements to acpi_hp(4) driver. - Attach only to WMI devices that provide supported GUIDs. HP Spectre x360 has two WMI devices, only one of which provides the GUIDs. - Pass proper device to ACPI_WMI_REMOVE_EVENT_HANDLER() on detach. - Improve error WMI handling separating status and data paths. This allows to hide sysctls not supported by specific hardware/BIOS. - Improve CMI block parser to make it work on HP Spectre x360 laptop. - In verbose mode log all unknown events to help futher improvements. Modified: head/sys/dev/acpi_support/acpi_hp.c Modified: head/sys/dev/acpi_support/acpi_hp.c ============================================================================== --- head/sys/dev/acpi_support/acpi_hp.c Sat Nov 12 03:07:41 2016 (r308567) +++ head/sys/dev/acpi_support/acpi_hp.c Sat Nov 12 05:09:39 2016 (r308568) @@ -66,11 +66,17 @@ ACPI_MODULE_NAME("HP") #define ACPI_HP_WMI_BIOS_GUID "5FB7F034-2C63-45E9-BE91-3D44E2C707E4" #define ACPI_HP_WMI_CMI_GUID "2D114B49-2DFB-4130-B8FE-4A3C09E75133" -#define ACPI_HP_WMI_DISPLAY_COMMAND 0x1 -#define ACPI_HP_WMI_HDDTEMP_COMMAND 0x2 -#define ACPI_HP_WMI_ALS_COMMAND 0x3 -#define ACPI_HP_WMI_DOCK_COMMAND 0x4 -#define ACPI_HP_WMI_WIRELESS_COMMAND 0x5 +#define ACPI_HP_WMI_DISPLAY_COMMAND 0x1 +#define ACPI_HP_WMI_HDDTEMP_COMMAND 0x2 +#define ACPI_HP_WMI_ALS_COMMAND 0x3 +#define ACPI_HP_WMI_DOCK_COMMAND 0x4 +#define ACPI_HP_WMI_WIRELESS_COMMAND 0x5 +#define ACPI_HP_WMI_BIOS_COMMAND 0x9 +#define ACPI_HP_WMI_FEATURE_COMMAND 0xb +#define ACPI_HP_WMI_HOTKEY_COMMAND 0xc +#define ACPI_HP_WMI_FEATURE2_COMMAND 0xd +#define ACPI_HP_WMI_WIRELESS2_COMMAND 0x1b +#define ACPI_HP_WMI_POSTCODEERROR_COMMAND 0x2a #define ACPI_HP_METHOD_WLAN_ENABLED 1 #define ACPI_HP_METHOD_WLAN_RADIO 2 @@ -104,11 +110,32 @@ ACPI_MODULE_NAME("HP") #define HP_MASK_BLUETOOTH_ENABLED 0x20000 #define HP_MASK_WLAN_ENABLED 0x200 +#define ACPI_HP_EVENT_DOCK 0x01 +#define ACPI_HP_EVENT_PARK_HDD 0x02 +#define ACPI_HP_EVENT_SMART_ADAPTER 0x03 +#define ACPI_HP_EVENT_BEZEL_BUTTON 0x04 +#define ACPI_HP_EVENT_WIRELESS 0x05 +#define ACPI_HP_EVENT_CPU_BATTERY_THROTTLE 0x06 +#define ACPI_HP_EVENT_LOCK_SWITCH 0x07 +#define ACPI_HP_EVENT_LID_SWITCH 0x08 +#define ACPI_HP_EVENT_SCREEN_ROTATION 0x09 +#define ACPI_HP_EVENT_COOLSENSE_SYSTEM_MOBILE 0x0A +#define ACPI_HP_EVENT_COOLSENSE_SYSTEM_HOT 0x0B +#define ACPI_HP_EVENT_PROXIMITY_SENSOR 0x0C +#define ACPI_HP_EVENT_BACKLIT_KB_BRIGHTNESS 0x0D +#define ACPI_HP_EVENT_PEAKSHIFT_PERIOD 0x0F +#define ACPI_HP_EVENT_BATTERY_CHARGE_PERIOD 0x10 + #define ACPI_HP_CMI_DETAIL_PATHS 0x01 #define ACPI_HP_CMI_DETAIL_ENUMS 0x02 #define ACPI_HP_CMI_DETAIL_FLAGS 0x04 #define ACPI_HP_CMI_DETAIL_SHOW_MAX_INSTANCE 0x08 +#define ACPI_HP_WMI_RET_WRONG_SIGNATURE 0x02 +#define ACPI_HP_WMI_RET_UNKNOWN_COMMAND 0x03 +#define ACPI_HP_WMI_RET_UNKNOWN_CMDTYPE 0x04 +#define ACPI_HP_WMI_RET_INVALID_PARAMETERS 0x05 + struct acpi_hp_inst_seq_pair { UINT32 sequence; /* sequence number as suggested by cmi bios */ UINT8 instance; /* object instance on guid */ @@ -119,6 +146,7 @@ struct acpi_hp_softc { device_t wmi_dev; int has_notify; /* notification GUID found */ int has_cmi; /* CMI GUID found */ + int has_wireless; /* Wireless command found */ int cmi_detail; /* CMI detail level (set by sysctl) */ int verbose; /* add debug output */ @@ -287,7 +315,7 @@ static int acpi_hp_sysctl_set(struct acp int arg, int oldarg); static int acpi_hp_sysctl_get(struct acpi_hp_softc *sc, int method); static int acpi_hp_exec_wmi_command(device_t wmi_dev, int command, - int is_write, int val); + int is_write, int val, int *retval); static void acpi_hp_notify(ACPI_HANDLE h, UINT32 notify, void *context); static int acpi_hp_get_cmi_block(device_t wmi_dev, const char* guid, UINT8 instance, char* outbuf, size_t outsize, @@ -332,13 +360,18 @@ MODULE_DEPEND(acpi_hp, acpi, 1, 1, 1); static void acpi_hp_evaluate_auto_on_off(struct acpi_hp_softc *sc) { + int res; int wireless; int new_wlan_status; int new_bluetooth_status; int new_wwan_status; - wireless = acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0); + res = acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0, &wireless); + if (res != 0) { + device_printf(sc->wmi_dev, "Wireless command error %x\n", res); + return; + } new_wlan_status = -1; new_bluetooth_status = -1; new_wwan_status = -1; @@ -348,41 +381,41 @@ acpi_hp_evaluate_auto_on_off(struct acpi if (sc->wlan_disable_if_radio_off && !(wireless & HP_MASK_WLAN_RADIO) && (wireless & HP_MASK_WLAN_ENABLED)) { acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 1, 0x100); + ACPI_HP_WMI_WIRELESS_COMMAND, 1, 0x100, NULL); new_wlan_status = 0; } else if (sc->wlan_enable_if_radio_on && (wireless & HP_MASK_WLAN_RADIO) && !(wireless & HP_MASK_WLAN_ENABLED)) { acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 1, 0x101); + ACPI_HP_WMI_WIRELESS_COMMAND, 1, 0x101, NULL); new_wlan_status = 1; } if (sc->bluetooth_disable_if_radio_off && !(wireless & HP_MASK_BLUETOOTH_RADIO) && (wireless & HP_MASK_BLUETOOTH_ENABLED)) { acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 1, 0x200); + ACPI_HP_WMI_WIRELESS_COMMAND, 1, 0x200, NULL); new_bluetooth_status = 0; } else if (sc->bluetooth_enable_if_radio_on && (wireless & HP_MASK_BLUETOOTH_RADIO) && !(wireless & HP_MASK_BLUETOOTH_ENABLED)) { acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 1, 0x202); + ACPI_HP_WMI_WIRELESS_COMMAND, 1, 0x202, NULL); new_bluetooth_status = 1; } if (sc->wwan_disable_if_radio_off && !(wireless & HP_MASK_WWAN_RADIO) && (wireless & HP_MASK_WWAN_ENABLED)) { acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 1, 0x400); + ACPI_HP_WMI_WIRELESS_COMMAND, 1, 0x400, NULL); new_wwan_status = 0; } else if (sc->wwan_enable_if_radio_on && (wireless & HP_MASK_WWAN_RADIO) && !(wireless & HP_MASK_WWAN_ENABLED)) { acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 1, 0x404); + ACPI_HP_WMI_WIRELESS_COMMAND, 1, 0x404, NULL); new_wwan_status = 1; } @@ -441,6 +474,11 @@ acpi_hp_identify(driver_t *driver, devic if (device_find_child(parent, "acpi_hp", -1) != NULL) return; + /* Check BIOS GUID to see whether system is compatible. */ + if (!ACPI_WMI_PROVIDES_GUID_STRING(parent, + ACPI_HP_WMI_BIOS_GUID)) + return; + if (BUS_ADD_CHILD(parent, 0, "acpi_hp", -1) == NULL) device_printf(parent, "add acpi_hp child failed\n"); } @@ -476,7 +514,7 @@ acpi_hp_attach(device_t dev) sc->was_wwan_on_air = 0; sc->cmi_detail = 0; sc->cmi_order_size = -1; - sc->verbose = 0; + sc->verbose = bootverbose; memset(sc->cmi_order, 0, sizeof(sc->cmi_order)); sc->wmi_dev = device_get_parent(dev); @@ -513,13 +551,17 @@ acpi_hp_attach(device_t dev) sc->hpcmi_bufptr = -1; } + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0, NULL) == 0) + sc->has_wireless = 1; + ACPI_SERIAL_BEGIN(hp); sc->sysctl_ctx = device_get_sysctl_ctx(dev); sc->sysctl_tree = device_get_sysctl_tree(dev); for (int i = 0; acpi_hp_sysctls[i].name != NULL; ++i) { arg = 0; - if ((!sc->has_notify && + if (((!sc->has_notify || !sc->has_wireless) && (acpi_hp_sysctls[i].method == ACPI_HP_METHOD_WLAN_ENABLE_IF_RADIO_ON || acpi_hp_sysctls[i].method == @@ -577,8 +619,10 @@ acpi_hp_detach(device_t dev) if (sc->has_cmi && sc->hpcmi_open_pid != 0) return (EBUSY); - if (sc->has_notify) - ACPI_WMI_REMOVE_EVENT_HANDLER(dev, ACPI_HP_WMI_EVENT_GUID); + if (sc->has_notify) { + ACPI_WMI_REMOVE_EVENT_HANDLER(sc->wmi_dev, + ACPI_HP_WMI_EVENT_GUID); + } if (sc->has_cmi) { if (sc->hpcmi_bufptr != -1) { @@ -630,18 +674,21 @@ acpi_hp_sysctl_get(struct acpi_hp_softc switch (method) { case ACPI_HP_METHOD_WLAN_ENABLED: - val = acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0, &val)) + return (-EINVAL); val = ((val & HP_MASK_WLAN_ENABLED) != 0); break; case ACPI_HP_METHOD_WLAN_RADIO: - val = acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0, &val)) + return (-EINVAL); val = ((val & HP_MASK_WLAN_RADIO) != 0); break; case ACPI_HP_METHOD_WLAN_ON_AIR: - val = acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0, &val)) + return (-EINVAL); val = ((val & HP_MASK_WLAN_ON_AIR) != 0); break; case ACPI_HP_METHOD_WLAN_ENABLE_IF_RADIO_ON: @@ -651,18 +698,21 @@ acpi_hp_sysctl_get(struct acpi_hp_softc val = sc->wlan_disable_if_radio_off; break; case ACPI_HP_METHOD_BLUETOOTH_ENABLED: - val = acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0, &val)) + return (-EINVAL); val = ((val & HP_MASK_BLUETOOTH_ENABLED) != 0); break; case ACPI_HP_METHOD_BLUETOOTH_RADIO: - val = acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0, &val)) + return (-EINVAL); val = ((val & HP_MASK_BLUETOOTH_RADIO) != 0); break; case ACPI_HP_METHOD_BLUETOOTH_ON_AIR: - val = acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0, &val)) + return (-EINVAL); val = ((val & HP_MASK_BLUETOOTH_ON_AIR) != 0); break; case ACPI_HP_METHOD_BLUETOOTH_ENABLE_IF_RADIO_ON: @@ -672,18 +722,21 @@ acpi_hp_sysctl_get(struct acpi_hp_softc val = sc->bluetooth_disable_if_radio_off; break; case ACPI_HP_METHOD_WWAN_ENABLED: - val = acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0, &val)) + return (-EINVAL); val = ((val & HP_MASK_WWAN_ENABLED) != 0); break; case ACPI_HP_METHOD_WWAN_RADIO: - val = acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0, &val)) + return (-EINVAL); val = ((val & HP_MASK_WWAN_RADIO) != 0); break; case ACPI_HP_METHOD_WWAN_ON_AIR: - val = acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_WIRELESS_COMMAND, 0, 0, &val)) + return (-EINVAL); val = ((val & HP_MASK_WWAN_ON_AIR) != 0); break; case ACPI_HP_METHOD_WWAN_ENABLE_IF_RADIO_ON: @@ -693,20 +746,24 @@ acpi_hp_sysctl_get(struct acpi_hp_softc val = sc->wwan_disable_if_radio_off; break; case ACPI_HP_METHOD_ALS: - val = acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_ALS_COMMAND, 0, 0); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_ALS_COMMAND, 0, 0, &val)) + return (-EINVAL); break; case ACPI_HP_METHOD_DISPLAY: - val = acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_DISPLAY_COMMAND, 0, 0); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_DISPLAY_COMMAND, 0, 0, &val)) + return (-EINVAL); break; case ACPI_HP_METHOD_HDDTEMP: - val = acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_HDDTEMP_COMMAND, 0, 0); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_HDDTEMP_COMMAND, 0, 0, &val)) + return (-EINVAL); break; case ACPI_HP_METHOD_DOCK: - val = acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_DOCK_COMMAND, 0, 0); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_DOCK_COMMAND, 0, 0, &val)) + return (-EINVAL); break; case ACPI_HP_METHOD_CMI_DETAIL: val = sc->cmi_detail; @@ -732,9 +789,11 @@ acpi_hp_sysctl_set(struct acpi_hp_softc if (arg != oldarg) { switch (method) { case ACPI_HP_METHOD_WLAN_ENABLED: - return (acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 1, - arg?0x101:0x100)); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_WIRELESS_COMMAND, 1, + arg?0x101:0x100, NULL)) + return (-EINVAL); + break; case ACPI_HP_METHOD_WLAN_ENABLE_IF_RADIO_ON: sc->wlan_enable_if_radio_on = arg; acpi_hp_evaluate_auto_on_off(sc); @@ -744,9 +803,11 @@ acpi_hp_sysctl_set(struct acpi_hp_softc acpi_hp_evaluate_auto_on_off(sc); break; case ACPI_HP_METHOD_BLUETOOTH_ENABLED: - return (acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 1, - arg?0x202:0x200)); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_WIRELESS_COMMAND, 1, + arg?0x202:0x200, NULL)) + return (-EINVAL); + break; case ACPI_HP_METHOD_BLUETOOTH_ENABLE_IF_RADIO_ON: sc->bluetooth_enable_if_radio_on = arg; acpi_hp_evaluate_auto_on_off(sc); @@ -756,9 +817,11 @@ acpi_hp_sysctl_set(struct acpi_hp_softc acpi_hp_evaluate_auto_on_off(sc); break; case ACPI_HP_METHOD_WWAN_ENABLED: - return (acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_WIRELESS_COMMAND, 1, - arg?0x404:0x400)); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_WIRELESS_COMMAND, 1, + arg?0x404:0x400, NULL)) + return (-EINVAL); + break; case ACPI_HP_METHOD_WWAN_ENABLE_IF_RADIO_ON: sc->wwan_enable_if_radio_on = arg?1:0; acpi_hp_evaluate_auto_on_off(sc); @@ -768,9 +831,10 @@ acpi_hp_sysctl_set(struct acpi_hp_softc acpi_hp_evaluate_auto_on_off(sc); break; case ACPI_HP_METHOD_ALS: - return (acpi_hp_exec_wmi_command(sc->wmi_dev, - ACPI_HP_WMI_ALS_COMMAND, 1, - arg?1:0)); + if (acpi_hp_exec_wmi_command(sc->wmi_dev, + ACPI_HP_WMI_ALS_COMMAND, 1, arg?1:0, NULL)) + return (-EINVAL); + break; case ACPI_HP_METHOD_CMI_DETAIL: sc->cmi_detail = arg; if ((arg & ACPI_HP_CMI_DETAIL_SHOW_MAX_INSTANCE) != @@ -806,26 +870,32 @@ acpi_hp_notify(ACPI_HANDLE h, UINT32 not ACPI_WMI_GET_EVENT_DATA(sc->wmi_dev, notify, &response); obj = (ACPI_OBJECT*) response.Pointer; if (obj && obj->Type == ACPI_TYPE_BUFFER && obj->Buffer.Length == 8) { - if (*((UINT8 *) obj->Buffer.Pointer) == 0x5) { + switch (*((UINT8 *) obj->Buffer.Pointer)) { + case ACPI_HP_EVENT_WIRELESS: acpi_hp_evaluate_auto_on_off(sc); + break; + default: + if (sc->verbose) { + device_printf(sc->dev, "Event %02x\n", + *((UINT8 *) obj->Buffer.Pointer)); + } + break; } } acpi_hp_free_buffer(&response); } static int -acpi_hp_exec_wmi_command(device_t wmi_dev, int command, int is_write, int val) +acpi_hp_exec_wmi_command(device_t wmi_dev, int command, int is_write, + int val, int *retval) { - UINT32 params[5] = { 0x55434553, - is_write?2:1, - command, - is_write?4:0, - val}; + UINT32 params[4+32] = { 0x55434553, is_write ? 2 : 1, + command, 4, val}; UINT32* result; ACPI_OBJECT *obj; ACPI_BUFFER in = { sizeof(params), ¶ms }; ACPI_BUFFER out = { ACPI_ALLOCATE_BUFFER, NULL }; - int retval; + int res; if (ACPI_FAILURE(ACPI_WMI_EVALUATE_CALL(wmi_dev, ACPI_HP_WMI_BIOS_GUID, 0, 0x3, &in, &out))) { @@ -838,13 +908,12 @@ acpi_hp_exec_wmi_command(device_t wmi_de return (-EINVAL); } result = (UINT32*) obj->Buffer.Pointer; - retval = result[2]; - if (result[1] > 0) { - retval = result[1]; - } + res = result[1]; + if (res == 0 && retval != NULL) + *retval = result[2]; acpi_hp_free_buffer(&out); - return (retval); + return (res); } static __inline char* @@ -909,81 +978,91 @@ acpi_hp_get_cmi_block(device_t wmi_dev, return (-EINVAL); } - if (obj->Package.Count >= 8 && - obj->Package.Elements[7].Type == ACPI_TYPE_INTEGER) { - valuebase = 8 + obj->Package.Elements[7].Integer.Value; - } - - /* check if this matches our expectations based on limited knowledge */ - if (valuebase > 7 && obj->Package.Count > valuebase + 1 && - obj->Package.Elements[0].Type == ACPI_TYPE_STRING && - obj->Package.Elements[1].Type == ACPI_TYPE_STRING && - obj->Package.Elements[2].Type == ACPI_TYPE_STRING && - obj->Package.Elements[3].Type == ACPI_TYPE_INTEGER && - obj->Package.Elements[4].Type == ACPI_TYPE_INTEGER && - obj->Package.Elements[5].Type == ACPI_TYPE_INTEGER && - obj->Package.Elements[6].Type == ACPI_TYPE_INTEGER && - obj->Package.Elements[valuebase].Type == ACPI_TYPE_STRING && - obj->Package.Elements[valuebase+1].Type == ACPI_TYPE_INTEGER && - obj->Package.Count > valuebase + - obj->Package.Elements[valuebase+1].Integer.Value - ) { - enumbase = valuebase + 1; - if (detail & ACPI_HP_CMI_DETAIL_PATHS) { - strlcat(outbuf, acpi_hp_get_string_from_object( - &obj->Package.Elements[2], string_buffer, size), - outsize); - outlen += 48; - while (strlen(outbuf) < outlen) - strlcat(outbuf, " ", outsize); - } - strlcat(outbuf, acpi_hp_get_string_from_object( - &obj->Package.Elements[0], string_buffer, size), - outsize); - outlen += 43; - while (strlen(outbuf) < outlen) - strlcat(outbuf, " ", outsize); + /* Check if first 6 bytes matches our expectations. */ + if (obj->Package.Count < 8 || + obj->Package.Elements[0].Type != ACPI_TYPE_STRING || + obj->Package.Elements[1].Type != ACPI_TYPE_STRING || + obj->Package.Elements[2].Type != ACPI_TYPE_STRING || + obj->Package.Elements[3].Type != ACPI_TYPE_INTEGER || + obj->Package.Elements[4].Type != ACPI_TYPE_INTEGER || + obj->Package.Elements[5].Type != ACPI_TYPE_INTEGER || + obj->Package.Elements[6].Type != ACPI_TYPE_INTEGER || + obj->Package.Elements[7].Type != ACPI_TYPE_INTEGER) { + acpi_hp_free_buffer(&out); + return (-EINVAL); + } + + /* Skip prerequisites and optionally array. */ + valuebase = 8 + obj->Package.Elements[7].Integer.Value; + if (obj->Package.Count <= valuebase) { + acpi_hp_free_buffer(&out); + return (-EINVAL); + } + if (obj->Package.Elements[valuebase].Type == ACPI_TYPE_INTEGER) + valuebase += 1 + obj->Package.Elements[valuebase].Integer.Value; + + /* Check if we have value and enum. */ + if (obj->Package.Count <= valuebase + 1 || + obj->Package.Elements[valuebase].Type != ACPI_TYPE_STRING || + obj->Package.Elements[valuebase+1].Type != ACPI_TYPE_INTEGER) { + acpi_hp_free_buffer(&out); + return (-EINVAL); + } + enumbase = valuebase + 1; + if (obj->Package.Count <= valuebase + + obj->Package.Elements[enumbase].Integer.Value) { + acpi_hp_free_buffer(&out); + return (-EINVAL); + } + + if (detail & ACPI_HP_CMI_DETAIL_PATHS) { strlcat(outbuf, acpi_hp_get_string_from_object( - &obj->Package.Elements[valuebase], string_buffer, - size), - outsize); - outlen += 21; + &obj->Package.Elements[2], string_buffer, size), outsize); + outlen += 48; while (strlen(outbuf) < outlen) strlcat(outbuf, " ", outsize); - for (i = 0; i < strlen(outbuf); ++i) - if (outbuf[i] == '\\') - outbuf[i] = '/'; - if (detail & ACPI_HP_CMI_DETAIL_ENUMS) { - for (i = enumbase + 1; i < enumbase + 1 + - obj->Package.Elements[enumbase].Integer.Value; - ++i) { - acpi_hp_get_string_from_object( - &obj->Package.Elements[i], string_buffer, - size); - if (strlen(string_buffer) > 1 || - (strlen(string_buffer) == 1 && - string_buffer[0] != ' ')) { - if (has_enums) - strlcat(outbuf, "/", outsize); - else - strlcat(outbuf, " (", outsize); - strlcat(outbuf, string_buffer, outsize); - has_enums = 1; - } + } + strlcat(outbuf, acpi_hp_get_string_from_object( + &obj->Package.Elements[0], string_buffer, size), outsize); + outlen += 43; + while (strlen(outbuf) < outlen) + strlcat(outbuf, " ", outsize); + strlcat(outbuf, acpi_hp_get_string_from_object( + &obj->Package.Elements[valuebase], string_buffer, size), outsize); + outlen += 21; + while (strlen(outbuf) < outlen) + strlcat(outbuf, " ", outsize); + for (i = 0; i < strlen(outbuf); ++i) + if (outbuf[i] == '\\') + outbuf[i] = '/'; + if (detail & ACPI_HP_CMI_DETAIL_ENUMS) { + for (i = enumbase + 1; i < enumbase + 1 + + obj->Package.Elements[enumbase].Integer.Value; ++i) { + acpi_hp_get_string_from_object( + &obj->Package.Elements[i], string_buffer, size); + if (strlen(string_buffer) > 1 || + (strlen(string_buffer) == 1 && + string_buffer[0] != ' ')) { + if (has_enums) + strlcat(outbuf, "/", outsize); + else + strlcat(outbuf, " (", outsize); + strlcat(outbuf, string_buffer, outsize); + has_enums = 1; } } - if (has_enums) - strlcat(outbuf, ")", outsize); - if (detail & ACPI_HP_CMI_DETAIL_FLAGS) { - strlcat(outbuf, obj->Package.Elements[3].Integer.Value? - " [ReadOnly]":"", outsize); - strlcat(outbuf, obj->Package.Elements[4].Integer.Value? - "":" [NOUI]", outsize); - strlcat(outbuf, obj->Package.Elements[5].Integer.Value? - " [RPP]":"", outsize); - } - *sequence = (UINT32) obj->Package.Elements[6].Integer.Value; } + if (has_enums) + strlcat(outbuf, ")", outsize); + if (detail & ACPI_HP_CMI_DETAIL_FLAGS) { + strlcat(outbuf, obj->Package.Elements[3].Integer.Value ? + " [ReadOnly]" : "", outsize); + strlcat(outbuf, obj->Package.Elements[4].Integer.Value ? + "" : " [NOUI]", outsize); + strlcat(outbuf, obj->Package.Elements[5].Integer.Value ? + " [RPP]" : "", outsize); + } + *sequence = (UINT32) obj->Package.Elements[6].Integer.Value; acpi_hp_free_buffer(&out); return (0); From owner-svn-src-all@freebsd.org Sat Nov 12 09:28:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24844C28A6B; Sat, 12 Nov 2016 09:28:38 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C64D410D8; Sat, 12 Nov 2016 09:28:37 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-wm0-x244.google.com with SMTP id a20so2353834wme.2; Sat, 12 Nov 2016 01:28:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=z54nAzU1APfRrOaTlDgj3l54wdvubYI8kTU4/CtMXow=; b=lL/u1Qy4diXpDDaQvCY1cGXMfvPp6NnvNnfSb8ox8m6Y90GSTy7yrE5+BhMXBGTAUP KxTbAGX0VZ8W+EFZx7R036upNoNm5wkwLdmMoMgXcO3rHrQbK666iNPot7YIwA29HKjB Gx6Vu5+RpLiYuq5Hw1MRtuLsFWaX9Onl9DjJeVPgXk6g56MwLSiUQWTud+SzzufRtuqa 3bXA9dMlVYgof9XNmggfJM701J0yhtsbH7D3/HBPZRqTi5WoSKblWRESg/vwYN63AiSp ozBtqkO6Ql9d7hKOgJVxVrtFfAZRGYLtSU+m/oGQhf6nKkHNc4xWnvX2CAuIzN7ACffC JtWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=z54nAzU1APfRrOaTlDgj3l54wdvubYI8kTU4/CtMXow=; b=RRp0ZJGMh3T7Pc7m7DXu6nN8atcCkEbFvzqgQVMl4a9EMenXxNDj++gAgrB0xEb3l9 7nWdOEHOG3SyvlFDGyHNQOnaqiulygZhy3LwpeSzAuXu9MNX4lwpiytlfdRHoijubJlq ZJL2Y8Tl0flaMGLhgv2XgWgoqczBXxhaMxATqMNXU+98DwFAjosLE1rwp69n/QbPye8B mwb2jWUryAtrr6Vw5yICJy4hkTBIFlKs4CzcMMjRoORVHT/39GKYaVN+WFKx9qR2V8q8 RU2clEB5uDJdnyTamSz6Y8bv1K5HZjTepgroiXKZrBaAUZQo6N42cbVKwon3w3dDJjs4 2jrQ== X-Gm-Message-State: ABUngvfprEyDtR+upfza15S4gzLQpKG6uvsFYvNkPtTxE0CRMj9lRX/B6uzQHWdpz+5/QA== X-Received: by 10.194.201.103 with SMTP id jz7mr13892688wjc.70.1478942915682; Sat, 12 Nov 2016 01:28:35 -0800 (PST) Received: from ernst.home (p578E14E0.dip0.t-ipconnect.de. [87.142.20.224]) by smtp.gmail.com with ESMTPSA id c202sm33680860wme.1.2016.11.12.01.28.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 12 Nov 2016 01:28:35 -0800 (PST) Date: Sat, 12 Nov 2016 10:28:33 +0100 From: Gary Jennejohn To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308565 - head/sys/kern Message-ID: <20161112102833.5cc951b8@ernst.home> In-Reply-To: <201611120023.uAC0N9fe018532@repo.freebsd.org> References: <201611120023.uAC0N9fe018532@repo.freebsd.org> Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.29; amd64-portbld-freebsd12.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 09:28:38 -0000 On Sat, 12 Nov 2016 00:23:09 +0000 (UTC) John Baldwin wrote: > Author: jhb > Date: Sat Nov 12 00:23:09 2016 > New Revision: 308565 > URL: https://svnweb.freebsd.org/changeset/base/308565 > > Log: > Allow scheduling during early boot. > > - Send IPI wakeups once SMP is started even if cold is true. > - Permit preemptions when cold is true. > > These changes are needed for EARLY_AP_STARTUP. > > MFC after: 2 weeks > Sponsored by: Netflix > > Modified: > head/sys/kern/sched_4bsd.c > Thank you, jhb! -- Gary Jennejohn From owner-svn-src-all@freebsd.org Sat Nov 12 16:40:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B061CC3D468; Sat, 12 Nov 2016 16:40:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D7291DD4; Sat, 12 Nov 2016 16:40:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from airbears2-10-142-121-215.airbears2.1918.berkeley.edu (unknown [IPv6:2607:f140:400:a01e:e051:653d:b021:c582]) by mail.baldwin.cx (Postfix) with ESMTPSA id 6B31E10A718; Sat, 12 Nov 2016 11:40:30 -0500 (EST) Subject: Re: svn commit: r308565 - head/sys/kern To: gljennjohn@gmail.com References: <201611120023.uAC0N9fe018532@repo.freebsd.org> <20161112102833.5cc951b8@ernst.home> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: John Baldwin Message-ID: <9d2a931d-cd92-4a82-0c47-a6737d6c6104@FreeBSD.org> Date: Sat, 12 Nov 2016 08:40:28 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161112102833.5cc951b8@ernst.home> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Sat, 12 Nov 2016 11:40:30 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 16:40:32 -0000 On 11/12/16 1:28 AM, Gary Jennejohn wrote: > On Sat, 12 Nov 2016 00:23:09 +0000 (UTC) > John Baldwin wrote: > >> Author: jhb >> Date: Sat Nov 12 00:23:09 2016 >> New Revision: 308565 >> URL: https://svnweb.freebsd.org/changeset/base/308565 >> >> Log: >> Allow scheduling during early boot. >> >> - Send IPI wakeups once SMP is started even if cold is true. >> - Permit preemptions when cold is true. >> >> These changes are needed for EARLY_AP_STARTUP. >> >> MFC after: 2 weeks >> Sponsored by: Netflix >> >> Modified: >> head/sys/kern/sched_4bsd.c >> > > Thank you, jhb! I believe the previous change fixed the original issue you reported as I was finally able to reproduce a similar hang with sched_bind when igb0 was pinning its interrupts. It was quite a bit of a PITA to track down. :( If you get a chance, can you please verify that 4BSD + EARLY_AP_STARTUP now works for you? -- John Baldwin From owner-svn-src-all@freebsd.org Sat Nov 12 17:03:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78C15C3D020; Sat, 12 Nov 2016 17:03:22 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AB8311C7; Sat, 12 Nov 2016 17:03:22 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACH3LRU020254; Sat, 12 Nov 2016 17:03:21 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACH3L3x020253; Sat, 12 Nov 2016 17:03:21 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201611121703.uACH3L3x020253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Sat, 12 Nov 2016 17:03:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308569 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 17:03:22 -0000 Author: skra Date: Sat Nov 12 17:03:21 2016 New Revision: 308569 URL: https://svnweb.freebsd.org/changeset/base/308569 Log: Always call PHYS_TO_VM_PAGE() in is_managed(). Fast road for addresses under first_page cannot be taken as this variable is connected only to vm_page_array segment. There could be more segments in system like the ones for various fictitious page ranges. These can be situated under vm_page_array segment and so, they could be skipped before this fix. However, as far as I know, there is no report associated with it. While here, the return type of this function is changed from boolean_t to bool type. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D8502 Modified: head/sys/arm/arm/pmap-v6.c Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Sat Nov 12 05:09:39 2016 (r308568) +++ head/sys/arm/arm/pmap-v6.c Sat Nov 12 17:03:21 2016 (r308569) @@ -2739,21 +2739,15 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_ /* * Is given page managed? */ -static __inline boolean_t +static __inline bool is_managed(vm_paddr_t pa) { - vm_offset_t pgnum; vm_page_t m; - pgnum = atop(pa); - if (pgnum >= first_page) { - m = PHYS_TO_VM_PAGE(pa); - if (m == NULL) - return (FALSE); - if ((m->oflags & VPO_UNMANAGED) == 0) - return (TRUE); - } - return (FALSE); + m = PHYS_TO_VM_PAGE(pa); + if (m == NULL) + return (false); + return ((m->oflags & VPO_UNMANAGED) == 0); } static __inline boolean_t From owner-svn-src-all@freebsd.org Sat Nov 12 17:24:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4138FC3D62F; Sat, 12 Nov 2016 17:24:42 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 133C41B32; Sat, 12 Nov 2016 17:24:42 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACHOftv027989; Sat, 12 Nov 2016 17:24:41 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACHOfct027988; Sat, 12 Nov 2016 17:24:41 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201611121724.uACHOfct027988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Sat, 12 Nov 2016 17:24:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308570 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 17:24:42 -0000 Author: skra Date: Sat Nov 12 17:24:41 2016 New Revision: 308570 URL: https://svnweb.freebsd.org/changeset/base/308570 Log: The return type of is_managed() was changed from boolean_t to bool type in r308569. Now, propagate this change further for consistency sake. MFC after: 2 weeks Modified: head/sys/arm/arm/pmap-v6.c Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Sat Nov 12 17:03:21 2016 (r308569) +++ head/sys/arm/arm/pmap-v6.c Sat Nov 12 17:24:41 2016 (r308570) @@ -2750,14 +2750,14 @@ is_managed(vm_paddr_t pa) return ((m->oflags & VPO_UNMANAGED) == 0); } -static __inline boolean_t +static __inline bool pte1_is_managed(pt1_entry_t pte1) { return (is_managed(pte1_pa(pte1))); } -static __inline boolean_t +static __inline bool pte2_is_managed(pt2_entry_t pte2) { @@ -6097,7 +6097,7 @@ pmap_mincore(pmap_t pmap, vm_offset_t ad pt1_entry_t *pte1p, pte1; pt2_entry_t *pte2p, pte2; vm_paddr_t pa; - boolean_t managed; + bool managed; int val; PMAP_LOCK(pmap); @@ -6124,7 +6124,7 @@ retry: if (pte2 & PTE2_A) val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; } else { - managed = FALSE; + managed = false; val = 0; } if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != From owner-svn-src-all@freebsd.org Sat Nov 12 17:27:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF956C3D6D4; Sat, 12 Nov 2016 17:27:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E55E1D08; Sat, 12 Nov 2016 17:27:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACHRSPY028134; Sat, 12 Nov 2016 17:27:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACHRSTr028133; Sat, 12 Nov 2016 17:27:28 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611121727.uACHRSTr028133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 12 Nov 2016 17:27:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308571 - stable/11/sys/dev/sound/usb X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 17:27:29 -0000 Author: hselasky Date: Sat Nov 12 17:27:28 2016 New Revision: 308571 URL: https://svnweb.freebsd.org/changeset/base/308571 Log: MFC r308437 and r308461: Range check the jitter values to avoid bogus sample rate adjustments. The expected deviation should not be more than 1Hz per second. The USB v2.0 specification also mandates this requirement. Refer to chapter 5.12.4.2 about feedback. Allow higher sample rates to have more jitter than lower ones. PR: 208791 Modified: stable/11/sys/dev/sound/usb/uaudio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/11/sys/dev/sound/usb/uaudio.c Sat Nov 12 17:24:41 2016 (r308570) +++ stable/11/sys/dev/sound/usb/uaudio.c Sat Nov 12 17:27:28 2016 (r308571) @@ -2078,9 +2078,23 @@ uaudio_chan_play_sync_callback(struct us * Use feedback value as fallback when there is no * recording channel: */ - if (ch->priv_sc->sc_rec_chan.num_alt == 0) - ch->jitter_curr = temp - sample_rate; + if (ch->priv_sc->sc_rec_chan.num_alt == 0) { + int32_t jitter_max = howmany(sample_rate, 16000); + /* + * Range check the jitter values to avoid + * bogus sample rate adjustments. The expected + * deviation should not be more than 1Hz per + * second. The USB v2.0 specification also + * mandates this requirement. Refer to chapter + * 5.12.4.2 about feedback. + */ + ch->jitter_curr = temp - sample_rate; + if (ch->jitter_curr > jitter_max) + ch->jitter_curr = jitter_max; + else if (ch->jitter_curr < -jitter_max) + ch->jitter_curr = -jitter_max; + } ch->feedback_rate = temp; break; From owner-svn-src-all@freebsd.org Sat Nov 12 17:30:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3919C3D89C; Sat, 12 Nov 2016 17:30:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 815D21FE1; Sat, 12 Nov 2016 17:30:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACHUtdr028332; Sat, 12 Nov 2016 17:30:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACHUtu0028331; Sat, 12 Nov 2016 17:30:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611121730.uACHUtu0028331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 12 Nov 2016 17:30:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308572 - stable/10/sys/dev/sound/usb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 17:30:56 -0000 Author: hselasky Date: Sat Nov 12 17:30:55 2016 New Revision: 308572 URL: https://svnweb.freebsd.org/changeset/base/308572 Log: MFC r308437 and r308461: Range check the jitter values to avoid bogus sample rate adjustments. The expected deviation should not be more than 1Hz per second. The USB v2.0 specification also mandates this requirement. Refer to chapter 5.12.4.2 about feedback. Allow higher sample rates to have more jitter than lower ones. PR: 208791 Modified: stable/10/sys/dev/sound/usb/uaudio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/10/sys/dev/sound/usb/uaudio.c Sat Nov 12 17:27:28 2016 (r308571) +++ stable/10/sys/dev/sound/usb/uaudio.c Sat Nov 12 17:30:55 2016 (r308572) @@ -2084,9 +2084,23 @@ uaudio_chan_play_sync_callback(struct us * Use feedback value as fallback when there is no * recording channel: */ - if (ch->priv_sc->sc_rec_chan.num_alt == 0) - ch->jitter_curr = temp - sample_rate; + if (ch->priv_sc->sc_rec_chan.num_alt == 0) { + int32_t jitter_max = howmany(sample_rate, 16000); + /* + * Range check the jitter values to avoid + * bogus sample rate adjustments. The expected + * deviation should not be more than 1Hz per + * second. The USB v2.0 specification also + * mandates this requirement. Refer to chapter + * 5.12.4.2 about feedback. + */ + ch->jitter_curr = temp - sample_rate; + if (ch->jitter_curr > jitter_max) + ch->jitter_curr = jitter_max; + else if (ch->jitter_curr < -jitter_max) + ch->jitter_curr = -jitter_max; + } ch->feedback_rate = temp; break; From owner-svn-src-all@freebsd.org Sat Nov 12 17:32:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28848C3D971; Sat, 12 Nov 2016 17:32:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E4C30139E; Sat, 12 Nov 2016 17:32:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACHWNKo032243; Sat, 12 Nov 2016 17:32:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACHWN5n032242; Sat, 12 Nov 2016 17:32:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611121732.uACHWN5n032242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 12 Nov 2016 17:32:23 +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: r308573 - stable/9/sys/dev/sound/usb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 17:32:24 -0000 Author: hselasky Date: Sat Nov 12 17:32:22 2016 New Revision: 308573 URL: https://svnweb.freebsd.org/changeset/base/308573 Log: MFC r308437 and r308461: Range check the jitter values to avoid bogus sample rate adjustments. The expected deviation should not be more than 1Hz per second. The USB v2.0 specification also mandates this requirement. Refer to chapter 5.12.4.2 about feedback. Allow higher sample rates to have more jitter than lower ones. PR: 208791 Modified: stable/9/sys/dev/sound/usb/uaudio.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/9/sys/dev/sound/usb/uaudio.c Sat Nov 12 17:30:55 2016 (r308572) +++ stable/9/sys/dev/sound/usb/uaudio.c Sat Nov 12 17:32:22 2016 (r308573) @@ -2047,9 +2047,23 @@ uaudio_chan_play_sync_callback(struct us * Use feedback value as fallback when there is no * recording channel: */ - if (ch->priv_sc->sc_rec_chan.num_alt == 0) - ch->jitter_curr = temp - sample_rate; + if (ch->priv_sc->sc_rec_chan.num_alt == 0) { + int32_t jitter_max = howmany(sample_rate, 16000); + /* + * Range check the jitter values to avoid + * bogus sample rate adjustments. The expected + * deviation should not be more than 1Hz per + * second. The USB v2.0 specification also + * mandates this requirement. Refer to chapter + * 5.12.4.2 about feedback. + */ + ch->jitter_curr = temp - sample_rate; + if (ch->jitter_curr > jitter_max) + ch->jitter_curr = jitter_max; + else if (ch->jitter_curr < -jitter_max) + ch->jitter_curr = -jitter_max; + } ch->feedback_rate = temp; break; From owner-svn-src-all@freebsd.org Sat Nov 12 17:36:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8996BC3DBA4; Sat, 12 Nov 2016 17:36:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C6111605; Sat, 12 Nov 2016 17:36:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACHaS4r032465; Sat, 12 Nov 2016 17:36:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACHaStu032464; Sat, 12 Nov 2016 17:36:28 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611121736.uACHaStu032464@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 12 Nov 2016 17:36:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r308574 - stable/8/sys/dev/sound/usb X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 17:36:29 -0000 Author: hselasky Date: Sat Nov 12 17:36:28 2016 New Revision: 308574 URL: https://svnweb.freebsd.org/changeset/base/308574 Log: MFC r308437 and r308461: Range check the jitter values to avoid bogus sample rate adjustments. The expected deviation should not be more than 1Hz per second. The USB v2.0 specification also mandates this requirement. Refer to chapter 5.12.4.2 about feedback. Allow higher sample rates to have more jitter than lower ones. PR: 208791 Modified: stable/8/sys/dev/sound/usb/uaudio.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/sound/ (props changed) stable/8/sys/dev/sound/usb/ (props changed) Modified: stable/8/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/8/sys/dev/sound/usb/uaudio.c Sat Nov 12 17:32:22 2016 (r308573) +++ stable/8/sys/dev/sound/usb/uaudio.c Sat Nov 12 17:36:28 2016 (r308574) @@ -2047,9 +2047,23 @@ uaudio_chan_play_sync_callback(struct us * Use feedback value as fallback when there is no * recording channel: */ - if (ch->priv_sc->sc_rec_chan.num_alt == 0) - ch->jitter_curr = temp - sample_rate; + if (ch->priv_sc->sc_rec_chan.num_alt == 0) { + int32_t jitter_max = howmany(sample_rate, 16000); + /* + * Range check the jitter values to avoid + * bogus sample rate adjustments. The expected + * deviation should not be more than 1Hz per + * second. The USB v2.0 specification also + * mandates this requirement. Refer to chapter + * 5.12.4.2 about feedback. + */ + ch->jitter_curr = temp - sample_rate; + if (ch->jitter_curr > jitter_max) + ch->jitter_curr = jitter_max; + else if (ch->jitter_curr < -jitter_max) + ch->jitter_curr = -jitter_max; + } ch->feedback_rate = temp; break; From owner-svn-src-all@freebsd.org Sat Nov 12 17:58:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2F59C3DAA7; Sat, 12 Nov 2016 17:58:38 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B02211A31; Sat, 12 Nov 2016 17:58:38 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACHwbSx041257; Sat, 12 Nov 2016 17:58:37 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACHwbgO041250; Sat, 12 Nov 2016 17:58:37 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201611121758.uACHwbgO041250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sat, 12 Nov 2016 17:58:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308575 - in head: share/man/man4 sys/dev/rtwn sys/dev/rtwn/pci sys/dev/rtwn/rtl8192c/pci sys/dev/rtwn/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 17:58:38 -0000 Author: avos Date: Sat Nov 12 17:58:37 2016 New Revision: 308575 URL: https://svnweb.freebsd.org/changeset/base/308575 Log: rtwn: enable 11n support for RTL8188CE. - Increase Rx buffer size from MCLBYTES to MJUMPAGESIZE. - Provide an additional defragmentation routine for frames larger than MCLBYTES; that is required by A-MSDU / Atheros Fast-Frames support to work with current Tx path implementation. Enabled features list for RTL8188CE: - Atheros Fast-Frames; - A-MPDU (Tx / Rx); - A-MSDU (Tx / Rx; 4k only); - Short Guard Interval. Tested with: - RTL8188CE (STA+AP) + RTL8821AU (STA). - RTL8188CE (STA) + RTL8188CUS (AP). Relnotes: yes Modified: head/share/man/man4/rtwn_pci.4 head/sys/dev/rtwn/if_rtwn_tx.h head/sys/dev/rtwn/pci/rtwn_pci_attach.c head/sys/dev/rtwn/pci/rtwn_pci_rx.c head/sys/dev/rtwn/pci/rtwn_pci_tx.c head/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c head/sys/dev/rtwn/usb/rtwn_usb_rx.c Modified: head/share/man/man4/rtwn_pci.4 ============================================================================== --- head/share/man/man4/rtwn_pci.4 Sat Nov 12 17:36:28 2016 (r308574) +++ head/share/man/man4/rtwn_pci.4 Sat Nov 12 17:58:37 2016 (r308575) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd October 17, 2016 +.Dd November 12, 2016 .Dt RTWN_PCI 4 .Os .Sh NAME @@ -58,6 +58,3 @@ It operates in the 2GHz spectrum only. .Xr rtwnfw 4 , .Xr rtwn_usb 4 , .Xr pci 4 -.Sh CAVEATS -Most 802.11 capabilities were turned off; some more testing -is required to re-enable them. Modified: head/sys/dev/rtwn/if_rtwn_tx.h ============================================================================== --- head/sys/dev/rtwn/if_rtwn_tx.h Sat Nov 12 17:36:28 2016 (r308574) +++ head/sys/dev/rtwn/if_rtwn_tx.h Sat Nov 12 17:58:37 2016 (r308575) @@ -20,7 +20,9 @@ #define IF_RTWN_TX_H void rtwn_drain_mbufq(struct rtwn_softc *); +#ifdef IEEE80211_SUPPORT_SUPERG void rtwn_ff_flush_all(struct rtwn_softc *, union sec_param *); +#endif int rtwn_transmit(struct ieee80211com *, struct mbuf *); void rtwn_start(struct rtwn_softc *); int rtwn_raw_xmit(struct ieee80211_node *, struct mbuf *, Modified: head/sys/dev/rtwn/pci/rtwn_pci_attach.c ============================================================================== --- head/sys/dev/rtwn/pci/rtwn_pci_attach.c Sat Nov 12 17:36:28 2016 (r308574) +++ head/sys/dev/rtwn/pci/rtwn_pci_attach.c Sat Nov 12 17:58:37 2016 (r308575) @@ -149,8 +149,8 @@ rtwn_pci_alloc_rx_list(struct rtwn_softc /* Create RX buffer DMA tag. */ error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, - 1, MCLBYTES, 0, NULL, NULL, &rx_ring->data_dmat); + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + MJUMPAGESIZE, 1, MJUMPAGESIZE, 0, NULL, NULL, &rx_ring->data_dmat); if (error != 0) { device_printf(sc->sc_dev, "could not create rx buf DMA tag\n"); goto fail; @@ -166,7 +166,8 @@ rtwn_pci_alloc_rx_list(struct rtwn_softc goto fail; } - rx_data->m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + rx_data->m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, + MJUMPAGESIZE); if (rx_data->m == NULL) { device_printf(sc->sc_dev, "could not allocate rx mbuf\n"); @@ -175,8 +176,8 @@ rtwn_pci_alloc_rx_list(struct rtwn_softc } error = bus_dmamap_load(rx_ring->data_dmat, rx_data->map, - mtod(rx_data->m, void *), MCLBYTES, rtwn_pci_dma_map_addr, - &rx_data->paddr, BUS_DMA_NOWAIT); + mtod(rx_data->m, void *), MJUMPAGESIZE, + rtwn_pci_dma_map_addr, &rx_data->paddr, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc->sc_dev, "could not load rx buf DMA map"); @@ -184,7 +185,7 @@ rtwn_pci_alloc_rx_list(struct rtwn_softc } rtwn_pci_setup_rx_desc(pc, &rx_ring->desc[i], rx_data->paddr, - MCLBYTES, i); + MJUMPAGESIZE, i); } rx_ring->cur = 0; @@ -206,7 +207,7 @@ rtwn_pci_reset_rx_list(struct rtwn_softc for (i = 0; i < RTWN_PCI_RX_LIST_COUNT; i++) { rx_data = &rx_ring->rx_data[i]; rtwn_pci_setup_rx_desc(pc, &rx_ring->desc[i], - rx_data->paddr, MCLBYTES, i); + rx_data->paddr, MJUMPAGESIZE, i); } rx_ring->cur = 0; } @@ -287,8 +288,8 @@ rtwn_pci_alloc_tx_list(struct rtwn_softc BUS_DMASYNC_PREWRITE); error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, - 1, MCLBYTES, 0, NULL, NULL, &tx_ring->data_dmat); + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + MJUMPAGESIZE, 1, MJUMPAGESIZE, 0, NULL, NULL, &tx_ring->data_dmat); if (error != 0) { device_printf(sc->sc_dev, "could not create tx buf DMA tag\n"); goto fail; Modified: head/sys/dev/rtwn/pci/rtwn_pci_rx.c ============================================================================== --- head/sys/dev/rtwn/pci/rtwn_pci_rx.c Sat Nov 12 17:36:28 2016 (r308574) +++ head/sys/dev/rtwn/pci/rtwn_pci_rx.c Sat Nov 12 17:58:37 2016 (r308575) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -120,7 +121,7 @@ rtwn_pci_rx_frame(struct rtwn_softc *sc, pktlen = MS(rxdw0, R92C_RXDW0_PKTLEN); if (__predict_false(pktlen < sizeof(struct ieee80211_frame_ack) || - pktlen > MCLBYTES)) { + pktlen > MJUMPAGESIZE)) { RTWN_DPRINTF(sc, RTWN_DEBUG_RECV, "%s: frame is too short/long: %d\n", __func__, pktlen); goto fail; @@ -129,7 +130,7 @@ rtwn_pci_rx_frame(struct rtwn_softc *sc, infosz = MS(rxdw0, R92C_RXDW0_INFOSZ) * 8; shift = MS(rxdw0, R92C_RXDW0_SHIFT); - m1 = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + m1 = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MJUMPAGESIZE); if (__predict_false(m1 == NULL)) { device_printf(sc->sc_dev, "%s: could not allocate RX mbuf\n", __func__); @@ -139,20 +140,20 @@ rtwn_pci_rx_frame(struct rtwn_softc *sc, bus_dmamap_unload(ring->data_dmat, rx_data->map); error = bus_dmamap_load(ring->data_dmat, rx_data->map, mtod(m1, void *), - MCLBYTES, rtwn_pci_dma_map_addr, &rx_data->paddr, 0); + MJUMPAGESIZE, rtwn_pci_dma_map_addr, &rx_data->paddr, 0); if (error != 0) { m_freem(m1); error = bus_dmamap_load(ring->data_dmat, rx_data->map, - mtod(rx_data->m, void *), MCLBYTES, rtwn_pci_dma_map_addr, - &rx_data->paddr, BUS_DMA_NOWAIT); + mtod(rx_data->m, void *), MJUMPAGESIZE, + rtwn_pci_dma_map_addr, &rx_data->paddr, BUS_DMA_NOWAIT); if (error != 0) panic("%s: could not load old RX mbuf", device_get_name(sc->sc_dev)); /* Physical address may have changed. */ - rtwn_pci_setup_rx_desc(pc, rx_desc, rx_data->paddr, MCLBYTES, - desc_idx); + rtwn_pci_setup_rx_desc(pc, rx_desc, rx_data->paddr, + MJUMPAGESIZE, desc_idx); goto fail; } @@ -169,7 +170,7 @@ rtwn_pci_rx_frame(struct rtwn_softc *sc, __func__, pktlen, infosz, shift, rssi); /* Update RX descriptor. */ - rtwn_pci_setup_rx_desc(pc, rx_desc, rx_data->paddr, MCLBYTES, + rtwn_pci_setup_rx_desc(pc, rx_desc, rx_data->paddr, MJUMPAGESIZE, desc_idx); /* Send the frame to the 802.11 layer. */ @@ -222,6 +223,8 @@ rtwn_pci_tx_done(struct rtwn_softc *sc, data->ni = NULL; ring->queued--; + KASSERT(ring->queued >= 0, + ("ring->queued (qid %d) underflow!\n", qid)); } else m_freem(data->m); @@ -235,9 +238,27 @@ rtwn_pci_tx_done(struct rtwn_softc *sc, #endif } - if (ring->queued < (RTWN_PCI_TX_LIST_COUNT - 1)) + if ((sc->qfullmsk & (1 << qid)) != 0 && + ring->queued < (RTWN_PCI_TX_LIST_COUNT - 1)) { sc->qfullmsk &= ~(1 << qid); - rtwn_start(sc); + rtwn_start(sc); + } + +#ifdef IEEE80211_SUPPORT_SUPERG + /* + * If the TX active queue drops below a certain + * threshold, ensure we age fast-frames out so they're + * transmitted. + */ + if (sc->sc_ratectl != RTWN_RATECTL_NET80211 && ring->queued <= 1) { + /* + * XXX TODO: just make this a callout timer schedule + * so we can flush the FF staging queue if we're + * approaching idle. + */ + rtwn_cmd_sleepable(sc, NULL, 0, rtwn_ff_flush_all); + } +#endif } static void @@ -261,6 +282,17 @@ rtwn_pci_rx_done(struct rtwn_softc *sc) ring->cur = (ring->cur + 1) % RTWN_PCI_RX_LIST_COUNT; } + + /* Finished receive; age anything left on the FF queue by a little bump */ + /* + * XXX TODO: just make this a callout timer schedule so we can + * flush the FF staging queue if we're approaching idle. + */ +#ifdef IEEE80211_SUPPORT_SUPERG + if (!(sc->sc_flags & RTWN_FW_LOADED) || + sc->sc_ratectl != RTWN_RATECTL_NET80211) + rtwn_cmd_sleepable(sc, NULL, 0, rtwn_ff_flush_all); +#endif } void Modified: head/sys/dev/rtwn/pci/rtwn_pci_tx.c ============================================================================== --- head/sys/dev/rtwn/pci/rtwn_pci_tx.c Sat Nov 12 17:36:28 2016 (r308574) +++ head/sys/dev/rtwn/pci/rtwn_pci_tx.c Sat Nov 12 17:58:37 2016 (r308575) @@ -58,6 +58,37 @@ __FBSDID("$FreeBSD$"); #include +static struct mbuf * +rtwn_mbuf_defrag(struct mbuf *m0, int how) +{ + struct mbuf *m = NULL; + + KASSERT(m0->m_flags & M_PKTHDR, + ("M_PKTHDR flag is absent (m %p)!", m0)); + + /* NB: we need _exactly_ one mbuf (no less, no more). */ + if (m0->m_pkthdr.len > MJUMPAGESIZE) { + /* XXX MJUM9BYTES? */ + return (NULL); + } else if (m0->m_pkthdr.len > MCLBYTES) { + m = m_getjcl(how, MT_DATA, M_PKTHDR, MJUMPAGESIZE); + if (m == NULL) + return (NULL); + + if (m_dup_pkthdr(m, m0, how) == 0) { + m_freem(m); + return (NULL); + } + + m_copydata(m0, 0, m0->m_pkthdr.len, mtod(m, caddr_t)); + m->m_len = m->m_pkthdr.len; + m_freem(m0); + + return (m); + } else + return (m_defrag(m0, how)); +} + static int rtwn_pci_tx_start_frame(struct rtwn_softc *sc, struct ieee80211_node *ni, struct mbuf *m, uint8_t *tx_desc, uint8_t type) @@ -114,7 +145,7 @@ rtwn_pci_tx_start_frame(struct rtwn_soft if (error != 0) { struct mbuf *mnew; - mnew = m_defrag(m, M_NOWAIT); + mnew = rtwn_mbuf_defrag(m, M_NOWAIT); if (mnew == NULL) { device_printf(sc->sc_dev, "can't defragment mbuf\n"); return (ENOBUFS); Modified: head/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c ============================================================================== --- head/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c Sat Nov 12 17:36:28 2016 (r308574) +++ head/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c Sat Nov 12 17:58:37 2016 (r308575) @@ -138,15 +138,11 @@ r92ce_adj_devcaps(struct rtwn_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; - /* XXX TODO: test everything that removed here before enabling. */ - /* XX do NOT enable PMGT until RSVD_PAGE command will not be fixed. */ - ic->ic_caps &= ~( - IEEE80211_C_PMGT /* check null frame / device usability */ - | IEEE80211_C_SWAMSDUTX - | IEEE80211_C_FF - ); - - ic->ic_htcaps = 0; + /* + * XXX do NOT enable PMGT until RSVD_PAGE command + * will not be tested / fixed + HRPWM register must be set too. + */ + ic->ic_caps &= ~IEEE80211_C_PMGT; } void Modified: head/sys/dev/rtwn/usb/rtwn_usb_rx.c ============================================================================== --- head/sys/dev/rtwn/usb/rtwn_usb_rx.c Sat Nov 12 17:36:28 2016 (r308574) +++ head/sys/dev/rtwn/usb/rtwn_usb_rx.c Sat Nov 12 17:58:37 2016 (r308575) @@ -326,7 +326,8 @@ finish: * flush the FF staging queue if we're approaching idle. */ #ifdef IEEE80211_SUPPORT_SUPERG - if (!(sc->sc_flags & RTWN_FW_LOADED)) + if (!(sc->sc_flags & RTWN_FW_LOADED) || + sc->sc_ratectl != RTWN_RATECTL_NET80211) rtwn_cmd_sleepable(sc, NULL, 0, rtwn_ff_flush_all); #endif From owner-svn-src-all@freebsd.org Sat Nov 12 18:04:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8918FC3DE60; Sat, 12 Nov 2016 18:04:04 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 596A0113B; Sat, 12 Nov 2016 18:04:04 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACI43Am045219; Sat, 12 Nov 2016 18:04:03 GMT (envelope-from def@FreeBSD.org) Received: (from def@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACI43wH045218; Sat, 12 Nov 2016 18:04:03 GMT (envelope-from def@FreeBSD.org) Message-Id: <201611121804.uACI43wH045218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: def set sender to def@FreeBSD.org using -f From: Konrad Witaszczyk Date: Sat, 12 Nov 2016 18:04:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308576 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 18:04:04 -0000 Author: def Date: Sat Nov 12 18:04:03 2016 New Revision: 308576 URL: https://svnweb.freebsd.org/changeset/base/308576 Log: Add myself (def) as a src committer and pjd as my mentor. Approved by: pjd (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Sat Nov 12 17:58:37 2016 (r308575) +++ head/share/misc/committers-src.dot Sat Nov 12 18:04:03 2016 (r308576) @@ -143,6 +143,7 @@ csjp [label="Christian S.J. Peron\ncsjp@ das [label="David Schultz\ndas@FreeBSD.org\n2003/02/21"] davide [label="Davide Italiano\ndavide@FreeBSD.org\n2012/01/27"] dchagin [label="Dmitry Chagin\ndchagin@FreeBSD.org\n2009/02/28"] +def [label="Konrad Witaszczyk\ndef@FreeBSD.org\n2016/11/02"] delphij [label="Xin Li\ndelphij@FreeBSD.org\n2004/09/14"] des [label="Dag-Erling Smorgrav\ndes@FreeBSD.org\n1998/04/03"] dfr [label="Doug Rabson\ndfr@FreeBSD.org\n????/??/??"] @@ -683,6 +684,7 @@ philip -> kp phk -> jkoshy phk -> mux +pjd -> def pjd -> kib pjd -> lulf pjd -> oshogbo From owner-svn-src-all@freebsd.org Sat Nov 12 18:26:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82E06C3E50E; Sat, 12 Nov 2016 18:26:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x229.google.com (mail-it0-x229.google.com [IPv6:2607:f8b0:4001:c0b::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D19E1E3B; Sat, 12 Nov 2016 18:26:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x229.google.com with SMTP id u205so36974798itc.0; Sat, 12 Nov 2016 10:26:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qkYRw2xfXrW9shdat3lManDEkW4YQrKM03EfRqtb45o=; b=lO1HeSfD2fC9P8LZq96JPIbltZ4XkBFXdN+bs51TRG/Zh9f1T1wXeCZa31B5PW2Hx8 jPLET+5e62PDnIQT/qrmfkOKhhXJm6ZxSjuqohNLK36Dak/edpjpdg47KyFDA0Xz022c 4YzgLyx9j/udnZSXvq4jOKdEqXtUFUXQPZ9Pduza6ZtLA5x/XujJ7+5wm+ExQcUXJ4oE hDe2drJa1uGTcNekDG+KLNyw/XHPLI+emf9XyMCsPm2K13nPK8U4niujyfj2uHYuLaHv MBgW5bvtPpM5ORqjEkbAtnbxq4EwQDVlz5DcZUIeDlLJZzEV3vBU/NcyHFTb7rKPMxJa XkcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qkYRw2xfXrW9shdat3lManDEkW4YQrKM03EfRqtb45o=; b=N9YYwa9qn7RZE8Z13kOmxCaBPiwCQlNo6ZS/7A0r+683v8bcigZCm17HjZAf3TBP0G LpVJ1JqHkraYDBr/rSrBZmgR5yPEjT6dtRYsNAONau4PXcpFyOnvssPKm8YnoDpkb3Fk xMUWtNIory0oIpuSHZtlla7aI4B9q7GhG/rGgLo1/kg/vaJGahCK48KqDLsh1IvWRWvZ plM46dwb5fNpidDQYlzxagJVbuHHGrCDK8mWEIhouHgPl3qXgVis/lNNRqrQVhwdBIA5 2AY006ZblqZktehlNRR6qwNCSRLp2dqf2LhT+PkR3HO0lf58YxvySMf1V6wo0lis/xp2 qTXg== X-Gm-Message-State: ABUngvd/Hr6euSwc+u5S7S+8gwaETXPnCMJn5BjglOd9cHP2WxjFd3zkgs8lqS7caTTv6J/Ew7qrj248A+61kg== X-Received: by 10.107.192.194 with SMTP id q185mr17624094iof.129.1478975210733; Sat, 12 Nov 2016 10:26:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.39.134 with HTTP; Sat, 12 Nov 2016 10:26:49 -0800 (PST) In-Reply-To: <201609230445.u8N4jCtK066601@repo.freebsd.org> References: <201609230445.u8N4jCtK066601@repo.freebsd.org> From: Adrian Chadd Date: Sat, 12 Nov 2016 10:26:49 -0800 Message-ID: Subject: Re: svn commit: r306224 - head/sys/kern To: Mateusz Guzik Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 18:26:52 -0000 This causes the AR9331 / Carambola2 kernel to just plainly not start. :( -adrian On 22 September 2016 at 21:45, Mateusz Guzik wrote: > Author: mjg > Date: Fri Sep 23 04:45:11 2016 > New Revision: 306224 > URL: https://svnweb.freebsd.org/changeset/base/306224 > > Log: > cache: get rid of the global lock > > Add a table of vnode locks and use them along with bucketlocks to provide > concurrent modification support. The approach taken is to preserve the > current behaviour of the namecache and just lock all relevant parts before > any changes are made. > > Lookups still require the relevant bucket to be locked. > > Discussed with: kib > Tested by: pho > > Modified: > head/sys/kern/subr_witness.c > head/sys/kern/vfs_cache.c > > Modified: head/sys/kern/subr_witness.c > ============================================================================== > --- head/sys/kern/subr_witness.c Fri Sep 23 03:21:40 2016 (r306223) > +++ head/sys/kern/subr_witness.c Fri Sep 23 04:45:11 2016 (r306224) > @@ -625,7 +625,7 @@ static struct witness_order_list_entry o > /* > * VFS namecache > */ > - { "ncglobal", &lock_class_rw }, > + { "ncvn", &lock_class_mtx_sleep }, > { "ncbuc", &lock_class_rw }, > { "vnode interlock", &lock_class_mtx_sleep }, > { "ncneg", &lock_class_mtx_sleep }, > > Modified: head/sys/kern/vfs_cache.c > ============================================================================== > --- head/sys/kern/vfs_cache.c Fri Sep 23 03:21:40 2016 (r306223) > +++ head/sys/kern/vfs_cache.c Fri Sep 23 04:45:11 2016 (r306224) > @@ -151,21 +151,35 @@ struct namecache_ts { > * name is located in the cache, it will be dropped. > * > * These locks are used (in the order in which they can be taken): > - * NAME TYPE ROLE > - * cache_lock rwlock global, needed for all modifications > - * bucketlock rwlock for access to given hash bucket > - * ncneg_mtx mtx negative entry LRU management > + * NAME TYPE ROLE > + * vnodelock mtx vnode lists and v_cache_dd field protection > + * bucketlock rwlock for access to given set of hash buckets > + * ncneg_mtx mtx negative entry LRU management > * > - * A name -> vnode lookup can be safely performed by either locking cache_lock > - * or the relevant hash bucket. > + * Additionally, ncneg_shrink_lock mtx is used to have at most one thread > + * shrinking the LRU list. > * > - * ".." and vnode -> name lookups require cache_lock. > + * It is legal to take multiple vnodelock and bucketlock locks. The locking > + * order is lower address first. Both are recursive. > * > - * Modifications require both cache_lock and relevant bucketlock taken for > - * writing. > + * "." lookups are lockless. > * > - * Negative entry LRU management requires ncneg_mtx taken on top of either > - * cache_lock or bucketlock. > + * ".." and vnode -> name lookups require vnodelock. > + * > + * name -> vnode lookup requires the relevant bucketlock to be held for reading. > + * > + * Insertions and removals of entries require involved vnodes and bucketlocks > + * to be write-locked to prevent other threads from seeing the entry. > + * > + * Some lookups result in removal of the found entry (e.g. getting rid of a > + * negative entry with the intent to create a positive one), which poses a > + * problem when multiple threads reach the state. Similarly, two different > + * threads can purge two different vnodes and try to remove the same name. > + * > + * If the already held vnode lock is lower than the second required lock, we > + * can just take the other lock. However, in the opposite case, this could > + * deadlock. As such, this is resolved by trylocking and if that fails unlocking > + * the first node, locking everything in order and revalidating the state. > */ > > /* > @@ -196,15 +210,9 @@ SYSCTL_UINT(_vfs, OID_AUTO, ncsizefactor > > struct nchstats nchstats; /* cache effectiveness statistics */ > > -static struct rwlock cache_lock; > -RW_SYSINIT(vfscache, &cache_lock, "ncglobal"); > - > -#define CACHE_TRY_WLOCK() rw_try_wlock(&cache_lock) > -#define CACHE_UPGRADE_LOCK() rw_try_upgrade(&cache_lock) > -#define CACHE_RLOCK() rw_rlock(&cache_lock) > -#define CACHE_RUNLOCK() rw_runlock(&cache_lock) > -#define CACHE_WLOCK() rw_wlock(&cache_lock) > -#define CACHE_WUNLOCK() rw_wunlock(&cache_lock) > +static struct mtx ncneg_shrink_lock; > +MTX_SYSINIT(vfscache_shrink_neg, &ncneg_shrink_lock, "Name Cache shrink neg", > + MTX_DEF); > > static struct mtx_padalign ncneg_mtx; > MTX_SYSINIT(vfscache_neg, &ncneg_mtx, "ncneg", MTX_DEF); > @@ -214,6 +222,19 @@ static struct rwlock_padalign *bucketlo > #define HASH2BUCKETLOCK(hash) \ > ((struct rwlock *)(&bucketlocks[((hash) % numbucketlocks)])) > > +static u_int numvnodelocks; > +static struct mtx *vnodelocks; > +static inline struct mtx * > +VP2VNODELOCK(struct vnode *vp) > +{ > + struct mtx *vlp; > + > + if (vp == NULL) > + return (NULL); > + vlp = &vnodelocks[(((uintptr_t)(vp) >> 8) % numvnodelocks)]; > + return (vlp); > +} > + > /* > * UMA zones for the VFS cache. > * > @@ -329,19 +350,49 @@ STATNODE_COUNTER(numfullpathfail2, > "Number of fullpath search errors (VOP_VPTOCNP failures)"); > STATNODE_COUNTER(numfullpathfail4, "Number of fullpath search errors (ENOMEM)"); > STATNODE_COUNTER(numfullpathfound, "Number of successful fullpath calls"); > -static long numupgrades; STATNODE_ULONG(numupgrades, > - "Number of updates of the cache after lookup (write lock + retry)"); > static long zap_and_exit_bucket_fail; STATNODE_ULONG(zap_and_exit_bucket_fail, > - "Number of times bucketlocked zap_and_exit case failed to writelock"); > + "Number of times zap_and_exit failed to lock"); > +static long cache_lock_vnodes_cel_3_failures; > +STATNODE_ULONG(cache_lock_vnodes_cel_3_failures, > + "Number of times 3-way vnode locking failed"); > > -static void cache_zap(struct namecache *ncp); > -static int vn_vptocnp_locked(struct vnode **vp, struct ucred *cred, char *buf, > - u_int *buflen); > +static void cache_zap_locked(struct namecache *ncp, bool neg_locked); > static int vn_fullpath1(struct thread *td, struct vnode *vp, struct vnode *rdir, > char *buf, char **retbuf, u_int buflen); > > static MALLOC_DEFINE(M_VFSCACHE, "vfscache", "VFS name cache entries"); > > +static int cache_yield; > +SYSCTL_INT(_vfs_cache, OID_AUTO, yield, CTLFLAG_RD, &cache_yield, 0, > + "Number of times cache called yield"); > + > +static void > +cache_maybe_yield(void) > +{ > + > + if (should_yield()) { > + cache_yield++; > + kern_yield(PRI_USER); > + } > +} > + > +static inline void > +cache_assert_vlp_locked(struct mtx *vlp) > +{ > + > + if (vlp != NULL) > + mtx_assert(vlp, MA_OWNED); > +} > + > +static inline void > +cache_assert_vnode_locked(struct vnode *vp) > +{ > + struct mtx *vlp; > + > + vlp = VP2VNODELOCK(vp); > + cache_assert_vlp_locked(vlp); > +} > + > static uint32_t > cache_get_hash(char *name, u_char len, struct vnode *dvp) > { > @@ -352,21 +403,41 @@ cache_get_hash(char *name, u_char len, s > return (hash); > } > > +static inline struct rwlock * > +NCP2BUCKETLOCK(struct namecache *ncp) > +{ > + uint32_t hash; > + > + hash = cache_get_hash(nc_get_name(ncp), ncp->nc_nlen, ncp->nc_dvp); > + return (HASH2BUCKETLOCK(hash)); > +} > + > #ifdef INVARIANTS > static void > cache_assert_bucket_locked(struct namecache *ncp, int mode) > { > - struct rwlock *bucketlock; > - uint32_t hash; > + struct rwlock *blp; > > - hash = cache_get_hash(nc_get_name(ncp), ncp->nc_nlen, ncp->nc_dvp); > - bucketlock = HASH2BUCKETLOCK(hash); > - rw_assert(bucketlock, mode); > + blp = NCP2BUCKETLOCK(ncp); > + rw_assert(blp, mode); > } > #else > #define cache_assert_bucket_locked(x, y) do { } while (0) > #endif > > +#define cache_sort(x, y) _cache_sort((void **)(x), (void **)(y)) > +static void > +_cache_sort(void **p1, void **p2) > +{ > + void *tmp; > + > + if (*p1 > *p2) { > + tmp = *p2; > + *p2 = *p1; > + *p1 = tmp; > + } > +} > + > static void > cache_lock_all_buckets(void) > { > @@ -385,6 +456,56 @@ cache_unlock_all_buckets(void) > rw_wunlock(&bucketlocks[i]); > } > > +static void > +cache_lock_all_vnodes(void) > +{ > + u_int i; > + > + for (i = 0; i < numvnodelocks; i++) > + mtx_lock(&vnodelocks[i]); > +} > + > +static void > +cache_unlock_all_vnodes(void) > +{ > + u_int i; > + > + for (i = 0; i < numvnodelocks; i++) > + mtx_unlock(&vnodelocks[i]); > +} > + > +static int > +cache_trylock_vnodes(struct mtx *vlp1, struct mtx *vlp2) > +{ > + > + cache_sort(&vlp1, &vlp2); > + MPASS(vlp2 != NULL); > + > + if (vlp1 != NULL) { > + if (!mtx_trylock(vlp1)) > + return (EAGAIN); > + } > + if (!mtx_trylock(vlp2)) { > + if (vlp1 != NULL) > + mtx_unlock(vlp1); > + return (EAGAIN); > + } > + > + return (0); > +} > + > +static void > +cache_unlock_vnodes(struct mtx *vlp1, struct mtx *vlp2) > +{ > + > + MPASS(vlp1 != NULL || vlp2 != NULL); > + > + if (vlp1 != NULL) > + mtx_unlock(vlp1); > + if (vlp2 != NULL) > + mtx_unlock(vlp2); > +} > + > static int > sysctl_nchstats(SYSCTL_HANDLER_ARGS) > { > @@ -426,9 +547,9 @@ retry: > if (req->oldptr == NULL) > return SYSCTL_OUT(req, 0, n_nchash * sizeof(int)); > cntbuf = malloc(n_nchash * sizeof(int), M_TEMP, M_ZERO | M_WAITOK); > - CACHE_RLOCK(); > + cache_lock_all_buckets(); > if (n_nchash != nchash + 1) { > - CACHE_RUNLOCK(); > + cache_unlock_all_buckets(); > free(cntbuf, M_TEMP); > goto retry; > } > @@ -436,7 +557,7 @@ retry: > for (ncpp = nchashtbl, i = 0; i < n_nchash; ncpp++, i++) > LIST_FOREACH(ncp, ncpp, nc_hash) > cntbuf[i]++; > - CACHE_RUNLOCK(); > + cache_unlock_all_buckets(); > for (error = 0, i = 0; i < n_nchash; i++) > if ((error = SYSCTL_OUT(req, &cntbuf[i], sizeof(int))) != 0) > break; > @@ -459,7 +580,7 @@ sysctl_debug_hashstat_nchash(SYSCTL_HAND > if (!req->oldptr) > return SYSCTL_OUT(req, 0, 4 * sizeof(int)); > > - CACHE_RLOCK(); > + cache_lock_all_buckets(); > n_nchash = nchash + 1; /* nchash is max index, not count */ > used = 0; > maxlength = 0; > @@ -476,7 +597,7 @@ sysctl_debug_hashstat_nchash(SYSCTL_HAND > maxlength = count; > } > n_nchash = nchash + 1; > - CACHE_RUNLOCK(); > + cache_unlock_all_buckets(); > pct = (used * 100) / (n_nchash / 100); > error = SYSCTL_OUT(req, &n_nchash, sizeof(n_nchash)); > if (error) > @@ -504,6 +625,7 @@ static void > cache_negative_hit(struct namecache *ncp) > { > > + MPASS(ncp->nc_vp == NULL); > mtx_lock(&ncneg_mtx); > TAILQ_REMOVE(&ncneg, ncp, nc_dst); > TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); > @@ -514,9 +636,8 @@ static void > cache_negative_insert(struct namecache *ncp) > { > > - rw_assert(&cache_lock, RA_WLOCKED); > - cache_assert_bucket_locked(ncp, RA_WLOCKED); > MPASS(ncp->nc_vp == NULL); > + cache_assert_bucket_locked(ncp, RA_WLOCKED); > mtx_lock(&ncneg_mtx); > TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); > numneg++; > @@ -524,43 +645,74 @@ cache_negative_insert(struct namecache * > } > > static void > -cache_negative_remove(struct namecache *ncp) > +cache_negative_remove(struct namecache *ncp, bool neg_locked) > { > > - rw_assert(&cache_lock, RA_WLOCKED); > - cache_assert_bucket_locked(ncp, RA_WLOCKED); > MPASS(ncp->nc_vp == NULL); > - mtx_lock(&ncneg_mtx); > + cache_assert_bucket_locked(ncp, RA_WLOCKED); > + if (!neg_locked) > + mtx_lock(&ncneg_mtx); > + else > + mtx_assert(&ncneg_mtx, MA_OWNED); > TAILQ_REMOVE(&ncneg, ncp, nc_dst); > numneg--; > - mtx_unlock(&ncneg_mtx); > + if (!neg_locked) > + mtx_unlock(&ncneg_mtx); > } > > -static struct namecache * > +static void > cache_negative_zap_one(void) > { > - struct namecache *ncp; > + struct namecache *ncp, *ncp2; > + struct mtx *dvlp; > + struct rwlock *blp; > + > + if (!mtx_trylock(&ncneg_shrink_lock)) > + return; > > - rw_assert(&cache_lock, RA_WLOCKED); > + mtx_lock(&ncneg_mtx); > ncp = TAILQ_FIRST(&ncneg); > - KASSERT(ncp->nc_vp == NULL, ("ncp %p vp %p on ncneg", > - ncp, ncp->nc_vp)); > - cache_zap(ncp); > - return (ncp); > + if (ncp == NULL) { > + mtx_unlock(&ncneg_mtx); > + goto out; > + } > + MPASS(ncp->nc_vp == NULL); > + dvlp = VP2VNODELOCK(ncp->nc_dvp); > + blp = NCP2BUCKETLOCK(ncp); > + mtx_unlock(&ncneg_mtx); > + mtx_lock(dvlp); > + rw_wlock(blp); > + mtx_lock(&ncneg_mtx); > + ncp2 = TAILQ_FIRST(&ncneg); > + if (ncp != ncp2 || dvlp != VP2VNODELOCK(ncp2->nc_dvp) || > + blp != NCP2BUCKETLOCK(ncp2) || ncp2->nc_vp != NULL) { > + ncp = NULL; > + goto out_unlock_all; > + } > + cache_zap_locked(ncp, true); > +out_unlock_all: > + mtx_unlock(&ncneg_mtx); > + rw_wunlock(blp); > + mtx_unlock(dvlp); > +out: > + mtx_unlock(&ncneg_shrink_lock); > + cache_free(ncp); > } > > /* > - * cache_zap(): > + * cache_zap_locked(): > * > * Removes a namecache entry from cache, whether it contains an actual > * pointer to a vnode or if it is just a negative cache entry. > */ > static void > -cache_zap_locked(struct namecache *ncp) > +cache_zap_locked(struct namecache *ncp, bool neg_locked) > { > > - rw_assert(&cache_lock, RA_WLOCKED); > + cache_assert_vnode_locked(ncp->nc_vp); > + cache_assert_vnode_locked(ncp->nc_dvp); > cache_assert_bucket_locked(ncp, RA_WLOCKED); > + > CTR2(KTR_VFS, "cache_zap(%p) vp %p", ncp, ncp->nc_vp); > if (ncp->nc_vp != NULL) { > SDT_PROBE3(vfs, namecache, zap, done, ncp->nc_dvp, > @@ -577,7 +729,7 @@ cache_zap_locked(struct namecache *ncp) > LIST_REMOVE(ncp, nc_src); > if (LIST_EMPTY(&ncp->nc_dvp->v_cache_src)) { > ncp->nc_flag |= NCF_DVDROP; > - numcachehv--; > + atomic_subtract_rel_long(&numcachehv, 1); > } > } > if (ncp->nc_vp) { > @@ -585,24 +737,198 @@ cache_zap_locked(struct namecache *ncp) > if (ncp == ncp->nc_vp->v_cache_dd) > ncp->nc_vp->v_cache_dd = NULL; > } else { > - cache_negative_remove(ncp); > + cache_negative_remove(ncp, neg_locked); > } > - numcache--; > + atomic_subtract_rel_long(&numcache, 1); > } > > static void > -cache_zap(struct namecache *ncp) > +cache_zap_negative_locked_vnode_kl(struct namecache *ncp, struct vnode *vp) > { > - struct rwlock *bucketlock; > - uint32_t hash; > + struct rwlock *blp; > > - rw_assert(&cache_lock, RA_WLOCKED); > + MPASS(ncp->nc_dvp == vp); > + MPASS(ncp->nc_vp == NULL); > + cache_assert_vnode_locked(vp); > > - hash = cache_get_hash(nc_get_name(ncp), ncp->nc_nlen, ncp->nc_dvp); > - bucketlock = HASH2BUCKETLOCK(hash); > - rw_wlock(bucketlock); > - cache_zap_locked(ncp); > - rw_wunlock(bucketlock); > + blp = NCP2BUCKETLOCK(ncp); > + rw_wlock(blp); > + cache_zap_locked(ncp, false); > + rw_wunlock(blp); > +} > + > +static bool > +cache_zap_locked_vnode_kl2(struct namecache *ncp, struct vnode *vp, > + struct mtx **vlpp) > +{ > + struct mtx *pvlp, *vlp1, *vlp2, *to_unlock; > + struct rwlock *blp; > + > + MPASS(vp == ncp->nc_dvp || vp == ncp->nc_vp); > + cache_assert_vnode_locked(vp); > + > + if (ncp->nc_vp == NULL) { > + if (*vlpp != NULL) { > + mtx_unlock(*vlpp); > + *vlpp = NULL; > + } > + cache_zap_negative_locked_vnode_kl(ncp, vp); > + return (true); > + } > + > + pvlp = VP2VNODELOCK(vp); > + blp = NCP2BUCKETLOCK(ncp); > + vlp1 = VP2VNODELOCK(ncp->nc_dvp); > + vlp2 = VP2VNODELOCK(ncp->nc_vp); > + > + if (*vlpp == vlp1 || *vlpp == vlp2) { > + to_unlock = *vlpp; > + *vlpp = NULL; > + } else { > + if (*vlpp != NULL) { > + mtx_unlock(*vlpp); > + *vlpp = NULL; > + } > + cache_sort(&vlp1, &vlp2); > + if (vlp1 == pvlp) { > + mtx_lock(vlp2); > + to_unlock = vlp2; > + } else { > + if (!mtx_trylock(vlp1)) > + goto out_relock; > + to_unlock = vlp1; > + } > + } > + rw_wlock(blp); > + cache_zap_locked(ncp, false); > + rw_wunlock(blp); > + if (to_unlock != NULL) > + mtx_unlock(to_unlock); > + return (true); > + > +out_relock: > + mtx_unlock(vlp2); > + mtx_lock(vlp1); > + mtx_lock(vlp2); > + MPASS(*vlpp == NULL); > + *vlpp = vlp1; > + return (false); > +} > + > +static int > +cache_zap_locked_vnode(struct namecache *ncp, struct vnode *vp) > +{ > + struct mtx *pvlp, *vlp1, *vlp2, *to_unlock; > + struct rwlock *blp; > + int error = 0; > + > + MPASS(vp == ncp->nc_dvp || vp == ncp->nc_vp); > + cache_assert_vnode_locked(vp); > + > + pvlp = VP2VNODELOCK(vp); > + if (ncp->nc_vp == NULL) { > + cache_zap_negative_locked_vnode_kl(ncp, vp); > + goto out; > + } > + > + blp = NCP2BUCKETLOCK(ncp); > + vlp1 = VP2VNODELOCK(ncp->nc_dvp); > + vlp2 = VP2VNODELOCK(ncp->nc_vp); > + cache_sort(&vlp1, &vlp2); > + if (vlp1 == pvlp) { > + mtx_lock(vlp2); > + to_unlock = vlp2; > + } else { > + if (!mtx_trylock(vlp1)) { > + error = EAGAIN; > + goto out; > + } > + to_unlock = vlp1; > + } > + rw_wlock(blp); > + cache_zap_locked(ncp, false); > + rw_wunlock(blp); > + mtx_unlock(to_unlock); > +out: > + mtx_unlock(pvlp); > + return (error); > +} > + > +static int > +cache_zap_rlocked_bucket(struct namecache *ncp, struct rwlock *blp) > +{ > + struct mtx *dvlp, *vlp; > + > + cache_assert_bucket_locked(ncp, RA_RLOCKED); > + > + dvlp = VP2VNODELOCK(ncp->nc_dvp); > + vlp = VP2VNODELOCK(ncp->nc_vp); > + if (cache_trylock_vnodes(dvlp, vlp) == 0) { > + rw_runlock(blp); > + rw_wlock(blp); > + cache_zap_locked(ncp, false); > + rw_wunlock(blp); > + cache_unlock_vnodes(dvlp, vlp); > + return (0); > + } > + > + rw_runlock(blp); > + return (EAGAIN); > +} > + > +static int > +cache_zap_wlocked_bucket_kl(struct namecache *ncp, struct rwlock *blp, > + struct mtx **vlpp1, struct mtx **vlpp2) > +{ > + struct mtx *dvlp, *vlp; > + > + cache_assert_bucket_locked(ncp, RA_WLOCKED); > + > + dvlp = VP2VNODELOCK(ncp->nc_dvp); > + vlp = VP2VNODELOCK(ncp->nc_vp); > + cache_sort(&dvlp, &vlp); > + > + if (*vlpp1 == dvlp && *vlpp2 == vlp) { > + cache_zap_locked(ncp, false); > + cache_unlock_vnodes(dvlp, vlp); > + *vlpp1 = NULL; > + *vlpp2 = NULL; > + return (0); > + } > + > + if (*vlpp1 != NULL) > + mtx_unlock(*vlpp1); > + if (*vlpp2 != NULL) > + mtx_unlock(*vlpp2); > + *vlpp1 = NULL; > + *vlpp2 = NULL; > + > + if (cache_trylock_vnodes(dvlp, vlp) == 0) { > + cache_zap_locked(ncp, false); > + cache_unlock_vnodes(dvlp, vlp); > + return (0); > + } > + > + rw_wunlock(blp); > + *vlpp1 = dvlp; > + *vlpp2 = vlp; > + if (*vlpp1 != NULL) > + mtx_lock(*vlpp1); > + mtx_lock(*vlpp2); > + rw_wlock(blp); > + return (EAGAIN); > +} > + > +static void > +cache_lookup_unlock(struct rwlock *blp, struct mtx *vlp) > +{ > + > + if (blp != NULL) { > + rw_runlock(blp); > + mtx_assert(vlp, MA_NOTOWNED); > + } else { > + mtx_unlock(vlp); > + } > } > > /* > @@ -622,44 +948,26 @@ cache_zap(struct namecache *ncp) > * not recursively acquired. > */ > > -enum { UNLOCKED, WLOCKED, RLOCKED }; > - > -static void > -cache_unlock(int cache_locked) > -{ > - > - switch (cache_locked) { > - case UNLOCKED: > - break; > - case WLOCKED: > - CACHE_WUNLOCK(); > - break; > - case RLOCKED: > - CACHE_RUNLOCK(); > - break; > - } > -} > - > int > cache_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, > struct timespec *tsp, int *ticksp) > { > - struct rwlock *bucketlock; > struct namecache *ncp; > + struct rwlock *blp; > + struct mtx *dvlp, *dvlp2; > uint32_t hash; > - int error, ltype, cache_locked; > + int error, ltype; > > if (!doingcache) { > cnp->cn_flags &= ~MAKEENTRY; > return (0); > } > retry: > - bucketlock = NULL; > - cache_locked = UNLOCKED; > + blp = NULL; > + dvlp = VP2VNODELOCK(dvp); > error = 0; > counter_u64_add(numcalls, 1); > > -retry_wlocked: > if (cnp->cn_nameptr[0] == '.') { > if (cnp->cn_namelen == 1) { > *vpp = dvp; > @@ -693,32 +1001,37 @@ retry_wlocked: > } > if (cnp->cn_namelen == 2 && cnp->cn_nameptr[1] == '.') { > counter_u64_add(dotdothits, 1); > - if (cache_locked == UNLOCKED) { > - CACHE_RLOCK(); > - cache_locked = RLOCKED; > - } > - > - if (dvp->v_cache_dd == NULL) { > + dvlp2 = NULL; > + mtx_lock(dvlp); > +retry_dotdot: > + ncp = dvp->v_cache_dd; > + if (ncp == NULL) { > SDT_PROBE3(vfs, namecache, lookup, miss, dvp, > "..", NULL); > - goto unlock; > + mtx_unlock(dvlp); > + return (0); > } > if ((cnp->cn_flags & MAKEENTRY) == 0) { > - if (cache_locked != WLOCKED && > - !CACHE_UPGRADE_LOCK()) > - goto wlock; > - ncp = NULL; > - if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT) { > - ncp = dvp->v_cache_dd; > - cache_zap(ncp); > + if ((ncp->nc_flag & NCF_ISDOTDOT) != 0) { > + if (ncp->nc_dvp != dvp) > + panic("dvp %p v_cache_dd %p\n", dvp, ncp); > + if (!cache_zap_locked_vnode_kl2(ncp, > + dvp, &dvlp2)) > + goto retry_dotdot; > + MPASS(dvp->v_cache_dd == NULL); > + mtx_unlock(dvlp); > + if (dvlp2 != NULL) > + mtx_unlock(dvlp2); > + cache_free(ncp); > + } else { > + dvp->v_cache_dd = NULL; > + mtx_unlock(dvlp); > + if (dvlp2 != NULL) > + mtx_unlock(dvlp2); > } > - dvp->v_cache_dd = NULL; > - CACHE_WUNLOCK(); > - cache_free(ncp); > return (0); > } > - ncp = dvp->v_cache_dd; > - if (ncp->nc_flag & NCF_ISDOTDOT) > + if ((ncp->nc_flag & NCF_ISDOTDOT) != 0) > *vpp = ncp->nc_vp; > else > *vpp = ncp->nc_dvp; > @@ -739,10 +1052,8 @@ retry_wlocked: > } > > hash = cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp); > - if (cache_locked == UNLOCKED) { > - bucketlock = HASH2BUCKETLOCK(hash); > - rw_rlock(bucketlock); > - } > + blp = HASH2BUCKETLOCK(hash); > + rw_rlock(blp); > > LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) { > counter_u64_add(numchecks, 1); > @@ -795,24 +1106,9 @@ negative_success: > SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, > nc_get_name(ncp)); > cache_out_ts(ncp, tsp, ticksp); > - MPASS(bucketlock != NULL || cache_locked != UNLOCKED); > - if (bucketlock != NULL) > - rw_runlock(bucketlock); > - cache_unlock(cache_locked); > + cache_lookup_unlock(blp, dvlp); > return (ENOENT); > > -wlock: > - /* > - * We need to update the cache after our lookup, so upgrade to > - * a write lock and retry the operation. > - */ > - CACHE_RUNLOCK(); > -wlock_unlocked: > - CACHE_WLOCK(); > - numupgrades++; > - cache_locked = WLOCKED; > - goto retry_wlocked; > - > success: > /* > * On success we return a locked and ref'd vnode as per the lookup > @@ -825,10 +1121,7 @@ success: > VOP_UNLOCK(dvp, 0); > } > vhold(*vpp); > - MPASS(bucketlock != NULL || cache_locked != UNLOCKED); > - if (bucketlock != NULL) > - rw_runlock(bucketlock); > - cache_unlock(cache_locked); > + cache_lookup_unlock(blp, dvlp); > error = vget(*vpp, cnp->cn_lkflags | LK_VNHELD, cnp->cn_thread); > if (cnp->cn_flags & ISDOTDOT) { > vn_lock(dvp, ltype | LK_RETRY); > @@ -850,32 +1143,232 @@ success: > return (-1); > > unlock: > - MPASS(bucketlock != NULL || cache_locked != UNLOCKED); > - if (bucketlock != NULL) > - rw_runlock(bucketlock); > - cache_unlock(cache_locked); > + cache_lookup_unlock(blp, dvlp); > return (0); > > zap_and_exit: > - if (bucketlock != NULL) { > - rw_assert(&cache_lock, RA_UNLOCKED); > - if (!CACHE_TRY_WLOCK()) { > - rw_runlock(bucketlock); > - bucketlock = NULL; > - zap_and_exit_bucket_fail++; > - goto wlock_unlocked; > - } > - cache_locked = WLOCKED; > - rw_runlock(bucketlock); > - bucketlock = NULL; > - } else if (cache_locked != WLOCKED && !CACHE_UPGRADE_LOCK()) > - goto wlock; > - cache_zap(ncp); > - CACHE_WUNLOCK(); > + if (blp != NULL) > + error = cache_zap_rlocked_bucket(ncp, blp); > + else > + error = cache_zap_locked_vnode(ncp, dvp); > + if (error != 0) { > + zap_and_exit_bucket_fail++; > + cache_maybe_yield(); > + goto retry; > + } > cache_free(ncp); > return (0); > } > > +struct celockstate { > + struct mtx *vlp[3]; > + struct rwlock *blp[2]; > +}; > +CTASSERT((nitems(((struct celockstate *)0)->vlp) == 3)); > +CTASSERT((nitems(((struct celockstate *)0)->blp) == 2)); > + > +static inline void > +cache_celockstate_init(struct celockstate *cel) > +{ > + > + bzero(cel, sizeof(*cel)); > +} > + > +static void > +cache_lock_vnodes_cel(struct celockstate *cel, struct vnode *vp, > + struct vnode *dvp) > +{ > + struct mtx *vlp1, *vlp2; > + > + MPASS(cel->vlp[0] == NULL); > + MPASS(cel->vlp[1] == NULL); > + MPASS(cel->vlp[2] == NULL); > + > + MPASS(vp != NULL || dvp != NULL); > + > + vlp1 = VP2VNODELOCK(vp); > + vlp2 = VP2VNODELOCK(dvp); > + cache_sort(&vlp1, &vlp2); > + > + if (vlp1 != NULL) { > + mtx_lock(vlp1); > + cel->vlp[0] = vlp1; > + } > + mtx_lock(vlp2); > + cel->vlp[1] = vlp2; > +} > + > +static void > +cache_unlock_vnodes_cel(struct celockstate *cel) > +{ > + > + MPASS(cel->vlp[0] != NULL || cel->vlp[1] != NULL); > + > + if (cel->vlp[0] != NULL) > + mtx_unlock(cel->vlp[0]); > + if (cel->vlp[1] != NULL) > + mtx_unlock(cel->vlp[1]); > + if (cel->vlp[2] != NULL) > + mtx_unlock(cel->vlp[2]); > +} > + > +static bool > +cache_lock_vnodes_cel_3(struct celockstate *cel, struct vnode *vp) > +{ > + struct mtx *vlp; > + bool ret; > + > + cache_assert_vlp_locked(cel->vlp[0]); > + cache_assert_vlp_locked(cel->vlp[1]); > + MPASS(cel->vlp[2] == NULL); > + > + vlp = VP2VNODELOCK(vp); > + if (vlp == NULL) > + return (true); > + > + ret = true; > + if (vlp >= cel->vlp[1]) { > + mtx_lock(vlp); > + } else { > + if (mtx_trylock(vlp)) > + goto out; > + cache_lock_vnodes_cel_3_failures++; > + cache_unlock_vnodes_cel(cel); > + if (vlp < cel->vlp[0]) { > + mtx_lock(vlp); > + mtx_lock(cel->vlp[0]); > + mtx_lock(cel->vlp[1]); > + } else { > + if (cel->vlp[0] != NULL) > + mtx_lock(cel->vlp[0]); > + mtx_lock(vlp); > + mtx_lock(cel->vlp[1]); > + } > + ret = false; > + } > +out: > + cel->vlp[2] = vlp; > + return (ret); > +} > + > +static void > +cache_lock_buckets_cel(struct celockstate *cel, struct rwlock *blp1, > + struct rwlock *blp2) > +{ > + > + MPASS(cel->blp[0] == NULL); > + MPASS(cel->blp[1] == NULL); > + > + cache_sort(&blp1, &blp2); > + > + if (blp1 != NULL) { > + rw_wlock(blp1); > + cel->blp[0] = blp1; > + } > + rw_wlock(blp2); > + cel->blp[1] = blp2; > +} > + > +static void > +cache_unlock_buckets_cel(struct celockstate *cel) > +{ > + > + if (cel->blp[0] != NULL) > + rw_wunlock(cel->blp[0]); > + rw_wunlock(cel->blp[1]); > +} > + > +/* > + * Lock part of the cache affected by the insertion. > + * > + * This means vnodelocks for dvp, vp and the relevant bucketlock. > + * However, insertion can result in removal of an old entry. In this > + * case we have an additional vnode and bucketlock pair to lock. If the > + * entry is negative, ncelock is locked instead of the vnode. > + * > + * That is, in the worst case we have to lock 3 vnodes and 2 bucketlocks, while > + * preserving the locking order (smaller address first). > + */ > +static void > +cache_enter_lock(struct celockstate *cel, struct vnode *dvp, struct vnode *vp, > + uint32_t hash) > +{ > + struct namecache *ncp; > + struct rwlock *blps[2]; > + > + blps[0] = HASH2BUCKETLOCK(hash); > + for (;;) { > + blps[1] = NULL; > + cache_lock_vnodes_cel(cel, dvp, vp); > + if (vp == NULL || vp->v_type != VDIR) > + break; > + ncp = vp->v_cache_dd; > + if (ncp == NULL) > + break; > + if ((ncp->nc_flag & NCF_ISDOTDOT) == 0) > + break; > + MPASS(ncp->nc_dvp == vp); > + blps[1] = NCP2BUCKETLOCK(ncp); > + if (cache_lock_vnodes_cel_3(cel, ncp->nc_vp)) > + break; > + /* > + * All vnodes got re-locked. Re-validate the state and if > + * nothing changed we are done. Otherwise restart. > + */ > + if (ncp == vp->v_cache_dd && > + (ncp->nc_flag & NCF_ISDOTDOT) != 0 && > + blps[1] == NCP2BUCKETLOCK(ncp) && > + VP2VNODELOCK(ncp->nc_vp) == cel->vlp[2]) > + break; > + cache_unlock_vnodes_cel(cel); > + cel->vlp[0] = NULL; > + cel->vlp[1] = NULL; > + cel->vlp[2] = NULL; > + } > + cache_lock_buckets_cel(cel, blps[0], blps[1]); > +} > + > +static void > +cache_enter_lock_dd(struct celockstate *cel, struct vnode *dvp, struct vnode *vp, > + uint32_t hash) > +{ > + struct namecache *ncp; > + struct rwlock *blps[2]; > + > + blps[0] = HASH2BUCKETLOCK(hash); > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-all@freebsd.org Sat Nov 12 18:33:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 097CDC3E8DE; Sat, 12 Nov 2016 18:33:58 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB09E167B; Sat, 12 Nov 2016 18:33:57 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACIXuTh057651; Sat, 12 Nov 2016 18:33:56 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACIXu72057650; Sat, 12 Nov 2016 18:33:56 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201611121833.uACIXu72057650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Sat, 12 Nov 2016 18:33:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308577 - head/sys/dev/iwm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 18:33:58 -0000 Author: gavin Date: Sat Nov 12 18:33:56 2016 New Revision: 308577 URL: https://svnweb.freebsd.org/changeset/base/308577 Log: iwm: If firmware load fails during init via iwm_preinit() we bail out before calling ieee80211_ifattach() so the taskqueue hasn't been initialized. Don't try to drain it, we'll panic. Looks like this issue was introduced in r303326. Reviewed by: avos, sbruno, adrian Differential Revision: https://reviews.freebsd.org/D8499 Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Sat Nov 12 18:04:03 2016 (r308576) +++ head/sys/dev/iwm/if_iwm.c Sat Nov 12 18:33:56 2016 (r308577) @@ -6192,7 +6192,8 @@ iwm_detach_local(struct iwm_softc *sc, i device_t dev = sc->sc_dev; int i; - ieee80211_draintask(&sc->sc_ic, &sc->sc_es_task); + if (do_net80211) + ieee80211_draintask(&sc->sc_ic, &sc->sc_es_task); callout_drain(&sc->sc_led_blink_to); callout_drain(&sc->sc_watchdog_to); From owner-svn-src-all@freebsd.org Sat Nov 12 18:49:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61B43C3ED3B; Sat, 12 Nov 2016 18:49:47 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30F4EF4; Sat, 12 Nov 2016 18:49:47 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACInkdq062562; Sat, 12 Nov 2016 18:49:46 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACInkid062561; Sat, 12 Nov 2016 18:49:46 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201611121849.uACInkid062561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sat, 12 Nov 2016 18:49:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308578 - stable/11/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 18:49:47 -0000 Author: gjb Date: Sat Nov 12 18:49:46 2016 New Revision: 308578 URL: https://svnweb.freebsd.org/changeset/base/308578 Log: Fix relnotes build. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml Sat Nov 12 18:33:56 2016 (r308577) +++ stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml Sat Nov 12 18:49:46 2016 (r308578) @@ -1376,12 +1376,12 @@ /etc/sysctl.conf. Unmapped IO support has been added to - &man.virtio_blk.4;. + &man.virtio.blk.4;. Unmapped IO support has been added to - &man.virtio_scsi.4;. + &man.virtio.scsi.4;. - The &man.virtio_random.4; driver has + The &man.virtio.random.4; driver has been added to harvest entropy from the host system. &os;/&arch.i386; guests can be run under From owner-svn-src-all@freebsd.org Sat Nov 12 18:57:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C42BC3D0CB; Sat, 12 Nov 2016 18:57:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 560ADB2E; Sat, 12 Nov 2016 18:57:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACIvc9E066403; Sat, 12 Nov 2016 18:57:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACIvca7066402; Sat, 12 Nov 2016 18:57:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611121857.uACIvca7066402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Nov 2016 18:57:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308579 - head/sys/geom/multipath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 18:57:39 -0000 Author: mav Date: Sat Nov 12 18:57:38 2016 New Revision: 308579 URL: https://svnweb.freebsd.org/changeset/base/308579 Log: Do not report error on close even if we have no paths left. MFC after: 2 weeks Modified: head/sys/geom/multipath/g_multipath.c Modified: head/sys/geom/multipath/g_multipath.c ============================================================================== --- head/sys/geom/multipath/g_multipath.c Sat Nov 12 18:49:46 2016 (r308578) +++ head/sys/geom/multipath/g_multipath.c Sat Nov 12 18:57:38 2016 (r308579) @@ -470,7 +470,7 @@ g_multipath_access(struct g_provider *pp gp = pp->geom; /* Error used if we have no valid consumers. */ - error = ENXIO; + error = (dr > 0 || dw > 0 || de > 0) ? ENXIO : 0; LIST_FOREACH(cp, &gp->consumer, consumer) { if (cp->index & MP_WITHER) From owner-svn-src-all@freebsd.org Sat Nov 12 19:03:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07AF6C3D2AA; Sat, 12 Nov 2016 19:03:25 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD468F4A; Sat, 12 Nov 2016 19:03:24 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACJ3NTA070197; Sat, 12 Nov 2016 19:03:23 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACJ3NjC070196; Sat, 12 Nov 2016 19:03:23 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201611121903.uACJ3NjC070196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Sat, 12 Nov 2016 19:03:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308580 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 19:03:25 -0000 Author: rstone Date: Sat Nov 12 19:03:23 2016 New Revision: 308580 URL: https://svnweb.freebsd.org/changeset/base/308580 Log: Don't read if_counters with if_addr_lock held Calling into an ifnet implementation with the if_addr_lock already held can cause a LOR and potentially a deadlock, as ifnet implementations typically can take the if_addr_lock after their own locks during configuration. Refactor a sysctl handler that was violating this to read if_counter data in a temporary buffer before the if_addr_lock is taken, and then copying the data in its final location later, when the if_addr_lock is held. PR: 194109 Reported by: Jean-Sebastien Pedron MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D8498 Reviewed by: sbruno Modified: head/sys/net/rtsock.c Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Sat Nov 12 18:57:38 2016 (r308579) +++ head/sys/net/rtsock.c Sat Nov 12 19:03:23 2016 (r308580) @@ -1566,8 +1566,8 @@ sysctl_dumpentry(struct radix_node *rn, } static int -sysctl_iflist_ifml(struct ifnet *ifp, struct rt_addrinfo *info, - struct walkarg *w, int len) +sysctl_iflist_ifml(struct ifnet *ifp, const struct if_data *src_ifd, + struct rt_addrinfo *info, struct walkarg *w, int len) { struct if_msghdrl *ifm; struct if_data *ifd; @@ -1598,14 +1598,14 @@ sysctl_iflist_ifml(struct ifnet *ifp, st ifd = &ifm->ifm_data; } - if_data_copy(ifp, ifd); + memcpy(ifd, src_ifd, sizeof(*ifd)); return (SYSCTL_OUT(w->w_req, (caddr_t)ifm, len)); } static int -sysctl_iflist_ifm(struct ifnet *ifp, struct rt_addrinfo *info, - struct walkarg *w, int len) +sysctl_iflist_ifm(struct ifnet *ifp, const struct if_data *src_ifd, + struct rt_addrinfo *info, struct walkarg *w, int len) { struct if_msghdr *ifm; struct if_data *ifd; @@ -1630,7 +1630,7 @@ sysctl_iflist_ifm(struct ifnet *ifp, str ifd = &ifm->ifm_data; } - if_data_copy(ifp, ifd); + memcpy(ifd, src_ifd, sizeof(*ifd)); return (SYSCTL_OUT(w->w_req, (caddr_t)ifm, len)); } @@ -1705,15 +1705,18 @@ sysctl_iflist(int af, struct walkarg *w) { struct ifnet *ifp; struct ifaddr *ifa; + struct if_data ifd; struct rt_addrinfo info; int len, error = 0; struct sockaddr_storage ss; bzero((caddr_t)&info, sizeof(info)); + bzero(&ifd, sizeof(ifd)); IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (w->w_arg && w->w_arg != ifp->if_index) continue; + if_data_copy(ifp, &ifd); IF_ADDR_RLOCK(ifp); ifa = ifp->if_addr; info.rti_info[RTAX_IFP] = ifa->ifa_addr; @@ -1723,9 +1726,11 @@ sysctl_iflist(int af, struct walkarg *w) info.rti_info[RTAX_IFP] = NULL; if (w->w_req && w->w_tmem) { if (w->w_op == NET_RT_IFLISTL) - error = sysctl_iflist_ifml(ifp, &info, w, len); + error = sysctl_iflist_ifml(ifp, &ifd, &info, w, + len); else - error = sysctl_iflist_ifm(ifp, &info, w, len); + error = sysctl_iflist_ifm(ifp, &ifd, &info, w, + len); if (error) goto done; } From owner-svn-src-all@freebsd.org Sat Nov 12 19:05:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9B6AC3D49B; Sat, 12 Nov 2016 19:05:42 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B9321357; Sat, 12 Nov 2016 19:05:42 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACJ5fRp070375; Sat, 12 Nov 2016 19:05:41 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACJ5fGW070374; Sat, 12 Nov 2016 19:05:41 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201611121905.uACJ5fGW070374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 12 Nov 2016 19:05:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308581 - head/sys/modules/rpi_ft5406 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 19:05:42 -0000 Author: gonzo Date: Sat Nov 12 19:05:41 2016 New Revision: 308581 URL: https://svnweb.freebsd.org/changeset/base/308581 Log: [rpi_ft5406] Add missing dependency on mbox_if.h Submitted by: hselasky MFC after: ASAP Modified: head/sys/modules/rpi_ft5406/Makefile Modified: head/sys/modules/rpi_ft5406/Makefile ============================================================================== --- head/sys/modules/rpi_ft5406/Makefile Sat Nov 12 19:03:23 2016 (r308580) +++ head/sys/modules/rpi_ft5406/Makefile Sat Nov 12 19:05:41 2016 (r308581) @@ -5,6 +5,6 @@ KMOD= rpi_ft5406 SRCS= bcm2835_ft5406.c -SRCS+= bus_if.h device_if.h ofw_bus_if.h +SRCS+= bus_if.h device_if.h mbox_if.h ofw_bus_if.h .include From owner-svn-src-all@freebsd.org Sat Nov 12 19:26:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB70BC3DCFF; Sat, 12 Nov 2016 19:26:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89E6C1F97; Sat, 12 Nov 2016 19:26:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACJQDDo078955; Sat, 12 Nov 2016 19:26:13 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACJQDsu078946; Sat, 12 Nov 2016 19:26:13 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201611121926.uACJQDsu078946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 12 Nov 2016 19:26:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308582 - in head: cddl/contrib/opensolaris/lib/libdtrace/common sys/cddl/contrib/opensolaris/uts/common/dtrace sys/cddl/contrib/opensolaris/uts/common/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 19:26:14 -0000 Author: markj Date: Sat Nov 12 19:26:12 2016 New Revision: 308582 URL: https://svnweb.freebsd.org/changeset/base/308582 Log: Remove the DTrace printt and typeref actions. These are FreeBSD-specific and were added in r178576 to provide the ability to pretty-print instances of compound types. However, the print action has long since been augmented to provide this functionality with a simpler interface. Discussed with: gnn Differential Revision: https://reviews.freebsd.org/D8478 Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c Sat Nov 12 19:05:41 2016 (r308581) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c Sat Nov 12 19:26:12 2016 (r308582) @@ -1058,46 +1058,6 @@ dt_action_printm(dtrace_hdl_t *dtp, dt_n } static void -dt_action_printt(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp) -{ - dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp); - - dt_node_t *size = dnp->dn_args; - dt_node_t *addr = dnp->dn_args->dn_list; - - char n[DT_TYPE_NAMELEN]; - - if (dt_node_is_posconst(size) == 0) { - dnerror(size, D_PRINTT_SIZE, "printt( ) argument #1 must " - "be a non-zero positive integral constant expression\n"); - } - - if (addr == NULL || addr->dn_kind != DT_NODE_FUNC || - addr->dn_ident != dt_idhash_lookup(dtp->dt_globals, "typeref")) { - dnerror(addr, D_PRINTT_ADDR, - "printt( ) argument #2 is incompatible with " - "prototype:\n\tprototype: typeref()\n" - "\t argument: %s\n", - dt_node_type_name(addr, n, sizeof (n))); - } - - dt_cg(yypcb, addr); - ap->dtad_difo = dt_as(yypcb); - ap->dtad_kind = DTRACEACT_PRINTT; - - ap->dtad_difo->dtdo_rtype.dtdt_flags |= DIF_TF_BYREF; - - /* - * Allow additional buffer space for the data size, type size, - * type string length and a stab in the dark (32 bytes) for the - * type string. The type string is part of the typeref() that - * this action references. - */ - ap->dtad_difo->dtdo_rtype.dtdt_size = size->dn_value + 3 * sizeof(uintptr_t) + 32; - -} - -static void dt_action_commit(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp) { dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp); @@ -1169,9 +1129,6 @@ dt_compile_fun(dtrace_hdl_t *dtp, dt_nod case DT_ACT_PRINTM: dt_action_printm(dtp, dnp->dn_expr, sdp); break; - case DT_ACT_PRINTT: - dt_action_printt(dtp, dnp->dn_expr, sdp); - break; case DT_ACT_RAISE: dt_action_raise(dtp, dnp->dn_expr, sdp); break; Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c Sat Nov 12 19:05:41 2016 (r308581) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c Sat Nov 12 19:26:12 2016 (r308582) @@ -1353,40 +1353,6 @@ dt_cg_inline(dt_node_t *dnp, dt_irlist_t } } -static void -dt_cg_func_typeref(dtrace_hdl_t *dtp, dt_node_t *dnp) -{ - dtrace_typeinfo_t dtt; - dt_node_t *addr = dnp->dn_args; - dt_node_t *nelm = addr->dn_list; - dt_node_t *strp = nelm->dn_list; - dt_node_t *typs = strp->dn_list; - char buf[DT_TYPE_NAMELEN]; - char *p; - - ctf_type_name(addr->dn_ctfp, addr->dn_type, buf, sizeof (buf)); - - /* - * XXX Hack alert! XXX - * The prototype has two dummy args that we munge to represent - * the type string and the type size. - * - * Yes, I hear your grumble, but it works for now. We'll come - * up with a more elegant implementation later. :-) - */ - free(strp->dn_string); - - if ((p = strchr(buf, '*')) != NULL) - *p = '\0'; - - strp->dn_string = strdup(buf); - - if (dtrace_lookup_by_type(dtp, DTRACE_OBJ_EVERY, buf, &dtt) < 0) - return; - - typs->dn_value = ctf_type_size(dtt.dtt_ctfp, dtt.dtt_type); -} - typedef struct dt_xlmemb { dt_ident_t *dtxl_idp; /* translated ident */ dt_irlist_t *dtxl_dlp; /* instruction list */ @@ -2002,8 +1968,6 @@ dt_cg_node(dt_node_t *dnp, dt_irlist_t * switch (dnp->dn_kind) { case DT_NODE_FUNC: { - dtrace_hdl_t *dtp = yypcb->pcb_hdl; - if ((idp = dnp->dn_ident)->di_kind != DT_IDENT_FUNC) { dnerror(dnp, D_CG_EXPR, "%s %s( ) may not be " "called from a D expression (D program " @@ -2011,15 +1975,6 @@ dt_cg_node(dt_node_t *dnp, dt_irlist_t * dt_idkind_name(idp->di_kind), idp->di_name); } - switch (idp->di_id) { - case DIF_SUBR_TYPEREF: - dt_cg_func_typeref(dtp, dnp); - break; - - default: - break; - } - dt_cg_arglist(dnp->dn_ident, dnp->dn_args, dlp, drp); dnp->dn_reg = dt_regset_alloc(drp); Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Sat Nov 12 19:05:41 2016 (r308581) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Sat Nov 12 19:26:12 2016 (r308582) @@ -1537,314 +1537,6 @@ dt_print_umod(dtrace_hdl_t *dtp, FILE *f return (err); } -int -dt_print_memory(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr) -{ - int quiet = (dtp->dt_options[DTRACEOPT_QUIET] != DTRACEOPT_UNSET); - size_t nbytes = *((uintptr_t *) addr); - - return (dt_print_bytes(dtp, fp, addr + sizeof(uintptr_t), - nbytes, 50, quiet, 1)); -} - -typedef struct dt_type_cbdata { - dtrace_hdl_t *dtp; - dtrace_typeinfo_t dtt; - caddr_t addr; - caddr_t addrend; - const char *name; - int f_type; - int indent; - int type_width; - int name_width; - FILE *fp; -} dt_type_cbdata_t; - -static int dt_print_type_data(dt_type_cbdata_t *, ctf_id_t); - -static int -dt_print_type_member(const char *name, ctf_id_t type, ulong_t off, void *arg) -{ - dt_type_cbdata_t cbdata; - dt_type_cbdata_t *cbdatap = arg; - ssize_t ssz; - - if ((ssz = ctf_type_size(cbdatap->dtt.dtt_ctfp, type)) <= 0) - return (0); - - off /= 8; - - cbdata = *cbdatap; - cbdata.name = name; - cbdata.addr += off; - cbdata.addrend = cbdata.addr + ssz; - - return (dt_print_type_data(&cbdata, type)); -} - -static int -dt_print_type_width(const char *name, ctf_id_t type, ulong_t off, void *arg) -{ - char buf[DT_TYPE_NAMELEN]; - char *p; - dt_type_cbdata_t *cbdatap = arg; - size_t sz = strlen(name); - - ctf_type_name(cbdatap->dtt.dtt_ctfp, type, buf, sizeof (buf)); - - if ((p = strchr(buf, '[')) != NULL) - p[-1] = '\0'; - else - p = ""; - - sz += strlen(p); - - if (sz > cbdatap->name_width) - cbdatap->name_width = sz; - - sz = strlen(buf); - - if (sz > cbdatap->type_width) - cbdatap->type_width = sz; - - return (0); -} - -static int -dt_print_type_data(dt_type_cbdata_t *cbdatap, ctf_id_t type) -{ - caddr_t addr = cbdatap->addr; - caddr_t addrend = cbdatap->addrend; - char buf[DT_TYPE_NAMELEN]; - char *p; - int cnt = 0; - uint_t kind = ctf_type_kind(cbdatap->dtt.dtt_ctfp, type); - ssize_t ssz = ctf_type_size(cbdatap->dtt.dtt_ctfp, type); - - ctf_type_name(cbdatap->dtt.dtt_ctfp, type, buf, sizeof (buf)); - - if ((p = strchr(buf, '[')) != NULL) - p[-1] = '\0'; - else - p = ""; - - if (cbdatap->f_type) { - int type_width = roundup(cbdatap->type_width + 1, 4); - int name_width = roundup(cbdatap->name_width + 1, 4); - - name_width -= strlen(cbdatap->name); - - dt_printf(cbdatap->dtp, cbdatap->fp, "%*s%-*s%s%-*s = ",cbdatap->indent * 4,"",type_width,buf,cbdatap->name,name_width,p); - } - - while (addr < addrend) { - dt_type_cbdata_t cbdata; - ctf_arinfo_t arinfo; - ctf_encoding_t cte; - uintptr_t *up; - void *vp = addr; - cbdata = *cbdatap; - cbdata.name = ""; - cbdata.addr = addr; - cbdata.addrend = addr + ssz; - cbdata.f_type = 0; - cbdata.indent++; - cbdata.type_width = 0; - cbdata.name_width = 0; - - if (cnt > 0) - dt_printf(cbdatap->dtp, cbdatap->fp, "%*s", cbdatap->indent * 4,""); - - switch (kind) { - case CTF_K_INTEGER: - if (ctf_type_encoding(cbdatap->dtt.dtt_ctfp, type, &cte) != 0) - return (-1); - if ((cte.cte_format & CTF_INT_SIGNED) != 0) - switch (cte.cte_bits) { - case 8: - if (isprint(*((char *) vp))) - dt_printf(cbdatap->dtp, cbdatap->fp, "'%c', ", *((char *) vp)); - dt_printf(cbdatap->dtp, cbdatap->fp, "%d (0x%x);\n", *((char *) vp), *((char *) vp)); - break; - case 16: - dt_printf(cbdatap->dtp, cbdatap->fp, "%hd (0x%hx);\n", *((short *) vp), *((u_short *) vp)); - break; - case 32: - dt_printf(cbdatap->dtp, cbdatap->fp, "%d (0x%x);\n", *((int *) vp), *((u_int *) vp)); - break; - case 64: - dt_printf(cbdatap->dtp, cbdatap->fp, "%jd (0x%jx);\n", *((long long *) vp), *((unsigned long long *) vp)); - break; - default: - dt_printf(cbdatap->dtp, cbdatap->fp, "CTF_K_INTEGER: format %x offset %u bits %u\n",cte.cte_format,cte.cte_offset,cte.cte_bits); - break; - } - else - switch (cte.cte_bits) { - case 8: - dt_printf(cbdatap->dtp, cbdatap->fp, "%u (0x%x);\n", *((uint8_t *) vp) & 0xff, *((uint8_t *) vp) & 0xff); - break; - case 16: - dt_printf(cbdatap->dtp, cbdatap->fp, "%hu (0x%hx);\n", *((u_short *) vp), *((u_short *) vp)); - break; - case 32: - dt_printf(cbdatap->dtp, cbdatap->fp, "%u (0x%x);\n", *((u_int *) vp), *((u_int *) vp)); - break; - case 64: - dt_printf(cbdatap->dtp, cbdatap->fp, "%ju (0x%jx);\n", *((unsigned long long *) vp), *((unsigned long long *) vp)); - break; - default: - dt_printf(cbdatap->dtp, cbdatap->fp, "CTF_K_INTEGER: format %x offset %u bits %u\n",cte.cte_format,cte.cte_offset,cte.cte_bits); - break; - } - break; - case CTF_K_FLOAT: - dt_printf(cbdatap->dtp, cbdatap->fp, "CTF_K_FLOAT: format %x offset %u bits %u\n",cte.cte_format,cte.cte_offset,cte.cte_bits); - break; - case CTF_K_POINTER: - dt_printf(cbdatap->dtp, cbdatap->fp, "%p;\n", *((void **) addr)); - break; - case CTF_K_ARRAY: - if (ctf_array_info(cbdatap->dtt.dtt_ctfp, type, &arinfo) != 0) - return (-1); - dt_printf(cbdatap->dtp, cbdatap->fp, "{\n%*s",cbdata.indent * 4,""); - dt_print_type_data(&cbdata, arinfo.ctr_contents); - dt_printf(cbdatap->dtp, cbdatap->fp, "%*s};\n",cbdatap->indent * 4,""); - break; - case CTF_K_FUNCTION: - dt_printf(cbdatap->dtp, cbdatap->fp, "CTF_K_FUNCTION:\n"); - break; - case CTF_K_STRUCT: - cbdata.f_type = 1; - if (ctf_member_iter(cbdatap->dtt.dtt_ctfp, type, - dt_print_type_width, &cbdata) != 0) - return (-1); - dt_printf(cbdatap->dtp, cbdatap->fp, "{\n"); - if (ctf_member_iter(cbdatap->dtt.dtt_ctfp, type, - dt_print_type_member, &cbdata) != 0) - return (-1); - dt_printf(cbdatap->dtp, cbdatap->fp, "%*s};\n",cbdatap->indent * 4,""); - break; - case CTF_K_UNION: - cbdata.f_type = 1; - if (ctf_member_iter(cbdatap->dtt.dtt_ctfp, type, - dt_print_type_width, &cbdata) != 0) - return (-1); - dt_printf(cbdatap->dtp, cbdatap->fp, "{\n"); - if (ctf_member_iter(cbdatap->dtt.dtt_ctfp, type, - dt_print_type_member, &cbdata) != 0) - return (-1); - dt_printf(cbdatap->dtp, cbdatap->fp, "%*s};\n",cbdatap->indent * 4,""); - break; - case CTF_K_ENUM: - dt_printf(cbdatap->dtp, cbdatap->fp, "%s;\n", ctf_enum_name(cbdatap->dtt.dtt_ctfp, type, *((int *) vp))); - break; - case CTF_K_TYPEDEF: - dt_print_type_data(&cbdata, ctf_type_reference(cbdatap->dtt.dtt_ctfp,type)); - break; - case CTF_K_VOLATILE: - if (cbdatap->f_type) - dt_printf(cbdatap->dtp, cbdatap->fp, "volatile "); - dt_print_type_data(&cbdata, ctf_type_reference(cbdatap->dtt.dtt_ctfp,type)); - break; - case CTF_K_CONST: - if (cbdatap->f_type) - dt_printf(cbdatap->dtp, cbdatap->fp, "const "); - dt_print_type_data(&cbdata, ctf_type_reference(cbdatap->dtt.dtt_ctfp,type)); - break; - case CTF_K_RESTRICT: - if (cbdatap->f_type) - dt_printf(cbdatap->dtp, cbdatap->fp, "restrict "); - dt_print_type_data(&cbdata, ctf_type_reference(cbdatap->dtt.dtt_ctfp,type)); - break; - default: - break; - } - - addr += ssz; - cnt++; - } - - return (0); -} - -static int -dt_print_type(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr) -{ - caddr_t addrend; - char *p; - dtrace_typeinfo_t dtt; - dt_type_cbdata_t cbdata; - int num = 0; - int quiet = (dtp->dt_options[DTRACEOPT_QUIET] != DTRACEOPT_UNSET); - ssize_t ssz; - - if (!quiet) - dt_printf(dtp, fp, "\n"); - - /* Get the total number of bytes of data buffered. */ - size_t nbytes = *((uintptr_t *) addr); - addr += sizeof(uintptr_t); - - /* - * Get the size of the type so that we can check that it matches - * the CTF data we look up and so that we can figure out how many - * type elements are buffered. - */ - size_t typs = *((uintptr_t *) addr); - addr += sizeof(uintptr_t); - - /* - * Point to the type string in the buffer. Get it's string - * length and round it up to become the offset to the start - * of the buffered type data which we would like to be aligned - * for easy access. - */ - char *strp = (char *) addr; - int offset = roundup(strlen(strp) + 1, sizeof(uintptr_t)); - - /* - * The type string might have a format such as 'int [20]'. - * Check if there is an array dimension present. - */ - if ((p = strchr(strp, '[')) != NULL) { - /* Strip off the array dimension. */ - *p++ = '\0'; - - for (; *p != '\0' && *p != ']'; p++) - num = num * 10 + *p - '0'; - } else - /* No array dimension, so default. */ - num = 1; - - /* Lookup the CTF type from the type string. */ - if (dtrace_lookup_by_type(dtp, DTRACE_OBJ_EVERY, strp, &dtt) < 0) - return (-1); - - /* Offset the buffer address to the start of the data... */ - addr += offset; - - ssz = ctf_type_size(dtt.dtt_ctfp, dtt.dtt_type); - - if (typs != ssz) { - printf("Expected type size from buffer (%lu) to match type size looked up now (%ld)\n", (u_long) typs, (long) ssz); - return (-1); - } - - cbdata.dtp = dtp; - cbdata.dtt = dtt; - cbdata.name = ""; - cbdata.addr = addr; - cbdata.addrend = addr + nbytes; - cbdata.indent = 1; - cbdata.f_type = 1; - cbdata.type_width = 0; - cbdata.name_width = 0; - cbdata.fp = fp; - - return (dt_print_type_data(&cbdata, dtt.dtt_type)); -} - static int dt_print_sym(dtrace_hdl_t *dtp, FILE *fp, const char *format, caddr_t addr) { @@ -1904,6 +1596,16 @@ dt_print_mod(dtrace_hdl_t *dtp, FILE *fp return (0); } +static int +dt_print_memory(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr) +{ + int quiet = (dtp->dt_options[DTRACEOPT_QUIET] != DTRACEOPT_UNSET); + size_t nbytes = *((uintptr_t *) addr); + + return (dt_print_bytes(dtp, fp, addr + sizeof(uintptr_t), + nbytes, 50, quiet, 1)); +} + typedef struct dt_normal { dtrace_aggvarid_t dtnd_id; uint64_t dtnd_normal; @@ -2644,12 +2346,6 @@ dt_consume_cpu(dtrace_hdl_t *dtp, FILE * goto nextrec; } - if (act == DTRACEACT_PRINTT) { - if (dt_print_type(dtp, fp, addr) < 0) - return (-1); - goto nextrec; - } - if (DTRACEACT_ISPRINTFLIKE(act)) { void *fmtdata; int (*func)(dtrace_hdl_t *, FILE *, void *, Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h Sat Nov 12 19:05:41 2016 (r308581) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h Sat Nov 12 19:26:12 2016 (r308582) @@ -265,8 +265,6 @@ typedef enum { D_NOREG, /* no available internal registers */ D_PRINTM_ADDR, /* printm() memref bad type */ D_PRINTM_SIZE, /* printm() size bad type */ - D_PRINTT_ADDR, /* printt() typeref bad type */ - D_PRINTT_SIZE /* printt() size bad type */ } dt_errtag_t; extern const char *dt_errtag(dt_errtag_t); Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h Sat Nov 12 19:05:41 2016 (r308581) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h Sat Nov 12 19:26:12 2016 (r308582) @@ -488,7 +488,6 @@ struct dtrace_hdl { #define DT_ACT_SETOPT DT_ACT(28) /* setopt() action */ #define DT_ACT_PRINT DT_ACT(29) /* print() action */ #define DT_ACT_PRINTM DT_ACT(30) /* printm() action */ -#define DT_ACT_PRINTT DT_ACT(31) /* printt() action */ /* * Sentinel to tell freopen() to restore the saved stdout. This must not Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Sat Nov 12 19:05:41 2016 (r308581) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Sat Nov 12 19:26:12 2016 (r308582) @@ -392,8 +392,6 @@ static const dt_ident_t _dtrace_globals[ &dt_idops_func, "void(@, ...)" }, { "printm", DT_IDENT_ACTFUNC, 0, DT_ACT_PRINTM, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_func, "void(size_t, uintptr_t *)" }, -{ "printt", DT_IDENT_ACTFUNC, 0, DT_ACT_PRINTT, DT_ATTR_STABCMN, DT_VERS_1_0, - &dt_idops_func, "void(size_t, uintptr_t *)" }, { "probefunc", DT_IDENT_SCALAR, 0, DIF_VAR_PROBEFUNC, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" }, { "probemod", DT_IDENT_SCALAR, 0, DIF_VAR_PROBEMOD, @@ -505,8 +503,6 @@ static const dt_ident_t _dtrace_globals[ &dt_idops_func, "void(@, size_t, ...)" }, { "trunc", DT_IDENT_ACTFUNC, 0, DT_ACT_TRUNC, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_func, "void(...)" }, -{ "typeref", DT_IDENT_FUNC, 0, DIF_SUBR_TYPEREF, DT_ATTR_STABCMN, DT_VERS_1_1, - &dt_idops_func, "uintptr_t *(void *, size_t, string, size_t)" }, { "uaddr", DT_IDENT_ACTFUNC, 0, DT_ACT_UADDR, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, { "ucaller", DT_IDENT_SCALAR, 0, DIF_VAR_UCALLER, DT_ATTR_STABCMN, Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sat Nov 12 19:05:41 2016 (r308581) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sat Nov 12 19:26:12 2016 (r308582) @@ -6042,22 +6042,6 @@ inetout: regs[rd] = (uintptr_t)end + 1; break; } #endif - - case DIF_SUBR_TYPEREF: { - uintptr_t size = 4 * sizeof(uintptr_t); - uintptr_t *typeref = (uintptr_t *) P2ROUNDUP(mstate->dtms_scratch_ptr, sizeof(uintptr_t)); - size_t scratch_size = ((uintptr_t) typeref - mstate->dtms_scratch_ptr) + size; - - /* address, num_elements, type_str, type_len */ - typeref[0] = tupregs[0].dttk_value; - typeref[1] = tupregs[1].dttk_value; - typeref[2] = tupregs[2].dttk_value; - typeref[3] = tupregs[3].dttk_value; - - regs[rd] = (uintptr_t) typeref; - mstate->dtms_scratch_ptr += scratch_size; - break; - } } } @@ -7707,66 +7691,6 @@ dtrace_probe(dtrace_id_t id, uintptr_t a break; } - case DTRACEACT_PRINTT: { - /* The DIF returns a 'typeref'. */ - uintptr_t *typeref = (uintptr_t *)(uintptr_t) val; - char c = '\0' + 1; - size_t s; - - /* - * Get the type string length and round it - * up so that the data that follows is - * aligned for easy access. - */ - size_t typs = strlen((char *) typeref[2]) + 1; - typs = roundup(typs, sizeof(uintptr_t)); - - /* - *Get the size from the typeref using the - * number of elements and the type size. - */ - size = typeref[1] * typeref[3]; - - /* - * Check if the size exceeds the allocated - * buffer size. - */ - if (size + typs + 2 * sizeof(uintptr_t) > dp->dtdo_rtype.dtdt_size) { - /* Flag a drop! */ - *flags |= CPU_DTRACE_DROP; - - } - - /* Store the size in the buffer first. */ - DTRACE_STORE(uintptr_t, tomax, - valoffs, size); - valoffs += sizeof(uintptr_t); - - /* Store the type size in the buffer. */ - DTRACE_STORE(uintptr_t, tomax, - valoffs, typeref[3]); - valoffs += sizeof(uintptr_t); - - val = typeref[2]; - - for (s = 0; s < typs; s++) { - if (c != '\0') - c = dtrace_load8(val++); - - DTRACE_STORE(uint8_t, tomax, - valoffs++, c); - } - - /* - * Reset to the memory address rather than - * the typeref array, then let the BYREF - * code below do the work to store the - * memory data in the buffer. - */ - val = typeref[0]; - break; - } - case DTRACEACT_CHILL: if (dtrace_priv_kernel_destructive(state)) dtrace_action_chill(&mstate, val); @@ -10342,12 +10266,12 @@ dtrace_difo_validate_helper(dtrace_difo_ subr == DIF_SUBR_NTOHS || subr == DIF_SUBR_NTOHL || subr == DIF_SUBR_NTOHLL || - subr == DIF_SUBR_MEMREF || -#ifndef illumos - subr == DIF_SUBR_MEMSTR || -#endif - subr == DIF_SUBR_TYPEREF) + subr == DIF_SUBR_MEMREF) break; +#ifdef __FreeBSD__ + if (subr == DIF_SUBR_MEMSTR) + break; +#endif err += efunc(pc, "invalid subr %u\n", subr); break; @@ -11647,10 +11571,6 @@ dtrace_ecb_action_add(dtrace_ecb_t *ecb, size = dp->dtdo_rtype.dtdt_size; break; - case DTRACEACT_PRINTT: - size = dp->dtdo_rtype.dtdt_size; - break; - case DTRACEACT_COMMIT: { dtrace_action_t *act = ecb->dte_action; Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Sat Nov 12 19:05:41 2016 (r308581) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Sat Nov 12 19:26:12 2016 (r308582) @@ -308,7 +308,7 @@ typedef enum dtrace_probespec { #define DIF_SUBR_TOUPPER 44 #define DIF_SUBR_TOLOWER 45 #define DIF_SUBR_MEMREF 46 -#define DIF_SUBR_TYPEREF 47 +#define DIF_SUBR_UNUSED 47 #define DIF_SUBR_SX_SHARED_HELD 48 #define DIF_SUBR_SX_EXCLUSIVE_HELD 49 #define DIF_SUBR_SX_ISEXCLUSIVE 50 @@ -429,7 +429,6 @@ typedef struct dtrace_difv { #define DTRACEACT_TRACEMEM 6 /* tracemem() action */ #define DTRACEACT_TRACEMEM_DYNSIZE 7 /* dynamic tracemem() size */ #define DTRACEACT_PRINTM 8 /* printm() action (BSD) */ -#define DTRACEACT_PRINTT 9 /* printt() action (BSD) */ #define DTRACEACT_PROC 0x0100 #define DTRACEACT_USTACK (DTRACEACT_PROC + 1) From owner-svn-src-all@freebsd.org Sat Nov 12 19:45:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9002C3E1B3; Sat, 12 Nov 2016 19:45:56 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 792CE1891; Sat, 12 Nov 2016 19:45:56 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACJjtEO086737; Sat, 12 Nov 2016 19:45:55 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACJjtb0086736; Sat, 12 Nov 2016 19:45:55 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <201611121945.uACJjtb0086736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Sat, 12 Nov 2016 19:45:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308583 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 19:45:56 -0000 Author: bcr (doc committer) Date: Sat Nov 12 19:45:55 2016 New Revision: 308583 URL: https://svnweb.freebsd.org/changeset/base/308583 Log: Fix a broken link to the USB audio class specs. PR: 214240 Submitted by: Tobias Kortkamp t@tobik.me MFC after: 5 days Modified: head/share/man/man4/snd_uaudio.4 Modified: head/share/man/man4/snd_uaudio.4 ============================================================================== --- head/share/man/man4/snd_uaudio.4 Sat Nov 12 19:26:12 2016 (r308582) +++ head/share/man/man4/snd_uaudio.4 Sat Nov 12 19:45:55 2016 (r308583) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 19, 2015 +.Dd November 12, 2016 .Dt SND_UAUDIO 4 .Os .Sh NAME @@ -73,7 +73,7 @@ for more information. .Xr usb 4 .Rs .%T "USB Audio Class Specifications" -.%U http://www.usb.org/developers/devclass_docs/ +.%U http://www.usb.org/developers/docs/devclass_docs/ .Re .Sh HISTORY The From owner-svn-src-all@freebsd.org Sat Nov 12 20:45:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B0C8C3D2CA; Sat, 12 Nov 2016 20:45:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C42AA199A; Sat, 12 Nov 2016 20:45:05 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACKj5Bt011163; Sat, 12 Nov 2016 20:45:05 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACKj3Sk011148; Sat, 12 Nov 2016 20:45:03 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201611122045.uACKj3Sk011148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 12 Nov 2016 20:45:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308584 - in head/sys: boot/fdt/dts/powerpc dev/dpaa powerpc/conf/dpaa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 20:45:06 -0000 Author: jhibbits Date: Sat Nov 12 20:45:03 2016 New Revision: 308584 URL: https://svnweb.freebsd.org/changeset/base/308584 Log: Make dpaa work with only slightly modified Linux device trees. Linux has a slightly different device tree definition for DPAA than originally done in the FreeBSD driver. This changes the driver to be mostly compatible with the Linux device tree definitions. Currently the differences are: bman-portals: compatible = "fsl,bman-portals" (Linux is "simple-bus") qman-portals: compatible = "fsl,qman-portals" (Linux is "simple-bus") fman: compatible = "fsl,fman" (Linux is "simple-bus") The Linux device tree doesn't specify anything for rgmii in the mdio. This change still requires the device tree to specify the phy-handle, and doesn't yet support tbi. Deleted: head/sys/dev/dpaa/dpaa.c Modified: head/sys/boot/fdt/dts/powerpc/p2041rdb.dts head/sys/boot/fdt/dts/powerpc/p2041si.dtsi head/sys/boot/fdt/dts/powerpc/p3041ds.dts head/sys/boot/fdt/dts/powerpc/p3041si.dtsi head/sys/boot/fdt/dts/powerpc/p5020ds.dts head/sys/boot/fdt/dts/powerpc/p5020si.dtsi head/sys/dev/dpaa/bman_fdt.c head/sys/dev/dpaa/fman.c head/sys/dev/dpaa/fman.h head/sys/dev/dpaa/if_dtsec.c head/sys/dev/dpaa/if_dtsec_fdt.c head/sys/dev/dpaa/if_dtsec_rm.c head/sys/dev/dpaa/qman_fdt.c head/sys/powerpc/conf/dpaa/files.dpaa Modified: head/sys/boot/fdt/dts/powerpc/p2041rdb.dts ============================================================================== --- head/sys/boot/fdt/dts/powerpc/p2041rdb.dts Sat Nov 12 19:45:55 2016 (r308583) +++ head/sys/boot/fdt/dts/powerpc/p2041rdb.dts Sat Nov 12 20:45:03 2016 (r308584) @@ -442,47 +442,6 @@ }; }; - fsl,dpaa { - compatible = "fsl,p2041-dpaa", "fsl,dpaa"; - - ethernet@0 { - compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet0>; - status = "okay"; - }; - ethernet@1 { - compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet1>; - status = "okay"; - }; - ethernet@2 { - compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet2>; - status = "okay"; - }; - ethernet@3 { - compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet3>; - status = "okay"; - }; - ethernet@4 { - compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet4>; - status = "okay"; - }; - ethernet@5 { - compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet5>; - status = "okay"; - }; - }; - chosen { stdin = "serial0"; stdout = "serial0"; Modified: head/sys/boot/fdt/dts/powerpc/p2041si.dtsi ============================================================================== --- head/sys/boot/fdt/dts/powerpc/p2041si.dtsi Sat Nov 12 19:45:55 2016 (r308583) +++ head/sys/boot/fdt/dts/powerpc/p2041si.dtsi Sat Nov 12 20:45:03 2016 (r308584) @@ -208,7 +208,7 @@ bman-portals@ff4000000 { #address-cells = <0x1>; #size-cells = <0x1>; - compatible = "bman-portals"; + compatible = "fsl,bman-portals"; ranges = <0x0 0xf 0xfde00000 0x200000>; bman-portal@0 { cell-index = <0x0>; @@ -281,7 +281,7 @@ qman-portals@ff4200000 { #address-cells = <0x1>; #size-cells = <0x1>; - compatible = "qman-portals"; + compatible = "fsl,qman-portals"; ranges = <0x0 0xf 0xfdc00000 0x200000>; qportal0: qman-portal@0 { cell-index = <0x0>; @@ -913,8 +913,8 @@ pme: pme@316000 { compatible = "fsl,pme"; reg = <0x316000 0x10000>; - /* fsl,pme-pdsr = <0x0 0x23000000 0x0 0x01000000>; */ - /* fsl,pme-sre = <0x0 0x24000000 0x0 0x00a00000>; */ + /* "fsl,pme-pdsr = <0x0 0x23000000 0x0 0x01000000>; */ + /* "fsl,pme-sre = <0x0 0x24000000 0x0 0x00a00000>; */ interrupts = <16 2 1 5>; }; @@ -923,16 +923,16 @@ reg = <0x318000 0x1000>; interrupts = <16 2 1 3>; /* Commented out, use default allocation */ - /* fsl,qman-fqd = <0x0 0x20000000 0x0 0x01000000>; */ - /* fsl,qman-pfdr = <0x0 0x21000000 0x0 0x01000000>; */ + /* "fsl,qman-fqd = <0x0 0x20000000 0x0 0x01000000>; */ + /* "fsl,qman-pfdr = <0x0 0x21000000 0x0 0x01000000>; */ }; bman: bman@31a000 { compatible = "fsl,p2041-bman", "fsl,bman"; reg = <0x31a000 0x1000>; interrupts = <16 2 1 2>; - /* Same as fsl,qman-*, use default allocation */ - /* fsl,bman-fbpr = <0x0 0x22000000 0x0 0x01000000>; */ + /* Same as "fsl,qman-*, use default allocation */ + /* "fsl,bman-fbpr = <0x0 0x22000000 0x0 0x01000000>; */ }; fman0: fman@400000 { @@ -983,27 +983,27 @@ fman0_rx0: port@88000 { cell-index = <0>; - compatible = "fsl,p2041-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p2041-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x88000 0x1000>; }; fman0_rx1: port@89000 { cell-index = <1>; - compatible = "fsl,p2041-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p2041-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x89000 0x1000>; }; fman0_rx2: port@8a000 { cell-index = <2>; - compatible = "fsl,p2041-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p2041-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x8a000 0x1000>; }; fman0_rx3: port@8b000 { cell-index = <3>; - compatible = "fsl,p2041-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p2041-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x8b000 0x1000>; }; fman0_rx4: port@8c000 { cell-index = <4>; - compatible = "fsl,p2041-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p2041-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x8c000 0x1000>; }; fman0_rx5: port@90000 { @@ -1020,31 +1020,31 @@ }; fman0_tx0: port@a8000 { cell-index = <0>; - compatible = "fsl,p2041-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p2041-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xa8000 0x1000>; fsl,qman-channel-id = <0x41>; }; fman0_tx1: port@a9000 { cell-index = <1>; - compatible = "fsl,p2041-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p2041-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xa9000 0x1000>; fsl,qman-channel-id = <0x42>; }; fman0_tx2: port@aa000 { cell-index = <2>; - compatible = "fsl,p2041-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p2041-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xaa000 0x1000>; fsl,qman-channel-id = <0x43>; }; fman0_tx3: port@ab000 { cell-index = <3>; - compatible = "fsl,p2041-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p2041-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xab000 0x1000>; fsl,qman-channel-id = <0x44>; }; fman0_tx4: port@ac000 { cell-index = <4>; - compatible = "fsl,p2041-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p2041-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xac000 0x1000>; fsl,qman-channel-id = <0x45>; }; @@ -1093,7 +1093,7 @@ enet0: ethernet@e0000 { cell-index = <0>; - compatible = "fsl,p2041-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p2041-fman-1g-mac", "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe0000 0x1000>; fsl,port-handles = <&fman0_rx0 &fman0_tx0>; }; @@ -1108,7 +1108,7 @@ enet1: ethernet@e2000 { cell-index = <1>; - compatible = "fsl,p2041-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p2041-fman-1g-mac", "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe2000 0x1000>; fsl,port-handles = <&fman0_rx1 &fman0_tx1>; }; @@ -1123,7 +1123,7 @@ enet2: ethernet@e4000 { cell-index = <2>; - compatible = "fsl,p2041-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p2041-fman-1g-mac", "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe4000 0x1000>; fsl,port-handles = <&fman0_rx2 &fman0_tx2>; }; @@ -1138,7 +1138,7 @@ enet3: ethernet@e6000 { cell-index = <3>; - compatible = "fsl,p2041-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p2041-fman-1g-mac", "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe6000 0x1000>; fsl,port-handles = <&fman0_rx3 &fman0_tx3>; }; @@ -1153,7 +1153,7 @@ enet4: ethernet@e8000 { cell-index = <4>; - compatible = "fsl,p2041-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p2041-fman-1g-mac", "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe8000 0x1000>; fsl,port-handles = <&fman0_rx4 &fman0_tx4>; }; @@ -1168,7 +1168,7 @@ enet5: ethernet@f0000 { cell-index = <0>; - compatible = "fsl,p2041-fman-10g-mac", "fsl,fman-10g-mac"; + compatible = "fsl,p2041-fman-10g-mac", "fsl,fman-10g-mac", "fsl,fman-xgec"; reg = <0xf0000 0x1000>; fsl,port-handles = <&fman0_rx5 &fman0_tx5>; }; Modified: head/sys/boot/fdt/dts/powerpc/p3041ds.dts ============================================================================== --- head/sys/boot/fdt/dts/powerpc/p3041ds.dts Sat Nov 12 19:45:55 2016 (r308583) +++ head/sys/boot/fdt/dts/powerpc/p3041ds.dts Sat Nov 12 20:45:03 2016 (r308584) @@ -539,47 +539,6 @@ }; }; - fsl,dpaa { - compatible = "fsl,p3041-dpaa", "fsl,dpaa"; - - ethernet@0 { - compatible = "fsl,p3041-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet0>; - status="okay"; - }; - ethernet@1 { - compatible = "fsl,p3041-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet1>; - status = "disabled"; - }; - ethernet@2 { - compatible = "fsl,p3041-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet2>; - status = "disabled"; - }; - ethernet@3 { - compatible = "fsl,p3041-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet3>; - status = "disabled"; - }; - ethernet@4 { - compatible = "fsl,p3041-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet4>; - status = "okay"; - }; - ethernet@5 { - compatible = "fsl,p3041-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet5>; - status = "disabled"; - }; - }; - chosen { stdin = "serial0"; stdout = "serial0"; Modified: head/sys/boot/fdt/dts/powerpc/p3041si.dtsi ============================================================================== --- head/sys/boot/fdt/dts/powerpc/p3041si.dtsi Sat Nov 12 19:45:55 2016 (r308583) +++ head/sys/boot/fdt/dts/powerpc/p3041si.dtsi Sat Nov 12 20:45:03 2016 (r308584) @@ -209,7 +209,7 @@ bman-portals@ff4000000 { #address-cells = <0x1>; #size-cells = <0x1>; - compatible = "bman-portals"; + compatible = "fsl,bman-portals"; ranges = <0x0 0xf 0xfde00000 0x200000>; bman-portal@0 { cell-index = <0x0>; @@ -282,7 +282,7 @@ qman-portals@ff4200000 { #address-cells = <0x1>; #size-cells = <0x1>; - compatible = "qman-portals"; + compatible = "fsl,qman-portals"; ranges = <0x0 0xf 0xfdc00000 0x200000>; qportal0: qman-portal@0 { cell-index = <0x0>; @@ -915,8 +915,8 @@ pme: pme@316000 { compatible = "fsl,pme"; reg = <0x316000 0x10000>; - /* fsl,pme-pdsr = <0x0 0x23000000 0x0 0x01000000>; */ - /* fsl,pme-sre = <0x0 0x24000000 0x0 0x00a00000>; */ + /* "fsl,pme-pdsr = <0x0 0x23000000 0x0 0x01000000>; */ + /* "fsl,pme-sre = <0x0 0x24000000 0x0 0x00a00000>; */ interrupts = <16 2 1 5>; }; @@ -925,16 +925,16 @@ reg = <0x318000 0x1000>; interrupts = <16 2 1 3>; /* Commented out, use default allocation */ - /* fsl,qman-fqd = <0x0 0x20000000 0x0 0x01000000>; */ - /* fsl,qman-pfdr = <0x0 0x21000000 0x0 0x01000000>; */ + /* "fsl,qman-fqd = <0x0 0x20000000 0x0 0x01000000>; */ + /* "fsl,qman-pfdr = <0x0 0x21000000 0x0 0x01000000>; */ }; bman: bman@31a000 { compatible = "fsl,p3041-bman", "fsl,bman"; reg = <0x31a000 0x1000>; interrupts = <16 2 1 2>; - /* Same as fsl,qman-*, use default allocation */ - /* fsl,bman-fbpr = <0x0 0x22000000 0x0 0x01000000>; */ + /* Same as "fsl,qman-*, use default allocation */ + /* "fsl,bman-fbpr = <0x0 0x22000000 0x0 0x01000000>; */ }; fman0: fman@400000 { @@ -985,27 +985,27 @@ fman0_rx0: port@88000 { cell-index = <0>; - compatible = "fsl,p3041-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p3041-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x88000 0x1000>; }; fman0_rx1: port@89000 { cell-index = <1>; - compatible = "fsl,p3041-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p3041-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x89000 0x1000>; }; fman0_rx2: port@8a000 { cell-index = <2>; - compatible = "fsl,p3041-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p3041-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x8a000 0x1000>; }; fman0_rx3: port@8b000 { cell-index = <3>; - compatible = "fsl,p3041-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p3041-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x8b000 0x1000>; }; fman0_rx4: port@8c000 { cell-index = <4>; - compatible = "fsl,p3041-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p3041-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x8c000 0x1000>; }; fman0_rx5: port@90000 { @@ -1022,31 +1022,31 @@ }; fman0_tx0: port@a8000 { cell-index = <0>; - compatible = "fsl,p3041-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p3041-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xa8000 0x1000>; fsl,qman-channel-id = <0x41>; }; fman0_tx1: port@a9000 { cell-index = <1>; - compatible = "fsl,p3041-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p3041-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xa9000 0x1000>; fsl,qman-channel-id = <0x42>; }; fman0_tx2: port@aa000 { cell-index = <2>; - compatible = "fsl,p3041-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p3041-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xaa000 0x1000>; fsl,qman-channel-id = <0x43>; }; fman0_tx3: port@ab000 { cell-index = <3>; - compatible = "fsl,p3041-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p3041-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xab000 0x1000>; fsl,qman-channel-id = <0x44>; }; fman0_tx4: port@ac000 { cell-index = <4>; - compatible = "fsl,p3041-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p3041-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xac000 0x1000>; fsl,qman-channel-id = <0x45>; }; @@ -1095,7 +1095,8 @@ enet0: ethernet@e0000 { cell-index = <0>; - compatible = "fsl,p3041-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p3041-fman-1g-mac", + "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe0000 0x1000>; fsl,port-handles = <&fman0_rx0 &fman0_tx0>; ptimer-handle = <&ptp_timer0>; @@ -1111,7 +1112,8 @@ enet1: ethernet@e2000 { cell-index = <1>; - compatible = "fsl,p3041-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p3041-fman-1g-mac", + "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe2000 0x1000>; fsl,port-handles = <&fman0_rx1 &fman0_tx1>; ptimer-handle = <&ptp_timer0>; @@ -1127,7 +1129,8 @@ enet2: ethernet@e4000 { cell-index = <2>; - compatible = "fsl,p3041-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p3041-fman-1g-mac", + "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe4000 0x1000>; fsl,port-handles = <&fman0_rx2 &fman0_tx2>; ptimer-handle = <&ptp_timer0>; @@ -1143,7 +1146,8 @@ enet3: ethernet@e6000 { cell-index = <3>; - compatible = "fsl,p3041-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p3041-fman-1g-mac", + "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe6000 0x1000>; fsl,port-handles = <&fman0_rx3 &fman0_tx3>; }; @@ -1158,7 +1162,8 @@ enet4: ethernet@e8000 { cell-index = <4>; - compatible = "fsl,p3041-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p3041-fman-1g-mac", + "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe8000 0x1000>; fsl,port-handles = <&fman0_rx4 &fman0_tx4>; ptimer-handle = <&ptp_timer0>; @@ -1174,7 +1179,8 @@ enet5: ethernet@f0000 { cell-index = <0>; - compatible = "fsl,p3041-fman-10g-mac", "fsl,fman-10g-mac"; + compatible = "fsl,p3041-fman-10g-mac", + "fsl,fman-10g-mac", "fsl,fman-xgec"; reg = <0xf0000 0x1000>; fsl,port-handles = <&fman0_rx5 &fman0_tx5>; }; Modified: head/sys/boot/fdt/dts/powerpc/p5020ds.dts ============================================================================== --- head/sys/boot/fdt/dts/powerpc/p5020ds.dts Sat Nov 12 19:45:55 2016 (r308583) +++ head/sys/boot/fdt/dts/powerpc/p5020ds.dts Sat Nov 12 20:45:03 2016 (r308584) @@ -535,47 +535,6 @@ }; }; - fsl,dpaa { - compatible = "fsl,p5020-dpaa", "fsl,dpaa"; - - ethernet@0 { - compatible = "fsl,p5020-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet0>; - status = "okay"; - }; - ethernet@1 { - compatible = "fsl,p5020-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet1>; - status = "disabled"; - }; - ethernet@2 { - compatible = "fsl,p5020-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet2>; - status = "disabled"; - }; - ethernet@3 { - compatible = "fsl,p5020-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet3>; - status = "disabled"; - }; - ethernet@4 { - compatible = "fsl,p5020-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet4>; - status = "okay"; - }; - ethernet@5 { - compatible = "fsl,p5020-dpa-ethernet", "fsl,dpa-ethernet"; - fsl,qman-channel = <&qpool1>; - fsl,fman-mac = <&enet5>; - status = "disabled"; - }; - }; - chosen { stdin = "serial0"; stdout = "serial0"; Modified: head/sys/boot/fdt/dts/powerpc/p5020si.dtsi ============================================================================== --- head/sys/boot/fdt/dts/powerpc/p5020si.dtsi Sat Nov 12 19:45:55 2016 (r308583) +++ head/sys/boot/fdt/dts/powerpc/p5020si.dtsi Sat Nov 12 20:45:03 2016 (r308584) @@ -194,7 +194,7 @@ bman-portals@ff4000000 { #address-cells = <0x1>; #size-cells = <0x1>; - compatible = "bman-portals"; + compatible = "fsl,bman-portals"; ranges = <0x0 0xf 0xfde00000 0x200000>; bman-portal@0 { cell-index = <0x0>; @@ -267,7 +267,7 @@ qman-portals@ff4200000 { #address-cells = <0x1>; #size-cells = <0x1>; - compatible = "qman-portals"; + compatible = "fsl,qman-portals"; ranges = <0x0 0xf 0xfdc00000 0x200000>; qportal0: qman-portal@0 { cell-index = <0x0>; @@ -960,8 +960,8 @@ pme: pme@316000 { compatible = "fsl,pme"; reg = <0x316000 0x10000>; - /* fsl,pme-pdsr = <0x0 0x23000000 0x0 0x01000000>; */ - /* fsl,pme-sre = <0x0 0x24000000 0x0 0x00a00000>; */ + /* "fsl,pme-pdsr = <0x0 0x23000000 0x0 0x01000000>; */ + /* "fsl,pme-sre = <0x0 0x24000000 0x0 0x00a00000>; */ interrupts = <16 2 1 5>; }; @@ -970,16 +970,16 @@ reg = <0x318000 0x1000>; interrupts = <16 2 1 3>; /* Commented out, use default allocation */ - /* fsl,qman-fqd = <0x0 0x20000000 0x0 0x01000000>; */ - /* fsl,qman-pfdr = <0x0 0x21000000 0x0 0x01000000>; */ + /* "fsl,qman-fqd = <0x0 0x20000000 0x0 0x01000000>; */ + /* "fsl,qman-pfdr = <0x0 0x21000000 0x0 0x01000000>; */ }; bman: bman@31a000 { compatible = "fsl,p5020-bman", "fsl,bman"; reg = <0x31a000 0x1000>; interrupts = <16 2 1 2>; - /* Same as fsl,qman-*, use default allocation */ - /* fsl,bman-fbpr = <0x0 0x22000000 0x0 0x01000000>; */ + /* Same as "fsl,qman-*, use default allocation */ + /* "fsl,bman-fbpr = <0x0 0x22000000 0x0 0x01000000>; */ }; fman0: fman@400000 { @@ -1030,27 +1030,27 @@ fman0_rx0: port@88000 { cell-index = <0>; - compatible = "fsl,p5020-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p5020-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x88000 0x1000>; }; fman0_rx1: port@89000 { cell-index = <1>; - compatible = "fsl,p5020-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p5020-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x89000 0x1000>; }; fman0_rx2: port@8a000 { cell-index = <2>; - compatible = "fsl,p5020-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p5020-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x8a000 0x1000>; }; fman0_rx3: port@8b000 { cell-index = <3>; - compatible = "fsl,p5020-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p5020-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x8b000 0x1000>; }; fman0_rx4: port@8c000 { cell-index = <4>; - compatible = "fsl,p5020-fman-port-1g-rx", "fsl,fman-port-1g-rx"; + compatible = "fsl,p5020-fman-port-1g-rx", "fsl,fman-port-1g-rx", "fsl,fman-v2-port-rx"; reg = <0x8c000 0x1000>; }; fman0_rx5: port@90000 { @@ -1067,31 +1067,31 @@ }; fman0_tx0: port@a8000 { cell-index = <0>; - compatible = "fsl,p5020-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p5020-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xa8000 0x1000>; fsl,qman-channel-id = <0x41>; }; fman0_tx1: port@a9000 { cell-index = <1>; - compatible = "fsl,p5020-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p5020-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xa9000 0x1000>; fsl,qman-channel-id = <0x42>; }; fman0_tx2: port@aa000 { cell-index = <2>; - compatible = "fsl,p5020-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p5020-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xaa000 0x1000>; fsl,qman-channel-id = <0x43>; }; fman0_tx3: port@ab000 { cell-index = <3>; - compatible = "fsl,p5020-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p5020-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xab000 0x1000>; fsl,qman-channel-id = <0x44>; }; fman0_tx4: port@ac000 { cell-index = <4>; - compatible = "fsl,p5020-fman-port-1g-tx", "fsl,fman-port-1g-tx"; + compatible = "fsl,p5020-fman-port-1g-tx", "fsl,fman-port-1g-tx", "fsl,fman-v2-port-tx"; reg = <0xac000 0x1000>; fsl,qman-channel-id = <0x45>; }; @@ -1140,7 +1140,7 @@ enet0: ethernet@e0000 { cell-index = <0>; - compatible = "fsl,p5020-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p5020-fman-1g-mac", "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe0000 0x1000>; fsl,port-handles = <&fman0_rx0 &fman0_tx0>; ptimer-handle = <&ptp_timer0>; @@ -1156,7 +1156,7 @@ enet1: ethernet@e2000 { cell-index = <1>; - compatible = "fsl,p5020-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p5020-fman-1g-mac", "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe2000 0x1000>; fsl,port-handles = <&fman0_rx1 &fman0_tx1>; ptimer-handle = <&ptp_timer0>; @@ -1172,7 +1172,7 @@ enet2: ethernet@e4000 { cell-index = <2>; - compatible = "fsl,p5020-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p5020-fman-1g-mac", "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe4000 0x1000>; fsl,port-handles = <&fman0_rx2 &fman0_tx2>; ptimer-handle = <&ptp_timer0>; @@ -1188,7 +1188,7 @@ enet3: ethernet@e6000 { cell-index = <3>; - compatible = "fsl,p5020-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p5020-fman-1g-mac", "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe6000 0x1000>; fsl,port-handles = <&fman0_rx3 &fman0_tx3>; ptimer-handle = <&ptp_timer0>; @@ -1204,7 +1204,7 @@ enet4: ethernet@e8000 { cell-index = <4>; - compatible = "fsl,p5020-fman-1g-mac", "fsl,fman-1g-mac"; + compatible = "fsl,p5020-fman-1g-mac", "fsl,fman-1g-mac", "fsl,fman-dtsec"; reg = <0xe8000 0x1000>; fsl,port-handles = <&fman0_rx4 &fman0_tx4>; ptimer-handle = <&ptp_timer0>; @@ -1220,7 +1220,7 @@ enet5: ethernet@f0000 { cell-index = <0>; - compatible = "fsl,p5020-fman-10g-mac", "fsl,fman-10g-mac"; + compatible = "fsl,p5020-fman-10g-mac", "fsl,fman-10g-mac", "fsl,fman-xgec"; reg = <0xf0000 0x1000>; fsl,port-handles = <&fman0_rx5 &fman0_tx5>; }; Modified: head/sys/dev/dpaa/bman_fdt.c ============================================================================== --- head/sys/dev/dpaa/bman_fdt.c Sat Nov 12 19:45:55 2016 (r308583) +++ head/sys/dev/dpaa/bman_fdt.c Sat Nov 12 20:45:03 2016 (r308584) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -105,7 +106,8 @@ static driver_t bm_portals_driver = { }; static devclass_t bm_portals_devclass; -DRIVER_MODULE(bman_portals, ofwbus, bm_portals_driver, bm_portals_devclass, 0, 0); +EARLY_DRIVER_MODULE(bman_portals, ofwbus, bm_portals_driver, + bm_portals_devclass, 0, 0, BUS_PASS_BUS); static void get_addr_props(phandle_t node, uint32_t *addrp, uint32_t *sizep) @@ -121,7 +123,7 @@ static int bman_portals_fdt_probe(device_t dev) { - if (!ofw_bus_is_compatible(dev, "bman-portals")) + if (!ofw_bus_is_compatible(dev, "fsl,bman-portals")) return (ENXIO); device_set_desc(dev, BMAN_PORT_DEVSTR); @@ -129,6 +131,25 @@ bman_portals_fdt_probe(device_t dev) return (BUS_PROBE_DEFAULT); } +static phandle_t +bman_portal_find_cpu(int cpu) +{ + phandle_t node; + pcell_t reg; + + node = OF_finddevice("/cpus"); + if (node == -1) + return (node); + + for (node = OF_child(node); node != 0; node = OF_peer(node)) { + if (OF_getprop(node, "reg", ®, sizeof(reg)) <= 0) + continue; + if (reg == cpu) + return (node); + } + return (-1); +} + static int bman_portals_fdt_attach(device_t dev) { @@ -152,13 +173,17 @@ bman_portals_fdt_attach(device_t dev) /* Find portals tied to CPUs */ for (child = OF_child(node); child != 0; child = OF_peer(child)) { + if (cpus >= mp_ncpus) + break; if (!ofw_bus_node_is_compatible(child, "fsl,bman-portal")) { continue; } /* Checkout related cpu */ if (OF_getprop(child, "cpu-handle", (void *)&cpu, sizeof(cpu)) <= 0) { - continue; + cpu = bman_portal_find_cpu(cpus); + if (cpu <= 0) + continue; } /* Acquire cpu number */ cpu_node = OF_instance_to_package(cpu); @@ -169,9 +194,6 @@ bman_portals_fdt_attach(device_t dev) cpus++; - if (cpus > MAXCPU) - break; - if (ofw_bus_gen_setup_devinfo(&ofw_di, child) != 0) { device_printf(dev, "could not set up devinfo\n"); continue; Modified: head/sys/dev/dpaa/fman.c ============================================================================== --- head/sys/dev/dpaa/fman.c Sat Nov 12 19:45:55 2016 (r308583) +++ head/sys/dev/dpaa/fman.c Sat Nov 12 20:45:03 2016 (r308584) @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -50,6 +49,8 @@ __FBSDID("$FreeBSD$"); #include "fman.h" +static MALLOC_DEFINE(M_FMAN, "fman", "fman devices information"); + /** * @group FMan private defines. * @{ @@ -259,6 +260,8 @@ fman_attach(device_t dev) { struct fman_softc *sc; struct fman_config cfg; + pcell_t qchan_range[2]; + phandle_t node; sc = device_get_softc(dev); sc->sc_base.dev = dev; @@ -272,6 +275,14 @@ fman_attach(device_t dev) XX_TrackInit(); + node = ofw_bus_get_node(dev); + if (OF_getencprop(node, "fsl,qman-channel-range", qchan_range, + sizeof(qchan_range)) <= 0) { + device_printf(dev, "Missing QMan channel range property!\n"); + return (ENXIO); + } + sc->qman_chan_base = qchan_range[0]; + sc->qman_chan_count = qchan_range[1]; sc->mem_rid = 0; sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid, RF_ACTIVE | RF_SHAREABLE); @@ -379,4 +390,21 @@ fman_shutdown(device_t dev) return (0); } +int +fman_qman_channel_id(device_t dev, int port) +{ + struct fman_softc *sc; + int qman_port_id[] = {0x31, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, + 0x2f, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; + int i; + + sc = device_get_softc(dev); + for (i = 0; i < sc->qman_chan_count; i++) { + if (qman_port_id[i] == port) + return (sc->qman_chan_base + i); + } + + return (0); +} + /** @} */ Modified: head/sys/dev/dpaa/fman.h ============================================================================== --- head/sys/dev/dpaa/fman.h Sat Nov 12 19:45:55 2016 (r308583) +++ head/sys/dev/dpaa/fman.h Sat Nov 12 20:45:03 2016 (r308584) @@ -42,6 +42,8 @@ struct fman_softc { int mem_rid; int irq_rid; int err_irq_rid; + int qman_chan_base; + int qman_chan_count; t_Handle fm_handle; t_Handle muram_handle; @@ -59,6 +61,7 @@ int fman_resume(device_t dev); int fman_shutdown(device_t dev); int fman_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); +int fman_qman_channel_id(device_t, int); /** @} */ uint32_t fman_get_clock(struct fman_softc *sc); Modified: head/sys/dev/dpaa/if_dtsec.c ============================================================================== --- head/sys/dev/dpaa/if_dtsec.c Sat Nov 12 19:45:55 2016 (r308583) +++ head/sys/dev/dpaa/if_dtsec.c Sat Nov 12 20:45:03 2016 (r308584) @@ -49,8 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include #include #include Modified: head/sys/dev/dpaa/if_dtsec_fdt.c ============================================================================== --- head/sys/dev/dpaa/if_dtsec_fdt.c Sat Nov 12 19:45:55 2016 (r308583) +++ head/sys/dev/dpaa/if_dtsec_fdt.c Sat Nov 12 20:45:03 2016 (r308584) @@ -87,7 +87,7 @@ static driver_t dtsec_driver = { }; static devclass_t dtsec_devclass; -DRIVER_MODULE(dtsec, dpaa, dtsec_driver, dtsec_devclass, 0, 0); +DRIVER_MODULE(dtsec, fman, dtsec_driver, dtsec_devclass, 0, 0); DRIVER_MODULE(miibus, dtsec, miibus_driver, miibus_devclass, 0, 0); MODULE_DEPEND(dtsec, ether, 1, 1, 1); MODULE_DEPEND(dtsec, miibus, 1, 1, 1); @@ -96,7 +96,8 @@ static int dtsec_fdt_probe(device_t dev) { - if (!ofw_bus_is_compatible(dev, "fsl,dpa-ethernet")) + if (!ofw_bus_is_compatible(dev, "fsl,fman-dtsec") && + !ofw_bus_is_compatible(dev, "fsl,fman-xgec")) return (ENXIO); device_set_desc(dev, "Freescale Data Path Triple Speed Ethernet " @@ -119,9 +120,7 @@ find_mdio(phandle_t phy_node, device_t m if (phy_node <= 0) return (ENOENT); - if (fman_get_dev(&bus) < 0) - return (ENOENT); - + bus = device_get_parent(mac); *mdio_dev = ofw_bus_find_child_device_by_phandle(bus, phy_node); return (0); @@ -131,21 +130,13 @@ static int dtsec_fdt_attach(device_t dev) { struct dtsec_softc *sc; - phandle_t node, enet_node, phy_node; + phandle_t enet_node, phy_node; phandle_t fman_rxtx_node[2]; char phy_type[6]; + pcell_t fman_tx_cell; sc = device_get_softc(dev); - node = ofw_bus_get_node(dev); - - if (OF_getprop(node, "fsl,fman-mac", (void *)&enet_node, - sizeof(enet_node)) == -1) { - device_printf(dev, "Could not load fsl,fman-mac property " - "from DTS\n"); - return (ENXIO); - } - - enet_node = OF_instance_to_package(enet_node); + enet_node = ofw_bus_get_node(dev); if (OF_getprop(enet_node, "local-mac-address", (void *)sc->sc_mac_addr, 6) == -1) { @@ -155,9 +146,9 @@ dtsec_fdt_attach(device_t dev) } /* Get link speed */ - if (ofw_bus_node_is_compatible(enet_node, "fsl,fman-1g-mac") != 0) + if (ofw_bus_is_compatible(dev, "fsl,fman-dtsec") != 0) sc->sc_eth_dev_type = ETH_DTSEC; - else if (ofw_bus_node_is_compatible(enet_node, "fsl,fman-10g-mac") != 0) + else if (ofw_bus_is_compatible(dev, "fsl,fman-xgec") != 0) sc->sc_eth_dev_type = ETH_10GSEC; else return(ENXIO); @@ -197,7 +188,7 @@ dtsec_fdt_attach(device_t dev) return (ENXIO); /* Get RX/TX port handles */ - if (OF_getprop(enet_node, "fsl,port-handles", (void *)fman_rxtx_node, + if (OF_getprop(enet_node, "fsl,fman-ports", (void *)fman_rxtx_node, sizeof(fman_rxtx_node)) <= 0) return (ENXIO); @@ -211,11 +202,11 @@ dtsec_fdt_attach(device_t dev) fman_rxtx_node[1] = OF_instance_to_package(fman_rxtx_node[1]); if (ofw_bus_node_is_compatible(fman_rxtx_node[0], - "fsl,fman-port-1g-rx") == 0) + "fsl,fman-v2-port-rx") == 0) return (ENXIO); if (ofw_bus_node_is_compatible(fman_rxtx_node[1], - "fsl,fman-port-1g-tx") == 0) + "fsl,fman-v2-port-tx") == 0) return (ENXIO); /* Get RX port HW id */ @@ -228,11 +219,12 @@ dtsec_fdt_attach(device_t dev) sizeof(sc->sc_port_tx_hw_id)) <= 0) return (ENXIO); - /* Get QMan channel */ - if (OF_getprop(fman_rxtx_node[1], "fsl,qman-channel-id", - (void *)&sc->sc_port_tx_qman_chan, - sizeof(sc->sc_port_tx_qman_chan)) <= 0) + if (OF_getprop(fman_rxtx_node[1], "cell-index", &fman_tx_cell, + sizeof(fman_tx_cell)) <= 0) return (ENXIO); + /* Get QMan channel */ + sc->sc_port_tx_qman_chan = fman_qman_channel_id(device_get_parent(dev), + fman_tx_cell); return (dtsec_attach(dev)); } Modified: head/sys/dev/dpaa/if_dtsec_rm.c ============================================================================== --- head/sys/dev/dpaa/if_dtsec_rm.c Sat Nov 12 19:45:55 2016 (r308583) +++ head/sys/dev/dpaa/if_dtsec_rm.c Sat Nov 12 20:45:03 2016 (r308584) @@ -323,6 +323,7 @@ dtsec_rm_pool_rx_init(struct dtsec_softc DTSEC_RM_POOL_RX_HIGH_MARK, 0, 0, dtsec_rm_pool_rx_depleted, sc, NULL, NULL); if (sc->sc_rx_pool == NULL) { + device_printf(sc->sc_dev, "NULL rx pool somehow\n"); dtsec_rm_pool_rx_free(sc); return (EIO); } Modified: head/sys/dev/dpaa/qman_fdt.c ============================================================================== --- head/sys/dev/dpaa/qman_fdt.c Sat Nov 12 19:45:55 2016 (r308583) +++ head/sys/dev/dpaa/qman_fdt.c Sat Nov 12 20:45:03 2016 (r308584) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -105,7 +106,8 @@ static driver_t qm_portals_driver = { }; static devclass_t qm_portals_devclass; -DRIVER_MODULE(qman_portals, ofwbus, qm_portals_driver, qm_portals_devclass, 0, 0); +EARLY_DRIVER_MODULE(qman_portals, ofwbus, qm_portals_driver, + qm_portals_devclass, 0, 0, BUS_PASS_BUS); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Nov 12 23:19:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58E5AC3D20D; Sat, 12 Nov 2016 23:19:15 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x242.google.com (mail-it0-x242.google.com [IPv6:2607:f8b0:4001:c0b::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0D577137A; Sat, 12 Nov 2016 23:19:15 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x242.google.com with SMTP id q124so4647112itd.1; Sat, 12 Nov 2016 15:19:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=togl0GepTOhWHt9ilkIHEOCvaE9N0xy0dgRHCW9586o=; b=Ne7aQQLV4kAIkQHCWn5KYtMKVHgZs9F0xuYQtfTmthESeffa4lpMkr/AADx8qIKct2 kKxqmEnr8hupkcenx6XQuetE/PZLkVmf95TAVUYk+5IiVsVKQeYxpW36Sd5FPcL2GRKa ER+29HJyNfxPJYYIbpZnEPG7clXVOrmCZi6YO+3Z0vlFgG2kpWY8UbUYNpdg9KVzybHs iCRMKIn2YotAO2DmIvlI8cgD3TTrtqOibjnhFhhph/D/XjJM5ve2ec2BeLbn2KcZud6w e+mq8sZQzbu7v41WzrgpE9i2Qcnf5B7bcjZwwLRl2ktoURoqoDGxyb7rwr79BQYdafmT sXTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=togl0GepTOhWHt9ilkIHEOCvaE9N0xy0dgRHCW9586o=; b=gR1DO+3r1qPDma4Ii84LlZ12yMbUcb+gu9gVk/Eyh+OA0XGjqhsAgnbbr4LOJ2aNS3 n8ZBAu8v0GhtZ7eaLMy1uIolGBbWN3c2uMNL+T9GP9kVCWKHsuWzISKgb3hSzoWPXsp+ RkghxQzfac1YVH587qjbJ6zMSVoCTrX9zLkrQF/kWVcsZLW0hfGePi2hQrUKRvOXVViu tnJMAWrJdCtcD3LFysepJRVbfUxIQiWr81yN2s5fGQMIxYTWUTTF1kBriQvpcBQw0n/4 sGHocGm/emXQun8gToJxNmt85POUBSUx8Q7rTCXyVyp+i7dRFph9JjbQ0Vul6SbJWVFm 1QlA== X-Gm-Message-State: ABUngveT8Enh2t0Kp2vFcoQgrl0+Chap0P19KqCZM4CWT30ZPfY0Or+x8EyHoXlsUUzKntkdPT99ByLO4tEryg== X-Received: by 10.107.174.157 with SMTP id n29mr14027616ioo.177.1478992753897; Sat, 12 Nov 2016 15:19:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.39.134 with HTTP; Sat, 12 Nov 2016 15:19:13 -0800 (PST) In-Reply-To: <201610191109.u9JB9TTC002727@repo.freebsd.org> References: <201610191109.u9JB9TTC002727@repo.freebsd.org> From: Adrian Chadd Date: Sat, 12 Nov 2016 15:19:13 -0800 Message-ID: Subject: Re: svn commit: r307626 - head/sys/ufs/ffs To: Konstantin Belousov , "freebsd-mips@freebsd.org" Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 23:19:15 -0000 hi! This broke freebsd on mips24k. BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x4002a4 got a read fault (type 0x2) at 0 Trapframe Register Dump: zero: 0 at: 0 v0: 0 v1: 0 a0: 0x7fffeecc a1: 0 a2: 0 a3: 0 t0: 0 t1: 0 t2: 0 t3: 0 t4: 0 t5: 0 t6: 0 t7: 0 t8: 0 t9: 0x400260 s0: 0x10 s1: 0x2 s2: 0x7fffeed0 s3: 0 s4: 0 s5: 0 s6: 0 s7: 0 k0: 0 k1: 0 gp: 0x4d55d0 sp: 0x7ffeee90 s8: 0 ra: 0 sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0 cause: 0x8 pc: 0x4002a4 Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 0xa001acda Dumping 4 words starting at pc address 0x4002a4: 8c420000 14400003 00908021 8f828024 Page table info for bad address 0: pde = 0, pte = 0 .. and yes, I've spent three days bisecting everything to get to this particular commit. -adrian On 19 October 2016 at 04:09, Konstantin Belousov wrote: > Author: kib > Date: Wed Oct 19 11:09:29 2016 > New Revision: 307626 > URL: https://svnweb.freebsd.org/changeset/base/307626 > > Log: > Add FFS pager, which uses buffer cache read operation to validate pages. > See the comments for more detailed description of the algorithm. > > The pager is used unconditionally when the block size of the > underlying device is larger than the machine page size, since local > vnode pager cannot handle the configuration [1]. Otherwise, the > vfs.ffs.use_buf_pager sysctl allows to switch to the local pager. > > Measurements demonstrated no regression in the ever-important > buildworld benchmark, and small (~5%) throughput improvements in the > special microbenchmark configuration for dbench over swap-backed > md(4). > > Code can be generalized and reused for other filesystems which use > buffer cache. > > Reported by: Anton Yuzhaninov [1] > Tested by: pho > Benchmarked by: mjg, pho > Reviewed by: alc, markj, mckusick (previous version) > Sponsored by: The FreeBSD Foundation > MFC after: 2 weeks > Differential revision: https://reviews.freebsd.org/D8198 > > Modified: > head/sys/ufs/ffs/ffs_vnops.c > > Modified: head/sys/ufs/ffs/ffs_vnops.c > ============================================================================== > --- head/sys/ufs/ffs/ffs_vnops.c Wed Oct 19 10:01:04 2016 (r307625) > +++ head/sys/ufs/ffs/ffs_vnops.c Wed Oct 19 11:09:29 2016 (r307626) > @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > > @@ -86,6 +87,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > > #include > @@ -102,8 +104,9 @@ __FBSDID("$FreeBSD$"); > #ifdef DIRECTIO > extern int ffs_rawread(struct vnode *vp, struct uio *uio, int *workdone); > #endif > -static vop_fsync_t ffs_fsync; > static vop_fdatasync_t ffs_fdatasync; > +static vop_fsync_t ffs_fsync; > +static vop_getpages_t ffs_getpages; > static vop_lock1_t ffs_lock; > static vop_read_t ffs_read; > static vop_write_t ffs_write; > @@ -119,13 +122,12 @@ static vop_openextattr_t ffs_openextattr > static vop_setextattr_t ffs_setextattr; > static vop_vptofh_t ffs_vptofh; > > - > /* Global vfs data structures for ufs. */ > struct vop_vector ffs_vnodeops1 = { > .vop_default = &ufs_vnodeops, > .vop_fsync = ffs_fsync, > .vop_fdatasync = ffs_fdatasync, > - .vop_getpages = vnode_pager_local_getpages, > + .vop_getpages = ffs_getpages, > .vop_getpages_async = vnode_pager_local_getpages_async, > .vop_lock1 = ffs_lock, > .vop_read = ffs_read, > @@ -147,7 +149,7 @@ struct vop_vector ffs_vnodeops2 = { > .vop_default = &ufs_vnodeops, > .vop_fsync = ffs_fsync, > .vop_fdatasync = ffs_fdatasync, > - .vop_getpages = vnode_pager_local_getpages, > + .vop_getpages = ffs_getpages, > .vop_getpages_async = vnode_pager_local_getpages_async, > .vop_lock1 = ffs_lock, > .vop_read = ffs_read, > @@ -1784,3 +1786,165 @@ vop_vptofh { > ufhp->ufid_gen = ip->i_gen; > return (0); > } > + > +SYSCTL_DECL(_vfs_ffs); > +static int use_buf_pager = 1; > +SYSCTL_INT(_vfs_ffs, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN, &use_buf_pager, 0, > + "Always use buffer pager instead of bmap"); > +static int buf_pager_relbuf; > +SYSCTL_INT(_vfs_ffs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN, > + &buf_pager_relbuf, 0, > + "Make buffer pager release buffers after reading"); > + > +/* > + * The FFS pager. It uses buffer reads to validate pages. > + * > + * In contrast to the generic local pager from vm/vnode_pager.c, this > + * pager correctly and easily handles volumes where the underlying > + * device block size is greater than the machine page size. The > + * buffer cache transparently extends the requested page run to be > + * aligned at the block boundary, and does the necessary bogus page > + * replacements in the addends to avoid obliterating already valid > + * pages. > + * > + * The only non-trivial issue is that the exclusive busy state for > + * pages, which is assumed by the vm_pager_getpages() interface, is > + * incompatible with the VMIO buffer cache's desire to share-busy the > + * pages. This function performs a trivial downgrade of the pages' > + * state before reading buffers, and a less trivial upgrade from the > + * shared-busy to excl-busy state after the read. > + */ > +static int > +ffs_getpages(struct vop_getpages_args *ap) > +{ > + struct vnode *vp; > + vm_page_t *ma, m; > + vm_object_t object; > + struct buf *bp; > + struct ufsmount *um; > + ufs_lbn_t lbn, lbnp; > + vm_ooffset_t la, lb; > + long bsize; > + int bo_bs, count, error, i; > + bool redo, lpart; > + > + vp = ap->a_vp; > + ma = ap->a_m; > + count = ap->a_count; > + > + um = VFSTOUFS(ap->a_vp->v_mount); > + bo_bs = um->um_devvp->v_bufobj.bo_bsize; > + if (!use_buf_pager && bo_bs <= PAGE_SIZE) > + return (vnode_pager_generic_getpages(vp, ma, count, > + ap->a_rbehind, ap->a_rahead, NULL, NULL)); > + > + object = vp->v_object; > + la = IDX_TO_OFF(ma[count - 1]->pindex); > + if (la >= object->un_pager.vnp.vnp_size) > + return (VM_PAGER_BAD); > + lpart = la + PAGE_SIZE > object->un_pager.vnp.vnp_size; > + if (ap->a_rbehind != NULL) { > + lb = IDX_TO_OFF(ma[0]->pindex); > + *ap->a_rbehind = OFF_TO_IDX(lb - rounddown2(lb, bo_bs)); > + } > + if (ap->a_rahead != NULL) { > + *ap->a_rahead = OFF_TO_IDX(roundup2(la, bo_bs) - la); > + if (la + IDX_TO_OFF(*ap->a_rahead) >= > + object->un_pager.vnp.vnp_size) { > + *ap->a_rahead = OFF_TO_IDX(roundup2(object->un_pager. > + vnp.vnp_size, PAGE_SIZE) - la); > + } > + } > + VM_OBJECT_WLOCK(object); > +again: > + for (i = 0; i < count; i++) > + vm_page_busy_downgrade(ma[i]); > + VM_OBJECT_WUNLOCK(object); > + > + lbnp = -1; > + for (i = 0; i < count; i++) { > + m = ma[i]; > + > + /* > + * Pages are shared busy and the object lock is not > + * owned, which together allow for the pages' > + * invalidation. The racy test for validity avoids > + * useless creation of the buffer for the most typical > + * case when invalidation is not used in redo or for > + * parallel read. The shared->excl upgrade loop at > + * the end of the function catches the race in a > + * reliable way (protected by the object lock). > + */ > + if (m->valid == VM_PAGE_BITS_ALL) > + continue; > + > + lbn = lblkno(um->um_fs, IDX_TO_OFF(m->pindex)); > + if (lbn != lbnp) { > + bsize = blksize(um->um_fs, VTOI(vp), lbn); > + error = bread_gb(vp, lbn, bsize, NOCRED, GB_UNMAPPED, > + &bp); > + if (error != 0) > + break; > + KASSERT(1 /* racy, enable for debugging */ || > + m->valid == VM_PAGE_BITS_ALL || i == count - 1, > + ("buf %d %p invalid", i, m)); > + if (i == count - 1 && lpart) { > + VM_OBJECT_WLOCK(object); > + if (m->valid != 0 && > + m->valid != VM_PAGE_BITS_ALL) > + vm_page_zero_invalid(m, TRUE); > + VM_OBJECT_WUNLOCK(object); > + } > + if (LIST_EMPTY(&bp->b_dep)) { > + /* > + * Invalidation clears m->valid, but > + * may leave B_CACHE flag if the > + * buffer existed at the invalidation > + * time. In this case, recycle the > + * buffer to do real read on next > + * bread() after redo. > + * > + * Otherwise B_RELBUF is not strictly > + * necessary, enable to reduce buf > + * cache pressure. > + */ > + if (buf_pager_relbuf || > + m->valid != VM_PAGE_BITS_ALL) > + bp->b_flags |= B_RELBUF; > + > + bp->b_flags &= ~B_NOCACHE; > + brelse(bp); > + } else { > + bqrelse(bp); > + } > + lbnp = lbn; > + } > + } > + > + VM_OBJECT_WLOCK(object); > + redo = false; > + for (i = 0; i < count; i++) { > + vm_page_sunbusy(ma[i]); > + ma[i] = vm_page_grab(object, ma[i]->pindex, VM_ALLOC_NORMAL); > + > + /* > + * Since the pages were only sbusy while neither the > + * buffer nor the object lock was held by us, or > + * reallocated while vm_page_grab() slept for busy > + * relinguish, they could have been invalidated. > + * Recheck the valid bits and re-read as needed. > + * > + * Note that the last page is made fully valid in the > + * read loop, and partial validity for the page at > + * index count - 1 could mean that the page was > + * invalidated or removed, so we must restart for > + * safety as well. > + */ > + if (ma[i]->valid != VM_PAGE_BITS_ALL) > + redo = true; > + } > + if (redo && error == 0) > + goto again; > + VM_OBJECT_WUNLOCK(object); > + return (error != 0 ? VM_PAGER_ERROR : VM_PAGER_OK); > +} > From owner-svn-src-all@freebsd.org Sat Nov 12 23:29:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF2CCC3D4F9; Sat, 12 Nov 2016 23:29:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80C3C19A3; Sat, 12 Nov 2016 23:29:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACNT9Ch074924; Sat, 12 Nov 2016 23:29:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACNT96Q074923; Sat, 12 Nov 2016 23:29:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611122329.uACNT96Q074923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Nov 2016 23:29:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308585 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 23:29:10 -0000 Author: mav Date: Sat Nov 12 23:29:09 2016 New Revision: 308585 URL: https://svnweb.freebsd.org/changeset/base/308585 Log: MFC r307318: MFV r307314: 6988 spa_sync() spends half its time in dmu_objset_do_userquota_updates Using a benchmark which creates 2 million files in one TXG, I observe that the thread running spa_sync() is on CPU almost the entire time we are syncing, and therefore can be a performance bottleneck. About 50% of the time in spa_sync() is in dmu_objset_do_userquota_updates(). The problem is that dmu_objset_do_userquota_updates() calls zap_increment_int(DMU_USERUSED_OBJECT) once for every file that was modified (or created). In this benchmark, all the files are owned by the same user/group, so all 2 million calls to zap_increment_int() are modifying the same entry in the zap. The same issue exists for the DMU_GROUPUSED_OBJECT. We should keep an in-memory map from user to space delta while we are syncing, and when we finish, iterate over the in-memory map and modify the ZAP once per entry. This reduces the number of calls to zap_increment_int() from "number of objects modified" to "number of owners/groups of modified files". This reduced the time spent in spa_sync() in the file create benchmark by ~33%, from 11 seconds to 7 seconds. Closes #107 Reviewed by: George Wilson Reviewed by: Steve Gonczi Reviewed by: Ned Bass Reviewed by: Jinshan Xiong Author: Matthew Ahrens openzfs/openzfs@5fc46359c569369d87728ca09f8705cdff6cc8e2 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Sat Nov 12 20:45:03 2016 (r308584) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Sat Nov 12 23:29:09 2016 (r308585) @@ -1207,18 +1207,83 @@ dmu_objset_userused_enabled(objset_t *os DMU_USERUSED_DNODE(os) != NULL); } +typedef struct userquota_node { + uint64_t uqn_id; + int64_t uqn_delta; + avl_node_t uqn_node; +} userquota_node_t; + +typedef struct userquota_cache { + avl_tree_t uqc_user_deltas; + avl_tree_t uqc_group_deltas; +} userquota_cache_t; + +static int +userquota_compare(const void *l, const void *r) +{ + const userquota_node_t *luqn = l; + const userquota_node_t *ruqn = r; + + if (luqn->uqn_id < ruqn->uqn_id) + return (-1); + if (luqn->uqn_id > ruqn->uqn_id) + return (1); + return (0); +} + static void -do_userquota_update(objset_t *os, uint64_t used, uint64_t flags, - uint64_t user, uint64_t group, boolean_t subtract, dmu_tx_t *tx) +do_userquota_cacheflush(objset_t *os, userquota_cache_t *cache, dmu_tx_t *tx) +{ + void *cookie; + userquota_node_t *uqn; + + ASSERT(dmu_tx_is_syncing(tx)); + + cookie = NULL; + while ((uqn = avl_destroy_nodes(&cache->uqc_user_deltas, + &cookie)) != NULL) { + VERIFY0(zap_increment_int(os, DMU_USERUSED_OBJECT, + uqn->uqn_id, uqn->uqn_delta, tx)); + kmem_free(uqn, sizeof (*uqn)); + } + avl_destroy(&cache->uqc_user_deltas); + + cookie = NULL; + while ((uqn = avl_destroy_nodes(&cache->uqc_group_deltas, + &cookie)) != NULL) { + VERIFY0(zap_increment_int(os, DMU_GROUPUSED_OBJECT, + uqn->uqn_id, uqn->uqn_delta, tx)); + kmem_free(uqn, sizeof (*uqn)); + } + avl_destroy(&cache->uqc_group_deltas); +} + +static void +userquota_update_cache(avl_tree_t *avl, uint64_t id, int64_t delta) +{ + userquota_node_t search = { .uqn_id = id }; + avl_index_t idx; + + userquota_node_t *uqn = avl_find(avl, &search, &idx); + if (uqn == NULL) { + uqn = kmem_zalloc(sizeof (*uqn), KM_SLEEP); + uqn->uqn_id = id; + avl_insert(avl, uqn, idx); + } + uqn->uqn_delta += delta; +} + +static void +do_userquota_update(userquota_cache_t *cache, uint64_t used, uint64_t flags, + uint64_t user, uint64_t group, boolean_t subtract) { if ((flags & DNODE_FLAG_USERUSED_ACCOUNTED)) { int64_t delta = DNODE_SIZE + used; if (subtract) delta = -delta; - VERIFY3U(0, ==, zap_increment_int(os, DMU_USERUSED_OBJECT, - user, delta, tx)); - VERIFY3U(0, ==, zap_increment_int(os, DMU_GROUPUSED_OBJECT, - group, delta, tx)); + + userquota_update_cache(&cache->uqc_user_deltas, user, delta); + userquota_update_cache(&cache->uqc_group_deltas, group, delta); } } @@ -1227,9 +1292,15 @@ dmu_objset_do_userquota_updates(objset_t { dnode_t *dn; list_t *list = &os->os_synced_dnodes; + userquota_cache_t cache = { 0 }; ASSERT(list_head(list) == NULL || dmu_objset_userused_enabled(os)); + avl_create(&cache.uqc_user_deltas, userquota_compare, + sizeof (userquota_node_t), offsetof(userquota_node_t, uqn_node)); + avl_create(&cache.uqc_group_deltas, userquota_compare, + sizeof (userquota_node_t), offsetof(userquota_node_t, uqn_node)); + while (dn = list_head(list)) { int flags; ASSERT(!DMU_OBJECT_IS_SPECIAL(dn->dn_object)); @@ -1239,32 +1310,26 @@ dmu_objset_do_userquota_updates(objset_t /* Allocate the user/groupused objects if necessary. */ if (DMU_USERUSED_DNODE(os)->dn_type == DMU_OT_NONE) { - VERIFY(0 == zap_create_claim(os, + VERIFY0(zap_create_claim(os, DMU_USERUSED_OBJECT, DMU_OT_USERGROUP_USED, DMU_OT_NONE, 0, tx)); - VERIFY(0 == zap_create_claim(os, + VERIFY0(zap_create_claim(os, DMU_GROUPUSED_OBJECT, DMU_OT_USERGROUP_USED, DMU_OT_NONE, 0, tx)); } - /* - * We intentionally modify the zap object even if the - * net delta is zero. Otherwise - * the block of the zap obj could be shared between - * datasets but need to be different between them after - * a bprewrite. - */ - flags = dn->dn_id_flags; ASSERT(flags); if (flags & DN_ID_OLD_EXIST) { - do_userquota_update(os, dn->dn_oldused, dn->dn_oldflags, - dn->dn_olduid, dn->dn_oldgid, B_TRUE, tx); + do_userquota_update(&cache, + dn->dn_oldused, dn->dn_oldflags, + dn->dn_olduid, dn->dn_oldgid, B_TRUE); } if (flags & DN_ID_NEW_EXIST) { - do_userquota_update(os, DN_USED_BYTES(dn->dn_phys), + do_userquota_update(&cache, + DN_USED_BYTES(dn->dn_phys), dn->dn_phys->dn_flags, dn->dn_newuid, - dn->dn_newgid, B_FALSE, tx); + dn->dn_newgid, B_FALSE); } mutex_enter(&dn->dn_mtx); @@ -1285,6 +1350,7 @@ dmu_objset_do_userquota_updates(objset_t list_remove(list, dn); dnode_rele(dn, list); } + do_userquota_cacheflush(os, &cache, tx); } /* From owner-svn-src-all@freebsd.org Sat Nov 12 23:32:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87B79C3D6C2; Sat, 12 Nov 2016 23:32:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 62CAE1D32; Sat, 12 Nov 2016 23:32:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACNW0QB076640; Sat, 12 Nov 2016 23:32:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACNW0aT076639; Sat, 12 Nov 2016 23:32:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611122332.uACNW0aT076639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Nov 2016 23:32:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308586 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 23:32:01 -0000 Author: mav Date: Sat Nov 12 23:32:00 2016 New Revision: 308586 URL: https://svnweb.freebsd.org/changeset/base/308586 Log: MFC r307318: MFV r307314: 6988 spa_sync() spends half its time in dmu_objset_do_userquota_updates Using a benchmark which creates 2 million files in one TXG, I observe that the thread running spa_sync() is on CPU almost the entire time we are syncing, and therefore can be a performance bottleneck. About 50% of the time in spa_sync() is in dmu_objset_do_userquota_updates(). The problem is that dmu_objset_do_userquota_updates() calls zap_increment_int(DMU_USERUSED_OBJECT) once for every file that was modified (or created). In this benchmark, all the files are owned by the same user/group, so all 2 million calls to zap_increment_int() are modifying the same entry in the zap. The same issue exists for the DMU_GROUPUSED_OBJECT. We should keep an in-memory map from user to space delta while we are syncing, and when we finish, iterate over the in-memory map and modify the ZAP once per entry. This reduces the number of calls to zap_increment_int() from "number of objects modified" to "number of owners/groups of modified files". This reduced the time spent in spa_sync() in the file create benchmark by ~33%, from 11 seconds to 7 seconds. Closes #107 Reviewed by: George Wilson Reviewed by: Steve Gonczi Reviewed by: Ned Bass Reviewed by: Jinshan Xiong Author: Matthew Ahrens openzfs/openzfs@5fc46359c569369d87728ca09f8705cdff6cc8e2 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Sat Nov 12 23:29:09 2016 (r308585) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Sat Nov 12 23:32:00 2016 (r308586) @@ -1207,18 +1207,83 @@ dmu_objset_userused_enabled(objset_t *os DMU_USERUSED_DNODE(os) != NULL); } +typedef struct userquota_node { + uint64_t uqn_id; + int64_t uqn_delta; + avl_node_t uqn_node; +} userquota_node_t; + +typedef struct userquota_cache { + avl_tree_t uqc_user_deltas; + avl_tree_t uqc_group_deltas; +} userquota_cache_t; + +static int +userquota_compare(const void *l, const void *r) +{ + const userquota_node_t *luqn = l; + const userquota_node_t *ruqn = r; + + if (luqn->uqn_id < ruqn->uqn_id) + return (-1); + if (luqn->uqn_id > ruqn->uqn_id) + return (1); + return (0); +} + static void -do_userquota_update(objset_t *os, uint64_t used, uint64_t flags, - uint64_t user, uint64_t group, boolean_t subtract, dmu_tx_t *tx) +do_userquota_cacheflush(objset_t *os, userquota_cache_t *cache, dmu_tx_t *tx) +{ + void *cookie; + userquota_node_t *uqn; + + ASSERT(dmu_tx_is_syncing(tx)); + + cookie = NULL; + while ((uqn = avl_destroy_nodes(&cache->uqc_user_deltas, + &cookie)) != NULL) { + VERIFY0(zap_increment_int(os, DMU_USERUSED_OBJECT, + uqn->uqn_id, uqn->uqn_delta, tx)); + kmem_free(uqn, sizeof (*uqn)); + } + avl_destroy(&cache->uqc_user_deltas); + + cookie = NULL; + while ((uqn = avl_destroy_nodes(&cache->uqc_group_deltas, + &cookie)) != NULL) { + VERIFY0(zap_increment_int(os, DMU_GROUPUSED_OBJECT, + uqn->uqn_id, uqn->uqn_delta, tx)); + kmem_free(uqn, sizeof (*uqn)); + } + avl_destroy(&cache->uqc_group_deltas); +} + +static void +userquota_update_cache(avl_tree_t *avl, uint64_t id, int64_t delta) +{ + userquota_node_t search = { .uqn_id = id }; + avl_index_t idx; + + userquota_node_t *uqn = avl_find(avl, &search, &idx); + if (uqn == NULL) { + uqn = kmem_zalloc(sizeof (*uqn), KM_SLEEP); + uqn->uqn_id = id; + avl_insert(avl, uqn, idx); + } + uqn->uqn_delta += delta; +} + +static void +do_userquota_update(userquota_cache_t *cache, uint64_t used, uint64_t flags, + uint64_t user, uint64_t group, boolean_t subtract) { if ((flags & DNODE_FLAG_USERUSED_ACCOUNTED)) { int64_t delta = DNODE_SIZE + used; if (subtract) delta = -delta; - VERIFY3U(0, ==, zap_increment_int(os, DMU_USERUSED_OBJECT, - user, delta, tx)); - VERIFY3U(0, ==, zap_increment_int(os, DMU_GROUPUSED_OBJECT, - group, delta, tx)); + + userquota_update_cache(&cache->uqc_user_deltas, user, delta); + userquota_update_cache(&cache->uqc_group_deltas, group, delta); } } @@ -1227,9 +1292,15 @@ dmu_objset_do_userquota_updates(objset_t { dnode_t *dn; list_t *list = &os->os_synced_dnodes; + userquota_cache_t cache = { 0 }; ASSERT(list_head(list) == NULL || dmu_objset_userused_enabled(os)); + avl_create(&cache.uqc_user_deltas, userquota_compare, + sizeof (userquota_node_t), offsetof(userquota_node_t, uqn_node)); + avl_create(&cache.uqc_group_deltas, userquota_compare, + sizeof (userquota_node_t), offsetof(userquota_node_t, uqn_node)); + while (dn = list_head(list)) { int flags; ASSERT(!DMU_OBJECT_IS_SPECIAL(dn->dn_object)); @@ -1239,32 +1310,26 @@ dmu_objset_do_userquota_updates(objset_t /* Allocate the user/groupused objects if necessary. */ if (DMU_USERUSED_DNODE(os)->dn_type == DMU_OT_NONE) { - VERIFY(0 == zap_create_claim(os, + VERIFY0(zap_create_claim(os, DMU_USERUSED_OBJECT, DMU_OT_USERGROUP_USED, DMU_OT_NONE, 0, tx)); - VERIFY(0 == zap_create_claim(os, + VERIFY0(zap_create_claim(os, DMU_GROUPUSED_OBJECT, DMU_OT_USERGROUP_USED, DMU_OT_NONE, 0, tx)); } - /* - * We intentionally modify the zap object even if the - * net delta is zero. Otherwise - * the block of the zap obj could be shared between - * datasets but need to be different between them after - * a bprewrite. - */ - flags = dn->dn_id_flags; ASSERT(flags); if (flags & DN_ID_OLD_EXIST) { - do_userquota_update(os, dn->dn_oldused, dn->dn_oldflags, - dn->dn_olduid, dn->dn_oldgid, B_TRUE, tx); + do_userquota_update(&cache, + dn->dn_oldused, dn->dn_oldflags, + dn->dn_olduid, dn->dn_oldgid, B_TRUE); } if (flags & DN_ID_NEW_EXIST) { - do_userquota_update(os, DN_USED_BYTES(dn->dn_phys), + do_userquota_update(&cache, + DN_USED_BYTES(dn->dn_phys), dn->dn_phys->dn_flags, dn->dn_newuid, - dn->dn_newgid, B_FALSE, tx); + dn->dn_newgid, B_FALSE); } mutex_enter(&dn->dn_mtx); @@ -1285,6 +1350,7 @@ dmu_objset_do_userquota_updates(objset_t list_remove(list, dn); dnode_rele(dn, list); } + do_userquota_cacheflush(os, &cache, tx); } /* From owner-svn-src-all@freebsd.org Sat Nov 12 23:35:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67708C3D78B; Sat, 12 Nov 2016 23:35:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 309931F1D; Sat, 12 Nov 2016 23:35:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACNZeZH079090; Sat, 12 Nov 2016 23:35:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACNZekg079089; Sat, 12 Nov 2016 23:35:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611122335.uACNZekg079089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Nov 2016 23:35:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308587 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 23:35:41 -0000 Author: mav Date: Sat Nov 12 23:35:40 2016 New Revision: 308587 URL: https://svnweb.freebsd.org/changeset/base/308587 Log: MFC r308049: Improve few debugging log messages. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Nov 12 23:32:00 2016 (r308586) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Nov 12 23:35:40 2016 (r308587) @@ -223,7 +223,7 @@ vdev_geom_attach(struct g_provider *pp, } error = g_access(cp, 1, 0, 1); if (error != 0) { - ZFS_LOG(1, "%s(%d): g_access failed: %d\n", __func__, + ZFS_LOG(1, "%s(%d): g_access failed: %d", __func__, __LINE__, error); vdev_geom_detach(cp, B_FALSE); return (NULL); @@ -293,7 +293,7 @@ vdev_geom_detach(struct g_consumer *cp, g_topology_assert(); - ZFS_LOG(1, "Detaching consumer. Provider %s.", + ZFS_LOG(1, "Detaching from %s.", cp->provider && cp->provider->name ? cp->provider->name : "NULL"); vd = cp->private; @@ -307,7 +307,7 @@ vdev_geom_detach(struct g_consumer *cp, if (cp->acw > 0) g_access(cp, 0, -cp->acw, 0); if (cp->provider != NULL) { - ZFS_LOG(1, "Destroying consumer to %s.", + ZFS_LOG(1, "Destroying consumer for %s.", cp->provider->name ? cp->provider->name : "NULL"); g_detach(cp); } From owner-svn-src-all@freebsd.org Sat Nov 12 23:36:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB94EC3D7FD; Sat, 12 Nov 2016 23:36:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B09C1080; Sat, 12 Nov 2016 23:36:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACNaR5w079174; Sat, 12 Nov 2016 23:36:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACNaRNm079173; Sat, 12 Nov 2016 23:36:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611122336.uACNaRNm079173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Nov 2016 23:36:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308588 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 23:36:28 -0000 Author: mav Date: Sat Nov 12 23:36:27 2016 New Revision: 308588 URL: https://svnweb.freebsd.org/changeset/base/308588 Log: MFC r308049: Improve few debugging log messages. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Nov 12 23:35:40 2016 (r308587) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Nov 12 23:36:27 2016 (r308588) @@ -225,7 +225,7 @@ vdev_geom_attach(struct g_provider *pp, } error = g_access(cp, 1, 0, 1); if (error != 0) { - ZFS_LOG(1, "%s(%d): g_access failed: %d\n", __func__, + ZFS_LOG(1, "%s(%d): g_access failed: %d", __func__, __LINE__, error); vdev_geom_detach(cp, B_FALSE); return (NULL); @@ -295,7 +295,7 @@ vdev_geom_detach(struct g_consumer *cp, g_topology_assert(); - ZFS_LOG(1, "Detaching consumer. Provider %s.", + ZFS_LOG(1, "Detaching from %s.", cp->provider && cp->provider->name ? cp->provider->name : "NULL"); vd = cp->private; @@ -309,7 +309,7 @@ vdev_geom_detach(struct g_consumer *cp, if (cp->acw > 0) g_access(cp, 0, -cp->acw, 0); if (cp->provider != NULL) { - ZFS_LOG(1, "Destroying consumer to %s.", + ZFS_LOG(1, "Destroying consumer for %s.", cp->provider->name ? cp->provider->name : "NULL"); g_detach(cp); } From owner-svn-src-all@freebsd.org Sat Nov 12 23:37:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3BBEC3D885; Sat, 12 Nov 2016 23:37:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7DEA31215; Sat, 12 Nov 2016 23:37:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACNbQQx079263; Sat, 12 Nov 2016 23:37:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACNbQMc079262; Sat, 12 Nov 2016 23:37:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611122337.uACNbQMc079262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Nov 2016 23:37:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308589 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 23:37:27 -0000 Author: mav Date: Sat Nov 12 23:37:26 2016 New Revision: 308589 URL: https://svnweb.freebsd.org/changeset/base/308589 Log: MFC r308051: Matching GUIDs, handle possible race on vdev detach. In case of vdev detach, causing top level mirror vdev destruction, leaf vdev changes its GUID to one of the destroyed mirror, that creates race condition when GUID in vdev label may not match one in the pool config. This change replicates logic nuance of vdev_validate() by adding special exception, matching the vdev GUID against the top level vdev GUID. Since this exception is not completely reliable (may give false positives if we fail to erase label on detached vdev), use it only as last resort. Quick way to reproduce this scenario now is detach vdev from a pool with enabled autoextend. During vdev detach autoextend logic tries to reopen remaining vdev, that always fails now since in-memory configuration is already updated, while on-disk labels are not yet. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Nov 12 23:36:27 2016 (r308588) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Nov 12 23:37:26 2016 (r308589) @@ -338,14 +338,6 @@ vdev_geom_close_locked(vdev_t *vd) vdev_geom_detach(cp, B_TRUE); } -static void -nvlist_get_guids(nvlist_t *list, uint64_t *pguid, uint64_t *vguid) -{ - - (void) nvlist_lookup_uint64(list, ZPOOL_CONFIG_GUID, vguid); - (void) nvlist_lookup_uint64(list, ZPOOL_CONFIG_POOL_GUID, pguid); -} - /* * Issue one or more bios to the vdev in parallel * cmds, datas, offsets, errors, and sizes are arrays of length ncmds. Each IO @@ -606,58 +598,69 @@ vdev_geom_read_pool_label(const char *na return (*count > 0 ? 0 : ENOENT); } -static void -vdev_geom_read_guids(struct g_consumer *cp, uint64_t *pguid, uint64_t *vguid) -{ - nvlist_t *config; - - g_topology_assert_not(); - - *pguid = 0; - *vguid = 0; - if (vdev_geom_read_config(cp, &config) == 0) { - nvlist_get_guids(config, pguid, vguid); - nvlist_free(config); - } -} +enum match { + NO_MATCH, + TOP_MATCH, + FULL_MATCH +}; -static boolean_t +static enum match vdev_attach_ok(vdev_t *vd, struct g_provider *pp) { - uint64_t pool_guid; - uint64_t vdev_guid; - struct g_consumer *zcp; - boolean_t pool_ok; - boolean_t vdev_ok; + nvlist_t *config; + uint64_t pool_guid, top_guid, vdev_guid; + struct g_consumer *cp; - zcp = vdev_geom_attach(pp, NULL); - if (zcp == NULL) { + cp = vdev_geom_attach(pp, NULL); + if (cp == NULL) { ZFS_LOG(1, "Unable to attach tasting instance to %s.", pp->name); - return (B_FALSE); + return (NO_MATCH); } g_topology_unlock(); - vdev_geom_read_guids(zcp, &pool_guid, &vdev_guid); + if (vdev_geom_read_config(cp, &config) != 0) { + g_topology_lock(); + vdev_geom_detach(cp, B_TRUE); + ZFS_LOG(1, "Unable to read config from %s.", pp->name); + return (NO_MATCH); + } g_topology_lock(); - vdev_geom_detach(zcp, B_TRUE); + vdev_geom_detach(cp, B_TRUE); - /* - * Check that the label's vdev guid matches the desired guid. If the - * label has a pool guid, check that it matches too. (Inactive spares - * and L2ARCs do not have any pool guid in the label.) + pool_guid = 0; + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &pool_guid); + top_guid = 0; + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_TOP_GUID, &top_guid); + vdev_guid = 0; + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_GUID, &vdev_guid); + nvlist_free(config); + + /* + * Check that the label's pool guid matches the desired guid. + * Inactive spares and L2ARCs do not have any pool guid in the label. */ - if ((pool_guid == 0 || pool_guid == spa_guid(vd->vdev_spa)) && - vdev_guid == vd->vdev_guid) { - ZFS_LOG(1, "guids match for provider %s.", vd->vdev_path); - return (B_TRUE); - } else { - ZFS_LOG(1, "guid mismatch for provider %s: " - "%ju:%ju != %ju:%ju.", vd->vdev_path, - (uintmax_t)spa_guid(vd->vdev_spa), - (uintmax_t)vd->vdev_guid, - (uintmax_t)pool_guid, (uintmax_t)vdev_guid); - return (B_FALSE); + if (pool_guid != 0 && pool_guid != spa_guid(vd->vdev_spa)) { + ZFS_LOG(1, "pool guid mismatch for provider %s: %ju != %ju.", + pp->name, + (uintmax_t)spa_guid(vd->vdev_spa), (uintmax_t)pool_guid); + return (NO_MATCH); } + + /* + * Check that the label's vdev guid matches the desired guid. + * The second condition handles possible race on vdev detach, when + * remaining vdev receives GUID of destroyed top level mirror vdev. + */ + if (vdev_guid == vd->vdev_guid) { + ZFS_LOG(1, "guids match for provider %s.", pp->name); + return (FULL_MATCH); + } else if (top_guid == vd->vdev_guid && vd == vd->vdev_top) { + ZFS_LOG(1, "top vdev guid match for provider %s.", pp->name); + return (TOP_MATCH); + } + ZFS_LOG(1, "vdev guid mismatch for provider %s: %ju != %ju.", + pp->name, (uintmax_t)vd->vdev_guid, (uintmax_t)vdev_guid); + return (NO_MATCH); } static struct g_consumer * @@ -667,6 +670,7 @@ vdev_geom_attach_by_guids(vdev_t *vd) struct g_geom *gp; struct g_provider *pp; struct g_consumer *cp; + enum match m; g_topology_assert(); @@ -678,23 +682,26 @@ vdev_geom_attach_by_guids(vdev_t *vd) if (gp->flags & G_GEOM_WITHER) continue; LIST_FOREACH(pp, &gp->provider, provider) { - if (!vdev_attach_ok(vd, pp)) + m = vdev_attach_ok(vd, pp); + if (m == NO_MATCH) continue; + if (cp != NULL) { + if (m == FULL_MATCH) + vdev_geom_detach(cp, B_TRUE); + else + continue; + } cp = vdev_geom_attach(pp, vd); if (cp == NULL) { printf("ZFS WARNING: Unable to " "attach to %s.\n", pp->name); continue; } - break; + if (m == FULL_MATCH) + return (cp); } - if (cp != NULL) - break; } - if (cp != NULL) - break; } -end: return (cp); } @@ -742,7 +749,7 @@ vdev_geom_open_by_path(vdev_t *vd, int c pp = g_provider_by_name(vd->vdev_path + sizeof("/dev/") - 1); if (pp != NULL) { ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path); - if (!check_guid || vdev_attach_ok(vd, pp)) + if (!check_guid || vdev_attach_ok(vd, pp) == FULL_MATCH) cp = vdev_geom_attach(pp, vd); } From owner-svn-src-all@freebsd.org Sat Nov 12 23:38:05 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88B63C3D919; Sat, 12 Nov 2016 23:38:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 604581373; Sat, 12 Nov 2016 23:38:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACNc4cx079341; Sat, 12 Nov 2016 23:38:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACNc4Gs079340; Sat, 12 Nov 2016 23:38:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611122338.uACNc4Gs079340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Nov 2016 23:38:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308590 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 23:38:05 -0000 Author: mav Date: Sat Nov 12 23:38:04 2016 New Revision: 308590 URL: https://svnweb.freebsd.org/changeset/base/308590 Log: MFC r308051: Matching GUIDs, handle possible race on vdev detach. In case of vdev detach, causing top level mirror vdev destruction, leaf vdev changes its GUID to one of the destroyed mirror, that creates race condition when GUID in vdev label may not match one in the pool config. This change replicates logic nuance of vdev_validate() by adding special exception, matching the vdev GUID against the top level vdev GUID. Since this exception is not completely reliable (may give false positives if we fail to erase label on detached vdev), use it only as last resort. Quick way to reproduce this scenario now is detach vdev from a pool with enabled autoextend. During vdev detach autoextend logic tries to reopen remaining vdev, that always fails now since in-memory configuration is already updated, while on-disk labels are not yet. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Nov 12 23:37:26 2016 (r308589) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Nov 12 23:38:04 2016 (r308590) @@ -340,14 +340,6 @@ vdev_geom_close_locked(vdev_t *vd) vdev_geom_detach(cp, B_TRUE); } -static void -nvlist_get_guids(nvlist_t *list, uint64_t *pguid, uint64_t *vguid) -{ - - (void) nvlist_lookup_uint64(list, ZPOOL_CONFIG_GUID, vguid); - (void) nvlist_lookup_uint64(list, ZPOOL_CONFIG_POOL_GUID, pguid); -} - /* * Issue one or more bios to the vdev in parallel * cmds, datas, offsets, errors, and sizes are arrays of length ncmds. Each IO @@ -608,58 +600,69 @@ vdev_geom_read_pool_label(const char *na return (*count > 0 ? 0 : ENOENT); } -static void -vdev_geom_read_guids(struct g_consumer *cp, uint64_t *pguid, uint64_t *vguid) -{ - nvlist_t *config; - - g_topology_assert_not(); - - *pguid = 0; - *vguid = 0; - if (vdev_geom_read_config(cp, &config) == 0) { - nvlist_get_guids(config, pguid, vguid); - nvlist_free(config); - } -} +enum match { + NO_MATCH, + TOP_MATCH, + FULL_MATCH +}; -static boolean_t +static enum match vdev_attach_ok(vdev_t *vd, struct g_provider *pp) { - uint64_t pool_guid; - uint64_t vdev_guid; - struct g_consumer *zcp; - boolean_t pool_ok; - boolean_t vdev_ok; + nvlist_t *config; + uint64_t pool_guid, top_guid, vdev_guid; + struct g_consumer *cp; - zcp = vdev_geom_attach(pp, NULL); - if (zcp == NULL) { + cp = vdev_geom_attach(pp, NULL); + if (cp == NULL) { ZFS_LOG(1, "Unable to attach tasting instance to %s.", pp->name); - return (B_FALSE); + return (NO_MATCH); } g_topology_unlock(); - vdev_geom_read_guids(zcp, &pool_guid, &vdev_guid); + if (vdev_geom_read_config(cp, &config) != 0) { + g_topology_lock(); + vdev_geom_detach(cp, B_TRUE); + ZFS_LOG(1, "Unable to read config from %s.", pp->name); + return (NO_MATCH); + } g_topology_lock(); - vdev_geom_detach(zcp, B_TRUE); + vdev_geom_detach(cp, B_TRUE); - /* - * Check that the label's vdev guid matches the desired guid. If the - * label has a pool guid, check that it matches too. (Inactive spares - * and L2ARCs do not have any pool guid in the label.) + pool_guid = 0; + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &pool_guid); + top_guid = 0; + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_TOP_GUID, &top_guid); + vdev_guid = 0; + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_GUID, &vdev_guid); + nvlist_free(config); + + /* + * Check that the label's pool guid matches the desired guid. + * Inactive spares and L2ARCs do not have any pool guid in the label. */ - if ((pool_guid == 0 || pool_guid == spa_guid(vd->vdev_spa)) && - vdev_guid == vd->vdev_guid) { - ZFS_LOG(1, "guids match for provider %s.", vd->vdev_path); - return (B_TRUE); - } else { - ZFS_LOG(1, "guid mismatch for provider %s: " - "%ju:%ju != %ju:%ju.", vd->vdev_path, - (uintmax_t)spa_guid(vd->vdev_spa), - (uintmax_t)vd->vdev_guid, - (uintmax_t)pool_guid, (uintmax_t)vdev_guid); - return (B_FALSE); + if (pool_guid != 0 && pool_guid != spa_guid(vd->vdev_spa)) { + ZFS_LOG(1, "pool guid mismatch for provider %s: %ju != %ju.", + pp->name, + (uintmax_t)spa_guid(vd->vdev_spa), (uintmax_t)pool_guid); + return (NO_MATCH); } + + /* + * Check that the label's vdev guid matches the desired guid. + * The second condition handles possible race on vdev detach, when + * remaining vdev receives GUID of destroyed top level mirror vdev. + */ + if (vdev_guid == vd->vdev_guid) { + ZFS_LOG(1, "guids match for provider %s.", pp->name); + return (FULL_MATCH); + } else if (top_guid == vd->vdev_guid && vd == vd->vdev_top) { + ZFS_LOG(1, "top vdev guid match for provider %s.", pp->name); + return (TOP_MATCH); + } + ZFS_LOG(1, "vdev guid mismatch for provider %s: %ju != %ju.", + pp->name, (uintmax_t)vd->vdev_guid, (uintmax_t)vdev_guid); + return (NO_MATCH); } static struct g_consumer * @@ -669,6 +672,7 @@ vdev_geom_attach_by_guids(vdev_t *vd) struct g_geom *gp; struct g_provider *pp; struct g_consumer *cp; + enum match m; g_topology_assert(); @@ -680,23 +684,26 @@ vdev_geom_attach_by_guids(vdev_t *vd) if (gp->flags & G_GEOM_WITHER) continue; LIST_FOREACH(pp, &gp->provider, provider) { - if (!vdev_attach_ok(vd, pp)) + m = vdev_attach_ok(vd, pp); + if (m == NO_MATCH) continue; + if (cp != NULL) { + if (m == FULL_MATCH) + vdev_geom_detach(cp, B_TRUE); + else + continue; + } cp = vdev_geom_attach(pp, vd); if (cp == NULL) { printf("ZFS WARNING: Unable to " "attach to %s.\n", pp->name); continue; } - break; + if (m == FULL_MATCH) + return (cp); } - if (cp != NULL) - break; } - if (cp != NULL) - break; } -end: return (cp); } @@ -744,7 +751,7 @@ vdev_geom_open_by_path(vdev_t *vd, int c pp = g_provider_by_name(vd->vdev_path + sizeof("/dev/") - 1); if (pp != NULL) { ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path); - if (!check_guid || vdev_attach_ok(vd, pp)) + if (!check_guid || vdev_attach_ok(vd, pp) == FULL_MATCH) cp = vdev_geom_attach(pp, vd); } From owner-svn-src-all@freebsd.org Sat Nov 12 23:39:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE7EAC3D9CD; Sat, 12 Nov 2016 23:39:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 99DEC154E; Sat, 12 Nov 2016 23:39:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACNd8fk079436; Sat, 12 Nov 2016 23:39:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACNd8s6079435; Sat, 12 Nov 2016 23:39:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611122339.uACNd8s6079435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Nov 2016 23:39:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308591 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 23:39:09 -0000 Author: mav Date: Sat Nov 12 23:39:08 2016 New Revision: 308591 URL: https://svnweb.freebsd.org/changeset/base/308591 Log: MFC r308055: Add vdev_reopening support to vdev_geom. It allows to avoid extra GEOM providers flapping without significant need. Since GEOM got resize support, we don't need to reopen provider to get new size. If provider was orphaned and no longer valid, ZFS should already know that, and in such case reopen should be done in full as expected. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Nov 12 23:38:04 2016 (r308590) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Nov 12 23:39:08 2016 (r308591) @@ -776,7 +776,14 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi return (EINVAL); } - vd->vdev_tsd = NULL; + /* + * Reopen the device if it's not currently open. Otherwise, + * just update the physical size of the device. + */ + if ((cp = vd->vdev_tsd) != NULL) { + ASSERT(vd->vdev_reopening); + goto skip_open; + } DROP_GIANT(); g_topology_lock(); @@ -861,6 +868,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; return (error); } +skip_open: pp = cp->provider; /* @@ -896,6 +904,9 @@ static void vdev_geom_close(vdev_t *vd) { + if (vd->vdev_reopening) + return; + DROP_GIANT(); g_topology_lock(); vdev_geom_close_locked(vd); From owner-svn-src-all@freebsd.org Sat Nov 12 23:40:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89B7AC3DBC9; Sat, 12 Nov 2016 23:40:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 589A517DC; Sat, 12 Nov 2016 23:40:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACNeev3081745; Sat, 12 Nov 2016 23:40:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACNeeWt081744; Sat, 12 Nov 2016 23:40:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611122340.uACNeeWt081744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Nov 2016 23:40:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308592 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 23:40:41 -0000 Author: mav Date: Sat Nov 12 23:40:40 2016 New Revision: 308592 URL: https://svnweb.freebsd.org/changeset/base/308592 Log: MFC r308055: Add vdev_reopening support to vdev_geom. It allows to avoid extra GEOM providers flapping without significant need. Since GEOM got resize support, we don't need to reopen provider to get new size. If provider was orphaned and no longer valid, ZFS should already know that, and in such case reopen should be done in full as expected. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Nov 12 23:39:08 2016 (r308591) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sat Nov 12 23:40:40 2016 (r308592) @@ -778,7 +778,14 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi return (EINVAL); } - vd->vdev_tsd = NULL; + /* + * Reopen the device if it's not currently open. Otherwise, + * just update the physical size of the device. + */ + if ((cp = vd->vdev_tsd) != NULL) { + ASSERT(vd->vdev_reopening); + goto skip_open; + } DROP_GIANT(); g_topology_lock(); @@ -863,6 +870,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; return (error); } +skip_open: pp = cp->provider; /* @@ -898,6 +906,9 @@ static void vdev_geom_close(vdev_t *vd) { + if (vd->vdev_reopening) + return; + DROP_GIANT(); g_topology_lock(); vdev_geom_close_locked(vd); From owner-svn-src-all@freebsd.org Sat Nov 12 23:50:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D610C3DE0E; Sat, 12 Nov 2016 23:50:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 424541D5B; Sat, 12 Nov 2016 23:50:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACNomDv083650; Sat, 12 Nov 2016 23:50:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACNomTt083649; Sat, 12 Nov 2016 23:50:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611122350.uACNomTt083649@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Nov 2016 23:50:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308593 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 23:50:49 -0000 Author: mav Date: Sat Nov 12 23:50:48 2016 New Revision: 308593 URL: https://svnweb.freebsd.org/changeset/base/308593 Log: MFC r308169: Pass to zvol_log_truncate() same sync values as to zvol_log_write(). Surplus marking of TX_TRUNCATE records as sync could result in putting them into ZIL before previous writes if ones were async. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Nov 12 23:40:40 2016 (r308592) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Nov 12 23:50:48 2016 (r308593) @@ -1670,7 +1670,7 @@ zvol_strategy(struct bio *bp) if (error != 0) { dmu_tx_abort(tx); } else { - zvol_log_truncate(zv, tx, off, resid, B_TRUE); + zvol_log_truncate(zv, tx, off, resid, sync); dmu_tx_commit(tx); error = dmu_free_long_range(zv->zv_objset, ZVOL_OBJ, off, resid); @@ -3114,9 +3114,9 @@ zvol_d_ioctl(struct cdev *dev, u_long cm { zvol_state_t *zv; rl_t *rl; - off_t offset, length, chunk; + off_t offset, length; int i, error; - u_int u; + boolean_t sync; zv = dev->si_drv2; @@ -3154,15 +3154,17 @@ zvol_d_ioctl(struct cdev *dev, u_long cm dmu_tx_t *tx = dmu_tx_create(zv->zv_objset); error = dmu_tx_assign(tx, TXG_WAIT); if (error != 0) { + sync = FALSE; dmu_tx_abort(tx); } else { - zvol_log_truncate(zv, tx, offset, length, B_TRUE); + sync = (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS); + zvol_log_truncate(zv, tx, offset, length, sync); dmu_tx_commit(tx); error = dmu_free_long_range(zv->zv_objset, ZVOL_OBJ, offset, length); } zfs_range_unlock(rl); - if (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS) + if (sync) zil_commit(zv->zv_zilog, ZVOL_OBJ); break; case DIOCGSTRIPESIZE: From owner-svn-src-all@freebsd.org Sat Nov 12 23:52:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C7B4C3E022; Sat, 12 Nov 2016 23:52:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44F2210DA; Sat, 12 Nov 2016 23:52:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACNqdfQ087159; Sat, 12 Nov 2016 23:52:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACNqdRu087158; Sat, 12 Nov 2016 23:52:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611122352.uACNqdRu087158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Nov 2016 23:52:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308594 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 23:52:40 -0000 Author: mav Date: Sat Nov 12 23:52:39 2016 New Revision: 308594 URL: https://svnweb.freebsd.org/changeset/base/308594 Log: MFC r308169: Pass to zvol_log_truncate() same sync values as to zvol_log_write(). Surplus marking of TX_TRUNCATE records as sync could result in putting them into ZIL before previous writes if ones were async. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Nov 12 23:50:48 2016 (r308593) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Nov 12 23:52:39 2016 (r308594) @@ -1649,7 +1649,7 @@ zvol_strategy(struct bio *bp) if (error != 0) { dmu_tx_abort(tx); } else { - zvol_log_truncate(zv, tx, off, resid, B_TRUE); + zvol_log_truncate(zv, tx, off, resid, sync); dmu_tx_commit(tx); error = dmu_free_long_range(zv->zv_objset, ZVOL_OBJ, off, resid); @@ -3093,9 +3093,9 @@ zvol_d_ioctl(struct cdev *dev, u_long cm { zvol_state_t *zv; rl_t *rl; - off_t offset, length, chunk; + off_t offset, length; int i, error; - u_int u; + boolean_t sync; zv = dev->si_drv2; @@ -3133,15 +3133,17 @@ zvol_d_ioctl(struct cdev *dev, u_long cm dmu_tx_t *tx = dmu_tx_create(zv->zv_objset); error = dmu_tx_assign(tx, TXG_WAIT); if (error != 0) { + sync = FALSE; dmu_tx_abort(tx); } else { - zvol_log_truncate(zv, tx, offset, length, B_TRUE); + sync = (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS); + zvol_log_truncate(zv, tx, offset, length, sync); dmu_tx_commit(tx); error = dmu_free_long_range(zv->zv_objset, ZVOL_OBJ, offset, length); } zfs_range_unlock(rl); - if (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS) + if (sync) zil_commit(zv->zv_zilog, ZVOL_OBJ); break; case DIOCGSTRIPESIZE: From owner-svn-src-all@freebsd.org Sat Nov 12 23:53:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4824FC3E0B0; Sat, 12 Nov 2016 23:53:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E32D129A; Sat, 12 Nov 2016 23:53:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACNrc0W087251; Sat, 12 Nov 2016 23:53:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACNrcXK087248; Sat, 12 Nov 2016 23:53:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611122353.uACNrcXK087248@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Nov 2016 23:53:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308595 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 23:53:39 -0000 Author: mav Date: Sat Nov 12 23:53:37 2016 New Revision: 308595 URL: https://svnweb.freebsd.org/changeset/base/308595 Log: MFC r308173: Fix ZIL records ordering when ZVOL opened both with and without FSYNC. Before this an earlier writes to a ZVOL opened without FSYNC could get to ZIL after later writes to the same ZVOL opened with FSYNC. Fix this by replicating functionality of ZPL (zv_sync_cnt equivalent to z_sync_cnt), marking all log records sync if anybody opened the ZVOL with FSYNC. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Sat Nov 12 23:52:39 2016 (r308594) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Sat Nov 12 23:53:37 2016 (r308595) @@ -405,6 +405,7 @@ extern itx_t *zil_itx_create(uint64_t tx extern void zil_itx_destroy(itx_t *itx); extern void zil_itx_assign(zilog_t *zilog, itx_t *itx, dmu_tx_t *tx); +extern void zil_async_to_sync(zilog_t *zilog, uint64_t oid); extern void zil_commit(zilog_t *zilog, uint64_t oid); extern int zil_vdev_offline(const char *osname, void *txarg); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sat Nov 12 23:52:39 2016 (r308594) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sat Nov 12 23:53:37 2016 (r308595) @@ -90,8 +90,6 @@ SYSCTL_INT(_vfs_zfs_trim, OID_AUTO, enab static kmem_cache_t *zil_lwb_cache; -static void zil_async_to_sync(zilog_t *zilog, uint64_t foid); - #define LWB_EMPTY(lwb) ((BP_GET_LSIZE(&lwb->lwb_blk) - \ sizeof (zil_chain_t)) == (lwb->lwb_sz - lwb->lwb_nused)) @@ -1412,7 +1410,7 @@ zil_get_commit_list(zilog_t *zilog) /* * Move the async itxs for a specified object to commit into sync lists. */ -static void +void zil_async_to_sync(zilog_t *zilog, uint64_t foid) { uint64_t otxg, txg; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Nov 12 23:52:39 2016 (r308594) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Nov 12 23:53:37 2016 (r308595) @@ -169,6 +169,7 @@ typedef struct zvol_state { uint32_t zv_open_count[OTYPCNT]; /* open counts */ #endif uint32_t zv_total_opens; /* total open count */ + uint32_t zv_sync_cnt; /* synchronous open count */ zilog_t *zv_zilog; /* ZIL handle */ list_t zv_extents; /* List of extents for dump */ znode_t zv_znode; /* for range locking */ @@ -1437,7 +1438,9 @@ zvol_log_write(zvol_state_t *zv, dmu_tx_ BP_ZERO(&lr->lr_blkptr); itx->itx_private = zv; - itx->itx_sync = sync; + + if (!sync && (zv->zv_sync_cnt == 0)) + itx->itx_sync = B_FALSE; zil_itx_assign(zilog, itx, tx); @@ -2079,7 +2082,7 @@ zvol_log_truncate(zvol_state_t *zv, dmu_ lr->lr_offset = off; lr->lr_length = len; - itx->itx_sync = sync; + itx->itx_sync = (sync || zv->zv_sync_cnt != 0); zil_itx_assign(zilog, itx, tx); } @@ -3071,6 +3074,11 @@ zvol_d_open(struct cdev *dev, int flags, #endif zv->zv_total_opens++; + if (flags & (FSYNC | FDSYNC)) { + zv->zv_sync_cnt++; + if (zv->zv_sync_cnt == 1) + zil_async_to_sync(zv->zv_zilog, ZVOL_OBJ); + } mutex_exit(&zfsdev_state_lock); return (err); out: @@ -3101,6 +3109,8 @@ zvol_d_close(struct cdev *dev, int flags * You may get multiple opens, but only one close. */ zv->zv_total_opens--; + if (flags & (FSYNC | FDSYNC)) + zv->zv_sync_cnt--; if (zv->zv_total_opens == 0) zvol_last_close(zv); From owner-svn-src-all@freebsd.org Sat Nov 12 23:58:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07B63C3E2E0; Sat, 12 Nov 2016 23:58:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D53DF145B; Sat, 12 Nov 2016 23:58:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uACNw8pO087472; Sat, 12 Nov 2016 23:58:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uACNw7Cd087469; Sat, 12 Nov 2016 23:58:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611122358.uACNw7Cd087469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Nov 2016 23:58:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308596 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 23:58:09 -0000 Author: mav Date: Sat Nov 12 23:58:07 2016 New Revision: 308596 URL: https://svnweb.freebsd.org/changeset/base/308596 Log: MFC r308173: Fix ZIL records ordering when ZVOL opened both with and without FSYNC. Before this an earlier writes to a ZVOL opened without FSYNC could get to ZIL after later writes to the same ZVOL opened with FSYNC. Fix this by replicating functionality of ZPL (zv_sync_cnt equivalent to z_sync_cnt), marking all log records sync if anybody opened the ZVOL with FSYNC. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Sat Nov 12 23:53:37 2016 (r308595) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Sat Nov 12 23:58:07 2016 (r308596) @@ -405,6 +405,7 @@ extern itx_t *zil_itx_create(uint64_t tx extern void zil_itx_destroy(itx_t *itx); extern void zil_itx_assign(zilog_t *zilog, itx_t *itx, dmu_tx_t *tx); +extern void zil_async_to_sync(zilog_t *zilog, uint64_t oid); extern void zil_commit(zilog_t *zilog, uint64_t oid); extern int zil_vdev_offline(const char *osname, void *txarg); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sat Nov 12 23:53:37 2016 (r308595) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sat Nov 12 23:58:07 2016 (r308596) @@ -93,8 +93,6 @@ SYSCTL_INT(_vfs_zfs_trim, OID_AUTO, enab static kmem_cache_t *zil_lwb_cache; -static void zil_async_to_sync(zilog_t *zilog, uint64_t foid); - #define LWB_EMPTY(lwb) ((BP_GET_LSIZE(&lwb->lwb_blk) - \ sizeof (zil_chain_t)) == (lwb->lwb_sz - lwb->lwb_nused)) @@ -1415,7 +1413,7 @@ zil_get_commit_list(zilog_t *zilog) /* * Move the async itxs for a specified object to commit into sync lists. */ -static void +void zil_async_to_sync(zilog_t *zilog, uint64_t foid) { uint64_t otxg, txg; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Nov 12 23:53:37 2016 (r308595) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Nov 12 23:58:07 2016 (r308596) @@ -167,6 +167,7 @@ typedef struct zvol_state { uint32_t zv_open_count[OTYPCNT]; /* open counts */ #endif uint32_t zv_total_opens; /* total open count */ + uint32_t zv_sync_cnt; /* synchronous open count */ zilog_t *zv_zilog; /* ZIL handle */ list_t zv_extents; /* List of extents for dump */ znode_t zv_znode; /* for range locking */ @@ -1416,7 +1417,9 @@ zvol_log_write(zvol_state_t *zv, dmu_tx_ BP_ZERO(&lr->lr_blkptr); itx->itx_private = zv; - itx->itx_sync = sync; + + if (!sync && (zv->zv_sync_cnt == 0)) + itx->itx_sync = B_FALSE; zil_itx_assign(zilog, itx, tx); @@ -2058,7 +2061,7 @@ zvol_log_truncate(zvol_state_t *zv, dmu_ lr->lr_offset = off; lr->lr_length = len; - itx->itx_sync = sync; + itx->itx_sync = (sync || zv->zv_sync_cnt != 0); zil_itx_assign(zilog, itx, tx); } @@ -3050,6 +3053,11 @@ zvol_d_open(struct cdev *dev, int flags, #endif zv->zv_total_opens++; + if (flags & (FSYNC | FDSYNC)) { + zv->zv_sync_cnt++; + if (zv->zv_sync_cnt == 1) + zil_async_to_sync(zv->zv_zilog, ZVOL_OBJ); + } mutex_exit(&zfsdev_state_lock); return (err); out: @@ -3080,6 +3088,8 @@ zvol_d_close(struct cdev *dev, int flags * You may get multiple opens, but only one close. */ zv->zv_total_opens--; + if (flags & (FSYNC | FDSYNC)) + zv->zv_sync_cnt--; if (zv->zv_total_opens == 0) zvol_last_close(zv);