From owner-svn-src-head@freebsd.org Sun Aug 18 01:00:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10BE5B6D75; Sun, 18 Aug 2019 01:00:22 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 469zHn6f53z3xFZ; Sun, 18 Aug 2019 01:00:21 +0000 (UTC) (envelope-from eugen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C59FC221C6; Sun, 18 Aug 2019 01:00:21 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7I10LuT027171; Sun, 18 Aug 2019 01:00:21 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7I10LPL027170; Sun, 18 Aug 2019 01:00:21 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201908180100.x7I10LPL027170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Sun, 18 Aug 2019 01:00:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351179 - head/release/picobsd/tinyware/simple_httpd X-SVN-Group: head X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: head/release/picobsd/tinyware/simple_httpd X-SVN-Commit-Revision: 351179 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 01:00:22 -0000 Author: eugen Date: Sun Aug 18 01:00:21 2019 New Revision: 351179 URL: https://svnweb.freebsd.org/changeset/base/351179 Log: simple_httpd was not buildable for some time due to multiple missing "static" keywords and -Werror,-Wmissing-variable-declarations This change adds needed "static" so it builds again with WARNS?=6 No functional changes. MFC after: 1 week Modified: head/release/picobsd/tinyware/simple_httpd/simple_httpd.c Modified: head/release/picobsd/tinyware/simple_httpd/simple_httpd.c ============================================================================== --- head/release/picobsd/tinyware/simple_httpd/simple_httpd.c Sat Aug 17 19:06:05 2019 (r351178) +++ head/release/picobsd/tinyware/simple_httpd/simple_httpd.c Sun Aug 18 01:00:21 2019 (r351179) @@ -48,33 +48,33 @@ #include #include -int http_port = 80; -int daemonize = 1; -int verbose = 0; -int http_sock, con_sock; +static int http_port = 80; +static int daemonize = 1; +static int verbose = 0; +static int http_sock, con_sock; -const char *fetch_mode = NULL; -char homedir[100]; -char logfile[80]; -char *adate(void); -void init_servconnection(void); -void http_date(void); -void http_output(const char *html); -void http_request(void); -void log_line(char *req); -void wait_connection(void); +static const char *fetch_mode = NULL; +static char homedir[100]; +static char logfile[80]; +static char *adate(void); +static void init_servconnection(void); +static void http_date(void); +static void http_output(const char *html); +static void http_request(void); +static void log_line(char *req); +static void wait_connection(void); -struct hostent *hst; -struct sockaddr_in source; +static struct hostent *hst; +static struct sockaddr_in source; /* HTTP basics */ static char httpd_server_ident[] = "Server: FreeBSD/PicoBSD simple_httpd 1.1\r"; static char http_200[] = "HTTP/1.0 200 OK\r"; -const char *default_mime_type = "application/octet-stream"; +static const char *default_mime_type = "application/octet-stream"; -const char *mime_type[][2] = { +static const char *mime_type[][2] = { { "txt", "text/plain" }, { "htm", "text/html" }, { "html", "text/html" }, @@ -83,7 +83,7 @@ const char *mime_type[][2] = { { "mp3", "audio/mpeg" } }; -const int mime_type_max = sizeof(mime_type) / sizeof(mime_type[0]) - 1; +static const int mime_type_max = sizeof(mime_type) / sizeof(mime_type[0]) - 1; /* Two parts, HTTP Header and then HTML */ static const char *http_404[2] = @@ -101,7 +101,7 @@ This server only supports GET and HEAD requests.\n Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 217D7BAFF3; Sun, 18 Aug 2019 04:19:42 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46B3jn6jwnz45WX; Sun, 18 Aug 2019 04:19:41 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C449E24642; Sun, 18 Aug 2019 04:19:41 +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 x7I4Jffo045156; Sun, 18 Aug 2019 04:19:41 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7I4Jf1t045155; Sun, 18 Aug 2019 04:19:41 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908180419.x7I4Jf1t045155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 18 Aug 2019 04:19:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351180 - head/sys/ofed/include/rdma X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/ofed/include/rdma X-SVN-Commit-Revision: 351180 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 04:19:42 -0000 Author: cem Date: Sun Aug 18 04:19:41 2019 New Revision: 351180 URL: https://svnweb.freebsd.org/changeset/base/351180 Log: OFED: Fix accidental double-copy of rdma_sdp.h in r351176 The mistake came about like this: the first attempt to commit was blocked by a pre-commit hook due to missing SVN tags. svn revert doesn't delete new files, I guess. While reapplying the fixed diff, the non-empty target file was just concatenated with the new contents? Ugh. :-( Modified: head/sys/ofed/include/rdma/rdma_sdp.h Modified: head/sys/ofed/include/rdma/rdma_sdp.h ============================================================================== --- head/sys/ofed/include/rdma/rdma_sdp.h Sun Aug 18 01:00:21 2019 (r351179) +++ head/sys/ofed/include/rdma/rdma_sdp.h Sun Aug 18 04:19:41 2019 (r351180) @@ -78,81 +78,3 @@ struct sdp_hah { } __packed; #endif /* _SYS_OFED_INCLUDE_RDMA_RDMA_SDP_H_ */ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2019 Isilon Systems, LLC. - * - * 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. - */ - -#ifndef _SYS_OFED_INCLUDE_RDMA_RDMA_SDP_H_ -#define _SYS_OFED_INCLUDE_RDMA_RDMA_SDP_H_ - -#include -#include - -#include - -union cma_ip_addr { - struct in6_addr ip6; - struct { - __be32 pad[3]; - __be32 addr; - } ip4; -}; - -struct sdp_bsdh { - u8 mid; - u8 flags; - __u16 bufs; - __u32 len; - __u32 mseq; - __u32 mseq_ack; -} __packed; - -struct sdp_hh { - struct sdp_bsdh bsdh; - u8 majv_minv; - u8 ipv_cap; - u8 rsvd1; - u8 max_adverts; - __u32 desremrcvsz; - __u32 localrcvsz; - __u16 port; - __u16 rsvd2; - union cma_ip_addr src_addr; - union cma_ip_addr dst_addr; - u8 rsvd3[IB_CM_REQ_PRIVATE_DATA_SIZE - sizeof(struct sdp_bsdh) - 48]; -} __packed; - -struct sdp_hah { - struct sdp_bsdh bsdh; - u8 majv_minv; - u8 ipv_cap; - u8 rsvd1; - u8 ext_max_adverts; - __u32 actrcvsz; - u8 rsvd2[IB_CM_REP_PRIVATE_DATA_SIZE - sizeof(struct sdp_bsdh) - 8]; -} __packed; - -#endif /* _SYS_OFED_INCLUDE_RDMA_RDMA_SDP_H_ */ From owner-svn-src-head@freebsd.org Sun Aug 18 07:06:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1471BBE09C; Sun, 18 Aug 2019 07:06:33 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46B7QJ6n5Tz4CD1; Sun, 18 Aug 2019 07:06:32 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6FF826490; Sun, 18 Aug 2019 07:06:32 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7I76WA8044825; Sun, 18 Aug 2019 07:06:32 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7I76W8U044822; Sun, 18 Aug 2019 07:06:32 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201908180706.x7I76W8U044822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 18 Aug 2019 07:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351181 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 351181 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 07:06:33 -0000 Author: jeff Date: Sun Aug 18 07:06:31 2019 New Revision: 351181 URL: https://svnweb.freebsd.org/changeset/base/351181 Log: Encapsulate phys_avail manipulation in a set of simple routines. Add a NUMA aware boot time memory allocator that will be used to allocate early domain correct structures. Code partially submitted by gallatin. Reviewed by: gallatin, kib Tested by: pho Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21251 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_phys.c head/sys/vm/vm_phys.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Aug 18 04:19:41 2019 (r351180) +++ head/sys/vm/vm_page.c Sun Aug 18 07:06:31 2019 (r351181) @@ -538,7 +538,7 @@ vm_page_startup(vm_offset_t vaddr) char *list, *listend; vm_offset_t mapped; vm_paddr_t end, high_avail, low_avail, new_end, page_range, size; - vm_paddr_t biggestsize, last_pa, pa; + vm_paddr_t last_pa, pa; u_long pagecount; int biggestone, i, segind; #ifdef WITNESS @@ -548,22 +548,10 @@ vm_page_startup(vm_offset_t vaddr) long ii; #endif - biggestsize = 0; - biggestone = 0; vaddr = round_page(vaddr); - for (i = 0; phys_avail[i + 1]; i += 2) { - phys_avail[i] = round_page(phys_avail[i]); - phys_avail[i + 1] = trunc_page(phys_avail[i + 1]); - } - for (i = 0; phys_avail[i + 1]; i += 2) { - size = phys_avail[i + 1] - phys_avail[i]; - if (size > biggestsize) { - biggestone = i; - biggestsize = size; - } - } - + vm_phys_early_startup(); + biggestone = vm_phys_avail_largest(); end = phys_avail[biggestone+1]; /* @@ -776,7 +764,8 @@ vm_page_startup(vm_offset_t vaddr) * physical pages. */ for (i = 0; phys_avail[i + 1] != 0; i += 2) - vm_phys_add_seg(phys_avail[i], phys_avail[i + 1]); + if (vm_phys_avail_size(i) != 0) + vm_phys_add_seg(phys_avail[i], phys_avail[i + 1]); /* * Initialize the physical memory allocator. Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Sun Aug 18 04:19:41 2019 (r351180) +++ head/sys/vm/vm_phys.c Sun Aug 18 07:06:31 2019 (r351181) @@ -1101,8 +1101,8 @@ vm_phys_free_pages(vm_page_t m, int order) vm_page_t m_buddy; KASSERT(m->order == VM_NFREEORDER, - ("vm_phys_free_pages: page %p has unexpected order %d", - m, m->order)); + ("vm_phys_free_pages: page %p(%p) has unexpected order %d", + m, (void *)m->phys_addr, m->order)); KASSERT(m->pool < VM_NFREEPOOL, ("vm_phys_free_pages: page %p has unexpected pool %d", m, m->pool)); @@ -1499,6 +1499,222 @@ done: vm_phys_enq_range(&m_ret[npages], npages_end - npages, fl, 0); } return (m_ret); +} + +/* + * Return the index of the first unused slot which may be the terminating + * entry. + */ +static int +vm_phys_avail_count(void) +{ + int i; + + for (i = 0; phys_avail[i + 1]; i += 2) + continue; + if (i > PHYS_AVAIL_ENTRIES) + panic("Improperly terminated phys_avail %d entries", i); + + return (i); +} + +/* + * Assert that a phys_avail entry is valid. + */ +static void +vm_phys_avail_check(int i) +{ + if (phys_avail[i] & PAGE_MASK) + panic("Unaligned phys_avail[%d]: %#jx", i, + (intmax_t)phys_avail[i]); + if (phys_avail[i+1] & PAGE_MASK) + panic("Unaligned phys_avail[%d + 1]: %#jx", i, + (intmax_t)phys_avail[i]); + if (phys_avail[i + 1] < phys_avail[i]) + panic("phys_avail[%d] start %#jx < end %#jx", i, + (intmax_t)phys_avail[i], (intmax_t)phys_avail[i+1]); +} + +/* + * Return the index of an overlapping phys_avail entry or -1. + */ +static int +vm_phys_avail_find(vm_paddr_t pa) +{ + int i; + + for (i = 0; phys_avail[i + 1]; i += 2) + if (phys_avail[i] <= pa && phys_avail[i + 1] > pa) + return (i); + return (-1); +} + +/* + * Return the index of the largest entry. + */ +int +vm_phys_avail_largest(void) +{ + vm_paddr_t sz, largesz; + int largest; + int i; + + largest = 0; + largesz = 0; + for (i = 0; phys_avail[i + 1]; i += 2) { + sz = vm_phys_avail_size(i); + if (sz > largesz) { + largesz = sz; + largest = i; + } + } + + return (largest); +} + +vm_paddr_t +vm_phys_avail_size(int i) +{ + + return (phys_avail[i + 1] - phys_avail[i]); +} + +/* + * Split an entry at the address 'pa'. Return zero on success or errno. + */ +static int +vm_phys_avail_split(vm_paddr_t pa, int i) +{ + int cnt; + + vm_phys_avail_check(i); + if (pa <= phys_avail[i] || pa >= phys_avail[i + 1]) + panic("vm_phys_avail_split: invalid address"); + cnt = vm_phys_avail_count(); + if (cnt >= PHYS_AVAIL_ENTRIES) + return (ENOSPC); + memmove(&phys_avail[i + 2], &phys_avail[i], + (cnt - i) * sizeof(phys_avail[0])); + phys_avail[i + 1] = pa; + phys_avail[i + 2] = pa; + vm_phys_avail_check(i); + vm_phys_avail_check(i+2); + + return (0); +} + +/* + * This routine allocates NUMA node specific memory before the page + * allocator is bootstrapped. + */ +vm_paddr_t +vm_phys_early_alloc(int domain, size_t alloc_size) +{ + int i, mem_index, biggestone; + vm_paddr_t pa, mem_start, mem_end, size, biggestsize, align; + + + /* + * Search the mem_affinity array for the biggest address + * range in the desired domain. This is used to constrain + * the phys_avail selection below. + */ + biggestsize = 0; + mem_index = 0; + mem_start = 0; + mem_end = -1; +#ifdef NUMA + if (mem_affinity != NULL) { + for (i = 0; ; i++) { + size = mem_affinity[i].end - mem_affinity[i].start; + if (size == 0) + break; + if (mem_affinity[i].domain != domain) + continue; + if (size > biggestsize) { + mem_index = i; + biggestsize = size; + } + } + mem_start = mem_affinity[mem_index].start; + mem_end = mem_affinity[mem_index].end; + } +#endif + + /* + * Now find biggest physical segment in within the desired + * numa domain. + */ + biggestsize = 0; + biggestone = 0; + for (i = 0; phys_avail[i + 1] != 0; i += 2) { + /* skip regions that are out of range */ + if (phys_avail[i+1] - alloc_size < mem_start || + phys_avail[i+1] > mem_end) + continue; + size = vm_phys_avail_size(i); + if (size > biggestsize) { + biggestone = i; + biggestsize = size; + } + } + alloc_size = round_page(alloc_size); + + /* + * Grab single pages from the front to reduce fragmentation. + */ + if (alloc_size == PAGE_SIZE) { + pa = phys_avail[biggestone]; + phys_avail[biggestone] += PAGE_SIZE; + vm_phys_avail_check(biggestone); + return (pa); + } + + /* + * Naturally align large allocations. + */ + align = phys_avail[biggestone + 1] & (alloc_size - 1); + if (alloc_size + align > biggestsize) + panic("cannot find a large enough size\n"); + if (align != 0 && + vm_phys_avail_split(phys_avail[biggestone + 1] - align, + biggestone) != 0) + /* Wasting memory. */ + phys_avail[biggestone + 1] -= align; + + phys_avail[biggestone + 1] -= alloc_size; + vm_phys_avail_check(biggestone); + pa = phys_avail[biggestone + 1]; + return (pa); +} + +void +vm_phys_early_startup(void) +{ + int i; + + for (i = 0; phys_avail[i + 1] != 0; i += 2) { + phys_avail[i] = round_page(phys_avail[i]); + phys_avail[i + 1] = trunc_page(phys_avail[i + 1]); + } + +#ifdef NUMA + /* Force phys_avail to be split by domain. */ + if (mem_affinity != NULL) { + int idx; + + for (i = 0; mem_affinity[i].end != 0; i++) { + idx = vm_phys_avail_find(mem_affinity[i].start); + if (idx != -1 && + phys_avail[idx] != mem_affinity[i].start) + vm_phys_avail_split(mem_affinity[i].start, idx); + idx = vm_phys_avail_find(mem_affinity[i].end); + if (idx != -1 && + phys_avail[idx] != mem_affinity[i].end) + vm_phys_avail_split(mem_affinity[i].end, idx); + } + } +#endif } #ifdef DDB Modified: head/sys/vm/vm_phys.h ============================================================================== --- head/sys/vm/vm_phys.h Sun Aug 18 04:19:41 2019 (r351180) +++ head/sys/vm/vm_phys.h Sun Aug 18 07:06:31 2019 (r351181) @@ -103,6 +103,11 @@ vm_page_t vm_phys_scan_contig(int domain, u_long npage void vm_phys_set_pool(int pool, vm_page_t m, int order); boolean_t vm_phys_unfree_page(vm_page_t m); int vm_phys_mem_affinity(int f, int t); +vm_paddr_t vm_phys_early_alloc(int domain, size_t alloc_size); +void vm_phys_early_startup(void); +int vm_phys_avail_largest(void); +vm_paddr_t vm_phys_avail_size(int i); + /* * From owner-svn-src-head@freebsd.org Sun Aug 18 07:43:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88E4ABEFCE; Sun, 18 Aug 2019 07:43:16 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46B8Dh31jqz4FSM; Sun, 18 Aug 2019 07:43:16 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A70826BBD; Sun, 18 Aug 2019 07:43:16 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7I7hGMO068270; Sun, 18 Aug 2019 07:43:16 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7I7hG3j068269; Sun, 18 Aug 2019 07:43:16 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201908180743.x7I7hG3j068269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 18 Aug 2019 07:43:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351182 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 351182 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 07:43:16 -0000 Author: jeff Date: Sun Aug 18 07:43:15 2019 New Revision: 351182 URL: https://svnweb.freebsd.org/changeset/base/351182 Log: vm_phys_avail_find is only used on NUMA kernels. Fix a build error. Modified: head/sys/vm/vm_phys.c Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Sun Aug 18 07:06:31 2019 (r351181) +++ head/sys/vm/vm_phys.c Sun Aug 18 07:43:15 2019 (r351182) @@ -1538,6 +1538,7 @@ vm_phys_avail_check(int i) /* * Return the index of an overlapping phys_avail entry or -1. */ +#ifdef NUMA static int vm_phys_avail_find(vm_paddr_t pa) { @@ -1548,6 +1549,7 @@ vm_phys_avail_find(vm_paddr_t pa) return (i); return (-1); } +#endif /* * Return the index of the largest entry. From owner-svn-src-head@freebsd.org Sun Aug 18 08:07:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4974FC04EC; Sun, 18 Aug 2019 08:07:32 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46B8mh16cvz4GYK; Sun, 18 Aug 2019 08:07:32 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 037C926F46; Sun, 18 Aug 2019 08:07:32 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7I87VTc080352; Sun, 18 Aug 2019 08:07:31 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7I87V7B080351; Sun, 18 Aug 2019 08:07:31 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201908180807.x7I87V7B080351@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 18 Aug 2019 08:07:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351183 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 351183 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 08:07:32 -0000 Author: jeff Date: Sun Aug 18 08:07:31 2019 New Revision: 351183 URL: https://svnweb.freebsd.org/changeset/base/351183 Log: Remove unnecessary debugging from r351181 that caused powerpc build to fail. Tested by: make universe TARGETS=powerpc Modified: head/sys/vm/vm_phys.c Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Sun Aug 18 07:43:15 2019 (r351182) +++ head/sys/vm/vm_phys.c Sun Aug 18 08:07:31 2019 (r351183) @@ -1101,8 +1101,8 @@ vm_phys_free_pages(vm_page_t m, int order) vm_page_t m_buddy; KASSERT(m->order == VM_NFREEORDER, - ("vm_phys_free_pages: page %p(%p) has unexpected order %d", - m, (void *)m->phys_addr, m->order)); + ("vm_phys_free_pages: page %p has unexpected order %d", + m, m->order)); KASSERT(m->pool < VM_NFREEPOOL, ("vm_phys_free_pages: page %p has unexpected pool %d", m, m->pool)); From owner-svn-src-head@freebsd.org Sun Aug 18 08:08:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67BF0C05B1; Sun, 18 Aug 2019 08:08:57 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46B8pK270Nz4Ggy; Sun, 18 Aug 2019 08:08:57 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A8B826F47; Sun, 18 Aug 2019 08:08:57 +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 x7I88udF080451; Sun, 18 Aug 2019 08:08:56 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7I88uwS080448; Sun, 18 Aug 2019 08:08:56 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201908180808.x7I88uwS080448@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 18 Aug 2019 08:08:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351184 - in head/sys/dev: extres/syscon fdt X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys/dev: extres/syscon fdt X-SVN-Commit-Revision: 351184 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 08:08:57 -0000 Author: mmel Date: Sun Aug 18 08:08:56 2019 New Revision: 351184 URL: https://svnweb.freebsd.org/changeset/base/351184 Log: Add method for getting of syscon handle from parent device. If simple multifuction device also provides syscon interface, its childern should be able to consume it. Due to this: - declare coresponding method in syscon interface - implement it in simple multifunction device driver MFC after: 1 week Modified: head/sys/dev/extres/syscon/syscon.c head/sys/dev/extres/syscon/syscon_if.m head/sys/dev/fdt/simple_mfd.c Modified: head/sys/dev/extres/syscon/syscon.c ============================================================================== --- head/sys/dev/extres/syscon/syscon.c Sun Aug 18 08:07:31 2019 (r351183) +++ head/sys/dev/extres/syscon/syscon.c Sun Aug 18 08:08:56 2019 (r351184) @@ -254,3 +254,14 @@ syscon_get_by_ofw_property(device_t cdev, phandle_t cn return (0); } #endif + +int +syscon_get_handle_default(device_t dev, struct syscon **syscon) +{ + device_t parent; + + parent = device_get_parent(dev); + if (parent == NULL) + return (ENODEV); + return (SYSCON_GET_HANDLE(parent, syscon)); +} Modified: head/sys/dev/extres/syscon/syscon_if.m ============================================================================== --- head/sys/dev/extres/syscon/syscon_if.m Sun Aug 18 08:07:31 2019 (r351183) +++ head/sys/dev/extres/syscon/syscon_if.m Sun Aug 18 08:08:56 2019 (r351184) @@ -32,6 +32,7 @@ INTERFACE syscon; HEADER { struct syscon; + int syscon_get_handle_default(device_t dev, struct syscon **syscon); } METHOD int init { @@ -62,3 +63,11 @@ METHOD int modify_4 { uint32_t clear_bits; uint32_t set_bits; }; + +/** + * Get syscon handle from parent driver + */ +METHOD int get_handle { + device_t dev; + struct syscon **syscon; +} DEFAULT syscon_get_handle_default; Modified: head/sys/dev/fdt/simple_mfd.c ============================================================================== --- head/sys/dev/fdt/simple_mfd.c Sun Aug 18 08:07:31 2019 (r351183) +++ head/sys/dev/fdt/simple_mfd.c Sun Aug 18 08:08:56 2019 (r351184) @@ -49,14 +49,16 @@ __FBSDID("$FreeBSD$"); device_t simple_mfd_add_device(device_t dev, phandle_t node, u_int order, const char *name, int unit, struct simplebus_devinfo *di); -struct simplebus_devinfo *simple_mfd_setup_dinfo(device_t dev, phandle_t node, struct simplebus_devinfo *di); +struct simplebus_devinfo *simple_mfd_setup_dinfo(device_t dev, phandle_t node, + struct simplebus_devinfo *di); #include "syscon_if.h" #include MALLOC_DECLARE(M_SYSCON); -static uint32_t simple_mfd_syscon_read_4(struct syscon *syscon, bus_size_t offset); +static uint32_t simple_mfd_syscon_read_4(struct syscon *syscon, + bus_size_t offset); static int simple_mfd_syscon_write_4(struct syscon *syscon, bus_size_t offset, uint32_t val); static int simple_mfd_syscon_modify_4(struct syscon *syscon, bus_size_t offset, @@ -125,7 +127,18 @@ simple_mfd_syscon_modify_4(struct syscon *syscon, bus_ SYSCON_UNLOCK(sc); return (0); } +static int +simple_mfd_syscon_get_handle(device_t dev, struct syscon **syscon) +{ + struct simple_mfd_softc *sc; + sc = device_get_softc(dev); + *syscon = sc->syscon; + if (syscon == NULL) + return (ENODEV); + return (0); +} + static int simple_mfd_probe(device_t dev) { @@ -278,6 +291,8 @@ simple_mfd_add_device(device_t dev, phandle_t node, u_ } static device_method_t simple_mfd_methods[] = { + /* syscon interface */ + DEVMETHOD(syscon_get_handle, simple_mfd_syscon_get_handle), /* Device interface */ DEVMETHOD(device_probe, simple_mfd_probe), DEVMETHOD(device_attach, simple_mfd_attach), From owner-svn-src-head@freebsd.org Sun Aug 18 08:09:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 94C31C0625 for ; Sun, 18 Aug 2019 08:09:26 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46B8ps6LcLz4GqK for ; Sun, 18 Aug 2019 08:09:25 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pl1-x629.google.com with SMTP id y1so4298938plp.9 for ; Sun, 18 Aug 2019 01:09:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jroberson-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=yaXljaTcEfaHgl1YA25H3IOmdKwfYSN/hHch6EBU0so=; b=yexld+qfRaiA04uBoVoPXEIKI1w0+7YgRDOV77mczKzScTkqDgEIBUiBRO9QP+NARl lz5v+e4PutnMmyOG6qwprKMVrPogf6Zs5c47Z/Fai2YzAw8dazFhGKH0OKBtpQ7G7Zp/ 7z+U8woXW7ikT/uxg2rFF2aJXkuA025j62BlMof/nOJOSyVnhML8w+haG352/hcu526I hubgWseECDabgKjV7fT0JFnMfIaiovguZ1DAW6kPXy+8Ma4CLiSMHuyb12oKhDThL0yE tnRioyD8gbEHjFAoVyWm3GBva2kORDj7Rv6KRTm9ew0KBJuk49XC9bJgCW1p1KFkKimq eE/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=yaXljaTcEfaHgl1YA25H3IOmdKwfYSN/hHch6EBU0so=; b=q0sLRfu18306bSR9KA+UQPaL3HotzuniXuUSi9BSa46qV6CsJgTbtUaaTYKxkPZz76 mOccjPycyj7/5CVtKPQ4iqzBoav8olPb+EAwP1a3vJ2Z/f7zHpP1gx6wAEymR5bdzxBu CSuS0JvwnJTCkwwoEuCQnUtCX5IVCdDlZKD3nbwcT76n1ypf8MLy5qu2h2zvTsati+5M pGEqn2JDGbyL82j1ja6E4LL9ThLncDeosjTR7xTtoVTzYvtFIO5qoxf4L8QwmjynC7iD +ZwnRblBWybpJ5owiSsqP6lx8VCilmRkIdOxbs/A06uxb6Hte/pBP/EVS/hw33WPv6qL hViA== X-Gm-Message-State: APjAAAXckhanV5TonHcbzg3zXDQVDsJEQZagjBaRRKwY6FZkCJbkSX1q /IkiambP+tPxjfIoggte5wRjiw== X-Google-Smtp-Source: APXvYqzOrepUL2WtlioA++PexuoZekHwJV7lhjbUyV+0Lo8yMKua8ugjPFRVjHW6a0U50USlaqf4oA== X-Received: by 2002:a17:902:2d03:: with SMTP id o3mr10719581plb.96.1566115764149; Sun, 18 Aug 2019 01:09:24 -0700 (PDT) Received: from rrcs-76-81-105-82.west.biz.rr.com (rrcs-76-81-105-82.west.biz.rr.com. [76.81.105.82]) by smtp.gmail.com with ESMTPSA id y14sm21545688pfq.85.2019.08.18.01.09.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Aug 2019 01:09:23 -0700 (PDT) Date: Sat, 17 Aug 2019 22:05:48 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Jeff Roberson cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351183 - head/sys/vm In-Reply-To: <201908180807.x7I87V7B080351@repo.freebsd.org> Message-ID: References: <201908180807.x7I87V7B080351@repo.freebsd.org> User-Agent: Alpine 2.21.9999 (BSF 287 2018-06-16) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 46B8ps6LcLz4GqK X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=jroberson-net.20150623.gappssmtp.com header.s=20150623 header.b=yexld+qf; dmarc=none; spf=none (mx1.freebsd.org: domain of jroberson@jroberson.net has no SPF policy when checking 2607:f8b0:4864:20::629) smtp.mailfrom=jroberson@jroberson.net X-Spamd-Result: default: False [-5.70 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[jroberson-net.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[jroberson.net]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[jroberson-net.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.99)[-0.993,0]; RCVD_IN_DNSWL_NONE(0.00)[9.2.6.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-2.91)[ip: (-9.16), ipnet: 2607:f8b0::/32(-2.95), asn: 15169(-2.38), country: US(-0.05)] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 08:09:26 -0000 On Sun, 18 Aug 2019, Jeff Roberson wrote: > Author: jeff > Date: Sun Aug 18 08:07:31 2019 > New Revision: 351183 > URL: https://svnweb.freebsd.org/changeset/base/351183 > > Log: > Remove unnecessary debugging from r351181 that caused powerpc build to fail. I'm not sure how I made such a mess of this. I have built universe multiple times on this branch since the phys_avail changes were so extensive. I must've made some error in the process of breaking it into commitable pieces and addressing review feedback. I will be more careful with my next set of commits. Sorry for any trouble. Thanks, Jeff > > Tested by: make universe TARGETS=powerpc > > Modified: > head/sys/vm/vm_phys.c > > Modified: head/sys/vm/vm_phys.c > ============================================================================== > --- head/sys/vm/vm_phys.c Sun Aug 18 07:43:15 2019 (r351182) > +++ head/sys/vm/vm_phys.c Sun Aug 18 08:07:31 2019 (r351183) > @@ -1101,8 +1101,8 @@ vm_phys_free_pages(vm_page_t m, int order) > vm_page_t m_buddy; > > KASSERT(m->order == VM_NFREEORDER, > - ("vm_phys_free_pages: page %p(%p) has unexpected order %d", > - m, (void *)m->phys_addr, m->order)); > + ("vm_phys_free_pages: page %p has unexpected order %d", > + m, m->order)); > KASSERT(m->pool < VM_NFREEPOOL, > ("vm_phys_free_pages: page %p has unexpected pool %d", > m, m->pool)); > From owner-svn-src-head@freebsd.org Sun Aug 18 08:54:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E5EE3C1320; Sun, 18 Aug 2019 08:54:10 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46B9pV5m9yz4JVj; Sun, 18 Aug 2019 08:54:10 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A774127859; Sun, 18 Aug 2019 08:54:10 +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 x7I8sAPd009694; Sun, 18 Aug 2019 08:54:10 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7I8sA8m009693; Sun, 18 Aug 2019 08:54:10 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201908180854.x7I8sA8m009693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 18 Aug 2019 08:54:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351185 - head/sys/dev/mmc/host X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/mmc/host X-SVN-Commit-Revision: 351185 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 08:54:11 -0000 Author: mmel Date: Sun Aug 18 08:54:10 2019 New Revision: 351185 URL: https://svnweb.freebsd.org/changeset/base/351185 Log: Enhance support of extres in dwmmc driver. Handle all clocks, regulators and resets defined by dwmmc bindings. MFC after: 2 weeks Modified: head/sys/dev/mmc/host/dwmmc.c head/sys/dev/mmc/host/dwmmc_var.h Modified: head/sys/dev/mmc/host/dwmmc.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc.c Sun Aug 18 08:08:56 2019 (r351184) +++ head/sys/dev/mmc/host/dwmmc.c Sun Aug 18 08:54:10 2019 (r351185) @@ -454,8 +454,45 @@ parse_fdt(struct dwmmc_softc *sc) } #ifdef EXT_RESOURCES + + /* IP block reset is optional */ + error = hwreset_get_by_ofw_name(sc->dev, 0, "reset", &sc->hwreset); + if (error != 0 && error != ENOENT) { + device_printf(sc->dev, "Cannot get reset\n"); + goto fail; + } + + /* vmmc regulator is optional */ + error = regulator_get_by_ofw_property(sc->dev, 0, "vmmc-supply", + &sc->vmmc); + if (error != 0 && error != ENOENT) { + device_printf(sc->dev, "Cannot get regulator 'vmmc-supply'\n"); + goto fail; + } + + /* vqmmc regulator is optional */ + error = regulator_get_by_ofw_property(sc->dev, 0, "vqmmc-supply", + &sc->vqmmc); + if (error != 0 && error != ENOENT) { + device_printf(sc->dev, "Cannot get regulator 'vqmmc-supply'\n"); + goto fail; + } + + /* Assert reset first */ + if (sc->hwreset != NULL) { + error = hwreset_assert(sc->hwreset); + if (error != 0) { + device_printf(sc->dev, "Cannot assert reset\n"); + goto fail; + } + } + /* BIU (Bus Interface Unit clock) is optional */ error = clk_get_by_ofw_name(sc->dev, 0, "biu", &sc->biu); + if (error != 0 && error != ENOENT) { + device_printf(sc->dev, "Cannot get 'biu' clock\n"); + goto fail; + } if (sc->biu) { error = clk_enable(sc->biu); if (error != 0) { @@ -469,19 +506,32 @@ parse_fdt(struct dwmmc_softc *sc) * if no clock-frequency property is given */ error = clk_get_by_ofw_name(sc->dev, 0, "ciu", &sc->ciu); + if (error != 0 && error != ENOENT) { + device_printf(sc->dev, "Cannot get 'ciu'clock\n"); + goto fail; + } if (sc->ciu) { - error = clk_enable(sc->ciu); - if (error != 0) { - device_printf(sc->dev, "cannot enable ciu clock\n"); - goto fail; - } if (bus_hz != 0) { error = clk_set_freq(sc->ciu, bus_hz, 0); if (error != 0) device_printf(sc->dev, "cannot set ciu clock to %u\n", bus_hz); } + error = clk_enable(sc->ciu); + if (error != 0) { + device_printf(sc->dev, "cannot enable ciu clock\n"); + goto fail; + } clk_get_freq(sc->ciu, &sc->bus_hz); + } + + /* Take dwmmc out of reset */ + if (sc->hwreset != NULL) { + error = hwreset_deassert(sc->hwreset); + if (error != 0) { + device_printf(sc->dev, "Cannot deassert reset\n"); + goto fail; + } } #endif /* EXT_RESOURCES */ Modified: head/sys/dev/mmc/host/dwmmc_var.h ============================================================================== --- head/sys/dev/mmc/host/dwmmc_var.h Sun Aug 18 08:08:56 2019 (r351184) +++ head/sys/dev/mmc/host/dwmmc_var.h Sun Aug 18 08:54:10 2019 (r351185) @@ -35,6 +35,8 @@ #ifdef EXT_RESOURCES #include +#include +#include #endif enum { @@ -83,6 +85,9 @@ struct dwmmc_softc { #ifdef EXT_RESOURCES clk_t biu; clk_t ciu; + hwreset_t hwreset; + regulator_t vmmc; + regulator_t vqmmc; #endif }; From owner-svn-src-head@freebsd.org Sun Aug 18 09:11:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8FAFC1BC0; Sun, 18 Aug 2019 09:11:43 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BBBl50NCz4KMQ; Sun, 18 Aug 2019 09:11:43 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E3E827A8F; Sun, 18 Aug 2019 09:11:43 +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 x7I9Bhof018714; Sun, 18 Aug 2019 09:11:43 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7I9Bhts018713; Sun, 18 Aug 2019 09:11:43 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201908180911.x7I9Bhts018713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 18 Aug 2019 09:11:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351186 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 351186 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 09:11:43 -0000 Author: mmel Date: Sun Aug 18 09:11:43 2019 New Revision: 351186 URL: https://svnweb.freebsd.org/changeset/base/351186 Log: Improve rk_i2c driver: - Properly handle IIC_M_NOSTOP and IIC_M_NOSTART flags. - add polling mode, so driver can be used even if interrupts are not enabled (this is necessary for proper support of PMICs). - add support for RK3288 MFC after: 2 weeks Modified: head/sys/arm64/rockchip/rk_i2c.c Modified: head/sys/arm64/rockchip/rk_i2c.c ============================================================================== --- head/sys/arm64/rockchip/rk_i2c.c Sun Aug 18 08:54:10 2019 (r351185) +++ head/sys/arm64/rockchip/rk_i2c.c Sun Aug 18 09:11:43 2019 (r351186) @@ -46,9 +46,7 @@ __FBSDID("$FreeBSD$"); #include "iicbus_if.h" -#include "opt_soc.h" - #define RK_I2C_CON 0x00 #define RK_I2C_CON_EN (1 << 0) #define RK_I2C_CON_MODE_SHIFT 1 @@ -61,6 +59,7 @@ __FBSDID("$FreeBSD$"); #define RK_I2C_CON_STOP (1 << 4) #define RK_I2C_CON_LASTACK (1 << 5) #define RK_I2C_CON_NAKSTOP (1 << 6) +#define RK_I2C_CON_CTRL_MASK 0xFF #define RK_I2C_CLKDIV 0x04 #define RK_I2C_CLKDIVL_MASK 0xFFFF @@ -91,8 +90,7 @@ __FBSDID("$FreeBSD$"); #define RK_I2C_IEN_STARTIEN (1 << 4) #define RK_I2C_IEN_STOPIEN (1 << 5) #define RK_I2C_IEN_NAKRCVIEN (1 << 6) -#define RK_I2C_IEN_ALL (RK_I2C_IEN_BTFIEN | \ - RK_I2C_IEN_BRFIEN | RK_I2C_IEN_MBTFIEN | RK_I2C_IEN_MBRFIEN | \ +#define RK_I2C_IEN_ALL (RK_I2C_IEN_MBTFIEN | RK_I2C_IEN_MBRFIEN | \ RK_I2C_IEN_STARTIEN | RK_I2C_IEN_STOPIEN | RK_I2C_IEN_NAKRCVIEN) #define RK_I2C_IPD 0x1C @@ -103,8 +101,7 @@ __FBSDID("$FreeBSD$"); #define RK_I2C_IPD_STARTIPD (1 << 4) #define RK_I2C_IPD_STOPIPD (1 << 5) #define RK_I2C_IPD_NAKRCVIPD (1 << 6) -#define RK_I2C_IPD_ALL (RK_I2C_IPD_BTFIPD | \ - RK_I2C_IPD_BRFIPD | RK_I2C_IPD_MBTFIPD | RK_I2C_IPD_MBRFIPD | \ +#define RK_I2C_IPD_ALL (RK_I2C_IPD_MBTFIPD | RK_I2C_IPD_MBRFIPD | \ RK_I2C_IPD_STARTIPD | RK_I2C_IPD_STOPIPD | RK_I2C_IPD_NAKRCVIPD) #define RK_I2C_FNCT 0x20 @@ -134,8 +131,10 @@ struct rk_i2c_softc { uint32_t ipd; struct iic_msg *msg; size_t cnt; - int transfer_done; - int nak_recv; + int msg_len; + bool transfer_done; + bool nak_recv; + bool tx_slave_addr; uint8_t mode; uint8_t state; @@ -143,12 +142,9 @@ struct rk_i2c_softc { }; static struct ofw_compat_data compat_data[] = { -#ifdef SOC_ROCKCHIP_RK3328 + {"rockchip,rk3288-i2c", 1}, {"rockchip,rk3328-i2c", 1}, -#endif -#ifdef SOC_ROCKCHIP_RK3399 {"rockchip,rk3399-i2c", 1}, -#endif {NULL, 0} }; @@ -169,7 +165,7 @@ static int rk_i2c_detach(device_t dev); #define RK_I2C_WRITE(sc, reg, val) bus_write_4((sc)->res[0], (reg), (val)) static uint32_t -rk_i2c_get_clkdiv(struct rk_i2c_softc *sc, uint64_t speed) +rk_i2c_get_clkdiv(struct rk_i2c_softc *sc, uint32_t speed) { uint64_t sclk_freq; uint32_t clkdiv; @@ -213,7 +209,7 @@ rk_i2c_reset(device_t dev, u_char speed, u_char addr, return (0); } -static void +static uint8_t rk_i2c_fill_tx(struct rk_i2c_softc *sc) { uint32_t buf32; @@ -221,7 +217,7 @@ rk_i2c_fill_tx(struct rk_i2c_softc *sc) int i, j, len; if (sc->msg == NULL || sc->msg->len == sc->cnt) - return; + return (0); len = sc->msg->len - sc->cnt; if (len > 8) @@ -234,22 +230,23 @@ rk_i2c_fill_tx(struct rk_i2c_softc *sc) break; /* Fill the addr if needed */ - if (sc->cnt == 0) { + if (sc->cnt == 0 && sc->tx_slave_addr) { buf = sc->msg->slave; + sc->tx_slave_addr = false; + } else { + buf = sc->msg->buf[sc->cnt]; + sc->cnt++; } - else - buf = sc->msg->buf[sc->cnt - 1]; - buf32 |= buf << (j * 8); - sc->cnt++; } - RK_I2C_WRITE(sc, RK_I2C_TXDATA_BASE + 4 * i, buf32); if (sc->cnt == sc->msg->len) break; } + + return (uint8_t)len; } static void @@ -274,29 +271,11 @@ rk_i2c_drain_rx(struct rk_i2c_softc *sc) buf32 = RK_I2C_READ(sc, RK_I2C_RXDATA_BASE + (i / 4) * 4); buf8 = (buf32 >> ((i % 4) * 8)) & 0xFF; - sc->msg->buf[sc->cnt++] = buf8; } } static void -rk_i2c_send_start(struct rk_i2c_softc *sc) -{ - uint32_t reg; - - RK_I2C_WRITE(sc, RK_I2C_IEN, RK_I2C_IEN_STARTIEN); - - sc->state = STATE_START; - - reg = RK_I2C_READ(sc, RK_I2C_CON); - reg |= RK_I2C_CON_START; - reg |= RK_I2C_CON_EN; - reg &= ~RK_I2C_CON_MODE_MASK; - reg |= sc->mode << RK_I2C_CON_MODE_SHIFT; - RK_I2C_WRITE(sc, RK_I2C_CON, reg); -} - -static void rk_i2c_send_stop(struct rk_i2c_softc *sc) { uint32_t reg; @@ -311,18 +290,29 @@ rk_i2c_send_stop(struct rk_i2c_softc *sc) } static void -rk_i2c_intr(void *arg) +rk_i2c_intr_locked(struct rk_i2c_softc *sc) { - struct rk_i2c_softc *sc; uint32_t reg; - sc = (struct rk_i2c_softc *)arg; + sc->ipd = RK_I2C_READ(sc, RK_I2C_IPD); - RK_I2C_LOCK(sc); + /* Something to handle? */ + if ((sc->ipd & RK_I2C_IPD_ALL) == 0) + return; - sc->ipd = RK_I2C_READ(sc, RK_I2C_IPD); RK_I2C_WRITE(sc, RK_I2C_IPD, sc->ipd); + sc->ipd &= RK_I2C_IPD_ALL; + if (sc->ipd & RK_I2C_IPD_NAKRCVIPD) { + /* NACK received */ + sc->ipd &= ~RK_I2C_IPD_NAKRCVIPD; + sc->nak_recv = 1; + /* XXXX last byte !!!, signal error !!! */ + sc->transfer_done = 1; + sc->state = STATE_IDLE; + goto err; + } + switch (sc->state) { case STATE_START: /* Disable start bit */ @@ -359,10 +349,12 @@ rk_i2c_intr(void *arg) break; case STATE_WRITE: - if (sc->cnt == sc->msg->len) + if (sc->cnt == sc->msg->len && + !(sc->msg->flags & IIC_M_NOSTOP)) { rk_i2c_send_stop(sc); - - break; + break; + } + /* passthru */ case STATE_STOP: /* Disable stop bit */ reg = RK_I2C_READ(sc, RK_I2C_CON); @@ -376,77 +368,177 @@ rk_i2c_intr(void *arg) break; } +err: wakeup(sc); +} + +static void +rk_i2c_intr(void *arg) +{ + struct rk_i2c_softc *sc; + + sc = (struct rk_i2c_softc *)arg; + + RK_I2C_LOCK(sc); + rk_i2c_intr_locked(sc); RK_I2C_UNLOCK(sc); } +static void +rk_i2c_start_xfer(struct rk_i2c_softc *sc, struct iic_msg *msg, boolean_t last) +{ + uint32_t reg; + uint8_t len; + + sc->transfer_done = false; + sc->nak_recv = false; + sc->tx_slave_addr = false; + sc->cnt = 0; + sc->state = STATE_IDLE; + sc->msg = msg; + sc->msg_len = sc->msg->len; + + reg = RK_I2C_READ(sc, RK_I2C_CON) & ~RK_I2C_CON_CTRL_MASK; + if (!(sc->msg->flags & IIC_M_NOSTART)) { + /* Stadard message */ + if (sc->mode == RK_I2C_CON_MODE_TX) { + sc->msg_len++; /* Take slave address in account. */ + sc->tx_slave_addr = true; + } + sc->state = STATE_START; + reg |= RK_I2C_CON_START; + + RK_I2C_WRITE(sc, RK_I2C_IEN, RK_I2C_IEN_STARTIEN); + } else { + /* Continuation message */ + if (sc->mode == RK_I2C_CON_MODE_RX) { + sc->state = STATE_READ; + if (last) + reg |= RK_I2C_CON_LASTACK; + + RK_I2C_WRITE(sc, RK_I2C_MRXCNT, sc->msg->len); + RK_I2C_WRITE(sc, RK_I2C_IEN, RK_I2C_IEN_MBRFIEN | + RK_I2C_IEN_NAKRCVIEN); + } else { + sc->state = STATE_WRITE; + len = rk_i2c_fill_tx(sc); + + RK_I2C_WRITE(sc, RK_I2C_MTXCNT, len); + + RK_I2C_WRITE(sc, RK_I2C_IEN, RK_I2C_IEN_MBTFIEN | + RK_I2C_IEN_NAKRCVIEN); + } + } + reg |= sc->mode << RK_I2C_CON_MODE_SHIFT; + reg |= RK_I2C_CON_EN; + RK_I2C_WRITE(sc, RK_I2C_CON, reg); +} + static int rk_i2c_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) { struct rk_i2c_softc *sc; uint32_t reg; - int i, j, msgskip, err = 0; + bool last_msg; + int i, j, timeout, err; sc = device_get_softc(dev); + RK_I2C_LOCK(sc); + while (sc->busy) mtx_sleep(sc, &sc->mtx, 0, "i2cbuswait", 0); - sc->busy = 1; - err = clk_enable(sc->pclk); - if (err != 0) { - device_printf(dev, "cannot enable pclk clock\n"); - goto out; - } - err = clk_enable(sc->sclk); - if (err != 0) { - device_printf(dev, "cannot enable i2c clock\n"); - goto out; - } + /* Disable the module and interrupts */ + RK_I2C_WRITE(sc, RK_I2C_CON, 0); + RK_I2C_WRITE(sc, RK_I2C_IEN, 0); - RK_I2C_LOCK(sc); - /* Clean stale interrupts */ RK_I2C_WRITE(sc, RK_I2C_IPD, RK_I2C_IPD_ALL); - for (i = 0; i < nmsgs; i += msgskip) { - if (nmsgs - i >= 2 && !(msgs[i].flags & IIC_M_RD) && - msgs[i + 1].flags & IIC_M_RD && msgs[i].len <= 4) { + err = 0; + for (i = 0; i < nmsgs; i++) { + /* Validate parameters. */ + if (msgs == NULL || msgs[i].buf == NULL || + msgs[i].len == 0) { + err = EINVAL; + break; + } + /* + * If next message have NOSTART flag, then they both + * should be same type (read/write) and same address. + */ + if (i < nmsgs - 1) { + if ((msgs[i + 1].flags & IIC_M_NOSTART) && + ((msgs[i].flags & IIC_M_RD) != + (msgs[i + 1].flags & IIC_M_RD) || + (msgs[i].slave != msgs[i + 1].slave))) { + err = EINVAL; + break; + } + } + /* + * Detect simple register read case. + * The first message should be IIC_M_WR | IIC_M_NOSTOP, + * next pure IIC_M_RD (no other flags allowed). Both + * messages should have same slave address. + */ + + if (nmsgs - i >= 2 && msgs[i].len < 4 && + msgs[i].flags == (IIC_M_WR | IIC_M_NOSTOP) && + msgs[i + 1].flags == IIC_M_RD && + (msgs[i].slave & ~LSB) == (msgs[i + 1].slave & ~LSB)) { sc->mode = RK_I2C_CON_MODE_RRX; - msgskip = 2; - sc->msg = &msgs[i + 1]; /* Write slave address */ - reg = msgs[i].slave | RK_I2C_MRXADDR_VALID(0); + reg = msgs[i].slave & ~LSB; + reg |= RK_I2C_MRXADDR_VALID(0); RK_I2C_WRITE(sc, RK_I2C_MRXADDR, reg); + /* Write slave register address */ - for (j = 0, reg = 0; j < msgs[i].len; j++) { + reg = 0; + for (j = 0; j < msgs[i].len ; j++) { reg |= (msgs[i].buf[j] & 0xff) << (j * 8); reg |= RK_I2C_MRXADDR_VALID(j); } - RK_I2C_WRITE(sc, RK_I2C_MRXRADDR, reg); + + i++; } else { if (msgs[i].flags & IIC_M_RD) { - sc->mode = RK_I2C_CON_MODE_RX; - msgs[i].slave |= LSB; - } - else { + if (msgs[i].flags & IIC_M_NOSTART) { + sc->mode = RK_I2C_CON_MODE_RX; + } else { + sc->mode = RK_I2C_CON_MODE_RRX; + reg = msgs[i].slave & LSB; + reg |= RK_I2C_MRXADDR_VALID(0); + RK_I2C_WRITE(sc, RK_I2C_MRXADDR, reg); + RK_I2C_WRITE(sc, RK_I2C_MRXRADDR, 0); + } + } else { sc->mode = RK_I2C_CON_MODE_TX; - msgs[i].slave &= ~LSB; } - msgskip = 1; - sc->msg = &msgs[i]; } + /* last message ? */ + last_msg = (i > nmsgs - 1) || + !(msgs[i + 1].flags & IIC_M_NOSTART); + rk_i2c_start_xfer(sc, msgs + i, last_msg); - sc->transfer_done = 0; - sc->cnt = 0; - sc->state = STATE_IDLE; - rk_i2c_send_start(sc); - - while (err == 0 && sc->transfer_done != 1) { - err = msleep(sc, &sc->mtx, 0, "rk_i2c", 10 * hz); + if (cold) { + for(timeout = 10000; timeout > 0; timeout--) { + rk_i2c_intr_locked(sc); + if (sc->transfer_done != 0) + break; + DELAY(100); + } + if (timeout <= 0) + err = ETIMEDOUT; + } else { + while (err == 0 && sc->transfer_done != 1) { + err = msleep(sc, &sc->mtx, PZERO, "rk_i2c", + 10 * hz); + } } } @@ -457,19 +549,6 @@ rk_i2c_transfer(device_t dev, struct iic_msg *msgs, ui sc->busy = 0; RK_I2C_UNLOCK(sc); - - err = clk_disable(sc->pclk); - if (err != 0) { - device_printf(dev, "cannot enable pclk clock\n"); - goto out; - } - err = clk_disable(sc->sclk); - if (err != 0) { - device_printf(dev, "cannot enable i2c clock\n"); - goto out; - } - -out: return (err); } @@ -519,10 +598,23 @@ rk_i2c_attach(device_t dev) device_printf(dev, "cannot get i2c clock\n"); goto fail; } - error = clk_get_by_ofw_name(dev, 0, "pclk", &sc->pclk); + error = clk_enable(sc->sclk); if (error != 0) { + device_printf(dev, "cannot enable i2c clock\n"); + goto fail; + } + /* pclk clock is optional. */ + error = clk_get_by_ofw_name(dev, 0, "pclk", &sc->pclk); + if (error != 0 && error != ENOENT) { device_printf(dev, "cannot get pclk clock\n"); goto fail; + } + if (sc->sclk != NULL) { + error = clk_enable(sc->sclk); + if (error != 0) { + device_printf(dev, "cannot enable pclk clock\n"); + goto fail; + } } sc->iicbus = device_add_child(dev, "iicbus", -1); From owner-svn-src-head@freebsd.org Sun Aug 18 09:19:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3170C1E2E; Sun, 18 Aug 2019 09:19:33 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BBMn6Pprz4KgW; Sun, 18 Aug 2019 09:19:33 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BCD3A27BE9; Sun, 18 Aug 2019 09:19:33 +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 x7I9JXl1021326; Sun, 18 Aug 2019 09:19:33 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7I9JXGj021325; Sun, 18 Aug 2019 09:19:33 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201908180919.x7I9JXGj021325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 18 Aug 2019 09:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351187 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 351187 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 09:19:33 -0000 Author: mmel Date: Sun Aug 18 09:19:33 2019 New Revision: 351187 URL: https://svnweb.freebsd.org/changeset/base/351187 Log: Improve rk_pinctrl driver: - add support for 'output-low', 'output-high', 'output-low' and 'output-enable' properties. These are use in RK3288 DT files - add support for RK3288 - to reduce overall file size, use local macros for initialization of pinctrl description structures. MFC after: 2 weeks Modified: head/sys/arm64/rockchip/rk_pinctrl.c Modified: head/sys/arm64/rockchip/rk_pinctrl.c ============================================================================== --- head/sys/arm64/rockchip/rk_pinctrl.c Sun Aug 18 09:11:43 2019 (r351186) +++ head/sys/arm64/rockchip/rk_pinctrl.c Sun Aug 18 09:19:33 2019 (r351187) @@ -34,11 +34,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include -#include -#include #include +#include #include +#include #include #include @@ -53,10 +54,9 @@ __FBSDID("$FreeBSD$"); #include +#include "gpio_if.h" #include "syscon_if.h" -#include "opt_soc.h" - struct rk_pinctrl_pin_drive { uint32_t bank; uint32_t subbank; @@ -66,8 +66,8 @@ struct rk_pinctrl_pin_drive { }; struct rk_pinctrl_bank { - uint32_t bank_num; - uint32_t subbank_num; + uint32_t bank; + uint32_t subbank; uint32_t offset; uint32_t nbits; }; @@ -81,6 +81,13 @@ struct rk_pinctrl_pin_fixup { uint32_t mask; }; +struct rk_pinctrl_gpio { + uint32_t bank; + char *gpio_name; + device_t gpio_dev; +}; + + struct rk_pinctrl_softc; struct rk_pinctrl_conf { @@ -90,8 +97,10 @@ struct rk_pinctrl_conf { uint32_t npin_fixup; struct rk_pinctrl_pin_drive *pin_drive; uint32_t npin_drive; - uint32_t (*get_pd_offset)(struct rk_pinctrl_softc *, uint32_t); - struct syscon *(*get_syscon)(struct rk_pinctrl_softc *, uint32_t); + struct rk_pinctrl_gpio *gpio_bank; + uint32_t ngpio_bank; + uint32_t (*get_pd_offset)(struct rk_pinctrl_softc *, uint32_t); + struct syscon *(*get_syscon)(struct rk_pinctrl_softc *, uint32_t); }; struct rk_pinctrl_softc { @@ -102,218 +111,392 @@ struct rk_pinctrl_softc { struct rk_pinctrl_conf *conf; }; +#define RK_IOMUX(_bank, _subbank, _offset, _nbits) \ +{ \ + .bank = _bank, \ + .subbank = _subbank, \ + .offset = _offset, \ + .nbits = _nbits, \ +} + +#define RK_PINFIX(_bank, _pin, _reg, _bit, _mask) \ +{ \ + .bank = _bank, \ + .pin = _pin, \ + .reg = _reg, \ + .bit = _bit, \ + .mask = _mask, \ +} + +#define RK_PINDRIVE(_bank, _subbank, _offset, _value, _ma) \ +{ \ + .bank = _bank, \ + .subbank = _subbank, \ + .offset = _offset, \ + .value = _value, \ + .ma = _ma, \ +} +#define RK_GPIO(_bank, _name) \ +{ \ + .bank = _bank, \ + .gpio_name = _name, \ +} + +static struct rk_pinctrl_gpio rk3288_gpio_bank[] = { + RK_GPIO(0, "gpio0"), + RK_GPIO(1, "gpio1"), + RK_GPIO(2, "gpio2"), + RK_GPIO(3, "gpio3"), + RK_GPIO(4, "gpio4"), + RK_GPIO(5, "gpio5"), + RK_GPIO(6, "gpio6"), + RK_GPIO(7, "gpio7"), + RK_GPIO(8, "gpio8"), +}; + +static struct rk_pinctrl_bank rk3288_iomux_bank[] = { + /* bank sub offs nbits */ + /* PMU */ + RK_IOMUX(0, 0, 0x0084, 2), + RK_IOMUX(0, 1, 0x0088, 2), + RK_IOMUX(0, 2, 0x008C, 2), + /* GFR */ + RK_IOMUX(1, 3, 0x000C, 2), + RK_IOMUX(2, 0, 0x0010, 2), + RK_IOMUX(2, 1, 0x0014, 2), + RK_IOMUX(2, 2, 0x0018, 2), + RK_IOMUX(2, 3, 0x001C, 2), + RK_IOMUX(3, 0, 0x0020, 2), + RK_IOMUX(3, 1, 0x0024, 2), + RK_IOMUX(3, 2, 0x0028, 2), + RK_IOMUX(3, 3, 0x002C, 4), + RK_IOMUX(4, 0, 0x0034, 4), + RK_IOMUX(4, 1, 0x003C, 4), + RK_IOMUX(4, 2, 0x0044, 2), + RK_IOMUX(4, 3, 0x0048, 2), + /* 5,0 - Empty */ + RK_IOMUX(5, 1, 0x0050, 2), + RK_IOMUX(5, 2, 0x0054, 2), + /* 5,3 - Empty */ + RK_IOMUX(6, 0, 0x005C, 2), + RK_IOMUX(6, 1, 0x0060, 2), + RK_IOMUX(6, 2, 0x0064, 2), + /* 6,3 - Empty */ + RK_IOMUX(7, 0, 0x006C, 2), + RK_IOMUX(7, 1, 0x0070, 2), + RK_IOMUX(7, 2, 0x0074, 4), + /* 7,3 - Empty */ + RK_IOMUX(8, 0, 0x0080, 2), + RK_IOMUX(8, 1, 0x0084, 2), + /* 8,2 - Empty */ + /* 8,3 - Empty */ + +}; + +static struct rk_pinctrl_pin_fixup rk3288_pin_fixup[] = { +}; + +static struct rk_pinctrl_pin_drive rk3288_pin_drive[] = { + /* bank sub offs val ma */ + /* GPIO0A (PMU)*/ + RK_PINDRIVE(0, 0, 0x070, 0, 2), + RK_PINDRIVE(0, 0, 0x070, 1, 4), + RK_PINDRIVE(0, 0, 0x070, 2, 8), + RK_PINDRIVE(0, 0, 0x070, 3, 12), + + /* GPIO0B (PMU)*/ + RK_PINDRIVE(0, 1, 0x074, 0, 2), + RK_PINDRIVE(0, 1, 0x074, 1, 4), + RK_PINDRIVE(0, 1, 0x074, 2, 8), + RK_PINDRIVE(0, 1, 0x074, 3, 12), + + /* GPIO0C (PMU)*/ + RK_PINDRIVE(0, 2, 0x078, 0, 2), + RK_PINDRIVE(0, 2, 0x078, 1, 4), + RK_PINDRIVE(0, 2, 0x078, 2, 8), + RK_PINDRIVE(0, 2, 0x078, 3, 12), + + /* GPIO1D */ + RK_PINDRIVE(1, 3, 0x1CC, 0, 2), + RK_PINDRIVE(1, 3, 0x1CC, 1, 4), + RK_PINDRIVE(1, 3, 0x1CC, 2, 8), + RK_PINDRIVE(1, 3, 0x1CC, 3, 12), + + /* GPIO2A */ + RK_PINDRIVE(2, 0, 0x1D0, 0, 2), + RK_PINDRIVE(2, 0, 0x1D0, 1, 4), + RK_PINDRIVE(2, 0, 0x1D0, 2, 8), + RK_PINDRIVE(2, 0, 0x1D0, 3, 12), + + /* GPIO2B */ + RK_PINDRIVE(2, 1, 0x1D4, 0, 2), + RK_PINDRIVE(2, 1, 0x1D4, 1, 4), + RK_PINDRIVE(2, 1, 0x1D4, 2, 8), + RK_PINDRIVE(2, 1, 0x1D4, 3, 12), + + /* GPIO2C */ + RK_PINDRIVE(2, 2, 0x1D8, 0, 2), + RK_PINDRIVE(2, 2, 0x1D8, 1, 4), + RK_PINDRIVE(2, 2, 0x1D8, 2, 8), + RK_PINDRIVE(2, 2, 0x1D8, 3, 12), + + /* GPIO2D */ + RK_PINDRIVE(2, 3, 0x1DC, 0, 2), + RK_PINDRIVE(2, 3, 0x1DC, 1, 4), + RK_PINDRIVE(2, 3, 0x1DC, 2, 8), + RK_PINDRIVE(2, 3, 0x1DC, 3, 12), + + /* GPIO3A */ + RK_PINDRIVE(3, 0, 0x1E0, 0, 2), + RK_PINDRIVE(3, 0, 0x1E0, 1, 4), + RK_PINDRIVE(3, 0, 0x1E0, 2, 8), + RK_PINDRIVE(3, 0, 0x1E0, 3, 12), + + /* GPIO3B */ + RK_PINDRIVE(3, 1, 0x1E4, 0, 2), + RK_PINDRIVE(3, 1, 0x1E4, 1, 4), + RK_PINDRIVE(3, 1, 0x1E4, 2, 8), + RK_PINDRIVE(3, 1, 0x1E4, 3, 12), + + /* GPIO3C */ + RK_PINDRIVE(3, 2, 0x1E8, 0, 2), + RK_PINDRIVE(3, 2, 0x1E8, 1, 4), + RK_PINDRIVE(3, 2, 0x1E8, 2, 8), + RK_PINDRIVE(3, 2, 0x1E8, 3, 12), + + /* GPIO3D */ + RK_PINDRIVE(3, 3, 0x1EC, 0, 2), + RK_PINDRIVE(3, 3, 0x1EC, 1, 4), + RK_PINDRIVE(3, 3, 0x1EC, 2, 8), + RK_PINDRIVE(3, 3, 0x1EC, 3, 12), + + /* GPIO4A */ + RK_PINDRIVE(4, 0, 0x1F0, 0, 2), + RK_PINDRIVE(4, 0, 0x1F0, 1, 4), + RK_PINDRIVE(4, 0, 0x1F0, 2, 8), + RK_PINDRIVE(4, 0, 0x1F0, 3, 12), + + /* GPIO4B */ + RK_PINDRIVE(4, 1, 0x1F4, 0, 2), + RK_PINDRIVE(4, 1, 0x1F4, 1, 4), + RK_PINDRIVE(4, 1, 0x1F4, 2, 8), + RK_PINDRIVE(4, 1, 0x1F4, 3, 12), + + /* GPIO4C */ + RK_PINDRIVE(4, 2, 0x1F8, 0, 2), + RK_PINDRIVE(4, 2, 0x1F8, 1, 4), + RK_PINDRIVE(4, 2, 0x1F8, 2, 8), + RK_PINDRIVE(4, 2, 0x1F8, 3, 12), + + /* GPIO4D */ + RK_PINDRIVE(4, 3, 0x1FC, 0, 2), + RK_PINDRIVE(4, 3, 0x1FC, 1, 4), + RK_PINDRIVE(4, 3, 0x1FC, 2, 8), + RK_PINDRIVE(4, 3, 0x1FC, 3, 12), + + /* GPIO5B */ + RK_PINDRIVE(5, 1, 0x204, 0, 2), + RK_PINDRIVE(5, 1, 0x204, 1, 4), + RK_PINDRIVE(5, 1, 0x204, 2, 8), + RK_PINDRIVE(5, 1, 0x204, 3, 12), + + /* GPIO5C */ + RK_PINDRIVE(5, 2, 0x208, 0, 2), + RK_PINDRIVE(5, 2, 0x208, 1, 4), + RK_PINDRIVE(5, 2, 0x208, 2, 8), + RK_PINDRIVE(5, 2, 0x208, 3, 12), + + /* GPIO6A */ + RK_PINDRIVE(6, 0, 0x210, 0, 2), + RK_PINDRIVE(6, 0, 0x210, 1, 4), + RK_PINDRIVE(6, 0, 0x210, 2, 8), + RK_PINDRIVE(6, 0, 0x210, 3, 12), + + /* GPIO6B */ + RK_PINDRIVE(6, 1, 0x214, 0, 2), + RK_PINDRIVE(6, 1, 0x214, 1, 4), + RK_PINDRIVE(6, 1, 0x214, 2, 8), + RK_PINDRIVE(6, 1, 0x214, 3, 12), + + /* GPIO6C */ + RK_PINDRIVE(6, 2, 0x218, 0, 2), + RK_PINDRIVE(6, 2, 0x218, 1, 4), + RK_PINDRIVE(6, 2, 0x218, 2, 8), + RK_PINDRIVE(6, 2, 0x218, 3, 12), + + /* GPIO7A */ + RK_PINDRIVE(7, 0, 0x220, 0, 2), + RK_PINDRIVE(7, 0, 0x220, 1, 4), + RK_PINDRIVE(7, 0, 0x220, 2, 8), + RK_PINDRIVE(7, 0, 0x220, 3, 12), + + /* GPIO7B */ + RK_PINDRIVE(7, 1, 0x224, 0, 2), + RK_PINDRIVE(7, 1, 0x224, 1, 4), + RK_PINDRIVE(7, 1, 0x224, 2, 8), + RK_PINDRIVE(7, 1, 0x224, 3, 12), + + /* GPIO7C */ + RK_PINDRIVE(7, 2, 0x228, 0, 2), + RK_PINDRIVE(7, 2, 0x228, 1, 4), + RK_PINDRIVE(7, 2, 0x228, 2, 8), + RK_PINDRIVE(7, 2, 0x228, 3, 12), + + /* GPIO8A */ + RK_PINDRIVE(8, 0, 0x230, 0, 2), + RK_PINDRIVE(8, 0, 0x230, 1, 4), + RK_PINDRIVE(8, 0, 0x230, 2, 8), + RK_PINDRIVE(8, 0, 0x230, 3, 12), + + /* GPIO8B */ + RK_PINDRIVE(8, 1, 0x234, 0, 2), + RK_PINDRIVE(8, 1, 0x234, 1, 4), + RK_PINDRIVE(8, 1, 0x234, 2, 8), + RK_PINDRIVE(8, 1, 0x234, 3, 12), +}; + +static uint32_t +rk3288_get_pd_offset(struct rk_pinctrl_softc *sc, uint32_t bank) +{ + if (bank == 0) + return (0x064); /* PMU */ + return (0x130); +} + +static struct syscon * +rk3288_get_syscon(struct rk_pinctrl_softc *sc, uint32_t bank) +{ + if (bank == 0) + return (sc->pmu); + return (sc->grf); +} + +struct rk_pinctrl_conf rk3288_conf = { + .iomux_conf = rk3288_iomux_bank, + .iomux_nbanks = nitems(rk3288_iomux_bank), + .pin_fixup = rk3288_pin_fixup, + .npin_fixup = nitems(rk3288_pin_fixup), + .pin_drive = rk3288_pin_drive, + .npin_drive = nitems(rk3288_pin_drive), + .gpio_bank = rk3288_gpio_bank, + .ngpio_bank = nitems(rk3288_gpio_bank), + .get_pd_offset = rk3288_get_pd_offset, + .get_syscon = rk3288_get_syscon, +}; + static struct rk_pinctrl_bank rk3328_iomux_bank[] = { - { - .bank_num = 0, - .subbank_num = 0, - .offset = 0x00, - .nbits = 2, - }, - { - .bank_num = 0, - .subbank_num = 1, - .offset = 0x04, - .nbits = 2, - }, - { - .bank_num = 0, - .subbank_num = 2, - .offset = 0x08, - .nbits = 2, - }, - { - .bank_num = 0, - .subbank_num = 3, - .offset = 0xc, - .nbits = 2, - }, - { - .bank_num = 1, - .subbank_num = 0, - .offset = 0x10, - .nbits = 2, - }, - { - .bank_num = 1, - .subbank_num = 1, - .offset = 0x14, - .nbits = 2, - }, - { - .bank_num = 1, - .subbank_num = 2, - .offset = 0x18, - .nbits = 2, - }, - { - .bank_num = 1, - .subbank_num = 3, - .offset = 0x1C, - .nbits = 2, - }, - { - .bank_num = 2, - .subbank_num = 0, - .offset = 0x20, - .nbits = 2, - }, - { - .bank_num = 2, - .subbank_num = 1, - .offset = 0x24, - .nbits = 3, - }, - { - .bank_num = 2, - .subbank_num = 2, - .offset = 0x2c, - .nbits = 3, - }, - { - .bank_num = 2, - .subbank_num = 3, - .offset = 0x34, - .nbits = 2, - }, - { - .bank_num = 3, - .subbank_num = 0, - .offset = 0x38, - .nbits = 3, - }, - { - .bank_num = 3, - .subbank_num = 1, - .offset = 0x40, - .nbits = 3, - }, - { - .bank_num = 3, - .subbank_num = 2, - .offset = 0x48, - .nbits = 2, - }, - { - .bank_num = 3, - .subbank_num = 3, - .offset = 0x4c, - .nbits = 2, - }, + /* bank sub offs nbits */ + RK_IOMUX(0, 0, 0x0000, 2), + RK_IOMUX(0, 1, 0x0004, 2), + RK_IOMUX(0, 2, 0x0008, 2), + RK_IOMUX(0, 3, 0x000C, 2), + RK_IOMUX(1, 0, 0x0010, 2), + RK_IOMUX(1, 1, 0x0014, 2), + RK_IOMUX(1, 2, 0x0018, 2), + RK_IOMUX(1, 3, 0x001C, 2), + RK_IOMUX(2, 0, 0xE000, 2), + RK_IOMUX(2, 1, 0xE004, 2), + RK_IOMUX(2, 2, 0xE008, 2), + RK_IOMUX(2, 3, 0xE00C, 2), + RK_IOMUX(3, 0, 0xE010, 2), + RK_IOMUX(3, 1, 0xE014, 2), + RK_IOMUX(3, 2, 0xE018, 2), + RK_IOMUX(3, 3, 0xE01C, 2), + RK_IOMUX(4, 0, 0xE020, 2), + RK_IOMUX(4, 1, 0xE024, 2), + RK_IOMUX(4, 2, 0xE028, 2), + RK_IOMUX(4, 3, 0xE02C, 2), }; static struct rk_pinctrl_pin_fixup rk3328_pin_fixup[] = { - { - .bank = 2, - .pin = 12, - .reg = 0x24, - .bit = 8, - .mask = 0x300, - }, - { - .bank = 2, - .pin = 15, - .reg = 0x28, - .bit = 0, - .mask = 0x7, - }, - { - .bank = 2, - .pin = 23, - .reg = 0x30, - .bit = 14, - .mask = 0x6000, - }, + /* bank pin reg bit mask */ + RK_PINFIX(2, 12, 0x24, 8, 0x300), + RK_PINFIX(2, 15, 0x28, 0, 0x7), + RK_PINFIX(2, 23, 0x30, 14, 0x6000), }; -#define RK_PINDRIVE(_bank, _subbank, _offset, _value, _ma) \ - { \ - .bank = _bank, \ - .subbank = _subbank, \ - .offset = _offset, \ - .value = _value, \ - .ma = _ma, \ - }, static struct rk_pinctrl_pin_drive rk3328_pin_drive[] = { - RK_PINDRIVE(0, 0, 0x200, 0, 2) - RK_PINDRIVE(0, 0, 0x200, 1, 4) - RK_PINDRIVE(0, 0, 0x200, 2, 8) - RK_PINDRIVE(0, 0, 0x200, 3, 12) + /* bank sub offs val ma */ + RK_PINDRIVE(0, 0, 0x200, 0, 2), + RK_PINDRIVE(0, 0, 0x200, 1, 4), + RK_PINDRIVE(0, 0, 0x200, 2, 8), + RK_PINDRIVE(0, 0, 0x200, 3, 12), - RK_PINDRIVE(0, 1, 0x204, 0, 2) - RK_PINDRIVE(0, 1, 0x204, 1, 4) - RK_PINDRIVE(0, 1, 0x204, 2, 8) - RK_PINDRIVE(0, 1, 0x204, 3, 12) + RK_PINDRIVE(0, 1, 0x204, 0, 2), + RK_PINDRIVE(0, 1, 0x204, 1, 4), + RK_PINDRIVE(0, 1, 0x204, 2, 8), + RK_PINDRIVE(0, 1, 0x204, 3, 12), - RK_PINDRIVE(0, 2, 0x208, 0, 2) - RK_PINDRIVE(0, 2, 0x208, 1, 4) - RK_PINDRIVE(0, 2, 0x208, 2, 8) - RK_PINDRIVE(0, 2, 0x208, 3, 12) + RK_PINDRIVE(0, 2, 0x208, 0, 2), + RK_PINDRIVE(0, 2, 0x208, 1, 4), + RK_PINDRIVE(0, 2, 0x208, 2, 8), + RK_PINDRIVE(0, 2, 0x208, 3, 12), - RK_PINDRIVE(0, 3, 0x20C, 0, 2) - RK_PINDRIVE(0, 3, 0x20C, 1, 4) - RK_PINDRIVE(0, 3, 0x20C, 2, 8) - RK_PINDRIVE(0, 3, 0x20C, 3, 12) + RK_PINDRIVE(0, 3, 0x20C, 0, 2), + RK_PINDRIVE(0, 3, 0x20C, 1, 4), + RK_PINDRIVE(0, 3, 0x20C, 2, 8), + RK_PINDRIVE(0, 3, 0x20C, 3, 12), - RK_PINDRIVE(1, 0, 0x210, 0, 2) - RK_PINDRIVE(1, 0, 0x210, 1, 4) - RK_PINDRIVE(1, 0, 0x210, 2, 8) - RK_PINDRIVE(1, 0, 0x210, 3, 12) + RK_PINDRIVE(1, 0, 0x210, 0, 2), + RK_PINDRIVE(1, 0, 0x210, 1, 4), + RK_PINDRIVE(1, 0, 0x210, 2, 8), + RK_PINDRIVE(1, 0, 0x210, 3, 12), - RK_PINDRIVE(1, 1, 0x214, 0, 2) - RK_PINDRIVE(1, 1, 0x214, 1, 4) - RK_PINDRIVE(1, 1, 0x214, 2, 8) - RK_PINDRIVE(1, 1, 0x214, 3, 12) + RK_PINDRIVE(1, 1, 0x214, 0, 2), + RK_PINDRIVE(1, 1, 0x214, 1, 4), + RK_PINDRIVE(1, 1, 0x214, 2, 8), + RK_PINDRIVE(1, 1, 0x214, 3, 12), - RK_PINDRIVE(1, 2, 0x218, 0, 2) - RK_PINDRIVE(1, 2, 0x218, 1, 4) - RK_PINDRIVE(1, 2, 0x218, 2, 8) - RK_PINDRIVE(1, 2, 0x218, 3, 12) + RK_PINDRIVE(1, 2, 0x218, 0, 2), + RK_PINDRIVE(1, 2, 0x218, 1, 4), + RK_PINDRIVE(1, 2, 0x218, 2, 8), + RK_PINDRIVE(1, 2, 0x218, 3, 12), - RK_PINDRIVE(1, 3, 0x21C, 0, 2) - RK_PINDRIVE(1, 3, 0x21C, 1, 4) - RK_PINDRIVE(1, 3, 0x21C, 2, 8) - RK_PINDRIVE(1, 3, 0x21C, 3, 12) + RK_PINDRIVE(1, 3, 0x21C, 0, 2), + RK_PINDRIVE(1, 3, 0x21C, 1, 4), + RK_PINDRIVE(1, 3, 0x21C, 2, 8), + RK_PINDRIVE(1, 3, 0x21C, 3, 12), - RK_PINDRIVE(2, 0, 0x220, 0, 2) - RK_PINDRIVE(2, 0, 0x220, 1, 4) - RK_PINDRIVE(2, 0, 0x220, 2, 8) - RK_PINDRIVE(2, 0, 0x220, 3, 12) + RK_PINDRIVE(2, 0, 0x220, 0, 2), + RK_PINDRIVE(2, 0, 0x220, 1, 4), + RK_PINDRIVE(2, 0, 0x220, 2, 8), + RK_PINDRIVE(2, 0, 0x220, 3, 12), - RK_PINDRIVE(2, 1, 0x224, 0, 2) - RK_PINDRIVE(2, 1, 0x224, 1, 4) - RK_PINDRIVE(2, 1, 0x224, 2, 8) - RK_PINDRIVE(2, 1, 0x224, 3, 12) + RK_PINDRIVE(2, 1, 0x224, 0, 2), + RK_PINDRIVE(2, 1, 0x224, 1, 4), + RK_PINDRIVE(2, 1, 0x224, 2, 8), + RK_PINDRIVE(2, 1, 0x224, 3, 12), - RK_PINDRIVE(2, 2, 0x228, 0, 2) - RK_PINDRIVE(2, 2, 0x228, 1, 4) - RK_PINDRIVE(2, 2, 0x228, 2, 8) - RK_PINDRIVE(2, 2, 0x228, 3, 12) + RK_PINDRIVE(2, 2, 0x228, 0, 2), + RK_PINDRIVE(2, 2, 0x228, 1, 4), + RK_PINDRIVE(2, 2, 0x228, 2, 8), + RK_PINDRIVE(2, 2, 0x228, 3, 12), - RK_PINDRIVE(2, 3, 0x22C, 0, 2) - RK_PINDRIVE(2, 3, 0x22C, 1, 4) - RK_PINDRIVE(2, 3, 0x22C, 2, 8) - RK_PINDRIVE(2, 3, 0x22C, 3, 12) + RK_PINDRIVE(2, 3, 0x22C, 0, 2), + RK_PINDRIVE(2, 3, 0x22C, 1, 4), + RK_PINDRIVE(2, 3, 0x22C, 2, 8), + RK_PINDRIVE(2, 3, 0x22C, 3, 12), - RK_PINDRIVE(3, 0, 0x230, 0, 2) - RK_PINDRIVE(3, 0, 0x230, 1, 4) - RK_PINDRIVE(3, 0, 0x230, 2, 8) - RK_PINDRIVE(3, 0, 0x230, 3, 12) + RK_PINDRIVE(3, 0, 0x230, 0, 2), + RK_PINDRIVE(3, 0, 0x230, 1, 4), + RK_PINDRIVE(3, 0, 0x230, 2, 8), + RK_PINDRIVE(3, 0, 0x230, 3, 12), - RK_PINDRIVE(3, 1, 0x234, 0, 2) - RK_PINDRIVE(3, 1, 0x234, 1, 4) - RK_PINDRIVE(3, 1, 0x234, 2, 8) - RK_PINDRIVE(3, 1, 0x234, 3, 12) + RK_PINDRIVE(3, 1, 0x234, 0, 2), + RK_PINDRIVE(3, 1, 0x234, 1, 4), + RK_PINDRIVE(3, 1, 0x234, 2, 8), + RK_PINDRIVE(3, 1, 0x234, 3, 12), - RK_PINDRIVE(3, 2, 0x238, 0, 2) - RK_PINDRIVE(3, 2, 0x238, 1, 4) - RK_PINDRIVE(3, 2, 0x238, 2, 8) - RK_PINDRIVE(3, 2, 0x238, 3, 12) + RK_PINDRIVE(3, 2, 0x238, 0, 2), + RK_PINDRIVE(3, 2, 0x238, 1, 4), + RK_PINDRIVE(3, 2, 0x238, 2, 8), + RK_PINDRIVE(3, 2, 0x238, 3, 12), - RK_PINDRIVE(3, 3, 0x23C, 0, 2) - RK_PINDRIVE(3, 3, 0x23C, 1, 4) - RK_PINDRIVE(3, 3, 0x23C, 2, 8) - RK_PINDRIVE(3, 3, 0x23C, 3, 12) + RK_PINDRIVE(3, 3, 0x23C, 0, 2), + RK_PINDRIVE(3, 3, 0x23C, 1, 4), + RK_PINDRIVE(3, 3, 0x23C, 2, 8), + RK_PINDRIVE(3, 3, 0x23C, 3, 12), }; static uint32_t @@ -340,166 +523,68 @@ struct rk_pinctrl_conf rk3328_conf = { }; static struct rk_pinctrl_bank rk3399_iomux_bank[] = { - { - .bank_num = 0, - .subbank_num = 0, - .offset = 0x00, - .nbits = 2, - }, - { - .bank_num = 0, - .subbank_num = 1, - .offset = 0x04, - .nbits = 2, - }, - { - .bank_num = 0, - .subbank_num = 2, - .offset = 0x08, - .nbits = 2, - }, - { - .bank_num = 0, - .subbank_num = 3, - .offset = 0x0c, - .nbits = 2, - }, - { - .bank_num = 1, - .subbank_num = 0, - .offset = 0x10, - .nbits = 2, - }, - { - .bank_num = 1, - .subbank_num = 1, - .offset = 0x14, - .nbits = 2, - }, - { - .bank_num = 1, - .subbank_num = 2, - .offset = 0x18, - .nbits = 2, - }, - { - .bank_num = 1, - .subbank_num = 3, - .offset = 0x1c, - .nbits = 2, - }, - { - .bank_num = 2, - .subbank_num = 0, - .offset = 0xe000, - .nbits = 2, - }, - { - .bank_num = 2, - .subbank_num = 1, - .offset = 0xe004, - .nbits = 2, - }, - { - .bank_num = 2, - .subbank_num = 2, - .offset = 0xe008, - .nbits = 2, - }, - { - .bank_num = 2, - .subbank_num = 3, - .offset = 0xe00c, - .nbits = 2, - }, - { - .bank_num = 3, - .subbank_num = 0, - .offset = 0xe010, - .nbits = 2, - }, - { - .bank_num = 3, - .subbank_num = 1, - .offset = 0xe014, - .nbits = 2, - }, - { - .bank_num = 3, - .subbank_num = 2, - .offset = 0xe018, - .nbits = 2, - }, - { - .bank_num = 3, - .subbank_num = 3, - .offset = 0xe01c, - .nbits = 2, - }, - { - .bank_num = 4, - .subbank_num = 0, - .offset = 0xe020, - .nbits = 2, - }, - { - .bank_num = 4, - .subbank_num = 1, - .offset = 0xe024, - .nbits = 2, - }, - { - .bank_num = 4, - .subbank_num = 2, - .offset = 0xe028, - .nbits = 2, - }, - { - .bank_num = 4, - .subbank_num = 3, - .offset = 0xe02c, - .nbits = 2, - }, + /* bank sub offs nbits */ + RK_IOMUX(0, 0, 0x0000, 2), + RK_IOMUX(0, 1, 0x0004, 2), + RK_IOMUX(0, 2, 0x0008, 2), + RK_IOMUX(0, 3, 0x000C, 2), + RK_IOMUX(1, 0, 0x0010, 2), + RK_IOMUX(1, 1, 0x0014, 2), + RK_IOMUX(1, 2, 0x0018, 2), + RK_IOMUX(1, 3, 0x000C, 2), + RK_IOMUX(2, 0, 0xE000, 2), + RK_IOMUX(2, 1, 0xE004, 2), + RK_IOMUX(2, 2, 0xE008, 2), + RK_IOMUX(2, 3, 0xE00C, 2), + RK_IOMUX(3, 0, 0xE010, 2), + RK_IOMUX(3, 1, 0xE014, 2), + RK_IOMUX(3, 2, 0xE018, 2), + RK_IOMUX(3, 3, 0xE01C, 2), + RK_IOMUX(4, 0, 0xE020, 2), + RK_IOMUX(4, 1, 0xE024, 2), + RK_IOMUX(4, 2, 0xE028, 2), + RK_IOMUX(4, 3, 0xE02C, 2), }; static struct rk_pinctrl_pin_fixup rk3399_pin_fixup[] = {}; static struct rk_pinctrl_pin_drive rk3399_pin_drive[] = { + /* bank sub offs val ma */ /* GPIO0A */ - RK_PINDRIVE(0, 0, 0x80, 0, 5) - RK_PINDRIVE(0, 0, 0x80, 1, 10) - RK_PINDRIVE(0, 0, 0x80, 2, 15) - RK_PINDRIVE(0, 0, 0x80, 3, 20) + RK_PINDRIVE(0, 0, 0x80, 0, 5), + RK_PINDRIVE(0, 0, 0x80, 1, 10), + RK_PINDRIVE(0, 0, 0x80, 2, 15), + RK_PINDRIVE(0, 0, 0x80, 3, 20), /* GPIOB */ - RK_PINDRIVE(0, 1, 0x88, 0, 5) - RK_PINDRIVE(0, 1, 0x88, 1, 10) - RK_PINDRIVE(0, 1, 0x88, 2, 15) - RK_PINDRIVE(0, 1, 0x88, 3, 20) + RK_PINDRIVE(0, 1, 0x88, 0, 5), + RK_PINDRIVE(0, 1, 0x88, 1, 10), + RK_PINDRIVE(0, 1, 0x88, 2, 15), + RK_PINDRIVE(0, 1, 0x88, 3, 20), /* GPIO1A */ - RK_PINDRIVE(1, 0, 0xA0, 0, 3) - RK_PINDRIVE(1, 0, 0xA0, 1, 6) - RK_PINDRIVE(1, 0, 0xA0, 2, 9) - RK_PINDRIVE(1, 0, 0xA0, 3, 12) + RK_PINDRIVE(1, 0, 0xA0, 0, 3), + RK_PINDRIVE(1, 0, 0xA0, 1, 6), + RK_PINDRIVE(1, 0, 0xA0, 2, 9), + RK_PINDRIVE(1, 0, 0xA0, 3, 12), /* GPIO1B */ - RK_PINDRIVE(1, 1, 0xA8, 0, 3) - RK_PINDRIVE(1, 1, 0xA8, 1, 6) - RK_PINDRIVE(1, 1, 0xA8, 2, 9) - RK_PINDRIVE(1, 1, 0xA8, 3, 12) + RK_PINDRIVE(1, 1, 0xA8, 0, 3), + RK_PINDRIVE(1, 1, 0xA8, 1, 6), + RK_PINDRIVE(1, 1, 0xA8, 2, 9), + RK_PINDRIVE(1, 1, 0xA8, 3, 12), /* GPIO1C */ - RK_PINDRIVE(1, 2, 0xB0, 0, 3) - RK_PINDRIVE(1, 2, 0xB0, 1, 6) - RK_PINDRIVE(1, 2, 0xB0, 2, 9) - RK_PINDRIVE(1, 2, 0xB0, 3, 12) + RK_PINDRIVE(1, 2, 0xB0, 0, 3), + RK_PINDRIVE(1, 2, 0xB0, 1, 6), + RK_PINDRIVE(1, 2, 0xB0, 2, 9), + RK_PINDRIVE(1, 2, 0xB0, 3, 12), /* GPIO1D */ - RK_PINDRIVE(1, 3, 0xB8, 0, 3) - RK_PINDRIVE(1, 3, 0xB8, 1, 6) - RK_PINDRIVE(1, 3, 0xB8, 2, 9) - RK_PINDRIVE(1, 3, 0xB8, 3, 12) + RK_PINDRIVE(1, 3, 0xB8, 0, 3), + RK_PINDRIVE(1, 3, 0xB8, 1, 6), + RK_PINDRIVE(1, 3, 0xB8, 2, 9), + RK_PINDRIVE(1, 3, 0xB8, 3, 12), }; static uint32_t @@ -508,7 +593,7 @@ rk3399_get_pd_offset(struct rk_pinctrl_softc *sc, uint if (bank < 2) return (0x40); - return (0xe040); + return (0xE040); } static struct syscon * @@ -532,12 +617,9 @@ struct rk_pinctrl_conf rk3399_conf = { }; static struct ofw_compat_data compat_data[] = { -#ifdef SOC_ROCKCHIP_RK3328 + {"rockchip,rk3288-pinctrl", (uintptr_t)&rk3288_conf}, {"rockchip,rk3328-pinctrl", (uintptr_t)&rk3328_conf}, -#endif -#ifdef SOC_ROCKCHIP_RK3399 {"rockchip,rk3399-pinctrl", (uintptr_t)&rk3399_conf}, -#endif {NULL, 0} }; @@ -554,7 +636,8 @@ rk_pinctrl_parse_bias(phandle_t node) return (-1); } -static int rk_pinctrl_parse_drive(struct rk_pinctrl_softc *sc, phandle_t node, +static int +rk_pinctrl_parse_drive(struct rk_pinctrl_softc *sc, phandle_t node, uint32_t bank, uint32_t subbank, uint32_t *drive, uint32_t *offset) { uint32_t value; @@ -595,6 +678,91 @@ rk_pinctrl_get_fixup(struct rk_pinctrl_softc *sc, uint } } +static int +rk_pinctrl_handle_io(struct rk_pinctrl_softc *sc, phandle_t node, uint32_t bank, +uint32_t pin) +{ + bool have_cfg, have_direction, have_value; + uint32_t direction_value, pin_value; + struct rk_pinctrl_gpio *gpio; + int i, rv; + + have_cfg = false; + have_direction = false; + have_value = false; + + /* Get (subset of) GPIO pin properties. */ + if (OF_hasprop(node, "output-disable")) { + have_cfg = true; + have_direction = true; + direction_value = GPIO_PIN_INPUT; + } + + if (OF_hasprop(node, "output-enable")) { + have_cfg = true; + have_direction = true; + direction_value = GPIO_PIN_OUTPUT; + } + + if (OF_hasprop(node, "output-low")) { + have_cfg = true; + have_direction = true; + direction_value = GPIO_PIN_OUTPUT; + have_value = true; + pin_value = 0; + } + + if (OF_hasprop(node, "output-high")) { + have_cfg = true; + have_direction = true; + direction_value = GPIO_PIN_OUTPUT; + have_value = true; + pin_value = 1; + } + + if (!have_cfg) + return (0); + + /* Find gpio */ + gpio = NULL; + for(i = 0; i < sc->conf->ngpio_bank; i++) { + if (bank == sc->conf->gpio_bank[i].bank) { + gpio = sc->conf->gpio_bank + i; + break; + } + } + if (gpio == NULL) { + device_printf(sc->dev, "Cannot find GPIO bank %d\n", bank); + return (ENXIO); + } + if (gpio->gpio_dev == NULL) { + device_printf(sc->dev, + "No GPIO subdevice found for bank %d\n", bank); + return (ENXIO); + } + + rv = 0; + if (have_value) { + rv = GPIO_PIN_SET(gpio->gpio_dev, pin, pin_value); + if (rv != 0) { + device_printf(sc->dev, "Cannot set GPIO value: %d\n", + rv); + return (rv); + } + } + + if (have_direction) { + rv = GPIO_PIN_SETFLAGS(gpio->gpio_dev, pin, direction_value); + if (rv != 0) { + device_printf(sc->dev, + "Cannot set GPIO direction: %d\n", rv); + return (rv); + } + } + + return (0); +} + static void rk_pinctrl_configure_pin(struct rk_pinctrl_softc *sc, uint32_t *pindata) { @@ -602,7 +770,7 @@ rk_pinctrl_configure_pin(struct rk_pinctrl_softc *sc, struct syscon *syscon; uint32_t bank, subbank, pin, function, bias; uint32_t bit, mask, reg, drive; - int i; + int i, rv; bank = pindata[0]; pin = pindata[1]; @@ -611,8 +779,8 @@ rk_pinctrl_configure_pin(struct rk_pinctrl_softc *sc, subbank = pin / 8; for (i = 0; i < sc->conf->iomux_nbanks; i++) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Aug 18 11:43:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6953C4B7F; Sun, 18 Aug 2019 11:43:59 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BFZR54ghz4Rs5; Sun, 18 Aug 2019 11:43:59 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FC7D178D; Sun, 18 Aug 2019 11:43:59 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7IBhxqI011256; Sun, 18 Aug 2019 11:43:59 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7IBhxZO011254; Sun, 18 Aug 2019 11:43:59 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201908181143.x7IBhxZO011254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 18 Aug 2019 11:43:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351188 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 351188 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 11:43:59 -0000 Author: jeff Date: Sun Aug 18 11:43:58 2019 New Revision: 351188 URL: https://svnweb.freebsd.org/changeset/base/351188 Log: Add a blocking wait bit to refcount. This allows refs to be used as a simple barrier. Reviewed by: markj, kib Discussed with: jhb Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21254 Modified: head/sys/kern/kern_synch.c head/sys/sys/refcount.h Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Sun Aug 18 09:19:33 2019 (r351187) +++ head/sys/kern/kern_synch.c Sun Aug 18 11:43:58 2019 (r351188) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -331,6 +332,75 @@ pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_ } return (_sleep(&pause_wchan[curcpu], NULL, (flags & C_CATCH) ? PCATCH : 0, wmesg, sbt, pr, flags)); +} + +/* + * Potentially release the last reference for refcount. Check for + * unlikely conditions and signal the caller as to whether it was + * the final ref. + */ +bool +refcount_release_last(volatile u_int *count, u_int n, u_int old) +{ + u_int waiter; + + waiter = old & REFCOUNT_WAITER; + old = REFCOUNT_COUNT(old); + if (__predict_false(n > old || REFCOUNT_SATURATED(old))) { + /* + * Avoid multiple destructor invocations if underflow occurred. + * This is not perfect since the memory backing the containing + * object may already have been reallocated. + */ + _refcount_update_saturated(count); + return (false); + } + + /* + * Attempt to atomically clear the waiter bit. Wakeup waiters + * if we are successful. + */ + if (waiter != 0 && atomic_cmpset_int(count, REFCOUNT_WAITER, 0)) + wakeup(__DEVOLATILE(u_int *, count)); + + /* + * Last reference. Signal the user to call the destructor. + * + * Ensure that the destructor sees all updates. The fence_rel + * at the start of refcount_releasen synchronizes with this fence. + */ + atomic_thread_fence_acq(); + return (true); +} + +/* + * Wait for a refcount wakeup. This does not guarantee that the ref is still + * zero on return and may be subject to transient wakeups. Callers wanting + * a precise answer should use refcount_wait(). + */ +void +refcount_sleep(volatile u_int *count, const char *wmesg, int pri) +{ + void *wchan; + u_int old; + + if (REFCOUNT_COUNT(*count) == 0) + return; + wchan = __DEVOLATILE(void *, count); + sleepq_lock(wchan); + old = *count; + for (;;) { + if (REFCOUNT_COUNT(old) == 0) { + sleepq_release(wchan); + return; + } + if (old & REFCOUNT_WAITER) + break; + if (atomic_fcmpset_int(count, &old, old | REFCOUNT_WAITER)) + break; + } + sleepq_add(wchan, NULL, wmesg, 0, 0); + sleepq_wait(wchan, pri); } /* Modified: head/sys/sys/refcount.h ============================================================================== --- head/sys/sys/refcount.h Sun Aug 18 09:19:33 2019 (r351187) +++ head/sys/sys/refcount.h Sun Aug 18 11:43:58 2019 (r351188) @@ -39,9 +39,15 @@ #define KASSERT(exp, msg) /* */ #endif -#define REFCOUNT_SATURATED(val) (((val) & (1U << 31)) != 0) -#define REFCOUNT_SATURATION_VALUE (3U << 30) +#define REFCOUNT_WAITER (1 << 31) /* Refcount has waiter. */ +#define REFCOUNT_SATURATION_VALUE (3U << 29) +#define REFCOUNT_SATURATED(val) (((val) & (1U << 30)) != 0) +#define REFCOUNT_COUNT(x) ((x) & ~REFCOUNT_WAITER) + +bool refcount_release_last(volatile u_int *count, u_int n, u_int old); +void refcount_sleep(volatile u_int *count, const char *wmesg, int prio); + /* * Attempt to handle reference count overflow and underflow. Force the counter * to stay at the saturation value so that a counter overflow cannot trigger @@ -76,6 +82,19 @@ refcount_acquire(volatile u_int *count) _refcount_update_saturated(count); } +static __inline void +refcount_acquiren(volatile u_int *count, u_int n) +{ + + u_int old; + + KASSERT(n < REFCOUNT_SATURATION_VALUE / 2, + ("refcount_acquiren: n %d too large", n)); + old = atomic_fetchadd_int(count, n); + if (__predict_false(REFCOUNT_SATURATED(old))) + _refcount_update_saturated(count); +} + static __inline __result_use_check bool refcount_acquire_checked(volatile u_int *count) { @@ -91,34 +110,35 @@ refcount_acquire_checked(volatile u_int *count) } static __inline bool -refcount_release(volatile u_int *count) +refcount_releasen(volatile u_int *count, u_int n) { u_int old; + KASSERT(n < REFCOUNT_SATURATION_VALUE / 2, + ("refcount_releasen: n %d too large", n)); atomic_thread_fence_rel(); - old = atomic_fetchadd_int(count, -1); - if (__predict_false(old == 0 || REFCOUNT_SATURATED(old))) { - /* - * Avoid multiple destructor invocations if underflow occurred. - * This is not perfect since the memory backing the containing - * object may already have been reallocated. - */ - _refcount_update_saturated(count); - return (false); - } - if (old > 1) - return (false); + old = atomic_fetchadd_int(count, -n); + if (__predict_false(n >= REFCOUNT_COUNT(old) || + REFCOUNT_SATURATED(old))) + return (refcount_release_last(count, n, old)); + return (false); +} - /* - * Last reference. Signal the user to call the destructor. - * - * Ensure that the destructor sees all updates. The fence_rel - * at the start of the function synchronizes with this fence. - */ - atomic_thread_fence_acq(); - return (true); +static __inline bool +refcount_release(volatile u_int *count) +{ + + return (refcount_releasen(count, 1)); } +static __inline void +refcount_wait(volatile u_int *count, const char *wmesg, int prio) +{ + + while (*count != 0) + refcount_sleep(count, wmesg, prio); +} + /* * This functions returns non-zero if the refcount was * incremented. Else zero is returned. @@ -130,7 +150,7 @@ refcount_acquire_if_not_zero(volatile u_int *count) old = *count; for (;;) { - if (old == 0) + if (REFCOUNT_COUNT(old) == 0) return (false); if (__predict_false(REFCOUNT_SATURATED(old))) return (true); @@ -146,7 +166,7 @@ refcount_release_if_not_last(volatile u_int *count) old = *count; for (;;) { - if (old == 1) + if (REFCOUNT_COUNT(old) == 1) return (false); if (__predict_false(REFCOUNT_SATURATED(old))) return (true); From owner-svn-src-head@freebsd.org Sun Aug 18 15:37:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A089C9FE1; Sun, 18 Aug 2019 15:37:20 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BLlh3Wjfz4fNV; Sun, 18 Aug 2019 15:37:20 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 561F943C8; Sun, 18 Aug 2019 15:37:20 +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 x7IFbKaj048955; Sun, 18 Aug 2019 15:37:20 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7IFbKbo048954; Sun, 18 Aug 2019 15:37:20 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201908181537.x7IFbKbo048954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 18 Aug 2019 15:37:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351189 - head/sys/dev/fdt X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/fdt X-SVN-Commit-Revision: 351189 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 15:37:20 -0000 Author: mmel Date: Sun Aug 18 15:37:19 2019 New Revision: 351189 URL: https://svnweb.freebsd.org/changeset/base/351189 Log: Fix bug introduced by r351184. We should check the returned handle, not the pointer to it. Noticed by: ian X-MFC with: r351184 MFC after: 1 week Modified: head/sys/dev/fdt/simple_mfd.c Modified: head/sys/dev/fdt/simple_mfd.c ============================================================================== --- head/sys/dev/fdt/simple_mfd.c Sun Aug 18 11:43:58 2019 (r351188) +++ head/sys/dev/fdt/simple_mfd.c Sun Aug 18 15:37:19 2019 (r351189) @@ -134,7 +134,7 @@ simple_mfd_syscon_get_handle(device_t dev, struct sysc sc = device_get_softc(dev); *syscon = sc->syscon; - if (syscon == NULL) + if (*syscon == NULL) return (ENODEV); return (0); } From owner-svn-src-head@freebsd.org Sun Aug 18 15:58:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50294CA42C; Sun, 18 Aug 2019 15:58:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BMDP1BNTz4g7v; Sun, 18 Aug 2019 15:58:45 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 064194757; Sun, 18 Aug 2019 15:58:45 +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 x7IFwij4060837; Sun, 18 Aug 2019 15:58:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7IFwixK060836; Sun, 18 Aug 2019 15:58:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908181558.x7IFwixK060836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 18 Aug 2019 15:58:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351190 - in head: share/man/man9 sys/i386/include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: share/man/man9 sys/i386/include X-SVN-Commit-Revision: 351190 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 15:58:45 -0000 Author: kib Date: Sun Aug 18 15:58:44 2019 New Revision: 351190 URL: https://svnweb.freebsd.org/changeset/base/351190 Log: i386: Implement atomic_load_64(9) and atomic_store_64(9). Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/share/man/man9/atomic.9 head/sys/i386/include/atomic.h Modified: head/share/man/man9/atomic.9 ============================================================================== --- head/share/man/man9/atomic.9 Sun Aug 18 15:37:19 2019 (r351189) +++ head/share/man/man9/atomic.9 Sun Aug 18 15:58:44 2019 (r351190) @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 22, 2017 +.Dd August 18, 2019 .Dt ATOMIC 9 .Os .Sh NAME @@ -477,7 +477,7 @@ and do not have any variants with memory barriers at t .Pp The type .Dq Li 64 -is currently not implemented for any of the atomic operations on the +is currently not implemented for some of the atomic operations on the .Tn arm , .Tn i386 , and Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Sun Aug 18 15:37:19 2019 (r351189) +++ head/sys/i386/include/atomic.h Sun Aug 18 15:58:44 2019 (r351190) @@ -891,6 +891,8 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_add_rel_64 atomic_add_64 #define atomic_subtract_acq_64 atomic_subtract_64 #define atomic_subtract_rel_64 atomic_subtract_64 +#define atomic_load_64 atomic_load_acq_64 +#define atomic_store_64 atomic_store_rel_64 /* Operations on pointers. */ #define atomic_set_ptr(p, v) \ From owner-svn-src-head@freebsd.org Sun Aug 18 16:04:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 615C8CA64B; Sun, 18 Aug 2019 16:04:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BMLW1wCjz3By0; Sun, 18 Aug 2019 16:04:03 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2350D4917; Sun, 18 Aug 2019 16:04:03 +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 x7IG42Il066273; Sun, 18 Aug 2019 16:04:02 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7IG42HT066269; Sun, 18 Aug 2019 16:04:02 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908181604.x7IG42HT066269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 18 Aug 2019 16:04:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351191 - head/sys/dev/random X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/random X-SVN-Commit-Revision: 351191 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 16:04:03 -0000 Author: cem Date: Sun Aug 18 16:04:01 2019 New Revision: 351191 URL: https://svnweb.freebsd.org/changeset/base/351191 Log: random(4): Reorder configuration of random source modules Move fast entropy source registration to the earlier SI_SUB_RANDOM:SI_ORDER_FOURTH and move random_harvestq_prime after that. Relocate the registration routines out of the much later randomdev module and into random_harvestq. This is necessary for the fast random sources to actually register before we perform random_harvestq_prime() early in the kernel boot. No functional change. Reviewed by: delphij, markjm Approved by: secteam(delphij) Differential Revision: https://reviews.freebsd.org/D21308 Modified: head/sys/dev/random/darn.c head/sys/dev/random/ivy.c head/sys/dev/random/nehemiah.c head/sys/dev/random/random_harvestq.c head/sys/dev/random/randomdev.c Modified: head/sys/dev/random/darn.c ============================================================================== --- head/sys/dev/random/darn.c Sun Aug 18 15:58:44 2019 (r351190) +++ head/sys/dev/random/darn.c Sun Aug 18 16:04:01 2019 (r351191) @@ -137,6 +137,12 @@ darn_modevent(module_t mod, int type, void *unused) return (error); } -DEV_MODULE(darn, darn_modevent, NULL); +static moduledata_t darn_mod = { + "darn", + darn_modevent, + 0 +}; + +DECLARE_MODULE(darn, darn_mod, SI_SUB_RANDOM, SI_ORDER_FOURTH); MODULE_VERSION(darn, 1); -MODULE_DEPEND(darn, random_device, 1, 1, 1); +MODULE_DEPEND(darn, random_harvestq, 1, 1, 1); Modified: head/sys/dev/random/ivy.c ============================================================================== --- head/sys/dev/random/ivy.c Sun Aug 18 15:58:44 2019 (r351190) +++ head/sys/dev/random/ivy.c Sun Aug 18 16:04:01 2019 (r351191) @@ -164,6 +164,12 @@ rdrand_modevent(module_t mod, int type, void *unused) return (error); } -DEV_MODULE(rdrand, rdrand_modevent, NULL); +static moduledata_t rdrand_mod = { + "rdrand", + rdrand_modevent, + 0 +}; + +DECLARE_MODULE(rdrand, rdrand_mod, SI_SUB_RANDOM, SI_ORDER_FOURTH); MODULE_VERSION(rdrand, 1); -MODULE_DEPEND(rdrand, random_device, 1, 1, 1); +MODULE_DEPEND(rdrand, random_harvestq, 1, 1, 1); Modified: head/sys/dev/random/nehemiah.c ============================================================================== --- head/sys/dev/random/nehemiah.c Sun Aug 18 15:58:44 2019 (r351190) +++ head/sys/dev/random/nehemiah.c Sun Aug 18 16:04:01 2019 (r351191) @@ -146,6 +146,12 @@ nehemiah_modevent(module_t mod, int type, void *unused return (error); } -DEV_MODULE(nehemiah, nehemiah_modevent, NULL); +static moduledata_t nehemiah_mod = { + "nehemiah", + nehemiah_modevent, + 0 +}; + +DECLARE_MODULE(nehemiah, nehemiah_mod, SI_SUB_RANDOM, SI_ORDER_FOURTH); MODULE_VERSION(nehemiah, 1); -MODULE_DEPEND(nehemiah, random_device, 1, 1, 1); +MODULE_DEPEND(nehemiah, random_harvestq, 1, 1, 1); Modified: head/sys/dev/random/random_harvestq.c ============================================================================== --- head/sys/dev/random/random_harvestq.c Sun Aug 18 15:58:44 2019 (r351190) +++ head/sys/dev/random/random_harvestq.c Sun Aug 18 16:04:01 2019 (r351191) @@ -447,7 +447,7 @@ random_harvestq_prime(void *unused __unused) printf("random: no preloaded entropy cache\n"); } } -SYSINIT(random_device_prime, SI_SUB_RANDOM, SI_ORDER_FOURTH, random_harvestq_prime, NULL); +SYSINIT(random_device_prime, SI_SUB_RANDOM, SI_ORDER_MIDDLE, random_harvestq_prime, NULL); /* ARGSUSED */ static void @@ -555,5 +555,61 @@ random_harvest_deregister_source(enum random_entropy_s hc_source_mask &= ~(1 << source); } + +void +random_source_register(struct random_source *rsource) +{ + struct random_sources *rrs; + + KASSERT(rsource != NULL, ("invalid input to %s", __func__)); + + rrs = malloc(sizeof(*rrs), M_ENTROPY, M_WAITOK); + rrs->rrs_source = rsource; + + random_harvest_register_source(rsource->rs_source); + + printf("random: registering fast source %s\n", rsource->rs_ident); + LIST_INSERT_HEAD(&source_list, rrs, rrs_entries); +} + +void +random_source_deregister(struct random_source *rsource) +{ + struct random_sources *rrs = NULL; + + KASSERT(rsource != NULL, ("invalid input to %s", __func__)); + + random_harvest_deregister_source(rsource->rs_source); + + LIST_FOREACH(rrs, &source_list, rrs_entries) + if (rrs->rrs_source == rsource) { + LIST_REMOVE(rrs, rrs_entries); + break; + } + if (rrs != NULL) + free(rrs, M_ENTROPY); +} + +static int +random_source_handler(SYSCTL_HANDLER_ARGS) +{ + struct random_sources *rrs; + struct sbuf sbuf; + int error, count; + + sbuf_new_for_sysctl(&sbuf, NULL, 64, req); + count = 0; + LIST_FOREACH(rrs, &source_list, rrs_entries) { + sbuf_cat(&sbuf, (count++ ? ",'" : "'")); + sbuf_cat(&sbuf, rrs->rrs_source->rs_ident); + sbuf_cat(&sbuf, "'"); + } + error = sbuf_finish(&sbuf); + sbuf_delete(&sbuf); + return (error); +} +SYSCTL_PROC(_kern_random, OID_AUTO, random_sources, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + NULL, 0, random_source_handler, "A", + "List of active fast entropy sources."); MODULE_VERSION(random_harvestq, 1); Modified: head/sys/dev/random/randomdev.c ============================================================================== --- head/sys/dev/random/randomdev.c Sun Aug 18 15:58:44 2019 (r351190) +++ head/sys/dev/random/randomdev.c Sun Aug 18 16:04:01 2019 (r351191) @@ -410,62 +410,6 @@ randomdev_ioctl(struct cdev *dev __unused, u_long cmd, return (error); } -void -random_source_register(struct random_source *rsource) -{ - struct random_sources *rrs; - - KASSERT(rsource != NULL, ("invalid input to %s", __func__)); - - rrs = malloc(sizeof(*rrs), M_ENTROPY, M_WAITOK); - rrs->rrs_source = rsource; - - random_harvest_register_source(rsource->rs_source); - - printf("random: registering fast source %s\n", rsource->rs_ident); - LIST_INSERT_HEAD(&source_list, rrs, rrs_entries); -} - -void -random_source_deregister(struct random_source *rsource) -{ - struct random_sources *rrs = NULL; - - KASSERT(rsource != NULL, ("invalid input to %s", __func__)); - - random_harvest_deregister_source(rsource->rs_source); - - LIST_FOREACH(rrs, &source_list, rrs_entries) - if (rrs->rrs_source == rsource) { - LIST_REMOVE(rrs, rrs_entries); - break; - } - if (rrs != NULL) - free(rrs, M_ENTROPY); -} - -static int -random_source_handler(SYSCTL_HANDLER_ARGS) -{ - struct random_sources *rrs; - struct sbuf sbuf; - int error, count; - - sbuf_new_for_sysctl(&sbuf, NULL, 64, req); - count = 0; - LIST_FOREACH(rrs, &source_list, rrs_entries) { - sbuf_cat(&sbuf, (count++ ? ",'" : "'")); - sbuf_cat(&sbuf, rrs->rrs_source->rs_ident); - sbuf_cat(&sbuf, "'"); - } - error = sbuf_finish(&sbuf); - sbuf_delete(&sbuf); - return (error); -} -SYSCTL_PROC(_kern_random, OID_AUTO, random_sources, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, random_source_handler, "A", - "List of active fast entropy sources."); - /* ARGSUSED */ static int randomdev_modevent(module_t mod __unused, int type, void *data __unused) From owner-svn-src-head@freebsd.org Sun Aug 18 17:12:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4AA3ACC1B0; Sun, 18 Aug 2019 17:12:07 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BNs31Fw9z3GsT; Sun, 18 Aug 2019 17:12:07 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E17B5583; Sun, 18 Aug 2019 17:12:07 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7IHC65h007448; Sun, 18 Aug 2019 17:12:06 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7IHC6PY007447; Sun, 18 Aug 2019 17:12:06 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908181712.x7IHC6PY007447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sun, 18 Aug 2019 17:12:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351192 - head/usr.sbin/periodic X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/usr.sbin/periodic X-SVN-Commit-Revision: 351192 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 17:12:07 -0000 Author: asomers Date: Sun Aug 18 17:12:06 2019 New Revision: 351192 URL: https://svnweb.freebsd.org/changeset/base/351192 Log: periodic: fix anticongestion for scripts run after security Revision 316342, which introduced the anticongestion feature, failed to consider that the periodic scripts are executed by a recursive invocation of periodic. The recursive invocation wrongly cleaned up a temporary file that should've been cleaned up only by the original invocation. The result is that if the first script that requests an anticongestion sleep runs after the security scripts, the sleep won't happen. Fix this bug by delaying cleanup until the end of the original invocation. PR: 236564 Submitted by: Yasuhiro KIMURA Reviewed by: imp MFC after: 1 month Modified: head/usr.sbin/periodic/periodic.sh Modified: head/usr.sbin/periodic/periodic.sh ============================================================================== --- head/usr.sbin/periodic/periodic.sh Sun Aug 18 16:04:01 2019 (r351191) +++ head/usr.sbin/periodic/periodic.sh Sun Aug 18 17:12:06 2019 (r351192) @@ -78,6 +78,11 @@ arg=$1 if [ -z "$PERIODIC_ANTICONGESTION_FILE" ] ; then export PERIODIC_ANTICONGESTION_FILE=`mktemp ${TMPDIR:-/tmp}/periodic.anticongestion.XXXXXXXXXX` + remove_periodic_anticongestion_file=yes +else + # We might be in a recursive invocation; let the top-level invocation + # remove the file. + remove_periodic_anticongestion_file=no fi if tty > /dev/null 2>&1; then export PERIODIC_IS_INTERACTIVE=1 @@ -147,4 +152,6 @@ esac } | output_pipe $arg "$context" rm -f $tmp_output -rm -f $PERIODIC_ANTICONGESTION_FILE +if [ $remove_periodic_anticongestion_file = "yes" ] ; then + rm -f $PERIODIC_ANTICONGESTION_FILE +fi From owner-svn-src-head@freebsd.org Sun Aug 18 18:40:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71895CE400; Sun, 18 Aug 2019 18:40:13 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BQpj26rgz3LX0; Sun, 18 Aug 2019 18:40:13 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A53A641D; Sun, 18 Aug 2019 18:40:13 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7IIeDD4055890; Sun, 18 Aug 2019 18:40:13 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7IIeCAL055888; Sun, 18 Aug 2019 18:40:12 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908181840.x7IIeCAL055888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 18 Aug 2019 18:40:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351193 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351193 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 18:40:13 -0000 Author: mjg Date: Sun Aug 18 18:40:12 2019 New Revision: 351193 URL: https://svnweb.freebsd.org/changeset/base/351193 Log: vfs: stop always overwriting ->mnt_stat in VFS_STATFS The struct is already populated on each mount (and remount). Fields are either constant or not used by filesystem in the first place. Some infrequently used functions use it to avoid having to allocate a new buffer and are left alone. The current code results in an avoidable copying single-threaded and significant cache line bouncing multithreaded While here deduplicate initial filling of the struct. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21317 Modified: head/sys/kern/vfs_mount.c head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Sun Aug 18 17:12:06 2019 (r351192) +++ head/sys/kern/vfs_mount.c Sun Aug 18 18:40:12 2019 (r351193) @@ -1831,12 +1831,15 @@ vfs_copyopt(struct vfsoptlist *opts, const char *name, int __vfs_statfs(struct mount *mp, struct statfs *sbp) { - int error; - error = mp->mnt_op->vfs_statfs(mp, &mp->mnt_stat); - if (sbp != &mp->mnt_stat) - *sbp = mp->mnt_stat; - return (error); + /* + * Set these in case the underlying filesystem fails to do so. + */ + sbp->f_version = STATFS_VERSION; + sbp->f_namemax = NAME_MAX; + sbp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; + + return (mp->mnt_op->vfs_statfs(mp, sbp)); } void Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sun Aug 18 17:12:06 2019 (r351192) +++ head/sys/kern/vfs_syscalls.c Sun Aug 18 18:40:12 2019 (r351193) @@ -248,7 +248,6 @@ statfs_scale_blocks(struct statfs *sf, long max_size) static int kern_do_statfs(struct thread *td, struct mount *mp, struct statfs *buf) { - struct statfs *sp; int error; if (mp == NULL) @@ -262,17 +261,9 @@ kern_do_statfs(struct thread *td, struct mount *mp, st if (error != 0) goto out; #endif - /* - * Set these in case the underlying filesystem fails to do so. - */ - sp = &mp->mnt_stat; - sp->f_version = STATFS_VERSION; - sp->f_namemax = NAME_MAX; - sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - error = VFS_STATFS(mp, sp); + error = VFS_STATFS(mp, buf); if (error != 0) goto out; - *buf = *sp; if (priv_check(td, PRIV_VFS_GENERATION)) { buf->f_fsid.val[0] = buf->f_fsid.val[1] = 0; prison_enforce_statfs(td->td_ucred, mp, buf); @@ -476,13 +467,6 @@ restart: if (sfsp != NULL && count < maxcount) { sp = &mp->mnt_stat; /* - * Set these in case the underlying filesystem - * fails to do so. - */ - sp->f_version = STATFS_VERSION; - sp->f_namemax = NAME_MAX; - sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - /* * If MNT_NOWAIT is specified, do not refresh * the fsstat cache. */ @@ -4545,7 +4529,6 @@ sys_fhstatfs(struct thread *td, struct fhstatfs_args * int kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf) { - struct statfs *sp; struct mount *mp; struct vnode *vp; int error; @@ -4569,16 +4552,7 @@ kern_fhstatfs(struct thread *td, fhandle_t fh, struct if (error != 0) goto out; #endif - /* - * Set these in case the underlying filesystem fails to do so. - */ - sp = &mp->mnt_stat; - sp->f_version = STATFS_VERSION; - sp->f_namemax = NAME_MAX; - sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - error = VFS_STATFS(mp, sp); - if (error == 0) - *buf = *sp; + error = VFS_STATFS(mp, buf); out: vfs_unbusy(mp); return (error); From owner-svn-src-head@freebsd.org Sun Aug 18 20:24:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F9C5D0350; Sun, 18 Aug 2019 20:24:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BT7T02Rgz3Qnn; Sun, 18 Aug 2019 20:24:53 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6D1277E7; Sun, 18 Aug 2019 20:24: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 x7IKOqEo020514; Sun, 18 Aug 2019 20:24:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7IKOqRD020512; Sun, 18 Aug 2019 20:24:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908182024.x7IKOqRD020512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 18 Aug 2019 20:24:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351194 - in head/sys: compat/linux kern vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: compat/linux kern vm X-SVN-Commit-Revision: 351194 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 20:24:53 -0000 Author: kib Date: Sun Aug 18 20:24:52 2019 New Revision: 351194 URL: https://svnweb.freebsd.org/changeset/base/351194 Log: Change locking requirements for VOP_UNSET_TEXT(). Require the vnode to be locked for the VOP_UNSET_TEXT() call. This will be used by the following bug fix for a tmpfs issue. Tested by: sbruno, pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/compat/linux/linux_misc.c head/sys/kern/vnode_if.src head/sys/vm/vm_map.c Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun Aug 18 18:40:12 2019 (r351193) +++ head/sys/compat/linux/linux_misc.c Sun Aug 18 20:24:52 2019 (r351194) @@ -472,8 +472,13 @@ cleanup: locked = false; VOP_CLOSE(vp, FREAD, td->td_ucred, td); } - if (textset) + if (textset) { + if (!locked) { + locked = true; + VOP_LOCK(vp, LK_SHARED | LK_RETRY); + } VOP_UNSET_TEXT_CHECKED(vp); + } if (locked) VOP_UNLOCK(vp, 0); Modified: head/sys/kern/vnode_if.src ============================================================================== --- head/sys/kern/vnode_if.src Sun Aug 18 18:40:12 2019 (r351193) +++ head/sys/kern/vnode_if.src Sun Aug 18 20:24:52 2019 (r351194) @@ -695,7 +695,7 @@ vop_set_text { }; -%% vop_unset_text vp = = = +%% vop_unset_text vp L L L vop_unset_text { IN struct vnode *vp; Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sun Aug 18 18:40:12 2019 (r351193) +++ head/sys/vm/vm_map.c Sun Aug 18 20:24:52 2019 (r351194) @@ -547,12 +547,20 @@ vm_map_entry_set_vnode_text(vm_map_entry_t entry, bool "entry %p, object %p, add %d", entry, object, add)); } if (vp != NULL) { - if (add) + if (add) { VOP_SET_TEXT_CHECKED(vp); - else + VM_OBJECT_RUNLOCK(object); + } else { + vhold(vp); + VM_OBJECT_RUNLOCK(object); + vn_lock(vp, LK_SHARED | LK_RETRY); VOP_UNSET_TEXT_CHECKED(vp); + VOP_UNLOCK(vp, 0); + vdrop(vp); + } + } else { + VM_OBJECT_RUNLOCK(object); } - VM_OBJECT_RUNLOCK(object); } static void From owner-svn-src-head@freebsd.org Sun Aug 18 20:36:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B2EDD0569; Sun, 18 Aug 2019 20:36:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BTNY08Vxz3RC0; Sun, 18 Aug 2019 20:36:13 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6A7E79A6; Sun, 18 Aug 2019 20:36:12 +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 x7IKaCxs026211; Sun, 18 Aug 2019 20:36:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7IKaBHS026207; Sun, 18 Aug 2019 20:36:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908182036.x7IKaBHS026207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 18 Aug 2019 20:36:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351195 - in head/sys: fs/tmpfs kern sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: fs/tmpfs kern sys X-SVN-Commit-Revision: 351195 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 20:36:13 -0000 Author: kib Date: Sun Aug 18 20:36:11 2019 New Revision: 351195 URL: https://svnweb.freebsd.org/changeset/base/351195 Log: Fix an issue with executing tmpfs binary. Suppose that a binary was executed from tmpfs mount, and the text vnode was reclaimed while the binary was still running. It is possible during even the normal operations since tmpfs vnode' vm_object has swap type, and no references on the vnode is held. Also assume that the text vnode was revived for some reason. Then, on the process exit or exec, unmapping of the text mapping tries to remove the text reference from the vnode, but since it went from recycle/instantiation cycle, there is no reference kept, and assertion in VOP_UNSET_TEXT_CHECKED() triggers. Fix this by keeping a use reference on the tmpfs vnode for each exec reference. This prevents the vnode reclamation while executable map entry is active. Do it by adding per-mount flag MNTK_TEXT_REFS that directs vop_stdset_text() to add use ref on first vnode text use, and per-vnode VI_TEXT_REF flag, to record the need on unref in vop_stdunset_text() on last vnode text use going away. Set MNTK_TEXT_REFS for tmpfs mounts. Reported by: bdrewery Tested by: sbruno, pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c head/sys/kern/vfs_default.c head/sys/sys/mount.h head/sys/sys/vnode.h Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Sun Aug 18 20:24:52 2019 (r351194) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Sun Aug 18 20:36:11 2019 (r351195) @@ -507,7 +507,8 @@ tmpfs_mount(struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED; + mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED | + MNTK_TEXT_REFS; MNT_IUNLOCK(mp); mp->mnt_data = tmp; Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Sun Aug 18 20:24:52 2019 (r351194) +++ head/sys/kern/vfs_default.c Sun Aug 18 20:36:11 2019 (r351195) @@ -1082,6 +1082,7 @@ int vop_stdset_text(struct vop_set_text_args *ap) { struct vnode *vp; + struct mount *mp; int error; vp = ap->a_vp; @@ -1089,6 +1090,17 @@ vop_stdset_text(struct vop_set_text_args *ap) if (vp->v_writecount > 0) { error = ETXTBSY; } else { + /* + * If requested by fs, keep a use reference to the + * vnode until the last text reference is released. + */ + mp = vp->v_mount; + if (mp != NULL && (mp->mnt_kern_flag & MNTK_TEXT_REFS) != 0 && + vp->v_writecount == 0) { + vp->v_iflag |= VI_TEXT_REF; + vrefl(vp); + } + vp->v_writecount--; error = 0; } @@ -1101,16 +1113,25 @@ vop_stdunset_text(struct vop_unset_text_args *ap) { struct vnode *vp; int error; + bool last; vp = ap->a_vp; + last = false; VI_LOCK(vp); if (vp->v_writecount < 0) { + if ((vp->v_iflag & VI_TEXT_REF) != 0 && + vp->v_writecount == -1) { + last = true; + vp->v_iflag &= ~VI_TEXT_REF; + } vp->v_writecount++; error = 0; } else { error = EINVAL; } VI_UNLOCK(vp); + if (last) + vunref(vp); return (error); } Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Sun Aug 18 20:24:52 2019 (r351194) +++ head/sys/sys/mount.h Sun Aug 18 20:36:11 2019 (r351195) @@ -398,6 +398,7 @@ void __mnt_vnode_markerfree_active(struct vno #define MNTK_MARKER 0x00001000 #define MNTK_UNMAPPED_BUFS 0x00002000 #define MNTK_USES_BCACHE 0x00004000 /* FS uses the buffer cache. */ +#define MNTK_TEXT_REFS 0x00008000 /* Keep use ref for text */ #define MNTK_NOASYNC 0x00800000 /* disable async */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Sun Aug 18 20:24:52 2019 (r351194) +++ head/sys/sys/vnode.h Sun Aug 18 20:36:11 2019 (r351195) @@ -233,6 +233,7 @@ struct xvnode { * VI_DOOMED is doubly protected by the interlock and vnode lock. Both * are required for writing but the status may be checked with either. */ +#define VI_TEXT_REF 0x0001 /* Text ref grabbed use ref */ #define VI_MOUNT 0x0020 /* Mount in progress */ #define VI_DOOMED 0x0080 /* This vnode is being recycled */ #define VI_FREE 0x0100 /* This vnode is on the freelist */ From owner-svn-src-head@freebsd.org Sun Aug 18 22:11:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6858AD2C83; Sun, 18 Aug 2019 22:11:43 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BWVl2wk2z42LS; Sun, 18 Aug 2019 22:11:43 +0000 (UTC) (envelope-from wulf@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 458E08C5C; Sun, 18 Aug 2019 22:11:43 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7IMBhsO084657; Sun, 18 Aug 2019 22:11:43 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7IMBgrb084651; Sun, 18 Aug 2019 22:11:42 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201908182211.x7IMBgrb084651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 18 Aug 2019 22:11:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351196 - in head/sys: conf modules/netgraph/bluetooth/ubt netgraph/bluetooth/drivers/ubt X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: in head/sys: conf modules/netgraph/bluetooth/ubt netgraph/bluetooth/drivers/ubt X-SVN-Commit-Revision: 351196 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 22:11:43 -0000 Author: wulf Date: Sun Aug 18 22:11:42 2019 New Revision: 351196 URL: https://svnweb.freebsd.org/changeset/base/351196 Log: ng_ubt(4): do not attach Intel Wireless 8260/8265 in bootloader mode. Add helper function for synchronous execution of HCI commands at probe stage and use this function to check firmware state of Intel Wireless 8260/8265 bluetooth devices found in many post 2016 year laptops. Attempt to initialize FreeBSD bluetooth stack while such a device is in bootloader mode locks the adapter hardly so it requires power on/off cycle to restore. This change blocks ng_ubt attachment unless operational firmware is loaded thus preventing the lock up. PR: 237083 Reviewed by: hps, emax MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21071 Added: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c (contents, props changed) Modified: head/sys/conf/files head/sys/modules/netgraph/bluetooth/ubt/Makefile head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Aug 18 20:36:11 2019 (r351195) +++ head/sys/conf/files Sun Aug 18 22:11:42 2019 (r351196) @@ -4147,6 +4147,7 @@ netgraph/bluetooth/common/ng_bluetooth.c optional netg netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c optional netgraph_bluetooth_bt3c netgraph/bluetooth/drivers/h4/ng_h4.c optional netgraph_bluetooth_h4 netgraph/bluetooth/drivers/ubt/ng_ubt.c optional netgraph_bluetooth_ubt usb +netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c optional netgraph_bluetooth_ubt usb netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c optional netgraph_bluetooth_ubtbcmfw usb netgraph/bluetooth/hci/ng_hci_cmds.c optional netgraph_bluetooth_hci netgraph/bluetooth/hci/ng_hci_evnt.c optional netgraph_bluetooth_hci Modified: head/sys/modules/netgraph/bluetooth/ubt/Makefile ============================================================================== --- head/sys/modules/netgraph/bluetooth/ubt/Makefile Sun Aug 18 20:36:11 2019 (r351195) +++ head/sys/modules/netgraph/bluetooth/ubt/Makefile Sun Aug 18 22:11:42 2019 (r351196) @@ -7,7 +7,7 @@ CFLAGS+= -I${SRCTOP}/sys/netgraph/bluetooth/include \ -I${SRCTOP}/sys/netgraph/bluetooth/drivers/ubt KMOD= ng_ubt -SRCS= ng_ubt.c opt_bus.h opt_usb.h device_if.h bus_if.h \ - usb_if.h usbdevs.h +SRCS= ng_ubt.c ng_ubt_intel.c opt_bus.h opt_usb.h device_if.h \ + bus_if.h usb_if.h usbdevs.h .include Modified: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c ============================================================================== --- head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Sun Aug 18 20:36:11 2019 (r351195) +++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Sun Aug 18 22:11:42 2019 (r351196) @@ -252,6 +252,7 @@ static struct ng_type typestruct = ****************************************************************************/ /* USB methods */ +static usb_callback_t ubt_probe_intr_callback; static usb_callback_t ubt_ctrl_write_callback; static usb_callback_t ubt_intr_read_callback; static usb_callback_t ubt_bulk_read_callback; @@ -421,6 +422,13 @@ static const STRUCT_USB_HOST_ID ubt_ignore_devs[] = /* Atheros AR5BBU12 with sflash firmware */ { USB_VPI(0x0489, 0xe03c, 0), USB_DEV_BCD_LTEQ(1) }, { USB_VPI(0x0489, 0xe036, 0), USB_DEV_BCD_LTEQ(1) }, + + /* Intel Wireless 8260 and successors are handled in ng_ubt_intel.c */ + { USB_VPI(USB_VENDOR_INTEL2, 0x0a2b, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0aaa, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0025, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0026, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0029, 0) }, }; /* List of supported bluetooth devices */ @@ -503,6 +511,79 @@ static const STRUCT_USB_HOST_ID ubt_devs[] = }; /* + * Does a synchronous (waits for completion event) execution of HCI command. + * Size of both command and response buffers are passed in length field of + * corresponding structures in "Parameter Total Length" format i.e. + * not including HCI packet headers. + * + * Must not be used after USB transfers have been configured in attach routine. + */ + +usb_error_t +ubt_do_hci_request(struct usb_device *udev, struct ubt_hci_cmd *cmd, + void *evt, usb_timeout_t timeout) +{ + static const struct usb_config ubt_probe_config = { + .type = UE_INTERRUPT, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_IN, + .flags = { .pipe_bof = 1, .short_xfer_ok = 1 }, + .bufsize = UBT_INTR_BUFFER_SIZE, + .callback = &ubt_probe_intr_callback, + }; + struct usb_device_request req; + struct usb_xfer *xfer[1]; + struct mtx mtx; + usb_error_t error = USB_ERR_NORMAL_COMPLETION; + uint8_t iface_index = 0; + + /* Initialize a USB control request and then do it */ + bzero(&req, sizeof(req)); + req.bmRequestType = UBT_HCI_REQUEST; + req.wIndex[0] = iface_index; + USETW(req.wLength, UBT_HCI_CMD_SIZE(cmd)); + + error = usbd_do_request(udev, NULL, &req, cmd); + if (error != USB_ERR_NORMAL_COMPLETION) { + printf("ng_ubt: usbd_do_request error=%s\n", + usbd_errstr(error)); + return (error); + } + + if (evt == NULL) + return (USB_ERR_NORMAL_COMPLETION); + + /* Initialize INTR endpoint xfer and wait for response */ + mtx_init(&mtx, "ubt pb", NULL, MTX_DEF); + + error = usbd_transfer_setup(udev, &iface_index, xfer, + &ubt_probe_config, 1, evt, &mtx); + if (error == USB_ERR_NORMAL_COMPLETION) { + + mtx_lock(&mtx); + usbd_transfer_start(*xfer); + + if (msleep_sbt(evt, &mtx, 0, "ubt pb", SBT_1MS * timeout, + 0, C_HARDCLOCK) == EWOULDBLOCK) { + printf("ng_ubt: HCI command 0x%04x timed out\n", + le16toh(cmd->opcode)); + error = USB_ERR_TIMEOUT; + } + + usbd_transfer_stop(*xfer); + mtx_unlock(&mtx); + + usbd_transfer_unsetup(xfer, 1); + } else + printf("ng_ubt: usbd_transfer_setup error=%s\n", + usbd_errstr(error)); + + mtx_destroy(&mtx); + + return (error); +} + +/* * Probe for a USB Bluetooth device. * USB context. */ @@ -717,6 +798,49 @@ ubt_detach(device_t dev) return (0); } /* ubt_detach */ +/* + * Called when incoming interrupt transfer (HCI event) has completed, i.e. + * HCI event was received from the device during device probe stage. + * USB context. + */ + +static void +ubt_probe_intr_callback(struct usb_xfer *xfer, usb_error_t error) +{ + struct ubt_hci_event *evt = usbd_xfer_softc(xfer); + struct usb_page_cache *pc; + int actlen; + + usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + if (actlen > UBT_HCI_EVENT_SIZE(evt)) + actlen = UBT_HCI_EVENT_SIZE(evt); + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_out(pc, 0, evt, actlen); + /* OneShot mode */ + wakeup(evt); + break; + + case USB_ST_SETUP: +submit_next: + /* Try clear stall first */ + usbd_xfer_set_stall(xfer); + usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); + usbd_transfer_submit(xfer); + break; + + default: + if (error != USB_ERR_CANCELLED) { + printf("ng_ubt: interrupt transfer failed: %s\n", + usbd_errstr(error)); + goto submit_next; + } + break; + } +} /* ubt_probe_intr_callback */ + /* * Called when outgoing control request (HCI command) has completed, i.e. * HCI command was sent to the device. @@ -1852,7 +1976,7 @@ ubt_modevent(module_t mod, int event, void *data) return (error); } /* ubt_modevent */ -static devclass_t ubt_devclass; +devclass_t ubt_devclass; static device_method_t ubt_methods[] = { @@ -1862,7 +1986,7 @@ static device_method_t ubt_methods[] = DEVMETHOD_END }; -static driver_t ubt_driver = +driver_t ubt_driver = { .name = "ubt", .methods = ubt_methods, Added: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c Sun Aug 18 22:11:42 2019 (r351196) @@ -0,0 +1,161 @@ +/* + * ng_ubt_intel.c + */ + +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Vladimir Kondratyev + * + * 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$ + */ + +/* + * Attempt to initialize FreeBSD bluetooth stack while Intel Wireless 8260/8265 + * device is in bootloader mode locks the adapter hardly so it requires power + * on/off cycle to restore. This driver blocks ng_ubt attachment until + * operational firmware is loaded by iwmbtfw utility thus avoiding the lock up. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "usbdevs.h" +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +static device_probe_t ubt_intel_probe; + +/* + * List of supported bluetooth devices. If you add a new device PID here ensure + * that it is blacklisted in ng_ubt.c and is supported by iwmbtfw utility. + */ + +static const STRUCT_USB_HOST_ID ubt_intel_devs[] = +{ + /* Intel Wireless 8260/8265 and successors */ + { USB_VPI(USB_VENDOR_INTEL2, 0x0a2b, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0aaa, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0025, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0026, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0029, 0) }, +}; + +/* + * Find if the Intel Wireless 8260/8265 device is in bootloader mode or is + * running operational firmware with checking of 4-th byte "Intel version" + * HCI command response. The value 0x23 identifies the operational firmware. + */ + +static bool +ubt_intel_check_firmware_state(struct usb_device *udev) +{ +#define UBT_INTEL_VER_LEN 13 +#define UBT_INTEL_HCICMD_TIMEOUT 2000 /* ms */ + struct ubt_hci_event_command_compl *evt; + uint8_t buf[offsetof(struct ubt_hci_event, data) + UBT_INTEL_VER_LEN]; + static struct ubt_hci_cmd cmd = { + .opcode = htole16(NG_HCI_OPCODE(NG_HCI_OGF_VENDOR, 0x05)), + .length = 0, + }; + usb_error_t error; + + bzero(buf, sizeof(buf)); + evt = (struct ubt_hci_event_command_compl *)buf; + evt->header.length = UBT_INTEL_VER_LEN; + + error = ubt_do_hci_request(udev, &cmd, evt, UBT_INTEL_HCICMD_TIMEOUT); + if (error != USB_ERR_NORMAL_COMPLETION) + return false; + + return (evt->header.event == NG_HCI_EVENT_COMMAND_COMPL && + evt->header.length == UBT_INTEL_VER_LEN && + evt->data[4] == 0x23); +} + +/* + * Probe for a Intel Wireless Bluetooth device. + */ + +static int +ubt_intel_probe(device_t dev) +{ + struct usb_attach_arg *uaa = device_get_ivars(dev); + int error; + + if (uaa->usb_mode != USB_MODE_HOST) + return (ENXIO); + + if (uaa->info.bIfaceIndex != 0) + return (ENXIO); + + error = usbd_lookup_id_by_uaa(ubt_intel_devs, sizeof(ubt_intel_devs), + uaa); + if (error != 0) + return (error); + + if (!ubt_intel_check_firmware_state(uaa->device)) + return (ENXIO); + + return (BUS_PROBE_DEFAULT); +} + +/* + * Module interface. Attach and detach methods, netgraph node type + * registration and PNP string are inherited from ng_ubt.c driver. + */ + +static device_method_t ubt_intel_methods[] = +{ + DEVMETHOD(device_probe, ubt_intel_probe), + DEVMETHOD_END +}; + +static kobj_class_t ubt_baseclasses[] = { &ubt_driver, NULL }; +static driver_t ubt_intel_driver = +{ + .name = "ubt", + .methods = ubt_intel_methods, + .size = sizeof(struct ubt_softc), + .baseclasses = ubt_baseclasses, +}; + +DRIVER_MODULE(ng_ubt_intel, uhub, ubt_intel_driver, ubt_devclass, 0, 0); +MODULE_VERSION(ng_ubt_intel, NG_BLUETOOTH_VERSION); +MODULE_DEPEND(ng_ubt_intel, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION); +MODULE_DEPEND(ng_ubt_intel, ng_hci, NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION); +MODULE_DEPEND(ng_ubt_intel, usb, 1, 1, 1); Modified: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h ============================================================================== --- head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h Sun Aug 18 20:36:11 2019 (r351195) +++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h Sun Aug 18 22:11:42 2019 (r351196) @@ -74,6 +74,35 @@ enum { UBT_N_TRANSFER, /* total number of transfers */ }; +/* USB control request (HCI command) structure */ +struct ubt_hci_cmd { + uint16_t opcode; + uint8_t length; + uint8_t data[]; +} __attribute__ ((packed)); +#define UBT_HCI_CMD_SIZE(cmd) \ + ((cmd)->length + offsetof(struct ubt_hci_cmd, data)) + +/* USB interrupt transfer HCI event header structure */ +struct ubt_hci_evhdr { + uint8_t event; + uint8_t length; +} __attribute__ ((packed)); +/* USB interrupt transfer (generic HCI event) structure */ +struct ubt_hci_event { + struct ubt_hci_evhdr header; + uint8_t data[]; +} __attribute__ ((packed)); +/* USB interrupt transfer (HCI command completion event) structure */ +struct ubt_hci_event_command_compl { + struct ubt_hci_evhdr header; + uint8_t numpkt; + uint16_t opcode; + uint8_t data[]; +} __attribute__ ((packed)); +#define UBT_HCI_EVENT_SIZE(evt) \ + ((evt)->header.length + offsetof(struct ubt_hci_event, data)) + /* USB device softc structure */ struct ubt_softc { device_t sc_dev; /* for debug printf */ @@ -128,6 +157,12 @@ struct ubt_softc { }; typedef struct ubt_softc ubt_softc_t; typedef struct ubt_softc * ubt_softc_p; + +usb_error_t ubt_do_hci_request(struct usb_device *, struct ubt_hci_cmd *, + void *, usb_timeout_t); + +extern devclass_t ubt_devclass; +extern driver_t ubt_driver; #endif /* ndef _NG_UBT_VAR_H_ */ From owner-svn-src-head@freebsd.org Sun Aug 18 22:20:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BD15D2E05; Sun, 18 Aug 2019 22:20:31 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BWhv1nF3z42lB; Sun, 18 Aug 2019 22:20:31 +0000 (UTC) (envelope-from wulf@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04ED18CDB; Sun, 18 Aug 2019 22:20:31 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7IMKUix085886; Sun, 18 Aug 2019 22:20:31 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7IMKSUV085874; Sun, 18 Aug 2019 22:20:28 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201908182220.x7IMKSUV085874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 18 Aug 2019 22:20:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351197 - in head: targets/pseudo/userland tools/build/mk usr.sbin/bluetooth usr.sbin/bluetooth/iwmbtfw X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: in head: targets/pseudo/userland tools/build/mk usr.sbin/bluetooth usr.sbin/bluetooth/iwmbtfw X-SVN-Commit-Revision: 351197 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 22:20:31 -0000 Author: wulf Date: Sun Aug 18 22:20:28 2019 New Revision: 351197 URL: https://svnweb.freebsd.org/changeset/base/351197 Log: iwmbtfw: Firmware loader for Intel Wireless 8260 based Bluetooth USB devices Currently supported models are: 8260, 8265, 9560, 9260 and 22161. Firmware files can be installed with comms/iwmbt-firmware port. PR: 237083 Reviewed by: hps, emax X-MFC with: r351196 Differential Revision: https://reviews.freebsd.org/D21071 Added: head/usr.sbin/bluetooth/iwmbtfw/ head/usr.sbin/bluetooth/iwmbtfw/Makefile (contents, props changed) head/usr.sbin/bluetooth/iwmbtfw/iwmbt_dbg.h (contents, props changed) head/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c (contents, props changed) head/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.h (contents, props changed) head/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c (contents, props changed) head/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h (contents, props changed) head/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 (contents, props changed) head/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf (contents, props changed) head/usr.sbin/bluetooth/iwmbtfw/main.c (contents, props changed) Modified: head/targets/pseudo/userland/Makefile.depend head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.sbin/bluetooth/Makefile Modified: head/targets/pseudo/userland/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/Makefile.depend Sun Aug 18 22:11:42 2019 (r351196) +++ head/targets/pseudo/userland/Makefile.depend Sun Aug 18 22:20:28 2019 (r351197) @@ -443,6 +443,7 @@ DIRDEPS+= \ usr.sbin/bluetooth/hccontrol \ usr.sbin/bluetooth/hcsecd \ usr.sbin/bluetooth/hcseriald \ + usr.sbin/bluetooth/iwmbtfw \ usr.sbin/bluetooth/l2control \ usr.sbin/bluetooth/l2ping \ usr.sbin/bluetooth/rfcomm_pppd \ Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Sun Aug 18 22:11:42 2019 (r351196) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Sun Aug 18 22:20:28 2019 (r351197) @@ -471,6 +471,7 @@ OLD_FILES+=etc/bluetooth/hcsecd.conf OLD_FILES+=etc/bluetooth/hosts OLD_FILES+=etc/bluetooth/protocols OLD_FILES+=etc/defaults/bluetooth.device.conf +OLD_FILES+=etc/devd/iwmbtfw.conf OLD_DIRS+=etc/bluetooth OLD_FILES+=etc/rc.d/bluetooth OLD_FILES+=etc/rc.d/bthidd @@ -524,6 +525,7 @@ OLD_FILES+=usr/sbin/btpand OLD_FILES+=usr/sbin/hccontrol OLD_FILES+=usr/sbin/hcsecd OLD_FILES+=usr/sbin/hcseriald +OLD_FILES+=usr/sbin/iwmbtfw OLD_FILES+=usr/sbin/l2control OLD_FILES+=usr/sbin/l2ping OLD_FILES+=usr/sbin/rfcomm_pppd @@ -601,6 +603,7 @@ OLD_FILES+=usr/share/man/man8/btpand.8.gz OLD_FILES+=usr/share/man/man8/hccontrol.8.gz OLD_FILES+=usr/share/man/man8/hcsecd.8.gz OLD_FILES+=usr/share/man/man8/hcseriald.8.gz +OLD_FILES+=usr/share/man/man8/iwmbtfw.8.gz OLD_FILES+=usr/share/man/man8/l2control.8.gz OLD_FILES+=usr/share/man/man8/l2ping.8.gz OLD_FILES+=usr/share/man/man8/rfcomm_pppd.8.gz Modified: head/usr.sbin/bluetooth/Makefile ============================================================================== --- head/usr.sbin/bluetooth/Makefile Sun Aug 18 22:11:42 2019 (r351196) +++ head/usr.sbin/bluetooth/Makefile Sun Aug 18 22:20:28 2019 (r351197) @@ -21,6 +21,7 @@ SUBDIR+= ath3kfw SUBDIR+= bcmfw SUBDIR+= bthidcontrol SUBDIR+= bthidd +SUBDIR+= iwmbtfw .endif .include Added: head/usr.sbin/bluetooth/iwmbtfw/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/iwmbtfw/Makefile Sun Aug 18 22:20:28 2019 (r351197) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +PACKAGE= bluetooth +CONFS= iwmbtfw.conf +CONFSDIR= /etc/devd +PROG= iwmbtfw +MAN= iwmbtfw.8 +LIBADD+= usb +SRCS= main.c iwmbt_fw.c iwmbt_hw.c + +.include Added: head/usr.sbin/bluetooth/iwmbtfw/iwmbt_dbg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/iwmbtfw/iwmbt_dbg.h Sun Aug 18 22:20:28 2019 (r351197) @@ -0,0 +1,47 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2013 Adrian Chadd + * Copyright (c) 2019 Vladimir Kondratyev + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef __IWMBT_DEBUG_H__ +#define __IWMBT_DEBUG_H__ + +extern int iwmbt_do_debug; +extern int iwmbt_do_info; + +#define iwmbt_err(fmt, ...) \ + fprintf(stderr, "iwmbtfw: %s: "fmt"\n", __func__, ##__VA_ARGS__) +#define iwmbt_info(fmt, ...) do { \ + if (iwmbt_do_info) \ + fprintf(stderr, "%s: "fmt"\n", __func__, ##__VA_ARGS__);\ +} while (0) +#define iwmbt_debug(fmt, ...) do { \ + if (iwmbt_do_debug) \ + fprintf(stderr, "%s: "fmt"\n", __func__, ##__VA_ARGS__);\ +} while (0) + +#endif Added: head/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c Sun Aug 18 22:20:28 2019 (r351197) @@ -0,0 +1,148 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2013 Adrian Chadd + * Copyright (c) 2019 Vladimir Kondratyev + * + * 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$ + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "iwmbt_fw.h" +#include "iwmbt_dbg.h" + +int +iwmbt_fw_read(struct iwmbt_firmware *fw, const char *fwname) +{ + int fd; + struct stat sb; + unsigned char *buf; + ssize_t r; + int i; + + fd = open(fwname, O_RDONLY); + if (fd < 0) { + warn("%s: open: %s", __func__, fwname); + return (0); + } + + if (fstat(fd, &sb) != 0) { + warn("%s: stat: %s", __func__, fwname); + close(fd); + return (0); + } + + buf = calloc(1, sb.st_size); + if (buf == NULL) { + warn("%s: calloc", __func__); + close(fd); + return (0); + } + + i = 0; + /* XXX handle partial reads */ + r = read(fd, buf, sb.st_size); + if (r < 0) { + warn("%s: read", __func__); + free(buf); + close(fd); + return (0); + } + + if (r != sb.st_size) { + iwmbt_err("read len %d != file size %d", + (int) r, + (int) sb.st_size); + free(buf); + close(fd); + return (0); + } + + /* We have everything, so! */ + + memset(fw, 0, sizeof(*fw)); + + fw->fwname = strdup(fwname); + fw->len = sb.st_size; + fw->buf = buf; + + close(fd); + return (1); +} + +void +iwmbt_fw_free(struct iwmbt_firmware *fw) +{ + if (fw->fwname) + free(fw->fwname); + if (fw->buf) + free(fw->buf); + memset(fw, 0, sizeof(*fw)); +} + +char * +iwmbt_get_fwname(struct iwmbt_version *ver, struct iwmbt_boot_params *params, + const char *prefix, const char *suffix) +{ + char *fwname; + + switch (ver->hw_variant) { + case 0x0b: /* 8260 */ + case 0x0c: /* 8265 */ + asprintf(&fwname, "%s/ibt-%u-%u.%s", + prefix, + le16toh(ver->hw_variant), + le16toh(params->dev_revid), + suffix); + break; + + case 0x11: /* 9560 */ + case 0x12: /* 9260 */ + case 0x13: + case 0x14: /* 22161 */ + asprintf(&fwname, "%s/ibt-%u-%u-%u.%s", + prefix, + le16toh(ver->hw_variant), + le16toh(ver->hw_revision), + le16toh(ver->fw_revision), + suffix); + break; + + default: + fwname = NULL; + } + + return (fwname); +} Added: head/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.h Sun Aug 18 22:20:28 2019 (r351197) @@ -0,0 +1,79 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2013 Adrian Chadd + * Copyright (c) 2019 Vladimir Kondratyev + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __IWMBT_FW_H__ +#define __IWMBT_FW_H__ + +struct iwmbt_version { + uint8_t status; + uint8_t hw_platform; + uint8_t hw_variant; + uint8_t hw_revision; + uint8_t fw_variant; + uint8_t fw_revision; + uint8_t fw_build_num; + uint8_t fw_build_ww; + uint8_t fw_build_yy; + uint8_t fw_patch_num; +} __attribute__ ((packed)); + +struct iwmbt_boot_params { + uint8_t status; + uint8_t otp_format; + uint8_t otp_content; + uint8_t otp_patch; + uint16_t dev_revid; + uint8_t secure_boot; + uint8_t key_from_hdr; + uint8_t key_type; + uint8_t otp_lock; + uint8_t api_lock; + uint8_t debug_lock; + uint8_t otp_bdaddr[6]; + uint8_t min_fw_build_nn; + uint8_t min_fw_build_cw; + uint8_t min_fw_build_yy; + uint8_t limited_cce; + uint8_t unlocked_state; +} __attribute__ ((packed)); + +struct iwmbt_firmware { + char *fwname; + int len; + unsigned char *buf; +}; + +extern int iwmbt_fw_read(struct iwmbt_firmware *fw, const char *fwname); +extern void iwmbt_fw_free(struct iwmbt_firmware *fw); +extern char *iwmbt_get_fwname(struct iwmbt_version *ver, + struct iwmbt_boot_params *params, const char *prefix, + const char *suffix); + +#endif Added: head/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c Sun Aug 18 22:20:28 2019 (r351197) @@ -0,0 +1,392 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Vladimir Kondratyev + * + * 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$ + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "iwmbt_fw.h" +#include "iwmbt_hw.h" +#include "iwmbt_dbg.h" + +#define XMIN(x, y) ((x) < (y) ? (x) : (y)) + +static int +iwmbt_send_fragment(struct libusb_device_handle *hdl, + uint8_t fragment_type, const void *data, uint8_t len, int timeout) +{ + int ret, transferred; + uint8_t buf[IWMBT_HCI_MAX_CMD_SIZE]; + struct iwmbt_hci_cmd *cmd = (struct iwmbt_hci_cmd *) buf; + + memset(buf, 0, sizeof(buf)); + cmd->opcode = htole16(0xfc09), + cmd->length = len + 1, + cmd->data[0] = fragment_type; + memcpy(cmd->data + 1, data, len); + + ret = libusb_bulk_transfer(hdl, + IWMBT_BULK_OUT_ENDPOINT_ADDR, + (uint8_t *)cmd, + IWMBT_HCI_CMD_SIZE(cmd), + &transferred, + timeout); + + if (ret < 0 || transferred != IWMBT_HCI_CMD_SIZE(cmd)) { + iwmbt_err("libusb_bulk_transfer() failed: err=%s, size=%zu", + libusb_strerror(ret), + IWMBT_HCI_CMD_SIZE(cmd)); + return (-1); + } + + ret = libusb_bulk_transfer(hdl, + IWMBT_BULK_IN_ENDPOINT_ADDR, + buf, + sizeof(buf), + &transferred, + timeout); + + if (ret < 0) { + iwmbt_err("libusb_bulk_transfer() failed: err=%s", + libusb_strerror(ret)); + return (-1); + } + + return (0); +} + +static int +iwmbt_hci_command(struct libusb_device_handle *hdl, struct iwmbt_hci_cmd *cmd, + void *event, int size, int *transferred, int timeout) +{ + int ret; + + ret = libusb_control_transfer(hdl, + LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_DEVICE, + 0, + 0, + 0, + (uint8_t *)cmd, + IWMBT_HCI_CMD_SIZE(cmd), + timeout); + + if (ret < 0) { + iwmbt_err("libusb_control_transfer() failed: err=%s", + libusb_strerror(ret)); + return (ret); + } + + ret = libusb_interrupt_transfer(hdl, + IWMBT_INTERRUPT_ENDPOINT_ADDR, + event, + size, + transferred, + timeout); + + if (ret < 0) + iwmbt_err("libusb_interrupt_transfer() failed: err=%s", + libusb_strerror(ret)); + + return (ret); +} + +int +iwmbt_load_fwfile(struct libusb_device_handle *hdl, + const struct iwmbt_firmware *fw, uint32_t *boot_param) +{ + int ready = 0, sent = 0; + int ret, transferred; + struct iwmbt_hci_cmd *cmd; + struct iwmbt_hci_event *event; + uint8_t buf[IWMBT_HCI_MAX_EVENT_SIZE]; + +#define IWMBT_SEND_FRAGMENT(fragment_type, size, msg) do { \ + iwmbt_debug("transferring %d bytes, offset %d", size, sent); \ + \ + ret = iwmbt_send_fragment(hdl, \ + fragment_type, \ + fw->buf + sent, \ + XMIN(size, fw->len - sent), \ + IWMBT_HCI_CMD_TIMEOUT); \ + \ + if (ret < 0) { \ + iwmbt_debug("Failed to send "msg": code=%d", ret); \ + return (-1); \ + } \ + sent += size; \ +} while (0) + + if (fw->len < 644) { + iwmbt_err("Invalid size of firmware file (%d)", fw->len); + return (-1); + } + + iwmbt_debug("file=%s, size=%d", fw->fwname, fw->len); + + IWMBT_SEND_FRAGMENT(0x00, 0x80, "CCS segment"); + IWMBT_SEND_FRAGMENT(0x03, 0x80, "public key / part 1"); + IWMBT_SEND_FRAGMENT(0x03, 0x80, "public key / part 2"); + + /* skip 4 bytes */ + sent += 4; + + IWMBT_SEND_FRAGMENT(0x02, 0x80, "signature / part 1"); + IWMBT_SEND_FRAGMENT(0x02, 0x80, "signature / part 2"); + + /* + * Send firmware chunks. Chunk len must be 4 byte aligned. + * multiple commands can be combined + */ + while (fw->len - sent - ready >= (int) sizeof(struct iwmbt_hci_cmd)) { + cmd = (struct iwmbt_hci_cmd *)(fw->buf + sent + ready); + /* Parse firmware for Intel Reset HCI command parameter */ + if (cmd->opcode == htole16(0xfc0e)) { + *boot_param = le32dec(cmd->data); + iwmbt_debug("boot_param=0x%08x", *boot_param); + } + ready += IWMBT_HCI_CMD_SIZE(cmd); + while (ready >= 0xFC) { + IWMBT_SEND_FRAGMENT(0x01, 0xFC, "firmware chunk"); + ready -= 0xFC; + } + if (ready > 0 && ready % 4 == 0) { + IWMBT_SEND_FRAGMENT(0x01, ready, "firmware chunk"); + ready = 0; + } + } + + /* Wait for firmware download completion event */ + ret = libusb_interrupt_transfer(hdl, + IWMBT_INTERRUPT_ENDPOINT_ADDR, + buf, + sizeof(buf), + &transferred, + IWMBT_LOADCMPL_TIMEOUT); + + if (ret < 0 || transferred < (int)sizeof(struct iwmbt_hci_event) + 1) { + iwmbt_err("libusb_interrupt_transfer() failed: " + "err=%s, size=%d", + libusb_strerror(ret), + transferred); + return (-1); + } + + /* Expect Vendor Specific Event 0x06 */ + event = (struct iwmbt_hci_event *)buf; + if (event->header.event != 0xFF || event->data[0] != 0x06) { + iwmbt_err("firmware download completion event missed"); + return (-1); + } + + return (0); +} + +int +iwmbt_get_version(struct libusb_device_handle *hdl, + struct iwmbt_version *version) +{ + int ret, transferred; + struct iwmbt_hci_event_cmd_compl*event; + struct iwmbt_hci_cmd cmd = { + .opcode = htole16(0xfc05), + .length = 0, + }; + uint8_t buf[IWMBT_HCI_EVT_COMPL_SIZE(struct iwmbt_version)]; + + memset(buf, 0, sizeof(buf)); + + ret = iwmbt_hci_command(hdl, + &cmd, + buf, + sizeof(buf), + &transferred, + IWMBT_HCI_CMD_TIMEOUT); + + if (ret < 0 || transferred != sizeof(buf)) { + iwmbt_debug("Can't get version: : code=%d, size=%d", + ret, + transferred); + return (-1); + } + + event = (struct iwmbt_hci_event_cmd_compl *)buf; + memcpy(version, event->data, sizeof(struct iwmbt_version)); + + return (0); +} + +int +iwmbt_get_boot_params(struct libusb_device_handle *hdl, + struct iwmbt_boot_params *params) +{ + int ret, transferred = 0; + struct iwmbt_hci_event_cmd_compl *event; + struct iwmbt_hci_cmd cmd = { + .opcode = htole16(0xfc0d), + .length = 0, + }; + uint8_t buf[IWMBT_HCI_EVT_COMPL_SIZE(struct iwmbt_boot_params)]; + + memset(buf, 0, sizeof(buf)); + + ret = iwmbt_hci_command(hdl, + &cmd, + buf, + sizeof(buf), + &transferred, + IWMBT_HCI_CMD_TIMEOUT); + + if (ret < 0 || transferred != sizeof(buf)) { + iwmbt_debug("Can't get boot params: code=%d, size=%d", + ret, + transferred); + return (-1); + } + + event = (struct iwmbt_hci_event_cmd_compl *)buf; + memcpy(params, event->data, sizeof(struct iwmbt_boot_params)); + + return (0); +} + +int +iwmbt_intel_reset(struct libusb_device_handle *hdl, uint32_t boot_param) +{ + int ret, transferred = 0; + struct iwmbt_hci_event *event; + static struct iwmbt_hci_cmd cmd = { + .opcode = htole16(0xfc01), + .length = 8, + .data = { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 }, + }; + uint8_t buf[IWMBT_HCI_MAX_EVENT_SIZE]; + + le32enc(cmd.data + 4, boot_param); + memset(buf, 0, sizeof(buf)); + + ret = iwmbt_hci_command(hdl, + &cmd, + buf, + sizeof(buf), + &transferred, + IWMBT_HCI_CMD_TIMEOUT); + + if (ret < 0 || transferred < (int)sizeof(struct iwmbt_hci_event) + 1) { + iwmbt_debug("Intel Reset command failed: code=%d, size=%d", + ret, + transferred); + return (ret); + } + + /* expect Vendor Specific Event 0x02 */ + event = (struct iwmbt_hci_event *)buf; + if (event->header.event != 0xFF || event->data[0] != 0x02) { + iwmbt_err("Intel Reset completion event missed"); + return (-1); + } + + return (0); +} + +int +iwmbt_load_ddc(struct libusb_device_handle *hdl, + const struct iwmbt_firmware *ddc) +{ + int size, sent = 0; + int ret, transferred; + uint8_t buf[IWMBT_HCI_MAX_CMD_SIZE]; + struct iwmbt_hci_cmd *cmd = (struct iwmbt_hci_cmd *)buf; + + size = ddc->len; + + iwmbt_debug("file=%s, size=%d", ddc->fwname, size); + + while (size > 0) { + + memset(buf, 0, sizeof(buf)); + cmd->opcode = htole16(0xfc8b); + cmd->length = ddc->buf[sent] + 1; + memcpy(cmd->data, ddc->buf + sent, XMIN(ddc->buf[sent], size)); + + iwmbt_debug("transferring %d bytes, offset %d", + cmd->length, + sent); + + size -= cmd->length; + sent += cmd->length; + + ret = iwmbt_hci_command(hdl, + cmd, + buf, + sizeof(buf), + &transferred, + IWMBT_HCI_CMD_TIMEOUT); + + if (ret < 0) { + iwmbt_debug("Intel Write DDC failed: code=%d", ret); + return (-1); + } + } + + return (0); +} + +int +iwmbt_set_event_mask(struct libusb_device_handle *hdl) +{ + int ret, transferred = 0; + static struct iwmbt_hci_cmd cmd = { + .opcode = htole16(0xfc52), + .length = 8, + .data = { 0x87, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + }; + uint8_t buf[IWMBT_HCI_MAX_EVENT_SIZE]; + + ret = iwmbt_hci_command(hdl, + &cmd, + buf, + sizeof(buf), + &transferred, + IWMBT_HCI_CMD_TIMEOUT); + + if (ret < 0) + iwmbt_debug("Intel Set Event Mask failed: code=%d", ret); + + return (ret); +} Added: head/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.h Sun Aug 18 22:20:28 2019 (r351197) @@ -0,0 +1,88 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Vladimir Kondratyev + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef __IWMBT_HW_H__ +#define __IWMBT_HW_H__ + +/* USB control request (HCI command) structure */ +struct iwmbt_hci_cmd { + uint16_t opcode; + uint8_t length; + uint8_t data[]; +} __attribute__ ((packed)); + +#define IWMBT_HCI_CMD_SIZE(cmd) \ + ((cmd)->length + offsetof(struct iwmbt_hci_cmd, data)) + +/* USB interrupt transfer HCI event header structure */ +struct iwmbt_hci_evhdr { + uint8_t event; + uint8_t length; +} __attribute__ ((packed)); + +/* USB interrupt transfer (generic HCI event) structure */ +struct iwmbt_hci_event { + struct iwmbt_hci_evhdr header; + uint8_t data[]; +} __attribute__ ((packed)); + +/* USB interrupt transfer (HCI command completion event) structure */ +struct iwmbt_hci_event_cmd_compl { + struct iwmbt_hci_evhdr header; + uint8_t numpkt; + uint16_t opcode; + uint8_t data[]; +} __attribute__ ((packed)); + +#define IWMBT_HCI_EVT_COMPL_SIZE(payload) \ + (offsetof(struct iwmbt_hci_event_cmd_compl, data) + sizeof(payload)) + +#define IWMBT_CONTROL_ENDPOINT_ADDR 0x00 +#define IWMBT_INTERRUPT_ENDPOINT_ADDR 0x81 +#define IWMBT_BULK_IN_ENDPOINT_ADDR 0x82 +#define IWMBT_BULK_OUT_ENDPOINT_ADDR 0x02 + +#define IWMBT_HCI_MAX_CMD_SIZE 256 +#define IWMBT_HCI_MAX_EVENT_SIZE 16 + +#define IWMBT_HCI_CMD_TIMEOUT 2000 /* ms */ +#define IWMBT_LOADCMPL_TIMEOUT 5000 /* ms */ + +extern int iwmbt_load_fwfile(struct libusb_device_handle *hdl, + const struct iwmbt_firmware *fw, uint32_t *boot_param); +extern int iwmbt_get_version(struct libusb_device_handle *hdl, + struct iwmbt_version *version); +extern int iwmbt_get_boot_params(struct libusb_device_handle *hdl, + struct iwmbt_boot_params *params); +extern int iwmbt_intel_reset(struct libusb_device_handle *hdl, + uint32_t boot_param); +extern int iwmbt_load_ddc(struct libusb_device_handle *hdl, + const struct iwmbt_firmware *ddc); +extern int iwmbt_set_event_mask(struct libusb_device_handle *hdl); + +#endif Added: head/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 Sun Aug 18 22:20:28 2019 (r351197) @@ -0,0 +1,96 @@ +.\" Copyright (c) 2013, 2016 Adrian Chadd +.\" Copyright (c) 2019 Vladimir Kondratyev +.\" +.\" 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$ +.\" +.Dd June 4, 2019 +.Dt IWMBTFW 8 +.Os +.Sh NAME +.Nm iwmbtfw +.Nd firmware download utility for Intel Wireless 8260/8265 chip based Bluetooth +USB devices +.Sh SYNOPSIS +.Nm +.Fl d Ar device_name +.Fl f Ar firmware_path +.Nm +.Fl h +.Sh DESCRIPTION +The +.Nm +utility downloads the specified firmware file to the specified +.Xr ugen 4 +device. +.Pp +This utility will +.Em only +work with Intel Wireless 8260/8265 chip based Bluetooth USB devices and some of +their successors. +The identification is currently based on USB vendor ID/product ID pair. +The vendor ID should be 0x8087 +.Pq Dv USB_VENDOR_INTEL2 +and the product ID should be one of the supported devices. +.Pp +Firmware files are available in the +.Pa comms/iwmbt-firmware +port. +.Pp +The +.Nm +utility will query the device to determine which firmware image and board +configuration to load in at runtime. +.Pp +The options are as follows: +.Bl -tag -width indent +.It Fl D +Enable verbose debugging. +.It Fl d Ar device_name +Specify +.Xr ugen 4 +device name. +.It Fl I +Enable informational debugging. +.It Fl f Ar firmware_path +Specify the directory containing the firmware files to search and upload. +.It Fl h +Display usage message and exit. +.El +.Sh EXIT STATUS +.Ex -std +.Sh SEE ALSO +.Xr libusb 3 , +.Xr ugen 4 , +.Xr devd 8 +.Sh AUTHORS +.Nm +is based on +.Xr ath3kfw 8 +utility used as firmware downloader template and on Linux btintel driver +source code. +It is written by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . +.Sh BUGS +Most likely. +Please report if found. Added: head/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf Sun Aug 18 22:20:28 2019 (r351197) @@ -0,0 +1,12 @@ +# $FreeBSD$ +# +# Download Intel Wireless 8260/8265 bluetooth adaptor firmware + +notify 100 { + match "system" "USB"; + match "subsystem" "DEVICE"; + match "type" "ATTACH"; + match "vendor" "0x8087"; + match "product" "(0x0a2b|0x0aaa|0x0025|0x0026|0x0029)"; + action "/usr/sbin/iwmbtfw -d $cdev -f /usr/local/share/iwmbt-firmware"; +}; Added: head/usr.sbin/bluetooth/iwmbtfw/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/iwmbtfw/main.c Sun Aug 18 22:20:28 2019 (r351197) @@ -0,0 +1,456 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2013 Adrian Chadd + * Copyright (c) 2019 Vladimir Kondratyev + * + * 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$ + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "iwmbt_fw.h" +#include "iwmbt_hw.h" +#include "iwmbt_dbg.h" + +#define _DEFAULT_IWMBT_FIRMWARE_PATH "/usr/share/firmware/intel" + +int iwmbt_do_debug = 0; +int iwmbt_do_info = 0; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Aug 18 23:07:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 487ECD3A56; Sun, 18 Aug 2019 23:07:58 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BXlf19Vrz44Zl; Sun, 18 Aug 2019 23:07:58 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09F0895D7; Sun, 18 Aug 2019 23:07:58 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7IN7vTh015722; Sun, 18 Aug 2019 23:07:57 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7IN7uYi015717; Sun, 18 Aug 2019 23:07:56 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201908182307.x7IN7uYi015717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 18 Aug 2019 23:07:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351198 - in head/sys: amd64/amd64 amd64/include vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include vm X-SVN-Commit-Revision: 351198 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 23:07:58 -0000 Author: jeff Date: Sun Aug 18 23:07:56 2019 New Revision: 351198 URL: https://svnweb.freebsd.org/changeset/base/351198 Log: Allocate amd64's page array using pages and page directory pages from the NUMA domain that the pages describe. Patch original from gallatin. Reviewed by: kib Tested by: pho Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21252 Modified: head/sys/amd64/amd64/pmap.c head/sys/amd64/include/pmap.h head/sys/amd64/include/vmparam.h head/sys/vm/vm_page.c head/sys/vm/vm_reserv.c head/sys/vm/vm_reserv.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sun Aug 18 22:20:28 2019 (r351197) +++ head/sys/amd64/amd64/pmap.c Sun Aug 18 23:07:56 2019 (r351198) @@ -383,6 +383,9 @@ static u_int64_t DMPDphys; /* phys addr of direct mapp static u_int64_t DMPDPphys; /* phys addr of direct mapped level 3 */ static int ndmpdpphys; /* number of DMPDPphys pages */ +static uint64_t PAPDPphys; /* phys addr of page array level 3 */ +static int npapdpphys; /* number of PAPDPphys pages */ + static vm_paddr_t KERNend; /* phys addr of end of bootstrap data */ /* @@ -1427,6 +1430,16 @@ create_pagetables(vm_paddr_t *firstaddr) pml4_entry_t *p4_p; uint64_t DMPDkernphys; + npapdpphys = howmany(ptoa(Maxmem) / sizeof(struct vm_page), NBPML4); + if (npapdpphys > NPAPML4E) { + printf("NDMPML4E limits system to %lu GB\n", + (NDMPML4E * 512) * (PAGE_SIZE / sizeof(struct vm_page))); + npapdpphys = NPAPML4E; + Maxmem = atop(NPAPML4E * NBPML4 * + (PAGE_SIZE / sizeof(struct vm_page))); + } + PAPDPphys = allocpages(firstaddr, npapdpphys); + /* Allocate page table pages for the direct map */ ndmpdp = howmany(ptoa(Maxmem), NBPDP); if (ndmpdp < 4) /* Minimum 4GB of dirmap */ @@ -1573,6 +1586,12 @@ create_pagetables(vm_paddr_t *firstaddr) p4_p[KPML4BASE + i] = KPDPphys + ptoa(i); p4_p[KPML4BASE + i] |= X86_PG_RW | X86_PG_V; } + + /* Connect the page array slots up to the pml4. */ + for (i = 0; i < npapdpphys; i++) { + p4_p[PAPML4I + i] = PAPDPphys + ptoa(i); + p4_p[PAPML4I + i] |= X86_PG_RW | X86_PG_V | pg_nx; + } } /* @@ -3387,6 +3406,11 @@ pmap_pinit_pml4(vm_page_t pml4pg) X86_PG_V; } + for (i = 0; i < npapdpphys; i++) { + pm_pml4[PAPML4I + i] = (PAPDPphys + ptoa(i)) | X86_PG_RW | + X86_PG_V; + } + /* install self-referential address mapping entry(s) */ pm_pml4[PML4PML4I] = VM_PAGE_TO_PHYS(pml4pg) | X86_PG_V | X86_PG_RW | X86_PG_A | X86_PG_M; @@ -3743,6 +3767,8 @@ pmap_release(pmap_t pmap) pmap->pm_pml4[KPML4BASE + i] = 0; for (i = 0; i < ndmpdpphys; i++)/* Direct Map */ pmap->pm_pml4[DMPML4I + i] = 0; + for (i = 0; i < npapdpphys; i++) + pmap->pm_pml4[PAPML4I + i] = 0; pmap->pm_pml4[PML4PML4I] = 0; /* Recursive Mapping */ for (i = 0; i < lm_ents; i++) /* Large Map */ pmap->pm_pml4[LMSPML4I + i] = 0; @@ -3779,6 +3805,44 @@ kvm_free(SYSCTL_HANDLER_ARGS) } SYSCTL_PROC(_vm, OID_AUTO, kvm_free, CTLTYPE_LONG|CTLFLAG_RD, 0, 0, kvm_free, "LU", "Amount of KVM free"); + +void +pmap_page_array_startup(long pages) +{ + pdp_entry_t *pdpe; + pd_entry_t *pde, newpdir; + vm_offset_t va, start, end; + vm_paddr_t pa; + long pfn; + int domain, i; + + vm_page_array_size = pages; + + start = va = PA_MIN_ADDRESS; + end = va + (pages * sizeof(struct vm_page)); + while (va < end) { + pfn = first_page + ((va - start) / sizeof(struct vm_page)); + domain = _vm_phys_domain(ctob(pfn)); + pdpe = pmap_pdpe(kernel_pmap, va); + if ((*pdpe & X86_PG_V) == 0) { + pa = vm_phys_early_alloc(domain, PAGE_SIZE); + bzero((void *)PHYS_TO_DMAP(pa), PAGE_SIZE); + *pdpe = (pdp_entry_t)(pa | X86_PG_V | X86_PG_RW | + X86_PG_A | X86_PG_M); + continue; /* try again */ + } + pde = pmap_pdpe_to_pde(pdpe, va); + if ((*pde & X86_PG_V) != 0) + panic("Unexpected pde"); + pa = vm_phys_early_alloc(domain, NBPDR); + for (i = 0; i < NPDEPG; i++) + dump_add_page(pa + (i * PAGE_SIZE)); + newpdir = (pd_entry_t)(pa | X86_PG_V | X86_PG_RW | X86_PG_A | + X86_PG_M | PG_PS | pg_g | pg_nx); + pde_store(pde, newpdir); + va += NBPDR; + } +} /* * grow the number of kernel page table entries, if needed Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Sun Aug 18 22:20:28 2019 (r351197) +++ head/sys/amd64/include/pmap.h Sun Aug 18 23:07:56 2019 (r351198) @@ -201,6 +201,13 @@ #define NDMPML4E 8 /* + * NPAPML4E is the maximum number of PML4 entries that will be + * used to implement the page array. This should be roughly 3% of + * NPDPML4E owing to 3% overhead for struct vm_page. + */ +#define NPAPML4E 1 + +/* * These values control the layout of virtual memory. The starting address * of the direct map, which is controlled by DMPML4I, must be a multiple of * its size. (See the PHYS_TO_DMAP() and DMAP_TO_PHYS() macros.) @@ -219,7 +226,8 @@ #define PML4PML4I (NPML4EPG/2) /* Index of recursive pml4 mapping */ #define KPML4BASE (NPML4EPG-NKPML4E) /* KVM at highest addresses */ -#define DMPML4I rounddown(KPML4BASE-NDMPML4E, NDMPML4E) /* Below KVM */ +#define PAPML4I (KPML4BASE-1-NPAPML4E) /* Below KVM */ +#define DMPML4I rounddown(PAPML4I-NDMPML4E, NDMPML4E) /* Below pages */ #define KPML4I (NPML4EPG-1) #define KPDPI (NPDPEPG-2) /* kernbase at -2GB */ @@ -467,6 +475,7 @@ int pmap_pkru_set(pmap_t pmap, vm_offset_t sva, vm_off u_int keyidx, int flags); void pmap_thread_init_invl_gen(struct thread *td); int pmap_vmspace_copy(pmap_t dst_pmap, pmap_t src_pmap); +void pmap_page_array_startup(long count); #endif /* _KERNEL */ /* Return various clipped indexes for a given VA */ Modified: head/sys/amd64/include/vmparam.h ============================================================================== --- head/sys/amd64/include/vmparam.h Sun Aug 18 22:20:28 2019 (r351197) +++ head/sys/amd64/include/vmparam.h Sun Aug 18 23:07:56 2019 (r351198) @@ -160,7 +160,9 @@ * 0xffff808000000000 - 0xffff847fffffffff large map (can be tuned up) * 0xffff848000000000 - 0xfffff7ffffffffff unused (large map extends there) * 0xfffff80000000000 - 0xfffffbffffffffff 4TB direct map - * 0xfffffc0000000000 - 0xfffffdffffffffff unused + * 0xfffffc0000000000 - 0xfffffcffffffffff unused + * 0xfffffd0000000000 - 0xfffffd7fffffffff page array 512GB + * 0xfffffd8000000000 - 0xfffffdffffffffff unused * 0xfffffe0000000000 - 0xffffffffffffffff 2TB kernel map * * Within the kernel map: @@ -175,6 +177,8 @@ #define DMAP_MIN_ADDRESS KVADDR(DMPML4I, 0, 0, 0) #define DMAP_MAX_ADDRESS KVADDR(DMPML4I + NDMPML4E, 0, 0, 0) +#define PA_MIN_ADDRESS KVADDR(PAPML4I, 0, 0, 0) + #define LARGEMAP_MIN_ADDRESS KVADDR(LMSPML4I, 0, 0, 0) #define LARGEMAP_MAX_ADDRESS KVADDR(LMEPML4I + 1, 0, 0, 0) @@ -210,6 +214,12 @@ ("virtual address %#jx not covered by the DMAP", \ (uintmax_t)x)); \ (x) & ~DMAP_MIN_ADDRESS; }) + +/* + * amd64 statically allocates the page array address so that it can + * be more easily allocated on the correct memory domains. + */ +#define PMAP_HAS_PAGE_ARRAY 1 /* * How many physical pages per kmem arena virtual page. Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Aug 18 22:20:28 2019 (r351197) +++ head/sys/vm/vm_page.c Sun Aug 18 23:07:56 2019 (r351198) @@ -135,7 +135,11 @@ static int vm_pageproc_waiters; */ vm_page_t bogus_page; +#ifdef PMAP_HAS_PAGE_ARRAY +vm_page_t vm_page_array = (vm_page_t)PA_MIN_ADDRESS; +#else vm_page_t vm_page_array; +#endif long vm_page_array_size; long first_page; @@ -522,6 +526,31 @@ vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segi pmap_page_init(m); } +#ifndef PMAP_HAS_PAGE_ARRAY +static vm_paddr_t +vm_page_array_alloc(vm_offset_t *vaddr, vm_paddr_t end, vm_paddr_t page_range) +{ + vm_paddr_t new_end; + + /* + * Reserve an unmapped guard page to trap access to vm_page_array[-1]. + * However, because this page is allocated from KVM, out-of-bounds + * accesses using the direct map will not be trapped. + */ + *vaddr += PAGE_SIZE; + + /* + * Allocate physical memory for the page structures, and map it. + */ + new_end = trunc_page(end - page_range * sizeof(struct vm_page)); + vm_page_array = (vm_page_t)pmap_map(vaddr, new_end, end, + VM_PROT_READ | VM_PROT_WRITE); + vm_page_array_size = page_range; + + return (new_end); +} +#endif + /* * vm_page_startup: * @@ -693,6 +722,11 @@ vm_page_startup(vm_offset_t vaddr) #error "Either VM_PHYSSEG_DENSE or VM_PHYSSEG_SPARSE must be defined." #endif +#ifdef PMAP_HAS_PAGE_ARRAY + pmap_page_array_startup(size / PAGE_SIZE); + biggestone = vm_phys_avail_largest(); + end = new_end = phys_avail[biggestone + 1]; +#else #ifdef VM_PHYSSEG_DENSE /* * In the VM_PHYSSEG_DENSE case, the number of pages can account for @@ -723,31 +757,15 @@ vm_page_startup(vm_offset_t vaddr) } } end = new_end; + new_end = vm_page_array_alloc(&vaddr, end, page_range); +#endif - /* - * Reserve an unmapped guard page to trap access to vm_page_array[-1]. - * However, because this page is allocated from KVM, out-of-bounds - * accesses using the direct map will not be trapped. - */ - vaddr += PAGE_SIZE; - - /* - * Allocate physical memory for the page structures, and map it. - */ - new_end = trunc_page(end - page_range * sizeof(struct vm_page)); - mapped = pmap_map(&vaddr, new_end, end, - VM_PROT_READ | VM_PROT_WRITE); - vm_page_array = (vm_page_t)mapped; - vm_page_array_size = page_range; - #if VM_NRESERVLEVEL > 0 /* * Allocate physical memory for the reservation management system's * data structures, and map it. */ - if (high_avail == end) - high_avail = new_end; - new_end = vm_reserv_startup(&vaddr, new_end, high_avail); + new_end = vm_reserv_startup(&vaddr, new_end); #endif #if defined(__aarch64__) || defined(__amd64__) || defined(__mips__) || \ defined(__riscv) Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Sun Aug 18 22:20:28 2019 (r351197) +++ head/sys/vm/vm_reserv.c Sun Aug 18 23:07:56 2019 (r351198) @@ -1360,10 +1360,23 @@ vm_reserv_size(int level) * management system's data structures, in particular, the reservation array. */ vm_paddr_t -vm_reserv_startup(vm_offset_t *vaddr, vm_paddr_t end, vm_paddr_t high_water) +vm_reserv_startup(vm_offset_t *vaddr, vm_paddr_t end) { - vm_paddr_t new_end; + vm_paddr_t new_end, high_water; size_t size; + int i; + + high_water = phys_avail[1]; + for (i = 0; i < vm_phys_nsegs; i++) { + if (vm_phys_segs[i].end > high_water) + high_water = vm_phys_segs[i].end; + } + + /* Skip the first chunk. It is already accounted for. */ + for (i = 2; phys_avail[i + 1] != 0; i += 2) { + if (phys_avail[i + 1] > high_water) + high_water = phys_avail[i + 1]; + } /* * Calculate the size (in bytes) of the reservation array. Round up Modified: head/sys/vm/vm_reserv.h ============================================================================== --- head/sys/vm/vm_reserv.h Sun Aug 18 22:20:28 2019 (r351197) +++ head/sys/vm/vm_reserv.h Sun Aug 18 23:07:56 2019 (r351198) @@ -66,8 +66,7 @@ boolean_t vm_reserv_reclaim_inactive(int domain); void vm_reserv_rename(vm_page_t m, vm_object_t new_object, vm_object_t old_object, vm_pindex_t old_object_offset); int vm_reserv_size(int level); -vm_paddr_t vm_reserv_startup(vm_offset_t *vaddr, vm_paddr_t end, - vm_paddr_t high_water); +vm_paddr_t vm_reserv_startup(vm_offset_t *vaddr, vm_paddr_t end); vm_page_t vm_reserv_to_superpage(vm_page_t m); #endif /* VM_NRESERVLEVEL > 0 */ From owner-svn-src-head@freebsd.org Sun Aug 18 23:10:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAA96D3AED; Sun, 18 Aug 2019 23:10:07 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BXp75NNXz44jw; Sun, 18 Aug 2019 23:10:07 +0000 (UTC) (envelope-from wulf@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A50295E5; Sun, 18 Aug 2019 23:10:07 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7INA70T015907; Sun, 18 Aug 2019 23:10:07 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7INA7rq015906; Sun, 18 Aug 2019 23:10:07 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201908182310.x7INA7rq015906@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 18 Aug 2019 23:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351199 - head/usr.sbin/bluetooth/iwmbtfw X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/usr.sbin/bluetooth/iwmbtfw X-SVN-Commit-Revision: 351199 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 23:10:07 -0000 Author: wulf Date: Sun Aug 18 23:10:07 2019 New Revision: 351199 URL: https://svnweb.freebsd.org/changeset/base/351199 Log: iwmbtfw(8): Fix compilation on platforms using gcc. X-MFC with: r351197 Modified: head/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c Modified: head/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c ============================================================================== --- head/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c Sun Aug 18 23:07:56 2019 (r351198) +++ head/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c Sun Aug 18 23:10:07 2019 (r351199) @@ -68,7 +68,7 @@ iwmbt_send_fragment(struct libusb_device_handle *hdl, &transferred, timeout); - if (ret < 0 || transferred != IWMBT_HCI_CMD_SIZE(cmd)) { + if (ret < 0 || transferred != (int)IWMBT_HCI_CMD_SIZE(cmd)) { iwmbt_err("libusb_bulk_transfer() failed: err=%s, size=%zu", libusb_strerror(ret), IWMBT_HCI_CMD_SIZE(cmd)); From owner-svn-src-head@freebsd.org Sun Aug 18 23:44:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C33A4D4354; Sun, 18 Aug 2019 23:44:24 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BYYh4lldz46Kx; Sun, 18 Aug 2019 23:44:24 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84EC89D1B; Sun, 18 Aug 2019 23:44:24 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7INiOIX039116; Sun, 18 Aug 2019 23:44:24 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7INiN3M039113; Sun, 18 Aug 2019 23:44:23 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201908182344.x7INiN3M039113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 18 Aug 2019 23:44:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351200 - in head/sys: amd64/amd64 dev/acpica X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: amd64/amd64 dev/acpica X-SVN-Commit-Revision: 351200 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 23:44:24 -0000 Author: jeff Date: Sun Aug 18 23:44:23 2019 New Revision: 351200 URL: https://svnweb.freebsd.org/changeset/base/351200 Log: Allocate all per-cpu datastructures in domain correct memory. Reviewed by: kib, gallatin (some objections) Tested by: pho Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21242 Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/dev/acpica/acpi_pxm.c head/sys/dev/acpica/acpivar.h Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Sun Aug 18 23:10:07 2019 (r351199) +++ head/sys/amd64/amd64/mp_machdep.c Sun Aug 18 23:44:23 2019 (r351200) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef GPROF #include #endif @@ -59,6 +60,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -75,6 +78,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #define WARMBOOT_TARGET 0 #define WARMBOOT_OFF (KERNBASE + 0x0467) #define WARMBOOT_SEG (KERNBASE + 0x0469) @@ -384,6 +390,25 @@ init_secondary(void) * local functions and data */ +#ifdef NUMA +static void +mp_realloc_pcpu(int cpuid, int domain) +{ + vm_page_t m; + vm_offset_t oa, na; + + oa = (vm_offset_t)&__pcpu[cpuid]; + if (_vm_phys_domain(pmap_kextract(oa)) == domain) + return; + m = vm_page_alloc_domain(NULL, 0, domain, + VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_ZERO); + na = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); + pagecopy((void *)oa, (void *)na); + pmap_enter(kernel_pmap, oa, m, VM_PROT_READ | VM_PROT_WRITE, 0, 0); + /* XXX old pcpu page leaked. */ +} +#endif + /* * start each AP in our list */ @@ -392,7 +417,7 @@ native_start_all_aps(void) { u_int64_t *pt4, *pt3, *pt2; u_int32_t mpbioswarmvec; - int apic_id, cpu, i; + int apic_id, cpu, domain, i; u_char mpbiosreason; mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); @@ -431,21 +456,41 @@ native_start_all_aps(void) outb(CMOS_REG, BIOS_RESET); outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ + /* Relocate pcpu areas to the correct domain. */ +#ifdef NUMA + if (vm_ndomains > 1) + for (cpu = 1; cpu < mp_ncpus; cpu++) { + apic_id = cpu_apic_ids[cpu]; + domain = acpi_pxm_get_cpu_locality(apic_id); + mp_realloc_pcpu(cpu, domain); + } +#endif + /* start each AP */ + domain = 0; for (cpu = 1; cpu < mp_ncpus; cpu++) { apic_id = cpu_apic_ids[cpu]; - +#ifdef NUMA + if (vm_ndomains > 1) + domain = acpi_pxm_get_cpu_locality(apic_id); +#endif /* allocate and set up an idle stack data page */ - bootstacks[cpu] = (void *)kmem_malloc(kstack_pages * PAGE_SIZE, + bootstacks[cpu] = (void *)kmem_malloc_domainset( + DOMAINSET_FIXED(domain), kstack_pages * PAGE_SIZE, M_WAITOK | M_ZERO); - doublefault_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | - M_ZERO); - mce_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); - nmi_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); - dbg_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); - dpcpu = (void *)kmem_malloc(DPCPU_SIZE, M_WAITOK | M_ZERO); + doublefault_stack = (char *)kmem_malloc_domainset( + DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + mce_stack = (char *)kmem_malloc_domainset( + DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + nmi_stack = (char *)kmem_malloc_domainset( + DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + dbg_stack = (char *)kmem_malloc_domainset( + DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + dpcpu = (void *)kmem_malloc_domainset(DOMAINSET_FIXED(domain), + DPCPU_SIZE, M_WAITOK | M_ZERO); - bootSTK = (char *)bootstacks[cpu] + kstack_pages * PAGE_SIZE - 8; + bootSTK = (char *)bootstacks[cpu] + + kstack_pages * PAGE_SIZE - 8; bootAP = cpu; /* attempt to start the Application Processor */ Modified: head/sys/dev/acpica/acpi_pxm.c ============================================================================== --- head/sys/dev/acpica/acpi_pxm.c Sun Aug 18 23:10:07 2019 (r351199) +++ head/sys/dev/acpica/acpi_pxm.c Sun Aug 18 23:44:23 2019 (r351200) @@ -653,6 +653,17 @@ acpi_pxm_set_cpu_locality(void) } } +int +acpi_pxm_get_cpu_locality(int apic_id) +{ + struct cpu_info *cpu; + + cpu = cpu_find(apic_id); + if (cpu == NULL) + panic("SRAT: CPU with ID %u is not known", apic_id); + return (cpu->domain); +} + /* * Free data structures allocated during acpi_pxm_init. */ Modified: head/sys/dev/acpica/acpivar.h ============================================================================== --- head/sys/dev/acpica/acpivar.h Sun Aug 18 23:10:07 2019 (r351199) +++ head/sys/dev/acpica/acpivar.h Sun Aug 18 23:44:23 2019 (r351200) @@ -532,6 +532,7 @@ int acpi_pxm_init(int ncpus, vm_paddr_t maxphys); void acpi_pxm_parse_tables(void); void acpi_pxm_set_mem_locality(void); void acpi_pxm_set_cpu_locality(void); +int acpi_pxm_get_cpu_locality(int apic_id); void acpi_pxm_free(void); /* From owner-svn-src-head@freebsd.org Mon Aug 19 00:29:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7582D4E1A; Mon, 19 Aug 2019 00:29:05 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BZYF4PFbz480D; Mon, 19 Aug 2019 00:29:05 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75EFBA4A2; Mon, 19 Aug 2019 00:29:05 +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 x7J0T5Ya063617; Mon, 19 Aug 2019 00:29:05 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7J0T5R6063616; Mon, 19 Aug 2019 00:29:05 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201908190029.x7J0T5R6063616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 19 Aug 2019 00:29:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351201 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 00:29:05 -0000 Author: rmacklem Date: Mon Aug 19 00:29:05 2019 New Revision: 351201 URL: https://svnweb.freebsd.org/changeset/base/351201 Log: Add a vop_stdioctl() that performs a trivial FIOSEEKDATA/FIOSEEKHOLE. Without this patch, when an application performed lseek(SEEK_DATA/SEEK_HOLE) on a file in a file system that does not have its own VOP_IOCTL(), the lseek(2) fails with errno ENOTTY. This didn't seem appropriate, since ENOTTY is not listed as an error return by either the lseek(2) man page nor the POSIX draft for lseek(2). A discussion on freebsd-current@ seemed to indicate that implementing a trivial algorithm that returns the offset argument for FIOSEEKDATA and returns the file's size for FIOSEEKHOLE was the preferred fix. http://docs.FreeBSD.org/cgi/mid.cgi?CAOtMX2iiQdv1+15e1N_r7V6aCx_VqAJCTP1AW+qs3Yg7sPg9wA The Linux kernel appears to implement this trivial algorithm as well. This patch adds a vop_stdioctl() that implements this trivial algorithm. It returns errors consistent with vn_bmap_seekhole() and, as such, will still return ENOTTY for non-regular files. I have proposed a separate patch that maps errors not described by the lseek(2) man page nor POSIX draft to EINVAL. This patch is under separate review. Reviewed by: kib Relnotes: yes Differential Revision: https://reviews.freebsd.org/D21299 Modified: head/sys/kern/vfs_default.c Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Sun Aug 18 23:44:23 2019 (r351200) +++ head/sys/kern/vfs_default.c Mon Aug 19 00:29:05 2019 (r351201) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -86,6 +87,7 @@ static int vop_stdadd_writecount(struct vop_add_writec static int vop_stdcopy_file_range(struct vop_copy_file_range_args *ap); static int vop_stdfdatasync(struct vop_fdatasync_args *ap); static int vop_stdgetpages_async(struct vop_getpages_async_args *ap); +static int vop_stdioctl(struct vop_ioctl_args *ap); /* * This vnode table stores what we want to do if the filesystem doesn't @@ -118,7 +120,7 @@ struct vop_vector default_vnodeops = { .vop_getpages_async = vop_stdgetpages_async, .vop_getwritemount = vop_stdgetwritemount, .vop_inactive = VOP_NULL, - .vop_ioctl = VOP_ENOTTY, + .vop_ioctl = vop_stdioctl, .vop_kqfilter = vop_stdkqfilter, .vop_islocked = vop_stdislocked, .vop_lock1 = vop_stdlock, @@ -1152,6 +1154,41 @@ vop_stdadd_writecount(struct vop_add_writecount_args * error = 0; } VI_UNLOCK(vp); + return (error); +} + +static int +vop_stdioctl(struct vop_ioctl_args *ap) +{ + struct vnode *vp; + struct vattr va; + off_t *offp; + int error; + + switch (ap->a_command) { + case FIOSEEKDATA: + case FIOSEEKHOLE: + vp = ap->a_vp; + error = vn_lock(vp, LK_SHARED); + if (error != 0) + return (EBADF); + if (vp->v_type == VREG) + error = VOP_GETATTR(vp, &va, ap->a_cred); + else + error = ENOTTY; + if (error == 0) { + offp = ap->a_data; + if (*offp < 0 || *offp >= va.va_size) + error = ENXIO; + else if (ap->a_command == FIOSEEKHOLE) + *offp = va.va_size; + } + VOP_UNLOCK(vp, 0); + break; + default: + error = ENOTTY; + break; + } return (error); } From owner-svn-src-head@freebsd.org Mon Aug 19 00:46:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A911D5225; Mon, 19 Aug 2019 00:46:32 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BZxN3bNfz48gN; Mon, 19 Aug 2019 00:46:32 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D167A834; Mon, 19 Aug 2019 00:46:32 +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 x7J0kWT1075223; Mon, 19 Aug 2019 00:46:32 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7J0kW2w075222; Mon, 19 Aug 2019 00:46:32 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201908190046.x7J0kW2w075222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 19 Aug 2019 00:46:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351202 - head X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 351202 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 00:46:32 -0000 Author: rmacklem Date: Mon Aug 19 00:46:31 2019 New Revision: 351202 URL: https://svnweb.freebsd.org/changeset/base/351202 Log: Add an entry to RELNOTES for r351201. Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Mon Aug 19 00:29:05 2019 (r351201) +++ head/RELNOTES Mon Aug 19 00:46:31 2019 (r351202) @@ -10,6 +10,15 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +r351201: + Add a vop_stdioctl() call, so that file systems that do not support + holes will have a trivial implementation of lseek(SEEK_DATA/SEEK_HOLE). + The algorithm appears to be compatible with the POSIX draft and + the implementation in Linux for the case of a file system that + does not support holes. Prior to this patch, lseek(2) would reply + -1 with errno set to ENOTTY for SEEK_DATA/SEEK_HOLE on files in + file systems that do not support holes. + r350665: The fuse driver has been renamed to fusefs(5) and been substantially rewritten. The new driver includes many bug fixes and performance From owner-svn-src-head@freebsd.org Mon Aug 19 01:14:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F617D576D; Mon, 19 Aug 2019 01:14:12 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BbYH6dykz49lK; Mon, 19 Aug 2019 01:14:11 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5A3CADCD; Mon, 19 Aug 2019 01:14:11 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7J1EBGK092736; Mon, 19 Aug 2019 01:14:11 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7J1EBJL092735; Mon, 19 Aug 2019 01:14:11 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908190114.x7J1EBJL092735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 19 Aug 2019 01:14:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351203 - head/usr.sbin/periodic X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/usr.sbin/periodic X-SVN-Commit-Revision: 351203 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 01:14:12 -0000 Author: asomers Date: Mon Aug 19 01:14:11 2019 New Revision: 351203 URL: https://svnweb.freebsd.org/changeset/base/351203 Log: periodic: replace "tty" with "test -t 0" Apparently using tty for this purpose has been deprecated since 4.4 Lite. Reviewed by: cy MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D21318 Modified: head/usr.sbin/periodic/periodic.sh Modified: head/usr.sbin/periodic/periodic.sh ============================================================================== --- head/usr.sbin/periodic/periodic.sh Mon Aug 19 00:46:31 2019 (r351202) +++ head/usr.sbin/periodic/periodic.sh Mon Aug 19 01:14:11 2019 (r351203) @@ -84,7 +84,7 @@ else # remove the file. remove_periodic_anticongestion_file=no fi -if tty > /dev/null 2>&1; then +if [ -t 0 ]; then export PERIODIC_IS_INTERACTIVE=1 fi tmp_output=`mktemp ${TMPDIR:-/tmp}/periodic.XXXXXXXXXX` From owner-svn-src-head@freebsd.org Mon Aug 19 04:09:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB4F0D7A15; Mon, 19 Aug 2019 04:09:55 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BgS33crCz4HVl; Mon, 19 Aug 2019 04:09:55 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id zYzOhNrJ6sAGkzYzQhLoKp; Sun, 18 Aug 2019 22:09:53 -0600 X-Authority-Analysis: v=2.3 cv=WeVylHpX c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=IVX3wovNNqagbmfdRnwA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 6BB2DF9; Sun, 18 Aug 2019 21:09:50 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x7J49oEW014805; Sun, 18 Aug 2019 21:09:50 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x7J49o32014802; Sun, 18 Aug 2019 21:09:50 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201908190409.x7J49o32014802@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Mateusz Guzik cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351193 - head/sys/kern In-reply-to: <201908181840.x7IIeCAL055888@repo.freebsd.org> References: <201908181840.x7IIeCAL055888@repo.freebsd.org> Comments: In-reply-to Mateusz Guzik message dated "Sun, 18 Aug 2019 18:40:12 -0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 18 Aug 2019 21:09:49 -0700 X-CMAE-Envelope: MS4wfJxcH4Nrpq9wtLZ4E9U/f6c0wp3UMrAYepOg28IWb7WutScBQ/VH9R5TS+I0Rzr8yBTCN3/FxsobCaR2/ekdPdS84GAA4jiBWyecs3WGfFcRVt9qu6hR r/cvG5+2MXsF99pIEZ8NAVAjHVPdz+XDJKp8/9vnwQHnDPpchve+I4e7mB2Jk2PZB5DUSr4dY9uFfRBF/Cg0ATDgSPKVTq3porvdMytWnOAp5uohz7Ish5oe SYW0IhzcqBaByBLge45WH3KO/8jw5p8b9Z8EEyzAlWJdJDFPVfcO5Hcwz4phVhTz X-Rspamd-Queue-Id: 46BgS33crCz4HVl X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.948,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 04:09:56 -0000 In message <201908181840.x7IIeCAL055888@repo.freebsd.org>, Mateusz Guzik writes : > Author: mjg > Date: Sun Aug 18 18:40:12 2019 > New Revision: 351193 > URL: https://svnweb.freebsd.org/changeset/base/351193 > > Log: > vfs: stop always overwriting ->mnt_stat in VFS_STATFS > > The struct is already populated on each mount (and remount). Fields are eit > her > constant or not used by filesystem in the first place. > > Some infrequently used functions use it to avoid having to allocate a new b > uffer > and are left alone. > > The current code results in an avoidable copying single-threaded and signif > icant > cache line bouncing multithreaded > > While here deduplicate initial filling of the struct. > > Reviewed by: kib > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D21317 > > Modified: > head/sys/kern/vfs_mount.c > head/sys/kern/vfs_syscalls.c > > Modified: head/sys/kern/vfs_mount.c > ============================================================================= > = > --- head/sys/kern/vfs_mount.c Sun Aug 18 17:12:06 2019 (r351192) > +++ head/sys/kern/vfs_mount.c Sun Aug 18 18:40:12 2019 (r351193) > @@ -1831,12 +1831,15 @@ vfs_copyopt(struct vfsoptlist *opts, const char *name > , > int > __vfs_statfs(struct mount *mp, struct statfs *sbp) > { > - int error; > > - error = mp->mnt_op->vfs_statfs(mp, &mp->mnt_stat); > - if (sbp != &mp->mnt_stat) > - *sbp = mp->mnt_stat; > - return (error); > + /* > + * Set these in case the underlying filesystem fails to do so. > + */ > + sbp->f_version = STATFS_VERSION; > + sbp->f_namemax = NAME_MAX; > + sbp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; > + > + return (mp->mnt_op->vfs_statfs(mp, sbp)); > } > > void > > Modified: head/sys/kern/vfs_syscalls.c > ============================================================================= > = > --- head/sys/kern/vfs_syscalls.c Sun Aug 18 17:12:06 2019 (r35119 > 2) > +++ head/sys/kern/vfs_syscalls.c Sun Aug 18 18:40:12 2019 (r35119 > 3) > @@ -248,7 +248,6 @@ statfs_scale_blocks(struct statfs *sf, long max_size) > static int > kern_do_statfs(struct thread *td, struct mount *mp, struct statfs *buf) > { > - struct statfs *sp; > int error; > > if (mp == NULL) > @@ -262,17 +261,9 @@ kern_do_statfs(struct thread *td, struct mount *mp, st > if (error != 0) > goto out; > #endif > - /* > - * Set these in case the underlying filesystem fails to do so. > - */ > - sp = &mp->mnt_stat; > - sp->f_version = STATFS_VERSION; > - sp->f_namemax = NAME_MAX; > - sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; > - error = VFS_STATFS(mp, sp); > + error = VFS_STATFS(mp, buf); > if (error != 0) > goto out; > - *buf = *sp; > if (priv_check(td, PRIV_VFS_GENERATION)) { > buf->f_fsid.val[0] = buf->f_fsid.val[1] = 0; > prison_enforce_statfs(td->td_ucred, mp, buf); > @@ -476,13 +467,6 @@ restart: > if (sfsp != NULL && count < maxcount) { > sp = &mp->mnt_stat; > /* > - * Set these in case the underlying filesystem > - * fails to do so. > - */ > - sp->f_version = STATFS_VERSION; > - sp->f_namemax = NAME_MAX; > - sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; > - /* > * If MNT_NOWAIT is specified, do not refresh > * the fsstat cache. > */ > @@ -4545,7 +4529,6 @@ sys_fhstatfs(struct thread *td, struct fhstatfs_args * > int > kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf) > { > - struct statfs *sp; > struct mount *mp; > struct vnode *vp; > int error; > @@ -4569,16 +4552,7 @@ kern_fhstatfs(struct thread *td, fhandle_t fh, struct > if (error != 0) > goto out; > #endif > - /* > - * Set these in case the underlying filesystem fails to do so. > - */ > - sp = &mp->mnt_stat; > - sp->f_version = STATFS_VERSION; > - sp->f_namemax = NAME_MAX; > - sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; > - error = VFS_STATFS(mp, sp); > - if (error == 0) > - *buf = *sp; > + error = VFS_STATFS(mp, buf); > out: > vfs_unbusy(mp); > return (error); > Hi mjg@, This revsion has caused a df(1) and statfs(2) a bit of gas. cwsys# df -h / Filesystem Size Used Avail Capacity Mounted on dsk02/src 1.9G 551M 1.2G 30% /opt/src cwsys# cwsys# df -h /usr Filesystem Size Used Avail Capacity Mounted on dsk02/var/mqueue 2.9G 1.3G 1.4G 47% /var/spool/mqueue cwsys# df -h /var Filesystem Size Used Avail Capacity Mounted on dsk02/src/svn-current 1.9G 1.4G 380M 79% /opt/src/svn-current cwsys# df -h /var/tmp Filesystem Size Used Avail Capacity Mounted on dsk02/src 992M 198M 714M 22% /opt/src cwsys# cwfw# df -h / Filesystem Size Used Avail Capacity Mounted on 4.0G 1.6G 2.0G 45% cwfw# df -h /usr Filesystem Size Used Avail Capacity Mounted on 4.0G 1.6G 2.0G 45% cwfw# df -h /var Filesystem Size Used Avail Capacity Mounted on 2.9G 647M 2.0G 24% cwfw# df -h /tmp Filesystem Size Used Avail Capacity Mounted on 300M 4.0K 300M 0% cwfw# df -h /var/tmp Filesystem Size Used Avail Capacity Mounted on 2.9G 648M 2.0G 24% cwfw# Reverting this revision corrected this regression. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Mon Aug 19 04:28:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C122D7F9B; Mon, 19 Aug 2019 04:28:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Bgs93M5Jz4JDr; Mon, 19 Aug 2019 04:28: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50807D1EB; Mon, 19 Aug 2019 04:28: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 x7J4SDsx006578; Mon, 19 Aug 2019 04:28:13 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7J4SD5W006577; Mon, 19 Aug 2019 04:28:13 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908190428.x7J4SD5W006577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 19 Aug 2019 04:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351204 - head/sbin/fsck_msdosfs X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/fsck_msdosfs X-SVN-Commit-Revision: 351204 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 04:28:13 -0000 Author: delphij Date: Mon Aug 19 04:28:12 2019 New Revision: 351204 URL: https://svnweb.freebsd.org/changeset/base/351204 Log: Remove redundant check and wrong fix: fat.c checks already take care about cluster chains. Obtained from: OpenBSD MFC after: 2 weeks Modified: head/sbin/fsck_msdosfs/dir.c Modified: head/sbin/fsck_msdosfs/dir.c ============================================================================== --- head/sbin/fsck_msdosfs/dir.c Mon Aug 19 01:14:11 2019 (r351203) +++ head/sbin/fsck_msdosfs/dir.c Mon Aug 19 04:28:12 2019 (r351204) @@ -220,7 +220,6 @@ int resetDosDirSection(struct bootblock *boot, struct fatEntry *fat) { int b1, b2; - cl_t cl; int ret = FSOK; size_t len; @@ -253,24 +252,9 @@ resetDosDirSection(struct bootblock *boot, struct fatE boot->bpbRootClust); return FSFATAL; } - cl = fat[boot->bpbRootClust].next; - if (cl < CLUST_FIRST - || (cl >= CLUST_RSRVD && cl< CLUST_EOFS) - || fat[boot->bpbRootClust].head != boot->bpbRootClust) { - if (cl == CLUST_FREE) - pwarn("Root directory starts with free cluster\n"); - else if (cl >= CLUST_RSRVD) - pwarn("Root directory starts with cluster marked %s\n", - rsrvdcltype(cl)); - else { - pfatal("Root directory doesn't start a cluster chain"); - return FSFATAL; - } - if (ask(1, "Fix")) { - fat[boot->bpbRootClust].next = CLUST_FREE; - ret = FSFATMOD; - } else - ret = FSFATAL; + if (fat[boot->bpbRootClust].head != boot->bpbRootClust) { + pfatal("Root directory doesn't start a cluster chain"); + return FSFATAL; } fat[boot->bpbRootClust].flags |= FAT_USED; From owner-svn-src-head@freebsd.org Mon Aug 19 04:30:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E98DA80A1; Mon, 19 Aug 2019 04:30:47 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Bgw61z86z4JNZ; Mon, 19 Aug 2019 04:30:46 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-ot1-x343.google.com with SMTP id c7so481474otp.1; Sun, 18 Aug 2019 21:30:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=dd+XnnQ3liyVhAWMXlup6qCDg2OCvrQbGppgOE2qrO4=; b=WktQsWUrxjMoo4rXxu9Aq4cXNhz4He3lbkOiqkR5aark3iwCSEjqz6soa5CR9FA3bX 5dCEExzc7a/PTQZetiwpqtHHoR9k1PaM1Dr/bPCw+jjmyQn++svZOt0AdBjDQy8VHoqs GnGaxw+ntNDPo+pR2ECcE/DUAdYf48YRPGEcqdjZWrAywVJ+tsQKSs4lw0CUKp3kVQ6A l3T6n7cM6VTXolsxImHU61UWYi962OwDfiSarDRAXKt0Z0Cj0jxfBqlPq1X37ujlsbct 9Vq3lmsg0brAJl8asXnPliKXGHUULkqNCou6BWX9hk0rPUCkNvE40aFoUyFSVA5BQya+ P+eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=dd+XnnQ3liyVhAWMXlup6qCDg2OCvrQbGppgOE2qrO4=; b=Z8bbahcbRWscii9IfgxjcJAiODRoOeAuWNhLtSvIetyVU7OWJtiBNts0Y+glSi2Bxu r4e35eHOTuz+mgmi9grc3ZwU48UNTcMfigbnUHgKIVR4d16Ml3I/3elcukl9i+OlCbop kF47WzKEdNbzZH+Yl/Fodg33qm4PaBN48tv6cm16WhvbVvEqa2A1yJ8DH55Kyuhx0vY8 4/J2cuNuURx9HwByq1UKS9iukbBv4ZVHlXuyx+NVlc7b6J+dMmtmrjOhGHlMM1TLvll1 EkJLEARGJeZZRRKBed1YXFsXGy7UOc1oQkCgshrccJAuqt2MSANOYNM2675rpaNwHajW /3hA== X-Gm-Message-State: APjAAAWDHJDRBOL1Xmcujbw29bTPqeGeBgB14XX+PlZQxxjB6JbzGpmY DRbsrBdHeiaGQP8G7xrpYGuAM+x92xzb64QcQ8k= X-Google-Smtp-Source: APXvYqytoAou/JbnnzCToBbs3VT2zOBcdQ0kjmPDANLQLPbfG//92fdQmZ5I2OcxtiZzKXSr7aN+E6sZBHOxl+hiWFA= X-Received: by 2002:a9d:7f05:: with SMTP id j5mr5379605otq.102.1566189044648; Sun, 18 Aug 2019 21:30:44 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:2516:0:0:0:0:0 with HTTP; Sun, 18 Aug 2019 21:30:44 -0700 (PDT) In-Reply-To: <201908190409.x7J49o32014802@slippy.cwsent.com> References: <201908181840.x7IIeCAL055888@repo.freebsd.org> <201908190409.x7J49o32014802@slippy.cwsent.com> From: Mateusz Guzik Date: Mon, 19 Aug 2019 06:30:44 +0200 Message-ID: Subject: Re: svn commit: r351193 - head/sys/kern To: Cy Schubert Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46Bgw61z86z4JNZ X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=WktQsWUr; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2607:f8b0:4864:20::343 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.98 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (2.94), ipnet: 2607:f8b0::/32(-2.95), asn: 15169(-2.38), country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[3.4.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 04:30:47 -0000 Sorry, cannot test right now. Does this fix it for you? diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 6a1547854c9d..0cde451e5890 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -466,18 +466,12 @@ kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, } if (sfsp != NULL && count < maxcount) { sp = &mp->mnt_stat; - /* - * If MNT_NOWAIT is specified, do not refresh - * the fsstat cache. - */ - if (mode != MNT_NOWAIT) { - error = VFS_STATFS(mp, sp); - if (error != 0) { - mtx_lock(&mountlist_mtx); - nmp = TAILQ_NEXT(mp, mnt_list); - vfs_unbusy(mp); - continue; - } + error = VFS_STATFS(mp, sp); + if (error != 0) { + mtx_lock(&mountlist_mtx); + nmp = TAILQ_NEXT(mp, mnt_list); + vfs_unbusy(mp); + continue; } if (priv_check(td, PRIV_VFS_GENERATION)) { sptmp = malloc(sizeof(struct statfs), M_STATFS, On 8/19/19, Cy Schubert wrote: > In message <201908181840.x7IIeCAL055888@repo.freebsd.org>, Mateusz Guzik > writes > : >> Author: mjg >> Date: Sun Aug 18 18:40:12 2019 >> New Revision: 351193 >> URL: https://svnweb.freebsd.org/changeset/base/351193 >> >> Log: >> vfs: stop always overwriting ->mnt_stat in VFS_STATFS >> >> The struct is already populated on each mount (and remount). Fields are >> eit >> her >> constant or not used by filesystem in the first place. >> >> Some infrequently used functions use it to avoid having to allocate a >> new b >> uffer >> and are left alone. >> >> The current code results in an avoidable copying single-threaded and >> signif >> icant >> cache line bouncing multithreaded >> >> While here deduplicate initial filling of the struct. >> >> Reviewed by: kib >> Sponsored by: The FreeBSD Foundation >> Differential Revision: https://reviews.freebsd.org/D21317 >> >> Modified: >> head/sys/kern/vfs_mount.c >> head/sys/kern/vfs_syscalls.c >> >> Modified: head/sys/kern/vfs_mount.c >> ============================================================================= >> = >> --- head/sys/kern/vfs_mount.c Sun Aug 18 17:12:06 2019 (r351192) >> +++ head/sys/kern/vfs_mount.c Sun Aug 18 18:40:12 2019 (r351193) >> @@ -1831,12 +1831,15 @@ vfs_copyopt(struct vfsoptlist *opts, const char >> *name >> , >> int >> __vfs_statfs(struct mount *mp, struct statfs *sbp) >> { >> - int error; >> >> - error = mp->mnt_op->vfs_statfs(mp, &mp->mnt_stat); >> - if (sbp != &mp->mnt_stat) >> - *sbp = mp->mnt_stat; >> - return (error); >> + /* >> + * Set these in case the underlying filesystem fails to do so. >> + */ >> + sbp->f_version = STATFS_VERSION; >> + sbp->f_namemax = NAME_MAX; >> + sbp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; >> + >> + return (mp->mnt_op->vfs_statfs(mp, sbp)); >> } >> >> void >> >> Modified: head/sys/kern/vfs_syscalls.c >> ============================================================================= >> = >> --- head/sys/kern/vfs_syscalls.c Sun Aug 18 17:12:06 2019 (r35119 >> 2) >> +++ head/sys/kern/vfs_syscalls.c Sun Aug 18 18:40:12 2019 (r35119 >> 3) >> @@ -248,7 +248,6 @@ statfs_scale_blocks(struct statfs *sf, long max_size) >> static int >> kern_do_statfs(struct thread *td, struct mount *mp, struct statfs *buf) >> { >> - struct statfs *sp; >> int error; >> >> if (mp == NULL) >> @@ -262,17 +261,9 @@ kern_do_statfs(struct thread *td, struct mount *mp, >> st >> if (error != 0) >> goto out; >> #endif >> - /* >> - * Set these in case the underlying filesystem fails to do so. >> - */ >> - sp = &mp->mnt_stat; >> - sp->f_version = STATFS_VERSION; >> - sp->f_namemax = NAME_MAX; >> - sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; >> - error = VFS_STATFS(mp, sp); >> + error = VFS_STATFS(mp, buf); >> if (error != 0) >> goto out; >> - *buf = *sp; >> if (priv_check(td, PRIV_VFS_GENERATION)) { >> buf->f_fsid.val[0] = buf->f_fsid.val[1] = 0; >> prison_enforce_statfs(td->td_ucred, mp, buf); >> @@ -476,13 +467,6 @@ restart: >> if (sfsp != NULL && count < maxcount) { >> sp = &mp->mnt_stat; >> /* >> - * Set these in case the underlying filesystem >> - * fails to do so. >> - */ >> - sp->f_version = STATFS_VERSION; >> - sp->f_namemax = NAME_MAX; >> - sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; >> - /* >> * If MNT_NOWAIT is specified, do not refresh >> * the fsstat cache. >> */ >> @@ -4545,7 +4529,6 @@ sys_fhstatfs(struct thread *td, struct fhstatfs_args >> * >> int >> kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf) >> { >> - struct statfs *sp; >> struct mount *mp; >> struct vnode *vp; >> int error; >> @@ -4569,16 +4552,7 @@ kern_fhstatfs(struct thread *td, fhandle_t fh, >> struct >> if (error != 0) >> goto out; >> #endif >> - /* >> - * Set these in case the underlying filesystem fails to do so. >> - */ >> - sp = &mp->mnt_stat; >> - sp->f_version = STATFS_VERSION; >> - sp->f_namemax = NAME_MAX; >> - sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; >> - error = VFS_STATFS(mp, sp); >> - if (error == 0) >> - *buf = *sp; >> + error = VFS_STATFS(mp, buf); >> out: >> vfs_unbusy(mp); >> return (error); >> > > Hi mjg@, > > This revsion has caused a df(1) and statfs(2) a bit of gas. > > cwsys# df -h / > Filesystem Size Used Avail Capacity Mounted on > dsk02/src 1.9G 551M 1.2G 30% /opt/src > cwsys# > cwsys# df -h /usr > Filesystem Size Used Avail Capacity Mounted on > dsk02/var/mqueue 2.9G 1.3G 1.4G 47% /var/spool/mqueue > cwsys# df -h /var > Filesystem Size Used Avail Capacity Mounted on > dsk02/src/svn-current 1.9G 1.4G 380M 79% > /opt/src/svn-current > cwsys# df -h /var/tmp > Filesystem Size Used Avail Capacity Mounted on > dsk02/src 992M 198M 714M 22% /opt/src > cwsys# > > cwfw# df -h / > Filesystem Size Used Avail Capacity Mounted on > 4.0G 1.6G 2.0G 45% > cwfw# df -h /usr > Filesystem Size Used Avail Capacity Mounted on > 4.0G 1.6G 2.0G 45% > cwfw# df -h /var > Filesystem Size Used Avail Capacity Mounted on > 2.9G 647M 2.0G 24% > cwfw# df -h /tmp > Filesystem Size Used Avail Capacity Mounted on > 300M 4.0K 300M 0% > cwfw# df -h /var/tmp > Filesystem Size Used Avail Capacity Mounted on > 2.9G 648M 2.0G 24% > cwfw# > > Reverting this revision corrected this regression. > > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: http://www.FreeBSD.org > > The need of the many outweighs the greed of the few. > > > -- Mateusz Guzik From owner-svn-src-head@freebsd.org Mon Aug 19 05:24:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82B1EA8E49; Mon, 19 Aug 2019 05:24:43 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Bj6M2hKXz4LBj; Mon, 19 Aug 2019 05:24:43 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BC2DDC73; Mon, 19 Aug 2019 05:24:43 +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 x7J5Oh4p041713; Mon, 19 Aug 2019 05:24:43 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7J5OhV4041712; Mon, 19 Aug 2019 05:24:43 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908190524.x7J5OhV4041712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 19 Aug 2019 05:24:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351205 - head/sbin/fsck_msdosfs X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/fsck_msdosfs X-SVN-Commit-Revision: 351205 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 05:24:43 -0000 Author: delphij Date: Mon Aug 19 05:24:42 2019 New Revision: 351205 URL: https://svnweb.freebsd.org/changeset/base/351205 Log: Use calloc(). MFC after: 2 weeks Modified: head/sbin/fsck_msdosfs/fat.c Modified: head/sbin/fsck_msdosfs/fat.c ============================================================================== --- head/sbin/fsck_msdosfs/fat.c Mon Aug 19 04:28:12 2019 (r351204) +++ head/sbin/fsck_msdosfs/fat.c Mon Aug 19 05:24:42 2019 (r351205) @@ -54,10 +54,10 @@ static int _readfat(int, struct bootblock *, u_int, u_ * 31...... ........ ........ .......0 * rrrr1111 11111111 11111111 mmmmmmmm FAT32 entry 0 * rrrrsh11 11111111 11111111 11111xxx FAT32 entry 1 - * + * * 11111111 mmmmmmmm FAT16 entry 0 * sh111111 11111xxx FAT16 entry 1 - * + * * r = reserved * m = BPB media ID byte * s = clean flag (1 = dismounted; 0 = still mounted) @@ -166,11 +166,11 @@ static int _readfat(int fs, struct bootblock *boot, u_int no, u_char **buffer) { off_t off; - size_t len; - *buffer = malloc(len = boot->FATsecs * boot->bpbBytesPerSec); + *buffer = calloc(boot->FATsecs, boot->bpbBytesPerSec); if (*buffer == NULL) { - perr("No space for FAT sectors (%zu)", len); + perr("No space for FAT sectors (%zu)", + (size_t)boot->FATsecs); return 0; } @@ -205,20 +205,19 @@ readfat(int fs, struct bootblock *boot, u_int no, stru u_char *buffer, *p; cl_t cl; int ret = FSOK; - size_t len; boot->NumFree = boot->NumBad = 0; if (!_readfat(fs, boot, no, &buffer)) return FSFATAL; - fat = malloc(len = boot->NumClusters * sizeof(struct fatEntry)); + fat = calloc(boot->NumClusters, sizeof(struct fatEntry)); if (fat == NULL) { - perr("No space for FAT clusters (%zu)", len); + perr("No space for FAT clusters (%zu)", + (size_t)boot->NumClusters); free(buffer); return FSFATAL; } - (void)memset(fat, 0, len); if (buffer[0] != boot->bpbMedia || buffer[1] != 0xff || buffer[2] != 0xff @@ -566,12 +565,13 @@ writefat(int fs, struct bootblock *boot, struct fatEnt off_t off; int ret = FSOK; - buffer = malloc(fatsz = boot->FATsecs * boot->bpbBytesPerSec); + fatsz = boot->FATsecs * boot->bpbBytesPerSec; + buffer = calloc(boot->FATsecs, boot->bpbBytesPerSec); if (buffer == NULL) { - perr("No space for FAT sectors (%zu)", fatsz); + perr("No space for FAT sectors (%zu)", + (size_t)boot->FATsecs); return FSFATAL; } - memset(buffer, 0, fatsz); boot->NumFree = 0; p = buffer; if (correct_fat) { From owner-svn-src-head@freebsd.org Mon Aug 19 09:29:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50D16AEE8A; Mon, 19 Aug 2019 09:29:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BpXm1BYHz4X56; Mon, 19 Aug 2019 09:29:28 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0639E187D6; Mon, 19 Aug 2019 09:29:28 +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 x7J9TRwG085224; Mon, 19 Aug 2019 09:29:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7J9TReK085223; Mon, 19 Aug 2019 09:29:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908190929.x7J9TReK085223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 19 Aug 2019 09:29:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351210 - head/tests/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/tests/sys/kern X-SVN-Commit-Revision: 351210 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 09:29:28 -0000 Author: kib Date: Mon Aug 19 09:29:27 2019 New Revision: 351210 URL: https://svnweb.freebsd.org/changeset/base/351210 Log: sys.kern.pdeathsig.signal_delivered_ptrace: fix debugger detach ptrace(PT_DETACH) requires stopped debuggee, otherwise it fails. When the call fails, the C process is left as debuggee of the process D, and might be killed too early if process D exits occurs fast enough. Since pipes are not closed in the forked children, this resulted in the test hanging, since no write occured from C to wake A. PR: 237657 Reported and tested by: lwhsu Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/tests/sys/kern/pdeathsig.c Modified: head/tests/sys/kern/pdeathsig.c ============================================================================== --- head/tests/sys/kern/pdeathsig.c Mon Aug 19 07:47:09 2019 (r351209) +++ head/tests/sys/kern/pdeathsig.c Mon Aug 19 09:29:27 2019 (r351210) @@ -305,7 +305,9 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) WSTOPSIG(status)); assert(rc == 0); - ptrace(PT_DETACH, c_pid, 0, 0); + waitpid(c_pid, &status, 0); + if (!WIFEXITED(status)) + ptrace(PT_DETACH, c_pid, 0, 0); _exit(0); } From owner-svn-src-head@freebsd.org Mon Aug 19 09:33:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F2DBAF18B; Mon, 19 Aug 2019 09:33:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Bpd203vWz4XWH; Mon, 19 Aug 2019 09:33: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7F2E189CF; Mon, 19 Aug 2019 09:33:09 +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 x7J9X9Hi090835; Mon, 19 Aug 2019 09:33:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7J9X9KO090834; Mon, 19 Aug 2019 09:33:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908190933.x7J9X9KO090834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 19 Aug 2019 09:33:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351211 - head/tests/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/tests/sys/kern X-SVN-Commit-Revision: 351211 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 09:33:10 -0000 Author: kib Date: Mon Aug 19 09:33:09 2019 New Revision: 351211 URL: https://svnweb.freebsd.org/changeset/base/351211 Log: sys.kern.pdeathsig.signal_delivered_ptrace: fix startup. Inform D that C executed procctl(PROC_PDEATHSIG_CTL). Otherwise D might allow B to exit before C is set up to receive a signal on the parent exit. In this case, C waits forever for the signal and test hangs. PR: 237657 Reported and tested by: lwhsu Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/tests/sys/kern/pdeathsig.c Modified: head/tests/sys/kern/pdeathsig.c ============================================================================== --- head/tests/sys/kern/pdeathsig.c Mon Aug 19 09:29:27 2019 (r351210) +++ head/tests/sys/kern/pdeathsig.c Mon Aug 19 09:33:09 2019 (r351211) @@ -229,6 +229,7 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) int rc; int pipe_ca[2]; int pipe_db[2]; + int pipe_cd[2]; char buffer; int status; @@ -236,6 +237,8 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) ATF_REQUIRE(rc == 0); rc = pipe(pipe_db); ATF_REQUIRE(rc == 0); + rc = pipe(pipe_cd); + assert(rc == 0); rc = fork(); ATF_REQUIRE(rc != -1); @@ -263,6 +266,9 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) rc = procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum); assert(rc == 0); + rc = write(pipe_cd[1], "x", 1); + assert(rc == 1); + /* wait for B to die and signal us... */ signum = 0xdeadbeef; rc = sigwait(&sigset, &signum); @@ -292,6 +298,9 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) rc = ptrace(PT_CONTINUE, c_pid, (caddr_t) 1, 0); assert(rc == 0); + + rc = read(pipe_cd[0], &buffer, 1); + assert(rc == 1); /* tell B that we're ready for it to exit now */ rc = write(pipe_db[1], ".", 1); From owner-svn-src-head@freebsd.org Mon Aug 19 10:48:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCF71C1768; Mon, 19 Aug 2019 10:48:29 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BrHx50lyz4dVb; Mon, 19 Aug 2019 10:48:29 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D2A6196B6; Mon, 19 Aug 2019 10:48:29 +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 x7JAmTZt033417; Mon, 19 Aug 2019 10:48:29 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JAmSgl033410; Mon, 19 Aug 2019 10:48:28 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201908191048.x7JAmSgl033410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Mon, 19 Aug 2019 10:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351212 - in head: . tests/sys/netpfil/common tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in head: . tests/sys/netpfil/common tests/sys/netpfil/pf X-SVN-Commit-Revision: 351212 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 10:48:29 -0000 Author: kp Date: Mon Aug 19 10:48:27 2019 New Revision: 351212 URL: https://svnweb.freebsd.org/changeset/base/351212 Log: netpfil tests: Move pft_ping.py and sniffer.py to the common test directory The pft_ping.py and sniffer.py tool is moved from tests/sys/netpfil/pf to tests/sys/netpfil/common directory because these tools are to be used in common for all the firewalls. Submitted by: Ahsan Barkati Reviewed by: kp, thj Sponsored by: Google, Inc. (GSoC 2019) Differential Revision: https://reviews.freebsd.org/D21276 Added: head/tests/sys/netpfil/common/pft_ping.py - copied unchanged from r351211, head/tests/sys/netpfil/pf/pft_ping.py head/tests/sys/netpfil/common/sniffer.py - copied unchanged from r351211, head/tests/sys/netpfil/pf/sniffer.py Deleted: head/tests/sys/netpfil/pf/pft_ping.py head/tests/sys/netpfil/pf/sniffer.py Modified: head/ObsoleteFiles.inc head/tests/sys/netpfil/common/Makefile head/tests/sys/netpfil/pf/Makefile head/tests/sys/netpfil/pf/forward.sh head/tests/sys/netpfil/pf/set_tos.sh Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Aug 19 09:33:09 2019 (r351211) +++ head/ObsoleteFiles.inc Mon Aug 19 10:48:27 2019 (r351212) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20190817: pft_ping.py and sniffer.py moved to /usr/tests/sys/netpfil/common +OLD_FILES+=usr/tests/sys/netpfil/pf/sniffer.py +OLD_FILES+=usr/tests/sys/netpfil/pf/pft_ping.py # 20190816: dir.h removed from POSIX OLD_FILES+=usr/include/sys/dir.h # 20190729: gzip'ed a.out support removed Modified: head/tests/sys/netpfil/common/Makefile ============================================================================== --- head/tests/sys/netpfil/common/Makefile Mon Aug 19 09:33:09 2019 (r351211) +++ head/tests/sys/netpfil/common/Makefile Mon Aug 19 10:48:27 2019 (r351212) @@ -11,6 +11,10 @@ ATF_TESTS_SH+= \ ${PACKAGE}FILES+= \ utils.subr \ - runner.subr + runner.subr \ + pft_ping.py \ + sniffer.py + +${PACKAGE}FILESMODE_pft_ping.py= 0555 .include Copied: head/tests/sys/netpfil/common/pft_ping.py (from r351211, head/tests/sys/netpfil/pf/pft_ping.py) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/common/pft_ping.py Mon Aug 19 10:48:27 2019 (r351212, copy of r351211, head/tests/sys/netpfil/pf/pft_ping.py) @@ -0,0 +1,135 @@ +#!/usr/local/bin/python2.7 + +import argparse +import scapy.all as sp +import sys +from sniffer import Sniffer + +PAYLOAD_MAGIC = 0x42c0ffee + +def check_ping_request(args, packet): + if args.ip6: + return check_ping6_request(args, packet) + else: + return check_ping4_request(args, packet) + +def check_ping4_request(args, packet): + """ + Verify that the packet matches what we'd have sent + """ + dst_ip = args.to[0] + + ip = packet.getlayer(sp.IP) + if not ip: + return False + if ip.dst != dst_ip: + return False + + icmp = packet.getlayer(sp.ICMP) + if not icmp: + return False + if sp.icmptypes[icmp.type] != 'echo-request': + return False + + raw = packet.getlayer(sp.Raw) + if not raw: + return False + if raw.load != str(PAYLOAD_MAGIC): + return False + + # Wait to check expectations until we've established this is the packet we + # sent. + if args.expect_tos: + if ip.tos != int(args.expect_tos[0]): + print "Unexpected ToS value %d, expected %s" \ + % (ip.tos, args.expect_tos[0]) + return False + + return True + +def check_ping6_request(args, packet): + """ + Verify that the packet matches what we'd have sent + """ + dst_ip = args.to[0] + + ip = packet.getlayer(sp.IPv6) + if not ip: + return False + if ip.dst != dst_ip: + return False + + icmp = packet.getlayer(sp.ICMPv6EchoRequest) + if not icmp: + return False + if icmp.data != str(PAYLOAD_MAGIC): + return False + + return True + +def ping(send_if, dst_ip, args): + ether = sp.Ether() + ip = sp.IP(dst=dst_ip) + icmp = sp.ICMP(type='echo-request') + raw = sp.Raw(str(PAYLOAD_MAGIC)) + + if args.send_tos: + ip.tos = int(args.send_tos[0]) + + req = ether / ip / icmp / raw + sp.sendp(req, iface=send_if, verbose=False) + +def ping6(send_if, dst_ip, args): + ether = sp.Ether() + ip6 = sp.IPv6(dst=dst_ip) + icmp = sp.ICMPv6EchoRequest(data=PAYLOAD_MAGIC) + + req = ether / ip6 / icmp + sp.sendp(req, iface=send_if, verbose=False) + +def main(): + parser = argparse.ArgumentParser("pft_ping.py", + description="Ping test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet(s) will be sent') + parser.add_argument('--recvif', nargs=1, + help='The interface on which to expect the ICMP echo response') + parser.add_argument('--ip6', action='store_true', + help='Use IPv6') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address for the ICMP echo request') + + # Packet settings + parser.add_argument('--send-tos', nargs=1, + help='Set the ToS value for the transmitted packet') + + # Expectations + parser.add_argument('--expect-tos', nargs=1, + help='The expected ToS value in the received packet') + + args = parser.parse_args() + + # We may not have a default route. Tell scapy where to start looking for routes + sp.conf.iface6 = args.sendif[0] + + sniffer = None + if not args.recvif is None: + sniffer = Sniffer(args, check_ping_request) + + if args.ip6: + ping6(args.sendif[0], args.to[0], args) + else: + ping(args.sendif[0], args.to[0], args) + + if sniffer: + sniffer.join() + + if sniffer.foundCorrectPacket: + sys.exit(0) + else: + sys.exit(1) + +if __name__ == '__main__': + main() Copied: head/tests/sys/netpfil/common/sniffer.py (from r351211, head/tests/sys/netpfil/pf/sniffer.py) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/common/sniffer.py Mon Aug 19 10:48:27 2019 (r351212, copy of r351211, head/tests/sys/netpfil/pf/sniffer.py) @@ -0,0 +1,25 @@ +# $FreeBSD$ + +import threading +import scapy.all as sp + +class Sniffer(threading.Thread): + def __init__(self, args, check_function): + threading.Thread.__init__(self) + + self._args = args + self._recvif = args.recvif[0] + self._check_function = check_function + self.foundCorrectPacket = False + + self.start() + + def _checkPacket(self, packet): + ret = self._check_function(self._args, packet) + if ret: + self.foundCorrectPacket = True + return ret + + def run(self): + self.packets = sp.sniff(iface=self._recvif, + stop_filter=self._checkPacket, timeout=3) Modified: head/tests/sys/netpfil/pf/Makefile ============================================================================== --- head/tests/sys/netpfil/pf/Makefile Mon Aug 19 09:33:09 2019 (r351211) +++ head/tests/sys/netpfil/pf/Makefile Mon Aug 19 10:48:27 2019 (r351212) @@ -21,12 +21,9 @@ ATF_TESTS_SH+= anchor \ ${PACKAGE}FILES+= utils.subr \ echo_inetd.conf \ - sniffer.py \ - pft_ping.py \ CVE-2019-5597.py \ CVE-2019-5598.py -${PACKAGE}FILESMODE_pft_ping.py= 0555 ${PACKAGE}FILESMODE_CVE-2019-5597.py= 0555 ${PACKAGE}FILESMODE_CVE-2019-5598.py= 0555 Modified: head/tests/sys/netpfil/pf/forward.sh ============================================================================== --- head/tests/sys/netpfil/pf/forward.sh Mon Aug 19 09:33:09 2019 (r351211) +++ head/tests/sys/netpfil/pf/forward.sh Mon Aug 19 10:48:27 2019 (r351212) @@ -2,6 +2,8 @@ . $(atf_get_srcdir)/utils.subr +common_dir=$(atf_get_srcdir)/../common + atf_test_case "v4" "cleanup" v4_head() { @@ -43,20 +45,20 @@ v4_body() # Forward with pf enabled pft_set_rules alcatraz "block in" - atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:1 ${common_dir}/pft_ping.py \ --sendif ${epair_send}a \ --to 198.51.100.3 \ --recvif ${epair_recv}a pft_set_rules alcatraz "block out" - atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:1 ${common_dir}/pft_ping.py \ --sendif ${epair_send}a \ --to 198.51.100.3 \ --recv ${epair_recv}a # Allow ICMP pft_set_rules alcatraz "block in" "pass in proto icmp" - atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:0 ${common_dir}/pft_ping.py \ --sendif ${epair_send}a \ --to 198.51.100.3 \ --recvif ${epair_recv}a @@ -98,7 +100,7 @@ v6_body() route add -6 2001:db8:43::/64 2001:db8:42::2 # Sanity check, can we forward ICMP echo requests without pf? - atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:0 ${common_dir}/pft_ping.py \ --ip6 \ --sendif ${epair_send}a \ --to 2001:db8:43::3 \ @@ -109,7 +111,7 @@ v6_body() # Block incoming echo request packets pft_set_rules alcatraz \ "block in inet6 proto icmp6 icmp6-type echoreq" - atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:1 ${common_dir}/pft_ping.py \ --ip6 \ --sendif ${epair_send}a \ --to 2001:db8:43::3 \ @@ -118,7 +120,7 @@ v6_body() # Block outgoing echo request packets pft_set_rules alcatraz \ "block out inet6 proto icmp6 icmp6-type echoreq" - atf_check -s exit:1 -e ignore $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:1 -e ignore ${common_dir}/pft_ping.py \ --ip6 \ --sendif ${epair_send}a \ --to 2001:db8:43::3 \ @@ -128,7 +130,7 @@ v6_body() pft_set_rules alcatraz \ "block out" \ "pass out inet6 proto icmp6" - atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:0 ${common_dir}/pft_ping.py \ --ip6 \ --sendif ${epair_send}a \ --to 2001:db8:43::3 \ @@ -138,7 +140,7 @@ v6_body() pft_set_rules alcatraz \ "block out inet6 proto icmp6 icmp6-type echoreq" \ "pass in proto icmp" - atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:1 ${common_dir}/pft_ping.py \ --ip6 \ --sendif ${epair_send}a \ --to 2001:db8:43::3 \ Modified: head/tests/sys/netpfil/pf/set_tos.sh ============================================================================== --- head/tests/sys/netpfil/pf/set_tos.sh Mon Aug 19 09:33:09 2019 (r351211) +++ head/tests/sys/netpfil/pf/set_tos.sh Mon Aug 19 10:48:27 2019 (r351212) @@ -2,6 +2,8 @@ . $(atf_get_srcdir)/utils.subr +common_dir=$(atf_get_srcdir)/../common + atf_test_case "v4" "cleanup" v4_head() { @@ -37,7 +39,7 @@ v4_body() # No change is done if not requested pft_set_rules alcatraz "scrub out proto icmp" - atf_check -s exit:1 -o ignore $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:1 -o ignore ${common_dir}/pft_ping.py \ --sendif ${epair_send}a \ --to 198.51.100.3 \ --recvif ${epair_recv}a \ @@ -45,7 +47,7 @@ v4_body() # The requested ToS is set pft_set_rules alcatraz "scrub out proto icmp set-tos 42" - atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:0 ${common_dir}/pft_ping.py \ --sendif ${epair_send}a \ --to 198.51.100.3 \ --recvif ${epair_recv}a \ @@ -53,7 +55,7 @@ v4_body() # ToS is not changed if the scrub rule does not match pft_set_rules alcatraz "scrub out proto tcp set-tos 42" - atf_check -s exit:1 -o ignore $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:1 -o ignore ${common_dir}/pft_ping.py \ --sendif ${epair_send}a \ --to 198.51.100.3 \ --recvif ${epair_recv}a \ @@ -62,14 +64,14 @@ v4_body() # Multiple scrub rules match as expected pft_set_rules alcatraz "scrub out proto tcp set-tos 13" \ "scrub out proto icmp set-tos 14" - atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:0 ${common_dir}/pft_ping.py \ --sendif ${epair_send}a \ --to 198.51.100.3 \ --recvif ${epair_recv}a \ --expect-tos 14 # And this works even if the packet already has ToS values set - atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:0 ${common_dir}/pft_ping.py \ --sendif ${epair_send}a \ --to 198.51.100.3 \ --recvif ${epair_recv}a \ @@ -78,7 +80,7 @@ v4_body() # ToS values are unmolested if the packets do not match a scrub rule pft_set_rules alcatraz "scrub out proto tcp set-tos 13" - atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:0 ${common_dir}/pft_ping.py \ --sendif ${epair_send}a \ --to 198.51.100.3 \ --recvif ${epair_recv}a \ From owner-svn-src-head@freebsd.org Mon Aug 19 11:18:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DC1FC25C4; Mon, 19 Aug 2019 11:18:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Bryj2dlKz4g1L; Mon, 19 Aug 2019 11:18:37 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C28E19C09; Mon, 19 Aug 2019 11:18: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 x7JBIbsq051037; Mon, 19 Aug 2019 11:18:37 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JBIa2c051036; Mon, 19 Aug 2019 11:18:36 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201908191118.x7JBIa2c051036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 19 Aug 2019 11:18:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351213 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351213 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 11:18:37 -0000 Author: avg Date: Mon Aug 19 11:18:36 2019 New Revision: 351213 URL: https://svnweb.freebsd.org/changeset/base/351213 Log: assert that td_lk_slocks is not leaked upon return from kernel This is similar to checks for td_sx_slocks and td_rw_rlocks. Although td_lk_slocks is an implementation detail, it still makes sense to validate it. MFC after: 1 week Sponsored by: Panzura Modified: head/sys/kern/subr_trap.c Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Mon Aug 19 10:48:27 2019 (r351212) +++ head/sys/kern/subr_trap.c Mon Aug 19 11:18:36 2019 (r351213) @@ -176,6 +176,9 @@ userret(struct thread *td, struct trapframe *frame) KASSERT(td->td_sx_slocks == 0, ("userret: Returning with %d sx locks held in shared mode", td->td_sx_slocks)); + KASSERT(td->td_lk_slocks == 0, + ("userret: Returning with %d lockmanager locks held in shared mode", + td->td_lk_slocks)); KASSERT((td->td_pflags & TDP_NOFAULTING) == 0, ("userret: Returning with pagefaults disabled")); KASSERT(td->td_no_sleeping == 0, From owner-svn-src-head@freebsd.org Mon Aug 19 12:42:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96624C5648; Mon, 19 Aug 2019 12:42:01 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) (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 46Btpx2Ttdz3Hbw; Mon, 19 Aug 2019 12:42:01 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from [192.168.200.4] (c-71-56-186-158.hsd1.va.comcast.net [71.56.186.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: gallatin) by duke.cs.duke.edu (Postfix) with ESMTPSA id A792D2700125; Mon, 19 Aug 2019 08:41:59 -0400 (EDT) DMARC-Filter: OpenDMARC Filter v1.3.1 duke.cs.duke.edu A792D2700125 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cs.duke.edu; s=mail0816; t=1566218519; bh=WWLMsuYCAXaPsR3DHGoTfIXLpLivZL+JgjDTv6dhBG0=; h=Subject:To:From:Date:From; b=JJne8+bfY2NSG8VrD824M4IJ8EgiAlISca2MyYSfgI01cIZDjdxbuZe/0WJTNdpMg EWcFruwOL+O46avUaicGEHHKZKKmy2nfvGoahIpmWzY8wJRjbfpYdlknooJR3wOE7t Hsx8HMDdndthYYjalE+RdWT/NZaJrRWNgMsPfT8NdlukFaT/ZpPEXOLIWfX0acrNr4 ZwERxsiAGhr8f7Sl5z1mTiU94k0lXkw6j/N2s8XEc8BKefyqbWzwYCkjFQmCAie1lw MSpAAIcvEhYlTAxGJKt4hLordus1yq28Jyiru6TF0eVCsn67gJmZS128CYiscODPZH y3csi0cMFNL7Q== Subject: Re: svn commit: r351200 - in head/sys: amd64/amd64 dev/acpica To: Jeff Roberson , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201908182344.x7INiN3M039113@repo.freebsd.org> From: Andrew Gallatin Message-ID: Date: Mon, 19 Aug 2019 08:41:59 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <201908182344.x7INiN3M039113@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46Btpx2Ttdz3Hbw X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.91 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.91)[-0.906,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 12:42:01 -0000 On 2019-08-18 19:44, Jeff Roberson wrote: > Author: jeff > Date: Sun Aug 18 23:44:23 2019 > New Revision: 351200 <..> > Log: > Allocate all per-cpu datastructures in domain correct memory. > > Reviewed by: kib, gallatin (some objections) No objection to what you actually committed. The only objection was this issues I found on non-NUMA, which you fixed in the committed code. Thanks! Drew From owner-svn-src-head@freebsd.org Mon Aug 19 12:42:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9339EC5675; Mon, 19 Aug 2019 12:42:04 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Btq035cMz3HcW; Mon, 19 Aug 2019 12:42:04 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A5B71ABA9; Mon, 19 Aug 2019 12:42:04 +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 x7JCg4KC005303; Mon, 19 Aug 2019 12:42:04 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JCg4Gu005302; Mon, 19 Aug 2019 12:42:04 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201908191242.x7JCg4Gu005302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 19 Aug 2019 12:42:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351214 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351214 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 12:42:04 -0000 Author: ae Date: Mon Aug 19 12:42:03 2019 New Revision: 351214 URL: https://svnweb.freebsd.org/changeset/base/351214 Log: Use TAILQ_FOREACH_SAFE() macro to avoid use after free in soclose(). PR: 239893 MFC after: 1 week Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Mon Aug 19 11:18:36 2019 (r351213) +++ head/sys/kern/uipc_socket.c Mon Aug 19 12:42:03 2019 (r351214) @@ -1131,9 +1131,9 @@ drop: so->so_state |= SS_NOFDREF; sorele(so); if (listening) { - struct socket *sp; + struct socket *sp, *tsp; - TAILQ_FOREACH(sp, &lqueue, so_list) { + TAILQ_FOREACH_SAFE(sp, &lqueue, so_list, tsp) { SOCK_LOCK(sp); if (sp->so_count == 0) { SOCK_UNLOCK(sp); From owner-svn-src-head@freebsd.org Mon Aug 19 14:11:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63FFCC7B02; Mon, 19 Aug 2019 14:11:55 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Bwpg1vc5z3NGg; Mon, 19 Aug 2019 14:11:55 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 232AA1BC1A; Mon, 19 Aug 2019 14:11:55 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7JEBtdE058101; Mon, 19 Aug 2019 14:11:55 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JEBtmj058100; Mon, 19 Aug 2019 14:11:55 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908191411.x7JEBtmj058100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 19 Aug 2019 14:11:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351215 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351215 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 14:11:55 -0000 Author: mjg Date: Mon Aug 19 14:11:54 2019 New Revision: 351215 URL: https://svnweb.freebsd.org/changeset/base/351215 Log: vfs: fix up r351193 ("stop always overwriting ->mnt_stat in VFS_STATFS") fs-specific part of vfs_statfs routines only fill in small portion of the structure. Previous code was always copying everything at a higher layer to acoomodate it and this patch does the same. 'df' (no arguments) worked fine because the caller uses mnt_stat itself as the target buffer, making all the copying a no-op for its own case. 'df /' and similar use a different consumer which passes its own buffer and this is where you can run into trouble. Reported by: cy Fixes: r351193 Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Mon Aug 19 12:42:03 2019 (r351214) +++ head/sys/kern/vfs_mount.c Mon Aug 19 14:11:54 2019 (r351215) @@ -1833,6 +1833,12 @@ __vfs_statfs(struct mount *mp, struct statfs *sbp) { /* + * Filesystems only fill in part of the structure for updates, we + * have to read the entirety first to get all content. + */ + memcpy(sbp, &mp->mnt_stat, sizeof(*sbp)); + + /* * Set these in case the underlying filesystem fails to do so. */ sbp->f_version = STATFS_VERSION; From owner-svn-src-head@freebsd.org Mon Aug 19 14:20:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D99AC7F14; Mon, 19 Aug 2019 14:20:27 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Bx0W0sl0z3Nwr; Mon, 19 Aug 2019 14:20:27 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F36291BD82; Mon, 19 Aug 2019 14:20:26 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7JEKQEm060831; Mon, 19 Aug 2019 14:20:26 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JEKQWH060830; Mon, 19 Aug 2019 14:20:26 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908191420.x7JEKQWH060830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 19 Aug 2019 14:20:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351216 - head/sbin/ping6 X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/ping6 X-SVN-Commit-Revision: 351216 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 14:20:27 -0000 Author: asomers Date: Mon Aug 19 14:20:26 2019 New Revision: 351216 URL: https://svnweb.freebsd.org/changeset/base/351216 Log: ping6: revert r350857 Some socket options require root privileges to set. The old code did indeed drop privileges at the earliest opportunity. Submitted by: Ján Sučan MFC after: Never Sponsored by: Google, Inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21319 Modified: head/sbin/ping6/ping6.c Modified: head/sbin/ping6/ping6.c ============================================================================== --- head/sbin/ping6/ping6.c Mon Aug 19 14:11:54 2019 (r351215) +++ head/sbin/ping6/ping6.c Mon Aug 19 14:20:26 2019 (r351216) @@ -663,12 +663,6 @@ main(int argc, char *argv[]) err(1, "socket srecv"); freeaddrinfo(res); - /* revoke root privilege */ - if (seteuid(getuid()) != 0) - err(1, "seteuid() failed"); - if (setuid(getuid()) != 0) - err(1, "setuid() failed"); - /* set the source address if specified. */ if ((options & F_SRCADDR) != 0) { /* properly fill sin6_scope_id */ @@ -738,6 +732,12 @@ main(int argc, char *argv[]) err(1, "setsockopt(IPV6_RECVRTHDRDSTOPTS)"); #endif } + + /* revoke root privilege */ + if (seteuid(getuid()) != 0) + err(1, "seteuid() failed"); + if (setuid(getuid()) != 0) + err(1, "setuid() failed"); if ((options & F_FLOOD) && (options & F_INTERVAL)) errx(1, "-f and -i incompatible options"); From owner-svn-src-head@freebsd.org Mon Aug 19 14:28:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27C77C8204; Mon, 19 Aug 2019 14:28:55 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BxBH0GbLz3PPx; Mon, 19 Aug 2019 14:28:55 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA9791BF3A; Mon, 19 Aug 2019 14:28:54 +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 x7JESseq067072; Mon, 19 Aug 2019 14:28:54 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JESsvn067071; Mon, 19 Aug 2019 14:28:54 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201908191428.x7JESsvn067071@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 19 Aug 2019 14:28:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351217 - head/sys/arm/mv X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/mv X-SVN-Commit-Revision: 351217 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 14:28:55 -0000 Author: manu Date: Mon Aug 19 14:28:54 2019 New Revision: 351217 URL: https://svnweb.freebsd.org/changeset/base/351217 Log: arm64: a37x0_gpio: Use syscon instead of MMIO region The fdt node for this driver is a simple-mfd and syscon compatible one meaning that simplemfd will be the driver attached for it. The gpio driver is attached to the 'gpio' subnode so use syscon_get_handle_default to obtain the handle of the syscon from the parent device and use this to read/write to the memory region. MFC after: 1 week Modified: head/sys/arm/mv/a37x0_gpio.c Modified: head/sys/arm/mv/a37x0_gpio.c ============================================================================== --- head/sys/arm/mv/a37x0_gpio.c Mon Aug 19 14:20:26 2019 (r351216) +++ head/sys/arm/mv/a37x0_gpio.c Mon Aug 19 14:28:54 2019 (r351217) @@ -46,21 +46,14 @@ __FBSDID("$FreeBSD$"); #include #include "gpio_if.h" +#include "syscon_if.h" -static struct resource_spec a37x0_gpio_res_spec[] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* Pinctl / GPIO */ - { SYS_RES_MEMORY, 1, RF_ACTIVE }, /* Interrupts control */ - { -1, 0, 0 } -}; - struct a37x0_gpio_softc { - bus_space_tag_t sc_bst; - bus_space_handle_t sc_bsh; device_t sc_busdev; int sc_type; uint32_t sc_max_pins; uint32_t sc_npins; - struct resource *sc_mem_res[nitems(a37x0_gpio_res_spec) - 1]; + struct syscon *syscon; }; /* Memory regions. */ @@ -72,9 +65,9 @@ struct a37x0_gpio_softc { #define A37X0_SB_GPIO 2 #define A37X0_GPIO_WRITE(_sc, _off, _val) \ - bus_space_write_4((_sc)->sc_bst, (_sc)->sc_bsh, (_off), (_val)) + SYSCON_WRITE_4((_sc)->syscon, (_off), (_val)) #define A37X0_GPIO_READ(_sc, _off) \ - bus_space_read_4((_sc)->sc_bst, (_sc)->sc_bsh, (_off)) + SYSCON_READ_4((_sc)->syscon, (_off)) #define A37X0_GPIO_BIT(_p) (1U << ((_p) % 32)) #define A37X0_GPIO_OUT_EN(_p) (0x0 + ((_p) / 32) * 4) @@ -280,6 +273,12 @@ a37x0_gpio_attach(device_t dev) sc = device_get_softc(dev); + err = syscon_get_handle_default(dev, &sc->syscon); + if (err != 0) { + device_printf(dev, "Cannot get syscon handle from parent\n"); + return (ENXIO); + } + /* Read and verify the "gpio-ranges" property. */ ncells = OF_getencprop_alloc(ofw_bus_get_node(dev), "gpio-ranges", (void **)&ranges); @@ -295,14 +294,6 @@ a37x0_gpio_attach(device_t dev) /* Check the number of pins in the DTS vs HW capabilities. */ if (sc->sc_npins > sc->sc_max_pins) return (ENXIO); - - err = bus_alloc_resources(dev, a37x0_gpio_res_spec, sc->sc_mem_res); - if (err != 0) { - device_printf(dev, "cannot allocate memory window\n"); - return (ENXIO); - } - sc->sc_bst = rman_get_bustag(sc->sc_mem_res[A37X0_GPIO]); - sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res[A37X0_GPIO]); sc->sc_busdev = gpiobus_attach_bus(dev); if (sc->sc_busdev == NULL) From owner-svn-src-head@freebsd.org Mon Aug 19 14:33:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C78F5C84C2; Mon, 19 Aug 2019 14:33:22 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BxHQ4nbTz3Ps8; Mon, 19 Aug 2019 14:33:22 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8757C1C0F6; Mon, 19 Aug 2019 14:33:22 +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 x7JEXMID072566; Mon, 19 Aug 2019 14:33:22 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JEXM56072565; Mon, 19 Aug 2019 14:33:22 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201908191433.x7JEXM56072565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 19 Aug 2019 14:33:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351218 - head/sys/arm/ti X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/ti X-SVN-Commit-Revision: 351218 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 14:33:22 -0000 Author: manu Date: Mon Aug 19 14:33:22 2019 New Revision: 351218 URL: https://svnweb.freebsd.org/changeset/base/351218 Log: ti: sdhci: Correct voltage caps ti,dual-volt property say that the eMMC support 1.8V and 3.3V not 3.0V Use the correct caps for the mmc stack. Note that the MMCHS_SD_CAPA register can only be written once after bootup so if one is using a u-boot compiled with eMMC support (this is the default) this code is a no-op but just in case someone have u-boot compiled without eMMC support this make eMMC works when the kernel is booted. MFC after: 1 week Modified: head/sys/arm/ti/ti_sdhci.c Modified: head/sys/arm/ti/ti_sdhci.c ============================================================================== --- head/sys/arm/ti/ti_sdhci.c Mon Aug 19 14:28:54 2019 (r351217) +++ head/sys/arm/ti/ti_sdhci.c Mon Aug 19 14:33:22 2019 (r351218) @@ -482,15 +482,14 @@ ti_sdhci_hw_init(device_t dev) * The attach() routine has examined fdt data and set flags in * slot.host.caps to reflect what voltages we can handle. Set those * values in the CAPA register. The manual says that these values can - * only be set once, "before initialization" whatever that means, and - * that they survive a reset. So maybe doing this will be a no-op if - * u-boot has already initialized the hardware. + * only be set once, and that they survive a reset so unless u-boot didn't + * set this register this code is a no-op. */ regval = ti_mmchs_read_4(sc, MMCHS_SD_CAPA); if (sc->slot.host.caps & MMC_OCR_LOW_VOLTAGE) regval |= MMCHS_SD_CAPA_VS18; - if (sc->slot.host.caps & (MMC_OCR_290_300 | MMC_OCR_300_310)) - regval |= MMCHS_SD_CAPA_VS30; + if (sc->slot.host.caps & (MMC_OCR_320_330 | MMC_OCR_330_340)) + regval |= MMCHS_SD_CAPA_VS33; ti_mmchs_write_4(sc, MMCHS_SD_CAPA, regval); /* Set initial host configuration (1-bit, std speed, pwr off). */ @@ -524,17 +523,20 @@ ti_sdhci_attach(device_t dev) } /* - * The hardware can inherently do dual-voltage (1p8v, 3p0v) on the first + * The hardware can inherently do dual-voltage (1p8v, 3p3v) on the first * device, and only 1p8v on other devices unless an external transceiver * is used. The only way we could know about a transceiver is fdt data. * Note that we have to do this before calling ti_sdhci_hw_init() so * that it can set the right values in the CAPA register, which can only * be done once and never reset. */ - sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; - if (sc->mmchs_clk_id == MMC1_CLK || OF_hasprop(node, "ti,dual-volt")) { - sc->slot.host.caps |= MMC_OCR_290_300 | MMC_OCR_300_310; - } + if (OF_hasprop(node, "ti,dual-volt")) { + sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE | MMC_OCR_320_330 | MMC_OCR_330_340; + } else if (OF_hasprop(node, "no-1-8-v")) { + sc->slot.host.caps |= MMC_OCR_320_330 | MMC_OCR_330_340; + } else + sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; + /* * Set the offset from the device's memory start to the MMCHS registers. From owner-svn-src-head@freebsd.org Mon Aug 19 16:29:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0F35CAC23; Mon, 19 Aug 2019 16:29:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Bzsr3nlxz413m; Mon, 19 Aug 2019 16:29:52 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49C071D4E4; Mon, 19 Aug 2019 16:29:52 +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 x7JGTq00046808; Mon, 19 Aug 2019 16:29:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JGTqHq046807; Mon, 19 Aug 2019 16:29:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908191629.x7JGTqHq046807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 19 Aug 2019 16:29:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351219 - head/sys/netinet/netdump X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/netinet/netdump X-SVN-Commit-Revision: 351219 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 16:29:52 -0000 Author: markj Date: Mon Aug 19 16:29:51 2019 New Revision: 351219 URL: https://svnweb.freebsd.org/changeset/base/351219 Log: Fix netdump buffering after r348473. nd_buf is used to buffer headers (for both the kernel dump itself and for EKCD) before the final call to netdump_dumper(), which flushes residual data in nd_buf. As a result, a small portion of the residual data would be corrupted. This manifests when kernel dump compression is enabled since both zstd and zlib detect the corruption during decompression. Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D21294 Modified: head/sys/netinet/netdump/netdump_client.c Modified: head/sys/netinet/netdump/netdump_client.c ============================================================================== --- head/sys/netinet/netdump/netdump_client.c Mon Aug 19 14:33:22 2019 (r351218) +++ head/sys/netinet/netdump/netdump_client.c Mon Aug 19 16:29:51 2019 (r351219) @@ -923,6 +923,24 @@ netdump_network_poll(void) */ /* + * Flush any buffered vmcore data. + */ +static int +netdump_flush_buf(void) +{ + int error; + + error = 0; + if (nd_conf.nd_buf_len != 0) { + error = netdump_send(NETDUMP_VMCORE, nd_conf.nd_tx_off, + nd_buf, nd_conf.nd_buf_len); + if (error == 0) + nd_conf.nd_buf_len = 0; + } + return (error); +} + +/* * Callback from dumpsys() to dump a chunk of memory. * Copies it out to our static buffer then sends it across the network. * Detects the initial KDH and makes sure it is given a special packet type. @@ -948,13 +966,9 @@ netdump_dumper(void *priv __unused, void *virtual, virtual, (uintmax_t)offset, length); if (virtual == NULL) { - if (nd_conf.nd_buf_len != 0) { - error = netdump_send(NETDUMP_VMCORE, nd_conf.nd_tx_off, nd_buf, - nd_conf.nd_buf_len); - if (error != 0) { - dump_failed = 1; - } - } + error = netdump_flush_buf(); + if (error != 0) + dump_failed = 1; if (dump_failed != 0) printf("failed to dump the kernel core\n"); @@ -968,16 +982,14 @@ netdump_dumper(void *priv __unused, void *virtual, if (length > sizeof(nd_buf)) return (ENOSPC); - if (nd_conf.nd_buf_len + length > sizeof(nd_buf) || - (nd_conf.nd_buf_len != 0 && nd_conf.nd_tx_off + + if (nd_conf.nd_buf_len + length > sizeof(nd_buf) || + (nd_conf.nd_buf_len != 0 && nd_conf.nd_tx_off + nd_conf.nd_buf_len != offset)) { - error = netdump_send(NETDUMP_VMCORE, nd_conf.nd_tx_off, nd_buf, - nd_conf.nd_buf_len); + error = netdump_flush_buf(); if (error != 0) { dump_failed = 1; return (error); } - nd_conf.nd_buf_len = 0; nd_conf.nd_tx_off = offset; } @@ -1078,6 +1090,9 @@ netdump_write_headers(struct dumperinfo *di, struct ke { int error; + error = netdump_flush_buf(); + if (error != 0) + return (error); memcpy(nd_buf, kdh, sizeof(*kdh)); error = netdump_send(NETDUMP_KDH, 0, nd_buf, sizeof(*kdh)); if (error == 0 && keysize > 0) { From owner-svn-src-head@freebsd.org Mon Aug 19 17:23:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46E68CC295; Mon, 19 Aug 2019 17:23:23 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C13b17gnz44Cc; Mon, 19 Aug 2019 17:23:23 +0000 (UTC) (envelope-from vmaffione@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 083A31E01E; Mon, 19 Aug 2019 17:23:23 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7JHNML1082143; Mon, 19 Aug 2019 17:23:22 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JHNM8n082142; Mon, 19 Aug 2019 17:23:22 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201908191723.x7JHNM8n082142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Mon, 19 Aug 2019 17:23:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351220 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 351220 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 17:23:23 -0000 Author: vmaffione Date: Mon Aug 19 17:23:22 2019 New Revision: 351220 URL: https://svnweb.freebsd.org/changeset/base/351220 Log: if_tuntap: minor improvements Rewrite a loop to avoid duplicating the exit condition. Simplify mask processing in tunpoll(). Fix minor typos. Reviewed by: kevans, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21302 Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Mon Aug 19 16:29:51 2019 (r351219) +++ head/sys/net/if_tuntap.c Mon Aug 19 17:23:22 2019 (r351220) @@ -110,7 +110,6 @@ struct tuntap_softc { u_short tun_flags; /* misc flags */ #define TUN_OPEN 0x0001 #define TUN_INITED 0x0002 -#define TUN_RCOLL 0x0004 #define TUN_IASET 0x0008 #define TUN_DSTADDR 0x0010 #define TUN_LMODE 0x0020 @@ -168,9 +167,9 @@ SX_SYSINIT(tun_ioctl_sx, &tun_ioctl_sx, "tun_ioctl"); SYSCTL_DECL(_net_link); /* tun */ static SYSCTL_NODE(_net_link, OID_AUTO, tun, CTLFLAG_RW, 0, - "IP tunnel software network interface."); + "IP tunnel software network interface"); SYSCTL_INT(_net_link_tun, OID_AUTO, devfs_cloning, CTLFLAG_RWTUN, &tundclone, 0, - "Enable legacy devfs interface creation."); + "Enable legacy devfs interface creation"); /* tap */ static SYSCTL_NODE(_net_link, OID_AUTO, tap, CTLFLAG_RW, 0, @@ -442,7 +441,7 @@ tun_clone_create(struct if_clone *ifc, char *name, siz return (ENXIO); if (unit != -1) { - /* If this unit number is still available that/s okay. */ + /* If this unit number is still available that's okay. */ if (alloc_unr_specific(drv->unrhdr, unit) == -1) return (EEXIST); } else { @@ -1435,22 +1434,22 @@ tunread(struct cdev *dev, struct uio *uio, int flag) tp->tun_flags &= ~TUN_RWAIT; - do { + for (;;) { IFQ_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) { - if (flag & O_NONBLOCK) { - TUN_UNLOCK(tp); - return (EWOULDBLOCK); - } - tp->tun_flags |= TUN_RWAIT; - error = mtx_sleep(tp, &tp->tun_mtx, PCATCH | (PZERO + 1), - "tunread", 0); - if (error != 0) { - TUN_UNLOCK(tp); - return (error); - } + if (m != NULL) + break; + if (flag & O_NONBLOCK) { + TUN_UNLOCK(tp); + return (EWOULDBLOCK); } - } while (m == NULL); + tp->tun_flags |= TUN_RWAIT; + error = mtx_sleep(tp, &tp->tun_mtx, PCATCH | (PZERO + 1), + "tunread", 0); + if (error != 0) { + TUN_UNLOCK(tp); + return (error); + } + } TUN_UNLOCK(tp); if ((tp->tun_flags & TUN_L2) != 0) @@ -1629,8 +1628,7 @@ tunpoll(struct cdev *dev, int events, struct thread *t } IFQ_UNLOCK(&ifp->if_snd); } - if (events & (POLLOUT | POLLWRNORM)) - revents |= events & (POLLOUT | POLLWRNORM); + revents |= events & (POLLOUT | POLLWRNORM); return (revents); } From owner-svn-src-head@freebsd.org Mon Aug 19 17:26:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BFEBCC33D; Mon, 19 Aug 2019 17:26:05 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C16j1phbz44MN; Mon, 19 Aug 2019 17:26:05 +0000 (UTC) (envelope-from vmaffione@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FFFC1E028; Mon, 19 Aug 2019 17:26:05 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7JHQ5s1082328; Mon, 19 Aug 2019 17:26:05 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JHQ4qk082327; Mon, 19 Aug 2019 17:26:04 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201908191726.x7JHQ4qk082327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Mon, 19 Aug 2019 17:26:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351221 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 351221 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 17:26:05 -0000 Author: vmaffione Date: Mon Aug 19 17:26:04 2019 New Revision: 351221 URL: https://svnweb.freebsd.org/changeset/base/351221 Log: link ptnet(4) man page to the build system Reported by: kevans Reviewed by: kevans, bcr MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21312 Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Mon Aug 19 17:23:22 2019 (r351220) +++ head/share/man/man4/Makefile Mon Aug 19 17:26:04 2019 (r351221) @@ -412,6 +412,7 @@ MAN= aac.4 \ psm.4 \ pst.4 \ pt.4 \ + ptnet.4 \ pts.4 \ pty.4 \ puc.4 \ @@ -691,6 +692,7 @@ MLINKS+=pccbb.4 cbb.4 MLINKS+=pcm.4 snd.4 \ pcm.4 sound.4 MLINKS+=pms.4 pmspcv.4 +MLINKS+=ptnet.4 if_ptnet.4 MLINKS+=ral.4 if_ral.4 MLINKS+=re.4 if_re.4 MLINKS+=rl.4 if_rl.4 From owner-svn-src-head@freebsd.org Mon Aug 19 17:28:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86D7ECC551; Mon, 19 Aug 2019 17:28:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C199331Mz44sc; Mon, 19 Aug 2019 17:28: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A24E1E032; Mon, 19 Aug 2019 17:28:13 +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 x7JHSDA6082683; Mon, 19 Aug 2019 17:28:13 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JHSDDp082682; Mon, 19 Aug 2019 17:28:13 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908191728.x7JHSDDp082682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 19 Aug 2019 17:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351224 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 351224 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 17:28:13 -0000 Author: jhb Date: Mon Aug 19 17:28:12 2019 New Revision: 351224 URL: https://svnweb.freebsd.org/changeset/base/351224 Log: Trim a spurious blank line I added in r348969. I did not bump .Dd since there is no content change. MFC after: 3 days Modified: head/share/man/man9/sysctl.9 Modified: head/share/man/man9/sysctl.9 ============================================================================== --- head/share/man/man9/sysctl.9 Mon Aug 19 17:28:12 2019 (r351223) +++ head/share/man/man9/sysctl.9 Mon Aug 19 17:28:12 2019 (r351224) @@ -482,7 +482,6 @@ .Fn SYSCTL_UQUAD parent number name ctlflags ptr val descr .Fn SYSCTL_UMA_MAX parent number name ctlflags ptr descr .Fn SYSCTL_UMA_CUR parent number name ctlflags ptr descr - .Sh DESCRIPTION The .Nm SYSCTL From owner-svn-src-head@freebsd.org Mon Aug 19 17:28:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FA86CC54D; Mon, 19 Aug 2019 17:28:13 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C1990v0Tz44sb; Mon, 19 Aug 2019 17:28:13 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 016551E031; Mon, 19 Aug 2019 17:28:13 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7JHSCWa082673; Mon, 19 Aug 2019 17:28:12 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JHSC7l082672; Mon, 19 Aug 2019 17:28:12 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908191728.x7JHSC7l082672@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 19 Aug 2019 17:28:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351223 - head/sbin/ping X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/ping X-SVN-Commit-Revision: 351223 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 17:28:13 -0000 Author: asomers Date: Mon Aug 19 17:28:12 2019 New Revision: 351223 URL: https://svnweb.freebsd.org/changeset/base/351223 Log: ping: fix -Wformat-truncating warning with GCC Increase buffer size for the string representation of n_time ICMP timestamp is a 32-bit number. In pr_ntime(), number of minutes and seconds is always 2 characters wide. Max. number of hours is 4 characters wide. The buffer size should be at least: 4 + 2 + 2 + 1 (':') + 1 (':') + 1 ('\0') = 11 Submitted by: Ján Sučan MFC after: 2 weeks Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21325 Modified: head/sbin/ping/ping.c Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Mon Aug 19 17:27:06 2019 (r351222) +++ head/sbin/ping/ping.c Mon Aug 19 17:28:12 2019 (r351223) @@ -1661,7 +1661,7 @@ pr_retip(struct ip *ip) static char * pr_ntime(n_time timestamp) { - static char buf[10]; + static char buf[11]; int hour, min, sec; sec = ntohl(timestamp) / 1000; From owner-svn-src-head@freebsd.org Mon Aug 19 17:51:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00A24CCD5F; Mon, 19 Aug 2019 17:51:07 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C1gZ6FYhz46Kd; Mon, 19 Aug 2019 17:51:06 +0000 (UTC) (envelope-from scottph@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B84F81E3FC; Mon, 19 Aug 2019 17:51:06 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7JHp6Ig095525; Mon, 19 Aug 2019 17:51:06 GMT (envelope-from scottph@FreeBSD.org) Received: (from scottph@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JHp6Hi095523; Mon, 19 Aug 2019 17:51:06 GMT (envelope-from scottph@FreeBSD.org) Message-Id: <201908191751.x7JHp6Hi095523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottph set sender to scottph@FreeBSD.org using -f From: D Scott Phillips Date: Mon, 19 Aug 2019 17:51:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351225 - in head/sys/dev: acpica nvdimm X-SVN-Group: head X-SVN-Commit-Author: scottph X-SVN-Commit-Paths: in head/sys/dev: acpica nvdimm X-SVN-Commit-Revision: 351225 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 17:51:07 -0000 Author: scottph Date: Mon Aug 19 17:51:06 2019 New Revision: 351225 URL: https://svnweb.freebsd.org/changeset/base/351225 Log: Don't set the string "unknown" as a device's location_str Return an empty string when the location is unknown instead of the string "unknown". This ensures that all location entries are of the form key=val. Suggested by: imp Approved by: jhb (mentor) MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D21326 Modified: head/sys/dev/acpica/acpi.c head/sys/dev/nvdimm/nvdimm.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Mon Aug 19 17:28:12 2019 (r351224) +++ head/sys/dev/acpica/acpi.c Mon Aug 19 17:51:06 2019 (r351225) @@ -866,7 +866,7 @@ acpi_child_location_str_method(device_t cbdev, device_ strlcat(buf, buf2, buflen); } } else { - snprintf(buf, buflen, "unknown"); + snprintf(buf, buflen, ""); } return (0); } Modified: head/sys/dev/nvdimm/nvdimm.c ============================================================================== --- head/sys/dev/nvdimm/nvdimm.c Mon Aug 19 17:28:12 2019 (r351224) +++ head/sys/dev/nvdimm/nvdimm.c Mon Aug 19 17:51:06 2019 (r351225) @@ -571,7 +571,7 @@ nvdimm_root_child_location_str(device_t dev, device_t if (handle != NULL) res = snprintf(buf, buflen, "handle=%s", acpi_name(handle)); else - res = snprintf(buf, buflen, "unknown"); + res = snprintf(buf, buflen, ""); if (res >= buflen) return (EOVERFLOW); From owner-svn-src-head@freebsd.org Mon Aug 19 17:54:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 743A8CCE28; Mon, 19 Aug 2019 17:54:41 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C1lj2RM1z46gQ; Mon, 19 Aug 2019 17:54:41 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 310271E58E; Mon, 19 Aug 2019 17:54:41 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7JHsfkI000663; Mon, 19 Aug 2019 17:54:41 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JHsf3D000662; Mon, 19 Aug 2019 17:54:41 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908191754.x7JHsf3D000662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 19 Aug 2019 17:54:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351226 - head/sbin/ping X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/ping X-SVN-Commit-Revision: 351226 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 17:54:41 -0000 Author: asomers Date: Mon Aug 19 17:54:40 2019 New Revision: 351226 URL: https://svnweb.freebsd.org/changeset/base/351226 Log: Fix uninitialized variable warnings when MK_CASPER=no Submitted by: Ján Sučan MFC after: 2 weeks Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21322 Modified: head/sbin/ping/ping.c Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Mon Aug 19 17:51:06 2019 (r351225) +++ head/sbin/ping/ping.c Mon Aug 19 17:54:40 2019 (r351226) @@ -610,6 +610,7 @@ main(int argc, char *const *argv) } /* From now on we will use only reverse DNS lookups. */ +#ifdef WITH_CASPER if (capdns != NULL) { const char *types[1]; @@ -617,7 +618,7 @@ main(int argc, char *const *argv) if (cap_dns_type_limit(capdns, types, 1) < 0) err(1, "unable to limit access to system.dns service"); } - +#endif if (connect(ssend, (struct sockaddr *)&whereto, sizeof(whereto)) != 0) err(1, "connect"); @@ -1709,9 +1710,10 @@ static cap_channel_t * capdns_setup(void) { cap_channel_t *capcas, *capdnsloc; +#ifdef WITH_CASPER const char *types[2]; int families[1]; - +#endif capcas = cap_init(); if (capcas == NULL) err(1, "unable to create casper process"); @@ -1720,6 +1722,7 @@ capdns_setup(void) cap_close(capcas); if (capdnsloc == NULL) err(1, "unable to open system.dns service"); +#ifdef WITH_CASPER types[0] = "NAME2ADDR"; types[1] = "ADDR2NAME"; if (cap_dns_type_limit(capdnsloc, types, 2) < 0) @@ -1727,7 +1730,7 @@ capdns_setup(void) families[0] = AF_INET; if (cap_dns_family_limit(capdnsloc, families, 1) < 0) err(1, "unable to limit access to system.dns service"); - +#endif return (capdnsloc); } From owner-svn-src-head@freebsd.org Mon Aug 19 18:15:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5088CCD83F; Mon, 19 Aug 2019 18:15:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C2CT6gCtz4842; Mon, 19 Aug 2019 18:15:17 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7AD61E981; Mon, 19 Aug 2019 18:15:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7JIFH7C012950; Mon, 19 Aug 2019 18:15:17 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JIFHqc012949; Mon, 19 Aug 2019 18:15:17 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201908191815.x7JIFHqc012949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Aug 2019 18:15:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351227 - head/sys/mips/include X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/mips/include X-SVN-Commit-Revision: 351227 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 18:15:18 -0000 Author: kevans Date: Mon Aug 19 18:15:17 2019 New Revision: 351227 URL: https://svnweb.freebsd.org/changeset/base/351227 Log: mips: avoid empty mdproc struct Compiling with a more modern toolchain than GCC 4.2 in base warns about the empty struct. Take a hint and comment from r350902+r350953 by luporl@. Modified: head/sys/mips/include/proc.h Modified: head/sys/mips/include/proc.h ============================================================================== --- head/sys/mips/include/proc.h Mon Aug 19 17:54:40 2019 (r351226) +++ head/sys/mips/include/proc.h Mon Aug 19 18:15:17 2019 (r351227) @@ -79,7 +79,8 @@ struct mdthread { #define MDTD_COP2USED 0x0002 /* Process used the COP2 */ struct mdproc { - /* empty */ + /* Avoid empty structs because they are undefined behavior. */ + long md_spare; }; struct syscall_args { From owner-svn-src-head@freebsd.org Mon Aug 19 19:02:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C67DCECFB; Mon, 19 Aug 2019 19:02:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C3FN0wbHz4CJr; Mon, 19 Aug 2019 19:02:00 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0127D1F158; Mon, 19 Aug 2019 19:02:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7JJ1xp3039490; Mon, 19 Aug 2019 19:01:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JJ1xup039489; Mon, 19 Aug 2019 19:01:59 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201908191901.x7JJ1xup039489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Aug 2019 19:01:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351229 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 351229 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 19:02:00 -0000 Author: kevans Date: Mon Aug 19 19:01:59 2019 New Revision: 351229 URL: https://svnweb.freebsd.org/changeset/base/351229 Log: tuntap: belatedly add MODULE_VERSION for if_tun and if_tap When tun/tap were merged, appropriate MODULE_VERSION should have been added for things like modfind(2) to continue to do the right thing with the old names. Reported by: jhb Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Mon Aug 19 18:50:56 2019 (r351228) +++ head/sys/net/if_tuntap.c Mon Aug 19 19:01:59 2019 (r351229) @@ -671,6 +671,8 @@ static moduledata_t tuntap_mod = { DECLARE_MODULE(if_tuntap, tuntap_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_VERSION(if_tuntap, 1); +MODULE_VERSION(if_tun, 1); +MODULE_VERSION(if_tap, 1); static void tunstart(struct ifnet *ifp) From owner-svn-src-head@freebsd.org Mon Aug 19 21:21:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 027ABD256A; Mon, 19 Aug 2019 21:21:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C6LN6L6Jz4RSM; Mon, 19 Aug 2019 21:21:32 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBFF020A6E; Mon, 19 Aug 2019 21:21:32 +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 x7JLLWdS031484; Mon, 19 Aug 2019 21:21:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JLLWKl031483; Mon, 19 Aug 2019 21:21:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908192121.x7JLLWKl031483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Aug 2019 21:21:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351230 - head/usr.sbin/makefs X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/makefs X-SVN-Commit-Revision: 351230 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 21:21:33 -0000 Author: emaste Date: Mon Aug 19 21:21:32 2019 New Revision: 351230 URL: https://svnweb.freebsd.org/changeset/base/351230 Log: makefs.8: style updates from igor Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/makefs/makefs.8 Modified: head/usr.sbin/makefs/makefs.8 ============================================================================== --- head/usr.sbin/makefs/makefs.8 Mon Aug 19 19:01:59 2019 (r351229) +++ head/usr.sbin/makefs/makefs.8 Mon Aug 19 21:21:32 2019 (r351230) @@ -119,7 +119,7 @@ XXX: document these .It Fl F Ar mtree-specfile .Em This is almost certainly not the option you are looking for. To create an image from a list of files in an mtree format manifest, -specify it as the last argument on the commandline, not as a the +specify it as the last argument on the command line, not as a the argument to .Fl F . .Pp @@ -160,10 +160,10 @@ and (in the case of symbolic links). If .Sy time -isn't provided, the current time will be used. +is not provided, the current time will be used. If .Sy flags -isn't provided, the current file flags will be used. +is not provided, the current file flags will be used. Missing regular file entries will be created as zero-length files. .It Fl f Ar free-files Ensure that a minimum of @@ -331,9 +331,11 @@ The following keywords are supported: Allow the directory structure to exceed the maximum specified in the spec. .It Sy allow-illegal-chars -Allow illegal characters in filenames. This option is not implemented. +Allow illegal characters in filenames. +This option is not implemented. .It Sy allow-lowercase -Allow lowercase characters in filenames. This option is not implemented. +Allow lowercase characters in filenames. +This option is not implemented. .It Sy allow-max-name Allow 37 instead of 33 characters for filenames by omitting the version id. @@ -348,7 +350,8 @@ extension to encode .Tn RISC OS metadata. .It Sy bootimagedir -Boot image directory. This option is not implemented. +Boot image directory. +This option is not implemented. .It Sy chrp-boot Write an MBR partition table to the image to allow older CHRP hardware to boot. From owner-svn-src-head@freebsd.org Mon Aug 19 21:30:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA543D273F; Mon, 19 Aug 2019 21:30:13 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C6XP4jhLz4Rqc; Mon, 19 Aug 2019 21:30:13 +0000 (UTC) (envelope-from jkim@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 846AE20C14; Mon, 19 Aug 2019 21:30:13 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7JLUDrG035773; Mon, 19 Aug 2019 21:30:13 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JLUDKp035771; Mon, 19 Aug 2019 21:30:13 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201908192130.x7JLUDKp035771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Mon, 19 Aug 2019 21:30:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351231 - head/sys/dev/sound/pci/hda X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: head/sys/dev/sound/pci/hda X-SVN-Commit-Revision: 351231 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 21:30:13 -0000 Author: jkim Date: Mon Aug 19 21:30:12 2019 New Revision: 351231 URL: https://svnweb.freebsd.org/changeset/base/351231 Log: Fix sound on headset jack for Lenovo Thinkpad X1 Carbon Gen 6 (model 20KH). Note this commit was inspired by r350433. MFC after: 2 weeks Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c head/sys/dev/sound/pci/hda/hdac.h Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa_patches.c Mon Aug 19 21:21:32 2019 (r351230) +++ head/sys/dev/sound/pci/hda/hdaa_patches.c Mon Aug 19 21:30:12 2019 (r351231) @@ -389,6 +389,13 @@ hdac_pin_patch(struct hdaa_widget *w) patch = "as=1 seq=15"; break; } + } else if (id == HDA_CODEC_ALC285 && + subid == LENOVO_X120KH_SUBVENDOR) { + switch (nid) { + case 33: + patch = "as=1 seq=15"; + break; + } } else if (id == HDA_CODEC_ALC269 && subid == ASUS_UX31A_SUBVENDOR) { switch (nid) { @@ -771,16 +778,18 @@ hdaa_patch_direct(struct hdaa_devinfo *devinfo) hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid, 0xf88, 0xc0)); break; + case HDA_CODEC_ALC255: + case HDA_CODEC_ALC256: + case HDA_CODEC_ALC285: + val = hdaa_read_coef(dev, 0x20, 0x46); + hdaa_write_coef(dev, 0x20, 0x46, val | 0x3000); + break; case HDA_CODEC_ALC1150: if (subid == 0xd9781462) { /* Too low volume on MSI H170 GAMING M3. */ hdaa_write_coef(dev, 0x20, 0x07, 0x7cb); } break; - } - if (id == HDA_CODEC_ALC255 || id == HDA_CODEC_ALC256) { - val = hdaa_read_coef(dev, 0x20, 0x46); - hdaa_write_coef(dev, 0x20, 0x46, val|0x3000); } if (subid == APPLE_INTEL_MAC) hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid, Modified: head/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.h Mon Aug 19 21:21:32 2019 (r351230) +++ head/sys/dev/sound/pci/hda/hdac.h Mon Aug 19 21:30:12 2019 (r351231) @@ -257,6 +257,7 @@ #define LENOVO_X1_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21e8) #define LENOVO_X1CRBN_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f9) #define LENOVO_X120BS_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x2227) +#define LENOVO_X120KH_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x225c) #define LENOVO_X220_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21da) #define LENOVO_X300_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac) #define LENOVO_T400_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20f2) From owner-svn-src-head@freebsd.org Mon Aug 19 21:38:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C80AD2961; Mon, 19 Aug 2019 21:38:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C6jb14Tlz4SGP; Mon, 19 Aug 2019 21:38:11 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0698B20E01; Mon, 19 Aug 2019 21:38:11 +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 x7JLcA6N041397; Mon, 19 Aug 2019 21:38:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JLcA2Y041396; Mon, 19 Aug 2019 21:38:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908192138.x7JLcA2Y041396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Aug 2019 21:38:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351232 - head/usr.sbin/makefs X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/makefs X-SVN-Commit-Revision: 351232 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 21:38:11 -0000 Author: emaste Date: Mon Aug 19 21:38:10 2019 New Revision: 351232 URL: https://svnweb.freebsd.org/changeset/base/351232 Log: makefs.8: expand description of image size Submitted by: ryan_freqlabs.com, Siva Mahadevan Differential Revision: https://reviews.freebsd.org/D21316 Modified: head/usr.sbin/makefs/makefs.8 Modified: head/usr.sbin/makefs/makefs.8 ============================================================================== --- head/usr.sbin/makefs/makefs.8 Mon Aug 19 21:30:12 2019 (r351231) +++ head/usr.sbin/makefs/makefs.8 Mon Aug 19 21:38:10 2019 (r351232) @@ -35,7 +35,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 30, 2018 +.Dd August 19, 2019 .Dt MAKEFS 8 .Os .Sh NAME @@ -225,6 +225,17 @@ Defaults to 512. .It Fl s Ar image-size Set the size of the file system image to .Ar image-size . +This is equivalent to setting both the minimum +.Fl ( M ) +and the maximum +.Fl ( m ) +sizes to the same value. +For +.Sy ffs +the +.Ar image-size +does not include the +.Ar offset . .It Fl T Ar timestamp Specify a timestamp to be set for all filesystem files and directories created so that repeatable builds are possible. From owner-svn-src-head@freebsd.org Mon Aug 19 21:45:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9570DD2D61; Mon, 19 Aug 2019 21:45:26 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C6sy05bKz4Snx; Mon, 19 Aug 2019 21:45:26 +0000 (UTC) (envelope-from jkim@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D521120FD5; Mon, 19 Aug 2019 21:45:25 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7JLjPdZ047179; Mon, 19 Aug 2019 21:45:25 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JLjPu1047178; Mon, 19 Aug 2019 21:45:25 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201908192145.x7JLjPu1047178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Mon, 19 Aug 2019 21:45:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351233 - head/sys/dev/sound/pci/hda X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: head/sys/dev/sound/pci/hda X-SVN-Commit-Revision: 351233 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 21:45:27 -0000 Author: jkim Date: Mon Aug 19 21:45:25 2019 New Revision: 351233 URL: https://svnweb.freebsd.org/changeset/base/351233 Log: Partially revert the previous commit. It was an experiment and not meant to be committed. :-( Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa_patches.c Mon Aug 19 21:38:10 2019 (r351232) +++ head/sys/dev/sound/pci/hda/hdaa_patches.c Mon Aug 19 21:45:25 2019 (r351233) @@ -778,18 +778,16 @@ hdaa_patch_direct(struct hdaa_devinfo *devinfo) hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid, 0xf88, 0xc0)); break; - case HDA_CODEC_ALC255: - case HDA_CODEC_ALC256: - case HDA_CODEC_ALC285: - val = hdaa_read_coef(dev, 0x20, 0x46); - hdaa_write_coef(dev, 0x20, 0x46, val | 0x3000); - break; case HDA_CODEC_ALC1150: if (subid == 0xd9781462) { /* Too low volume on MSI H170 GAMING M3. */ hdaa_write_coef(dev, 0x20, 0x07, 0x7cb); } break; + } + if (id == HDA_CODEC_ALC255 || id == HDA_CODEC_ALC256) { + val = hdaa_read_coef(dev, 0x20, 0x46); + hdaa_write_coef(dev, 0x20, 0x46, val|0x3000); } if (subid == APPLE_INTEL_MAC) hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid, From owner-svn-src-head@freebsd.org Mon Aug 19 22:25:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E0CFD3976; Mon, 19 Aug 2019 22:25:29 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C7m90lJFz4VmS; Mon, 19 Aug 2019 22:25:29 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC764216F2; Mon, 19 Aug 2019 22:25:28 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7JMPSFc071434; Mon, 19 Aug 2019 22:25:28 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JMPSep071431; Mon, 19 Aug 2019 22:25:28 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201908192225.x7JMPSep071431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Mon, 19 Aug 2019 22:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351235 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 351235 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 22:25:29 -0000 Author: jeff Date: Mon Aug 19 22:25:28 2019 New Revision: 351235 URL: https://svnweb.freebsd.org/changeset/base/351235 Log: Permit vm_pager_has_page() to run with a shared lock. Introduce VM_OBJECT_DROP/VM_OBJECT_PICKUP to handle functions that are called with uncertain lock state. Reviewed by: kib, markj Tested by: pho Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21310 Modified: head/sys/vm/vm_object.h head/sys/vm/vm_pager.h head/sys/vm/vnode_pager.c Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Mon Aug 19 21:59:02 2019 (r351234) +++ head/sys/vm/vm_object.h Mon Aug 19 22:25:28 2019 (r351235) @@ -255,6 +255,10 @@ extern struct vm_object kernel_object_store; rw_wowned(&(object)->lock) #define VM_OBJECT_WUNLOCK(object) \ rw_wunlock(&(object)->lock) +#define VM_OBJECT_DROP(object) \ + lock_class_rw.lc_unlock(&(object)->lock.lock_object) +#define VM_OBJECT_PICKUP(object, state) \ + lock_class_rw.lc_lock(&(object)->lock.lock_object, (state)) struct vnode; Modified: head/sys/vm/vm_pager.h ============================================================================== --- head/sys/vm/vm_pager.h Mon Aug 19 21:59:02 2019 (r351234) +++ head/sys/vm/vm_pager.h Mon Aug 19 22:25:28 2019 (r351235) @@ -151,7 +151,7 @@ vm_pager_has_page( ) { boolean_t ret; - VM_OBJECT_ASSERT_WLOCKED(object); + VM_OBJECT_ASSERT_LOCKED(object); ret = (*pagertab[object->type]->pgo_haspage) (object, offset, before, after); return (ret); Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Mon Aug 19 21:59:02 2019 (r351234) +++ head/sys/vm/vnode_pager.c Mon Aug 19 22:25:28 2019 (r351235) @@ -355,13 +355,14 @@ vnode_pager_haspage(vm_object_t object, vm_pindex_t pi { struct vnode *vp = object->handle; daddr_t bn; + uintptr_t lockstate; int err; daddr_t reqblock; int poff; int bsize; int pagesperblock, blocksperpage; - VM_OBJECT_ASSERT_WLOCKED(object); + VM_OBJECT_ASSERT_LOCKED(object); /* * If no vp or vp is doomed or marked transparent to VM, we do not * have the page. @@ -384,9 +385,9 @@ vnode_pager_haspage(vm_object_t object, vm_pindex_t pi blocksperpage = (PAGE_SIZE / bsize); reqblock = pindex * blocksperpage; } - VM_OBJECT_WUNLOCK(object); + lockstate = VM_OBJECT_DROP(object); err = VOP_BMAP(vp, reqblock, NULL, &bn, after, before); - VM_OBJECT_WLOCK(object); + VM_OBJECT_PICKUP(object, lockstate); if (err) return TRUE; if (bn == -1) From owner-svn-src-head@freebsd.org Mon Aug 19 22:53:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5692ED4172; Mon, 19 Aug 2019 22:53:06 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C8N21WG6z4X7B; Mon, 19 Aug 2019 22:53:06 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1582C21C3E; Mon, 19 Aug 2019 22:53:06 +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 x7JMr5AE088960; Mon, 19 Aug 2019 22:53:05 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JMr5g9088957; Mon, 19 Aug 2019 22:53:05 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908192253.x7JMr5g9088957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 19 Aug 2019 22:53:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351237 - in head/sys: conf libkern sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: conf libkern sys X-SVN-Commit-Revision: 351237 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 22:53:06 -0000 Author: cem Date: Mon Aug 19 22:53:05 2019 New Revision: 351237 URL: https://svnweb.freebsd.org/changeset/base/351237 Log: libkern: Implement strchrnul(3) Added: head/sys/libkern/strchrnul.c (contents, props changed) Modified: head/sys/conf/files head/sys/sys/libkern.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Aug 19 22:31:04 2019 (r351236) +++ head/sys/conf/files Mon Aug 19 22:53:05 2019 (r351237) @@ -3974,6 +3974,7 @@ libkern/scanc.c standard libkern/strcasecmp.c standard libkern/strcat.c standard libkern/strchr.c standard +libkern/strchrnul.c optional gdb libkern/strcmp.c standard libkern/strcpy.c standard libkern/strcspn.c standard Added: head/sys/libkern/strchrnul.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/libkern/strchrnul.c Mon Aug 19 22:53:05 2019 (r351237) @@ -0,0 +1,41 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Conrad Meyer + * + * 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 +#include + +char * +strchrnul(const char *p, int ch) +{ + + for (; *p != 0 && *p != ch; p++) + ; + return (__DECONST(char *, p)); +} Modified: head/sys/sys/libkern.h ============================================================================== --- head/sys/sys/libkern.h Mon Aug 19 22:31:04 2019 (r351236) +++ head/sys/sys/libkern.h Mon Aug 19 22:53:05 2019 (r351237) @@ -170,6 +170,7 @@ void srandom(u_long); int strcasecmp(const char *, const char *); char *strcat(char * __restrict, const char * __restrict); char *strchr(const char *, int); +char *strchrnul(const char *, int); int strcmp(const char *, const char *); char *strcpy(char * __restrict, const char * __restrict); size_t strcspn(const char * __restrict, const char * __restrict) __pure; From owner-svn-src-head@freebsd.org Mon Aug 19 22:57:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C5EFD432F; Mon, 19 Aug 2019 22:57:04 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C8Sc23dMz4XKD; Mon, 19 Aug 2019 22:57: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23E9021C40; Mon, 19 Aug 2019 22:57: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 x7JMv3cH089194; Mon, 19 Aug 2019 22:57:03 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JMv3UN089192; Mon, 19 Aug 2019 22:57:03 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908192257.x7JMv3UN089192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 19 Aug 2019 22:57:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351238 - head/sys/gdb X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/gdb X-SVN-Commit-Revision: 351238 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 22:57:04 -0000 Author: cem Date: Mon Aug 19 22:57:03 2019 New Revision: 351238 URL: https://svnweb.freebsd.org/changeset/base/351238 Log: gdb(4): Pack 'info threads' responses into fewer packets We suffer at least one round trip ACK latency every command / packet that GDB has to send and receive, and the response format for 'info threads' supports packing many threads IDs into a single packet, so do so. Adds and uses a new API, gdb_txbuf_has_capacity(), which checks for a certain number of bytes available in the outgoing txbuf. On an example amd64 VM, the number of RTTs to transmit this list is reduced by a factor of 110x. This is especially beneficial with recent GDB, which seems to request the list at least twice during attach. Modified: head/sys/gdb/gdb_int.h head/sys/gdb/gdb_main.c head/sys/gdb/gdb_packet.c Modified: head/sys/gdb/gdb_int.h ============================================================================== --- head/sys/gdb/gdb_int.h Mon Aug 19 22:53:05 2019 (r351237) +++ head/sys/gdb/gdb_int.h Mon Aug 19 22:57:03 2019 (r351238) @@ -62,6 +62,7 @@ void gdb_tx_begin(char); int gdb_tx_end(void); int gdb_tx_mem(const unsigned char *, size_t); void gdb_tx_reg(int); +bool gdb_txbuf_has_capacity(size_t); int gdb_rx_bindata(unsigned char *data, size_t datalen, size_t *amt); int gdb_search_mem(const unsigned char *addr, size_t size, const unsigned char *pat, size_t patlen, const unsigned char **found); Modified: head/sys/gdb/gdb_main.c ============================================================================== --- head/sys/gdb/gdb_main.c Mon Aug 19 22:53:05 2019 (r351237) +++ head/sys/gdb/gdb_main.c Mon Aug 19 22:57:03 2019 (r351238) @@ -123,6 +123,45 @@ gdb_do_mem_search(void) gdb_tx_err(EIO); } +static void +gdb_do_threadinfo(struct thread **thr_iter) +{ + static struct thread * const done_sentinel = (void *)(uintptr_t)1; + static const size_t tidsz_hex = sizeof(lwpid_t) * 2; + size_t tds_sent; + + if (*thr_iter == NULL) { + gdb_tx_err(ENXIO); + return; + } + + if (*thr_iter == done_sentinel) { + gdb_tx_begin('l'); + *thr_iter = NULL; + goto sendit; + } + + gdb_tx_begin('m'); + + for (tds_sent = 0; + *thr_iter != NULL && gdb_txbuf_has_capacity(tidsz_hex + 1); + *thr_iter = kdb_thr_next(*thr_iter), tds_sent++) { + if (tds_sent > 0) + gdb_tx_char(','); + gdb_tx_varhex((*thr_iter)->td_tid); + } + + /* + * Can't send EOF and "some" in same packet, so set a sentinel to send + * EOF when GDB asks us next. + */ + if (*thr_iter == NULL && tds_sent > 0) + *thr_iter = done_sentinel; + +sendit: + gdb_tx_end(); +} + static int gdb_trap(int type, int code) { @@ -268,23 +307,9 @@ gdb_trap(int type, int code) case 'q': /* General query. */ if (gdb_rx_equal("fThreadInfo")) { thr_iter = kdb_thr_first(); - gdb_tx_begin('m'); - gdb_tx_hex((long)thr_iter->td_tid, 8); - gdb_tx_end(); + gdb_do_threadinfo(&thr_iter); } else if (gdb_rx_equal("sThreadInfo")) { - if (thr_iter == NULL) { - gdb_tx_err(ENXIO); - break; - } - thr_iter = kdb_thr_next(thr_iter); - if (thr_iter != NULL) { - gdb_tx_begin('m'); - gdb_tx_hex((long)thr_iter->td_tid, 8); - gdb_tx_end(); - } else { - gdb_tx_begin('l'); - gdb_tx_end(); - } + gdb_do_threadinfo(&thr_iter); } else if (gdb_rx_equal("Search:memory:")) { gdb_do_mem_search(); } else if (!gdb_cpu_query()) Modified: head/sys/gdb/gdb_packet.c ============================================================================== --- head/sys/gdb/gdb_packet.c Mon Aug 19 22:53:05 2019 (r351237) +++ head/sys/gdb/gdb_packet.c Mon Aug 19 22:57:03 2019 (r351238) @@ -327,6 +327,12 @@ gdb_tx_reg(int regnum) gdb_tx_mem(regp, regsz); } +bool +gdb_txbuf_has_capacity(size_t req) +{ + return (((char *)gdb_txbuf + sizeof(gdb_txbuf) - gdb_txp) >= req); +} + /* Read binary data up until the end of the packet or until we have datalen decoded bytes */ int gdb_rx_bindata(unsigned char *data, size_t datalen, size_t *amt) From owner-svn-src-head@freebsd.org Mon Aug 19 22:58:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C360ED43B5; Mon, 19 Aug 2019 22:58:30 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C8VG4mFjz4XSb; Mon, 19 Aug 2019 22:58:30 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 851AE21C41; Mon, 19 Aug 2019 22:58:30 +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 x7JMwU7u089291; Mon, 19 Aug 2019 22:58:30 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JMwUw5089290; Mon, 19 Aug 2019 22:58:30 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908192258.x7JMwUw5089290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 19 Aug 2019 22:58:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351239 - head/sys/gdb X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/gdb X-SVN-Commit-Revision: 351239 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 22:58:30 -0000 Author: cem Date: Mon Aug 19 22:58:30 2019 New Revision: 351239 URL: https://svnweb.freebsd.org/changeset/base/351239 Log: gdb(4): Support "qC" query Sometimes GDB gets confused about what the current thread is. When it does, it asks the remote: "Who am I?" Answer it. Modified: head/sys/gdb/gdb_main.c Modified: head/sys/gdb/gdb_main.c ============================================================================== --- head/sys/gdb/gdb_main.c Mon Aug 19 22:57:03 2019 (r351238) +++ head/sys/gdb/gdb_main.c Mon Aug 19 22:58:30 2019 (r351239) @@ -305,7 +305,13 @@ gdb_trap(int type, int code) break; } case 'q': /* General query. */ - if (gdb_rx_equal("fThreadInfo")) { + if (gdb_rx_equal("C")) { + gdb_tx_begin('Q'); + gdb_tx_char('C'); + gdb_tx_varhex((long)kdb_thread->td_tid); + gdb_tx_end(); + break; + } else if (gdb_rx_equal("fThreadInfo")) { thr_iter = kdb_thr_first(); gdb_do_threadinfo(&thr_iter); } else if (gdb_rx_equal("sThreadInfo")) { From owner-svn-src-head@freebsd.org Mon Aug 19 23:02:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7AE58D4641; Mon, 19 Aug 2019 23:02:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C8ZJ2kp6z4XtT; Mon, 19 Aug 2019 23:02:00 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F99021DC9; Mon, 19 Aug 2019 23:02:00 +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 x7JN20Eu095091; Mon, 19 Aug 2019 23:02:00 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JN20Pe095090; Mon, 19 Aug 2019 23:02:00 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908192302.x7JN20Pe095090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 19 Aug 2019 23:02:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351240 - head/sys/gdb X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/gdb X-SVN-Commit-Revision: 351240 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 23:02:00 -0000 Author: cem Date: Mon Aug 19 23:01:59 2019 New Revision: 351240 URL: https://svnweb.freebsd.org/changeset/base/351240 Log: Fix stylistic nit in r351239 Meant to fix this before committing, but forgot. Modified: head/sys/gdb/gdb_main.c Modified: head/sys/gdb/gdb_main.c ============================================================================== --- head/sys/gdb/gdb_main.c Mon Aug 19 22:58:30 2019 (r351239) +++ head/sys/gdb/gdb_main.c Mon Aug 19 23:01:59 2019 (r351240) @@ -310,7 +310,6 @@ gdb_trap(int type, int code) gdb_tx_char('C'); gdb_tx_varhex((long)kdb_thread->td_tid); gdb_tx_end(); - break; } else if (gdb_rx_equal("fThreadInfo")) { thr_iter = kdb_thr_first(); gdb_do_threadinfo(&thr_iter); From owner-svn-src-head@freebsd.org Mon Aug 19 23:09:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA245D4855; Mon, 19 Aug 2019 23:09:39 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C8l75Lpnz4YF5; Mon, 19 Aug 2019 23:09:39 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A73621E0E; Mon, 19 Aug 2019 23:09:39 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7JN9d81095455; Mon, 19 Aug 2019 23:09:39 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7JN9cgL095450; Mon, 19 Aug 2019 23:09:38 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201908192309.x7JN9cgL095450@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Mon, 19 Aug 2019 23:09:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351241 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern vm X-SVN-Commit-Revision: 351241 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2019 23:09:39 -0000 Author: jeff Date: Mon Aug 19 23:09:38 2019 New Revision: 351241 URL: https://svnweb.freebsd.org/changeset/base/351241 Log: Use an atomic reference count for paging in progress so that callers do not require the object lock. Reviewed by: markj Tested by: pho (as part of a larger branch) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21311 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/kern/vfs_cluster.c head/sys/kern/vfs_subr.c head/sys/vm/swap_pager.c head/sys/vm/vm_object.c head/sys/vm/vm_object.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 19 23:01:59 2019 (r351240) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 19 23:09:38 2019 (r351241) @@ -451,7 +451,7 @@ page_unbusy(vm_page_t pp) { vm_page_sunbusy(pp); - vm_object_pip_subtract(pp->object, 1); + vm_object_pip_wakeup(pp->object); } static vm_page_t @@ -523,6 +523,7 @@ update_pages(vnode_t *vp, int64_t start, int len, objs off = start & PAGEOFFSET; zfs_vmobject_wlock(obj); + vm_object_pip_add(obj, 1); for (start &= PAGEMASK; len > 0; start += PAGESIZE) { vm_page_t pp; int nbytes = imin(PAGESIZE - off, len); @@ -541,7 +542,7 @@ update_pages(vnode_t *vp, int64_t start, int len, objs len -= nbytes; off = 0; } - vm_object_pip_wakeupn(obj, 0); + vm_object_pip_wakeup(obj); zfs_vmobject_wunlock(obj); } Modified: head/sys/kern/vfs_cluster.c ============================================================================== --- head/sys/kern/vfs_cluster.c Mon Aug 19 23:01:59 2019 (r351240) +++ head/sys/kern/vfs_cluster.c Mon Aug 19 23:09:38 2019 (r351241) @@ -479,7 +479,8 @@ cluster_rbuild(struct vnode *vp, u_quad_t filesize, da } if (tsize > 0) { clean_sbusy: - vm_object_pip_add(tbp->b_bufobj->bo_object, -j); + vm_object_pip_wakeupn(tbp->b_bufobj->bo_object, + j); for (k = 0; k < j; k++) vm_page_sunbusy(tbp->b_pages[k]); VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object); Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Aug 19 23:01:59 2019 (r351240) +++ head/sys/kern/vfs_subr.c Mon Aug 19 23:09:38 2019 (r351241) @@ -1786,13 +1786,9 @@ bufobj_invalbuf(struct bufobj *bo, int flags, int slpf */ do { bufobj_wwait(bo, 0, 0); - if ((flags & V_VMIO) == 0) { + if ((flags & V_VMIO) == 0 && bo->bo_object != NULL) { BO_UNLOCK(bo); - if (bo->bo_object != NULL) { - VM_OBJECT_WLOCK(bo->bo_object); - vm_object_pip_wait(bo->bo_object, "bovlbx"); - VM_OBJECT_WUNLOCK(bo->bo_object); - } + vm_object_pip_wait_unlocked(bo->bo_object, "bovlbx"); BO_LOCK(bo); } } while (bo->bo_numoutput > 0); Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Mon Aug 19 23:01:59 2019 (r351240) +++ head/sys/vm/swap_pager.c Mon Aug 19 23:09:38 2019 (r351241) @@ -1256,7 +1256,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t *ma, while ((ma[0]->oflags & VPO_SWAPINPROG) != 0) { ma[0]->oflags |= VPO_SWAPSLEEP; VM_CNT_INC(v_intrans); - if (VM_OBJECT_SLEEP(object, &object->paging_in_progress, PSWP, + if (VM_OBJECT_SLEEP(object, &object->handle, PSWP, "swread", hz * 20)) { printf( "swap_pager: indefinite wait buffer: bufobj: %p, blkno: %jd, size: %ld\n", @@ -1531,7 +1531,7 @@ swp_pager_async_iodone(struct buf *bp) m->oflags &= ~VPO_SWAPINPROG; if (m->oflags & VPO_SWAPSLEEP) { m->oflags &= ~VPO_SWAPSLEEP; - wakeup(&object->paging_in_progress); + wakeup(&object->handle); } if (bp->b_ioflags & BIO_ERROR) { Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Mon Aug 19 23:01:59 2019 (r351240) +++ head/sys/vm/vm_object.c Mon Aug 19 23:09:38 2019 (r351241) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); #include #include #include /* for curproc, pageproc */ +#include #include #include #include @@ -221,7 +222,7 @@ vm_object_zinit(void *mem, int size, int flags) object->type = OBJT_DEAD; object->ref_count = 0; vm_radix_init(&object->rtree); - object->paging_in_progress = 0; + refcount_init(&object->paging_in_progress, 0); object->resident_page_count = 0; object->shadow_count = 0; object->flags = OBJ_DEAD; @@ -371,52 +372,44 @@ void vm_object_pip_add(vm_object_t object, short i) { - VM_OBJECT_ASSERT_WLOCKED(object); - object->paging_in_progress += i; + refcount_acquiren(&object->paging_in_progress, i); } void -vm_object_pip_subtract(vm_object_t object, short i) +vm_object_pip_wakeup(vm_object_t object) { - VM_OBJECT_ASSERT_WLOCKED(object); - object->paging_in_progress -= i; + refcount_release(&object->paging_in_progress); } void -vm_object_pip_wakeup(vm_object_t object) +vm_object_pip_wakeupn(vm_object_t object, short i) { - VM_OBJECT_ASSERT_WLOCKED(object); - object->paging_in_progress--; - if ((object->flags & OBJ_PIPWNT) && object->paging_in_progress == 0) { - vm_object_clear_flag(object, OBJ_PIPWNT); - wakeup(object); - } + refcount_releasen(&object->paging_in_progress, i); } void -vm_object_pip_wakeupn(vm_object_t object, short i) +vm_object_pip_wait(vm_object_t object, char *waitid) { VM_OBJECT_ASSERT_WLOCKED(object); - if (i) - object->paging_in_progress -= i; - if ((object->flags & OBJ_PIPWNT) && object->paging_in_progress == 0) { - vm_object_clear_flag(object, OBJ_PIPWNT); - wakeup(object); + + while (object->paging_in_progress) { + VM_OBJECT_WUNLOCK(object); + refcount_wait(&object->paging_in_progress, waitid, PVM); + VM_OBJECT_WLOCK(object); } } void -vm_object_pip_wait(vm_object_t object, char *waitid) +vm_object_pip_wait_unlocked(vm_object_t object, char *waitid) { - VM_OBJECT_ASSERT_WLOCKED(object); - while (object->paging_in_progress) { - object->flags |= OBJ_PIPWNT; - VM_OBJECT_SLEEP(object, object, PVM, waitid, 0); - } + VM_OBJECT_ASSERT_UNLOCKED(object); + + while (object->paging_in_progress) + refcount_wait(&object->paging_in_progress, waitid, PVM); } /* @@ -615,9 +608,10 @@ retry: } } else if (object->paging_in_progress) { VM_OBJECT_WUNLOCK(robject); - object->flags |= OBJ_PIPWNT; - VM_OBJECT_SLEEP(object, object, - PDROP | PVM, "objde2", 0); + VM_OBJECT_WUNLOCK(object); + refcount_wait( + &object->paging_in_progress, + "objde2", PVM); VM_OBJECT_WLOCK(robject); temp = robject->backing_object; if (object == temp) { @@ -761,14 +755,6 @@ vm_object_terminate(vm_object_t object) vm_object_set_flag(object, OBJ_DEAD); /* - * wait for the pageout daemon to be done with the object - */ - vm_object_pip_wait(object, "objtrm"); - - KASSERT(!object->paging_in_progress, - ("vm_object_terminate: pageout in progress")); - - /* * Clean and free the pages, as appropriate. All references to the * object are gone, so we don't need to lock it. */ @@ -789,6 +775,14 @@ vm_object_terminate(vm_object_t object) VM_OBJECT_WLOCK(object); } + + /* + * wait for the pageout daemon to be done with the object + */ + vm_object_pip_wait(object, "objtrm"); + + KASSERT(!object->paging_in_progress, + ("vm_object_terminate: pageout in progress")); KASSERT(object->ref_count == 0, ("vm_object_terminate: object with references, ref_count=%d", Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Mon Aug 19 23:01:59 2019 (r351240) +++ head/sys/vm/vm_object.h Mon Aug 19 23:09:38 2019 (r351241) @@ -111,7 +111,7 @@ struct vm_object { objtype_t type; /* type of pager */ u_short flags; /* see below */ u_short pg_color; /* (c) color of first page in obj */ - u_int paging_in_progress; /* Paging (in or out) so don't collapse or destroy */ + volatile u_int paging_in_progress; /* Paging (in or out) so don't collapse or destroy */ int resident_page_count; /* number of resident pages */ struct vm_object *backing_object; /* object that I'm a shadow of */ vm_ooffset_t backing_object_offset;/* Offset in backing object */ @@ -183,7 +183,6 @@ struct vm_object { #define OBJ_DEAD 0x0008 /* dead objects (during rundown) */ #define OBJ_NOSPLIT 0x0010 /* dont split this object */ #define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */ -#define OBJ_PIPWNT 0x0040 /* paging in progress wanted */ #define OBJ_PG_DTOR 0x0080 /* dont reset object, leave that for dtor */ #define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty, only for vnode */ #define OBJ_TMPFS_NODE 0x0200 /* object belongs to tmpfs VREG node */ @@ -309,10 +308,10 @@ vm_object_reserv(vm_object_t object) void vm_object_clear_flag(vm_object_t object, u_short bits); void vm_object_pip_add(vm_object_t object, short i); -void vm_object_pip_subtract(vm_object_t object, short i); void vm_object_pip_wakeup(vm_object_t object); void vm_object_pip_wakeupn(vm_object_t object, short i); void vm_object_pip_wait(vm_object_t object, char *waitid); +void vm_object_pip_wait_unlocked(vm_object_t object, char *waitid); void umtx_shm_object_init(vm_object_t object); void umtx_shm_object_terminated(vm_object_t object); From owner-svn-src-head@freebsd.org Tue Aug 20 01:06:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE740D6BD2; Tue, 20 Aug 2019 01:06:43 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46CCLC5znyz4fwj; Tue, 20 Aug 2019 01:06:43 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEF98233D8; Tue, 20 Aug 2019 01:06:43 +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 x7K16hD7067245; Tue, 20 Aug 2019 01:06:43 GMT (envelope-from stevek@FreeBSD.org) Received: (from stevek@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7K16hWT067244; Tue, 20 Aug 2019 01:06:43 GMT (envelope-from stevek@FreeBSD.org) Message-Id: <201908200106.x7K16hWT067244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: stevek set sender to stevek@FreeBSD.org using -f From: "Stephen J. Kiernan" Date: Tue, 20 Aug 2019 01:06:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351244 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: stevek X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 351244 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 01:06:44 -0000 Author: stevek Date: Tue Aug 20 01:06:43 2019 New Revision: 351244 URL: https://svnweb.freebsd.org/changeset/base/351244 Log: usb_ethernet.h includes a number of mii headers, but only does so in order to have struct mii_data available. However, it only really needs a forward declaration of struct mii_data for use in pointer form for the return type of a function prototype. Custom kernel configuration that have usb and fdt enabled, but no miibus, end up with compilation failures because miibus_if.h will not get generated. Due to the above, the following changes have been made to usb_ethernet.h: * remove the inclusion of mii headers * forward-declare struct mii_data * include net/ifq.h to satify the need for complete struct ifqueue Reviewed by: ian Obtained from: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D21293 Modified: head/sys/dev/usb/net/usb_ethernet.h Modified: head/sys/dev/usb/net/usb_ethernet.h ============================================================================== --- head/sys/dev/usb/net/usb_ethernet.h Tue Aug 20 00:50:17 2019 (r351243) +++ head/sys/dev/usb/net/usb_ethernet.h Tue Aug 20 01:06:43 2019 (r351244) @@ -45,14 +45,11 @@ #include #include #include +#include #include #include -#include "miibus_if.h" - -#include -#include - +struct mii_data; struct usb_ether; struct usb_device_request; From owner-svn-src-head@freebsd.org Tue Aug 20 01:26:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDEA0D747F; Tue, 20 Aug 2019 01:26:03 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46CCmW576Rz3CG5; Tue, 20 Aug 2019 01:26:03 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73B432377B; Tue, 20 Aug 2019 01:26:03 +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 x7K1Q37Z079178; Tue, 20 Aug 2019 01:26:03 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7K1Q2x4079175; Tue, 20 Aug 2019 01:26:02 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908200126.x7K1Q2x4079175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 20 Aug 2019 01:26:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351245 - in head/sys/powerpc: booke include X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys/powerpc: booke include X-SVN-Commit-Revision: 351245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 01:26:03 -0000 Author: jhibbits Date: Tue Aug 20 01:26:02 2019 New Revision: 351245 URL: https://svnweb.freebsd.org/changeset/base/351245 Log: powerpc: Link Book-E kernels at the same address as AIM kernels Summary: Reduce the diff between AIM and Book-E even more. This also cleans up vmparam.h significantly. Reviewed by: luporl Differential Revision: https://reviews.freebsd.org/D21301 Modified: head/sys/powerpc/booke/pmap.c head/sys/powerpc/include/param.h head/sys/powerpc/include/vmparam.h Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue Aug 20 01:06:43 2019 (r351244) +++ head/sys/powerpc/booke/pmap.c Tue Aug 20 01:26:02 2019 (r351245) @@ -219,7 +219,7 @@ uint32_t tlb1_entries; #define TLB1_ENTRIES (tlb1_entries) -static vm_offset_t tlb1_map_base = VM_MAXUSER_ADDRESS + PAGE_SIZE; +static vm_offset_t tlb1_map_base = (vm_offset_t)VM_MAXUSER_ADDRESS + PAGE_SIZE; static tlbtid_t tid_alloc(struct pmap *); static void tid_flush(tlbtid_t tid); @@ -1574,7 +1574,6 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o * Note that kernel end does not necessarily relate to kernsize. * kernsize is the size of the kernel that is actually mapped. */ - kernstart = trunc_page(start); data_start = round_page(kernelend); data_end = data_start; @@ -2146,7 +2145,7 @@ mmu_booke_map_user_ptr(mmu_t mmu, pmap_t pm, volatile void **kaddr, size_t ulen, size_t *klen) { - if ((uintptr_t)uaddr + ulen > VM_MAXUSER_ADDRESS + PAGE_SIZE) + if (trunc_page((uintptr_t)uaddr + ulen) > VM_MAXUSER_ADDRESS) return (EFAULT); *kaddr = (void *)(uintptr_t)uaddr; @@ -2166,7 +2165,7 @@ mmu_booke_decode_kernel_ptr(mmu_t mmu, vm_offset_t add vm_offset_t *decoded_addr) { - if (addr < VM_MAXUSER_ADDRESS) + if (trunc_page(addr) <= VM_MAXUSER_ADDRESS) *is_user = 1; else *is_user = 0; @@ -4025,7 +4024,8 @@ tlb1_mapin_region(vm_offset_t va, vm_paddr_t pa, vm_si void tlb1_init() { - uint32_t mas0, mas1, mas2, mas3, mas7; + vm_offset_t mas2; + uint32_t mas0, mas1, mas3, mas7; uint32_t tsz; tlb1_get_tlbconf(); @@ -4044,6 +4044,7 @@ tlb1_init() tsz = (mas1 & MAS1_TSIZE_MASK) >> MAS1_TSIZE_SHIFT; kernsize += (tsz > 0) ? tsize2size(tsz) : 0; + kernstart = trunc_page(mas2); /* Setup TLB miss defaults */ set_mas4_defaults(); Modified: head/sys/powerpc/include/param.h ============================================================================== --- head/sys/powerpc/include/param.h Tue Aug 20 01:06:43 2019 (r351244) +++ head/sys/powerpc/include/param.h Tue Aug 20 01:26:02 2019 (r351245) @@ -103,7 +103,7 @@ #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) #define PAGE_SHIFT 12 -#define PAGE_SIZE (1L << PAGE_SHIFT) /* Page size */ +#define PAGE_SIZE (1 << PAGE_SHIFT) /* Page size */ #define PAGE_MASK (PAGE_SIZE - 1) #define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) Modified: head/sys/powerpc/include/vmparam.h ============================================================================== --- head/sys/powerpc/include/vmparam.h Tue Aug 20 01:06:43 2019 (r351244) +++ head/sys/powerpc/include/vmparam.h Tue Aug 20 01:26:02 2019 (r351245) @@ -72,53 +72,35 @@ #endif #ifdef AIM -#define VM_MAXUSER_ADDRESS32 ((vm_offset_t)0xfffff000) +#define VM_MAXUSER_ADDRESS32 0xfffff000 #else -#define VM_MAXUSER_ADDRESS32 ((vm_offset_t)0x7ffff000) +#define VM_MAXUSER_ADDRESS32 0x7ffff000 #endif /* * Would like to have MAX addresses = 0, but this doesn't (currently) work */ -#if !defined(LOCORE) #ifdef __powerpc64__ -#define VM_MIN_ADDRESS (0x0000000000000000UL) -#define VM_MAXUSER_ADDRESS (0x3ffffffffffff000UL) -#define VM_MAX_ADDRESS (0xffffffffffffffffUL) +#define VM_MIN_ADDRESS 0x0000000000000000 +#define VM_MAXUSER_ADDRESS 0x3ffffffffffff000 +#define VM_MAX_ADDRESS 0xffffffffffffffff +#define VM_MIN_KERNEL_ADDRESS 0xe000000000000000 +#define VM_MAX_KERNEL_ADDRESS 0xe0000007ffffffff +#define VM_MAX_SAFE_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS #else -#define VM_MIN_ADDRESS ((vm_offset_t)0) +#define VM_MIN_ADDRESS 0 #define VM_MAXUSER_ADDRESS VM_MAXUSER_ADDRESS32 -#define VM_MAX_ADDRESS ((vm_offset_t)0xffffffff) +#define VM_MAX_ADDRESS 0xffffffff #endif + #define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) -#else /* LOCORE */ -#ifdef BOOKE -#define VM_MIN_ADDRESS 0 -#ifdef __powerpc64__ -#define VM_MAXUSER_ADDRESS 0x3ffffffffffff000 -#else -#define VM_MAXUSER_ADDRESS 0x7ffff000 -#endif -#endif -#endif /* LOCORE */ #define FREEBSD32_SHAREDPAGE (VM_MAXUSER_ADDRESS32 - PAGE_SIZE) #define FREEBSD32_USRSTACK FREEBSD32_SHAREDPAGE -#ifdef __powerpc64__ -#ifndef LOCORE -#define VM_MIN_KERNEL_ADDRESS 0xe000000000000000UL -#define VM_MAX_KERNEL_ADDRESS 0xe0000007ffffffffUL -#else -#define VM_MIN_KERNEL_ADDRESS 0xe000000000000000 -#define VM_MAX_KERNEL_ADDRESS 0xe0000007ffffffff -#endif -#define VM_MAX_SAFE_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS -#endif - -#ifdef AIM #define KERNBASE 0x00100100 /* start of kernel virtual */ +#ifdef AIM #ifndef __powerpc64__ #define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)KERNEL_SR << ADDR_SR_SHFT) #define VM_MAX_SAFE_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + 2*SEGMENT_LENGTH -1) @@ -136,12 +118,9 @@ /* Use the direct map for UMA small allocs on powerpc64. */ #ifdef __powerpc64__ #define UMA_MD_SMALL_ALLOC -#endif - -#define KERNBASE 0x04000100 /* start of kernel physical */ -#ifndef __powerpc64__ -#define VM_MIN_KERNEL_ADDRESS 0xc0000000 -#define VM_MAX_KERNEL_ADDRESS 0xffffefff +#else +#define VM_MIN_KERNEL_ADDRESS 0xc0000000 +#define VM_MAX_KERNEL_ADDRESS 0xffffefff #define VM_MAX_SAFE_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS #endif From owner-svn-src-head@freebsd.org Tue Aug 20 07:10:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26BA8C8124; Tue, 20 Aug 2019 07:10:26 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46CMPs14cfz4079; Tue, 20 Aug 2019 07:10:24 +0000 (UTC) (envelope-from ohartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1566285013; bh=ewWDeGVmT7vq87/C7tfztFqrh1l2tUqM2F0g7qPkJxo=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=kt5k3qdqe9LbxtV6osOKxbak3HXnkhFBpYo2w60gj4zk9XxBQUDnUnQ5gGER9OV5V oW8DIIitWUIWalKw+Rwin+2Tnt3Tkqity5ZRZp6ewjgzlkY8EcZKUjj33QO8zh9W/s qVMELCpyNkpU2l9rpqMwgZPPTdFNAbb+2iN2vciI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from freyja ([46.88.81.15]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LyR1G-1iMT8x02KM-015nzM; Tue, 20 Aug 2019 09:04:25 +0200 Date: Tue, 20 Aug 2019 09:04:23 +0200 From: "O. Hartmann" To: "Stephen J. Kiernan" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351244 - head/sys/dev/usb/net Message-ID: <20190820090413.6c08b565@freyja> In-Reply-To: <201908200106.x7K16hWT067244@repo.freebsd.org> References: <201908200106.x7K16hWT067244@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:4t2/3dEb8jAM205ipaJmRNSCtjGXiT1Tz1fqhxcFwBMQpdpZqZ7 VRjpaCvfCnDP2qJ4DwSIYIMPp1xY+u3fbw5OxA2JSkOAXH7WuTC/6h7Qu/Ao+7ysygP18eo 5hpdhO3yqXu0Ya8U7fXPB2qbXZRZuOmMYiRweIithYX053dAts5eDLn1KUi4YZy9xzhbvmL 8EVlOjepXfcvPtnGHGmYA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:YKN2WAVnpMc=:tVAjonYjndl93GLu3VST/G CdJ1j9AM5lImdU6hhsAsUC/g8V4mudERz4FaUdKQLznnF3r88JpdAqWEksYJzQmHHRHKuTPw8 5JFmoaV/UVa13RZ0t0FmlP2OvLheD7qH0Qax/7h59yLkSLYYH/V4x96dU9A3FFxBTVFta+No4 Q2ttChalV0FNG+WE1nFX1uwynDXaZkDv4Bj/BdpXszmdN67UXMGBnzInsNePQHh/GYxJqJEYG j+ghUVer4621nDTaZUcgGnoLsdamOnZeCYSsrb73GwvFjY0gWV8scufklhRmxnJUFNGZpdllj n/IF2krJD4cgLPtVi1fIG2StTe5GxZG48K67oTdyJ3osrwF4cOcXZycGOFU9DvpypuWu8NZDD MksQABeDWKhXxJbVFLHLfvTFqH4+GB0JNV2DaBbuzfIaajuhTf/HSb27m/8Gd8SVkWjxRs0ut m55oDJ1yDBqFfB/oMMJr9d+8ddgsdvTV88y6g+VvyaE/qX1WIhhdeoKXv7i1Wbx+WwmQYs2CJ VHum4KYffAZkt6LQYIbkzJES8LOg2X8GM3qwJb+EjP2ug1tGrheTZRKgFiYSj6SSOsw9rbGLl RclCIDOAfml/IwqEOcko/3J7U3kLekena42IN6Zrg7TRpvkFf8xAhePg1RKKk9yDaJuyuhdKt 6fokEKJBeorQVx5x09pq+dfmS953hTw1rd+Sqb+eZBX2DaEGxapRqkAFY4d1poXwf3Vg3nwvi wHpkQYJld6Oom8VNWb85+fvtclnfeSwtzeLlSWOcdrAdRt+vIbz1P3WeQ7vCax7fG7nkn2LXy e6h5+66aqLqpwxA14cCEVX/PUGYrJIytiGoOXpAdMunWX4pNI2xcPtYC1ng4r1kRiRKDdSF3B 1J818zvsndjxa7QO9bSdSZ6PuYa62nCiabk6PJeEkzQkWjXOlM27HLgNuARnbHG92SlbtAtkI x6ZPIeoi2WxbM7kIdYwQmkdUGKWgF4dsSvbxBC4yBR4OhaW138EZcIknVOPb5pKwL/cpWsbkg VnBfp+WKM93ILVm5Kjmr0B3bvpOnaKfNoylfEJreEdLXwQ8HzAxgEmuboPfxTRWKIrYNhwS4e 9nNF9cVgS+AsB00LWqA2WZ2mEgvOtwJBNkD61n5H4sMuMlO8aJZF8lXs7aVBov7PconiCbP0h dfjwuHpFR7v5S1NaA1Ykp2FE7xXLrR9T6sAETooEC8cFzonw== X-Rspamd-Queue-Id: 46CMPs14cfz4079 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=kt5k3qdq; dmarc=none; spf=none (mx1.freebsd.org: domain of ohartmann@walstatt.org has no SPF policy when checking 212.227.17.20) smtp.mailfrom=ohartmann@walstatt.org X-Spamd-Result: default: False [-3.90 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmx.net:s=badeba3b8450]; RECEIVED_SPAMHAUS_PBL(0.00)[15.81.88.46.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; IP_SCORE(-1.08)[ip: (-6.31), ipnet: 212.227.0.0/16(-1.36), asn: 8560(2.25), country: DE(-0.01)]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[walstatt.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmx.net:+]; NEURAL_HAM_SHORT(-0.92)[-0.917,0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_SPF_NA(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[20.17.227.212.list.dnswl.org : 127.0.3.1]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 07:10:26 -0000 On Tue, 20 Aug 2019 01:06:43 +0000 (UTC) "Stephen J. Kiernan" wrote: > Author: stevek > Date: Tue Aug 20 01:06:43 2019 > New Revision: 351244 > URL: https://svnweb.freebsd.org/changeset/base/351244 > > Log: > usb_ethernet.h includes a number of mii headers, but only does so in > order to have struct mii_data available. However, it only really needs > a forward declaration of struct mii_data for use in pointer form for > the return type of a function prototype. > > Custom kernel configuration that have usb and fdt enabled, but no miib= us, > end up with compilation failures because miibus_if.h will not get > generated. > > Due to the above, the following changes have been made to usb_ethernet= .h: > * remove the inclusion of mii headers > * forward-declare struct mii_data > * include net/ifq.h to satify the need for complete struct ifqueue > > Reviewed by: ian > Obtained from: Juniper Networks, Inc. > Differential Revision: https://reviews.freebsd.org/D21293 > > Modified: > head/sys/dev/usb/net/usb_ethernet.h > > Modified: head/sys/dev/usb/net/usb_ethernet.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/dev/usb/net/usb_ethernet.h Tue Aug 20 00:50:17 > 2019 (r351243) +++ head/sys/dev/usb/net/usb_ethernet.h Tue Aug > 20 01:06:43 2019 (r351244) @@ -45,14 +45,11 @@ > #include > #include > #include > +#include > #include > #include > > -#include "miibus_if.h" > - > -#include > -#include > - > +struct mii_data; > struct usb_ether; > struct usb_device_request; > > _______________________________________________ > 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" This breaks buildkernel: [...] =3D=3D=3D> usb/udl (all) Building /usr/obj/usr/src/amd64.amd64/sys/WOTAN/modules/usr/src/sys/modules/usb/udl= /udl.ko =3D=3D=3D> usb/uether (all) Building /usr/obj/usr/src/amd64.amd64/sys/WOTAN/modules/usr/src/sys/modules/usb/uet= her/uether.ko =3D=3D=3D> usb/aue (all) Building /usr/obj/usr/src/amd64.amd64/sys/WOTAN/modules/usr/src/sys/modules/usb/aue= /if_aue.o /usr/src/sys/dev/usb/net/if_aue.c:197:8: error: unknown type name 'miibus_readreg_t' static miibus_readreg_t aue_miibus_readreg; ^ /usr/src/sys/dev/usb/net/if_aue.c:198:8: error: unknown type name 'miibus_writereg_t' static miibus_writereg_t aue_miibus_writereg; ^ /usr/src/sys/dev/usb/net/if_aue.c:199:8: error: unknown type name 'miibus_statchg_t' static miibus_statchg_t aue_miibus_statchg; ^ /usr/src/sys/dev/usb/net/if_aue.c:262:2: error: use of undeclared identifi= er 'miibus_readreg_desc' DEVMETHOD(miibus_readreg, aue_miibus_readreg), ^ /usr/src/sys/sys/bus.h:751:19: note: expanded from macro 'DEVMETHOD' #define DEVMETHOD KOBJMETHOD [...] Kind regards, oh From owner-svn-src-head@freebsd.org Tue Aug 20 14:31:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16D87D35DC; Tue, 20 Aug 2019 14:31:23 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46CYBf6tY0z4Q20; Tue, 20 Aug 2019 14:31:22 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CDE5A4A50; Tue, 20 Aug 2019 14:31:22 +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 x7KEVMtE045077; Tue, 20 Aug 2019 14:31:22 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7KEVM3D045075; Tue, 20 Aug 2019 14:31:22 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201908201431.x7KEVM3D045075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 20 Aug 2019 14:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351248 - head/tests/sys/netpfil/common X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/common X-SVN-Commit-Revision: 351248 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 14:31:23 -0000 Author: kp Date: Tue Aug 20 14:31:22 2019 New Revision: 351248 URL: https://svnweb.freebsd.org/changeset/base/351248 Log: netpfil tests: Add the set ToS test for ipfw and pf This test tests the following: - The firewall is able to set the tos bits - The firewall is able to set the DSCP bits when EN bits is already set and the EN bits remains unchanged. - The firewall is able to drop the packets based on ToS value Submitted by: Ahsan Barkati Reviewed by: kp Sponsored by: Google, Inc. (GSoC 2019) Differential Revision: https://reviews.freebsd.org/D21305 Added: head/tests/sys/netpfil/common/tos.sh (contents, props changed) Modified: head/tests/sys/netpfil/common/Makefile Modified: head/tests/sys/netpfil/common/Makefile ============================================================================== --- head/tests/sys/netpfil/common/Makefile Tue Aug 20 05:36:41 2019 (r351247) +++ head/tests/sys/netpfil/common/Makefile Tue Aug 20 14:31:22 2019 (r351248) @@ -7,7 +7,8 @@ TESTSDIR= ${TESTSBASE}/sys/netpfil/common ATF_TESTS_SH+= \ pass_block \ - nat + nat \ + tos ${PACKAGE}FILES+= \ utils.subr \ Added: head/tests/sys/netpfil/common/tos.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/common/tos.sh Tue Aug 20 14:31:22 2019 (r351248) @@ -0,0 +1,118 @@ +#- +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Ahsan Barkati +# +# 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$ +# + +. $(atf_get_srcdir)/utils.subr +. $(atf_get_srcdir)/runner.subr + +tos_head() +{ + atf_set descr 'set-tos test' + atf_set require.user root + atf_set require.progs scapy +} + +tos_body() +{ + firewall=$1 + firewall_init $firewall + + epair_send=$(vnet_mkepair) + ifconfig ${epair_send}a 192.0.2.1/24 up + + epair_recv=$(vnet_mkepair) + ifconfig ${epair_recv}a up + + vnet_mkjail iron ${epair_send}b ${epair_recv}b + jexec iron ifconfig ${epair_send}b 192.0.2.2/24 up + jexec iron ifconfig ${epair_recv}b 198.51.100.2/24 up + jexec iron sysctl net.inet.ip.forwarding=1 + jexec iron arp -s 198.51.100.3 00:01:02:03:04:05 + route add -net 198.51.100.0/24 192.0.2.2 + + # Check if the firewall is able to set the ToS bits + firewall_config "iron" ${firewall} \ + "pf" \ + "scrub out proto icmp set-tos 36" \ + "ipfw" \ + "ipfw -q add 100 setdscp 9 ip from any to any" + # dscp is set to 9 because last two bits are for + # EN and hence tos would be 36 + + atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \ + --sendif ${epair_send}a \ + --to 198.51.100.3 \ + --recvif ${epair_recv}a \ + --expect-tos 36 + + # Check if the firewall is able to set the ToS bits + # and persists the EN bits (if already set) + firewall_config "iron" ${firewall} \ + "pf" \ + "scrub out proto icmp set-tos 36" \ + "ipfw" \ + "ipfw -q add 100 setdscp 9 ip from any to any" + + atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \ + --sendif ${epair_send}a \ + --to 198.51.100.3 \ + --recvif ${epair_recv}a \ + --send-tos 3 \ + --expect-tos 39 + + # Check if the firewall is able to filter the + # packets based on the ToS value + firewall_config "iron" ${firewall} \ + "pf" \ + "block all tos 36" \ + "ipfw" \ + "ipfw -q add 100 deny all from any to any dscp 9" + + atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \ + --sendif ${epair_send}a \ + --to 198.51.100.3 \ + --recvif ${epair_recv}a \ + --send-tos 36 + + atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \ + --sendif ${epair_send}a \ + --to 198.51.100.3 \ + --recvif ${epair_recv}a \ + --send-tos 32 +} + +tos_cleanup() +{ + firewall=$1 + firewall_cleanup $firewall +} + +setup_tests \ + "tos" \ + "pf" \ + "ipfw" From owner-svn-src-head@freebsd.org Tue Aug 20 14:46:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53710D3CB3; Tue, 20 Aug 2019 14:46:13 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46CYWn1WN3z4Qrf; Tue, 20 Aug 2019 14:46:13 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1654E4CA1; Tue, 20 Aug 2019 14:46:13 +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 x7KEkCdZ053399; Tue, 20 Aug 2019 14:46:12 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7KEkC0M053397; Tue, 20 Aug 2019 14:46:12 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201908201446.x7KEkC0M053397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 20 Aug 2019 14:46:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351249 - head/tests/sys/netpfil/common X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/common X-SVN-Commit-Revision: 351249 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 14:46:13 -0000 Author: kp Date: Tue Aug 20 14:46:12 2019 New Revision: 351249 URL: https://svnweb.freebsd.org/changeset/base/351249 Log: netpfil tests: Add too many fragments test for pf, ipfw and ipf Add test for checking that the packets are dropped if it is fragmented into more than the defined value. Submitted by: Ahsan Barkati Reviewed by: kp Sponsored by: Google, Inc. (GSoC 2019) Differential Revision: https://reviews.freebsd.org/D21307 Added: head/tests/sys/netpfil/common/fragments.sh (contents, props changed) Modified: head/tests/sys/netpfil/common/Makefile Modified: head/tests/sys/netpfil/common/Makefile ============================================================================== --- head/tests/sys/netpfil/common/Makefile Tue Aug 20 14:31:22 2019 (r351248) +++ head/tests/sys/netpfil/common/Makefile Tue Aug 20 14:46:12 2019 (r351249) @@ -8,7 +8,8 @@ TESTSDIR= ${TESTSBASE}/sys/netpfil/common ATF_TESTS_SH+= \ pass_block \ nat \ - tos + tos \ + fragments ${PACKAGE}FILES+= \ utils.subr \ Added: head/tests/sys/netpfil/common/fragments.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/common/fragments.sh Tue Aug 20 14:46:12 2019 (r351249) @@ -0,0 +1,80 @@ +#- +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Ahsan Barkati +# +# 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$ +# + +. $(atf_get_srcdir)/utils.subr +. $(atf_get_srcdir)/runner.subr + +fragments_head() +{ + atf_set descr 'Too many fragments test' + atf_set require.user root +} + +fragments_body() +{ + firewall=$1 + firewall_init $firewall + + epair=$(vnet_mkepair) + ifconfig ${epair}b inet 192.0.2.1/24 up + + vnet_mkjail iron ${epair}a + jexec iron ifconfig ${epair}a 192.0.2.2/24 up + + ifconfig ${epair}b mtu 200 + jexec iron ifconfig ${epair}a mtu 200 + + firewall_config "iron" ${firewall} \ + "pf" \ + "scrub all fragment reassemble" \ + "ipfw" \ + "ipfw -q add 100 reass all from any to any in" \ + "ipf" \ + "pass in all with frags" + + jexec iron sysctl net.inet.ip.maxfragsperpacket=1024 + + atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.2 + atf_check -s exit:0 -o ignore ping -c 1 -s 800 192.0.2.2 + + # Too many fragments should fail + atf_check -s exit:2 -o ignore ping -c 1 -s 20000 192.0.2.2 +} + +fragments_cleanup() +{ + firewall=$1 + firewall_cleanup $firewall +} + +setup_tests \ + "fragments" \ + "pf" \ + "ipfw" \ + "ipf" From owner-svn-src-head@freebsd.org Tue Aug 20 15:14:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D272D441B; Tue, 20 Aug 2019 15:14:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46CZ8V1pDLz4S74; Tue, 20 Aug 2019 15:14:34 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F0345217; Tue, 20 Aug 2019 15:14:34 +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 x7KFEYdE071021; Tue, 20 Aug 2019 15:14:34 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7KFEWCs071012; Tue, 20 Aug 2019 15:14:32 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908201514.x7KFEWCs071012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 20 Aug 2019 15:14:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351250 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 351250 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 15:14:34 -0000 Author: jhibbits Date: Tue Aug 20 15:14:32 2019 New Revision: 351250 URL: https://svnweb.freebsd.org/changeset/base/351250 Log: Unbreak USB ethernet module builds Sponsored by: Juniper Networks, Inc. Modified: head/sys/dev/usb/net/if_aue.c head/sys/dev/usb/net/if_axe.c head/sys/dev/usb/net/if_axge.c head/sys/dev/usb/net/if_mos.c head/sys/dev/usb/net/if_muge.c head/sys/dev/usb/net/if_rue.c head/sys/dev/usb/net/if_smsc.c head/sys/dev/usb/net/if_udav.c head/sys/dev/usb/net/if_ure.c Modified: head/sys/dev/usb/net/if_aue.c ============================================================================== --- head/sys/dev/usb/net/if_aue.c Tue Aug 20 14:46:12 2019 (r351249) +++ head/sys/dev/usb/net/if_aue.c Tue Aug 20 15:14:32 2019 (r351250) @@ -92,7 +92,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include @@ -104,6 +108,8 @@ __FBSDID("$FreeBSD$"); #include #include + +#include "miibus_if.h" #ifdef USB_DEBUG static int aue_debug = 0; Modified: head/sys/dev/usb/net/if_axe.c ============================================================================== --- head/sys/dev/usb/net/if_axe.c Tue Aug 20 14:46:12 2019 (r351249) +++ head/sys/dev/usb/net/if_axe.c Tue Aug 20 15:14:32 2019 (r351250) @@ -116,6 +116,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "miibus_if.h" + /* * AXE_178_MAX_FRAME_BURST * max frame burst size for Ax88178 and Ax88772 Modified: head/sys/dev/usb/net/if_axge.c ============================================================================== --- head/sys/dev/usb/net/if_axge.c Tue Aug 20 14:46:12 2019 (r351249) +++ head/sys/dev/usb/net/if_axge.c Tue Aug 20 15:14:32 2019 (r351250) @@ -48,7 +48,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include @@ -60,6 +64,8 @@ __FBSDID("$FreeBSD$"); #include #include + +#include "miibus_if.h" /* * Various supported device vendors/products. Modified: head/sys/dev/usb/net/if_mos.c ============================================================================== --- head/sys/dev/usb/net/if_mos.c Tue Aug 20 14:46:12 2019 (r351249) +++ head/sys/dev/usb/net/if_mos.c Tue Aug 20 15:14:32 2019 (r351250) @@ -120,7 +120,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include @@ -131,6 +135,8 @@ __FBSDID("$FreeBSD$"); #include #include + +#include "miibus_if.h" //#include #include "if_mosreg.h" Modified: head/sys/dev/usb/net/if_muge.c ============================================================================== --- head/sys/dev/usb/net/if_muge.c Tue Aug 20 14:46:12 2019 (r351249) +++ head/sys/dev/usb/net/if_muge.c Tue Aug 20 15:14:32 2019 (r351250) @@ -87,7 +87,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include @@ -112,6 +116,8 @@ __FBSDID("$FreeBSD$"); #include #include + +#include "miibus_if.h" #ifdef USB_DEBUG static int muge_debug = 0; Modified: head/sys/dev/usb/net/if_rue.c ============================================================================== --- head/sys/dev/usb/net/if_rue.c Tue Aug 20 14:46:12 2019 (r351249) +++ head/sys/dev/usb/net/if_rue.c Tue Aug 20 15:14:32 2019 (r351250) @@ -89,7 +89,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include @@ -101,6 +105,8 @@ __FBSDID("$FreeBSD$"); #include #include + +#include "miibus_if.h" #ifdef USB_DEBUG static int rue_debug = 0; Modified: head/sys/dev/usb/net/if_smsc.c ============================================================================== --- head/sys/dev/usb/net/if_smsc.c Tue Aug 20 14:46:12 2019 (r351249) +++ head/sys/dev/usb/net/if_smsc.c Tue Aug 20 15:14:32 2019 (r351250) @@ -87,7 +87,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include @@ -112,6 +116,8 @@ __FBSDID("$FreeBSD$"); #include #include + +#include "miibus_if.h" #ifdef USB_DEBUG static int smsc_debug = 0; Modified: head/sys/dev/usb/net/if_udav.c ============================================================================== --- head/sys/dev/usb/net/if_udav.c Tue Aug 20 14:46:12 2019 (r351249) +++ head/sys/dev/usb/net/if_udav.c Tue Aug 20 15:14:32 2019 (r351250) @@ -70,11 +70,17 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include #include "usbdevs.h" + +#include "miibus_if.h" #define USB_DEBUG_VAR udav_debug #include Modified: head/sys/dev/usb/net/if_ure.c ============================================================================== --- head/sys/dev/usb/net/if_ure.c Tue Aug 20 14:46:12 2019 (r351249) +++ head/sys/dev/usb/net/if_ure.c Tue Aug 20 15:14:32 2019 (r351250) @@ -41,7 +41,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include @@ -53,6 +57,8 @@ __FBSDID("$FreeBSD$"); #include #include + +#include "miibus_if.h" #ifdef USB_DEBUG static int ure_debug = 0; From owner-svn-src-head@freebsd.org Tue Aug 20 16:07:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D0DBD52B5; Tue, 20 Aug 2019 16:07:18 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46CbKL0QDFz4VhX; Tue, 20 Aug 2019 16:07:18 +0000 (UTC) (envelope-from brooks@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E14835B4E; Tue, 20 Aug 2019 16:07:17 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7KG7H8l001336; Tue, 20 Aug 2019 16:07:17 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7KG7HOb001335; Tue, 20 Aug 2019 16:07:17 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201908201607.x7KG7HOb001335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 20 Aug 2019 16:07:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351251 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 351251 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 16:07:18 -0000 Author: brooks Date: Tue Aug 20 16:07:17 2019 New Revision: 351251 URL: https://svnweb.freebsd.org/changeset/base/351251 Log: Remove some compatability with Seventh Edition UNIX realloc(). In Seventh Edition UNIX, the last pointer passed to free() was guaranteed to not actually have been freed allowing memory to be "compacted" via the following pattern: free(foo); foo = realloc(foo, newsize); Further, Andrew Koenig reports in "C Traps and Pitfalls" that the original realloc() implementation required this pattern. The C standard is clear that this is Undefined Behavior. Modern allocators don't support it and no portable code could rely on it so remove this support. Note: the removed implementation contains an off-by-one error and if an item isn't found on the freelist, then twice as much memory as the largest possible allocation will be copied. Reviewed by: kib, imp Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21296 Modified: head/libexec/rtld-elf/rtld_malloc.c Modified: head/libexec/rtld-elf/rtld_malloc.c ============================================================================== --- head/libexec/rtld-elf/rtld_malloc.c Tue Aug 20 15:14:32 2019 (r351250) +++ head/libexec/rtld-elf/rtld_malloc.c Tue Aug 20 16:07:17 2019 (r351251) @@ -85,7 +85,6 @@ union overhead { static void morecore(int bucket); static int morepages(int n); -static int findbucket(union overhead *freep, int srchlen); #define MAGIC 0xef /* magic # on accounting info */ @@ -248,19 +247,6 @@ __crt_free(void *cp) nextf[size] = op; } -/* - * When a program attempts "storage compaction" as mentioned in the - * old malloc man page, it realloc's an already freed block. Usually - * this is the last block it freed; occasionally it might be farther - * back. We have to search all the free lists for the block in order - * to determine its bucket: 1st we make one pass through the lists - * checking only the first block in each; if that fails we search - * ``realloc_srchlen'' blocks in each list for a match (the variable - * is extern so the caller can modify it). If that fails we just copy - * however many bytes was given to realloc() and hope it's not huge. - */ -static int realloc_srchlen = 4; /* 4 should be plenty, -1 =>'s whole list */ - void * __crt_realloc(void *cp, size_t nbytes) { @@ -268,78 +254,33 @@ __crt_realloc(void *cp, size_t nbytes) int i; union overhead *op; char *res; - int was_alloced = 0; if (cp == NULL) return (__crt_malloc(nbytes)); op = (union overhead *)((caddr_t)cp - sizeof (union overhead)); - if (op->ov_magic == MAGIC) { - was_alloced++; - i = op->ov_index; - } else { - /* - * Already free, doing "compaction". - * - * Search for the old block of memory on the - * free list. First, check the most common - * case (last element free'd), then (this failing) - * the last ``realloc_srchlen'' items free'd. - * If all lookups fail, then assume the size of - * the memory block being realloc'd is the - * largest possible (so that all "nbytes" of new - * memory are copied into). Note that this could cause - * a memory fault if the old area was tiny, and the moon - * is gibbous. However, that is very unlikely. - */ - if ((i = findbucket(op, 1)) < 0 && - (i = findbucket(op, realloc_srchlen)) < 0) - i = NBUCKETS; - } + if (op->ov_magic != MAGIC) + return (NULL); /* Double-free or bad argument */ + i = op->ov_index; onb = 1 << (i + 3); if (onb < (u_int)pagesz) onb -= sizeof(*op); else onb += pagesz - sizeof(*op); /* avoid the copy if same size block */ - if (was_alloced) { - if (i) { - i = 1 << (i + 2); - if (i < pagesz) - i -= sizeof(*op); - else - i += pagesz - sizeof(*op); - } - if (nbytes <= onb && nbytes > (size_t)i) - return (cp); - __crt_free(cp); + if (i != 0) { + i = 1 << (i + 2); + if (i < pagesz) + i -= sizeof(*op); + else + i += pagesz - sizeof(*op); } + if (nbytes <= onb && nbytes > (size_t)i) + return (cp); if ((res = __crt_malloc(nbytes)) == NULL) return (NULL); - if (cp != res) /* common optimization if "compacting" */ - bcopy(cp, res, (nbytes < onb) ? nbytes : onb); + bcopy(cp, res, (nbytes < onb) ? nbytes : onb); + __crt_free(cp); return (res); -} - -/* - * Search ``srchlen'' elements of each free list for a block whose - * header starts at ``freep''. If srchlen is -1 search the whole list. - * Return bucket number, or -1 if not found. - */ -static int -findbucket(union overhead *freep, int srchlen) -{ - union overhead *p; - int i, j; - - for (i = 0; i < NBUCKETS; i++) { - j = 0; - for (p = nextf[i]; p && j != srchlen; p = p->ov_next) { - if (p == freep) - return (i); - j++; - } - } - return (-1); } static int From owner-svn-src-head@freebsd.org Tue Aug 20 17:39:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B26DD696B; Tue, 20 Aug 2019 17:39:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46CdMp1D72z4ZZR; Tue, 20 Aug 2019 17:39:34 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BB7E6B94; Tue, 20 Aug 2019 17:39:34 +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 x7KHdXhA054614; Tue, 20 Aug 2019 17:39:33 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7KHdXvv054610; Tue, 20 Aug 2019 17:39:33 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201908201739.x7KHdXvv054610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 20 Aug 2019 17:39:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351253 - in head/contrib/libc++: include src X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/contrib/libc++: include src X-SVN-Commit-Revision: 351253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 17:39:34 -0000 Author: dim Date: Tue Aug 20 17:39:32 2019 New Revision: 351253 URL: https://svnweb.freebsd.org/changeset/base/351253 Log: Pull in r368867 from upstream libc++ trunk (by Marshall Clow): Rework recursive_timed_mutex so that it uses __thread_id instead of using the lower-level __libcpp_thread_id. This is prep for fixing PR42918. Reviewed as https://reviews.llvm.org/D65895 Pull in r368916 from upstream libc++ trunk (by Marshall Clow): Fix thread comparison by making sure we never pass our special 'not a thread' value to the underlying implementation. Fixes PR#42918. This should fix std::thread::id::operator==() attempting to call pthread_equal(3) with zero values. Reported by: andrew@tao11.riddles.org.uk PR: 239038, 239550 MFC after: 3 days Modified: head/contrib/libc++/include/__threading_support head/contrib/libc++/include/mutex head/contrib/libc++/include/thread head/contrib/libc++/src/mutex.cpp Modified: head/contrib/libc++/include/__threading_support ============================================================================== --- head/contrib/libc++/include/__threading_support Tue Aug 20 17:00:31 2019 (r351252) +++ head/contrib/libc++/include/__threading_support Tue Aug 20 17:39:32 2019 (r351253) @@ -13,6 +13,7 @@ #include <__config> #include +#include #include #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER @@ -392,6 +393,86 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p } #endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL + +class _LIBCPP_TYPE_VIS thread; +class _LIBCPP_TYPE_VIS __thread_id; + +namespace this_thread +{ + +_LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT; + +} // this_thread + +template<> struct hash<__thread_id>; + +class _LIBCPP_TEMPLATE_VIS __thread_id +{ + // FIXME: pthread_t is a pointer on Darwin but a long on Linux. + // NULL is the no-thread value on Darwin. Someone needs to check + // on other platforms. We assume 0 works everywhere for now. + __libcpp_thread_id __id_; + +public: + _LIBCPP_INLINE_VISIBILITY + __thread_id() _NOEXCEPT : __id_(0) {} + + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT + { // don't pass id==0 to underlying routines + if (__x.__id_ == 0) return __y.__id_ == 0; + if (__y.__id_ == 0) return false; + return __libcpp_thread_id_equal(__x.__id_, __y.__id_); + } + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT + {return !(__x == __y);} + friend _LIBCPP_INLINE_VISIBILITY + bool operator< (__thread_id __x, __thread_id __y) _NOEXCEPT + { // id==0 is always less than any other thread_id + if (__x.__id_ == 0) return __y.__id_ != 0; + if (__y.__id_ == 0) return false; + return __libcpp_thread_id_less(__x.__id_, __y.__id_); + } + friend _LIBCPP_INLINE_VISIBILITY + bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT + {return !(__y < __x);} + friend _LIBCPP_INLINE_VISIBILITY + bool operator> (__thread_id __x, __thread_id __y) _NOEXCEPT + {return __y < __x ;} + friend _LIBCPP_INLINE_VISIBILITY + bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT + {return !(__x < __y);} + + _LIBCPP_INLINE_VISIBILITY + void __reset() { __id_ = 0; } + + template + friend + _LIBCPP_INLINE_VISIBILITY + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id); + +private: + _LIBCPP_INLINE_VISIBILITY + __thread_id(__libcpp_thread_id __id) : __id_(__id) {} + + friend __thread_id this_thread::get_id() _NOEXCEPT; + friend class _LIBCPP_TYPE_VIS thread; + friend struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>; +}; + +namespace this_thread +{ + +inline _LIBCPP_INLINE_VISIBILITY +__thread_id +get_id() _NOEXCEPT +{ + return __libcpp_thread_get_current_id(); +} + +} // this_thread _LIBCPP_END_NAMESPACE_STD Modified: head/contrib/libc++/include/mutex ============================================================================== --- head/contrib/libc++/include/mutex Tue Aug 20 17:00:31 2019 (r351252) +++ head/contrib/libc++/include/mutex Tue Aug 20 17:39:32 2019 (r351253) @@ -280,7 +280,7 @@ class _LIBCPP_TYPE_VIS recursive_timed_mutex mutex __m_; condition_variable __cv_; size_t __count_; - __libcpp_thread_id __id_; + __thread_id __id_; public: recursive_timed_mutex(); ~recursive_timed_mutex(); @@ -307,9 +307,9 @@ bool recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) { using namespace chrono; - __libcpp_thread_id __id = __libcpp_thread_get_current_id(); + __thread_id __id = this_thread::get_id(); unique_lock lk(__m_); - if (__libcpp_thread_id_equal(__id, __id_)) + if (__id == __id_) { if (__count_ == numeric_limits::max()) return false; Modified: head/contrib/libc++/include/thread ============================================================================== --- head/contrib/libc++/include/thread Tue Aug 20 17:00:31 2019 (r351252) +++ head/contrib/libc++/include/thread Tue Aug 20 17:39:32 2019 (r351253) @@ -201,64 +201,6 @@ __thread_specific_ptr<_Tp>::set_pointer(pointer __p) __libcpp_tls_set(__key_, __p); } -class _LIBCPP_TYPE_VIS thread; -class _LIBCPP_TYPE_VIS __thread_id; - -namespace this_thread -{ - -_LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT; - -} // this_thread - -template<> struct hash<__thread_id>; - -class _LIBCPP_TEMPLATE_VIS __thread_id -{ - // FIXME: pthread_t is a pointer on Darwin but a long on Linux. - // NULL is the no-thread value on Darwin. Someone needs to check - // on other platforms. We assume 0 works everywhere for now. - __libcpp_thread_id __id_; - -public: - _LIBCPP_INLINE_VISIBILITY - __thread_id() _NOEXCEPT : __id_(0) {} - - friend _LIBCPP_INLINE_VISIBILITY - bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT - {return __libcpp_thread_id_equal(__x.__id_, __y.__id_);} - friend _LIBCPP_INLINE_VISIBILITY - bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT - {return !(__x == __y);} - friend _LIBCPP_INLINE_VISIBILITY - bool operator< (__thread_id __x, __thread_id __y) _NOEXCEPT - {return __libcpp_thread_id_less(__x.__id_, __y.__id_);} - friend _LIBCPP_INLINE_VISIBILITY - bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT - {return !(__y < __x);} - friend _LIBCPP_INLINE_VISIBILITY - bool operator> (__thread_id __x, __thread_id __y) _NOEXCEPT - {return __y < __x ;} - friend _LIBCPP_INLINE_VISIBILITY - bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT - {return !(__x < __y);} - - template - friend - _LIBCPP_INLINE_VISIBILITY - basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) - {return __os << __id.__id_;} - -private: - _LIBCPP_INLINE_VISIBILITY - __thread_id(__libcpp_thread_id __id) : __id_(__id) {} - - friend __thread_id this_thread::get_id() _NOEXCEPT; - friend class _LIBCPP_TYPE_VIS thread; - friend struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>; -}; - template<> struct _LIBCPP_TEMPLATE_VIS hash<__thread_id> : public unary_function<__thread_id, size_t> @@ -270,17 +212,11 @@ struct _LIBCPP_TEMPLATE_VIS hash<__thread_id> } }; -namespace this_thread -{ - -inline _LIBCPP_INLINE_VISIBILITY -__thread_id -get_id() _NOEXCEPT -{ - return __libcpp_thread_get_current_id(); -} - -} // this_thread +template +_LIBCPP_INLINE_VISIBILITY +basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) +{return __os << __id.__id_;} class _LIBCPP_TYPE_VIS thread { Modified: head/contrib/libc++/src/mutex.cpp ============================================================================== --- head/contrib/libc++/src/mutex.cpp Tue Aug 20 17:00:31 2019 (r351252) +++ head/contrib/libc++/src/mutex.cpp Tue Aug 20 17:39:32 2019 (r351253) @@ -130,7 +130,7 @@ timed_mutex::unlock() _NOEXCEPT recursive_timed_mutex::recursive_timed_mutex() : __count_(0), - __id_(0) + __id_{} { } @@ -142,9 +142,9 @@ recursive_timed_mutex::~recursive_timed_mutex() void recursive_timed_mutex::lock() { - __libcpp_thread_id id = __libcpp_thread_get_current_id(); + __thread_id id = this_thread::get_id(); unique_lock lk(__m_); - if (__libcpp_thread_id_equal(id, __id_)) + if (id ==__id_) { if (__count_ == numeric_limits::max()) __throw_system_error(EAGAIN, "recursive_timed_mutex lock limit reached"); @@ -160,9 +160,9 @@ recursive_timed_mutex::lock() bool recursive_timed_mutex::try_lock() _NOEXCEPT { - __libcpp_thread_id id = __libcpp_thread_get_current_id(); + __thread_id id = this_thread::get_id(); unique_lock lk(__m_, try_to_lock); - if (lk.owns_lock() && (__count_ == 0 || __libcpp_thread_id_equal(id, __id_))) + if (lk.owns_lock() && (__count_ == 0 || id == __id_)) { if (__count_ == numeric_limits::max()) return false; @@ -179,7 +179,7 @@ recursive_timed_mutex::unlock() _NOEXCEPT unique_lock lk(__m_); if (--__count_ == 0) { - __id_ = 0; + __id_.__reset(); lk.unlock(); __cv_.notify_one(); } From owner-svn-src-head@freebsd.org Tue Aug 20 17:44:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC78AD6CA5; Tue, 20 Aug 2019 17:44:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46CdSz44rZz4b4V; Tue, 20 Aug 2019 17:44:03 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DD606D82; Tue, 20 Aug 2019 17:44:03 +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 x7KHi3As060503; Tue, 20 Aug 2019 17:44:03 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7KHi38h060502; Tue, 20 Aug 2019 17:44:03 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908201744.x7KHi38h060502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Aug 2019 17:44:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351254 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351254 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 17:44:03 -0000 Author: emaste Date: Tue Aug 20 17:44:03 2019 New Revision: 351254 URL: https://svnweb.freebsd.org/changeset/base/351254 Log: mqueuefs: fix compat32 struct file leak In a compat32 error case we previously leaked a struct file. Submitted by: Karsten König, Secfault Security Security: CVE-2019-5603 Modified: head/sys/kern/uipc_mqueue.c Modified: head/sys/kern/uipc_mqueue.c ============================================================================== --- head/sys/kern/uipc_mqueue.c Tue Aug 20 17:39:32 2019 (r351253) +++ head/sys/kern/uipc_mqueue.c Tue Aug 20 17:44:03 2019 (r351254) @@ -2806,7 +2806,7 @@ freebsd32_kmq_timedsend(struct thread *td, if (uap->abs_timeout != NULL) { error = copyin(uap->abs_timeout, &ets32, sizeof(ets32)); if (error != 0) - return (error); + goto out; CP(ets32, ets, tv_sec); CP(ets32, ets, tv_nsec); abs_timeout = &ets; @@ -2815,6 +2815,7 @@ freebsd32_kmq_timedsend(struct thread *td, waitok = !(fp->f_flag & O_NONBLOCK); error = mqueue_send(mq, uap->msg_ptr, uap->msg_len, uap->msg_prio, waitok, abs_timeout); +out: fdrop(fp, td); return (error); } From owner-svn-src-head@freebsd.org Tue Aug 20 17:52:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3A3BD7173; Tue, 20 Aug 2019 17:52:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46CdfP43NXz4cQC; Tue, 20 Aug 2019 17:52:13 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 529766F33; Tue, 20 Aug 2019 17:52:13 +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 x7KHqD87066293; Tue, 20 Aug 2019 17:52:13 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7KHqDN6066292; Tue, 20 Aug 2019 17:52:13 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908201752.x7KHqDN6066292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 20 Aug 2019 17:52:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351262 - head/sys/dev/sound/midi X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/sound/midi X-SVN-Commit-Revision: 351262 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 17:52:13 -0000 Author: markj Date: Tue Aug 20 17:52:12 2019 New Revision: 351262 URL: https://svnweb.freebsd.org/changeset/base/351262 Log: Use a sleepable lock for midistat functions. Otherwise the mutex needs to be dropped when copying out the midistat sbuf, leading to a race which allows one to read kernel memory beyond the end of the sbuf buffer. Reported and tested by: pho Security: CVE-2019-5612 Modified: head/sys/dev/sound/midi/midi.c Modified: head/sys/dev/sound/midi/midi.c ============================================================================== --- head/sys/dev/sound/midi/midi.c Tue Aug 20 17:51:32 2019 (r351261) +++ head/sys/dev/sound/midi/midi.c Tue Aug 20 17:52:12 2019 (r351262) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -49,10 +50,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include -#include -#include +#include #include #include #include @@ -187,10 +186,9 @@ TAILQ_HEAD(, snd_midi) midi_devs; * /dev/midistat variables and declarations, protected by midistat_lock */ -static struct mtx midistat_lock; +static struct sx midistat_lock; static int midistat_isopen = 0; static struct sbuf midistat_sbuf; -static int midistat_bufptr; static struct cdev *midistat_dev; /* @@ -289,7 +287,7 @@ midi_init(kobj_class_t cls, int unit, int channel, voi MIDI_TYPE *buf; MIDI_DEBUG(1, printf("midiinit: unit %d/%d.\n", unit, channel)); - mtx_lock(&midistat_lock); + sx_xlock(&midistat_lock); /* * Protect against call with existing unit/channel or auto-allocate a * new unit number. @@ -316,13 +314,8 @@ midi_init(kobj_class_t cls, int unit, int channel, voi unit = i + 1; MIDI_DEBUG(1, printf("midiinit #2: unit %d/%d.\n", unit, channel)); - m = malloc(sizeof(*m), M_MIDI, M_NOWAIT | M_ZERO); - if (m == NULL) - goto err0; - - m->synth = malloc(sizeof(*m->synth), M_MIDI, M_NOWAIT | M_ZERO); - if (m->synth == NULL) - goto err1; + m = malloc(sizeof(*m), M_MIDI, M_WAITOK | M_ZERO); + m->synth = malloc(sizeof(*m->synth), M_MIDI, M_WAITOK | M_ZERO); kobj_init((kobj_t)m->synth, &midisynth_class); m->synth->m = m; kobj_init((kobj_t)m, cls); @@ -331,7 +324,7 @@ midi_init(kobj_class_t cls, int unit, int channel, voi MIDI_DEBUG(1, printf("midiinit queues %d/%d.\n", inqsize, outqsize)); if (!inqsize && !outqsize) - goto err2; + goto err1; mtx_init(&m->lock, "raw midi", NULL, 0); mtx_init(&m->qlock, "q raw midi", NULL, 0); @@ -356,9 +349,8 @@ midi_init(kobj_class_t cls, int unit, int channel, voi if ((inqsize && !MIDIQ_BUF(m->inq)) || (outqsize && !MIDIQ_BUF(m->outq))) - goto err3; + goto err2; - m->busy = 0; m->flags = 0; m->unit = unit; @@ -366,14 +358,14 @@ midi_init(kobj_class_t cls, int unit, int channel, voi m->cookie = cookie; if (MPU_INIT(m, cookie)) - goto err3; + goto err2; mtx_unlock(&m->lock); mtx_unlock(&m->qlock); TAILQ_INSERT_TAIL(&midi_devs, m, link); - mtx_unlock(&midistat_lock); + sx_xunlock(&midistat_lock); m->dev = make_dev(&midi_cdevsw, MIDIMKMINOR(unit, MIDI_DEV_RAW, channel), @@ -382,16 +374,19 @@ midi_init(kobj_class_t cls, int unit, int channel, voi return m; -err3: mtx_destroy(&m->qlock); +err2: + mtx_destroy(&m->qlock); mtx_destroy(&m->lock); if (MIDIQ_BUF(m->inq)) free(MIDIQ_BUF(m->inq), M_MIDI); if (MIDIQ_BUF(m->outq)) free(MIDIQ_BUF(m->outq), M_MIDI); -err2: free(m->synth, M_MIDI); -err1: free(m, M_MIDI); -err0: mtx_unlock(&midistat_lock); +err1: + free(m->synth, M_MIDI); + free(m, M_MIDI); +err0: + sx_xunlock(&midistat_lock); MIDI_DEBUG(1, printf("midi_init ended in error\n")); return NULL; } @@ -409,7 +404,7 @@ midi_uninit(struct snd_midi *m) int err; err = EBUSY; - mtx_lock(&midistat_lock); + sx_xlock(&midistat_lock); mtx_lock(&m->lock); if (m->busy) { if (!(m->rchan || m->wchan)) @@ -428,8 +423,10 @@ midi_uninit(struct snd_midi *m) if (!err) goto exit; -err: mtx_unlock(&m->lock); -exit: mtx_unlock(&midistat_lock); +err: + mtx_unlock(&m->lock); +exit: + sx_xunlock(&midistat_lock); return err; } @@ -941,27 +938,22 @@ midistat_open(struct cdev *i_dev, int flags, int mode, int error; MIDI_DEBUG(1, printf("midistat_open\n")); - mtx_lock(&midistat_lock); + sx_xlock(&midistat_lock); if (midistat_isopen) { - mtx_unlock(&midistat_lock); + sx_xunlock(&midistat_lock); return EBUSY; } midistat_isopen = 1; - mtx_unlock(&midistat_lock); - if (sbuf_new(&midistat_sbuf, NULL, 4096, SBUF_AUTOEXTEND) == NULL) { error = ENXIO; - mtx_lock(&midistat_lock); goto out; } - mtx_lock(&midistat_lock); - midistat_bufptr = 0; error = (midistat_prepare(&midistat_sbuf) > 0) ? 0 : ENOMEM; - -out: if (error) +out: + if (error) midistat_isopen = 0; - mtx_unlock(&midistat_lock); + sx_xunlock(&midistat_lock); return error; } @@ -969,40 +961,40 @@ static int midistat_close(struct cdev *i_dev, int flags, int mode, struct thread *td) { MIDI_DEBUG(1, printf("midistat_close\n")); - mtx_lock(&midistat_lock); + sx_xlock(&midistat_lock); if (!midistat_isopen) { - mtx_unlock(&midistat_lock); + sx_xunlock(&midistat_lock); return EBADF; } sbuf_delete(&midistat_sbuf); midistat_isopen = 0; - - mtx_unlock(&midistat_lock); + sx_xunlock(&midistat_lock); return 0; } static int -midistat_read(struct cdev *i_dev, struct uio *buf, int flag) +midistat_read(struct cdev *i_dev, struct uio *uio, int flag) { - int l, err; + long l; + int err; MIDI_DEBUG(4, printf("midistat_read\n")); - mtx_lock(&midistat_lock); + sx_xlock(&midistat_lock); if (!midistat_isopen) { - mtx_unlock(&midistat_lock); + sx_xunlock(&midistat_lock); return EBADF; } - l = min(buf->uio_resid, sbuf_len(&midistat_sbuf) - midistat_bufptr); + if (uio->uio_offset < 0 || uio->uio_offset > sbuf_len(&midistat_sbuf)) { + sx_xunlock(&midistat_lock); + return EINVAL; + } err = 0; + l = lmin(uio->uio_resid, sbuf_len(&midistat_sbuf) - uio->uio_offset); if (l > 0) { - mtx_unlock(&midistat_lock); - err = uiomove(sbuf_data(&midistat_sbuf) + midistat_bufptr, l, - buf); - mtx_lock(&midistat_lock); - } else - l = 0; - midistat_bufptr += l; - mtx_unlock(&midistat_lock); + err = uiomove(sbuf_data(&midistat_sbuf) + uio->uio_offset, l, + uio); + } + sx_xunlock(&midistat_lock); return err; } @@ -1015,7 +1007,7 @@ midistat_prepare(struct sbuf *s) { struct snd_midi *m; - mtx_assert(&midistat_lock, MA_OWNED); + sx_assert(&midistat_lock, SA_XLOCKED); sbuf_printf(s, "FreeBSD Midi Driver (midi2)\n"); if (TAILQ_EMPTY(&midi_devs)) { @@ -1378,8 +1370,7 @@ midisynth_bender(void *n, uint8_t chn, uint16_t val) static int midi_destroy(struct snd_midi *m, int midiuninit) { - - mtx_assert(&midistat_lock, MA_OWNED); + sx_assert(&midistat_lock, SA_XLOCKED); mtx_assert(&m->lock, MA_OWNED); MIDI_DEBUG(3, printf("midi_destroy\n")); @@ -1405,8 +1396,8 @@ midi_destroy(struct snd_midi *m, int midiuninit) static int midi_load(void) { - mtx_init(&midistat_lock, "midistat lock", NULL, 0); - TAILQ_INIT(&midi_devs); /* Initialize the queue. */ + sx_init(&midistat_lock, "midistat lock"); + TAILQ_INIT(&midi_devs); midistat_dev = make_dev(&midistat_cdevsw, MIDIMKMINOR(0, MIDI_DEV_MIDICTL, 0), @@ -1423,7 +1414,7 @@ midi_unload(void) MIDI_DEBUG(1, printf("midi_unload()\n")); retval = EBUSY; - mtx_lock(&midistat_lock); + sx_xlock(&midistat_lock); if (midistat_isopen) goto exit0; @@ -1436,20 +1427,19 @@ midi_unload(void) if (retval) goto exit1; } - - mtx_unlock(&midistat_lock); /* XXX */ - + sx_xunlock(&midistat_lock); destroy_dev(midistat_dev); + /* * Made it here then unload is complete */ - mtx_destroy(&midistat_lock); + sx_destroy(&midistat_lock); return 0; exit1: mtx_unlock(&m->lock); exit0: - mtx_unlock(&midistat_lock); + sx_xunlock(&midistat_lock); if (retval) MIDI_DEBUG(2, printf("midi_unload: failed\n")); return retval; @@ -1498,13 +1488,11 @@ midimapper_open(void *arg1, void **cookie) int retval = 0; struct snd_midi *m; - mtx_lock(&midistat_lock); - + sx_xlock(&midistat_lock); TAILQ_FOREACH(m, &midi_devs, link) { retval++; } - - mtx_unlock(&midistat_lock); + sx_xunlock(&midistat_lock); return retval; } @@ -1520,17 +1508,15 @@ midimapper_fetch_synth(void *arg, void *cookie, int un struct snd_midi *m; int retval = 0; - mtx_lock(&midistat_lock); - + sx_xlock(&midistat_lock); TAILQ_FOREACH(m, &midi_devs, link) { if (unit == retval) { - mtx_unlock(&midistat_lock); + sx_xunlock(&midistat_lock); return (kobj_t)m->synth; } retval++; } - - mtx_unlock(&midistat_lock); + sx_xunlock(&midistat_lock); return NULL; } From owner-svn-src-head@freebsd.org Tue Aug 20 18:20:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6933D8515; Tue, 20 Aug 2019 18:20:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46CfHM6VpMz3Bsc; Tue, 20 Aug 2019 18:20:47 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2406731C; Tue, 20 Aug 2019 18:20:47 +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 x7KIKl1R080883; Tue, 20 Aug 2019 18:20:47 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7KIKjLu080715; Tue, 20 Aug 2019 18:20:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908201820.x7KIKjLu080715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Aug 2019 18:20:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351273 - in head/usr.sbin/makefs: . msdos X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/usr.sbin/makefs: . msdos X-SVN-Commit-Revision: 351273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 18:20:48 -0000 Author: emaste Date: Tue Aug 20 18:20:45 2019 New Revision: 351273 URL: https://svnweb.freebsd.org/changeset/base/351273 Log: makefs: add msdosfs (FAT) support Add FAT support to makefs by copying some files from sys/fs/msdosfs/ and updating others with changes from NetBSD. The six files copied from sys/fs/msdosfs at r348251 and modified are: denode.h direntry.h fat.h msdosfs_fat.c msdosfs_lookup.c msdosfsmount.h I would prefer to avoid the duplication, but reluctance to doing so was expressed in a previous review (D11197); for now copy the files and revisit in the future. Submitted by: Siva Mahadevan Discussed with: cem, imp MFC after: 1 month Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D16438 Added: head/usr.sbin/makefs/msdos/Makefile.inc (contents, props changed) head/usr.sbin/makefs/msdos/denode.h - copied, changed from r351251, head/sys/fs/msdosfs/denode.h head/usr.sbin/makefs/msdos/direntry.h - copied, changed from r351251, head/sys/fs/msdosfs/direntry.h head/usr.sbin/makefs/msdos/fat.h - copied, changed from r351251, head/sys/fs/msdosfs/fat.h head/usr.sbin/makefs/msdos/msdosfs_conv.c (contents, props changed) head/usr.sbin/makefs/msdos/msdosfs_fat.c - copied, changed from r351251, head/sys/fs/msdosfs/msdosfs_fat.c head/usr.sbin/makefs/msdos/msdosfs_lookup.c - copied, changed from r351251, head/sys/fs/msdosfs/msdosfs_lookup.c head/usr.sbin/makefs/msdos/msdosfsmount.h - copied, changed from r351251, head/sys/fs/msdosfs/msdosfsmount.h Modified: head/usr.sbin/makefs/Makefile head/usr.sbin/makefs/makefs.8 head/usr.sbin/makefs/makefs.c head/usr.sbin/makefs/makefs.h head/usr.sbin/makefs/msdos.c head/usr.sbin/makefs/msdos.h head/usr.sbin/makefs/msdos/msdosfs_denode.c head/usr.sbin/makefs/msdos/msdosfs_vfsops.c head/usr.sbin/makefs/msdos/msdosfs_vnops.c Modified: head/usr.sbin/makefs/Makefile ============================================================================== --- head/usr.sbin/makefs/Makefile Tue Aug 20 18:02:37 2019 (r351272) +++ head/usr.sbin/makefs/Makefile Tue Aug 20 18:20:45 2019 (r351273) @@ -8,8 +8,10 @@ PROG= makefs CFLAGS+=-I${SRCDIR} -SRCS= cd9660.c ffs.c \ +SRCS= cd9660.c \ + ffs.c \ makefs.c \ + msdos.c \ mtree.c \ walk.c MAN= makefs.8 @@ -18,6 +20,7 @@ WARNS?= 2 .include "${SRCDIR}/cd9660/Makefile.inc" .include "${SRCDIR}/ffs/Makefile.inc" +.include "${SRCDIR}/msdos/Makefile.inc" CFLAGS+=-DHAVE_STRUCT_STAT_ST_FLAGS=1 Modified: head/usr.sbin/makefs/makefs.8 ============================================================================== --- head/usr.sbin/makefs/makefs.8 Tue Aug 20 18:02:37 2019 (r351272) +++ head/usr.sbin/makefs/makefs.8 Tue Aug 20 18:20:45 2019 (r351273) @@ -35,7 +35,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 19, 2019 +.Dd August 20, 2019 .Dt MAKEFS 8 .Os .Sh NAME @@ -198,7 +198,9 @@ and Instead of creating the filesystem at the beginning of the file, start at offset. Valid only for -.Sy ffs . +.Sy ffs +and +.Sy msdos . .It Fl o Ar fs-options Set file system specific options. .Ar fs-options @@ -232,10 +234,14 @@ and the maximum sizes to the same value. For .Sy ffs +and +.Sy msdos the .Ar image-size does not include the .Ar offset . +.Ar offset +is not included in that size. .It Fl T Ar timestamp Specify a timestamp to be set for all filesystem files and directories created so that repeatable builds are possible. @@ -258,6 +264,8 @@ The following file system types are supported: BSD fast file system (default). .It Sy cd9660 ISO 9660 file system. +.It Sy msdos +FAT12, FAT16, or FAT32 file system. .El .It Fl x Exclude file system nodes not explicitly listed in the specfile. @@ -420,6 +428,67 @@ Use RockRidge extensions (for longer filenames, etc.). Turns on verbose output. .It Sy volumeid Volume set identifier of the image. +.El +.Ss msdos-specific options +.Sy msdos +images have MS-DOS-specific optional parameters that may be +provided. +The arguments consist of a keyword, an equal sign +.Pq Ql = , +and a value. +The following keywords are supported (see +.Xr newfs_msdos 8 +for more details): +.Pp +.Bl -tag -width omit-trailing-period -offset indent -compact +.It Cm backup_sector +Location of the backup boot sector. +.It Cm block_size +Block size. +.It Cm bootstrap +Bootstrap file. +.It Cm bytes_per_sector +Bytes per sector. +.It Cm create_size +Create file size. +.It Cm directory_entries +Directory entries. +.It Cm drive_heads +Drive heads. +.It Cm fat_type +FAT type (12, 16, or 32). +.It Cm floppy +Preset drive parameters for standard format floppy disks +(160, 180, 320, 360, 640, 720, 1200, 1232, 1440, or 2880). +.It Cm hidden_sectors +Hidden sectors. +.It Cm info_sector +Location of the info sector. +.It Cm media_descriptor +Media descriptor. +.It Cm num_FAT +Number of FATs. +.It Cm OEM_string +OEM string. +.It Cm offset +Offset in device. +This option will be ignored if +.Fl O +is set to a positive number. +.It Cm reserved_sectors +Reserved sectors. +.It Cm sectors_per_cluster +Sectors per cluster. +.It Cm sectors_per_fat +Sectors per FAT. +.It Cm sectors_per_track +Sectors per track. +.It Cm size +File System size. +.It Cm volume_id +Volume ID. +.It Cm volume_label +Volume Label. .El .Sh SEE ALSO .Xr mtree 5 , Modified: head/usr.sbin/makefs/makefs.c ============================================================================== --- head/usr.sbin/makefs/makefs.c Tue Aug 20 18:02:37 2019 (r351272) +++ head/usr.sbin/makefs/makefs.c Tue Aug 20 18:20:45 2019 (r351273) @@ -74,8 +74,9 @@ static fstype_t fstypes[] = { # name, name ## _prep_opts, name ## _parse_opts, \ name ## _cleanup_opts, name ## _makefs \ } - ENTRY(ffs), ENTRY(cd9660), + ENTRY(ffs), + ENTRY(msdos), { .type = NULL }, }; Modified: head/usr.sbin/makefs/makefs.h ============================================================================== --- head/usr.sbin/makefs/makefs.h Tue Aug 20 18:02:37 2019 (r351272) +++ head/usr.sbin/makefs/makefs.h Tue Aug 20 18:20:45 2019 (r351273) @@ -183,8 +183,9 @@ int fs ## _parse_opts(const char *, fsinfo_t *); \ void fs ## _cleanup_opts(fsinfo_t *); \ void fs ## _makefs(const char *, const char *, fsnode *, fsinfo_t *) -DECLARE_FUN(ffs); DECLARE_FUN(cd9660); +DECLARE_FUN(ffs); +DECLARE_FUN(msdos); extern u_int debug; extern int dupsok; @@ -225,6 +226,7 @@ extern struct stat stampst; #define DEBUG_APPLY_SPECFILE 0x04000000 #define DEBUG_APPLY_SPECENTRY 0x08000000 #define DEBUG_APPLY_SPECONLY 0x10000000 +#define DEBUG_MSDOSFS 0x20000000 #define TIMER_START(x) \ Modified: head/usr.sbin/makefs/msdos.c ============================================================================== --- head/usr.sbin/makefs/msdos.c Tue Aug 20 18:02:37 2019 (r351272) +++ head/usr.sbin/makefs/msdos.c Tue Aug 20 18:20:45 2019 (r351273) @@ -50,24 +50,28 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include -#include -#include -#include -#include #include "makefs.h" #include "msdos.h" -#include "mkfs_msdos.h" +#include +#include + +#include "ffs/buf.h" + +#include "msdos/msdosfsmount.h" +#include "msdos/direntry.h" +#include "msdos/denode.h" + static int msdos_populate_dir(const char *, struct denode *, fsnode *, fsnode *, fsinfo_t *); struct msdos_options_ex { struct msdos_options options; - bool utf8; }; void @@ -85,15 +89,13 @@ msdos_prep_opts(fsinfo_t *fsopts) (sizeof(_type) == 4 ? OPT_INT32 : OPT_INT64)))), \ .value = &msdos_opt->options._name, \ .minimum = _min, \ - .maximum = sizeof(_type) == 1 ? 0xff : \ - (sizeof(_type) == 2 ? 0xffff : \ - (sizeof(_type) == 4 ? 0xffffffff : 0xffffffffffffffffLL)), \ - .desc = _desc, \ + .maximum = sizeof(_type) == 1 ? UINT8_MAX : \ + (sizeof(_type) == 2 ? UINT16_MAX : \ + (sizeof(_type) == 4 ? UINT32_MAX : INT64_MAX)), \ + .desc = _desc, \ }, ALLOPTS #undef AOPT - { 'U', "utf8", &msdos_opt->utf8, OPT_BOOL, - 0, 1, "Use UTF8 names" }, { .name = NULL } }; @@ -113,7 +115,6 @@ msdos_parse_opts(const char *option, fsinfo_t *fsopts) { struct msdos_options *msdos_opt = fsopts->fs_specific; option_t *msdos_options = fsopts->fs_options; - int rv; assert(option != NULL); @@ -148,7 +149,7 @@ msdos_makefs(const char *image, const char *dir, fsnod { struct msdos_options_ex *msdos_opt = fsopts->fs_specific; struct vnode vp, rootvp; - struct timeval start; + struct timeval start; struct msdosfsmount *pmp; uint32_t flags; @@ -160,7 +161,8 @@ msdos_makefs(const char *image, const char *dir, fsnod fsopts->size = fsopts->maxsize; msdos_opt->options.create_size = MAX(msdos_opt->options.create_size, fsopts->offset + fsopts->size); - msdos_opt->options.offset = fsopts->offset; + if (fsopts->offset > 0) + msdos_opt->options.offset = fsopts->offset; if (msdos_opt->options.bytes_per_sector == 0) { if (fsopts->sectorsize == -1) fsopts->sectorsize = 512; @@ -173,7 +175,7 @@ msdos_makefs(const char *image, const char *dir, fsnod fsopts->sectorsize, msdos_opt->options.bytes_per_sector); } - /* create image */ + /* create image */ printf("Creating `%s'\n", image); TIMER_START(start); if (mkfs_msdos(image, NULL, &msdos_opt->options) == -1) @@ -184,10 +186,7 @@ msdos_makefs(const char *image, const char *dir, fsnod vp.fs = fsopts; flags = 0; - if (msdos_opt->utf8) - flags |= MSDOSFSMNT_UTF8; - - if ((pmp = msdosfs_mount(&vp, flags)) == NULL) + if ((pmp = msdosfs_mount(&vp)) == NULL) err(1, "msdosfs_mount"); if (msdosfs_root(pmp, &rootvp) != 0) @@ -197,7 +196,7 @@ msdos_makefs(const char *image, const char *dir, fsnod printf("msdos_makefs: image %s directory %s root %p\n", image, dir, root); - /* populate image */ + /* populate image */ printf("Populating `%s'\n", image); TIMER_START(start); if (msdos_populate_dir(dir, VTODE(&rootvp), root, root, fsopts) == -1) @@ -207,7 +206,7 @@ msdos_makefs(const char *image, const char *dir, fsnod if (debug & DEBUG_FS_MAKEFS) putchar('\n'); - /* ensure no outstanding buffers remain */ + /* ensure no outstanding buffers remain */ if (debug & DEBUG_FS_MAKEFS) bcleanup(); Modified: head/usr.sbin/makefs/msdos.h ============================================================================== --- head/usr.sbin/makefs/msdos.h Tue Aug 20 18:02:37 2019 (r351272) +++ head/usr.sbin/makefs/msdos.h Tue Aug 20 18:20:45 2019 (r351273) @@ -30,11 +30,31 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifndef _MAKEFS_MSDOS_H +#define _MAKEFS_MSDOS_H + +#define NOCRED NULL + +#define MSDOSFS_DPRINTF(args) do { \ + if (debug & DEBUG_MSDOSFS) \ + printf args; \ +} while (0); + + struct vnode; struct denode; +struct fsnode; +struct msdosfsmount; -struct msdosfsmount *msdosfs_mount(struct vnode *, int); +struct componentname { + char *cn_nameptr; + size_t cn_namelen; +}; + +struct msdosfsmount *msdosfs_mount(struct vnode *); int msdosfs_root(struct msdosfsmount *, struct vnode *); struct denode *msdosfs_mkfile(const char *, struct denode *, fsnode *); struct denode *msdosfs_mkdire(const char *, struct denode *, fsnode *); + +#endif Added: head/usr.sbin/makefs/msdos/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/makefs/msdos/Makefile.inc Tue Aug 20 18:20:45 2019 (r351273) @@ -0,0 +1,13 @@ +# $FreeBSD$ +# + +MSDOS= ${SRCTOP}/sys/fs/msdosfs +MSDOS_NEWFS= ${SRCTOP}/sbin/newfs_msdos + +.PATH: ${SRCDIR}/msdos ${MSDOS} ${MSDOS_NEWFS} + +CFLAGS+= -I${MSDOS} -I${MSDOS_NEWFS} + +SRCS+= mkfs_msdos.c +SRCS+= msdosfs_conv.c msdosfs_denode.c msdosfs_fat.c msdosfs_lookup.c +SRCS+= msdosfs_vnops.c msdosfs_vfsops.c Copied and modified: head/usr.sbin/makefs/msdos/denode.h (from r351251, head/sys/fs/msdosfs/denode.h) ============================================================================== --- head/sys/fs/msdosfs/denode.h Tue Aug 20 16:07:17 2019 (r351251, copy source) +++ head/usr.sbin/makefs/msdos/denode.h Tue Aug 20 18:20:45 2019 (r351273) @@ -161,7 +161,6 @@ struct denode { u_long de_StartCluster; /* starting cluster of file */ u_long de_FileSize; /* size of file in bytes */ struct fatcache de_fc[FC_SIZE]; /* FAT cache */ - u_quad_t de_modrev; /* Revision level for lease. */ uint64_t de_inode; /* Inode number (really byte offset of direntry) */ }; @@ -213,60 +212,16 @@ struct denode { ((dep)->de_Attributes & ATTR_DIRECTORY) ? 0 : (dep)->de_FileSize), \ putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16)) -#ifdef _KERNEL - #define VTODE(vp) ((struct denode *)(vp)->v_data) #define DETOV(de) ((de)->de_vnode) -#define DETIMES(dep, acc, mod, cre) do { \ - if ((dep)->de_flag & DE_UPDATE) { \ - (dep)->de_flag |= DE_MODIFIED; \ - timespec2fattime((mod), 0, &(dep)->de_MDate, \ - &(dep)->de_MTime, NULL); \ - (dep)->de_Attributes |= ATTR_ARCHIVE; \ - } \ - if ((dep)->de_pmp->pm_flags & MSDOSFSMNT_NOWIN95) { \ - (dep)->de_flag &= ~(DE_UPDATE | DE_CREATE | DE_ACCESS); \ - break; \ - } \ - if ((dep)->de_flag & DE_ACCESS) { \ - uint16_t adate; \ - \ - timespec2fattime((acc), 0, &adate, NULL, NULL); \ - if (adate != (dep)->de_ADate) { \ - (dep)->de_flag |= DE_MODIFIED; \ - (dep)->de_ADate = adate; \ - } \ - } \ - if ((dep)->de_flag & DE_CREATE) { \ - timespec2fattime((cre), 0, &(dep)->de_CDate, \ - &(dep)->de_CTime, &(dep)->de_CHun); \ - (dep)->de_flag |= DE_MODIFIED; \ - } \ - (dep)->de_flag &= ~(DE_UPDATE | DE_CREATE | DE_ACCESS); \ -} while (0) +struct buf; +struct msdosfsmount; +struct direntry; +struct componentname; +struct denode; /* - * This overlays the fid structure (see mount.h) - */ -struct defid { - u_short defid_len; /* length of structure */ - u_short defid_pad; /* force long alignment */ - - uint32_t defid_dirclust; /* cluster this dir entry came from */ - uint32_t defid_dirofs; /* offset of entry within the cluster */ -#if 0 - uint32_t defid_gen; /* generation number */ -#endif -}; - -extern struct vop_vector msdosfs_vnodeops; - -int msdosfs_lookup(struct vop_cachedlookup_args *); -int msdosfs_inactive(struct vop_inactive_args *); -int msdosfs_reclaim(struct vop_reclaim_args *); - -/* * Internal service routine prototypes. */ int deget(struct msdosfsmount *, u_long, u_long, struct denode **); @@ -274,14 +229,9 @@ int uniqdosname(struct denode *, struct componentname int readep(struct msdosfsmount *pmp, u_long dirclu, u_long dirofs, struct buf **bpp, struct direntry **epp); int readde(struct denode *dep, struct buf **bpp, struct direntry **epp); -int deextend(struct denode *dep, u_long length, struct ucred *cred); +int deextend(struct denode *dep, u_long length); int fillinusemap(struct msdosfsmount *pmp); -void reinsert(struct denode *dep); -int dosdirempty(struct denode *dep); int createde(struct denode *dep, struct denode *ddep, struct denode **depp, struct componentname *cnp); -int deupdat(struct denode *dep, int waitfor); int removede(struct denode *pdep, struct denode *dep); -int detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred); -int doscheckpath( struct denode *source, struct denode *target); -#endif /* _KERNEL */ +int detrunc(struct denode *dep, u_long length, int flags); #endif /* !_FS_MSDOSFS_DENODE_H_ */ Copied and modified: head/usr.sbin/makefs/msdos/direntry.h (from r351251, head/sys/fs/msdosfs/direntry.h) ============================================================================== --- head/sys/fs/msdosfs/direntry.h Tue Aug 20 16:07:17 2019 (r351251, copy source) +++ head/usr.sbin/makefs/msdos/direntry.h Tue Aug 20 18:20:45 2019 (r351273) @@ -135,31 +135,12 @@ struct winentry { #define DD_YEAR_MASK 0xFE00 /* year - 1980 */ #define DD_YEAR_SHIFT 9 -#ifdef _KERNEL -struct mbnambuf { - size_t nb_len; - int nb_last_id; - char nb_buf[WIN_MAXLEN + 1]; -}; - -struct dirent; -struct msdosfsmount; - -char *mbnambuf_flush(struct mbnambuf *nbp, struct dirent *dp); -void mbnambuf_init(struct mbnambuf *nbp); -int mbnambuf_write(struct mbnambuf *nbp, char *name, int id); -int dos2unixfn(u_char dn[11], u_char *un, int lower, - struct msdosfsmount *pmp); -int unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen, - struct msdosfsmount *pmp); -int unix2winfn(const u_char *un, size_t unlen, struct winentry *wep, int cnt, - int chksum, struct msdosfsmount *pmp); -int winChkName(struct mbnambuf *nbp, const u_char *un, size_t unlen, - int chksum, struct msdosfsmount *pmp); -int win2unixfn(struct mbnambuf *nbp, struct winentry *wep, int chksum, - struct msdosfsmount *pmp); uint8_t winChksum(uint8_t *name); -int winSlotCnt(const u_char *un, size_t unlen, struct msdosfsmount *pmp); -size_t winLenFixup(const u_char *un, size_t unlen); -#endif /* _KERNEL */ +int winSlotCnt(const u_char *un, size_t unlen); +int unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen); +int winChkName(const u_char *un, size_t unlen, struct winentry *wep, + int chksum); +int unix2winfn(const u_char *un, size_t unlen, struct winentry *wep, int cnt, + int chksum); + #endif /* !_FS_MSDOSFS_DIRENTRY_H_ */ Copied and modified: head/usr.sbin/makefs/msdos/fat.h (from r351251, head/sys/fs/msdosfs/fat.h) ============================================================================== --- head/sys/fs/msdosfs/fat.h Tue Aug 20 16:07:17 2019 (r351251, copy source) +++ head/usr.sbin/makefs/msdos/fat.h Tue Aug 20 18:20:45 2019 (r351273) @@ -82,7 +82,6 @@ #define MSDOSFSEOF(pmp, cn) ((((cn) | ~(pmp)->pm_fatmask) & CLUST_EOFS) == CLUST_EOFS) -#ifdef _KERNEL /* * These are the values for the function argument to the function * fatentry(). @@ -96,6 +95,10 @@ */ #define DE_CLEAR 1 /* Zero out the blocks allocated */ +struct buf; +struct denode; +struct msdosfsmount; + int pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp, u_long *cnp, int* sp); int clusterfree(struct msdosfsmount *pmp, u_long cn, u_long *oldcnp); int clusteralloc(struct msdosfsmount *pmp, u_long start, u_long count, u_long fillwith, u_long *retcluster, u_long *got); @@ -103,7 +106,5 @@ int fatentry(int function, struct msdosfsmount *pmp, u int freeclusterchain(struct msdosfsmount *pmp, u_long startchain); int extendfile(struct denode *dep, u_long count, struct buf **bpp, u_long *ncp, int flags); void fc_purge(struct denode *dep, u_int frcn); -int markvoldirty(struct msdosfsmount *pmp, int dirty); -#endif /* _KERNEL */ #endif /* !_FS_MSDOSFS_FAT_H_ */ Added: head/usr.sbin/makefs/msdos/msdosfs_conv.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/makefs/msdos/msdosfs_conv.c Tue Aug 20 18:20:45 2019 (r351273) @@ -0,0 +1,508 @@ +/*- + * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. + * Copyright (C) 1994, 1995, 1997 TooLs GmbH. + * All rights reserved. + * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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. + */ +/* + * Written by Paul Popelka (paulp@uts.amdahl.com) + * + * You can do anything you want with this software, just don't say you wrote + * it, and don't remove this notice. + * + * This software is provided "as is". + * + * The author supplies this software to be publicly redistributed on the + * understanding that the author is not responsible for the correct + * functioning of this software in any circumstances and is not liable for + * any damages caused by this software. + * + * October 1992 + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include + +#include + +#include "makefs.h" +#include "msdos.h" + +#include "msdos/denode.h" +#include "msdos/direntry.h" +#include "msdos/fat.h" +#include "msdos/msdosfsmount.h" + +static int char8ucs2str(const uint8_t *in, int n, uint16_t *out, int m); +static void ucs2pad(uint16_t *buf, int len, int size); +static int char8match(uint16_t *w1, uint16_t *w2, int n); + +static const u_char unix2dos[256] = { + 0, 0, 0, 0, 0, 0, 0, 0, /* 00-07 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 08-0f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 10-17 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 18-1f */ + 0, '!', 0, '#', '$', '%', '&', '\'', /* 20-27 */ + '(', ')', 0, '+', 0, '-', 0, 0, /* 28-2f */ + '0', '1', '2', '3', '4', '5', '6', '7', /* 30-37 */ + '8', '9', 0, 0, 0, 0, 0, 0, /* 38-3f */ + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', /* 40-47 */ + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', /* 48-4f */ + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', /* 50-57 */ + 'X', 'Y', 'Z', 0, 0, 0, '^', '_', /* 58-5f */ + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', /* 60-67 */ + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', /* 68-6f */ + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', /* 70-77 */ + 'X', 'Y', 'Z', '{', 0, '}', '~', 0, /* 78-7f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 80-87 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 88-8f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 90-97 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 98-9f */ + 0, 0xad, 0xbd, 0x9c, 0xcf, 0xbe, 0xdd, 0xf5, /* a0-a7 */ + 0xf9, 0xb8, 0xa6, 0xae, 0xaa, 0xf0, 0xa9, 0xee, /* a8-af */ + 0xf8, 0xf1, 0xfd, 0xfc, 0xef, 0xe6, 0xf4, 0xfa, /* b0-b7 */ + 0xf7, 0xfb, 0xa7, 0xaf, 0xac, 0xab, 0xf3, 0xa8, /* b8-bf */ + 0xb7, 0xb5, 0xb6, 0xc7, 0x8e, 0x8f, 0x92, 0x80, /* c0-c7 */ + 0xd4, 0x90, 0xd2, 0xd3, 0xde, 0xd6, 0xd7, 0xd8, /* c8-cf */ + 0xd1, 0xa5, 0xe3, 0xe0, 0xe2, 0xe5, 0x99, 0x9e, /* d0-d7 */ + 0x9d, 0xeb, 0xe9, 0xea, 0x9a, 0xed, 0xe8, 0xe1, /* d8-df */ + 0xb7, 0xb5, 0xb6, 0xc7, 0x8e, 0x8f, 0x92, 0x80, /* e0-e7 */ + 0xd4, 0x90, 0xd2, 0xd3, 0xde, 0xd6, 0xd7, 0xd8, /* e8-ef */ + 0xd1, 0xa5, 0xe3, 0xe0, 0xe2, 0xe5, 0x99, 0xf6, /* f0-f7 */ + 0x9d, 0xeb, 0xe9, 0xea, 0x9a, 0xed, 0xe8, 0x98, /* f8-ff */ +}; + +static const u_char u2l[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 00-07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 08-0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 10-17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 18-1f */ + ' ', '!', '"', '#', '$', '%', '&', '\'', /* 20-27 */ + '(', ')', '*', '+', ',', '-', '.', '/', /* 28-2f */ + '0', '1', '2', '3', '4', '5', '6', '7', /* 30-37 */ + '8', '9', ':', ';', '<', '=', '>', '?', /* 38-3f */ + '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', /* 40-47 */ + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', /* 48-4f */ + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', /* 50-57 */ + 'x', 'y', 'z', '[', '\\', ']', '^', '_', /* 58-5f */ + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', /* 60-67 */ + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', /* 68-6f */ + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', /* 70-77 */ + 'x', 'y', 'z', '{', '|', '}', '~', 0x7f, /* 78-7f */ + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 80-87 */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 88-8f */ + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 90-97 */ + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 98-9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* a0-a7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* a8-af */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* b0-b7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* b8-bf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* c0-c7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* c8-cf */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* d0-d7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* d8-df */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* e0-e7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* e8-ef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* f0-f7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* f8-ff */ +}; + +/* + * Determine the number of slots necessary for Win95 names + */ +int +winSlotCnt(const u_char *un, size_t unlen) +{ + const u_char *cp; + + /* + * Drop trailing blanks and dots + */ + for (cp = un + unlen; unlen > 0; unlen--) + if (*--cp != ' ' && *cp != '.') + break; + + return howmany(unlen, WIN_CHARS); +} + +/* + * Compare our filename to the one in the Win95 entry + * Returns the checksum or -1 if no match + */ +int +winChkName(const u_char *un, size_t unlen, struct winentry *wep, int chksum) +{ + uint16_t wn[WIN_MAXLEN], *p; + uint16_t buf[WIN_CHARS]; + int i, len; + + /* + * First compare checksums + */ + if (wep->weCnt & WIN_LAST) + chksum = wep->weChksum; + else if (chksum != wep->weChksum) + chksum = -1; + if (chksum == -1) + return -1; + + /* + * Offset of this entry + */ + i = ((wep->weCnt & WIN_CNT) - 1) * WIN_CHARS; + + /* + * Translate UNIX name to ucs-2 + */ + len = char8ucs2str(un, unlen, wn, WIN_MAXLEN); + ucs2pad(wn, len, WIN_MAXLEN); + + if (i >= len + 1) + return -1; + if ((wep->weCnt & WIN_LAST) && (len - i > WIN_CHARS)) + return -1; + + /* + * Fetch name segment from directory entry + */ + p = &buf[0]; + memcpy(p, wep->wePart1, sizeof(wep->wePart1)); + p += sizeof(wep->wePart1) / sizeof(*p); + memcpy(p, wep->wePart2, sizeof(wep->wePart2)); + p += sizeof(wep->wePart2) / sizeof(*p); + memcpy(p, wep->wePart3, sizeof(wep->wePart3)); + + /* + * And compare name segment + */ + if (!(char8match(&wn[i], buf, WIN_CHARS))) + return -1; + + return chksum; +} + +/* + * Compute the checksum of a DOS filename for Win95 use + */ +uint8_t +winChksum(uint8_t *name) +{ + int i; + uint8_t s; + + for (s = 0, i = 11; --i >= 0; s += *name++) + s = (s << 7) | (s >> 1); + return s; +} + +/* + * Create a Win95 long name directory entry + * Note: assumes that the filename is valid, + * i.e. doesn't consist solely of blanks and dots + */ +int +unix2winfn(const u_char *un, size_t unlen, struct winentry *wep, int cnt, + int chksum) +{ + uint16_t wn[WIN_MAXLEN], *p; + int i, len; + const u_char *cp; + + /* + * Drop trailing blanks and dots + */ + for (cp = un + unlen; unlen > 0; unlen--) + if (*--cp != ' ' && *cp != '.') + break; + + /* + * Offset of this entry + */ + i = (cnt - 1) * WIN_CHARS; + + /* + * Translate UNIX name to ucs-2 + */ + len = char8ucs2str(un, unlen, wn, WIN_MAXLEN); + ucs2pad(wn, len, WIN_MAXLEN); + + /* + * Initialize winentry to some useful default + */ + memset(wep, 0xff, sizeof(*wep)); + wep->weCnt = cnt; + wep->weAttributes = ATTR_WIN95; + wep->weReserved1 = 0; + wep->weChksum = chksum; + wep->weReserved2 = 0; + + /* + * Store name segment into directory entry + */ + p = &wn[i]; + memcpy(wep->wePart1, p, sizeof(wep->wePart1)); + p += sizeof(wep->wePart1) / sizeof(*p); + memcpy(wep->wePart2, p, sizeof(wep->wePart2)); + p += sizeof(wep->wePart2) / sizeof(*p); + memcpy(wep->wePart3, p, sizeof(wep->wePart3)); + + if (len > i + WIN_CHARS) + return 1; + + wep->weCnt |= WIN_LAST; + return 0; +} + +/* + * Convert a unix filename to a DOS filename according to Win95 rules. + * If applicable and gen is not 0, it is inserted into the converted + * filename as a generation number. + * Returns + * 0 if name couldn't be converted + * 1 if the converted name is the same as the original + * (no long filename entry necessary for Win95) + * 2 if conversion was successful + * 3 if conversion was successful and generation number was inserted + */ +int +unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen) +{ + int i, j, l; + int conv = 1; + const u_char *cp, *dp, *dp1; + u_char gentext[6], *wcp; + int shortlen; + + /* + * Fill the dos filename string with blanks. These are DOS's pad + * characters. + */ + for (i = 0; i < 11; i++) + dn[i] = ' '; + dn[11] = 0; + + /* + * The filenames "." and ".." are handled specially, since they + * don't follow dos filename rules. + */ + if (un[0] == '.' && unlen == 1) { + dn[0] = '.'; + return gen <= 1; + } + if (un[0] == '.' && un[1] == '.' && unlen == 2) { + dn[0] = '.'; + dn[1] = '.'; + return gen <= 1; + } + + /* + * Filenames with only blanks and dots are not allowed! + */ + for (cp = un, i = unlen; --i >= 0; cp++) + if (*cp != ' ' && *cp != '.') + break; + if (i < 0) + return 0; + + /* + * Now find the extension + * Note: dot as first char doesn't start extension + * and trailing dots and blanks are ignored + */ + dp = dp1 = 0; + for (cp = un + 1, i = unlen - 1; --i >= 0;) { + switch (*cp++) { + case '.': + if (!dp1) + dp1 = cp; + break; + case ' ': + break; + default: + if (dp1) + dp = dp1; + dp1 = 0; + break; + } + } + + /* + * Now convert it + */ + if (dp) { + if (dp1) + l = dp1 - dp; + else + l = unlen - (dp - un); + for (i = 0, j = 8; i < l && j < 11; i++, j++) { + if (dp[i] != (dn[j] = unix2dos[dp[i]]) + && conv != 3) + conv = 2; + if (!dn[j]) { + conv = 3; + dn[j--] = ' '; + } + } + if (i < l) + conv = 3; + dp--; + } else { + for (dp = cp; *--dp == ' ' || *dp == '.';); + dp++; + } + + shortlen = (dp - un) <= 8; + + /* + * Now convert the rest of the name + */ + for (i = j = 0; un < dp && j < 8; i++, j++, un++) { + if ((*un == ' ') && shortlen) + dn[j] = ' '; + else + dn[j] = unix2dos[*un]; + if ((*un != dn[j]) + && conv != 3) + conv = 2; + if (!dn[j]) { + conv = 3; + dn[j--] = ' '; + } + } + if (un < dp) + conv = 3; + /* + * If we didn't have any chars in filename, + * generate a default + */ + if (!j) + dn[0] = '_'; + + /* + * The first character cannot be E5, + * because that means a deleted entry + */ + if (dn[0] == 0xe5) + dn[0] = SLOT_E5; + + /* + * If there wasn't any char dropped, + * there is no place for generation numbers + */ + if (conv != 3) { + if (gen > 1) + return 0; + return conv; + } + + /* + * Now insert the generation number into the filename part + */ + for (wcp = gentext + sizeof(gentext); wcp > gentext && gen; gen /= 10) + *--wcp = gen % 10 + '0'; + if (gen) + return 0; + for (i = 8; dn[--i] == ' ';); + i++; + if (gentext + sizeof(gentext) - wcp + 1 > 8 - i) + i = 8 - (gentext + sizeof(gentext) - wcp + 1); + dn[i++] = '~'; + while (wcp < gentext + sizeof(gentext)) + dn[i++] = *wcp++; + return 3; +} + +/* + * Convert 8bit character string into UCS-2 string + * return total number of output chacters + */ +static int +char8ucs2str(const uint8_t *in, int n, uint16_t *out, int m) +{ + uint16_t *p; + + p = out; + while (n > 0 && in[0] != 0) { + if (m < 1) + break; + if (p) + p[0] = htole16(in[0]); + p += 1; + m -= 1; + in += 1; + n -= 1; + } + + return p - out; +} + +static void +ucs2pad(uint16_t *buf, int len, int size) +{ + + if (len < size-1) + buf[len++] = 0x0000; + while (len < size) + buf[len++] = 0xffff; +} + +/* + * Compare two 8bit char conversions case-insensitive + * + * uses the DOS case folding table + */ +static int +char8match(uint16_t *w1, uint16_t *w2, int n) +{ + uint16_t u1, u2; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Aug 20 19:31:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BAF2D9D8A; Tue, 20 Aug 2019 19:31:12 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Cgrc2Vw3z3JSb; Tue, 20 Aug 2019 19:31:12 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D5288004; Tue, 20 Aug 2019 19:31:12 +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 x7KJVCxS026275; Tue, 20 Aug 2019 19:31:12 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7KJVCbd026274; Tue, 20 Aug 2019 19:31:12 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201908201931.x7KJVCbd026274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 20 Aug 2019 19:31:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351274 - head/stand/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/libefi X-SVN-Commit-Revision: 351274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 19:31:12 -0000 Author: tsoome Date: Tue Aug 20 19:31:11 2019 New Revision: 351274 URL: https://svnweb.freebsd.org/changeset/base/351274 Log: loader.efi: efipart should be more careful about constructing block device lists The cd handles should be collected as list of partitions. Some systems also provide base name for block device (like PciRoot(0x0)/Pci(0x5,0x0)), we need to be careful about those. To make out life a bit easier, we prepare not just an array of handles, but we allocate pdinfo struct for each handle and devicepath, then we can simplify our work to sort the devices. Differential Revision: https://reviews.freebsd.org/D21187 Modified: head/stand/efi/libefi/efipart.c Modified: head/stand/efi/libefi/efipart.c ============================================================================== --- head/stand/efi/libefi/efipart.c Tue Aug 20 18:20:45 2019 (r351273) +++ head/stand/efi/libefi/efipart.c Tue Aug 20 19:31:11 2019 (r351274) @@ -100,12 +100,18 @@ struct devsw efipart_hddev = { .dv_cleanup = NULL }; -static pdinfo_list_t fdinfo; -static pdinfo_list_t cdinfo; -static pdinfo_list_t hdinfo; +static pdinfo_list_t fdinfo = STAILQ_HEAD_INITIALIZER(fdinfo); +static pdinfo_list_t cdinfo = STAILQ_HEAD_INITIALIZER(cdinfo); +static pdinfo_list_t hdinfo = STAILQ_HEAD_INITIALIZER(hdinfo); -static EFI_HANDLE *efipart_handles = NULL; -static UINTN efipart_nhandles = 0; +/* + * efipart_inithandles() is used to build up the pdinfo list from + * block device handles. Then each devsw init callback is used to + * pick items from pdinfo and move to proper device list. + * In ideal world, we should end up with empty pdinfo once all + * devsw initializers are called. + */ +static pdinfo_list_t pdinfo = STAILQ_HEAD_INITIALIZER(pdinfo); pdinfo_list_t * efiblk_get_pdinfo_list(struct devsw *dev) @@ -141,9 +147,11 @@ pdinfo_t * efiblk_get_pdinfo_by_device_path(EFI_DEVICE_PATH *path) { EFI_HANDLE h; + EFI_STATUS status; + EFI_DEVICE_PATH *devp = path; - h = efi_devpath_to_handle(path, efipart_handles, efipart_nhandles); - if (h == NULL) + status = BS->LocateDevicePath(&blkio_guid, &devp, &h); + if (EFI_ERROR(status)) return (NULL); return (efiblk_get_pdinfo_by_handle(h)); } @@ -174,6 +182,10 @@ efiblk_get_pdinfo_by_handle(EFI_HANDLE h) STAILQ_FOREACH(dp, &cdinfo, pd_link) { if (same_handle(dp, h)) return (dp); + STAILQ_FOREACH(pp, &dp->pd_part, pd_link) { + if (same_handle(pp, h)) + return (pp); + } } STAILQ_FOREACH(dp, &fdinfo, pd_link) { if (same_handle(dp, h)) @@ -197,15 +209,16 @@ efiblk_pdinfo_count(pdinfo_list_t *pdi) int efipart_inithandles(void) { + unsigned i, nin; UINTN sz; EFI_HANDLE *hin; + EFI_DEVICE_PATH *devpath; + EFI_BLOCK_IO *blkio; EFI_STATUS status; + pdinfo_t *pd; - if (efipart_nhandles != 0) { - free(efipart_handles); - efipart_handles = NULL; - efipart_nhandles = 0; - } + if (!STAILQ_EMPTY(&pdinfo)) + return (0); sz = 0; hin = NULL; @@ -220,12 +233,51 @@ efipart_inithandles(void) if (EFI_ERROR(status)) return (efi_status_to_errno(status)); - efipart_handles = hin; - efipart_nhandles = sz / sizeof(*hin); + nin = sz / sizeof(*hin); #ifdef EFIPART_DEBUG - printf("%s: Got %d BLOCK IO MEDIA handle(s)\n", __func__, - efipart_nhandles); + printf("%s: Got %d BLOCK IO MEDIA handle(s)\n", __func__, nin); #endif + + for (i = 0; i < nin; i++) { + /* + * Get devpath and open protocol. + * We should not get errors here + */ + if ((devpath = efi_lookup_devpath(hin[i])) == NULL) + continue; + + status = OpenProtocolByHandle(hin[i], &blkio_guid, + (void **)&blkio); + if (EFI_ERROR(status)) { + printf("error %lu\n", EFI_ERROR_CODE(status)); + continue; + } + + /* + * We assume the block size 512 or greater power of 2. + * iPXE is known to insert stub BLOCK IO device with + * BlockSize 1. + */ + if (blkio->Media->BlockSize < 512 || + !powerof2(blkio->Media->BlockSize)) { + continue; + } + + /* This is bad. */ + if ((pd = calloc(1, sizeof(*pd))) == NULL) { + printf("efipart_inithandles: Out of memory.\n"); + free(hin); + return (ENOMEM); + } + STAILQ_INIT(&pd->pd_part); + + pd->pd_handle = hin[i]; + pd->pd_devpath = devpath; + pd->pd_blkio = blkio; + STAILQ_INSERT_TAIL(&pdinfo, pd, pd_link); + } + + free(hin); return (0); } @@ -246,134 +298,49 @@ efipart_floppy(EFI_DEVICE_PATH *node) return (NULL); } -/* - * Determine if the provided device path is hdd. - * - * There really is no simple fool proof way to classify the devices. - * Since we do build three lists of devices - floppy, cd and hdd, we - * will try to see if the device is floppy or cd, and list anything else - * as hdd. - */ -static bool -efipart_hdd(EFI_DEVICE_PATH *dp) +static pdinfo_t * +efipart_find_parent(pdinfo_list_t *pdi, EFI_DEVICE_PATH *devpath) { - unsigned i; - EFI_DEVICE_PATH *devpath, *node; - EFI_BLOCK_IO *blkio; - EFI_STATUS status; + pdinfo_t *pd; - if (dp == NULL) - return (false); - - if ((node = efi_devpath_last_node(dp)) == NULL) - return (false); - - if (efipart_floppy(node) != NULL) - return (false); - - /* - * Test every EFI BLOCK IO handle to make sure dp is not device path - * for CD/DVD. - */ - for (i = 0; i < efipart_nhandles; i++) { - devpath = efi_lookup_devpath(efipart_handles[i]); - if (devpath == NULL) - return (false); - - /* Only continue testing when dp is prefix in devpath. */ - if (!efi_devpath_is_prefix(dp, devpath)) - continue; - - /* - * The device path has to have last node describing the - * device, or we can not test the type. - */ - if ((node = efi_devpath_last_node(devpath)) == NULL) - return (false); - - if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_CDROM_DP) { - return (false); - } - - /* Make sure we do have the media. */ - status = OpenProtocolByHandle(efipart_handles[i], &blkio_guid, - (void **)&blkio); - if (EFI_ERROR(status)) - return (false); - - /* USB or SATA cd without the media. */ - if (blkio->Media->RemovableMedia && - !blkio->Media->MediaPresent) { - return (false); - } - - /* - * We assume the block size 512 or greater power of 2. - * iPXE is known to insert stub BLOCK IO device with - * BlockSize 1. - */ - if (blkio->Media->BlockSize < 512 || - !powerof2(blkio->Media->BlockSize)) { - return (false); - } + STAILQ_FOREACH(pd, pdi, pd_link) { + if (efi_devpath_is_prefix(pd->pd_devpath, devpath)) + return (pd); } - return (true); + return (NULL); } -/* - * Add or update entries with new handle data. - */ static int -efipart_fdinfo_add(EFI_HANDLE handle, uint32_t uid, EFI_DEVICE_PATH *devpath) +efipart_initfd(void) { - pdinfo_t *fd; - - fd = calloc(1, sizeof(pdinfo_t)); - if (fd == NULL) { - printf("Failed to register floppy %d, out of memory\n", uid); - return (ENOMEM); - } - STAILQ_INIT(&fd->pd_part); - - fd->pd_unit = uid; - fd->pd_handle = handle; - fd->pd_devpath = devpath; - fd->pd_parent = NULL; - fd->pd_devsw = &efipart_fddev; - STAILQ_INSERT_TAIL(&fdinfo, fd, pd_link); - return (0); -} - -static void -efipart_updatefd(void) -{ - EFI_DEVICE_PATH *devpath, *node; + EFI_DEVICE_PATH *node; ACPI_HID_DEVICE_PATH *acpi; - int i; + pdinfo_t *parent, *fd; - for (i = 0; i < efipart_nhandles; i++) { - devpath = efi_lookup_devpath(efipart_handles[i]); - if (devpath == NULL) +restart: + STAILQ_FOREACH(fd, &pdinfo, pd_link) { + if ((node = efi_devpath_last_node(fd->pd_devpath)) == NULL) continue; - if ((node = efi_devpath_last_node(devpath)) == NULL) + if ((acpi = efipart_floppy(node)) == NULL) continue; - if ((acpi = efipart_floppy(node)) != NULL) { - efipart_fdinfo_add(efipart_handles[i], acpi->UID, - devpath); + + STAILQ_REMOVE(&pdinfo, fd, pdinfo, pd_link); + parent = efipart_find_parent(&pdinfo, fd->pd_devpath); + if (parent != NULL) { + STAILQ_REMOVE(&pdinfo, parent, pdinfo, pd_link); + parent->pd_alias = fd->pd_handle; + parent->pd_unit = acpi->UID; + free(fd); + fd = parent; + } else { + fd->pd_unit = acpi->UID; } + fd->pd_devsw = &efipart_fddev; + STAILQ_INSERT_TAIL(&fdinfo, fd, pd_link); + goto restart; } -} -static int -efipart_initfd(void) -{ - - STAILQ_INIT(&fdinfo); - - efipart_updatefd(); - bcache_add_dev(efiblk_pdinfo_count(&fdinfo)); return (0); } @@ -381,68 +348,90 @@ efipart_initfd(void) /* * Add or update entries with new handle data. */ -static int -efipart_cdinfo_add(EFI_HANDLE handle, EFI_HANDLE alias, - EFI_DEVICE_PATH *devpath) +static void +efipart_cdinfo_add(pdinfo_t *cd) { - int unit; - pdinfo_t *cd; - pdinfo_t *pd; + pdinfo_t *pd, *last; - unit = 0; STAILQ_FOREACH(pd, &cdinfo, pd_link) { - if (efi_devpath_match(pd->pd_devpath, devpath) == true) { - pd->pd_handle = handle; - pd->pd_alias = alias; - return (0); + if (efi_devpath_is_prefix(pd->pd_devpath, cd->pd_devpath)) { + last = STAILQ_LAST(&pd->pd_part, pdinfo, pd_link); + if (last != NULL) + cd->pd_unit = last->pd_unit + 1; + else + cd->pd_unit = 0; + cd->pd_parent = pd; + cd->pd_devsw = &efipart_cddev; + STAILQ_INSERT_TAIL(&pd->pd_part, cd, pd_link); + return; } - unit++; } - cd = calloc(1, sizeof(pdinfo_t)); - if (cd == NULL) { - printf("Failed to add cd %d, out of memory\n", unit); - return (ENOMEM); - } - STAILQ_INIT(&cd->pd_part); + last = STAILQ_LAST(&cdinfo, pdinfo, pd_link); + if (last != NULL) + cd->pd_unit = last->pd_unit + 1; + else + cd->pd_unit = 0; - cd->pd_handle = handle; - cd->pd_unit = unit; - cd->pd_alias = alias; - cd->pd_devpath = devpath; cd->pd_parent = NULL; cd->pd_devsw = &efipart_cddev; STAILQ_INSERT_TAIL(&cdinfo, cd, pd_link); - return (0); } +static bool +efipart_testcd(EFI_DEVICE_PATH *node, EFI_BLOCK_IO *blkio) +{ + if (DevicePathType(node) == MEDIA_DEVICE_PATH && + DevicePathSubType(node) == MEDIA_CDROM_DP) { + return (true); + } + + /* cd drive without the media. */ + if (blkio->Media->RemovableMedia && + !blkio->Media->MediaPresent) { + return (true); + } + + return (false); +} + static void efipart_updatecd(void) { - int i; - EFI_DEVICE_PATH *devpath, *devpathcpy, *tmpdevpath, *node; - EFI_HANDLE handle; - EFI_BLOCK_IO *blkio; + EFI_DEVICE_PATH *devpath, *node; EFI_STATUS status; + pdinfo_t *parent, *cd; - for (i = 0; i < efipart_nhandles; i++) { - devpath = efi_lookup_devpath(efipart_handles[i]); - if (devpath == NULL) +restart: + STAILQ_FOREACH(cd, &pdinfo, pd_link) { + if ((node = efi_devpath_last_node(cd->pd_devpath)) == NULL) continue; - if ((node = efi_devpath_last_node(devpath)) == NULL) - continue; - if (efipart_floppy(node) != NULL) continue; - if (efipart_hdd(devpath)) - continue; + /* Is parent of this device already registered? */ + parent = efipart_find_parent(&cdinfo, cd->pd_devpath); + if (parent != NULL) { + STAILQ_REMOVE(&pdinfo, cd, pdinfo, pd_link); + efipart_cdinfo_add(cd); + goto restart; + } - status = OpenProtocolByHandle(efipart_handles[i], &blkio_guid, - (void **)&blkio); - if (EFI_ERROR(status)) + if (!efipart_testcd(node, cd->pd_blkio)) continue; + + /* Find parent and unlink both parent and cd from pdinfo */ + STAILQ_REMOVE(&pdinfo, cd, pdinfo, pd_link); + parent = efipart_find_parent(&pdinfo, cd->pd_devpath); + if (parent != NULL) { + STAILQ_REMOVE(&pdinfo, parent, pdinfo, pd_link); + efipart_cdinfo_add(parent); + } + + if (parent == NULL) + parent = efipart_find_parent(&cdinfo, cd->pd_devpath); + /* * If we come across a logical partition of subtype CDROM * it doesn't refer to the CD filesystem itself, but rather @@ -451,132 +440,79 @@ efipart_updatecd(void) * that will be the CD filesystem. */ if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_CDROM_DP) { - devpathcpy = efi_devpath_trim(devpath); - if (devpathcpy == NULL) - continue; - tmpdevpath = devpathcpy; - status = BS->LocateDevicePath(&blkio_guid, &tmpdevpath, - &handle); - free(devpathcpy); - if (EFI_ERROR(status)) - continue; - devpath = efi_lookup_devpath(handle); - efipart_cdinfo_add(handle, efipart_handles[i], - devpath); - continue; - } + DevicePathSubType(node) == MEDIA_CDROM_DP && + parent == NULL) { + parent = calloc(1, sizeof(*parent)); + if (parent == NULL) { + printf("efipart_updatecd: out of memory\n"); + /* this device is lost but try again. */ + free(cd); + goto restart; + } - if (DevicePathType(node) == MESSAGING_DEVICE_PATH && - DevicePathSubType(node) == MSG_ATAPI_DP) { - efipart_cdinfo_add(efipart_handles[i], NULL, - devpath); - continue; + devpath = efi_devpath_trim(cd->pd_devpath); + if (devpath == NULL) { + printf("efipart_updatecd: out of memory\n"); + /* this device is lost but try again. */ + free(parent); + free(cd); + goto restart; + } + parent->pd_devpath = devpath; + status = BS->LocateDevicePath(&blkio_guid, + &parent->pd_devpath, &parent->pd_handle); + free(devpath); + if (EFI_ERROR(status)) { + printf("efipart_updatecd: error %lu\n", + EFI_ERROR_CODE(status)); + free(parent); + free(cd); + goto restart; + } + parent->pd_devpath = + efi_lookup_devpath(parent->pd_handle); + efipart_cdinfo_add(parent); } - /* USB or SATA cd without the media. */ - if (blkio->Media->RemovableMedia && - !blkio->Media->MediaPresent) { - efipart_cdinfo_add(efipart_handles[i], NULL, - devpath); - } + efipart_cdinfo_add(cd); + goto restart; } } static int efipart_initcd(void) { - - STAILQ_INIT(&cdinfo); - efipart_updatecd(); bcache_add_dev(efiblk_pdinfo_count(&cdinfo)); return (0); } -static int -efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE part_handle) +static void +efipart_hdinfo_add(pdinfo_t *hd, HARDDRIVE_DEVICE_PATH *node) { - EFI_DEVICE_PATH *disk_devpath, *part_devpath; - HARDDRIVE_DEVICE_PATH *node; - int unit; - pdinfo_t *hd, *pd, *last; + pdinfo_t *pd, *last; - disk_devpath = efi_lookup_devpath(disk_handle); - if (disk_devpath == NULL) - return (ENOENT); - - if (part_handle != NULL) { - part_devpath = efi_lookup_devpath(part_handle); - if (part_devpath == NULL) - return (ENOENT); - node = (HARDDRIVE_DEVICE_PATH *) - efi_devpath_last_node(part_devpath); - if (node == NULL) - return (ENOENT); /* This should not happen. */ - } else { - part_devpath = NULL; - node = NULL; - } - - pd = calloc(1, sizeof(pdinfo_t)); - if (pd == NULL) { - printf("Failed to add disk, out of memory\n"); - return (ENOMEM); - } - STAILQ_INIT(&pd->pd_part); - - STAILQ_FOREACH(hd, &hdinfo, pd_link) { - if (efi_devpath_match(hd->pd_devpath, disk_devpath) == true) { - if (part_devpath == NULL) - return (0); - + STAILQ_FOREACH(pd, &hdinfo, pd_link) { + if (efi_devpath_is_prefix(pd->pd_devpath, hd->pd_devpath)) { /* Add the partition. */ - pd->pd_handle = part_handle; - pd->pd_unit = node->PartitionNumber; - pd->pd_devpath = part_devpath; - pd->pd_parent = hd; - pd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&hd->pd_part, pd, pd_link); - return (0); + hd->pd_unit = node->PartitionNumber; + hd->pd_parent = pd; + hd->pd_devsw = &efipart_hddev; + STAILQ_INSERT_TAIL(&pd->pd_part, hd, pd_link); + return; } } last = STAILQ_LAST(&hdinfo, pdinfo, pd_link); if (last != NULL) - unit = last->pd_unit + 1; + hd->pd_unit = last->pd_unit + 1; else - unit = 0; + hd->pd_unit = 0; /* Add the disk. */ - hd = pd; - hd->pd_handle = disk_handle; - hd->pd_unit = unit; - hd->pd_devpath = disk_devpath; - hd->pd_parent = NULL; hd->pd_devsw = &efipart_hddev; STAILQ_INSERT_TAIL(&hdinfo, hd, pd_link); - - if (part_devpath == NULL) - return (0); - - pd = calloc(1, sizeof(pdinfo_t)); - if (pd == NULL) { - printf("Failed to add partition, out of memory\n"); - return (ENOMEM); - } - STAILQ_INIT(&pd->pd_part); - - /* Add the partition. */ - pd->pd_handle = part_handle; - pd->pd_unit = node->PartitionNumber; - pd->pd_devpath = part_devpath; - pd->pd_parent = hd; - pd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&hd->pd_part, pd, pd_link); - - return (0); } /* @@ -585,40 +521,25 @@ efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE * of typeN:M, where type is interface type, N is disk id * and M is partition id. */ -static int -efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle) +static void +efipart_hdinfo_add_filepath(pdinfo_t *hd, FILEPATH_DEVICE_PATH *node) { - EFI_DEVICE_PATH *devpath; - FILEPATH_DEVICE_PATH *node; char *pathname, *p; - int unit, len; - pdinfo_t *pd, *last; + int len; + pdinfo_t *last; - /* First collect and verify all the data */ - if ((devpath = efi_lookup_devpath(disk_handle)) == NULL) - return (ENOENT); - node = (FILEPATH_DEVICE_PATH *)efi_devpath_last_node(devpath); - if (node == NULL) - return (ENOENT); /* This should not happen. */ - - pd = calloc(1, sizeof(pdinfo_t)); - if (pd == NULL) { - printf("Failed to add disk, out of memory\n"); - return (ENOMEM); - } - STAILQ_INIT(&pd->pd_part); last = STAILQ_LAST(&hdinfo, pdinfo, pd_link); if (last != NULL) - unit = last->pd_unit + 1; + hd->pd_unit = last->pd_unit + 1; else - unit = 0; + hd->pd_unit = 0; /* FILEPATH_DEVICE_PATH has 0 terminated string */ len = ucs2len(node->PathName); if ((pathname = malloc(len + 1)) == NULL) { printf("Failed to add disk, out of memory\n"); - free(pd); - return (ENOMEM); + free(hd); + return; } cpy16to8(node->PathName, pathname, len + 1); p = strchr(pathname, ':'); @@ -629,23 +550,19 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle) * false, this code would need update. */ if (p == NULL) { /* no colon, add the disk */ - pd->pd_handle = disk_handle; - pd->pd_unit = unit; - pd->pd_devpath = devpath; - pd->pd_parent = NULL; - pd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&hdinfo, pd, pd_link); + hd->pd_devsw = &efipart_hddev; + STAILQ_INSERT_TAIL(&hdinfo, hd, pd_link); free(pathname); - return (0); + return; } p++; /* skip the colon */ errno = 0; - unit = (int)strtol(p, NULL, 0); + hd->pd_unit = (int)strtol(p, NULL, 0); if (errno != 0) { printf("Bad unit number for partition \"%s\"\n", pathname); free(pathname); - free(pd); - return (EUNIT); + free(hd); + return; } /* @@ -657,80 +574,98 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle) if (last == NULL) { printf("BUG: No disk for partition \"%s\"\n", pathname); free(pathname); - free(pd); - return (EINVAL); + free(hd); + return; } /* Add the partition. */ - pd->pd_handle = disk_handle; - pd->pd_unit = unit; - pd->pd_devpath = devpath; - pd->pd_parent = last; - pd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&last->pd_part, pd, pd_link); + hd->pd_parent = last; + hd->pd_devsw = &efipart_hddev; + STAILQ_INSERT_TAIL(&last->pd_part, hd, pd_link); free(pathname); - return (0); } static void efipart_updatehd(void) { - int i; - EFI_DEVICE_PATH *devpath, *devpathcpy, *tmpdevpath, *node; - EFI_HANDLE handle; - EFI_BLOCK_IO *blkio; + EFI_DEVICE_PATH *devpath, *node; EFI_STATUS status; + pdinfo_t *parent, *hd; - for (i = 0; i < efipart_nhandles; i++) { - devpath = efi_lookup_devpath(efipart_handles[i]); - if (devpath == NULL) +restart: + STAILQ_FOREACH(hd, &pdinfo, pd_link) { + if ((node = efi_devpath_last_node(hd->pd_devpath)) == NULL) continue; - if ((node = efi_devpath_last_node(devpath)) == NULL) + if (efipart_floppy(node) != NULL) continue; - if (!efipart_hdd(devpath)) + if (efipart_testcd(node, hd->pd_blkio)) continue; - status = OpenProtocolByHandle(efipart_handles[i], &blkio_guid, - (void **)&blkio); - if (EFI_ERROR(status)) - continue; + if (DevicePathType(node) == HARDWARE_DEVICE_PATH && + DevicePathSubType(node) == HW_PCI_DP) { + STAILQ_REMOVE(&pdinfo, hd, pdinfo, pd_link); + efipart_hdinfo_add(hd, NULL); + goto restart; + } if (DevicePathType(node) == MEDIA_DEVICE_PATH && DevicePathSubType(node) == MEDIA_FILEPATH_DP) { - efipart_hdinfo_add_filepath(efipart_handles[i]); - continue; + STAILQ_REMOVE(&pdinfo, hd, pdinfo, pd_link); + efipart_hdinfo_add_filepath(hd, + (FILEPATH_DEVICE_PATH *)node); + goto restart; } + STAILQ_REMOVE(&pdinfo, hd, pdinfo, pd_link); + parent = efipart_find_parent(&pdinfo, hd->pd_devpath); + if (parent != NULL) { + STAILQ_REMOVE(&pdinfo, parent, pdinfo, pd_link); + efipart_hdinfo_add(parent, NULL); + } else { + parent = efipart_find_parent(&hdinfo, hd->pd_devpath); + } + if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_HARDDRIVE_DP) { - devpathcpy = efi_devpath_trim(devpath); - if (devpathcpy == NULL) - continue; - tmpdevpath = devpathcpy; - status = BS->LocateDevicePath(&blkio_guid, &tmpdevpath, - &handle); - free(devpathcpy); - if (EFI_ERROR(status)) - continue; - /* - * We do not support nested partitions. - */ - devpathcpy = efi_lookup_devpath(handle); - if (devpathcpy == NULL) - continue; - if ((node = efi_devpath_last_node(devpathcpy)) == NULL) - continue; + DevicePathSubType(node) == MEDIA_HARDDRIVE_DP && + parent == NULL) { + parent = calloc(1, sizeof(*parent)); + if (parent == NULL) { + printf("efipart_updatehd: out of memory\n"); + /* this device is lost but try again. */ + free(hd); + goto restart; + } - if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_HARDDRIVE_DP) - continue; + devpath = efi_devpath_trim(hd->pd_devpath); + if (devpath == NULL) { + printf("efipart_updatehd: out of memory\n"); + /* this device is lost but try again. */ + free(parent); + free(hd); + goto restart; + } - efipart_hdinfo_add(handle, efipart_handles[i]); - continue; + parent->pd_devpath = devpath; + status = BS->LocateDevicePath(&blkio_guid, + &parent->pd_devpath, &parent->pd_handle); + free(devpath); + if (EFI_ERROR(status)) { + printf("efipart_updatehd: error %lu\n", + EFI_ERROR_CODE(status)); + free(parent); + free(hd); + goto restart; + } + + parent->pd_devpath = + efi_lookup_devpath(&parent->pd_handle); + + efipart_hdinfo_add(parent, NULL); } - efipart_hdinfo_add(efipart_handles[i], NULL); + efipart_hdinfo_add(hd, (HARDDRIVE_DEVICE_PATH *)node); + goto restart; } } @@ -738,8 +673,6 @@ static int efipart_inithd(void) { - STAILQ_INIT(&hdinfo); - efipart_updatehd(); bcache_add_dev(efiblk_pdinfo_count(&hdinfo)); @@ -852,7 +785,7 @@ efipart_open(struct open_file *f, ...) EFI_STATUS status; va_start(args, f); - dev = va_arg(args, struct disk_devdesc*); + dev = va_arg(args, struct disk_devdesc *); va_end(args); if (dev == NULL) return (EINVAL); @@ -1044,7 +977,7 @@ efipart_realstrategy(void *devdata, int rw, daddr_t bl char *blkbuf; size_t blkoff, blksz; int error; - size_t diskend, readstart; + uint64_t diskend, readstart; if (dev == NULL || blk < 0) return (EINVAL); @@ -1101,7 +1034,7 @@ efipart_realstrategy(void *devdata, int rw, daddr_t bl size / blkio->Media->BlockSize, buf)); /* - * The block size of the media is not a multiple of I/O. + * The buffer size is not a multiple of the media block size. */ blkbuf = malloc(blkio->Media->BlockSize); if (blkbuf == NULL) From owner-svn-src-head@freebsd.org Tue Aug 20 20:04:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 355B4DA664; Tue, 20 Aug 2019 20:04:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ChZn0T7pz3LHs; Tue, 20 Aug 2019 20:04:17 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E60C88763; Tue, 20 Aug 2019 20:04:16 +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 x7KK4GM7049513; Tue, 20 Aug 2019 20:04:16 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7KK4Ghw049512; Tue, 20 Aug 2019 20:04:16 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908202004.x7KK4Ghw049512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Aug 2019 20:04:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351275 - head/usr.sbin/makefs/msdos X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/makefs/msdos X-SVN-Commit-Revision: 351275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 20:04:17 -0000 Author: emaste Date: Tue Aug 20 20:04:16 2019 New Revision: 351275 URL: https://svnweb.freebsd.org/changeset/base/351275 Log: makefs: avoid "dereferencing 'void *' pointer" warnings On GCC 4.2.1 archs MFC with: r351273 Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/makefs/msdos/msdosfs_fat.c Modified: head/usr.sbin/makefs/msdos/msdosfs_fat.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_fat.c Tue Aug 20 19:31:11 2019 (r351274) +++ head/usr.sbin/makefs/msdos/msdosfs_fat.c Tue Aug 20 20:04:16 2019 (r351275) @@ -220,9 +220,9 @@ pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp return (EIO); } if (FAT32(pmp)) - cn = getulong(&bp->b_data[bo]); + cn = getulong((char *)bp->b_data + bo); else - cn = getushort(&bp->b_data[bo]); + cn = getushort((char *)bp->b_data + bo); if (FAT12(pmp) && (prevcn & 1)) cn >>= 4; cn &= pmp->pm_fatmask; @@ -502,9 +502,9 @@ fatentry(int function, struct msdosfsmount *pmp, u_lon if (function & FAT_GET) { if (FAT32(pmp)) - readcn = getulong(&bp->b_data[bo]); + readcn = getulong((char *)bp->b_data + bo); else - readcn = getushort(&bp->b_data[bo]); + readcn = getushort((char *)bp->b_data + bo); if (FAT12(pmp) & (cn & 1)) readcn >>= 4; readcn &= pmp->pm_fatmask; @@ -516,7 +516,7 @@ fatentry(int function, struct msdosfsmount *pmp, u_lon if (function & FAT_SET) { switch (pmp->pm_fatmask) { case FAT12_MASK: - readcn = getushort(&bp->b_data[bo]); + readcn = getushort((char *)bp->b_data + bo); if (cn & 1) { readcn &= 0x000f; readcn |= newcontents << 4; @@ -524,20 +524,20 @@ fatentry(int function, struct msdosfsmount *pmp, u_lon readcn &= 0xf000; readcn |= newcontents & 0xfff; } - putushort(&bp->b_data[bo], readcn); + putushort((char *)bp->b_data + bo, readcn); break; case FAT16_MASK: - putushort(&bp->b_data[bo], newcontents); + putushort((char *)bp->b_data + bo, newcontents); break; case FAT32_MASK: /* * According to spec we have to retain the * high order bits of the FAT entry. */ - readcn = getulong(&bp->b_data[bo]); + readcn = getulong((char *)bp->b_data + bo); readcn &= ~FAT32_MASK; readcn |= newcontents & FAT32_MASK; - putulong(&bp->b_data[bo], readcn); + putulong((char *)bp->b_data + bo, readcn); break; } updatefats(pmp, bp, bn); @@ -587,7 +587,7 @@ fatchain(struct msdosfsmount *pmp, u_long start, u_lon newc = --count > 0 ? start : fillwith; switch (pmp->pm_fatmask) { case FAT12_MASK: - readcn = getushort(&bp->b_data[bo]); + readcn = getushort((char *)bp->b_data + bo); if (start & 1) { readcn &= 0xf000; readcn |= newc & 0xfff; @@ -595,20 +595,20 @@ fatchain(struct msdosfsmount *pmp, u_long start, u_lon readcn &= 0x000f; readcn |= newc << 4; } - putushort(&bp->b_data[bo], readcn); + putushort((char *)bp->b_data + bo, readcn); bo++; if (!(start & 1)) bo++; break; case FAT16_MASK: - putushort(&bp->b_data[bo], newc); + putushort((char *)bp->b_data + bo, newc); bo += 2; break; case FAT32_MASK: - readcn = getulong(&bp->b_data[bo]); + readcn = getulong((char *)bp->b_data + bo); readcn &= ~pmp->pm_fatmask; readcn |= newc & pmp->pm_fatmask; - putulong(&bp->b_data[bo], readcn); + putulong((char *)bp->b_data + bo, readcn); bo += 4; break; } @@ -833,7 +833,7 @@ freeclusterchain(struct msdosfsmount *pmp, u_long clus usemap_free(pmp, cluster); switch (pmp->pm_fatmask) { case FAT12_MASK: - readcn = getushort(&bp->b_data[bo]); + readcn = getushort((char *)bp->b_data + bo); if (cluster & 1) { cluster = readcn >> 4; readcn &= 0x000f; @@ -843,15 +843,15 @@ freeclusterchain(struct msdosfsmount *pmp, u_long clus readcn &= 0xf000; readcn |= MSDOSFSFREE & 0xfff; } - putushort(&bp->b_data[bo], readcn); + putushort((char *)bp->b_data + bo, readcn); break; case FAT16_MASK: - cluster = getushort(&bp->b_data[bo]); - putushort(&bp->b_data[bo], MSDOSFSFREE); + cluster = getushort((char *)bp->b_data + bo); + putushort((char *)bp->b_data + bo, MSDOSFSFREE); break; case FAT32_MASK: - cluster = getulong(&bp->b_data[bo]); - putulong(&bp->b_data[bo], + cluster = getulong((char *)bp->b_data + bo); + putulong((char *)bp->b_data + bo, (MSDOSFSFREE & FAT32_MASK) | (cluster & ~FAT32_MASK)); break; } @@ -903,9 +903,9 @@ fillinusemap(struct msdosfsmount *pmp) } } if (FAT32(pmp)) - readcn = getulong(&bp->b_data[bo]); + readcn = getulong((char *)bp->b_data + bo); else - readcn = getushort(&bp->b_data[bo]); + readcn = getushort((char *)bp->b_data + bo); if (FAT12(pmp) && (cn & 1)) readcn >>= 4; readcn &= pmp->pm_fatmask; From owner-svn-src-head@freebsd.org Tue Aug 20 21:02:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7FBA5E0B8E for ; Tue, 20 Aug 2019 21:02:39 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic310-24.consmr.mail.ne1.yahoo.com (sonic310-24.consmr.mail.ne1.yahoo.com [66.163.186.205]) (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 46Cjt620H8z43rt for ; Tue, 20 Aug 2019 21:02:37 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: l588vsUVM1mWGKWdnS62v8ire5HDnoH8Gb1AiRpbnnLXK.go_WzKtF.nOy3ukgi cj42Oypfd5A63rc.7n6PWcdueKaDBKq1_wt3fGsor26Tsb6evRIPyGs2hHa99KkRdoJrK2PVqu6V b5ZvKalazmyRDga8KbZVLfh_FM63tmv_IDsdZKsfpgdr.NgW5wyqzMD0UHGrEXtCmHYPBtnua1tm xuv6PmMFeugvXxC6xkBU7Puk4ibekJB88fzZDk47DwRbR03Q2NmLTcu2Qz77gJd.QgM4pUK6BLwe zXiD4_YOGCzzFPjJdZtGeurVorlRN.ZlaivIw8m4YHCKspx3_c0HsirQxQhBVGk0PDIkvn0j6DgZ a3VAAj8RQ7UIqFfpMzmLeQJDeofYhsvq7JzTXRuHAsSJJuU0xeyXOC1SGuUZR15ST5GuoIda2ZCW kDsmRqzHnNGRhVChzcHVCXqfnjrFKS.NtSPWf8fwuo4julhQBNzCtfr6vKcoPSAQWLDAX0eLhaCm uvJ_.exkBI66W1gt42Sfw7Ltqn7WT9LVmlInqoVDZ6xrDdP1iRYPPjwmek0TZwmCXl89GpnmY9nZ hhzPGeqOoTaxlFdpTfOHXr7F0KveQkCxYCwmtsIorikl4Y7EnZes9KSe5XRVtgnl.4PC_hGPJiCs 49qXoPpeKkwd.OMdH4_sjVT8cvTW1gQEXK49kcgMCP_Jll2fTwueuNFjQvfxzkKTyEH5ivmUwqH4 2Frj6i_Z7Y9n3GnC0OOXzaObeWvthFeahUXAKS6MOahOTsdwQ0cXlK3i9cBaDQGGG5K7bjtrBiRX RnSU1AViJwdZVZw3DgdmlIRvo7lQGjWibyReEC9cB6EHRUauOOs5sYBCq4xmWLUAcEM3O5PkUNZo .Qr84iPSlhr7jr4Pp2uY._8nW44uHajy109QyZEx9HeAQBev.IiZmsU8bSPYNsq0IhKkjrKQRKR_ gEh9tU6Wooo0.obWC77G_7.yFfdOLSmKYSmZVh4Bvqdt.Yz6Lehi9M2nKiRXAJfam5gmizt3iptk 3PRLaDzkoUzk_gE7_Fzf2MV7.kkt58odJnlSa1ZLrHoxnRER9R4OKEjGawBPYnu3KUX58ddjbSx8 jw3Ckd7530IB58dVQYgV91z1jemz7JNoX1HUMLAXVLjr5o2P2btTQyljEihcxFvLbYWN7IjFGiB3 aRllyXOpLDj5OGYrhdbsWw7j9_UobAKs30lONEK3MCL5M5_skfJ_DZEYWPH94jUJj3F.amTZE9bo 4eqlP7wXH8hN1FRUQTJpy9CY- Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.ne1.yahoo.com with HTTP; Tue, 20 Aug 2019 21:02:36 +0000 Received: by smtp429.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID ad1a88bdc1ce2f549070808e15c15152; Tue, 20 Aug 2019 21:02:35 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r351253 - in head/contrib/libc++: include src Message-Id: <416E4F6E-A073-4B0E-A67D-EFAC4769E3AD@yahoo.com> Date: Tue, 20 Aug 2019 14:02:33 -0700 To: svn-src-head@freebsd.org, "dim@freebsd.org " X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 46Cjt620H8z43rt X-Spamd-Bar: + X-Spamd-Result: default: False [1.15 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36646, ipnet:66.163.184.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; FAKE_REPLY(1.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.54)[0.539,0]; NEURAL_HAM_LONG(-0.58)[-0.576,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (2.39), ipnet: 66.163.184.0/21(1.28), asn: 36646(1.03), country: US(-0.05)]; NEURAL_SPAM_MEDIUM(0.68)[0.684,0]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[205.186.163.66.list.dnswl.org : 127.0.5.0]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 21:02:39 -0000 > Author: dim > Date: Tue Aug 20 17:39:32 2019 > New Revision: 351253 > URL:=20 > https://svnweb.freebsd.org/changeset/base/351253 >=20 >=20 > Log: > Pull in r368867 from upstream libc++ trunk (by Marshall Clow): > =20 > Rework recursive_timed_mutex so that it uses __thread_id instead = of > using the lower-level __libcpp_thread_id. This is prep for fixing > PR42918. Reviewed as=20 > https://reviews.llvm.org/D65895 >=20 > =20 > Pull in r368916 from upstream libc++ trunk (by Marshall Clow): > =20 > Fix thread comparison by making sure we never pass our special = 'not a > thread' value to the underlying implementation. Fixes PR#42918. FYI: llvm's -r368916 has a successor fix: -r329399 tied to: https:://reviews.llvm.org/D66480 that is summarized with: QUOTE In fixing https://bugs.llvm.org/show_bug.cgi?id=3D42918 (r368916), I = broke external threading support. This should fix that END QUOTE =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Tue Aug 20 21:12:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CD96E0EAD for ; Tue, 20 Aug 2019 21:12:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Ck5l70prz44Gg; Tue, 20 Aug 2019 21:12:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id D39EA1CEFD; Tue, 20 Aug 2019 21:12:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [192.168.178.61] (unknown [194.76.129.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id B366F1C3; Tue, 20 Aug 2019 23:12:42 +0200 (CEST) From: Dimitry Andric Message-Id: <36651EB6-E3B5-4E4F-A445-825B638A2DED@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_2D84DD20-5EE6-4E7F-A9EB-4E03BE62ED3D"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r351253 - in head/contrib/libc++: include src Date: Tue, 20 Aug 2019 23:12:40 +0200 In-Reply-To: <416E4F6E-A073-4B0E-A67D-EFAC4769E3AD@yahoo.com> Cc: svn-src-head@freebsd.org To: Mark Millard References: <416E4F6E-A073-4B0E-A67D-EFAC4769E3AD@yahoo.com> X-Mailer: Apple Mail (2.3445.104.11) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 21:12:44 -0000 --Apple-Mail=_2D84DD20-5EE6-4E7F-A9EB-4E03BE62ED3D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 20 Aug 2019, at 23:02, Mark Millard wrote: >=20 >> Author: dim >> Date: Tue Aug 20 17:39:32 2019 >> New Revision: 351253 >> URL: >> https://svnweb.freebsd.org/changeset/base/351253 >>=20 >>=20 >> Log: >> Pull in r368867 from upstream libc++ trunk (by Marshall Clow): >>=20 >> Rework recursive_timed_mutex so that it uses __thread_id instead = of >> using the lower-level __libcpp_thread_id. This is prep for fixing >> PR42918. Reviewed as >> https://reviews.llvm.org/D65895 >>=20 >>=20 >> Pull in r368916 from upstream libc++ trunk (by Marshall Clow): >>=20 >> Fix thread comparison by making sure we never pass our special = 'not a >> thread' value to the underlying implementation. Fixes PR#42918. >=20 > FYI: llvm's -r368916 has a successor fix: -r329399 tied to: >=20 > https:://reviews.llvm.org/D66480 >=20 > that is summarized with: >=20 > QUOTE > In fixing https://bugs.llvm.org/show_bug.cgi?id=3D42918 (r368916), I = broke external threading support. > This should fix that > END QUOTE Yes, I saw that, but as far as I know, we do not use any form of external threading. At some point we will import this with a wholesale update. -Dimitry --Apple-Mail=_2D84DD20-5EE6-4E7F-A9EB-4E03BE62ED3D Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXVxiSAAKCRCwXqMKLiCW o/4zAKCnEEOHOGoaeATrkcuzRmihD+PBPACffrDfzua652/JF2HUVS/gSZaKTlM= =qcmJ -----END PGP SIGNATURE----- --Apple-Mail=_2D84DD20-5EE6-4E7F-A9EB-4E03BE62ED3D-- From owner-svn-src-head@freebsd.org Tue Aug 20 21:14:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01ACBE0F18; Tue, 20 Aug 2019 21:14:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Ck845qX8z44JK; Tue, 20 Aug 2019 21:14:44 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A9B78941A; Tue, 20 Aug 2019 21:14:44 +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 x7KLEimt093244; Tue, 20 Aug 2019 21:14:44 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7KLEiOw093243; Tue, 20 Aug 2019 21:14:44 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908202114.x7KLEiOw093243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Aug 2019 21:14:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351302 - head/usr.sbin/makefs X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/makefs X-SVN-Commit-Revision: 351302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 21:14:45 -0000 Author: emaste Date: Tue Aug 20 21:14:44 2019 New Revision: 351302 URL: https://svnweb.freebsd.org/changeset/base/351302 Log: makefs.8: update history - ported to FreeBSD and first appeared in 8.0 - Christos Zoulas added the FAT support that I imported Modified: head/usr.sbin/makefs/makefs.8 Modified: head/usr.sbin/makefs/makefs.8 ============================================================================== --- head/usr.sbin/makefs/makefs.8 Tue Aug 20 20:59:44 2019 (r351301) +++ head/usr.sbin/makefs/makefs.8 Tue Aug 20 21:14:44 2019 (r351302) @@ -499,6 +499,10 @@ The .Nm utility appeared in .Nx 1.6 . +It was ported to +.Fx +and first appeared in +.Fx 8.0 . .Sh AUTHORS .An Luke Mewburn .Aq Mt lukem@NetBSD.org @@ -508,4 +512,6 @@ utility appeared in .An Ryan Gabrys , .An Alan Perez-Rathke , .An Ram Vedam -(cd9660 support) +(cd9660 support), +.An Christos Zoulas +(msdos support). From owner-svn-src-head@freebsd.org Tue Aug 20 21:59:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05EF3E25A1; Tue, 20 Aug 2019 21:59:50 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Cl856Nsvz48PZ; Tue, 20 Aug 2019 21:59:49 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BCEFB9B5F; Tue, 20 Aug 2019 21:59:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7KLxnv9019026; Tue, 20 Aug 2019 21:59:49 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7KLxmH4019020; Tue, 20 Aug 2019 21:59:48 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908202159.x7KLxmH4019020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 20 Aug 2019 21:59:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351318 - in head: etc/mtree sbin/ping sbin/ping/tests X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: etc/mtree sbin/ping sbin/ping/tests X-SVN-Commit-Revision: 351318 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2019 21:59:50 -0000 Author: asomers Date: Tue Aug 20 21:59:48 2019 New Revision: 351318 URL: https://svnweb.freebsd.org/changeset/base/351318 Log: ping: Add tests of the Internet checksum function Submitted by: Ján Sučan MFC after: 2 weeks Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21340 Added: head/sbin/ping/tests/ head/sbin/ping/tests/Makefile (contents, props changed) head/sbin/ping/tests/in_cksum_test.c (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/sbin/ping/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Tue Aug 20 21:43:13 2019 (r351317) +++ head/etc/mtree/BSD.tests.dist Tue Aug 20 21:59:48 2019 (r351318) @@ -440,6 +440,8 @@ files .. .. + ping + .. .. secure lib Modified: head/sbin/ping/Makefile ============================================================================== --- head/sbin/ping/Makefile Tue Aug 20 21:43:13 2019 (r351317) +++ head/sbin/ping/Makefile Tue Aug 20 21:59:48 2019 (r351318) @@ -23,4 +23,7 @@ CFLAGS+=-DWITH_CASPER CFLAGS+=-DIPSEC LIBADD+= ipsec +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include Added: head/sbin/ping/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ping/tests/Makefile Tue Aug 20 21:59:48 2019 (r351318) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +WARNS?= 6 + +ATF_TESTS_C+= in_cksum_test +SRCS.in_cksum_test= in_cksum_test.c ../utils.c + +.include Added: head/sbin/ping/tests/in_cksum_test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ping/tests/in_cksum_test.c Tue Aug 20 21:59:48 2019 (r351318) @@ -0,0 +1,146 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (C) 2019 Jan Sucan + * 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 + +#include + +#include "../utils.h" + +/* + * Test cases. + */ + +ATF_TC_WITHOUT_HEAD(aligned_even_length_big_endian); +ATF_TC_BODY(aligned_even_length_big_endian, tc) +{ + u_char data[] __aligned(sizeof(u_short)) = + {0x12, 0x34, 0x56, 0x78}; + u_short sum; + + sum = in_cksum(data, nitems(data)); + ATF_REQUIRE(sum == 0x5397); +} + +ATF_TC_WITHOUT_HEAD(aligned_odd_length_big_endian); +ATF_TC_BODY(aligned_odd_length_big_endian, tc) +{ + u_char data[] __aligned(sizeof(u_short)) = + {0x12, 0x34, 0x56, 0x78, 0x9a}; + u_short sum; + + sum = in_cksum(data, nitems(data)); + ATF_REQUIRE(sum == 0x52fd); +} + +ATF_TC_WITHOUT_HEAD(aligned_even_length_little_endian); +ATF_TC_BODY(aligned_even_length_little_endian, tc) +{ + u_char data[] __aligned(sizeof(u_short)) = + {0x34, 0x12, 0x78, 0x56}; + u_short sum; + + sum = in_cksum(data, nitems(data)); + ATF_REQUIRE_MSG(sum == 0x9753, "%d", sum); +} + +ATF_TC_WITHOUT_HEAD(aligned_odd_length_little_endian); +ATF_TC_BODY(aligned_odd_length_little_endian, tc) +{ + u_char data[] __aligned(sizeof(u_short)) = + {0x34, 0x12, 0x78, 0x56, 0x00, 0x9a}; + u_short sum; + + sum = in_cksum(data, nitems(data)); + ATF_REQUIRE(sum == 0xfd52); +} + +ATF_TC_WITHOUT_HEAD(unaligned_even_length_big_endian); +ATF_TC_BODY(unaligned_even_length_big_endian, tc) +{ + u_char data[] __aligned(sizeof(u_short)) = + {0x00, 0x12, 0x34, 0x56, 0x78}; + u_short sum; + + sum = in_cksum(data + 1, nitems(data) - 1); + ATF_REQUIRE(sum == 0x5397); +} + +ATF_TC_WITHOUT_HEAD(unaligned_odd_length_big_endian); +ATF_TC_BODY(unaligned_odd_length_big_endian, tc) +{ + u_char data[] __aligned(sizeof(u_short)) = + {0x00, 0x12, 0x34, 0x56, 0x78, 0x9a}; + u_short sum; + + sum = in_cksum(data + 1, nitems(data) - 1); + ATF_REQUIRE(sum == 0x52fd); +} + +ATF_TC_WITHOUT_HEAD(unaligned_even_length_little_endian); +ATF_TC_BODY(unaligned_even_length_little_endian, tc) +{ + u_char data[] __aligned(sizeof(u_short)) = + {0x00, 0x34, 0x12, 0x78, 0x56}; + u_short sum; + + sum = in_cksum(data + 1, nitems(data) - 1); + ATF_REQUIRE_MSG(sum == 0x9753, "%d", sum); +} + +ATF_TC_WITHOUT_HEAD(unaligned_odd_length_little_endian); +ATF_TC_BODY(unaligned_odd_length_little_endian, tc) +{ + u_char data[] __aligned(sizeof(u_short)) = + {0x00, 0x34, 0x12, 0x78, 0x56, 0x00, 0x9a}; + u_short sum; + + sum = in_cksum(data + 1, nitems(data) - 1); + ATF_REQUIRE(sum == 0xfd52); +} + +/* + * Main. + */ + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, aligned_even_length_big_endian); + ATF_TP_ADD_TC(tp, aligned_odd_length_big_endian); + ATF_TP_ADD_TC(tp, aligned_even_length_little_endian); + ATF_TP_ADD_TC(tp, aligned_odd_length_little_endian); + ATF_TP_ADD_TC(tp, unaligned_even_length_big_endian); + ATF_TP_ADD_TC(tp, unaligned_odd_length_big_endian); + ATF_TP_ADD_TC(tp, unaligned_even_length_little_endian); + ATF_TP_ADD_TC(tp, unaligned_odd_length_little_endian); + + return (atf_no_error()); +} From owner-svn-src-head@freebsd.org Wed Aug 21 01:45:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9ABCFE6593; Wed, 21 Aug 2019 01:45:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Cr8V3btJz4KH4; Wed, 21 Aug 2019 01:45: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DECBC5E0; Wed, 21 Aug 2019 01:45: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 x7L1jUP2072182; Wed, 21 Aug 2019 01:45:30 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7L1jU3x072180; Wed, 21 Aug 2019 01:45:30 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908210145.x7L1jU3x072180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Aug 2019 01:45:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351319 - in head/usr.sbin/makefs: ffs msdos X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/usr.sbin/makefs: ffs msdos X-SVN-Commit-Revision: 351319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 01:45:30 -0000 Author: emaste Date: Wed Aug 21 01:45:29 2019 New Revision: 351319 URL: https://svnweb.freebsd.org/changeset/base/351319 Log: makefs: use `char *` not `void *` for buf b_data, drop casts in msdos (The kernel uses caddr_t.) Suggested by: cem Reviewed by: cem MFC with: r351273 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21348 Modified: head/usr.sbin/makefs/ffs/buf.h head/usr.sbin/makefs/msdos/msdosfs_fat.c Modified: head/usr.sbin/makefs/ffs/buf.h ============================================================================== --- head/usr.sbin/makefs/ffs/buf.h Tue Aug 20 21:59:48 2019 (r351318) +++ head/usr.sbin/makefs/ffs/buf.h Wed Aug 21 01:45:29 2019 (r351319) @@ -54,7 +54,7 @@ struct vnode { }; struct buf { - void * b_data; + char * b_data; long b_bufsize; long b_bcount; daddr_t b_blkno; Modified: head/usr.sbin/makefs/msdos/msdosfs_fat.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_fat.c Tue Aug 20 21:59:48 2019 (r351318) +++ head/usr.sbin/makefs/msdos/msdosfs_fat.c Wed Aug 21 01:45:29 2019 (r351319) @@ -220,9 +220,9 @@ pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp return (EIO); } if (FAT32(pmp)) - cn = getulong((char *)bp->b_data + bo); + cn = getulong(bp->b_data + bo); else - cn = getushort((char *)bp->b_data + bo); + cn = getushort(bp->b_data + bo); if (FAT12(pmp) && (prevcn & 1)) cn >>= 4; cn &= pmp->pm_fatmask; @@ -502,9 +502,9 @@ fatentry(int function, struct msdosfsmount *pmp, u_lon if (function & FAT_GET) { if (FAT32(pmp)) - readcn = getulong((char *)bp->b_data + bo); + readcn = getulong(bp->b_data + bo); else - readcn = getushort((char *)bp->b_data + bo); + readcn = getushort(bp->b_data + bo); if (FAT12(pmp) & (cn & 1)) readcn >>= 4; readcn &= pmp->pm_fatmask; @@ -516,7 +516,7 @@ fatentry(int function, struct msdosfsmount *pmp, u_lon if (function & FAT_SET) { switch (pmp->pm_fatmask) { case FAT12_MASK: - readcn = getushort((char *)bp->b_data + bo); + readcn = getushort(bp->b_data + bo); if (cn & 1) { readcn &= 0x000f; readcn |= newcontents << 4; @@ -524,20 +524,20 @@ fatentry(int function, struct msdosfsmount *pmp, u_lon readcn &= 0xf000; readcn |= newcontents & 0xfff; } - putushort((char *)bp->b_data + bo, readcn); + putushort(bp->b_data + bo, readcn); break; case FAT16_MASK: - putushort((char *)bp->b_data + bo, newcontents); + putushort(bp->b_data + bo, newcontents); break; case FAT32_MASK: /* * According to spec we have to retain the * high order bits of the FAT entry. */ - readcn = getulong((char *)bp->b_data + bo); + readcn = getulong(bp->b_data + bo); readcn &= ~FAT32_MASK; readcn |= newcontents & FAT32_MASK; - putulong((char *)bp->b_data + bo, readcn); + putulong(bp->b_data + bo, readcn); break; } updatefats(pmp, bp, bn); @@ -587,7 +587,7 @@ fatchain(struct msdosfsmount *pmp, u_long start, u_lon newc = --count > 0 ? start : fillwith; switch (pmp->pm_fatmask) { case FAT12_MASK: - readcn = getushort((char *)bp->b_data + bo); + readcn = getushort(bp->b_data + bo); if (start & 1) { readcn &= 0xf000; readcn |= newc & 0xfff; @@ -595,20 +595,20 @@ fatchain(struct msdosfsmount *pmp, u_long start, u_lon readcn &= 0x000f; readcn |= newc << 4; } - putushort((char *)bp->b_data + bo, readcn); + putushort(bp->b_data + bo, readcn); bo++; if (!(start & 1)) bo++; break; case FAT16_MASK: - putushort((char *)bp->b_data + bo, newc); + putushort(bp->b_data + bo, newc); bo += 2; break; case FAT32_MASK: - readcn = getulong((char *)bp->b_data + bo); + readcn = getulong(bp->b_data + bo); readcn &= ~pmp->pm_fatmask; readcn |= newc & pmp->pm_fatmask; - putulong((char *)bp->b_data + bo, readcn); + putulong(bp->b_data + bo, readcn); bo += 4; break; } @@ -833,7 +833,7 @@ freeclusterchain(struct msdosfsmount *pmp, u_long clus usemap_free(pmp, cluster); switch (pmp->pm_fatmask) { case FAT12_MASK: - readcn = getushort((char *)bp->b_data + bo); + readcn = getushort(bp->b_data + bo); if (cluster & 1) { cluster = readcn >> 4; readcn &= 0x000f; @@ -843,15 +843,15 @@ freeclusterchain(struct msdosfsmount *pmp, u_long clus readcn &= 0xf000; readcn |= MSDOSFSFREE & 0xfff; } - putushort((char *)bp->b_data + bo, readcn); + putushort(bp->b_data + bo, readcn); break; case FAT16_MASK: - cluster = getushort((char *)bp->b_data + bo); - putushort((char *)bp->b_data + bo, MSDOSFSFREE); + cluster = getushort(bp->b_data + bo); + putushort(bp->b_data + bo, MSDOSFSFREE); break; case FAT32_MASK: - cluster = getulong((char *)bp->b_data + bo); - putulong((char *)bp->b_data + bo, + cluster = getulong(bp->b_data + bo); + putulong(bp->b_data + bo, (MSDOSFSFREE & FAT32_MASK) | (cluster & ~FAT32_MASK)); break; } @@ -903,9 +903,9 @@ fillinusemap(struct msdosfsmount *pmp) } } if (FAT32(pmp)) - readcn = getulong((char *)bp->b_data + bo); + readcn = getulong(bp->b_data + bo); else - readcn = getushort((char *)bp->b_data + bo); + readcn = getushort(bp->b_data + bo); if (FAT12(pmp) && (cn & 1)) readcn >>= 4; readcn &= pmp->pm_fatmask; From owner-svn-src-head@freebsd.org Wed Aug 21 02:17:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 512A7E6EBB; Wed, 21 Aug 2019 02:17:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Crsc1RkPz4Lx3; Wed, 21 Aug 2019 02:17: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 146F1CB49; Wed, 21 Aug 2019 02:17: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 x7L2HdY3090378; Wed, 21 Aug 2019 02:17:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7L2Hdjm090377; Wed, 21 Aug 2019 02:17:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908210217.x7L2Hdjm090377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Aug 2019 02:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351320 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 351320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 02:17:40 -0000 Author: mav Date: Wed Aug 21 02:17:39 2019 New Revision: 351320 URL: https://svnweb.freebsd.org/changeset/base/351320 Log: Formalize NVMe controller consumer life cycle. This fixes possible double call of fail_fn, for example on hot removal. It also allows ctrlr_fn to safely return NULL cookie in case of failure and not get useless ns_fn or fail_fn call with NULL cookie later. MFC after: 2 weeks Modified: head/sys/dev/nvme/nvme.c Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Wed Aug 21 01:45:29 2019 (r351319) +++ head/sys/dev/nvme/nvme.c Wed Aug 21 02:17:39 2019 (r351320) @@ -330,16 +330,21 @@ nvme_notify(struct nvme_consumer *cons, return; cmpset = atomic_cmpset_32(&ctrlr->notification_sent, 0, 1); - if (cmpset == 0) return; if (cons->ctrlr_fn != NULL) ctrlr_cookie = (*cons->ctrlr_fn)(ctrlr); else - ctrlr_cookie = NULL; + ctrlr_cookie = (void *)(uintptr_t)0xdeadc0dedeadc0de; ctrlr->cons_cookie[cons->id] = ctrlr_cookie; + + /* ctrlr_fn has failed. Nothing to notify here any more. */ + if (ctrlr_cookie == NULL) + return; + if (ctrlr->is_failed) { + ctrlr->cons_cookie[cons->id] = NULL; if (cons->fail_fn != NULL) (*cons->fail_fn)(ctrlr_cookie); /* @@ -395,13 +400,16 @@ nvme_notify_async_consumers(struct nvme_controller *ct uint32_t log_page_size) { struct nvme_consumer *cons; + void *ctrlr_cookie; uint32_t i; for (i = 0; i < NVME_MAX_CONSUMERS; i++) { cons = &nvme_consumer[i]; - if (cons->id != INVALID_CONSUMER_ID && cons->async_fn != NULL) - (*cons->async_fn)(ctrlr->cons_cookie[i], async_cpl, + if (cons->id != INVALID_CONSUMER_ID && cons->async_fn != NULL && + (ctrlr_cookie = ctrlr->cons_cookie[i]) != NULL) { + (*cons->async_fn)(ctrlr_cookie, async_cpl, log_page_id, log_page_buffer, log_page_size); + } } } @@ -409,6 +417,7 @@ void nvme_notify_fail_consumers(struct nvme_controller *ctrlr) { struct nvme_consumer *cons; + void *ctrlr_cookie; uint32_t i; /* @@ -422,8 +431,12 @@ nvme_notify_fail_consumers(struct nvme_controller *ctr for (i = 0; i < NVME_MAX_CONSUMERS; i++) { cons = &nvme_consumer[i]; - if (cons->id != INVALID_CONSUMER_ID && cons->fail_fn != NULL) - cons->fail_fn(ctrlr->cons_cookie[i]); + if (cons->id != INVALID_CONSUMER_ID && + (ctrlr_cookie = ctrlr->cons_cookie[i]) != NULL) { + ctrlr->cons_cookie[i] = NULL; + if (cons->fail_fn != NULL) + cons->fail_fn(ctrlr_cookie); + } } } @@ -432,6 +445,7 @@ nvme_notify_ns(struct nvme_controller *ctrlr, int nsid { struct nvme_consumer *cons; struct nvme_namespace *ns = &ctrlr->ns[nsid - 1]; + void *ctrlr_cookie; uint32_t i; if (!ctrlr->is_initialized) @@ -439,9 +453,9 @@ nvme_notify_ns(struct nvme_controller *ctrlr, int nsid for (i = 0; i < NVME_MAX_CONSUMERS; i++) { cons = &nvme_consumer[i]; - if (cons->id != INVALID_CONSUMER_ID && cons->ns_fn != NULL) - ns->cons_cookie[cons->id] = - (*cons->ns_fn)(ns, ctrlr->cons_cookie[cons->id]); + if (cons->id != INVALID_CONSUMER_ID && cons->ns_fn != NULL && + (ctrlr_cookie = ctrlr->cons_cookie[i]) != NULL) + ns->cons_cookie[i] = (*cons->ns_fn)(ns, ctrlr_cookie); } } From owner-svn-src-head@freebsd.org Wed Aug 21 02:21:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53F45E712A; Wed, 21 Aug 2019 02:21:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46CryG1c0bz4MH0; Wed, 21 Aug 2019 02:21:42 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19ED4CBAC; Wed, 21 Aug 2019 02:21:42 +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 x7L2LfnP095731; Wed, 21 Aug 2019 02:21:41 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7L2LeQH095708; Wed, 21 Aug 2019 02:21:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908210221.x7L2LeQH095708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Aug 2019 02:21:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351321 - in head: sys/fs/msdosfs usr.sbin/makefs/msdos X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: sys/fs/msdosfs usr.sbin/makefs/msdos X-SVN-Commit-Revision: 351321 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 02:21:42 -0000 Author: emaste Date: Wed Aug 21 02:21:40 2019 New Revision: 351321 URL: https://svnweb.freebsd.org/changeset/base/351321 Log: makefs: share fat.h between kernel msdosfs and makefs There is no reason to duplicate this file when it can be trivially shared (just exposing one section previously under #ifdef _KERNEL). Reviewed by: imp, cem MFC with: r351273 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21346 Deleted: head/usr.sbin/makefs/msdos/fat.h Modified: head/sys/fs/msdosfs/fat.h head/usr.sbin/makefs/msdos/Makefile.inc head/usr.sbin/makefs/msdos/msdosfs_conv.c head/usr.sbin/makefs/msdos/msdosfs_denode.c head/usr.sbin/makefs/msdos/msdosfs_fat.c head/usr.sbin/makefs/msdos/msdosfs_lookup.c head/usr.sbin/makefs/msdos/msdosfs_vfsops.c head/usr.sbin/makefs/msdos/msdosfs_vnops.c Modified: head/sys/fs/msdosfs/fat.h ============================================================================== --- head/sys/fs/msdosfs/fat.h Wed Aug 21 02:17:39 2019 (r351320) +++ head/sys/fs/msdosfs/fat.h Wed Aug 21 02:21:40 2019 (r351321) @@ -82,7 +82,7 @@ #define MSDOSFSEOF(pmp, cn) ((((cn) | ~(pmp)->pm_fatmask) & CLUST_EOFS) == CLUST_EOFS) -#ifdef _KERNEL +#if defined (_KERNEL) || defined(MAKEFS) /* * These are the values for the function argument to the function * fatentry(). @@ -105,5 +105,5 @@ int extendfile(struct denode *dep, u_long count, struc void fc_purge(struct denode *dep, u_int frcn); int markvoldirty(struct msdosfsmount *pmp, int dirty); -#endif /* _KERNEL */ +#endif /* _KERNEL || MAKEFS */ #endif /* !_FS_MSDOSFS_FAT_H_ */ Modified: head/usr.sbin/makefs/msdos/Makefile.inc ============================================================================== --- head/usr.sbin/makefs/msdos/Makefile.inc Wed Aug 21 02:17:39 2019 (r351320) +++ head/usr.sbin/makefs/msdos/Makefile.inc Wed Aug 21 02:21:40 2019 (r351321) @@ -6,7 +6,7 @@ MSDOS_NEWFS= ${SRCTOP}/sbin/newfs_msdos .PATH: ${SRCDIR}/msdos ${MSDOS} ${MSDOS_NEWFS} -CFLAGS+= -I${MSDOS} -I${MSDOS_NEWFS} +CFLAGS+= -DMAKEFS -I${MSDOS} -I${MSDOS_NEWFS} SRCS+= mkfs_msdos.c SRCS+= msdosfs_conv.c msdosfs_denode.c msdosfs_fat.c msdosfs_lookup.c Modified: head/usr.sbin/makefs/msdos/msdosfs_conv.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_conv.c Wed Aug 21 02:17:39 2019 (r351320) +++ head/usr.sbin/makefs/msdos/msdosfs_conv.c Wed Aug 21 02:21:40 2019 (r351321) @@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$"); #include "msdos/denode.h" #include "msdos/direntry.h" -#include "msdos/fat.h" #include "msdos/msdosfsmount.h" static int char8ucs2str(const uint8_t *in, int n, uint16_t *out, int m); Modified: head/usr.sbin/makefs/msdos/msdosfs_denode.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_denode.c Wed Aug 21 02:17:39 2019 (r351320) +++ head/usr.sbin/makefs/msdos/msdosfs_denode.c Wed Aug 21 02:21:40 2019 (r351321) @@ -60,16 +60,16 @@ __FBSDID("$FreeBSD$"); #include #include +#include "msdos/denode.h" +#include "msdos/msdosfsmount.h" +#include #include "makefs.h" #include "msdos.h" #include "ffs/buf.h" -#include "msdos/denode.h" #include "msdos/direntry.h" -#include "msdos/fat.h" -#include "msdos/msdosfsmount.h" /* * If deget() succeeds it returns with the gotten denode locked(). Modified: head/usr.sbin/makefs/msdos/msdosfs_fat.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_fat.c Wed Aug 21 02:17:39 2019 (r351320) +++ head/usr.sbin/makefs/msdos/msdosfs_fat.c Wed Aug 21 02:21:40 2019 (r351321) @@ -59,13 +59,13 @@ #include #include +#include "msdos/denode.h" +#include "msdos/msdosfsmount.h" +#include #include "ffs/buf.h" -#include "msdos/denode.h" #include "msdos/direntry.h" -#include "msdos/fat.h" -#include "msdos/msdosfsmount.h" #include "makefs.h" #include "msdos.h" Modified: head/usr.sbin/makefs/msdos/msdosfs_lookup.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_lookup.c Wed Aug 21 02:17:39 2019 (r351320) +++ head/usr.sbin/makefs/msdos/msdosfs_lookup.c Wed Aug 21 02:21:40 2019 (r351321) @@ -57,13 +57,13 @@ #include #include +#include "msdos/denode.h" +#include "msdos/msdosfsmount.h" +#include #include "ffs/buf.h" -#include "msdos/denode.h" #include "msdos/direntry.h" -#include "msdos/fat.h" -#include "msdos/msdosfsmount.h" #include "makefs.h" #include "msdos.h" Modified: head/usr.sbin/makefs/msdos/msdosfs_vfsops.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_vfsops.c Wed Aug 21 02:17:39 2019 (r351320) +++ head/usr.sbin/makefs/msdos/msdosfs_vfsops.c Wed Aug 21 02:21:40 2019 (r351321) @@ -60,6 +60,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include "msdos/denode.h" +#include "msdos/msdosfsmount.h" +#include #include @@ -68,10 +71,7 @@ __FBSDID("$FreeBSD$"); #include "ffs/buf.h" -#include "msdos/denode.h" #include "msdos/direntry.h" -#include "msdos/fat.h" -#include "msdos/msdosfsmount.h" struct msdosfsmount * msdosfs_mount(struct vnode *devvp) Modified: head/usr.sbin/makefs/msdos/msdosfs_vnops.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_vnops.c Wed Aug 21 02:17:39 2019 (r351320) +++ head/usr.sbin/makefs/msdos/msdosfs_vnops.c Wed Aug 21 02:21:40 2019 (r351321) @@ -63,16 +63,16 @@ __FBSDID("$FreeBSD$"); #include #include +#include "msdos/denode.h" +#include "msdos/msdosfsmount.h" +#include #include "makefs.h" #include "msdos.h" #include "ffs/buf.h" -#include "msdos/denode.h" #include "msdos/direntry.h" -#include "msdos/fat.h" -#include "msdos/msdosfsmount.h" /* * Some general notes: From owner-svn-src-head@freebsd.org Wed Aug 21 02:26:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56E46E734B; Wed, 21 Aug 2019 02:26:24 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Cs3h1LTtz4Mhb; Wed, 21 Aug 2019 02:26:24 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FB37CD0D; Wed, 21 Aug 2019 02:26:24 +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 x7L2QNtl096370; Wed, 21 Aug 2019 02:26:23 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7L2QMWe096365; Wed, 21 Aug 2019 02:26:22 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908210226.x7L2QMWe096365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 21 Aug 2019 02:26:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351322 - in head/sys: contrib/ncsw/Peripherals/FM/HC contrib/ncsw/Peripherals/FM/Pcd contrib/ncsw/Peripherals/QM contrib/ncsw/inc/Peripherals contrib/ncsw/user/env dev/dpaa X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: contrib/ncsw/Peripherals/FM/HC contrib/ncsw/Peripherals/FM/Pcd contrib/ncsw/Peripherals/QM contrib/ncsw/inc/Peripherals contrib/ncsw/user/env dev/dpaa X-SVN-Commit-Revision: 351322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 02:26:24 -0000 Author: jhibbits Date: Wed Aug 21 02:26:22 2019 New Revision: 351322 URL: https://svnweb.freebsd.org/changeset/base/351322 Log: dpaa: Fix warnings in dtsec(4) found by clang These are all trivial warnings that have no real functional change. Modified: head/sys/contrib/ncsw/Peripherals/FM/HC/hc.c head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_cc.c head/sys/contrib/ncsw/Peripherals/QM/qm_portal_fqr.c head/sys/contrib/ncsw/inc/Peripherals/dpaa_ext.h head/sys/contrib/ncsw/user/env/xx.c head/sys/dev/dpaa/if_dtsec_rm.c Modified: head/sys/contrib/ncsw/Peripherals/FM/HC/hc.c ============================================================================== --- head/sys/contrib/ncsw/Peripherals/FM/HC/hc.c Wed Aug 21 02:21:40 2019 (r351321) +++ head/sys/contrib/ncsw/Peripherals/FM/HC/hc.c Wed Aug 21 02:26:22 2019 (r351322) @@ -658,7 +658,7 @@ t_Error FmHcPcdKgSetClsPlan(t_Handle h_FmHc, t_FmPcdKg p_HcFrame->extraReg = HC_HCOR_KG_SCHEME_REGS_MASK; idx = (uint8_t)(i - p_Set->baseEntry); - memcpy(&p_HcFrame->hcSpecificData.clsPlanEntries, &p_Set->vectors[idx], CLS_PLAN_NUM_PER_GRP*sizeof(uint32_t)); + memcpy(__DEVOLATILE(uint32_t *, &p_HcFrame->hcSpecificData.clsPlanEntries), &p_Set->vectors[idx], CLS_PLAN_NUM_PER_GRP*sizeof(uint32_t)); p_HcFrame->commandSequence = seqNum; BUILD_FD(sizeof(t_HcFrame)); Modified: head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_cc.c ============================================================================== --- head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_cc.c Wed Aug 21 02:21:40 2019 (r351321) +++ head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_cc.c Wed Aug 21 02:26:22 2019 (r351322) @@ -895,7 +895,7 @@ static t_Handle BuildNewAd( XX_Free(p_FmPcdCcNodeTmp); - return E_OK; + return NULL; } static t_Error DynamicChangeHc( Modified: head/sys/contrib/ncsw/Peripherals/QM/qm_portal_fqr.c ============================================================================== --- head/sys/contrib/ncsw/Peripherals/QM/qm_portal_fqr.c Wed Aug 21 02:21:40 2019 (r351321) +++ head/sys/contrib/ncsw/Peripherals/QM/qm_portal_fqr.c Wed Aug 21 02:26:22 2019 (r351322) @@ -1478,7 +1478,6 @@ static t_Error CalcWredCurve(t_QmCgWredCurve *p_WredCu } sa = sa/pres; ASSERT_COND(sa<128 && sa>=64); - sn = sn; ASSERT_COND(sn<64 && sn>=7); *p_CurveWord = ((ma << 24) | Modified: head/sys/contrib/ncsw/inc/Peripherals/dpaa_ext.h ============================================================================== --- head/sys/contrib/ncsw/inc/Peripherals/dpaa_ext.h Wed Aug 21 02:21:40 2019 (r351321) +++ head/sys/contrib/ncsw/inc/Peripherals/dpaa_ext.h Wed Aug 21 02:26:22 2019 (r351322) @@ -57,8 +57,12 @@ #include +#ifndef __BYTE_ORDER__ #define __BYTE_ORDER__ BYTE_ORDER +#endif +#ifndef __ORDER_BIG_ENDIAN__ #define __ORDER_BIG_ENDIAN__ BIG_ENDIAN +#endif /**************************************************************************//** @Description Frame descriptor Modified: head/sys/contrib/ncsw/user/env/xx.c ============================================================================== --- head/sys/contrib/ncsw/user/env/xx.c Wed Aug 21 02:21:40 2019 (r351321) +++ head/sys/contrib/ncsw/user/env/xx.c Wed Aug 21 02:26:22 2019 (r351322) @@ -646,7 +646,7 @@ XX_IpcInitSession(char destAddr[XX_IPC_MAX_ADDR_NAME_L /* Should not be called */ printf("NetCommSW: Unimplemented function %s() called!\n", __func__); - return (E_OK); + return (NULL); } t_Error Modified: head/sys/dev/dpaa/if_dtsec_rm.c ============================================================================== --- head/sys/dev/dpaa/if_dtsec_rm.c Wed Aug 21 02:21:40 2019 (r351321) +++ head/sys/dev/dpaa/if_dtsec_rm.c Wed Aug 21 02:26:22 2019 (r351322) @@ -86,10 +86,10 @@ enum dtsec_rm_pool_params { DTSEC_RM_POOL_FI_MAX_SIZE = 256, }; +#define DTSEC_RM_FQR_RX_CHANNEL e_QM_FQ_CHANNEL_POOL1 +#define DTSEC_RM_FQR_TX_CONF_CHANNEL e_QM_FQ_CHANNEL_SWPORTAL0 enum dtsec_rm_fqr_params { - DTSEC_RM_FQR_RX_CHANNEL = e_QM_FQ_CHANNEL_POOL1, DTSEC_RM_FQR_RX_WQ = 1, - DTSEC_RM_FQR_TX_CONF_CHANNEL = e_QM_FQ_CHANNEL_SWPORTAL0, DTSEC_RM_FQR_TX_WQ = 1, DTSEC_RM_FQR_TX_CONF_WQ = 1 }; From owner-svn-src-head@freebsd.org Wed Aug 21 04:54:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13CD3BA511; Wed, 21 Aug 2019 04:54:49 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46CwLw6l6yz4Tw0; Wed, 21 Aug 2019 04:54:48 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C92CEE852; Wed, 21 Aug 2019 04:54:48 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7L4smKs085104; Wed, 21 Aug 2019 04:54:48 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7L4smIa085103; Wed, 21 Aug 2019 04:54:48 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908210454.x7L4smIa085103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 21 Aug 2019 04:54:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351323 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 351323 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 04:54:49 -0000 Author: mjg Date: Wed Aug 21 04:54:48 2019 New Revision: 351323 URL: https://svnweb.freebsd.org/changeset/base/351323 Log: seqc: predict false for _in_modify and type fixes for _consistent_* seqc_consistent_* return bool, not seqc. [0] While here annotate the rarely true condition - it is expected to run into it on vare occasion (compared to the other case). Reported by: oshogbo [0] Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/seqc.h Modified: head/sys/sys/seqc.h ============================================================================== --- head/sys/sys/seqc.h Wed Aug 21 02:26:22 2019 (r351322) +++ head/sys/sys/seqc.h Wed Aug 21 04:54:48 2019 (r351323) @@ -78,7 +78,7 @@ seqc_read(const seqc_t *seqcp) for (;;) { ret = atomic_load_acq_int(__DECONST(seqc_t *, seqcp)); - if (seqc_in_modify(ret)) { + if (__predict_false(seqc_in_modify(ret))) { cpu_spinwait(); continue; } @@ -88,14 +88,14 @@ seqc_read(const seqc_t *seqcp) return (ret); } -static __inline seqc_t +static __inline bool seqc_consistent_nomb(const seqc_t *seqcp, seqc_t oldseqc) { return (*seqcp == oldseqc); } -static __inline seqc_t +static __inline bool seqc_consistent(const seqc_t *seqcp, seqc_t oldseqc) { From owner-svn-src-head@freebsd.org Wed Aug 21 07:45:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 193B8BE044; Wed, 21 Aug 2019 07:45:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46D0836q0Qz4cVX; Wed, 21 Aug 2019 07:45:39 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C758118781; Wed, 21 Aug 2019 07:45:39 +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 x7L7jd6o086483; Wed, 21 Aug 2019 07:45:39 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7L7jd30086482; Wed, 21 Aug 2019 07:45:39 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908210745.x7L7jd30086482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 21 Aug 2019 07:45:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351324 - head/sys/netgraph/bluetooth/drivers/ubt X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sys/netgraph/bluetooth/drivers/ubt X-SVN-Commit-Revision: 351324 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 07:45:40 -0000 Author: delphij Date: Wed Aug 21 07:45:39 2019 New Revision: 351324 URL: https://svnweb.freebsd.org/changeset/base/351324 Log: Fix a panic in ubt_do_hci_request. The 'mtx' is on stack and can contain garbages that would cause mtx_init (and in turn lock_init) to think that the mutex was already initialized. Modified: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Modified: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c ============================================================================== --- head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Wed Aug 21 04:54:48 2019 (r351323) +++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Wed Aug 21 07:45:39 2019 (r351324) @@ -554,6 +554,7 @@ ubt_do_hci_request(struct usb_device *udev, struct ubt return (USB_ERR_NORMAL_COMPLETION); /* Initialize INTR endpoint xfer and wait for response */ + bzero(&mtx, sizeof(mtx)); mtx_init(&mtx, "ubt pb", NULL, MTX_DEF); error = usbd_transfer_setup(udev, &iface_index, xfer, From owner-svn-src-head@freebsd.org Wed Aug 21 07:59:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7340BE72D; Wed, 21 Aug 2019 07:59:08 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46D0Rc4nvpz4dBN; Wed, 21 Aug 2019 07:59:08 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f48.google.com with SMTP id i22so2800096ioh.2; Wed, 21 Aug 2019 00:59:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=xeV9Rl8I/2RO3xcFmWHHdmOZfSGRYwVGIFBnr4sw28Y=; b=d3akbUcrDiAtNAZzo4nmnN3HAisovvbqzHn4FkuXiU2htfr0CuIlq3xSXSEKUcnaL8 tOmbmjSetq3UObOcZcsVNvKy/Ua38OJC/H76x2p+9xDhqygIj9S5DTLSN2OtGlnfb0Bu WiyjGDmtaBbTS/tSaFAsxFY33JZLbYkvywRbHx4o0qSjk7N+PW/j8nuiV2ERes8eOdfd CgQcDfrfNAJwYgoLqQPWA/zyFbpnZCCugcpesHFE5ufi3xxx+qrxRyxOeSCmczs9TyQZ UIDpB7TpFOyreZ/lzDn/tLI6QKQ7qk3xTU3xw2Z/zxZIbyFTzerNRTsS3lk6+dB8KoWs m/sg== X-Gm-Message-State: APjAAAVkjSV4yVMiOr2ao/E1lWkC0gXiuWa98wRdTsqFAEl6UK0dlOjP wXcQY2nP1nrQGjn2UbH/agoFlPiP X-Google-Smtp-Source: APXvYqzLk/aeVipYekTC2aCbA3AHhUAmUW9GiJppihpJGq5lHr3f12BkHhQlV+zqbLBmrWMP76xRrQ== X-Received: by 2002:a5e:9701:: with SMTP id w1mr4883879ioj.294.1566374347247; Wed, 21 Aug 2019 00:59:07 -0700 (PDT) Received: from mail-io1-f46.google.com (mail-io1-f46.google.com. [209.85.166.46]) by smtp.gmail.com with ESMTPSA id j16sm19614739iok.34.2019.08.21.00.59.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Aug 2019 00:59:06 -0700 (PDT) Received: by mail-io1-f46.google.com with SMTP id t3so2683837ioj.12; Wed, 21 Aug 2019 00:59:06 -0700 (PDT) X-Received: by 2002:a6b:f216:: with SMTP id q22mr35767399ioh.65.1566374346744; Wed, 21 Aug 2019 00:59:06 -0700 (PDT) MIME-Version: 1.0 References: <201908210745.x7L7jd30086482@repo.freebsd.org> In-Reply-To: <201908210745.x7L7jd30086482@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Wed, 21 Aug 2019 00:58:55 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r351324 - head/sys/netgraph/bluetooth/drivers/ubt To: Xin LI Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46D0Rc4nvpz4dBN X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 07:59:08 -0000 Hi Xin Li, On Wed, Aug 21, 2019 at 12:45 AM Xin LI wrote: > URL: https://svnweb.freebsd.org/changeset/base/351324 > > Log: > The 'mtx' is on stack and can contain garbages that would cause mtx_init > (and in turn lock_init) to think that the mutex was already initialized. > > --- head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Wed Aug 21 04:54:48 2019 (r351323) > +++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Wed Aug 21 07:45:39 2019 (r351324) > @@ -554,6 +554,7 @@ ubt_do_hci_request(struct usb_device *udev, struct ubt > /* Initialize INTR endpoint xfer and wait for response */ > + bzero(&mtx, sizeof(mtx)); > mtx_init(&mtx, "ubt pb", NULL, MTX_DEF); This is usually spelled 'MTX_DEF | MTX_NEW' instead. Best regards, Conrad From owner-svn-src-head@freebsd.org Wed Aug 21 08:01:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0148CBF6A1; Wed, 21 Aug 2019 08:01:44 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46D0Vb5rN7z4dbh; Wed, 21 Aug 2019 08:01:43 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABC3018AC9; Wed, 21 Aug 2019 08:01:43 +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 x7L81hxN097167; Wed, 21 Aug 2019 08:01:43 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7L81hDn097166; Wed, 21 Aug 2019 08:01:43 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908210801.x7L81hDn097166@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 21 Aug 2019 08:01:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351325 - head/sys/dev/sound/pci/hda X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sys/dev/sound/pci/hda X-SVN-Commit-Revision: 351325 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 08:01:44 -0000 Author: delphij Date: Wed Aug 21 08:01:43 2019 New Revision: 351325 URL: https://svnweb.freebsd.org/changeset/base/351325 Log: Fix sound on headset jack for ThinkPad T51. Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa_patches.c Wed Aug 21 07:45:39 2019 (r351324) +++ head/sys/dev/sound/pci/hda/hdaa_patches.c Wed Aug 21 08:01:43 2019 (r351325) @@ -429,6 +429,15 @@ hdac_pin_patch(struct hdaa_widget *w) patch = "as=1 seq=15"; break; } + } else if (id == HDA_CODEC_ALC298 && HDA_DEV_MATCH(LENOVO_ALL_SUBVENDOR, subid)) { + switch (nid) { + case 23: + config = 0x03a1103f; + break; + case 33: + config = 0x2121101f; + break; + } } else if (id == HDA_CODEC_ALC298 && subid == DELL_XPS9560_SUBVENDOR) { switch (nid) { case 24: From owner-svn-src-head@freebsd.org Wed Aug 21 08:15:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 615CEBFA9D; Wed, 21 Aug 2019 08:15:31 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46D0pW1PZbz4f6R; Wed, 21 Aug 2019 08:15:31 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E3C218D0B; Wed, 21 Aug 2019 08:15:31 +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 x7L8FUBj004198; Wed, 21 Aug 2019 08:15:30 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7L8FUfq004197; Wed, 21 Aug 2019 08:15:30 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908210815.x7L8FUfq004197@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 21 Aug 2019 08:15:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351326 - head/sys/netgraph/bluetooth/drivers/ubt X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sys/netgraph/bluetooth/drivers/ubt X-SVN-Commit-Revision: 351326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 08:15:31 -0000 Author: delphij Date: Wed Aug 21 08:15:30 2019 New Revision: 351326 URL: https://svnweb.freebsd.org/changeset/base/351326 Log: Use MTX_NEW instead of bzero(). Submitted by: cem Modified: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Modified: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c ============================================================================== --- head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Wed Aug 21 08:01:43 2019 (r351325) +++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Wed Aug 21 08:15:30 2019 (r351326) @@ -554,8 +554,7 @@ ubt_do_hci_request(struct usb_device *udev, struct ubt return (USB_ERR_NORMAL_COMPLETION); /* Initialize INTR endpoint xfer and wait for response */ - bzero(&mtx, sizeof(mtx)); - mtx_init(&mtx, "ubt pb", NULL, MTX_DEF); + mtx_init(&mtx, "ubt pb", NULL, MTX_DEF | MTX_NEW); error = usbd_transfer_setup(udev, &iface_index, xfer, &ubt_probe_config, 1, evt, &mtx); From owner-svn-src-head@freebsd.org Wed Aug 21 10:42:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D069C39F6; Wed, 21 Aug 2019 10:42:32 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46D44837RDz3J9D; Wed, 21 Aug 2019 10:42:32 +0000 (UTC) (envelope-from bz@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CF891A7EC; Wed, 21 Aug 2019 10:42:32 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7LAgWID092352; Wed, 21 Aug 2019 10:42:32 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LAgW17092351; Wed, 21 Aug 2019 10:42:32 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201908211042.x7LAgW17092351@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 21 Aug 2019 10:42:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351327 - head/sys/contrib/dev/ath/ath_hal/ar9300 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/contrib/dev/ath/ath_hal/ar9300 X-SVN-Commit-Revision: 351327 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 10:42:32 -0000 Author: bz Date: Wed Aug 21 10:42:31 2019 New Revision: 351327 URL: https://svnweb.freebsd.org/changeset/base/351327 Log: athhal: disable unused function (big endian only) Disable ar9300_swap_tx_desc() for the moment. It is an unused function only tried to compile on big endian systems. Found by: s390x buildkernel MFC after: 3 months Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit_ds.c Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit_ds.c ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit_ds.c Wed Aug 21 08:15:30 2019 (r351326) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit_ds.c Wed Aug 21 10:42:31 2019 (r351327) @@ -26,9 +26,11 @@ #include "ar9300/ar9300phy.h" #include "ah_devid.h" +#if 0 #if AH_BYTE_ORDER == AH_BIG_ENDIAN static void ar9300_swap_tx_desc(void *ds); #endif +#endif void ar9300_tx_req_intr_desc(struct ath_hal *ah, void *ds) @@ -174,6 +176,7 @@ ar9300_clear_dest_mask(struct ath_hal *ah, void *ds) } #endif +#if 0 #if AH_BYTE_ORDER == AH_BIG_ENDIAN /* XXX what words need swapping */ /* Swap transmit descriptor */ @@ -192,6 +195,7 @@ ar9300_swap_tx_desc(void *dsp) ds->status7 = __bswap32(ds->status7); ds->status8 = __bswap32(ds->status8); } +#endif #endif From owner-svn-src-head@freebsd.org Wed Aug 21 10:45:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A1C3C3ABF; Wed, 21 Aug 2019 10:45:29 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46D47X6ghlz3JKb; Wed, 21 Aug 2019 10:45:28 +0000 (UTC) (envelope-from rrs@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C25591A7FA; Wed, 21 Aug 2019 10:45:28 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7LAjSqK092575; Wed, 21 Aug 2019 10:45:28 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LAjSHb092574; Wed, 21 Aug 2019 10:45:28 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201908211045.x7LAjSHb092574@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Wed, 21 Aug 2019 10:45:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351328 - head/sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: head/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 351328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 10:45:29 -0000 Author: rrs Date: Wed Aug 21 10:45:28 2019 New Revision: 351328 URL: https://svnweb.freebsd.org/changeset/base/351328 Log: Fix an issue when TSO and Rack play together. Basically an retransmission of the initial SYN (with data) would cause us to strip the SYN and decrement/increase offset/len which then caused us a -1 offset and a panic. Reported by: Larry Rosenman (Michael Tuexen helped me debug this at the IETF) Modified: head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Wed Aug 21 10:42:31 2019 (r351327) +++ head/sys/netinet/tcp_stacks/rack.c Wed Aug 21 10:45:28 2019 (r351328) @@ -7405,9 +7405,6 @@ again: (tp->t_state == TCPS_SYN_RECEIVED)) flags &= ~TH_SYN; #endif - sb_offset--, len++; - if (sbavail(sb) == 0) - len = 0; } /* * Be careful not to send data and/or FIN on SYN segments. This From owner-svn-src-head@freebsd.org Wed Aug 21 10:54:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 92A38C3E17; Wed, 21 Aug 2019 10:54:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46D4LP3LK6z3Jky; Wed, 21 Aug 2019 10:54:53 +0000 (UTC) (envelope-from bz@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5479D1A9BB; Wed, 21 Aug 2019 10:54:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7LAsrkc098156; Wed, 21 Aug 2019 10:54:53 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LAsqO9098153; Wed, 21 Aug 2019 10:54:52 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201908211054.x7LAsqO9098153@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 21 Aug 2019 10:54:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351329 - head/usr.bin/gprof X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/usr.bin/gprof X-SVN-Commit-Revision: 351329 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 10:54:53 -0000 Author: bz Date: Wed Aug 21 10:54:52 2019 New Revision: 351329 URL: https://svnweb.freebsd.org/changeset/base/351329 Log: gprof: disable building of a.out components On arm64, riscv, and s390x disable building of aout components. This allows gprof to build on these architectures which never supported the legacy a.out binary format. Obtained from: s390x branch MFC after: 3 months Modified: head/usr.bin/gprof/Makefile head/usr.bin/gprof/gprof.c head/usr.bin/gprof/gprof.h Modified: head/usr.bin/gprof/Makefile ============================================================================== --- head/usr.bin/gprof/Makefile Wed Aug 21 10:45:28 2019 (r351328) +++ head/usr.bin/gprof/Makefile Wed Aug 21 10:54:52 2019 (r351329) @@ -2,8 +2,14 @@ # $FreeBSD$ PROG= gprof -SRCS= gprof.c aout.c arcs.c dfn.c elf.c lookup.c hertz.c \ +SRCS= gprof.c arcs.c dfn.c elf.c lookup.c hertz.c \ printgprof.c printlist.c kernel.c + +.if ${MACHINE_ARCH} != "aarch64" && ${MACHINE_ARCH} != "riscv" && \ + ${MACHINE_ARCH} != "s390x" +SRCS+= aout.c +CFLAGS+= -DWITH_AOUT +.endif FILES= gprof.flat gprof.callg FILESDIR= ${SHAREDIR}/misc Modified: head/usr.bin/gprof/gprof.c ============================================================================== --- head/usr.bin/gprof/gprof.c Wed Aug 21 10:45:28 2019 (r351328) +++ head/usr.bin/gprof/gprof.c Wed Aug 21 10:54:52 2019 (r351329) @@ -160,8 +160,11 @@ main(int argc, char **argv) * get information from the executable file. */ if ((Kflag && kernel_getnfile(a_outname, &defaultEs) == -1) || - (!Kflag && elf_getnfile(a_outname, &defaultEs) == -1 && - aout_getnfile(a_outname, &defaultEs) == -1)) + (!Kflag && elf_getnfile(a_outname, &defaultEs) == -1 +#ifdef WITH_AOUT + && aout_getnfile(a_outname, &defaultEs) == -1 +#endif + )) errx(1, "%s: bad format", a_outname); /* * sort symbol table. Modified: head/usr.bin/gprof/gprof.h ============================================================================== --- head/usr.bin/gprof/gprof.h Wed Aug 21 10:45:28 2019 (r351328) +++ head/usr.bin/gprof/gprof.h Wed Aug 21 10:54:52 2019 (r351329) @@ -256,7 +256,9 @@ void addarc(nltype *, nltype *, long); bool addcycle(arctype **, arctype **); void addlist(struct stringlist *, char *); void alignentries(void); +#ifdef WITH_AOUT int aout_getnfile(const char *, char ***); +#endif int arccmp(arctype *, arctype *); arctype *arclookup(nltype *, nltype *); void asgnsamples(void); From owner-svn-src-head@freebsd.org Wed Aug 21 12:49:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 282D9C7C26; Wed, 21 Aug 2019 12:49:13 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay109.isp.belgacom.be (mailrelay109.isp.belgacom.be [195.238.20.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign Organization Validation CA - SHA256 - G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46D6tJ2JZ1z3QNy; Wed, 21 Aug 2019 12:49:11 +0000 (UTC) (envelope-from tijl@freebsd.org) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2CjAgCJPF1d/ygG91FlHAEBAQQBAQc?= =?us-ascii?q?EAQGBVgQBAQsBghdZFFIyFhSNG4YBAYIONQGIBIIfkDUJAQECAQEBAQErDAE?= =?us-ascii?q?BhD8CglkmNwYOAgUBAQUBAgEBBgRthGVCDIVLAQU6HCMQCw4GBAklD0gGE4M?= =?us-ascii?q?jgg4Lq2iENAELAYEIg3eBCgaBNAGMAIF/hCM+hESFYwSURV2WMwmCH4ZojUU?= =?us-ascii?q?nmEaEHpEgkjkigVhNMAiDJ4JOF4hjhUE9AzCNJwEB?= X-IPAS-Result: =?us-ascii?q?A2CjAgCJPF1d/ygG91FlHAEBAQQBAQcEAQGBVgQBAQsBg?= =?us-ascii?q?hdZFFIyFhSNG4YBAYIONQGIBIIfkDUJAQECAQEBAQErDAEBhD8CglkmNwYOA?= =?us-ascii?q?gUBAQUBAgEBBgRthGVCDIVLAQU6HCMQCw4GBAklD0gGE4Mjgg4Lq2iENAELA?= =?us-ascii?q?YEIg3eBCgaBNAGMAIF/hCM+hESFYwSURV2WMwmCH4ZojUUnmEaEHpEgkjkig?= =?us-ascii?q?VhNMAiDJ4JOF4hjhUE9AzCNJwEB?= Received: from 40.6-247-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.247.6.40]) by relay.skynet.be with ESMTP; 21 Aug 2019 14:49:09 +0200 Received: from localhost (localhost [127.0.0.1]) by kalimero.tijl.coosemans.org (8.15.2/8.15.2) with ESMTP id x7LCn8rn041401; Wed, 21 Aug 2019 14:49:08 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Date: Wed, 21 Aug 2019 14:49:08 +0200 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Dimitry Andric Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351253 - in head/contrib/libc++: include src Message-ID: <20190821144908.7137e6bc@FreeBSD.org> In-Reply-To: <201908201739.x7KHdXvv054610@repo.freebsd.org> References: <201908201739.x7KHdXvv054610@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46D6tJ2JZ1z3QNy X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.991,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; ASN(0.00)[asn:5432, ipnet:195.238.0.0/19, country:BE]; NEURAL_HAM_LONG(-1.00)[-0.998,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 12:49:13 -0000 On Tue, 20 Aug 2019 17:39:33 +0000 (UTC) Dimitry Andric wrote: > Author: dim > Date: Tue Aug 20 17:39:32 2019 > New Revision: 351253 > URL: https://svnweb.freebsd.org/changeset/base/351253 > > Log: > Pull in r368867 from upstream libc++ trunk (by Marshall Clow): > > Rework recursive_timed_mutex so that it uses __thread_id instead of > using the lower-level __libcpp_thread_id. This is prep for fixing > PR42918. Reviewed as https://reviews.llvm.org/D65895 > > Pull in r368916 from upstream libc++ trunk (by Marshall Clow): > > Fix thread comparison by making sure we never pass our special 'not a > thread' value to the underlying implementation. Fixes PR#42918. > > This should fix std::thread::id::operator==() attempting to call > pthread_equal(3) with zero values. > > Reported by: andrew@tao11.riddles.org.uk > PR: 239038, 239550 > MFC after: 3 days > > Modified: > head/contrib/libc++/include/__threading_support > head/contrib/libc++/include/mutex > head/contrib/libc++/include/thread > head/contrib/libc++/src/mutex.cpp > > Modified: head/contrib/libc++/include/__threading_support > ============================================================================== > --- head/contrib/libc++/include/__threading_support Tue Aug 20 17:00:31 2019 (r351252) > +++ head/contrib/libc++/include/__threading_support Tue Aug 20 17:39:32 2019 (r351253) > @@ -13,6 +13,7 @@ > > #include <__config> > #include > +#include > #include > > #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER > @@ -392,6 +393,86 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p > } > > #endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL > + > +class _LIBCPP_TYPE_VIS thread; This seems to break building Firefox: In file included from /home/root/obj/ports/home/tijl/projects/freebsd/ports/head/www/firefox/work/firefox-68.0.2/media/mtransport/nricectx.cpp:82: In file included from /home/root/obj/ports/home/tijl/projects/freebsd/ports/head/www/firefox/work/firefox-68.0.2/media/mtransport/third_party/nICEr/src/stun/stun_client_ctx.h:41: In file included from /home/root/obj/ports/home/tijl/projects/freebsd/ports/head/www/firefox/work/firefox-68.0.2/media/mtransport/third_party/nICEr/src/stun/stun.h:45: In file included from /usr/include/net/if_var.h:84: /usr/include/sys/lock.h:68:15: error: reference to 'thread' is ambiguous struct thread **owner); ^ /usr/include/sys/lock.h:42:8: note: candidate found by name lookup is 'thread' struct thread; ^ /usr/include/c++/v1/__threading_support:397:24: note: candidate found by name lookup is 'std::__1::thread' class _LIBCPP_TYPE_VIS thread; ^ This "class thread" conflicts with "struct thread" in sys/lock.h. Should everything in sys/lock.h be under #ifdef _KERNEL? From owner-svn-src-head@freebsd.org Wed Aug 21 13:07:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7292C8484; Wed, 21 Aug 2019 13:07:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46D7Hy5sYpz3wnn; Wed, 21 Aug 2019 13:07:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 618AF4521; Wed, 21 Aug 2019 13:07:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [192.168.1.58] (92-111-45-100.static.v4.ziggozakelijk.nl [92.111.45.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 2E063252; Wed, 21 Aug 2019 15:07:57 +0200 (CEST) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_CF6FB93D-1E70-4E41-974C-55A7A4FCF69D"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r351253 - in head/contrib/libc++: include src Date: Wed, 21 Aug 2019 15:07:56 +0200 In-Reply-To: <20190821144908.7137e6bc@FreeBSD.org> Cc: src-committers , svn-src-all , svn-src-head@freebsd.org, Marshall Clow To: =?utf-8?Q?T=C4=B3l_Coosemans?= References: <201908201739.x7KHdXvv054610@repo.freebsd.org> <20190821144908.7137e6bc@FreeBSD.org> X-Mailer: Apple Mail (2.3445.104.11) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 13:07:59 -0000 --Apple-Mail=_CF6FB93D-1E70-4E41-974C-55A7A4FCF69D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On 21 Aug 2019, at 14:49, T=C4=B3l Coosemans wrote: >=20 > On Tue, 20 Aug 2019 17:39:33 +0000 (UTC) Dimitry Andric > wrote: >> Author: dim >> Date: Tue Aug 20 17:39:32 2019 >> New Revision: 351253 >> URL: https://svnweb.freebsd.org/changeset/base/351253 >>=20 >> Log: >> Pull in r368867 from upstream libc++ trunk (by Marshall Clow): >>=20 >> Rework recursive_timed_mutex so that it uses __thread_id instead = of >> using the lower-level __libcpp_thread_id. This is prep for fixing >> PR42918. Reviewed as https://reviews.llvm.org/D65895 >>=20 >> Pull in r368916 from upstream libc++ trunk (by Marshall Clow): >>=20 >> Fix thread comparison by making sure we never pass our special = 'not a >> thread' value to the underlying implementation. Fixes PR#42918. >>=20 >> This should fix std::thread::id::operator=3D=3D() attempting to call >> pthread_equal(3) with zero values. ... > This seems to break building Firefox: >=20 > In file included from = /home/root/obj/ports/home/tijl/projects/freebsd/ports/head/www/firefox/wor= k/firefox-68.0.2/media/mtransport/nricectx.cpp:82: > In file included from = /home/root/obj/ports/home/tijl/projects/freebsd/ports/head/www/firefox/wor= k/firefox-68.0.2/media/mtransport/third_party/nICEr/src/stun/stun_client_c= tx.h:41: > In file included from = /home/root/obj/ports/home/tijl/projects/freebsd/ports/head/www/firefox/wor= k/firefox-68.0.2/media/mtransport/third_party/nICEr/src/stun/stun.h:45: > In file included from /usr/include/net/if_var.h:84: > /usr/include/sys/lock.h:68:15: error: reference to 'thread' is = ambiguous > struct thread **owner); > ^ > /usr/include/sys/lock.h:42:8: note: candidate found by name lookup is = 'thread' > struct thread; > ^ > /usr/include/c++/v1/__threading_support:397:24: note: candidate found = by name > lookup is 'std::__1::thread' > class _LIBCPP_TYPE_VIS thread; > ^ >=20 >=20 > This "class thread" conflicts with "struct thread" in sys/lock.h. > Should everything in sys/lock.h be under #ifdef _KERNEL? Maybe, but is Firefox using "using namespace std;" here? It is a likely explanation for the ambiguity between the global struct thread from sys/lock.h, and std::thread from libc++. -Dimitry --Apple-Mail=_CF6FB93D-1E70-4E41-974C-55A7A4FCF69D Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXV1CLAAKCRCwXqMKLiCW ox00AJ94I76mMSoo1TroHaI8A6k+KaAz9wCfen99CTsq3xdljkYIPUC2ZtXpEEA= =3WIy -----END PGP SIGNATURE----- --Apple-Mail=_CF6FB93D-1E70-4E41-974C-55A7A4FCF69D-- From owner-svn-src-head@freebsd.org Wed Aug 21 13:20:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6AA58C8794; Wed, 21 Aug 2019 13:20:06 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay109.isp.belgacom.be (mailrelay109.isp.belgacom.be [195.238.20.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign Organization Validation CA - SHA256 - G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46D7Yx6K45z3xLq; Wed, 21 Aug 2019 13:20:05 +0000 (UTC) (envelope-from tijl@freebsd.org) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2DQCgC0RF1d/ygG91FlHAEBAQQBAQc?= =?us-ascii?q?EAQGBZ4IYWRRSMhYUhB+IfIYCAYIONQGIBIIfkDUJAQEBMQwBAYQ/AoJZJjg?= =?us-ascii?q?TAgUBAQUBAgEBBgRthGVCDIVLAQUjMyMQCw4GBAICBSECAg9IBhODI4IOC6o?= =?us-ascii?q?3gTKENAELAYUBgQoGgQwojAGBf4QjPoREgwuCWASURZcQCYIfhmiNRSeYRoQ?= =?us-ascii?q?ekSCSOiGBWE0wCIMni0iFQT0DMI0nAQE?= X-IPAS-Result: =?us-ascii?q?A2DQCgC0RF1d/ygG91FlHAEBAQQBAQcEAQGBZ4IYWRRSM?= =?us-ascii?q?hYUhB+IfIYCAYIONQGIBIIfkDUJAQEBMQwBAYQ/AoJZJjgTAgUBAQUBAgEBB?= =?us-ascii?q?gRthGVCDIVLAQUjMyMQCw4GBAICBSECAg9IBhODI4IOC6o3gTKENAELAYUBg?= =?us-ascii?q?QoGgQwojAGBf4QjPoREgwuCWASURZcQCYIfhmiNRSeYRoQekSCSOiGBWE0wC?= =?us-ascii?q?IMni0iFQT0DMI0nAQE?= Received: from 40.6-247-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.247.6.40]) by relay.skynet.be with ESMTP; 21 Aug 2019 15:20:05 +0200 Received: from localhost (localhost [127.0.0.1]) by kalimero.tijl.coosemans.org (8.15.2/8.15.2) with ESMTP id x7LDK3Pa041528; Wed, 21 Aug 2019 15:20:03 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Date: Wed, 21 Aug 2019 15:20:03 +0200 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Dimitry Andric Cc: src-committers , svn-src-all , svn-src-head@freebsd.org, Marshall Clow Subject: Re: svn commit: r351253 - in head/contrib/libc++: include src Message-ID: <20190821151949.00c9845c@FreeBSD.org> In-Reply-To: References: <201908201739.x7KHdXvv054610@repo.freebsd.org> <20190821144908.7137e6bc@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 46D7Yx6K45z3xLq X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.989,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.949,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 13:20:06 -0000 On Wed, 21 Aug 2019 15:07:56 +0200 Dimitry Andric wrote: > On 21 Aug 2019, at 14:49, T=C4=B3l Coosemans wrote: >> On Tue, 20 Aug 2019 17:39:33 +0000 (UTC) Dimitry Andric >> wrote: =20 >>> Author: dim >>> Date: Tue Aug 20 17:39:32 2019 >>> New Revision: 351253 >>> URL: https://svnweb.freebsd.org/changeset/base/351253 >>>=20 >>> Log: >>> Pull in r368867 from upstream libc++ trunk (by Marshall Clow): >>>=20 >>> Rework recursive_timed_mutex so that it uses __thread_id instead of >>> using the lower-level __libcpp_thread_id. This is prep for fixing >>> PR42918. Reviewed as https://reviews.llvm.org/D65895 >>>=20 >>> Pull in r368916 from upstream libc++ trunk (by Marshall Clow): >>>=20 >>> Fix thread comparison by making sure we never pass our special 'not a >>> thread' value to the underlying implementation. Fixes PR#42918. >>>=20 >>> This should fix std::thread::id::operator=3D=3D() attempting to call >>> pthread_equal(3) with zero values. =20 > ... >> This seems to break building Firefox: >>=20 >> In file included from /usr/ports/www/firefox/work/firefox-68.0.2/media/m= transport/nricectx.cpp:82: >> In file included from /usr/ports/www/firefox/work/firefox-68.0.2/media/m= transport/third_party/nICEr/src/stun/stun_client_ctx.h:41: >> In file included from /usr/ports/www/firefox/work/firefox-68.0.2/media/m= transport/third_party/nICEr/src/stun/stun.h:45: >> In file included from /usr/include/net/if_var.h:84: >> /usr/include/sys/lock.h:68:15: error: reference to 'thread' is ambiguous >> struct thread **owner); >> ^ >> /usr/include/sys/lock.h:42:8: note: candidate found by name lookup is 't= hread' >> struct thread; >> ^ >> /usr/include/c++/v1/__threading_support:397:24: note: candidate found by= name >> lookup is 'std::__1::thread' >> class _LIBCPP_TYPE_VIS thread; >> ^ >>=20 >> This "class thread" conflicts with "struct thread" in sys/lock.h. >> Should everything in sys/lock.h be under #ifdef _KERNEL? =20 >=20 > Maybe, but is Firefox using "using namespace std;" here? It is a likely > explanation for the ambiguity between the global struct thread from > sys/lock.h, and std::thread from libc++. Yes, several headers in media/mtransport/third_party/nICEr/src start with: #ifdef __cplusplus using namespace std; extern "C" { #endif /* __cplusplus */ From owner-svn-src-head@freebsd.org Wed Aug 21 14:52:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4180CA7EE; Wed, 21 Aug 2019 14:52:13 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46D9cF3vSGz42mg; Wed, 21 Aug 2019 14:52:13 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5CE901D4FA; Wed, 21 Aug 2019 14:52:13 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7LEqDiq036968; Wed, 21 Aug 2019 14:52:13 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LEqDJt036967; Wed, 21 Aug 2019 14:52:13 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908211452.x7LEqDJt036967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 21 Aug 2019 14:52:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351330 - head/sbin/ping X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/ping X-SVN-Commit-Revision: 351330 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 14:52:13 -0000 Author: asomers Date: Wed Aug 21 14:52:12 2019 New Revision: 351330 URL: https://svnweb.freebsd.org/changeset/base/351330 Log: ping: do reverse DNS lookup of the target address When printing replies, ping will now attempt a reverse DNS lookup of the target. That can be suppressed by using the "-n" option. Curiously, ping has always done reverse lookups in certain error paths, but never in the success path. Submitted by: Ján Sučan MFC after: 2 weeks Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21351 Modified: head/sbin/ping/ping.c Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Wed Aug 21 10:54:52 2019 (r351329) +++ head/sbin/ping/ping.c Wed Aug 21 14:52:12 2019 (r351330) @@ -1168,8 +1168,7 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s (void)write(STDOUT_FILENO, &BSPACE, 1); else { (void)printf("%d bytes from %s: icmp_seq=%u", cc, - inet_ntoa(*(struct in_addr *)&from->sin_addr.s_addr), - seq); + pr_addr(from->sin_addr), seq); (void)printf(" ttl=%d", ip->ip_ttl); if (timing) (void)printf(" time=%.3f ms", triptime); From owner-svn-src-head@freebsd.org Wed Aug 21 15:52:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 58A7FCBFE6; Wed, 21 Aug 2019 15:52:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DBxR1hmmz46NZ; Wed, 21 Aug 2019 15:52:11 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BEC01DFF6; Wed, 21 Aug 2019 15:52:11 +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 x7LFqAtC073931; Wed, 21 Aug 2019 15:52:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LFqAKP073930; Wed, 21 Aug 2019 15:52:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908211552.x7LFqAKP073930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 21 Aug 2019 15:52:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351331 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 351331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 15:52:11 -0000 Author: markj Date: Wed Aug 21 15:52:10 2019 New Revision: 351331 URL: https://svnweb.freebsd.org/changeset/base/351331 Log: Don't requeue active pages in vm_swapout_object_deactivate_pages(). As of r332974 the page daemon does not requeue pages during a scan of the active queue, so there is not much value in doing so here either. Reviewed by: alc, dougm, kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21343 Modified: head/sys/vm/vm_swapout.c Modified: head/sys/vm/vm_swapout.c ============================================================================== --- head/sys/vm/vm_swapout.c Wed Aug 21 14:52:12 2019 (r351330) +++ head/sys/vm/vm_swapout.c Wed Aug 21 15:52:10 2019 (r351331) @@ -226,20 +226,22 @@ vm_swapout_object_deactivate_pages(pmap_t pmap, vm_obj vm_page_activate(p); p->act_count += act_delta; } else if (vm_page_active(p)) { + /* + * The page daemon does not requeue pages + * after modifying their activation count. + */ if (act_delta == 0) { p->act_count -= min(p->act_count, ACT_DECLINE); if (!remove_mode && p->act_count == 0) { pmap_remove_all(p); vm_page_deactivate(p); - } else - vm_page_requeue(p); + } } else { vm_page_activate(p); if (p->act_count < ACT_MAX - ACT_ADVANCE) p->act_count += ACT_ADVANCE; - vm_page_requeue(p); } } else if (vm_page_inactive(p)) pmap_remove_all(p); From owner-svn-src-head@freebsd.org Wed Aug 21 15:52:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 462EDCC04C; Wed, 21 Aug 2019 15:52:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46DBy07392z46XT; Wed, 21 Aug 2019 15:52:40 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x7LFqVVi064194 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 21 Aug 2019 18:52:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x7LFqVVi064194 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x7LFqVQ7064193; Wed, 21 Aug 2019 18:52:31 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 21 Aug 2019 18:52:31 +0300 From: Konstantin Belousov To: =?utf-8?Q?T=C4=B3l?= Coosemans Cc: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351253 - in head/contrib/libc++: include src Message-ID: <20190821155231.GQ71821@kib.kiev.ua> References: <201908201739.x7KHdXvv054610@repo.freebsd.org> <20190821144908.7137e6bc@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190821144908.7137e6bc@FreeBSD.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 46DBy07392z46XT X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.90 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; NEURAL_HAM_SHORT(-0.90)[-0.901,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 15:52:41 -0000 On Wed, Aug 21, 2019 at 02:49:08PM +0200, Tijl Coosemans wrote: > On Tue, 20 Aug 2019 17:39:33 +0000 (UTC) Dimitry Andric > wrote: > > Author: dim > > Date: Tue Aug 20 17:39:32 2019 > > New Revision: 351253 > > URL: https://svnweb.freebsd.org/changeset/base/351253 > > > > Log: > > Pull in r368867 from upstream libc++ trunk (by Marshall Clow): > > > > Rework recursive_timed_mutex so that it uses __thread_id instead of > > using the lower-level __libcpp_thread_id. This is prep for fixing > > PR42918. Reviewed as https://reviews.llvm.org/D65895 > > > > Pull in r368916 from upstream libc++ trunk (by Marshall Clow): > > > > Fix thread comparison by making sure we never pass our special 'not a > > thread' value to the underlying implementation. Fixes PR#42918. > > > > This should fix std::thread::id::operator==() attempting to call > > pthread_equal(3) with zero values. > > > > Reported by: andrew@tao11.riddles.org.uk > > PR: 239038, 239550 > > MFC after: 3 days > > > > Modified: > > head/contrib/libc++/include/__threading_support > > head/contrib/libc++/include/mutex > > head/contrib/libc++/include/thread > > head/contrib/libc++/src/mutex.cpp > > > > Modified: head/contrib/libc++/include/__threading_support > > ============================================================================== > > --- head/contrib/libc++/include/__threading_support Tue Aug 20 17:00:31 2019 (r351252) > > +++ head/contrib/libc++/include/__threading_support Tue Aug 20 17:39:32 2019 (r351253) > > @@ -13,6 +13,7 @@ > > > > #include <__config> > > #include > > +#include > > #include > > > > #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER > > @@ -392,6 +393,86 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p > > } > > > > #endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL > > + > > +class _LIBCPP_TYPE_VIS thread; > > This seems to break building Firefox: > > In file included from /home/root/obj/ports/home/tijl/projects/freebsd/ports/head/www/firefox/work/firefox-68.0.2/media/mtransport/nricectx.cpp:82: > In file included from /home/root/obj/ports/home/tijl/projects/freebsd/ports/head/www/firefox/work/firefox-68.0.2/media/mtransport/third_party/nICEr/src/stun/stun_client_ctx.h:41: > In file included from /home/root/obj/ports/home/tijl/projects/freebsd/ports/head/www/firefox/work/firefox-68.0.2/media/mtransport/third_party/nICEr/src/stun/stun.h:45: > In file included from /usr/include/net/if_var.h:84: > /usr/include/sys/lock.h:68:15: error: reference to 'thread' is ambiguous > struct thread **owner); > ^ > /usr/include/sys/lock.h:42:8: note: candidate found by name lookup is 'thread' > struct thread; > ^ > /usr/include/c++/v1/__threading_support:397:24: note: candidate found by name > lookup is 'std::__1::thread' > class _LIBCPP_TYPE_VIS thread; > ^ > > > This "class thread" conflicts with "struct thread" in sys/lock.h. > Should everything in sys/lock.h be under #ifdef _KERNEL? Why does firefox pulls if_var.h at all ? (As I understand, this is how the pollution occurs.) From owner-svn-src-head@freebsd.org Wed Aug 21 16:01:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECFA4CC452; Wed, 21 Aug 2019 16:01:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DC7x5J93z477j; Wed, 21 Aug 2019 16:01:17 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 936911E067; Wed, 21 Aug 2019 16:01:17 +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 x7LG1Hs4076084; Wed, 21 Aug 2019 16:01:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LG1HLd076083; Wed, 21 Aug 2019 16:01:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908211601.x7LG1HLd076083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 21 Aug 2019 16:01:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351332 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 351332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 16:01:18 -0000 Author: markj Date: Wed Aug 21 16:01:17 2019 New Revision: 351332 URL: https://svnweb.freebsd.org/changeset/base/351332 Log: Unconditionally enable debug.vm_lowmem. It is useful for testing purposes to be able to drain UMA caches, so do not limit the sysctl to DIAGNOSTIC kernels. MFC after: 1 week Sponsored by: Netflix Modified: head/sys/vm/vm_kern.c Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Wed Aug 21 15:52:10 2019 (r351331) +++ head/sys/vm/vm_kern.c Wed Aug 21 16:01:17 2019 (r351332) @@ -839,7 +839,6 @@ kmem_bootstrap_free(vm_offset_t start, vm_size_t size) #endif } -#ifdef DIAGNOSTIC /* * Allow userspace to directly trigger the VM drain routine for testing * purposes. @@ -862,4 +861,3 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, CTLTYPE_INT | CTLFLAG_RW, 0, 0, debug_vm_lowmem, "I", "set to trigger vm_lowmem event with given flags"); -#endif From owner-svn-src-head@freebsd.org Wed Aug 21 16:02:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D7FDCC65F; Wed, 21 Aug 2019 16:02:01 +0000 (UTC) (envelope-from mclow.lists@gmail.com) Received: from mail-vs1-xe29.google.com (mail-vs1-xe29.google.com [IPv6:2607:f8b0:4864:20::e29]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DC8m71Dpz47P4; Wed, 21 Aug 2019 16:02:00 +0000 (UTC) (envelope-from mclow.lists@gmail.com) Received: by mail-vs1-xe29.google.com with SMTP id i128so1720020vsc.7; Wed, 21 Aug 2019 09:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5UdbzTow5/mXNO03bJS7WeaJSWN9Eht+8sSN+1eDm88=; b=I5bU7Co3IszA01oTHzkxhpfyOlT/y0rO2SpJIAEkwphGPJzPY2cCJWJ9x/AUUnU8XO mkUCSm4JMgw8Q66PHdz0sgqf92OS9hBTE3ws6IANVRlpBvCypDn+8pygSE+x3g/sFLAr HFVniXbG5KBIORi8aSQL+EQbR5qwXU86ibDA+DtJmplpWCn8ozpj7pGi0alk+MmP0khd GDpFim9PjftdTHJfWfl3nJNeBSvPVrYR167rJcDejOms4KM9uLxaOhmQUgUZNZquOo/f v7PxW2/JZcrVXQFjIsZMeSRpO0WSydE/DCwPn164e6a+fhk2rijAq8HJLGerYH28PtcT o4Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5UdbzTow5/mXNO03bJS7WeaJSWN9Eht+8sSN+1eDm88=; b=TP9TS5Q4J/D3tUTHoKZlkRel+mE7IG0/BANRkJ6XITOMxdFCqrqeM2HCZzoOeyyuLK M5OrFYW7i+OKtLDAxAsXGJeOheeSputdKw5SfI8LygnWYb1sBl3U+sC7mei9eBvyGA7Y JlDgVvbZA9tS72Hyy7Rk/LJNundt0wUVwWmBc4yn8h2hGa8VdND6qcvcCLs8qQJd3Php 5cNrV1p2DBoRTx96VDddeIF/REElaQCKRieNjpCpup9AJ9K6NWgWoyWUpr9kT+ycgEW1 Ry5lBB31B3/CBHLTKvPp+QjktPe8sIGevqJmPzXGAffLBt6RsdNVh/VRLJ+qnMdGq/T+ ShqA== X-Gm-Message-State: APjAAAUgBf4VMcLYmiXo9eJYVkElbbtaNvZztwcj5cMV9mexeXbX5MAN HHcfXxVzyp5BeJwVEFRLA16LAzzR5F5TK1W2EFENdQ== X-Google-Smtp-Source: APXvYqx93Z/Aij0qB53lKm2I1/PVex3dS9dsFDVrX8gUMHoNpwvAMVb37Pd5AFZeniKVTiErEIP/k55PBNVdcLFauB8= X-Received: by 2002:a67:fc14:: with SMTP id o20mr14403200vsq.160.1566403319556; Wed, 21 Aug 2019 09:01:59 -0700 (PDT) MIME-Version: 1.0 References: <201908201739.x7KHdXvv054610@repo.freebsd.org> <20190821144908.7137e6bc@FreeBSD.org> <20190821151949.00c9845c@FreeBSD.org> In-Reply-To: <20190821151949.00c9845c@FreeBSD.org> From: Marshall Clow Date: Wed, 21 Aug 2019 09:01:48 -0700 Message-ID: Subject: Re: svn commit: r351253 - in head/contrib/libc++: include src To: =?UTF-8?Q?T=C4=B3l_Coosemans?= Cc: Dimitry Andric , src-committers , svn-src-all , svn-src-head@freebsd.org X-Rspamd-Queue-Id: 46DC8m71Dpz47P4 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 16:02:01 -0000 On Wed, Aug 21, 2019 at 6:20 AM T=C4=B3l Coosemans wrote= : > On Wed, 21 Aug 2019 15:07:56 +0200 Dimitry Andric > wrote: > > On 21 Aug 2019, at 14:49, T=C4=B3l Coosemans wrote: > >> On Tue, 20 Aug 2019 17:39:33 +0000 (UTC) Dimitry Andric > >> wrote: > >>> Author: dim > >>> Date: Tue Aug 20 17:39:32 2019 > >>> New Revision: 351253 > >>> URL: https://svnweb.freebsd.org/changeset/base/351253 > >>> > >>> Log: > >>> Pull in r368867 from upstream libc++ trunk (by Marshall Clow): > >>> > >>> Rework recursive_timed_mutex so that it uses __thread_id instead o= f > >>> using the lower-level __libcpp_thread_id. This is prep for fixing > >>> PR42918. Reviewed as https://reviews.llvm.org/D65895 > >>> > >>> Pull in r368916 from upstream libc++ trunk (by Marshall Clow): > >>> > >>> Fix thread comparison by making sure we never pass our special 'no= t > a > >>> thread' value to the underlying implementation. Fixes PR#42918. > >>> > >>> This should fix std::thread::id::operator=3D=3D() attempting to call > >>> pthread_equal(3) with zero values. > > ... > >> This seems to break building Firefox: > >> > >> In file included from > /usr/ports/www/firefox/work/firefox-68.0.2/media/mtransport/nricectx.cpp:= 82: > >> In file included from > /usr/ports/www/firefox/work/firefox-68.0.2/media/mtransport/third_party/n= ICEr/src/stun/stun_client_ctx.h:41: > >> In file included from > /usr/ports/www/firefox/work/firefox-68.0.2/media/mtransport/third_party/n= ICEr/src/stun/stun.h:45: > >> In file included from /usr/include/net/if_var.h:84: > >> /usr/include/sys/lock.h:68:15: error: reference to 'thread' is ambiguo= us > >> struct thread **owner); > >> ^ > >> /usr/include/sys/lock.h:42:8: note: candidate found by name lookup is > 'thread' > >> struct thread; > >> ^ > >> /usr/include/c++/v1/__threading_support:397:24: note: candidate found > by name > >> lookup is 'std::__1::thread' > >> class _LIBCPP_TYPE_VIS thread; > >> ^ > >> > >> This "class thread" conflicts with "struct thread" in sys/lock.h. > >> Should everything in sys/lock.h be under #ifdef _KERNEL? > > > > Maybe, but is Firefox using "using namespace std;" here? It is a likel= y > > explanation for the ambiguity between the global struct thread from > > sys/lock.h, and std::thread from libc++. > > Yes, several headers in media/mtransport/third_party/nICEr/src start > with: > > #ifdef __cplusplus > using namespace std; > extern "C" { > #endif /* __cplusplus */ > libc++ has always had a `std::thread` struct. The change here is that forward declaration moved from to <__threading_support>, and that was included by . -- Marshall From owner-svn-src-head@freebsd.org Wed Aug 21 16:11:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0793CCB70; Wed, 21 Aug 2019 16:11:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DCMP66CCz47qg; Wed, 21 Aug 2019 16:11:13 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3CEF1E225; Wed, 21 Aug 2019 16:11:13 +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 x7LGBD2T081908; Wed, 21 Aug 2019 16:11:13 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LGBD8Z081905; Wed, 21 Aug 2019 16:11:13 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908211611.x7LGBD8Z081905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 21 Aug 2019 16:11:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351333 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 351333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 16:11:14 -0000 Author: markj Date: Wed Aug 21 16:11:12 2019 New Revision: 351333 URL: https://svnweb.freebsd.org/changeset/base/351333 Log: Simplify vm_page_dequeue() and fix an assertion. - Add a vm_pagequeue_remove() function to physically remove a page from its queue and update the queue length. - Remove vm_page_pagequeue_lockptr() and let vm_page_pagequeue() return NULL for dequeued pages. - Avoid unnecessarily reloading the queue index if vm_page_dequeue() loses a race with a concurrent queue operation. - Correct an always-true assertion: vm_page_dequeue() may be called from the page allocator with the page unlocked. The assertion m->order == VM_NFREEORDER simply tests whether the page has been removed from the vm_phys free lists; instead, check whether the page belongs to an object. Reviewed by: kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21341 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pagequeue.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Aug 21 16:01:17 2019 (r351332) +++ head/sys/vm/vm_page.c Wed Aug 21 16:11:12 2019 (r351333) @@ -3056,21 +3056,15 @@ vm_waitpfault(struct domainset *dset, int timo) mtx_unlock(&vm_domainset_lock); } -struct vm_pagequeue * +static struct vm_pagequeue * vm_page_pagequeue(vm_page_t m) { - return (&vm_pagequeue_domain(m)->vmd_pagequeues[m->queue]); -} - -static struct mtx * -vm_page_pagequeue_lockptr(vm_page_t m) -{ uint8_t queue; if ((queue = atomic_load_8(&m->queue)) == PQ_NONE) return (NULL); - return (&vm_pagequeue_domain(m)->vmd_pagequeues[queue].pq_mutex); + return (&vm_pagequeue_domain(m)->vmd_pagequeues[queue]); } static inline void @@ -3093,10 +3087,8 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa m, pq, qflags)); if ((qflags & PGA_DEQUEUE) != 0) { - if (__predict_true((qflags & PGA_ENQUEUED) != 0)) { - TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); - vm_pagequeue_cnt_dec(pq); - } + if (__predict_true((qflags & PGA_ENQUEUED) != 0)) + vm_pagequeue_remove(pq, m); vm_page_dequeue_complete(m); } else if ((qflags & (PGA_REQUEUE | PGA_REQUEUE_HEAD)) != 0) { if ((qflags & PGA_ENQUEUED) != 0) @@ -3299,16 +3291,14 @@ vm_page_dequeue_deferred_free(vm_page_t m) void vm_page_dequeue(vm_page_t m) { - struct mtx *lock, *lock1; - struct vm_pagequeue *pq; + struct vm_pagequeue *pq, *pq1; uint8_t aflags; - KASSERT(mtx_owned(vm_page_lockptr(m)) || m->order == VM_NFREEORDER, + KASSERT(mtx_owned(vm_page_lockptr(m)) || m->object == NULL, ("page %p is allocated and unlocked", m)); - for (;;) { - lock = vm_page_pagequeue_lockptr(m); - if (lock == NULL) { + for (pq = vm_page_pagequeue(m);; pq = pq1) { + if (pq == NULL) { /* * A thread may be concurrently executing * vm_page_dequeue_complete(). Ensure that all queue @@ -3327,27 +3317,24 @@ vm_page_dequeue(vm_page_t m) * critical section. */ cpu_spinwait(); + pq1 = vm_page_pagequeue(m); continue; } - mtx_lock(lock); - if ((lock1 = vm_page_pagequeue_lockptr(m)) == lock) + vm_pagequeue_lock(pq); + if ((pq1 = vm_page_pagequeue(m)) == pq) break; - mtx_unlock(lock); - lock = lock1; + vm_pagequeue_unlock(pq); } - KASSERT(lock == vm_page_pagequeue_lockptr(m), + KASSERT(pq == vm_page_pagequeue(m), ("%s: page %p migrated directly between queues", __func__, m)); KASSERT((m->aflags & PGA_DEQUEUE) != 0 || mtx_owned(vm_page_lockptr(m)), ("%s: queued unlocked page %p", __func__, m)); - if ((m->aflags & PGA_ENQUEUED) != 0) { - pq = vm_page_pagequeue(m); - TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); - vm_pagequeue_cnt_dec(pq); - } + if ((m->aflags & PGA_ENQUEUED) != 0) + vm_pagequeue_remove(pq, m); vm_page_dequeue_complete(m); - mtx_unlock(lock); + vm_pagequeue_unlock(pq); } /* Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Wed Aug 21 16:01:17 2019 (r351332) +++ head/sys/vm/vm_page.h Wed Aug 21 16:11:12 2019 (r351333) @@ -552,7 +552,6 @@ 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 *); -struct vm_pagequeue *vm_page_pagequeue(vm_page_t m); vm_page_t vm_page_prev(vm_page_t m); bool vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip_m); void vm_page_putfake(vm_page_t m); Modified: head/sys/vm/vm_pagequeue.h ============================================================================== --- head/sys/vm/vm_pagequeue.h Wed Aug 21 16:01:17 2019 (r351332) +++ head/sys/vm/vm_pagequeue.h Wed Aug 21 16:11:12 2019 (r351333) @@ -199,6 +199,14 @@ vm_pagequeue_cnt_add(struct vm_pagequeue *pq, int adde #define vm_pagequeue_cnt_dec(pq) vm_pagequeue_cnt_add((pq), -1) static inline void +vm_pagequeue_remove(struct vm_pagequeue *pq, vm_page_t m) +{ + + TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); + vm_pagequeue_cnt_dec(pq); +} + +static inline void vm_batchqueue_init(struct vm_batchqueue *bq) { From owner-svn-src-head@freebsd.org Wed Aug 21 16:47:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B860CE1EF for ; Wed, 21 Aug 2019 16:47:17 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46DD911T3Fz4CvQ for ; Wed, 21 Aug 2019 16:47:16 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1566406035; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=VudpuNK5ZBwLJAfcfJ8oNTEQqL1CBgyQG3tfvCXa9qvR1GezNBAd89tUGDSKjAXxGcJ/wLDOpet87 AXGulIhm6IL1gqjb+uYikF3AePmDQmAHM10w24mIbFWNMRBjqCEfP7lmgMc80f3+hP7McotlgwwUes cSsgBbNFlPoWYb/IbEQRHt+woqsxlEWi4eN4LqtwCQtGHUDSutKOgsOe70Fv6JL4rQ2fBhK8YkLXBo wE5tNJc8uZOyINuxW9KD4t2oDBoLokhVgdNetNgJntIK2meRZIv79EbJ/U0cR0FD7FLUkAM+cYEAW1 dNDA83c1Q7CFdPtFdvWDxBDdv8LZQxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=vQ2KC4pbh1V1SPTtlTq4b+QhnPG98/d8uu8BatM3KHA=; b=q4LlDGLMFLuKt8D2UZ31lJcgFKNKbBtlNdNSHBdgtq24++UdkWV3xWTLVMxc2noJgkjP/hbG4zVJF LX5FmaboVGcqNk7cYXbMp/zLnFdRvqnFBTCDNimL/ancMFErjm4258nwn0ViKui/lW+qS7+Ee0Edqf 4/jh1aNNFUJcuXTpG+B2wzhtd0rnZ1cZl1jJRRnYFHhJ/Wx+3NqNgNT8v/v4DN6CFIAOl/zOcFjqv7 ZMSa2SArT+nZKx+x+f7GXAnNaFpI2EMrYZQE3z9RKc5y86oCbOr/yQ5JALN7ER0vrKBjp9P2gX5oge PSXkn8Vi+HN9r2DHlV3RXalOhoNkS8w== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=vQ2KC4pbh1V1SPTtlTq4b+QhnPG98/d8uu8BatM3KHA=; b=dyfAS81Racvni55bJtPLS2rtrzzscXoH19AQJ2M2ptbKNf/YvF0ih9cS/WlCybsJLE27/A2HK9Wyg iJBoq78A+nC3gjTd5uI/R++3RI+jhCIkMFEC23ZqICkp638UKyzb0lvohnIQOGiA1W18NT9qme3DB6 jb1yaEgZN1quChXklCFbmMTJRq0O1dSERrYYY5nCq6ZUuQVrJHxtmnAu6z71U0l+OcqVuyOSGTCUW/ oxAnGshHebRCMwPRb+5ino54Fd9XB+pax4BzVS3HY85HdxaZMcrpRxpX75zE6ufQym0RAithnV8NZU BjHhJ08u4mTj7iib9Hq7lW2mjU+iTTQ== X-MHO-RoutePath: aGlwcGll X-MHO-User: 53752a5b-c433-11e9-85ec-13b9aae3a1d2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 53752a5b-c433-11e9-85ec-13b9aae3a1d2; Wed, 21 Aug 2019 16:47:14 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x7LGlDrN084700; Wed, 21 Aug 2019 10:47:13 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <2722bd2586be8b60720bd634238e63f629b60c50.camel@freebsd.org> Subject: Re: svn commit: r351253 - in head/contrib/libc++: include src From: Ian Lepore To: Marshall Clow , T Coosemans Cc: Dimitry Andric , src-committers , svn-src-all , svn-src-head@freebsd.org Date: Wed, 21 Aug 2019 10:47:13 -0600 In-Reply-To: References: <201908201739.x7KHdXvv054610@repo.freebsd.org> <20190821144908.7137e6bc@FreeBSD.org> <20190821151949.00c9845c@FreeBSD.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 46DD911T3Fz4CvQ X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TAGGED_RCPT(0.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.981,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 16:47:17 -0000 On Wed, 2019-08-21 at 09:01 -0700, Marshall Clow wrote: > On Wed, Aug 21, 2019 at 6:20 AM Tijl Coosemans > wrote: > > > On Wed, 21 Aug 2019 15:07:56 +0200 Dimitry Andric > > wrote: > > > On 21 Aug 2019, at 14:49, Tijl Coosemans wrote: > > > > On Tue, 20 Aug 2019 17:39:33 +0000 (UTC) Dimitry Andric > > > > wrote: > > > > > Author: dim > > > > > Date: Tue Aug 20 17:39:32 2019 > > > > > New Revision: 351253 > > > > > URL: https://svnweb.freebsd.org/changeset/base/351253 > > > > > > > > > > Log: > > > > > Pull in r368867 from upstream libc++ trunk (by Marshall > > > > > Clow): > > > > > > > > > > Rework recursive_timed_mutex so that it uses __thread_id > > > > > instead of > > > > > using the lower-level __libcpp_thread_id. This is prep for > > > > > fixing > > > > > PR42918. Reviewed as https://reviews.llvm.org/D65895 > > > > > > > > > > Pull in r368916 from upstream libc++ trunk (by Marshall > > > > > Clow): > > > > > > > > > > Fix thread comparison by making sure we never pass our > > > > > special 'not > > > > a > > > > > thread' value to the underlying implementation. Fixes > > > > > PR#42918. > > > > > > > > > > This should fix std::thread::id::operator==() attempting to > > > > > call > > > > > pthread_equal(3) with zero values. > > > > > > ... > > > > This seems to break building Firefox: > > > > > > > > In file included from > > > > /usr/ports/www/firefox/work/firefox- > > 68.0.2/media/mtransport/nricectx.cpp:82: > > > > In file included from > > > > /usr/ports/www/firefox/work/firefox- > > 68.0.2/media/mtransport/third_party/nICEr/src/stun/stun_client_ctx. > > h:41: > > > > In file included from > > > > /usr/ports/www/firefox/work/firefox- > > 68.0.2/media/mtransport/third_party/nICEr/src/stun/stun.h:45: > > > > In file included from /usr/include/net/if_var.h:84: > > > > /usr/include/sys/lock.h:68:15: error: reference to 'thread' is > > > > ambiguous > > > > struct thread **owner); > > > > ^ > > > > /usr/include/sys/lock.h:42:8: note: candidate found by name > > > > lookup is > > > > 'thread' > > > > struct thread; > > > > ^ > > > > /usr/include/c++/v1/__threading_support:397:24: note: candidate > > > > found > > > > by name > > > > lookup is 'std::__1::thread' > > > > class _LIBCPP_TYPE_VIS thread; > > > > ^ > > > > > > > > This "class thread" conflicts with "struct thread" in > > > > sys/lock.h. > > > > Should everything in sys/lock.h be under #ifdef _KERNEL? > > > > > > Maybe, but is Firefox using "using namespace std;" here? It is a > > > likely > > > explanation for the ambiguity between the global struct thread > > > from > > > sys/lock.h, and std::thread from libc++. > > > > Yes, several headers in media/mtransport/third_party/nICEr/src > > start > > with: > > > > #ifdef __cplusplus > > using namespace std; > > extern "C" { > > #endif /* __cplusplus */ > > > > libc++ has always had a `std::thread` struct. > > The change here is that forward declaration moved from to > <__threading_support>, and > that was included by . > > It doesn't matter what the change was, because the error is in firefox. It violates the c++ convention that you NEVER put 'using namespace' statements in a header file. Never. Because, this stuff happens if you do. -- Ian From owner-svn-src-head@freebsd.org Wed Aug 21 19:07:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4D8DD0C8F; Wed, 21 Aug 2019 19:07:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DHGW4KgWz4LlP; Wed, 21 Aug 2019 19:07:15 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7641F20266; Wed, 21 Aug 2019 19:07:15 +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 x7LJ7FQi088564; Wed, 21 Aug 2019 19:07:15 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LJ7DFA088554; Wed, 21 Aug 2019 19:07:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908211907.x7LJ7DFA088554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Aug 2019 19:07:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351346 - in head: sys/fs/msdosfs usr.sbin/makefs usr.sbin/makefs/ffs usr.sbin/makefs/msdos X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: sys/fs/msdosfs usr.sbin/makefs usr.sbin/makefs/ffs usr.sbin/makefs/msdos X-SVN-Commit-Revision: 351346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 19:07:15 -0000 Author: emaste Date: Wed Aug 21 19:07:13 2019 New Revision: 351346 URL: https://svnweb.freebsd.org/changeset/base/351346 Log: makefs: share denode.h between kernel msdosfs and makefs There is no need to duplicate this file when it can be trivially shared (just exposing sections previously under #ifdef _KERNEL). MFC with: r351273 Differential Revision: The FreeBSD Foundation Deleted: head/usr.sbin/makefs/msdos/denode.h Modified: head/sys/fs/msdosfs/denode.h head/usr.sbin/makefs/ffs/buf.h head/usr.sbin/makefs/msdos.c head/usr.sbin/makefs/msdos/msdosfs_conv.c head/usr.sbin/makefs/msdos/msdosfs_denode.c head/usr.sbin/makefs/msdos/msdosfs_fat.c head/usr.sbin/makefs/msdos/msdosfs_lookup.c head/usr.sbin/makefs/msdos/msdosfs_vfsops.c head/usr.sbin/makefs/msdos/msdosfs_vnops.c Modified: head/sys/fs/msdosfs/denode.h ============================================================================== --- head/sys/fs/msdosfs/denode.h Wed Aug 21 18:28:38 2019 (r351345) +++ head/sys/fs/msdosfs/denode.h Wed Aug 21 19:07:13 2019 (r351346) @@ -213,7 +213,7 @@ struct denode { ((dep)->de_Attributes & ATTR_DIRECTORY) ? 0 : (dep)->de_FileSize), \ putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16)) -#ifdef _KERNEL +#if defined(_KERNEL) || defined(MAKEFS) #define VTODE(vp) ((struct denode *)(vp)->v_data) #define DETOV(de) ((de)->de_vnode) @@ -262,9 +262,11 @@ struct defid { extern struct vop_vector msdosfs_vnodeops; +#ifdef _KERNEL int msdosfs_lookup(struct vop_cachedlookup_args *); int msdosfs_inactive(struct vop_inactive_args *); int msdosfs_reclaim(struct vop_reclaim_args *); +#endif /* * Internal service routine prototypes. @@ -283,5 +285,5 @@ int deupdat(struct denode *dep, int waitfor); int removede(struct denode *pdep, struct denode *dep); int detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred); int doscheckpath( struct denode *source, struct denode *target); -#endif /* _KERNEL */ +#endif /* _KERNEL || MAKEFS */ #endif /* !_FS_MSDOSFS_DENODE_H_ */ Modified: head/usr.sbin/makefs/ffs/buf.h ============================================================================== --- head/usr.sbin/makefs/ffs/buf.h Wed Aug 21 18:28:38 2019 (r351345) +++ head/usr.sbin/makefs/ffs/buf.h Wed Aug 21 19:07:13 2019 (r351346) @@ -45,6 +45,7 @@ #include #include +struct componentname; struct makefs_fsinfo; struct ucred; Modified: head/usr.sbin/makefs/msdos.c ============================================================================== --- head/usr.sbin/makefs/msdos.c Wed Aug 21 18:28:38 2019 (r351345) +++ head/usr.sbin/makefs/msdos.c Wed Aug 21 19:07:13 2019 (r351346) @@ -55,17 +55,17 @@ __FBSDID("$FreeBSD$"); #include #include +#include "ffs/buf.h" #include "makefs.h" #include "msdos.h" #include #include +#include "msdos/direntry.h" +#include -#include "ffs/buf.h" #include "msdos/msdosfsmount.h" -#include "msdos/direntry.h" -#include "msdos/denode.h" static int msdos_populate_dir(const char *, struct denode *, fsnode *, fsnode *, fsinfo_t *); Modified: head/usr.sbin/makefs/msdos/msdosfs_conv.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_conv.c Wed Aug 21 18:28:38 2019 (r351345) +++ head/usr.sbin/makefs/msdos/msdosfs_conv.c Wed Aug 21 19:07:13 2019 (r351346) @@ -56,13 +56,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include "msdos/direntry.h" +#include "msdos/msdosfsmount.h" #include "makefs.h" #include "msdos.h" - -#include "msdos/denode.h" -#include "msdos/direntry.h" -#include "msdos/msdosfsmount.h" static int char8ucs2str(const uint8_t *in, int n, uint16_t *out, int m); static void ucs2pad(uint16_t *buf, int len, int size); Modified: head/usr.sbin/makefs/msdos/msdosfs_denode.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_denode.c Wed Aug 21 18:28:38 2019 (r351345) +++ head/usr.sbin/makefs/msdos/msdosfs_denode.c Wed Aug 21 19:07:13 2019 (r351346) @@ -59,18 +59,18 @@ __FBSDID("$FreeBSD$"); #include #include +#include "ffs/buf.h" + #include -#include "msdos/denode.h" -#include "msdos/msdosfsmount.h" +#include +#include #include +#include "msdos/msdosfsmount.h" #include "makefs.h" #include "msdos.h" -#include "ffs/buf.h" -#include "msdos/direntry.h" - /* * If deget() succeeds it returns with the gotten denode locked(). * @@ -208,7 +208,7 @@ deget(struct msdosfsmount *pmp, u_long dirclust, u_lon * Truncate the file described by dep to the length specified by length. */ int -detrunc(struct denode *dep, u_long length, int flags) +detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred) { int error; int allerror; @@ -240,7 +240,7 @@ detrunc(struct denode *dep, u_long length, int flags) } if (dep->de_FileSize < length) - return deextend(dep, length); + return deextend(dep, length, cred); /* * If the desired length is 0 then remember the starting cluster of @@ -333,7 +333,7 @@ detrunc(struct denode *dep, u_long length, int flags) * Extend the file described by dep to length specified by length. */ int -deextend(struct denode *dep, u_long length) +deextend(struct denode *dep, u_long length, struct ucred *cred) { struct msdosfsmount *pmp = dep->de_pmp; u_long count; @@ -364,7 +364,7 @@ deextend(struct denode *dep, u_long length) error = extendfile(dep, count, NULL, NULL, DE_CLEAR); if (error) { /* truncate the added clusters away again */ - (void) detrunc(dep, dep->de_FileSize, 0); + (void) detrunc(dep, dep->de_FileSize, 0, cred); return (error); } } Modified: head/usr.sbin/makefs/msdos/msdosfs_fat.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_fat.c Wed Aug 21 18:28:38 2019 (r351345) +++ head/usr.sbin/makefs/msdos/msdosfs_fat.c Wed Aug 21 19:07:13 2019 (r351346) @@ -58,14 +58,13 @@ #include #include -#include -#include "msdos/denode.h" -#include "msdos/msdosfsmount.h" -#include - #include "ffs/buf.h" +#include #include "msdos/direntry.h" +#include +#include +#include "msdos/msdosfsmount.h" #include "makefs.h" #include "msdos.h" Modified: head/usr.sbin/makefs/msdos/msdosfs_lookup.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_lookup.c Wed Aug 21 18:28:38 2019 (r351345) +++ head/usr.sbin/makefs/msdos/msdosfs_lookup.c Wed Aug 21 19:07:13 2019 (r351346) @@ -56,15 +56,13 @@ #include #include +#include "ffs/buf.h" #include -#include "msdos/denode.h" -#include "msdos/msdosfsmount.h" +#include "msdos/direntry.h" +#include #include +#include "msdos/msdosfsmount.h" -#include "ffs/buf.h" - -#include "msdos/direntry.h" - #include "makefs.h" #include "msdos.h" @@ -104,7 +102,7 @@ createde(struct denode *dep, struct denode *ddep, stru dirclust = de_clcount(pmp, diroffset); error = extendfile(ddep, dirclust, 0, 0, DE_CLEAR); if (error) { - (void)detrunc(ddep, ddep->de_FileSize, 0); + (void)detrunc(ddep, ddep->de_FileSize, 0, NULL); return error; } Modified: head/usr.sbin/makefs/msdos/msdosfs_vfsops.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_vfsops.c Wed Aug 21 18:28:38 2019 (r351345) +++ head/usr.sbin/makefs/msdos/msdosfs_vfsops.c Wed Aug 21 19:07:13 2019 (r351346) @@ -58,20 +58,20 @@ __FBSDID("$FreeBSD$"); #include #include +#include "ffs/buf.h" #include #include -#include "msdos/denode.h" -#include "msdos/msdosfsmount.h" +#include "msdos/direntry.h" +#include #include +#include "msdos/msdosfsmount.h" #include #include "makefs.h" #include "msdos.h" -#include "ffs/buf.h" -#include "msdos/direntry.h" struct msdosfsmount * msdosfs_mount(struct vnode *devvp) Modified: head/usr.sbin/makefs/msdos/msdosfs_vnops.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_vnops.c Wed Aug 21 18:28:38 2019 (r351345) +++ head/usr.sbin/makefs/msdos/msdosfs_vnops.c Wed Aug 21 19:07:13 2019 (r351346) @@ -62,18 +62,16 @@ __FBSDID("$FreeBSD$"); #include #include +#include "ffs/buf.h" #include -#include "msdos/denode.h" -#include "msdos/msdosfsmount.h" +#include "msdos/direntry.h" +#include #include +#include "msdos/msdosfsmount.h" #include "makefs.h" #include "msdos.h" -#include "ffs/buf.h" - -#include "msdos/direntry.h" - /* * Some general notes: * @@ -455,7 +453,7 @@ msdosfs_wfile(const char *path, struct denode *dep, fs nsize = st->st_size; MSDOSFS_DPRINTF(("%s(nsize=%zu, osize=%zu)\n", __func__, nsize, osize)); if (nsize > osize) { - if ((error = deextend(dep, nsize)) != 0) + if ((error = deextend(dep, nsize, NULL)) != 0) return error; if ((error = msdosfs_updatede(dep)) != 0) return error; From owner-svn-src-head@freebsd.org Wed Aug 21 19:09:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68930D0D32; Wed, 21 Aug 2019 19:09:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DHKK27TSz4LvM; Wed, 21 Aug 2019 19:09:41 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 276D120267; Wed, 21 Aug 2019 19:09:41 +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 x7LJ9eTZ088699; Wed, 21 Aug 2019 19:09:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LJ9e7l088698; Wed, 21 Aug 2019 19:09:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908211909.x7LJ9e7l088698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Aug 2019 19:09:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351347 - head/usr.sbin/makefs/msdos X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/makefs/msdos X-SVN-Commit-Revision: 351347 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 19:09:41 -0000 Author: emaste Date: Wed Aug 21 19:09:40 2019 New Revision: 351347 URL: https://svnweb.freebsd.org/changeset/base/351347 Log: makefs: Verify that the BPB media descriptor and FAT ID match From r322982 in sys/fs/msdosfs. Modified: head/usr.sbin/makefs/msdos/msdosfs_fat.c Modified: head/usr.sbin/makefs/msdos/msdosfs_fat.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_fat.c Wed Aug 21 19:07:13 2019 (r351346) +++ head/usr.sbin/makefs/msdos/msdosfs_fat.c Wed Aug 21 19:09:40 2019 (r351347) @@ -887,19 +887,17 @@ fillinusemap(struct msdosfsmount *pmp) * zero. These represent free clusters. */ pmp->pm_freeclustercount = 0; - for (cn = CLUST_FIRST; cn <= pmp->pm_maxcluster; cn++) { + for (cn = 0; cn <= pmp->pm_maxcluster; cn++) { byteoffset = FATOFS(pmp, cn); bo = byteoffset % pmp->pm_fatblocksize; - if (bo == 0 || bp == NULL) { + if (bo == 0) { /* Read new FAT block */ if (bp != NULL) brelse(bp); fatblock(pmp, byteoffset, &bn, &bsize, NULL); error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp); - if (error != 0) { - brelse(bp); + if (error != 0) return (error); - } } if (FAT32(pmp)) readcn = getulong(bp->b_data + bo); @@ -909,7 +907,19 @@ fillinusemap(struct msdosfsmount *pmp) readcn >>= 4; readcn &= pmp->pm_fatmask; - if (readcn == CLUST_FREE) + /* + * Check if the FAT ID matches the BPB's media descriptor and + * all other bits are set to 1. + */ + if (cn == 0 && readcn != ((pmp->pm_fatmask & 0xffffff00) | + pmp->pm_bpb.bpbMedia)) { +#ifdef MSDOSFS_DEBUG + printf("mountmsdosfs(): Media descriptor in BPB" + "does not match FAT ID\n"); +#endif + brelse(bp); + return (EINVAL); + } else if (readcn == CLUST_FREE) usemap_free(pmp, cn); } if (bp != NULL) From owner-svn-src-head@freebsd.org Wed Aug 21 19:35:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F410D1E4F; Wed, 21 Aug 2019 19:35:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DHtd0sz5z4QZV; Wed, 21 Aug 2019 19:35:05 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA1AF207E6; Wed, 21 Aug 2019 19:35:04 +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 x7LJZ4aY008617; Wed, 21 Aug 2019 19:35:04 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LJZ4dd008616; Wed, 21 Aug 2019 19:35:04 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908211935.x7LJZ4dd008616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 21 Aug 2019 19:35:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351348 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 19:35:05 -0000 Author: markj Date: Wed Aug 21 19:35:04 2019 New Revision: 351348 URL: https://svnweb.freebsd.org/changeset/base/351348 Log: Modify pipe_poll() to properly check for pending direct writes. With r349546, it is a responsibility of the writer to clear PIPE_DIRECTW after pinned data has been read. In particular, once a reader has drained this data, there is a small window where the pipe is empty but PIPE_DIRECTW is set. pipe_poll() was using the presence of PIPE_DIRECTW to determine whether to return POLLIN, so in this window it would claim that data was available to read when this was not the case. Fix this by modifying several checks for PIPE_DIRECTW to instead look at the number of residual bytes in data pinned by a direct writer. In some cases we really do want to check for PIPE_DIRECTW, since the presence of this flag indicates that any attempt to write to the pipe will block on the existing direct writer. Bisected and test case provided by: mav Tested by: pho Reviewed by: kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21333 Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Wed Aug 21 19:09:40 2019 (r351347) +++ head/sys/kern/sys_pipe.c Wed Aug 21 19:35:04 2019 (r351348) @@ -709,11 +709,9 @@ pipe_read(struct file *fp, struct uio *uio, struct ucr /* * Direct copy, bypassing a kernel buffer. */ - } else if ((size = rpipe->pipe_map.cnt) && - (rpipe->pipe_state & PIPE_DIRECTW)) { + } else if ((size = rpipe->pipe_map.cnt) != 0) { if (size > uio->uio_resid) size = (u_int) uio->uio_resid; - PIPE_UNLOCK(rpipe); error = uiomove_fromphys(rpipe->pipe_map.ms, rpipe->pipe_map.pos, size, uio); @@ -819,32 +817,33 @@ pipe_build_write_buffer(struct pipe *wpipe, struct uio u_int size; int i; - PIPE_LOCK_ASSERT(wpipe, MA_NOTOWNED); - KASSERT(wpipe->pipe_state & PIPE_DIRECTW, - ("Clone attempt on non-direct write pipe!")); + PIPE_LOCK_ASSERT(wpipe, MA_OWNED); + KASSERT((wpipe->pipe_state & PIPE_DIRECTW) == 0, + ("%s: PIPE_DIRECTW set on %p", __func__, wpipe)); + KASSERT(wpipe->pipe_map.cnt == 0, + ("%s: pipe map for %p contains residual data", __func__, wpipe)); if (uio->uio_iov->iov_len > wpipe->pipe_buffer.size) size = wpipe->pipe_buffer.size; else size = uio->uio_iov->iov_len; - if ((i = vm_fault_quick_hold_pages(&curproc->p_vmspace->vm_map, + wpipe->pipe_state |= PIPE_DIRECTW; + PIPE_UNLOCK(wpipe); + i = vm_fault_quick_hold_pages(&curproc->p_vmspace->vm_map, (vm_offset_t)uio->uio_iov->iov_base, size, VM_PROT_READ, - wpipe->pipe_map.ms, PIPENPAGES)) < 0) + wpipe->pipe_map.ms, PIPENPAGES); + PIPE_LOCK(wpipe); + if (i < 0) { + wpipe->pipe_state &= ~PIPE_DIRECTW; return (EFAULT); + } -/* - * set up the control block - */ wpipe->pipe_map.npages = i; wpipe->pipe_map.pos = ((vm_offset_t) uio->uio_iov->iov_base) & PAGE_MASK; wpipe->pipe_map.cnt = size; -/* - * and update the uio data - */ - uio->uio_iov->iov_len -= size; uio->uio_iov->iov_base = (char *)uio->uio_iov->iov_base + size; if (uio->uio_iov->iov_len == 0) @@ -864,6 +863,8 @@ pipe_destroy_write_buffer(struct pipe *wpipe) PIPE_LOCK_ASSERT(wpipe, MA_OWNED); KASSERT((wpipe->pipe_state & PIPE_DIRECTW) != 0, ("%s: PIPE_DIRECTW not set on %p", __func__, wpipe)); + KASSERT(wpipe->pipe_map.cnt == 0, + ("%s: pipe map for %p contains residual data", __func__, wpipe)); wpipe->pipe_state &= ~PIPE_DIRECTW; vm_page_unhold_pages(wpipe->pipe_map.ms, wpipe->pipe_map.npages); @@ -889,6 +890,7 @@ pipe_clone_write_buffer(struct pipe *wpipe) size = wpipe->pipe_map.cnt; pos = wpipe->pipe_map.pos; + wpipe->pipe_map.cnt = 0; wpipe->pipe_buffer.in = size; wpipe->pipe_buffer.out = 0; @@ -946,7 +948,6 @@ retry: else goto retry; } - wpipe->pipe_map.cnt = 0; /* transfer not ready yet */ if (wpipe->pipe_buffer.cnt > 0) { if (wpipe->pipe_state & PIPE_WANTR) { wpipe->pipe_state &= ~PIPE_WANTR; @@ -963,19 +964,15 @@ retry: goto retry; } - wpipe->pipe_state |= PIPE_DIRECTW; - - PIPE_UNLOCK(wpipe); error = pipe_build_write_buffer(wpipe, uio); - PIPE_LOCK(wpipe); if (error) { - wpipe->pipe_state &= ~PIPE_DIRECTW; pipeunlock(wpipe); goto error1; } while (wpipe->pipe_map.cnt != 0) { if (wpipe->pipe_state & PIPE_EOF) { + wpipe->pipe_map.cnt = 0; pipe_destroy_write_buffer(wpipe); pipeselwakeup(wpipe); pipeunlock(wpipe); @@ -1129,7 +1126,7 @@ pipe_write(struct file *fp, struct uio *uio, struct uc * pipe buffer. We break out if a signal occurs or the * reader goes away. */ - if (wpipe->pipe_state & PIPE_DIRECTW) { + if (wpipe->pipe_map.cnt != 0) { if (wpipe->pipe_state & PIPE_WANTR) { wpipe->pipe_state &= ~PIPE_WANTR; wakeup(wpipe); @@ -1347,7 +1344,7 @@ pipe_ioctl(struct file *fp, u_long cmd, void *data, st PIPE_UNLOCK(mpipe); return (0); } - if (mpipe->pipe_state & PIPE_DIRECTW) + if (mpipe->pipe_map.cnt != 0) *(int *)data = mpipe->pipe_map.cnt; else *(int *)data = mpipe->pipe_buffer.cnt; @@ -1403,14 +1400,13 @@ pipe_poll(struct file *fp, int events, struct ucred *a goto locked_error; #endif if (fp->f_flag & FREAD && events & (POLLIN | POLLRDNORM)) - if ((rpipe->pipe_state & PIPE_DIRECTW) || - (rpipe->pipe_buffer.cnt > 0)) + if (rpipe->pipe_map.cnt > 0 || rpipe->pipe_buffer.cnt > 0) revents |= events & (POLLIN | POLLRDNORM); if (fp->f_flag & FWRITE && events & (POLLOUT | POLLWRNORM)) if (wpipe->pipe_present != PIPE_ACTIVE || (wpipe->pipe_state & PIPE_EOF) || - (((wpipe->pipe_state & PIPE_DIRECTW) == 0) && + ((wpipe->pipe_state & PIPE_DIRECTW) == 0 && ((wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) >= PIPE_BUF || wpipe->pipe_buffer.size == 0))) revents |= events & (POLLOUT | POLLWRNORM); @@ -1485,7 +1481,7 @@ pipe_stat(struct file *fp, struct stat *ub, struct ucr bzero(ub, sizeof(*ub)); ub->st_mode = S_IFIFO; ub->st_blksize = PAGE_SIZE; - if (pipe->pipe_state & PIPE_DIRECTW) + if (pipe->pipe_map.cnt != 0) ub->st_size = pipe->pipe_map.cnt; else ub->st_size = pipe->pipe_buffer.cnt; @@ -1727,7 +1723,7 @@ filt_piperead(struct knote *kn, long hint) PIPE_LOCK_ASSERT(rpipe, MA_OWNED); kn->kn_data = rpipe->pipe_buffer.cnt; - if ((kn->kn_data == 0) && (rpipe->pipe_state & PIPE_DIRECTW)) + if (kn->kn_data == 0) kn->kn_data = rpipe->pipe_map.cnt; if ((rpipe->pipe_state & PIPE_EOF) || From owner-svn-src-head@freebsd.org Wed Aug 21 19:53:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B91E2D277E; Wed, 21 Aug 2019 19:53:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DJJH4S3tz4SB3; Wed, 21 Aug 2019 19:53: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6046B20B9C; Wed, 21 Aug 2019 19:53: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 x7LJrpYg021067; Wed, 21 Aug 2019 19:53:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LJroaw021064; Wed, 21 Aug 2019 19:53:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908211953.x7LJroaw021064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Aug 2019 19:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351349 - head/lib/libthr/thread X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libthr/thread X-SVN-Commit-Revision: 351349 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 19:53:51 -0000 Author: kib Date: Wed Aug 21 19:53:50 2019 New Revision: 351349 URL: https://svnweb.freebsd.org/changeset/base/351349 Log: Fix _pthread_cancel_enter() and _pthread_cancel_leave() jmptable entries. PR: 240022 Reported by: Andrew Gierth Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/lib/libthr/thread/thr_cancel.c head/lib/libthr/thread/thr_init.c head/lib/libthr/thread/thr_private.h Modified: head/lib/libthr/thread/thr_cancel.c ============================================================================== --- head/lib/libthr/thread/thr_cancel.c Wed Aug 21 19:35:04 2019 (r351348) +++ head/lib/libthr/thread/thr_cancel.c Wed Aug 21 19:53:50 2019 (r351349) @@ -43,6 +43,8 @@ __weak_reference(_thr_setcanceltype, pthread_setcancel __weak_reference(_thr_setcanceltype, _pthread_setcanceltype); __weak_reference(_Tthr_testcancel, pthread_testcancel); __weak_reference(_Tthr_testcancel, _pthread_testcancel); +__weak_reference(_Tthr_cancel_enter, _pthread_cancel_enter); +__weak_reference(_Tthr_cancel_leave, _pthread_cancel_leave); static inline void testcancel(struct pthread *curthread) @@ -173,13 +175,13 @@ _thr_cancel_leave(struct pthread *curthread, int mayca } void -_pthread_cancel_enter(int maycancel) +_Tthr_cancel_enter(int maycancel) { _thr_cancel_enter2(_get_curthread(), maycancel); } void -_pthread_cancel_leave(int maycancel) +_Tthr_cancel_leave(int maycancel) { _thr_cancel_leave(_get_curthread(), maycancel); } Modified: head/lib/libthr/thread/thr_init.c ============================================================================== --- head/lib/libthr/thread/thr_init.c Wed Aug 21 19:35:04 2019 (r351348) +++ head/lib/libthr/thread/thr_init.c Wed Aug 21 19:53:50 2019 (r351349) @@ -265,8 +265,8 @@ static pthread_func_t jmp_table[][2] = { [PJT_TESTCANCEL] = {DUAL_ENTRY(_Tthr_testcancel)}, [PJT_CLEANUP_POP_IMP] = {DUAL_ENTRY(__thr_cleanup_pop_imp)}, [PJT_CLEANUP_PUSH_IMP] = {DUAL_ENTRY(__thr_cleanup_push_imp)}, - [PJT_CANCEL_ENTER] = {DUAL_ENTRY(_thr_cancel_enter)}, - [PJT_CANCEL_LEAVE] = {DUAL_ENTRY(_thr_cancel_leave)}, + [PJT_CANCEL_ENTER] = {DUAL_ENTRY(_Tthr_cancel_enter)}, + [PJT_CANCEL_LEAVE] = {DUAL_ENTRY(_Tthr_cancel_leave)}, [PJT_MUTEX_CONSISTENT] = {DUAL_ENTRY(_Tthr_mutex_consistent)}, [PJT_MUTEXATTR_GETROBUST] = {DUAL_ENTRY(_thr_mutexattr_getrobust)}, [PJT_MUTEXATTR_SETROBUST] = {DUAL_ENTRY(_thr_mutexattr_setrobust)}, Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Wed Aug 21 19:35:04 2019 (r351348) +++ head/lib/libthr/thread/thr_private.h Wed Aug 21 19:53:50 2019 (r351349) @@ -1022,6 +1022,8 @@ void __thr_cleanup_pop_imp(int); void _thr_cleanup_push(void (*)(void *), void *); void _thr_cleanup_pop(int); void _Tthr_testcancel(void); +void _Tthr_cancel_enter(int); +void _Tthr_cancel_leave(int); int _thr_cancel(pthread_t); int _thr_atfork(void (*)(void), void (*)(void), void (*)(void)); int _thr_attr_destroy(pthread_attr_t *); From owner-svn-src-head@freebsd.org Wed Aug 21 20:01:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64D3BD29DD; Wed, 21 Aug 2019 20:01:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DJTY1jsGz4SXX; Wed, 21 Aug 2019 20:01:53 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C7A720C1E; Wed, 21 Aug 2019 20:01:53 +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 x7LK1qPo023912; Wed, 21 Aug 2019 20:01:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LK1q8a023911; Wed, 21 Aug 2019 20:01:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908212001.x7LK1q8a023911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 21 Aug 2019 20:01:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351351 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 20:01:53 -0000 Author: markj Date: Wed Aug 21 20:01:52 2019 New Revision: 351351 URL: https://svnweb.freebsd.org/changeset/base/351351 Log: Remove manual wire_count adjustments from the unmapped mbuf code. The original code came from a desire to minimize the number of updates to v_wire_count, which prior to r329187 was updated using atomics. However, there is no significant benefit to batching today, so simply allocate pages using VM_ALLOC_WIRED and rely on system accounting. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D21323 Modified: head/sys/kern/uipc_mbuf.c Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Wed Aug 21 19:57:54 2019 (r351350) +++ head/sys/kern/uipc_mbuf.c Wed Aug 21 20:01:52 2019 (r351351) @@ -1616,22 +1616,18 @@ mb_free_mext_pgs(struct mbuf *m) { struct mbuf_ext_pgs *ext_pgs; vm_page_t pg; - int wire_adj; MBUF_EXT_PGS_ASSERT(m); ext_pgs = m->m_ext.ext_pgs; - wire_adj = 0; for (int i = 0; i < ext_pgs->npgs; i++) { pg = PHYS_TO_VM_PAGE(ext_pgs->pa[i]); /* * Note: page is not locked, as it has no * object and is not on any queues. */ - vm_page_free_toq(pg); - wire_adj++; + vm_page_unwire_noq(pg); + vm_page_free(pg); } - if (wire_adj) - vm_wire_sub(wire_adj); } static struct mbuf * @@ -1640,9 +1636,10 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, i struct mbuf *m, *mb, *prev; struct mbuf_ext_pgs *pgs; vm_page_t pg_array[MBUF_PEXT_MAX_PGS]; - int error, length, i, needed, wire_adj = 0; + int error, length, i, needed; ssize_t total; - int pflags = malloc2vm_flags(how) | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP; + int pflags = malloc2vm_flags(how) | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | + VM_ALLOC_WIRED; /* * len can be zero or an arbitrary large value bound by @@ -1676,9 +1673,6 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, i retry_page: pg_array[i] = vm_page_alloc(NULL, 0, pflags); if (pg_array[i] == NULL) { - if (wire_adj) - vm_wire_add(wire_adj); - wire_adj = 0; if (how & M_NOWAIT) { goto failed; } else { @@ -1686,15 +1680,12 @@ retry_page: goto retry_page; } } - wire_adj++; pg_array[i]->flags &= ~PG_ZERO; pgs->pa[i] = VM_PAGE_TO_PHYS(pg_array[i]); pgs->npgs++; } pgs->last_pg_len = length - PAGE_SIZE * (pgs->npgs - 1); MBUF_EXT_PGS_ASSERT_SANITY(pgs); - vm_wire_add(wire_adj); - wire_adj = 0; total -= length; error = uiomove_fromphys(pg_array, 0, length, uio); if (error != 0) From owner-svn-src-head@freebsd.org Wed Aug 21 20:17:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33D40D2F85; Wed, 21 Aug 2019 20:17:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DJqb0dyMz4Tn0; Wed, 21 Aug 2019 20:17:31 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EBD3020F2D; Wed, 21 Aug 2019 20:17:30 +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 x7LKHUeZ033458; Wed, 21 Aug 2019 20:17:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LKHUOw033457; Wed, 21 Aug 2019 20:17:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908212017.x7LKHUOw033457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Aug 2019 20:17:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351352 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 351352 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 20:17:31 -0000 Author: mav Date: Wed Aug 21 20:17:30 2019 New Revision: 351352 URL: https://svnweb.freebsd.org/changeset/base/351352 Log: Improve NVMe hot unplug handling. If device is unplugged from the system (CSTS register reads return 0xffffffff), it makes no sense to send any more recovery requests or expect any responses back. If there is a detach call in such state, just stop all activity and free resources. If there is no detach call (hot-plug is not supported), rely on normal timeout handling, but when it trigger controller reset, do not wait for impossible and quickly report failure. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_qpair.c Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Wed Aug 21 20:01:52 2019 (r351351) +++ head/sys/dev/nvme/nvme_ctrlr.c Wed Aug 21 20:17:30 2019 (r351352) @@ -207,10 +207,13 @@ nvme_ctrlr_fail(struct nvme_controller *ctrlr) int i; ctrlr->is_failed = TRUE; + nvme_admin_qpair_disable(&ctrlr->adminq); nvme_qpair_fail(&ctrlr->adminq); if (ctrlr->ioq != NULL) { - for (i = 0; i < ctrlr->num_io_queues; i++) + for (i = 0; i < ctrlr->num_io_queues; i++) { + nvme_io_qpair_disable(&ctrlr->ioq[i]); nvme_qpair_fail(&ctrlr->ioq[i]); + } } nvme_notify_fail_consumers(ctrlr); } @@ -249,17 +252,20 @@ nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrl int ms_waited; uint32_t csts; - csts = nvme_mmio_read_4(ctrlr, csts); - ms_waited = 0; - while (((csts >> NVME_CSTS_REG_RDY_SHIFT) & NVME_CSTS_REG_RDY_MASK) != desired_val) { + while (1) { + csts = nvme_mmio_read_4(ctrlr, csts); + if (csts == 0xffffffff) /* Hot unplug. */ + return (ENXIO); + if (((csts >> NVME_CSTS_REG_RDY_SHIFT) & NVME_CSTS_REG_RDY_MASK) + == desired_val) + break; if (ms_waited++ > ctrlr->ready_timeout_in_ms) { nvme_printf(ctrlr, "controller ready did not become %d " "within %d ms\n", desired_val, ctrlr->ready_timeout_in_ms); return (ENXIO); } DELAY(1000); - csts = nvme_mmio_read_4(ctrlr, csts); } return (0); @@ -1338,12 +1344,20 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de void nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) { - int i; + int gone, i; if (ctrlr->resource == NULL) goto nores; - nvme_notify_fail_consumers(ctrlr); + /* + * Check whether it is a hot unplug or a clean driver detach. + * If device is not there any more, skip any shutdown commands. + */ + gone = (nvme_mmio_read_4(ctrlr, csts) == 0xffffffff); + if (gone) + nvme_ctrlr_fail(ctrlr); + else + nvme_notify_fail_consumers(ctrlr); for (i = 0; i < NVME_MAX_NAMESPACES; i++) nvme_ns_destruct(&ctrlr->ns[i]); @@ -1351,12 +1365,11 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev if (ctrlr->cdev) destroy_dev(ctrlr->cdev); - nvme_ctrlr_destroy_qpairs(ctrlr); - for (i = 0; i < ctrlr->num_io_queues; i++) { + if (!gone) + nvme_ctrlr_destroy_qpairs(ctrlr); + for (i = 0; i < ctrlr->num_io_queues; i++) nvme_io_qpair_destroy(&ctrlr->ioq[i]); - } free(ctrlr->ioq, M_NVME); - nvme_admin_qpair_destroy(&ctrlr->adminq); /* @@ -1366,9 +1379,11 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev * shutdown notification in case the system is shutdown before * reloading the driver. */ - nvme_ctrlr_shutdown(ctrlr); + if (!gone) + nvme_ctrlr_shutdown(ctrlr); - nvme_ctrlr_disable(ctrlr); + if (!gone) + nvme_ctrlr_disable(ctrlr); if (ctrlr->taskqueue) taskqueue_free(ctrlr->taskqueue); @@ -1407,14 +1422,19 @@ nvme_ctrlr_shutdown(struct nvme_controller *ctrlr) cc |= NVME_SHN_NORMAL << NVME_CC_REG_SHN_SHIFT; nvme_mmio_write_4(ctrlr, cc, cc); - csts = nvme_mmio_read_4(ctrlr, csts); - while ((NVME_CSTS_GET_SHST(csts) != NVME_SHST_COMPLETE) && (ticks++ < 5*hz)) { - pause("nvme shn", 1); + while (1) { csts = nvme_mmio_read_4(ctrlr, csts); + if (csts == 0xffffffff) /* Hot unplug. */ + break; + if (NVME_CSTS_GET_SHST(csts) == NVME_SHST_COMPLETE) + break; + if (ticks++ > 5*hz) { + nvme_printf(ctrlr, "did not complete shutdown within" + " 5 seconds of notification\n"); + break; + } + pause("nvme shn", 1); } - if (NVME_CSTS_GET_SHST(csts) != NVME_SHST_COMPLETE) - nvme_printf(ctrlr, "did not complete shutdown within 5 seconds " - "of notification\n"); } void Modified: head/sys/dev/nvme/nvme_qpair.c ============================================================================== --- head/sys/dev/nvme/nvme_qpair.c Wed Aug 21 20:01:52 2019 (r351351) +++ head/sys/dev/nvme/nvme_qpair.c Wed Aug 21 20:17:30 2019 (r351352) @@ -911,7 +911,8 @@ nvme_timeout(void *arg) nvme_abort_complete, tr); } else { nvme_printf(ctrlr, "Resetting controller due to a timeout%s.\n", - cfs ? " and fatal error status" : ""); + (csts == 0xffffffff) ? " and possible hot unplug" : + (cfs ? " and fatal error status" : "")); nvme_ctrlr_reset(ctrlr); } } From owner-svn-src-head@freebsd.org Wed Aug 21 21:05:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27FC7D43E6; Wed, 21 Aug 2019 21:05:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DKth06MXz4Y7T; Wed, 21 Aug 2019 21:05:16 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAD3F21839; Wed, 21 Aug 2019 21:05:15 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7LL5F2q063637; Wed, 21 Aug 2019 21:05:15 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LL5Frr063636; Wed, 21 Aug 2019 21:05:15 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908212105.x7LL5Frr063636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 21 Aug 2019 21:05:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351354 - head/sbin/ping X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/ping X-SVN-Commit-Revision: 351354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 21:05:16 -0000 Author: asomers Date: Wed Aug 21 21:05:15 2019 New Revision: 351354 URL: https://svnweb.freebsd.org/changeset/base/351354 Log: ping: add -H option for enabling reverse DNS lookup This is the reverse of the -n flag. Submitted by: Ján Sučan Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21356 Modified: head/sbin/ping/ping.8 head/sbin/ping/ping.c Modified: head/sbin/ping/ping.8 ============================================================================== --- head/sbin/ping/ping.8 Wed Aug 21 20:44:42 2019 (r351353) +++ head/sbin/ping/ping.8 Wed Aug 21 21:05:15 2019 (r351354) @@ -28,7 +28,7 @@ .\" @(#)ping.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd March 11, 2016 +.Dd August 21, 2019 .Dt PING 8 .Os .Sh NAME @@ -38,7 +38,7 @@ packets to network hosts .Sh SYNOPSIS .Nm -.Op Fl AaDdfnoQqRrv +.Op Fl AaDdfHnoQqRrv .Op Fl c Ar count .Op Fl G Ar sweepmaxsize .Op Fl g Ar sweepminsize @@ -56,7 +56,7 @@ packets to network hosts .Op Fl z Ar tos .Ar host .Nm -.Op Fl AaDdfLnoQqRrv +.Op Fl AaDdfHLnoQqRrv .Op Fl c Ar count .Op Fl I Ar iface .Op Fl i Ar wait @@ -157,6 +157,14 @@ Specify the size of .Tn ICMP payload to start with when sending sweeping pings. The default value is 0. +.It Fl H +Hostname output. +Try to do a reverse DNS lookup when displaying addresses. +This is the opposite of +.Fl n , +and it is the default behavior. +.Nm +utility tries reverse-lookup by default. .It Fl h Ar sweepincrsize Specify the number of bytes to increment the size of .Tn ICMP Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Wed Aug 21 20:44:42 2019 (r351353) +++ head/sbin/ping/ping.c Wed Aug 21 21:05:15 2019 (r351354) @@ -297,7 +297,7 @@ main(int argc, char *const *argv) outpack = outpackhdr + sizeof(struct ip); while ((ch = getopt(argc, argv, - "Aac:DdfG:g:h:I:i:Ll:M:m:nop:QqRrS:s:T:t:vW:z:" + "Aac:DdfG:g:Hh:I:i:Ll:M:m:nop:QqRrS:s:T:t:vW:z:" #ifdef IPSEC #ifdef IPSEC_POLICY_IPSEC "P:" @@ -363,6 +363,9 @@ main(int argc, char *const *argv) options |= F_SWEEP; sweepmin = ltmp; break; + case 'H': + options &= ~F_NUMERIC; + break; case 'h': /* Packet size increment for ping sweep */ ltmp = strtol(optarg, &ep, 0); if (*ep || ep == optarg || ltmp < 1) @@ -1743,11 +1746,11 @@ usage(void) { (void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", -"usage: ping [-AaDdfnoQqRrv] [-c count] [-G sweepmaxsize] [-g sweepminsize]", +"usage: ping [-AaDdfHnoQqRrv] [-c count] [-G sweepmaxsize] [-g sweepminsize]", " [-h sweepincrsize] [-i wait] [-l preload] [-M mask | time] [-m ttl]", " " SECOPT " [-p pattern] [-S src_addr] [-s packetsize] [-t timeout]", " [-W waittime] [-z tos] host", -" ping [-AaDdfLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload]", +" ping [-AaDdfHLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload]", " [-M mask | time] [-m ttl]" SECOPT " [-p pattern] [-S src_addr]", " [-s packetsize] [-T ttl] [-t timeout] [-W waittime]", " [-z tos] mcast-group"); From owner-svn-src-head@freebsd.org Wed Aug 21 21:46:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49D91D4EC4; Wed, 21 Aug 2019 21:46:57 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay105.isp.belgacom.be (mailrelay105.isp.belgacom.be [195.238.20.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign Organization Validation CA - SHA256 - G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DLpm3MKmz4b8w; Wed, 21 Aug 2019 21:46:56 +0000 (UTC) (envelope-from tijl@freebsd.org) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2D0EgAqu11d/ygG91FkGwEBAQEDAQE?= =?us-ascii?q?BBwMBAQGBZwKCFlkUUiASKoQfiHyGAwGCDjUBiSh7kDUJAQEBMQwBAYFLgnQ?= =?us-ascii?q?CglkmOBMCBQEBBQEBAQEBBgRthGVCDEIBDAGEewEFIzMjEAsOBgQCAgUhAgI?= =?us-ascii?q?PEjYGARKDI4FqAyELqmSBMoQ0AQsBg1wNgRqBCgaBDCgBjAWBf4QjPoIagiq?= =?us-ascii?q?DC4JYBJRFllBACYIfhmiJWINtJ5hGhB6JPYdjgXqQQCGBWE0wCIMngk4XiGO?= =?us-ascii?q?FQT0DMIJPinsBAQ?= X-IPAS-Result: =?us-ascii?q?A2D0EgAqu11d/ygG91FkGwEBAQEDAQEBBwMBAQGBZwKCF?= =?us-ascii?q?lkUUiASKoQfiHyGAwGCDjUBiSh7kDUJAQEBMQwBAYFLgnQCglkmOBMCBQEBB?= =?us-ascii?q?QEBAQEBBgRthGVCDEIBDAGEewEFIzMjEAsOBgQCAgUhAgIPEjYGARKDI4FqA?= =?us-ascii?q?yELqmSBMoQ0AQsBg1wNgRqBCgaBDCgBjAWBf4QjPoIagiqDC4JYBJRFllBAC?= =?us-ascii?q?YIfhmiJWINtJ5hGhB6JPYdjgXqQQCGBWE0wCIMngk4XiGOFQT0DMIJPinsBA?= =?us-ascii?q?Q?= Received: from 40.6-247-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.247.6.40]) by relay.skynet.be with ESMTP; 21 Aug 2019 23:46:53 +0200 Received: from localhost (localhost [127.0.0.1]) by kalimero.tijl.coosemans.org (8.15.2/8.15.2) with ESMTP id x7LLkqnU043143; Wed, 21 Aug 2019 23:46:53 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Date: Wed, 21 Aug 2019 23:46:52 +0200 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Konstantin Belousov , gecko@FreeBSD.org Cc: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Marshall Clow Subject: Re: svn commit: r351253 - in head/contrib/libc++: include src Message-ID: <20190821234652.0ed2f345@FreeBSD.org> In-Reply-To: <20190821155231.GQ71821@kib.kiev.ua> References: <201908201739.x7KHdXvv054610@repo.freebsd.org> <20190821144908.7137e6bc@FreeBSD.org> <20190821155231.GQ71821@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 46DLpm3MKmz4b8w X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.991,0]; NEURAL_HAM_LONG(-1.00)[-0.998,0]; TAGGED_RCPT(0.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:5432, ipnet:195.238.0.0/19, country:BE] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 21:46:57 -0000 On Wed, 21 Aug 2019 18:52:31 +0300 Konstantin Belousov wrote: > On Wed, Aug 21, 2019 at 02:49:08PM +0200, T=C4=B3l Coosemans wrote: >> On Tue, 20 Aug 2019 17:39:33 +0000 (UTC) Dimitry Andric >> wrote: =20 >>> Author: dim >>> Date: Tue Aug 20 17:39:32 2019 >>> New Revision: 351253 >>> URL: https://svnweb.freebsd.org/changeset/base/351253 >>>=20 >>> Log: >>> Pull in r368867 from upstream libc++ trunk (by Marshall Clow): >>> =20 >>> Rework recursive_timed_mutex so that it uses __thread_id instead of >>> using the lower-level __libcpp_thread_id. This is prep for fixing >>> PR42918. Reviewed as https://reviews.llvm.org/D65895 >>> =20 >>> Pull in r368916 from upstream libc++ trunk (by Marshall Clow): >>> =20 >>> Fix thread comparison by making sure we never pass our special 'not= a >>> thread' value to the underlying implementation. Fixes PR#42918. >>> =20 >>> This should fix std::thread::id::operator=3D=3D() attempting to call >>> pthread_equal(3) with zero values. >>> =20 >>> Reported by: andrew@tao11.riddles.org.uk >>> PR: 239038, 239550 >>> MFC after: 3 days >>>=20 >>> Modified: >>> head/contrib/libc++/include/__threading_support >>> head/contrib/libc++/include/mutex >>> head/contrib/libc++/include/thread >>> head/contrib/libc++/src/mutex.cpp >>>=20 >>> Modified: head/contrib/libc++/include/__threading_support >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=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/contrib/libc++/include/__threading_support Tue Aug 20 17:00:31= 2019 (r351252) >>> +++ head/contrib/libc++/include/__threading_support Tue Aug 20 17:39:32= 2019 (r351253) >>> @@ -13,6 +13,7 @@ >>> =20 >>> #include <__config> >>> #include >>> +#include >>> #include >>> =20 >>> #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER >>> @@ -392,6 +393,86 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void = *__p >>> } >>> =20 >>> #endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THR= EAD_LIBRARY_EXTERNAL >>> + >>> +class _LIBCPP_TYPE_VIS thread; =20 >>=20 >> This seems to break building Firefox: >>=20 >> In file included from /usr/ports/www/firefox/work/firefox-68.0.2/media/m= transport/nricectx.cpp:82: >> In file included from /usr/ports/www/firefox/work/firefox-68.0.2/media/m= transport/third_party/nICEr/src/stun/stun_client_ctx.h:41: >> In file included from /usr/ports/www/firefox/work/firefox-68.0.2/media/m= transport/third_party/nICEr/src/stun/stun.h:45: >> In file included from /usr/include/net/if_var.h:84: >> /usr/include/sys/lock.h:68:15: error: reference to 'thread' is ambiguous >> struct thread **owner); >> ^ >> /usr/include/sys/lock.h:42:8: note: candidate found by name lookup is 't= hread' >> struct thread; >> ^ >> /usr/include/c++/v1/__threading_support:397:24: note: candidate found by= name >> lookup is 'std::__1::thread' >> class _LIBCPP_TYPE_VIS thread; >> ^ >>=20 >>=20 >> This "class thread" conflicts with "struct thread" in sys/lock.h. >> Should everything in sys/lock.h be under #ifdef _KERNEL? =20 > Why does firefox pulls if_var.h at all ? (As I understand, this is how > the pollution occurs.) Right, it turns out it doesn't need it: --- media/mtransport/third_party/nICEr/src/stun/stun.h.orig 2019-08-13 = 18:06:44 UTC +++ media/mtransport/third_party/nICEr/src/stun/stun.h @@ -41,7 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O #include #ifndef LINUX #include -#if !defined(__OpenBSD__) && !defined(__NetBSD__) +#if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) #include #endif #include From owner-svn-src-head@freebsd.org Wed Aug 21 22:17:56 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B34DAD5CF1; Wed, 21 Aug 2019 22:17:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DMVX50tVz4cy5; Wed, 21 Aug 2019 22:17:56 +0000 (UTC) (envelope-from imp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D51C2253A; Wed, 21 Aug 2019 22:17:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7LMHutQ004914; Wed, 21 Aug 2019 22:17:56 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LMHtWs004908; Wed, 21 Aug 2019 22:17:55 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908212217.x7LMHtWs004908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Aug 2019 22:17:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351355 - in head/sys: conf dev/nvme modules/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: conf dev/nvme modules/nvme X-SVN-Commit-Revision: 351355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 22:17:56 -0000 Author: imp Date: Wed Aug 21 22:17:55 2019 New Revision: 351355 URL: https://svnweb.freebsd.org/changeset/base/351355 Log: Separate the pci attachment from the rest of nvme Nvme drives can be attached in a number of different ways. Separate out the PCI attachment so that we can have other attachment types, like ahci and various types of NVMeoF. Submitted by: cognet@ Added: head/sys/dev/nvme/nvme_pci.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_private.h head/sys/modules/nvme/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Aug 21 21:05:15 2019 (r351354) +++ head/sys/conf/files Wed Aug 21 22:17:55 2019 (r351355) @@ -2483,6 +2483,7 @@ dev/nvme/nvme_ctrlr.c optional nvme dev/nvme/nvme_ctrlr_cmd.c optional nvme dev/nvme/nvme_ns.c optional nvme dev/nvme/nvme_ns_cmd.c optional nvme +dev/nvme/nvme_pci.c optional nvme pci dev/nvme/nvme_qpair.c optional nvme dev/nvme/nvme_sim.c optional nvme scbus dev/nvme/nvme_sysctl.c optional nvme Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Wed Aug 21 21:05:15 2019 (r351354) +++ head/sys/dev/nvme/nvme.c Wed Aug 21 22:17:55 2019 (r351355) @@ -36,9 +36,6 @@ __FBSDID("$FreeBSD$"); #include -#include -#include - #include "nvme_private.h" struct nvme_consumer { @@ -58,107 +55,8 @@ int32_t nvme_retry_count; MALLOC_DEFINE(M_NVME, "nvme", "nvme(4) memory allocations"); -static int nvme_probe(device_t); -static int nvme_attach(device_t); -static int nvme_detach(device_t); -static int nvme_shutdown(device_t); +devclass_t nvme_devclass; -static devclass_t nvme_devclass; - -static device_method_t nvme_pci_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, nvme_probe), - DEVMETHOD(device_attach, nvme_attach), - DEVMETHOD(device_detach, nvme_detach), - DEVMETHOD(device_shutdown, nvme_shutdown), - { 0, 0 } -}; - -static driver_t nvme_pci_driver = { - "nvme", - nvme_pci_methods, - sizeof(struct nvme_controller), -}; - -DRIVER_MODULE(nvme, pci, nvme_pci_driver, nvme_devclass, NULL, NULL); -MODULE_VERSION(nvme, 1); -MODULE_DEPEND(nvme, cam, 1, 1, 1); - -static struct _pcsid -{ - uint32_t devid; - int match_subdevice; - uint16_t subdevice; - const char *desc; - uint32_t quirks; -} pci_ids[] = { - { 0x01118086, 0, 0, "NVMe Controller" }, - { IDT32_PCI_ID, 0, 0, "IDT NVMe Controller (32 channel)" }, - { IDT8_PCI_ID, 0, 0, "IDT NVMe Controller (8 channel)" }, - { 0x09538086, 1, 0x3702, "DC P3700 SSD" }, - { 0x09538086, 1, 0x3703, "DC P3700 SSD [2.5\" SFF]" }, - { 0x09538086, 1, 0x3704, "DC P3500 SSD [Add-in Card]" }, - { 0x09538086, 1, 0x3705, "DC P3500 SSD [2.5\" SFF]" }, - { 0x09538086, 1, 0x3709, "DC P3600 SSD [Add-in Card]" }, - { 0x09538086, 1, 0x370a, "DC P3600 SSD [2.5\" SFF]" }, - { 0x00031c58, 0, 0, "HGST SN100", QUIRK_DELAY_B4_CHK_RDY }, - { 0x00231c58, 0, 0, "WDC SN200", QUIRK_DELAY_B4_CHK_RDY }, - { 0x05401c5f, 0, 0, "Memblaze Pblaze4", QUIRK_DELAY_B4_CHK_RDY }, - { 0xa821144d, 0, 0, "Samsung PM1725", QUIRK_DELAY_B4_CHK_RDY }, - { 0xa822144d, 0, 0, "Samsung PM1725a", QUIRK_DELAY_B4_CHK_RDY }, - { 0x01161179, 0, 0, "Toshiba XG5", QUIRK_DISABLE_TIMEOUT }, - { 0x00000000, 0, 0, NULL } -}; - -static int -nvme_match(uint32_t devid, uint16_t subdevice, struct _pcsid *ep) -{ - if (devid != ep->devid) - return 0; - - if (!ep->match_subdevice) - return 1; - - if (subdevice == ep->subdevice) - return 1; - else - return 0; -} - -static int -nvme_probe (device_t device) -{ - struct _pcsid *ep; - uint32_t devid; - uint16_t subdevice; - - devid = pci_get_devid(device); - subdevice = pci_get_subdevice(device); - ep = pci_ids; - - while (ep->devid) { - if (nvme_match(devid, subdevice, ep)) - break; - ++ep; - } - - if (ep->desc) { - device_set_desc(device, ep->desc); - return (BUS_PROBE_DEFAULT); - } - -#if defined(PCIS_STORAGE_NVM) - if (pci_get_class(device) == PCIC_STORAGE && - pci_get_subclass(device) == PCIS_STORAGE_NVM && - pci_get_progif(device) == PCIP_STORAGE_NVM_ENTERPRISE_NVMHCI_1_0) { - device_set_desc(device, "Generic NVMe Device"); - return (BUS_PROBE_GENERIC); - } -#endif - - return (ENXIO); -} - static void nvme_init(void) { @@ -181,7 +79,7 @@ nvme_uninit(void) SYSUNINIT(nvme_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_uninit, NULL); -static int +int nvme_shutdown(device_t dev) { struct nvme_controller *ctrlr; @@ -225,25 +123,12 @@ nvme_dump_completion(struct nvme_completion *cpl) cpl->cid, p, sc, sct, m, dnr); } -static int +int nvme_attach(device_t dev) { struct nvme_controller *ctrlr = DEVICE2SOFTC(dev); int status; - struct _pcsid *ep; - uint32_t devid; - uint16_t subdevice; - devid = pci_get_devid(dev); - subdevice = pci_get_subdevice(dev); - ep = pci_ids; - while (ep->devid) { - if (nvme_match(devid, subdevice, ep)) - break; - ++ep; - } - ctrlr->quirks = ep->quirks; - status = nvme_ctrlr_construct(ctrlr, dev); if (status != 0) { @@ -252,32 +137,8 @@ nvme_attach(device_t dev) } /* - * Some drives do not implement the completion timeout feature - * correctly. There's a WAR from the manufacturer to just disable it. - * The driver wouldn't respond correctly to a timeout anyway. - */ - if (ep->quirks & QUIRK_DISABLE_TIMEOUT) { - int ptr; - uint16_t devctl2; - - status = pci_find_cap(dev, PCIY_EXPRESS, &ptr); - if (status) { - device_printf(dev, "Can't locate PCIe capability?"); - return (status); - } - devctl2 = pci_read_config(dev, ptr + PCIER_DEVICE_CTL2, sizeof(devctl2)); - devctl2 |= PCIEM_CTL2_COMP_TIMO_DISABLE; - pci_write_config(dev, ptr + PCIER_DEVICE_CTL2, devctl2, sizeof(devctl2)); - } - - /* - * Enable busmastering so the completion status messages can - * be busmastered back to the host. - */ - pci_enable_busmaster(dev); - - /* * Reset controller twice to ensure we do a transition from cc.en==1 + * Reset controller twice to ensure we do a transition from cc.en==1 * to cc.en==0. This is because we don't really know what status * the controller was left in when boot handed off to OS. */ @@ -301,13 +162,12 @@ nvme_attach(device_t dev) return (0); } -static int +int nvme_detach (device_t dev) { struct nvme_controller *ctrlr = DEVICE2SOFTC(dev); nvme_ctrlr_destruct(ctrlr, dev); - pci_disable_busmaster(dev); return (0); } Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Wed Aug 21 21:05:15 2019 (r351354) +++ head/sys/dev/nvme/nvme_ctrlr.c Wed Aug 21 22:17:55 2019 (r351355) @@ -42,50 +42,14 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include - #include "nvme_private.h" #define B4_CHK_RDY_DELAY_MS 2300 /* work around controller bug */ static void nvme_ctrlr_construct_and_submit_aer(struct nvme_controller *ctrlr, struct nvme_async_event_request *aer); -static void nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr); static int -nvme_ctrlr_allocate_bar(struct nvme_controller *ctrlr) -{ - - ctrlr->resource_id = PCIR_BAR(0); - - ctrlr->resource = bus_alloc_resource_any(ctrlr->dev, SYS_RES_MEMORY, - &ctrlr->resource_id, RF_ACTIVE); - - if(ctrlr->resource == NULL) { - nvme_printf(ctrlr, "unable to allocate pci resource\n"); - return (ENOMEM); - } - - ctrlr->bus_tag = rman_get_bustag(ctrlr->resource); - ctrlr->bus_handle = rman_get_bushandle(ctrlr->resource); - ctrlr->regs = (struct nvme_registers *)ctrlr->bus_handle; - - /* - * The NVMe spec allows for the MSI-X table to be placed behind - * BAR 4/5, separate from the control/doorbell registers. Always - * try to map this bar, because it must be mapped prior to calling - * pci_alloc_msix(). If the table isn't behind BAR 4/5, - * bus_alloc_resource() will just return NULL which is OK. - */ - ctrlr->bar4_resource_id = PCIR_BAR(4); - ctrlr->bar4_resource = bus_alloc_resource_any(ctrlr->dev, SYS_RES_MEMORY, - &ctrlr->bar4_resource_id, RF_ACTIVE); - - return (0); -} - -static int nvme_ctrlr_construct_admin_qpair(struct nvme_controller *ctrlr) { struct nvme_qpair *qpair; @@ -876,9 +840,8 @@ nvme_ctrlr_start(void *ctrlr_arg) * the number of I/O queues supported, so cannot reset * the adminq again here. */ - if (ctrlr->is_resetting) { + if (ctrlr->is_resetting) nvme_qpair_reset(&ctrlr->adminq); - } for (i = 0; i < ctrlr->num_io_queues; i++) nvme_qpair_reset(&ctrlr->ioq[i]); @@ -1004,34 +967,6 @@ nvme_ctrlr_intx_handler(void *arg) nvme_mmio_write_4(ctrlr, intmc, 1); } -static int -nvme_ctrlr_configure_intx(struct nvme_controller *ctrlr) -{ - - ctrlr->msix_enabled = 0; - ctrlr->num_io_queues = 1; - ctrlr->num_cpus_per_ioq = mp_ncpus; - ctrlr->rid = 0; - ctrlr->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, - &ctrlr->rid, RF_SHAREABLE | RF_ACTIVE); - - if (ctrlr->res == NULL) { - nvme_printf(ctrlr, "unable to allocate shared IRQ\n"); - return (ENOMEM); - } - - bus_setup_intr(ctrlr->dev, ctrlr->res, - INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_intx_handler, - ctrlr, &ctrlr->tag); - - if (ctrlr->tag == NULL) { - nvme_printf(ctrlr, "unable to setup intx handler\n"); - return (ENOMEM); - } - - return (0); -} - static void nvme_pt_done(void *arg, const struct nvme_completion *cpl) { @@ -1177,88 +1112,6 @@ static struct cdevsw nvme_ctrlr_cdevsw = { .d_ioctl = nvme_ctrlr_ioctl }; -static void -nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr) -{ - device_t dev; - int per_cpu_io_queues; - int min_cpus_per_ioq; - int num_vectors_requested, num_vectors_allocated; - int num_vectors_available; - - dev = ctrlr->dev; - min_cpus_per_ioq = 1; - TUNABLE_INT_FETCH("hw.nvme.min_cpus_per_ioq", &min_cpus_per_ioq); - - if (min_cpus_per_ioq < 1) { - min_cpus_per_ioq = 1; - } else if (min_cpus_per_ioq > mp_ncpus) { - min_cpus_per_ioq = mp_ncpus; - } - - per_cpu_io_queues = 1; - TUNABLE_INT_FETCH("hw.nvme.per_cpu_io_queues", &per_cpu_io_queues); - - if (per_cpu_io_queues == 0) { - min_cpus_per_ioq = mp_ncpus; - } - - ctrlr->force_intx = 0; - TUNABLE_INT_FETCH("hw.nvme.force_intx", &ctrlr->force_intx); - - /* - * FreeBSD currently cannot allocate more than about 190 vectors at - * boot, meaning that systems with high core count and many devices - * requesting per-CPU interrupt vectors will not get their full - * allotment. So first, try to allocate as many as we may need to - * understand what is available, then immediately release them. - * Then figure out how many of those we will actually use, based on - * assigning an equal number of cores to each I/O queue. - */ - - /* One vector for per core I/O queue, plus one vector for admin queue. */ - num_vectors_available = min(pci_msix_count(dev), mp_ncpus + 1); - if (pci_alloc_msix(dev, &num_vectors_available) != 0) { - num_vectors_available = 0; - } - pci_release_msi(dev); - - if (ctrlr->force_intx || num_vectors_available < 2) { - nvme_ctrlr_configure_intx(ctrlr); - return; - } - - /* - * Do not use all vectors for I/O queues - one must be saved for the - * admin queue. - */ - ctrlr->num_cpus_per_ioq = max(min_cpus_per_ioq, - howmany(mp_ncpus, num_vectors_available - 1)); - - ctrlr->num_io_queues = howmany(mp_ncpus, ctrlr->num_cpus_per_ioq); - num_vectors_requested = ctrlr->num_io_queues + 1; - num_vectors_allocated = num_vectors_requested; - - /* - * Now just allocate the number of vectors we need. This should - * succeed, since we previously called pci_alloc_msix() - * successfully returning at least this many vectors, but just to - * be safe, if something goes wrong just revert to INTx. - */ - if (pci_alloc_msix(dev, &num_vectors_allocated) != 0) { - nvme_ctrlr_configure_intx(ctrlr); - return; - } - - if (num_vectors_allocated < num_vectors_requested) { - pci_release_msi(dev); - nvme_ctrlr_configure_intx(ctrlr); - return; - } - - ctrlr->msix_enabled = 1; -} - int nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) { @@ -1274,11 +1127,6 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de mtx_init(&ctrlr->lock, "nvme ctrlr lock", NULL, MTX_DEF); - status = nvme_ctrlr_allocate_bar(ctrlr); - - if (status != 0) - return (status); - /* * Software emulators may set the doorbell stride to something * other than zero, but this driver is not set up to handle that. @@ -1308,8 +1156,6 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de ctrlr->enable_aborts = 0; TUNABLE_INT_FETCH("hw.nvme.enable_aborts", &ctrlr->enable_aborts); - nvme_ctrlr_setup_interrupts(ctrlr); - ctrlr->max_xfer_size = NVME_MAX_XFER_SIZE; if (nvme_ctrlr_construct_admin_qpair(ctrlr) != 0) return (ENXIO); @@ -1394,9 +1240,6 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev if (ctrlr->res) bus_release_resource(ctrlr->dev, SYS_RES_IRQ, rman_get_rid(ctrlr->res), ctrlr->res); - - if (ctrlr->msix_enabled) - pci_release_msi(dev); if (ctrlr->bar4_resource != NULL) { bus_release_resource(dev, SYS_RES_MEMORY, Added: head/sys/dev/nvme/nvme_pci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/nvme/nvme_pci.c Wed Aug 21 22:17:55 2019 (r351355) @@ -0,0 +1,333 @@ +/*- + * Copyright (C) 2012-2016 Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, 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 +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "nvme_private.h" + +static int nvme_pci_probe(device_t); +static int nvme_pci_attach(device_t); +static int nvme_pci_detach(device_t); + +static void nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr); + +static device_method_t nvme_pci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, nvme_pci_probe), + DEVMETHOD(device_attach, nvme_pci_attach), + DEVMETHOD(device_detach, nvme_pci_detach), + DEVMETHOD(device_shutdown, nvme_shutdown), + { 0, 0 } +}; + +static driver_t nvme_pci_driver = { + "nvme", + nvme_pci_methods, + sizeof(struct nvme_controller), +}; + +DRIVER_MODULE(nvme, pci, nvme_pci_driver, nvme_devclass, NULL, 0); +MODULE_VERSION(nvme_pci, 1); + +static struct _pcsid +{ + uint32_t devid; + int match_subdevice; + uint16_t subdevice; + const char *desc; + uint32_t quirks; +} pci_ids[] = { + { 0x01118086, 0, 0, "NVMe Controller" }, + { IDT32_PCI_ID, 0, 0, "IDT NVMe Controller (32 channel)" }, + { IDT8_PCI_ID, 0, 0, "IDT NVMe Controller (8 channel)" }, + { 0x09538086, 1, 0x3702, "DC P3700 SSD" }, + { 0x09538086, 1, 0x3703, "DC P3700 SSD [2.5\" SFF]" }, + { 0x09538086, 1, 0x3704, "DC P3500 SSD [Add-in Card]" }, + { 0x09538086, 1, 0x3705, "DC P3500 SSD [2.5\" SFF]" }, + { 0x09538086, 1, 0x3709, "DC P3600 SSD [Add-in Card]" }, + { 0x09538086, 1, 0x370a, "DC P3600 SSD [2.5\" SFF]" }, + { 0x00031c58, 0, 0, "HGST SN100", QUIRK_DELAY_B4_CHK_RDY }, + { 0x00231c58, 0, 0, "WDC SN200", QUIRK_DELAY_B4_CHK_RDY }, + { 0x05401c5f, 0, 0, "Memblaze Pblaze4", QUIRK_DELAY_B4_CHK_RDY }, + { 0xa821144d, 0, 0, "Samsung PM1725", QUIRK_DELAY_B4_CHK_RDY }, + { 0xa822144d, 0, 0, "Samsung PM1725a", QUIRK_DELAY_B4_CHK_RDY }, + { 0x00000000, 0, 0, NULL } +}; + + +static int +nvme_match(uint32_t devid, uint16_t subdevice, struct _pcsid *ep) +{ + if (devid != ep->devid) + return 0; + + if (!ep->match_subdevice) + return 1; + + if (subdevice == ep->subdevice) + return 1; + else + return 0; +} + +static int +nvme_pci_probe (device_t device) +{ + struct nvme_controller *ctrlr = DEVICE2SOFTC(device); + struct _pcsid *ep; + uint32_t devid; + uint16_t subdevice; + + devid = pci_get_devid(device); + subdevice = pci_get_subdevice(device); + ep = pci_ids; + + while (ep->devid) { + if (nvme_match(devid, subdevice, ep)) + break; + ++ep; + } + if (ep->devid) + ctrlr->quirks = ep->quirks; + + if (ep->desc) { + device_set_desc(device, ep->desc); + return (BUS_PROBE_DEFAULT); + } + +#if defined(PCIS_STORAGE_NVM) + if (pci_get_class(device) == PCIC_STORAGE && + pci_get_subclass(device) == PCIS_STORAGE_NVM && + pci_get_progif(device) == PCIP_STORAGE_NVM_ENTERPRISE_NVMHCI_1_0) { + device_set_desc(device, "Generic NVMe Device"); + return (BUS_PROBE_GENERIC); + } +#endif + + return (ENXIO); +} + +static int +nvme_ctrlr_allocate_bar(struct nvme_controller *ctrlr) +{ + + ctrlr->resource_id = PCIR_BAR(0); + + ctrlr->resource = bus_alloc_resource_any(ctrlr->dev, SYS_RES_MEMORY, + &ctrlr->resource_id, RF_ACTIVE); + + if(ctrlr->resource == NULL) { + nvme_printf(ctrlr, "unable to allocate pci resource\n"); + return (ENOMEM); + } + + ctrlr->bus_tag = rman_get_bustag(ctrlr->resource); + ctrlr->bus_handle = rman_get_bushandle(ctrlr->resource); + ctrlr->regs = (struct nvme_registers *)ctrlr->bus_handle; + + /* + * The NVMe spec allows for the MSI-X table to be placed behind + * BAR 4/5, separate from the control/doorbell registers. Always + * try to map this bar, because it must be mapped prior to calling + * pci_alloc_msix(). If the table isn't behind BAR 4/5, + * bus_alloc_resource() will just return NULL which is OK. + */ + ctrlr->bar4_resource_id = PCIR_BAR(4); + ctrlr->bar4_resource = bus_alloc_resource_any(ctrlr->dev, SYS_RES_MEMORY, + &ctrlr->bar4_resource_id, RF_ACTIVE); + + return (0); +} + +static int +nvme_pci_attach(device_t dev) +{ + struct nvme_controller*ctrlr = DEVICE2SOFTC(dev); + int status; + + ctrlr->dev = dev; + status = nvme_ctrlr_allocate_bar(ctrlr); + if (status != 0) + goto bad; + pci_enable_busmaster(dev); + nvme_ctrlr_setup_interrupts(ctrlr); + return nvme_attach(dev); +bad: + if (ctrlr->resource != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + ctrlr->resource_id, ctrlr->resource); + } + + if (ctrlr->bar4_resource != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + ctrlr->bar4_resource_id, ctrlr->bar4_resource); + } + + if (ctrlr->tag) + bus_teardown_intr(dev, ctrlr->res, ctrlr->tag); + + if (ctrlr->res) + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(ctrlr->res), ctrlr->res); + + if (ctrlr->msix_enabled) + pci_release_msi(dev); + + return status; +} + +static int +nvme_pci_detach(device_t dev) +{ + struct nvme_controller*ctrlr = DEVICE2SOFTC(dev); + + if (ctrlr->msix_enabled) + pci_release_msi(dev); + pci_disable_busmaster(dev); + return (nvme_detach(dev)); +} + +static int +nvme_ctrlr_configure_intx(struct nvme_controller *ctrlr) +{ + + ctrlr->msix_enabled = 0; + ctrlr->num_io_queues = 1; + ctrlr->num_cpus_per_ioq = mp_ncpus; + ctrlr->rid = 0; + ctrlr->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, + &ctrlr->rid, RF_SHAREABLE | RF_ACTIVE); + + if (ctrlr->res == NULL) { + nvme_printf(ctrlr, "unable to allocate shared IRQ\n"); + return (ENOMEM); + } + + bus_setup_intr(ctrlr->dev, ctrlr->res, + INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_intx_handler, + ctrlr, &ctrlr->tag); + + if (ctrlr->tag == NULL) { + nvme_printf(ctrlr, "unable to setup intx handler\n"); + return (ENOMEM); + } + + return (0); +} + +static void +nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr) +{ + device_t dev; + int per_cpu_io_queues; + int min_cpus_per_ioq; + int num_vectors_requested, num_vectors_allocated; + int num_vectors_available; + + dev = ctrlr->dev; + min_cpus_per_ioq = 1; + TUNABLE_INT_FETCH("hw.nvme.min_cpus_per_ioq", &min_cpus_per_ioq); + + if (min_cpus_per_ioq < 1) { + min_cpus_per_ioq = 1; + } else if (min_cpus_per_ioq > mp_ncpus) { + min_cpus_per_ioq = mp_ncpus; + } + + per_cpu_io_queues = 1; + TUNABLE_INT_FETCH("hw.nvme.per_cpu_io_queues", &per_cpu_io_queues); + + if (per_cpu_io_queues == 0) { + min_cpus_per_ioq = mp_ncpus; + } + + ctrlr->force_intx = 0; + TUNABLE_INT_FETCH("hw.nvme.force_intx", &ctrlr->force_intx); + + /* + * FreeBSD currently cannot allocate more than about 190 vectors at + * boot, meaning that systems with high core count and many devices + * requesting per-CPU interrupt vectors will not get their full + * allotment. So first, try to allocate as many as we may need to + * understand what is available, then immediately release them. + * Then figure out how many of those we will actually use, based on + * assigning an equal number of cores to each I/O queue. + */ + + /* One vector for per core I/O queue, plus one vector for admin queue. */ + num_vectors_available = min(pci_msix_count(dev), mp_ncpus + 1); + if (pci_alloc_msix(dev, &num_vectors_available) != 0) { + num_vectors_available = 0; + } + pci_release_msi(dev); + + if (ctrlr->force_intx || num_vectors_available < 2) { + nvme_ctrlr_configure_intx(ctrlr); + return; + } + + /* + * Do not use all vectors for I/O queues - one must be saved for the + * admin queue. + */ + ctrlr->num_cpus_per_ioq = max(min_cpus_per_ioq, + howmany(mp_ncpus, num_vectors_available - 1)); + + ctrlr->num_io_queues = howmany(mp_ncpus, ctrlr->num_cpus_per_ioq); + num_vectors_requested = ctrlr->num_io_queues + 1; + num_vectors_allocated = num_vectors_requested; + + /* + * Now just allocate the number of vectors we need. This should + * succeed, since we previously called pci_alloc_msix() + * successfully returning at least this many vectors, but just to + * be safe, if something goes wrong just revert to INTx. + */ + if (pci_alloc_msix(dev, &num_vectors_allocated) != 0) { + nvme_ctrlr_configure_intx(ctrlr); + return; + } + + if (num_vectors_allocated < num_vectors_requested) { + pci_release_msi(dev); + nvme_ctrlr_configure_intx(ctrlr); + return; + } + + ctrlr->msix_enabled = 1; +} Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Wed Aug 21 21:05:15 2019 (r351354) +++ head/sys/dev/nvme/nvme_private.h Wed Aug 21 22:17:55 2019 (r351355) @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -122,6 +123,8 @@ struct nvme_completion_poll_status { int done; }; +extern devclass_t nvme_devclass; + #define NVME_REQUEST_VADDR 1 #define NVME_REQUEST_NULL 2 /* For requests with no payload. */ #define NVME_REQUEST_UIO 3 @@ -438,6 +441,10 @@ void nvme_sysctl_initialize_ctrlr(struct nvme_controll void nvme_dump_command(struct nvme_command *cmd); void nvme_dump_completion(struct nvme_completion *cpl); + +int nvme_attach(device_t dev); +int nvme_shutdown(device_t dev); +int nvme_detach(device_t dev); static __inline void nvme_single_map(void *arg, bus_dma_segment_t *seg, int nseg, int error) Modified: head/sys/modules/nvme/Makefile ============================================================================== --- head/sys/modules/nvme/Makefile Wed Aug 21 21:05:15 2019 (r351354) +++ head/sys/modules/nvme/Makefile Wed Aug 21 22:17:55 2019 (r351355) @@ -9,6 +9,7 @@ SRCS = nvme.c \ nvme_ctrlr_cmd.c \ nvme_ns.c \ nvme_ns_cmd.c \ + nvme_pci.c \ nvme_qpair.c \ nvme_sim.c \ nvme_sysctl.c \ From owner-svn-src-head@freebsd.org Wed Aug 21 22:18:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DAE6D5D21; Wed, 21 Aug 2019 22:18:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DMVf75mhz4d59; Wed, 21 Aug 2019 22:18:02 +0000 (UTC) (envelope-from imp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D63532253B; Wed, 21 Aug 2019 22:18:02 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7LMI2ak004977; Wed, 21 Aug 2019 22:18:02 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LMI1kO004971; Wed, 21 Aug 2019 22:18:01 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908212218.x7LMI1kO004971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Aug 2019 22:18:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351356 - in head/sys: conf dev/ahci dev/nvme modules/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: conf dev/ahci dev/nvme modules/nvme X-SVN-Commit-Revision: 351356 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 22:18:03 -0000 Author: imp Date: Wed Aug 21 22:18:01 2019 New Revision: 351356 URL: https://svnweb.freebsd.org/changeset/base/351356 Log: Create a AHCI attachment for nvme. Intel has created RST and many laptops from vendors like Lenovo and Asus. It's a mechanism for creating multiple boot devices under windows. It effectively hides the nvme drive inside of the ahci controller. The details are supposed to be a trade secret. However, there's a reverse engineered Linux driver, and this implements similar operations to allow nvme drives to attach. The ahci driver attaches nvme children that proxy the remapped resources to the child. nvme_ahci is just like nvme_pci, except it doesn't do the PCI specific things. That's moved into ahci where appropriate. When the nvme drive is remapped, MSI-x interrupts aren't forwarded (the linux driver doesn't know how to use this either). INTx interrupts are used instead. This is suboptimal, but usually sufficient for the laptops these parts are in. This is based loosely on https://www.spinics.net/lists/linux-ide/msg53364.html submitted, but not accepted by, Linux. It was written by Dan Williams. These changes were written from scratch by Olivier Houchard. Submitted by: cognet@ (Olivier Houchard) Added: head/sys/dev/nvme/nvme_ahci.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci.h head/sys/dev/ahci/ahci_pci.c head/sys/modules/nvme/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Aug 21 22:17:55 2019 (r351355) +++ head/sys/conf/files Wed Aug 21 22:18:01 2019 (r351356) @@ -2479,6 +2479,7 @@ dev/nmdm/nmdm.c optional nmdm dev/null/null.c standard dev/nvd/nvd.c optional nvd nvme dev/nvme/nvme.c optional nvme +dev/nvme/nvme_ahci.c optional nvme ahci dev/nvme/nvme_ctrlr.c optional nvme dev/nvme/nvme_ctrlr_cmd.c optional nvme dev/nvme/nvme_ns.c optional nvme Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Wed Aug 21 22:17:55 2019 (r351355) +++ head/sys/dev/ahci/ahci.c Wed Aug 21 22:18:01 2019 (r351356) @@ -347,6 +347,16 @@ ahci_attach(device_t dev) if ((ctlr->ichannels & (1 << unit)) == 0) device_disable(child); } + /* Attach any remapped NVME device */ + for (; unit < ctlr->channels + ctlr->remapped_devices; unit++) { + child = device_add_child(dev, "nvme", -1); + if (child == NULL) { + device_printf(dev, "failed to add remapped NVMe device"); + continue; + } + device_set_ivars(child, (void *)(intptr_t)(unit | AHCI_REMAPPED_UNIT)); + } + if (ctlr->caps & AHCI_CAP_EMS) { child = device_add_child(dev, "ahciem", -1); if (child == NULL) @@ -497,6 +507,12 @@ ahci_intr(void *data) ctlr->interrupt[unit].function(arg); } } + for (; unit < ctlr->channels + ctlr->remapped_devices; unit++) { + if ((arg = ctlr->interrupt[unit].argument)) { + ctlr->interrupt[unit].function(arg); + } + } + /* AHCI declares level triggered IS. */ if (!(ctlr->quirks & AHCI_Q_EDGEIS)) ATA_OUTL(ctlr->r_mem, AHCI_IS, is); @@ -546,12 +562,23 @@ ahci_alloc_resource(device_t dev, device_t child, int struct resource *res; rman_res_t st; int offset, size, unit; + bool is_remapped; unit = (intptr_t)device_get_ivars(child); + if (unit & AHCI_REMAPPED_UNIT) { + unit &= ~AHCI_REMAPPED_UNIT; + unit -= ctlr->channels; + is_remapped = true; + } else + is_remapped = false; res = NULL; switch (type) { case SYS_RES_MEMORY: - if (unit >= 0) { + if (is_remapped) { + offset = ctlr->remap_offset + unit * ctlr->remap_size; + size = ctlr->remap_size; + } + else if (unit >= 0) { offset = AHCI_OFFSET + (unit << 7); size = 128; } else if (*rid == 0) { @@ -612,7 +639,7 @@ ahci_setup_intr(device_t dev, device_t child, struct r void *argument, void **cookiep) { struct ahci_controller *ctlr = device_get_softc(dev); - int unit = (intptr_t)device_get_ivars(child); + int unit = (intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; if (filter != NULL) { printf("ahci.c: we cannot use a filter here\n"); @@ -628,7 +655,7 @@ ahci_teardown_intr(device_t dev, device_t child, struc void *cookie) { struct ahci_controller *ctlr = device_get_softc(dev); - int unit = (intptr_t)device_get_ivars(child); + int unit = (intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; ctlr->interrupt[unit].function = NULL; ctlr->interrupt[unit].argument = NULL; @@ -641,7 +668,7 @@ ahci_print_child(device_t dev, device_t child) int retval, channel; retval = bus_print_child_header(dev, child); - channel = (int)(intptr_t)device_get_ivars(child); + channel = (int)(intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; if (channel >= 0) retval += printf(" at channel %d", channel); retval += bus_print_child_footer(dev, child); @@ -654,7 +681,7 @@ ahci_child_location_str(device_t dev, device_t child, { int channel; - channel = (int)(intptr_t)device_get_ivars(child); + channel = (int)(intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; if (channel >= 0) snprintf(buf, buflen, "channel=%d", channel); return (0); Modified: head/sys/dev/ahci/ahci.h ============================================================================== --- head/sys/dev/ahci/ahci.h Wed Aug 21 22:17:55 2019 (r351355) +++ head/sys/dev/ahci/ahci.h Wed Aug 21 22:18:01 2019 (r351356) @@ -214,6 +214,7 @@ #define AHCI_CAP2_SADM 0x00000010 #define AHCI_CAP2_DESO 0x00000020 +#define AHCI_VSCAP 0xa4 #define AHCI_OFFSET 0x100 #define AHCI_STEP 0x80 @@ -318,6 +319,10 @@ /* Total main work area. */ #define AHCI_WORK_SIZE (AHCI_CT_OFFSET + AHCI_CT_SIZE * ch->numslots) + +/* NVMe remapped device */ +#define AHCI_REMAPPED_UNIT (1 << 31) + struct ahci_dma_prd { u_int64_t dba; u_int32_t reserved; @@ -518,6 +523,9 @@ struct ahci_controller { int cccv; /* CCC vector */ int direct; /* Direct command completion */ int msi; /* MSI interupts */ + int remapped_devices; /* Remapped NVMe devices */ + uint32_t remap_offset; + uint32_t remap_size; struct { void (*function)(void *); void *argument; Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Wed Aug 21 22:17:55 2019 (r351355) +++ head/sys/dev/ahci/ahci_pci.c Wed Aug 21 22:18:01 2019 (r351356) @@ -495,6 +495,48 @@ ahci_pci_attach(device_t dev) &ctlr->r_rid, RF_ACTIVE))) return ENXIO; + /* + * Intel RAID hardware can remap NVMe devices inside its BAR. + * Try to detect this. Either we have to add the device + * here, or the user has to change the mode in the BIOS + * from RST to AHCI. + */ + if (pci_get_vendor(dev) == 0x8086) { + uint32_t vscap; + + vscap = ATA_INL(ctlr->r_mem, AHCI_VSCAP); + if (vscap & 1) { + uint32_t cap = ATA_INL(ctlr->r_mem, 0x800); /* Intel's REMAP CAP */ + int i; + + ctlr->remap_offset = 0x4000; + ctlr->remap_size = 0x4000; + + /* + * Check each of the devices that might be remapped to + * make sure they are an nvme device. At the present, + * nvme are the only known devices remapped. + */ + for (i = 0; i < 3; i++) { + if (cap & (1 << i) && + (ATA_INL(ctlr->r_mem, 0x880 + i * 0x80) == + ((PCIC_STORAGE << 16) | + (PCIS_STORAGE_NVM << 8) | + PCIP_STORAGE_NVM_ENTERPRISE_NVMHCI_1_0))) { + ctlr->remapped_devices++; + } + } + + /* If we have any remapped device, disable MSI */ + if (ctlr->remapped_devices > 0) { + device_printf(dev, "Detected %d nvme remapped devices\n", + ctlr->remapped_devices); + ctlr->quirks |= (AHCI_Q_NOMSIX | AHCI_Q_NOMSI); + } + } + } + + if (ctlr->quirks & AHCI_Q_NOMSIX) msix_count = 0; Added: head/sys/dev/nvme/nvme_ahci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/nvme/nvme_ahci.c Wed Aug 21 22:18:01 2019 (r351356) @@ -0,0 +1,127 @@ +/*- + * Copyright (C) 2017 Olivier Houchard + * + * 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 +#include +#include +#include +#include +#include +#include + +#include "nvme_private.h" + +static int nvme_ahci_probe(device_t dev); +static int nvme_ahci_attach(device_t dev); +static int nvme_ahci_detach(device_t dev); + +static device_method_t nvme_ahci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, nvme_ahci_probe), + DEVMETHOD(device_attach, nvme_ahci_attach), + DEVMETHOD(device_detach, nvme_ahci_detach), + DEVMETHOD(device_shutdown, nvme_shutdown), + { 0, 0 } +}; + +static driver_t nvme_ahci_driver = { + "nvme", + nvme_ahci_methods, + sizeof(struct nvme_controller), +}; + +DRIVER_MODULE(nvme, ahci, nvme_ahci_driver, nvme_devclass, NULL, 0); +MODULE_VERSION(nvme_ahci, 1); + +static int +nvme_ahci_probe (device_t device) +{ + return (0); +} + +static int +nvme_ahci_attach(device_t dev) +{ + struct nvme_controller*ctrlr = DEVICE2SOFTC(dev); + int ret; + + /* Map MMIO registers */ + ctrlr->resource_id = 0; + + ctrlr->resource = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &ctrlr->resource_id, RF_ACTIVE); + + if(ctrlr->resource == NULL) { + nvme_printf(ctrlr, "unable to allocate mem resource\n"); + ret = ENOMEM; + goto bad; + } + ctrlr->bus_tag = rman_get_bustag(ctrlr->resource); + ctrlr->bus_handle = rman_get_bushandle(ctrlr->resource); + ctrlr->regs = (struct nvme_registers *)ctrlr->bus_handle; + + /* Allocate and setup IRQ */ + ctrlr->rid = 0; + ctrlr->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &ctrlr->rid, RF_SHAREABLE | RF_ACTIVE); + + if (ctrlr->res == NULL) { + nvme_printf(ctrlr, "unable to allocate shared IRQ\n"); + ret = ENOMEM; + goto bad; + } + + ctrlr->msix_enabled = 0; + ctrlr->num_io_queues = 1; + ctrlr->num_cpus_per_ioq = mp_ncpus; + if (bus_setup_intr(dev, ctrlr->res, + INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_intx_handler, + ctrlr, &ctrlr->tag) != 0) { + nvme_printf(ctrlr, "unable to setup intx handler\n"); + ret = ENOMEM; + goto bad; + } + ctrlr->tag = (void *)0x1; + + return nvme_attach(dev); +bad: + if (ctrlr->resource != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + ctrlr->resource_id, ctrlr->resource); + } + if (ctrlr->res) + bus_release_resource(ctrlr->dev, SYS_RES_IRQ, + rman_get_rid(ctrlr->res), ctrlr->res); + return (ret); +} + +static int +nvme_ahci_detach(device_t dev) +{ + + return (nvme_detach(dev)); +} Modified: head/sys/modules/nvme/Makefile ============================================================================== --- head/sys/modules/nvme/Makefile Wed Aug 21 22:17:55 2019 (r351355) +++ head/sys/modules/nvme/Makefile Wed Aug 21 22:18:01 2019 (r351356) @@ -5,6 +5,7 @@ KMOD = nvme SRCS = nvme.c \ + nvme_ahci.c \ nvme_ctrlr.c \ nvme_ctrlr_cmd.c \ nvme_ns.c \ From owner-svn-src-head@freebsd.org Wed Aug 21 22:18:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4700DD5D60; Wed, 21 Aug 2019 22:18:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DMVm0mfvz4dCQ; Wed, 21 Aug 2019 22:18:08 +0000 (UTC) (envelope-from imp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF6C82253C; Wed, 21 Aug 2019 22:18:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7LMI7Ws005032; Wed, 21 Aug 2019 22:18:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LMI7vg005030; Wed, 21 Aug 2019 22:18:07 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908212218.x7LMI7vg005030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Aug 2019 22:18:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351357 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 351357 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 22:18:08 -0000 Author: imp Date: Wed Aug 21 22:18:07 2019 New Revision: 351357 URL: https://svnweb.freebsd.org/changeset/base/351357 Log: Document RST support in nvme(4) and ahci(4). Modified: head/share/man/man4/ahci.4 head/share/man/man4/nvme.4 Modified: head/share/man/man4/ahci.4 ============================================================================== --- head/share/man/man4/ahci.4 Wed Aug 21 22:18:01 2019 (r351356) +++ head/share/man/man4/ahci.4 Wed Aug 21 22:18:07 2019 (r351357) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 2, 2018 +.Dd August 21, 2019 .Dt AHCI 4 .Os .Sh NAME @@ -153,6 +153,26 @@ subclass 6 (SATA) and programming interface 1 (AHCI). Also, in cooperation with atamarvell and atajmicron drivers of ata(4), it supports AHCI part of legacy-PATA + AHCI-SATA combined controllers, such as JMicron JMB36x and Marvell 88SE61xx. +.Pp +The +.Nm +driver also supports AHCI devices that act as PCI bridges for +.Xr nvme 4 +using Intel Rapid Storage Technology (RST). +To use the +.Xr nvme 4 +device, either one must set the SATA mode in the BIOS to AHCI (from RST), +or one must accept the performance with RST enabled due to interrupt sharing. +.Fx +will automatically detect AHCI devices with this extension that are in RST +mode. +When that happens, +.Nm +will attach +.Xr nvme 4 +children to the +.Xr ahci 4 +device. .Sh FILES .Bl -tag -width /dev/led/ahcich*.locate .It Pa /dev/led/ahci*.*.act Modified: head/share/man/man4/nvme.4 ============================================================================== --- head/share/man/man4/nvme.4 Wed Aug 21 22:18:01 2019 (r351356) +++ head/share/man/man4/nvme.4 Wed Aug 21 22:18:07 2019 (r351357) @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 18, 2019 +.Dd August 21, 2019 .Dt NVME 4 .Os .Sh NAME @@ -207,6 +207,23 @@ with a completion entry that was posted by the control (W) Writing 1 to this sysctl will dump the full contents of the submission and completion queues to the console. .El +.Pp +In addition to the typical pci attachment, the +.Nm +driver supports attaching to a +.Xr ahci 4 +device. +Intel's Rapid Storage Technology (RST) hides the nvme device +behind the AHCI device due to limitations in Windows. +However, this effectively hides it from the +.Fx +kernel. +To work around this limitation, +.Fx +detects that the AHCI device supports RST and when it is enabled. +See +.Xr ahci 4 +for more details. .Sh SEE ALSO .Xr nda 4 , .Xr nvd 4 , From owner-svn-src-head@freebsd.org Wed Aug 21 23:13:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29DFCD71A5; Wed, 21 Aug 2019 23:13:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DNk50Jjrz3CsL; Wed, 21 Aug 2019 23:13:01 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E05FE22FFB; Wed, 21 Aug 2019 23:13:00 +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 x7LND0FP040237; Wed, 21 Aug 2019 23:13:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LND0OP040236; Wed, 21 Aug 2019 23:13:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908212313.x7LND0OP040236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 21 Aug 2019 23:13:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351359 - head/cddl/contrib/opensolaris/cmd/lockstat X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/lockstat X-SVN-Commit-Revision: 351359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 23:13:01 -0000 Author: markj Date: Wed Aug 21 23:13:00 2019 New Revision: 351359 URL: https://svnweb.freebsd.org/changeset/base/351359 Log: Fix inverted predicates for sx lock hold events in lockstat(1). This caused shared sx holds to be reported as exclusive, and vice versa. Reviewed by: mjg MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Wed Aug 21 22:42:08 2019 (r351358) +++ head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Wed Aug 21 23:13:00 2019 (r351359) @@ -206,10 +206,10 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = { "lockstat:::rw-release", "arg1 == 1", "lockstat:::rw-acquire" }, { 'H', "Lock", "SX shared hold", "nsec", - "lockstat:::sx-release", "arg1 == 0", + "lockstat:::sx-release", "arg1 == 1", "lockstat:::sx-acquire" }, { 'H', "Lock", "SX exclusive hold", "nsec", - "lockstat:::sx-release", "arg1 == 1", + "lockstat:::sx-release", "arg1 == 0", "lockstat:::sx-acquire" }, { 'H', "Lock", "Unknown event (type 38)", "units" }, { 'H', "Lock", "Unknown event (type 39)", "units" }, From owner-svn-src-head@freebsd.org Wed Aug 21 23:24:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E11C9D745F; Wed, 21 Aug 2019 23:24:40 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DNzX5fLhz3DWX; Wed, 21 Aug 2019 23:24:40 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B89BD231CD; Wed, 21 Aug 2019 23:24:40 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7LNOeVU046595; Wed, 21 Aug 2019 23:24:40 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LNOeTj046593; Wed, 21 Aug 2019 23:24:40 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908212324.x7LNOeTj046593@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 21 Aug 2019 23:24:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351360 - head/sys/fs/nullfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/nullfs X-SVN-Commit-Revision: 351360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 23:24:40 -0000 Author: mjg Date: Wed Aug 21 23:24:40 2019 New Revision: 351360 URL: https://svnweb.freebsd.org/changeset/base/351360 Log: nullfs: lock the vnode with LK_SHARED in null_vptocnp null_nodeget which follows almost always finds the target vnode in the hash, avoiding insmntque1 altogether. Should it be needed, it already checks if the lock needs to be upgraded. Reviewed by: kib Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20244 Modified: head/sys/fs/nullfs/null_subr.c head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_subr.c ============================================================================== --- head/sys/fs/nullfs/null_subr.c Wed Aug 21 23:13:00 2019 (r351359) +++ head/sys/fs/nullfs/null_subr.c Wed Aug 21 23:24:40 2019 (r351360) @@ -222,9 +222,6 @@ null_nodeget(mp, lowervp, vpp) * provide ready to use vnode. */ if (VOP_ISLOCKED(lowervp) != LK_EXCLUSIVE) { - KASSERT((MOUNTTONULLMOUNT(mp)->nullm_flags & NULLM_CACHE) != 0, - ("lowervp %p is not excl locked and cache is disabled", - lowervp)); vn_lock(lowervp, LK_UPGRADE | LK_RETRY); if ((lowervp->v_iflag & VI_DOOMED) != 0) { vput(lowervp); Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Wed Aug 21 23:13:00 2019 (r351359) +++ head/sys/fs/nullfs/null_vnops.c Wed Aug 21 23:24:40 2019 (r351360) @@ -893,11 +893,7 @@ null_vptocnp(struct vop_vptocnp_args *ap) return (ENOENT); } - /* - * Exclusive lock is required by insmntque1 call in - * null_nodeget() - */ - error = vn_lock(ldvp, LK_EXCLUSIVE); + error = vn_lock(ldvp, LK_SHARED); if (error != 0) { vrele(ldvp); vn_lock(vp, locked | LK_RETRY); From owner-svn-src-head@freebsd.org Wed Aug 21 23:44:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13F40D79B0; Wed, 21 Aug 2019 23:44:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DPPr0GPTz3FRT; Wed, 21 Aug 2019 23:44:00 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0433623556; Wed, 21 Aug 2019 23:44:00 +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 x7LNhxYN058388; Wed, 21 Aug 2019 23:43:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LNhxkh058383; Wed, 21 Aug 2019 23:43:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908212343.x7LNhxkh058383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 21 Aug 2019 23:43:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351361 - in head: cddl/contrib/opensolaris/cmd/lockstat share/man/man4 sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/lockstat share/man/man4 sys/kern sys/sys X-SVN-Commit-Revision: 351361 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 23:44:00 -0000 Author: markj Date: Wed Aug 21 23:43:58 2019 New Revision: 351361 URL: https://svnweb.freebsd.org/changeset/base/351361 Log: Add lockmgr(9) probes to the lockstat DTrace provider. They follow the conventions set by rw and sx lock probes. There is an additional lockstat:::lockmgr-disown probe. Update lockstat(1) to report on contention and hold events for lockmgr locks. Document the new probes in dtrace_lockstat.4, and deduplicate some of the existing probe descriptions. Reviewed by: mjg MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21355 Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c head/share/man/man4/dtrace_lockstat.4 head/sys/kern/kern_lock.c head/sys/kern/kern_lockstat.c head/sys/sys/lockstat.h Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Wed Aug 21 23:24:40 2019 (r351360) +++ head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Wed Aug 21 23:43:58 2019 (r351361) @@ -158,29 +158,33 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = { { 'C', "Lock", "R/W writer blocked by readers", "nsec", "lockstat:::rw-block", "arg2 == 0 && arg3 == 0 && arg4" }, { 'C', "Lock", "R/W reader blocked by writer", "nsec", - "lockstat:::rw-block", "arg2 != 0 && arg3 == 1" }, + "lockstat:::rw-block", "arg2 == 1 && arg3 == 1" }, { 'C', "Lock", "R/W reader blocked by write wanted", "nsec", - "lockstat:::rw-block", "arg2 != 0 && arg3 == 0 && arg4" }, + "lockstat:::rw-block", "arg2 == 1 && arg3 == 0 && arg4" }, { 'C', "Lock", "R/W writer spin on writer", "nsec", "lockstat:::rw-spin", "arg2 == 0 && arg3 == 1" }, { 'C', "Lock", "R/W writer spin on readers", "nsec", "lockstat:::rw-spin", "arg2 == 0 && arg3 == 0 && arg4" }, { 'C', "Lock", "R/W reader spin on writer", "nsec", - "lockstat:::rw-spin", "arg2 != 0 && arg3 == 1" }, + "lockstat:::rw-spin", "arg2 == 1 && arg3 == 1" }, { 'C', "Lock", "R/W reader spin on write wanted", "nsec", - "lockstat:::rw-spin", "arg2 != 0 && arg3 == 0 && arg4" }, + "lockstat:::rw-spin", "arg2 == 1 && arg3 == 0 && arg4" }, { 'C', "Lock", "SX exclusive block", "nsec", "lockstat:::sx-block", "arg2 == 0" }, { 'C', "Lock", "SX shared block", "nsec", - "lockstat:::sx-block", "arg2 != 0" }, + "lockstat:::sx-block", "arg2 == 1" }, { 'C', "Lock", "SX exclusive spin", "nsec", "lockstat:::sx-spin", "arg2 == 0" }, { 'C', "Lock", "SX shared spin", "nsec", - "lockstat:::sx-spin", "arg2 != 0" }, - { 'C', "Lock", "Unknown event (type 16)", "units" }, - { 'C', "Lock", "Unknown event (type 17)", "units" }, - { 'C', "Lock", "Unknown event (type 18)", "units" }, - { 'C', "Lock", "Unknown event (type 19)", "units" }, + "lockstat:::sx-spin", "arg2 == 1" }, + { 'C', "Lock", "lockmgr writer blocked by writer", "nsec", + "lockstat:::lockmgr-block", "arg2 == 0 && arg3 == 1" }, + { 'C', "Lock", "lockmgr writer blocked by readers", "nsec", + "lockstat:::lockmgr-block", "arg2 == 0 && arg3 == 0 && arg4" }, + { 'C', "Lock", "lockmgr reader blocked by writer", "nsec", + "lockstat:::lockmgr-block", "arg2 == 1 && arg3 == 1" }, + { 'C', "Lock", "lockmgr reader blocked by write wanted", "nsec", + "lockstat:::lockmgr-block", "arg2 == 1 && arg3 == 0 && arg4" }, { 'C', "Lock", "Unknown event (type 20)", "units" }, { 'C', "Lock", "Unknown event (type 21)", "units" }, { 'C', "Lock", "Unknown event (type 22)", "units" }, Modified: head/share/man/man4/dtrace_lockstat.4 ============================================================================== --- head/share/man/man4/dtrace_lockstat.4 Wed Aug 21 23:24:40 2019 (r351360) +++ head/share/man/man4/dtrace_lockstat.4 Wed Aug 21 23:43:58 2019 (r351361) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 2, 2018 +.Dd August 20, 2019 .Dt DTRACE_LOCKSTAT 4 .Os .Sh NAME @@ -50,6 +50,12 @@ .Fn lockstat:::sx-spin "struct sx *" "uint64_t" .Fn lockstat:::sx-upgrade "struct sx *" .Fn lockstat:::sx-downgrade "struct sx *" +.Fn lockstat:::lockmgr-acquire "struct lock *" "int" +.Fn lockstat:::lockmgr-release "struct lock *" "int" +.Fn lockstat:::lockmgr-disown "struct lock *" "int" +.Fn lockstat:::lockmgr-block "struct lock *" "uint64_t" "int" "int" "int" +.Fn lockstat:::lockmgr-upgrade "struct lock *" +.Fn lockstat:::lockmgr-downgrade "struct lock *" .Fn lockstat:::thread-spin "struct mtx *" "uint64" .Sh DESCRIPTION The DTrace @@ -62,6 +68,7 @@ The provider contains DTrace probes for inspecting kernel lock state transitions. Probes exist for the +.Xr lockmgr 9 , .Xr mutex 9 , .Xr rwlock 9 , and @@ -159,76 +166,50 @@ The second argument is if the lock is being acquired or released as a writer, and .Dv 1 if it is being acquired or released as a reader. -.Pp The -.Fn lockstat:::rw-block -probe fires when a thread removes itself from the CPU while -waiting to acquire a -.Xr rwlock 9 . -The -.Fn lockstat:::rw-spin -probe fires when a thread spins while waiting to acquire a -.Xr rwlock 9 . -Both probes take the same set of arguments. -The first argument is a pointer to the lock structure that describes -the lock. -The second argument is the length of time, in nanoseconds, -that the waiting thread was off the CPU or spinning for the lock. -The third argument is -.Dv 0 -if the thread is attempting to acquire the lock as a writer, and -.Dv 1 -if the thread is attempting to acquire the lock as a reader. -The fourth argument is -.Dv 0 -if the thread is waiting for a writer to release the lock, and -.Dv 1 -if the thread is waiting for a reader to release the lock. -The fifth argument is the number of readers that held the lock when -the thread first attempted to acquire the lock. -This argument will be -.Dv 0 -if the fourth argument is -.Dv 0 . -.Pp -The -.Fn lockstat:::rw-upgrade -probe fires when a thread successfully upgrades a held -.Xr rwlock 9 -read lock to a write lock. -The -.Fn lockstat:::rw-downgrade -probe fires when a thread downgrades a held -.Xr rwlock 9 -write lock to a read lock. -The only argument is a pointer to the structure which describes -the lock being acquired. -.Pp -The .Fn lockstat:::sx-acquire and -.Fn lockstat:::sx-release -probes fire when a +.Fn lockstat:::sx-release , +and +.Fn lockstat:::lockmgr-acquire +and +.Fn lockstat:::lockmgr-release +probes fire upon the corresponding events for .Xr sx 9 -is acquired or released, respectively. +and +.Xr lockmgr 9 +locks, respectively. +The +.Fn lockstat:::lockmgr-disown +probe fires when a +.Xr lockmgr 9 +exclusive lock is disowned. +In this state, the lock remains exclusively held, but may be +released by a different thread. +The +.Fn lockstat:::lockmgr-release +probe does not fire when releasing a disowned lock. The first argument is a pointer to the structure which describes -the lock being acquired. +the lock being disowned. The second argument is -.Dv 0 -if the shared lock is being acquired or released, and -.Dv 1 -if the exclusive lock is being acquired or released. +.Dv 0 , +for compatibility with +.Fn lockstat:::lockmgr-release . .Pp The -.Fn lockstat:::sx-block -probe fires when a thread takes itself off the CPU while -waiting to acquire a -.Xr sx 9 . +.Fn lockstat:::rw-block , +.Fn lockstat:::sx-block , +and +.Fn lockstat:::lockmgr-block +probes fire when a thread removes itself from the CPU while +waiting to acquire a lock of the corresponding type. The +.Fn lockstat:::rw-spin +and .Fn lockstat:::sx-spin -probe fires when a thread spins while waiting to acquire a -.Xr sx 9 . -Both probes take the same set of arguments. +probes fire when a thread spins while waiting to acquire a lock +of the corresponding type. +All probes take the same set of arguments. The first argument is a pointer to the lock structure that describes the lock. The second argument is the length of time, in nanoseconds, @@ -240,28 +221,40 @@ if the thread is attempting to acquire the lock as a w if the thread is attempting to acquire the lock as a reader. The fourth argument is .Dv 0 -if the thread is waiting for a writer to release the lock, and +if the thread is waiting for a reader to release the lock, and .Dv 1 -if the thread is waiting for a reader to release the lock. +if the thread is waiting for a writer to release the lock. The fifth argument is the number of readers that held the lock when the thread first attempted to acquire the lock. This argument will be .Dv 0 if the fourth argument is -.Dv 0 . +.Dv 1 . .Pp The +.Fn lockstat:::lockmgr-upgrade , +.Fn lockstat:::rw-upgrade , +and .Fn lockstat:::sx-upgrade -probe fires when a thread successfully upgrades a held +probes fire when a thread successfully upgrades a held +.Xr lockmgr 9 , +.Xr rwlock 9 , +or .Xr sx 9 -shared lock to an exclusive lock. +shared/reader lock to an exclusive/writer lock. The only argument is a pointer to the structure which describes the lock being acquired. The +.Fn lockstat:::lockmgr-downgrade , +.Fn lockstat:::rw-downgrade , +and .Fn lockstat:::sx-downgrade -probe fires when a thread downgrades a held +probes fire when a thread downgrades a held +.Xr lockmgr 9 , +.Xr rwlock 9 , +or .Xr sx 9 -exclusive lock to a shared lock. +exclusive/writer lock to a shared/reader lock. .Pp The .Fn lockstat:::thread-spin @@ -291,10 +284,11 @@ provider first appeared in .Fx 9 . .Sh AUTHORS This manual page was written by -.An George V. Neville-Neil Aq Mt gnn@FreeBSD.org . +.An George V. Neville-Neil Aq Mt gnn@FreeBSD.org +and +.An -nosplit +.An Mark Johnston Aq Mt markj@FreeBSD.org . .Sh BUGS Probes for -.Xr lockmgr 9 -and .Xr rmlock 9 locks have not yet been added. Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Wed Aug 21 23:24:40 2019 (r351360) +++ head/sys/kern/kern_lock.c Wed Aug 21 23:43:58 2019 (r351361) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -201,8 +202,8 @@ lockmgr_note_shared_acquire(struct lock *lk, int conte uint64_t waittime, const char *file, int line, int flags) { - lock_profile_obtain_lock_success(&lk->lock_object, contested, waittime, - file, line); + LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(lockmgr__acquire, lk, contested, + waittime, file, line, LOCKSTAT_READER); LOCK_LOG_LOCK("SLOCK", &lk->lock_object, 0, 0, file, line); WITNESS_LOCK(&lk->lock_object, LK_TRYWIT(flags), file, line); TD_LOCKS_INC(curthread); @@ -214,7 +215,7 @@ static void lockmgr_note_shared_release(struct lock *lk, const char *file, int line) { - lock_profile_release_lock(&lk->lock_object); + LOCKSTAT_PROFILE_RELEASE_RWLOCK(lockmgr__release, lk, LOCKSTAT_READER); WITNESS_UNLOCK(&lk->lock_object, 0, file, line); LOCK_LOG_LOCK("SUNLOCK", &lk->lock_object, 0, 0, file, line); TD_LOCKS_DEC(curthread); @@ -226,8 +227,8 @@ lockmgr_note_exclusive_acquire(struct lock *lk, int co uint64_t waittime, const char *file, int line, int flags) { - lock_profile_obtain_lock_success(&lk->lock_object, contested, waittime, - file, line); + LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(lockmgr__acquire, lk, contested, + waittime, file, line, LOCKSTAT_WRITER); LOCK_LOG_LOCK("XLOCK", &lk->lock_object, 0, lk->lk_recurse, file, line); WITNESS_LOCK(&lk->lock_object, LOP_EXCLUSIVE | LK_TRYWIT(flags), file, line); @@ -239,7 +240,7 @@ static void lockmgr_note_exclusive_release(struct lock *lk, const char *file, int line) { - lock_profile_release_lock(&lk->lock_object); + LOCKSTAT_PROFILE_RELEASE_RWLOCK(lockmgr__release, lk, LOCKSTAT_WRITER); LOCK_LOG_LOCK("XUNLOCK", &lk->lock_object, 0, lk->lk_recurse, file, line); WITNESS_UNLOCK(&lk->lock_object, LOP_EXCLUSIVE, file, line); @@ -555,6 +556,9 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struc const char *iwmesg; int ipri, itimo; +#ifdef KDTRACE_HOOKS + uint64_t sleep_time = 0; +#endif #ifdef LOCK_PROFILING uint64_t waittime = 0; int contested = 0; @@ -645,8 +649,14 @@ retry_sleepq: * shared lock and the shared waiters flag is set, * we will sleep. */ +#ifdef KDTRACE_HOOKS + sleep_time -= lockstat_nsecs(&lk->lock_object); +#endif error = sleeplk(lk, flags, ilk, iwmesg, ipri, itimo, SQ_SHARED_QUEUE); +#ifdef KDTRACE_HOOKS + sleep_time += lockstat_nsecs(&lk->lock_object); +#endif flags &= ~LK_INTERLOCK; if (error) { LOCK_LOG3(lk, @@ -658,6 +668,12 @@ retry_sleepq: __func__, lk); } if (error == 0) { +#ifdef KDTRACE_HOOKS + if (sleep_time != 0) + LOCKSTAT_RECORD4(lockmgr__block, lk, sleep_time, + LOCKSTAT_READER, (x & LK_SHARE) == 0, + (x & LK_SHARE) == 0 ? 0 : LK_SHARERS(x)); +#endif #ifdef LOCK_PROFILING lockmgr_note_shared_acquire(lk, contested, waittime, file, line, flags); @@ -682,6 +698,9 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struc const char *iwmesg; int ipri, itimo; +#ifdef KDTRACE_HOOKS + uint64_t sleep_time = 0; +#endif #ifdef LOCK_PROFILING uint64_t waittime = 0; int contested = 0; @@ -821,8 +840,14 @@ retry_sleepq: * exclusive lock and the exclusive waiters flag * is set, we will sleep. */ +#ifdef KDTRACE_HOOKS + sleep_time -= lockstat_nsecs(&lk->lock_object); +#endif error = sleeplk(lk, flags, ilk, iwmesg, ipri, itimo, SQ_EXCLUSIVE_QUEUE); +#ifdef KDTRACE_HOOKS + sleep_time += lockstat_nsecs(&lk->lock_object); +#endif flags &= ~LK_INTERLOCK; if (error) { LOCK_LOG3(lk, @@ -834,6 +859,12 @@ retry_sleepq: __func__, lk); } if (error == 0) { +#ifdef KDTRACE_HOOKS + if (sleep_time != 0) + LOCKSTAT_RECORD4(lockmgr__block, lk, sleep_time, + LOCKSTAT_WRITER, (x & LK_SHARE) == 0, + (x & LK_SHARE) == 0 ? 0 : LK_SHARERS(x)); +#endif #ifdef LOCK_PROFILING lockmgr_note_exclusive_acquire(lk, contested, waittime, file, line, flags); @@ -877,6 +908,7 @@ lockmgr_upgrade(struct lock *lk, u_int flags, struct l line); WITNESS_UPGRADE(&lk->lock_object, LOP_EXCLUSIVE | LK_TRYWIT(flags), file, line); + LOCKSTAT_RECORD0(lockmgr__upgrade, lk); TD_SLOCKS_DEC(curthread); goto out; } @@ -1024,7 +1056,8 @@ lockmgr_xunlock_hard(struct lock *lk, uintptr_t x, u_i goto out; } if (tid != LK_KERNPROC) - lock_profile_release_lock(&lk->lock_object); + LOCKSTAT_PROFILE_RELEASE_RWLOCK(lockmgr__release, lk, + LOCKSTAT_WRITER); if (x == tid && atomic_cmpset_rel_ptr(&lk->lk_lock, tid, LK_UNLOCKED)) goto out; @@ -1205,7 +1238,6 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lo break; case LK_DOWNGRADE: _lockmgr_assert(lk, KA_XLOCKED, file, line); - LOCK_LOG_LOCK("XDOWNGRADE", &lk->lock_object, 0, 0, file, line); WITNESS_DOWNGRADE(&lk->lock_object, 0, file, line); /* @@ -1231,6 +1263,8 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lo break; cpu_spinwait(); } + LOCK_LOG_LOCK("XDOWNGRADE", &lk->lock_object, 0, 0, file, line); + LOCKSTAT_RECORD0(lockmgr__downgrade, lk); break; case LK_RELEASE: _lockmgr_assert(lk, KA_LOCKED, file, line); @@ -1462,6 +1496,7 @@ _lockmgr_disown(struct lock *lk, const char *file, int if (LK_HOLDER(lk->lk_lock) != tid) return; lock_profile_release_lock(&lk->lock_object); + LOCKSTAT_RECORD1(lockmgr__disown, lk, LOCKSTAT_WRITER); LOCK_LOG_LOCK("XDISOWN", &lk->lock_object, 0, 0, file, line); WITNESS_UNLOCK(&lk->lock_object, LOP_EXCLUSIVE, file, line); TD_LOCKS_DEC(curthread); Modified: head/sys/kern/kern_lockstat.c ============================================================================== --- head/sys/kern/kern_lockstat.c Wed Aug 21 23:24:40 2019 (r351360) +++ head/sys/kern/kern_lockstat.c Wed Aug 21 23:43:58 2019 (r351361) @@ -62,6 +62,14 @@ SDT_PROBE_DEFINE2(lockstat, , , sx__spin, "struct sx * SDT_PROBE_DEFINE1(lockstat, , , sx__upgrade, "struct sx *"); SDT_PROBE_DEFINE1(lockstat, , , sx__downgrade, "struct sx *"); +SDT_PROBE_DEFINE2(lockstat, , , lockmgr__acquire, "struct lock *", "int"); +SDT_PROBE_DEFINE2(lockstat, , , lockmgr__release, "struct lock *", "int"); +SDT_PROBE_DEFINE2(lockstat, , , lockmgr__disown, "struct lock *", "int"); +SDT_PROBE_DEFINE5(lockstat, , , lockmgr__block, "struct lock *", "uint64_t", + "int", "int", "int"); +SDT_PROBE_DEFINE1(lockstat, , , lockmgr__upgrade, "struct lock *"); +SDT_PROBE_DEFINE1(lockstat, , , lockmgr__downgrade, "struct lock *"); + SDT_PROBE_DEFINE2(lockstat, , , thread__spin, "struct mtx *", "uint64_t"); volatile bool __read_frequently lockstat_enabled; Modified: head/sys/sys/lockstat.h ============================================================================== --- head/sys/sys/lockstat.h Wed Aug 21 23:24:40 2019 (r351360) +++ head/sys/sys/lockstat.h Wed Aug 21 23:43:58 2019 (r351361) @@ -65,6 +65,13 @@ SDT_PROBE_DECLARE(lockstat, , , sx__spin); SDT_PROBE_DECLARE(lockstat, , , sx__upgrade); SDT_PROBE_DECLARE(lockstat, , , sx__downgrade); +SDT_PROBE_DECLARE(lockstat, , , lockmgr__acquire); +SDT_PROBE_DECLARE(lockstat, , , lockmgr__release); +SDT_PROBE_DECLARE(lockstat, , , lockmgr__disown); +SDT_PROBE_DECLARE(lockstat, , , lockmgr__block); +SDT_PROBE_DECLARE(lockstat, , , lockmgr__upgrade); +SDT_PROBE_DECLARE(lockstat, , , lockmgr__downgrade); + SDT_PROBE_DECLARE(lockstat, , , thread__spin); #define LOCKSTAT_WRITER 0 From owner-svn-src-head@freebsd.org Wed Aug 21 23:47:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE628D7B43; Wed, 21 Aug 2019 23:47:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DPTK4bnzz3FtC; Wed, 21 Aug 2019 23:47:01 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F7982356D; Wed, 21 Aug 2019 23:47:01 +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 x7LNl1cW058647; Wed, 21 Aug 2019 23:47:01 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LNl1L8058646; Wed, 21 Aug 2019 23:47:01 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908212347.x7LNl1L8058646@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 21 Aug 2019 23:47:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351363 - head/cddl/contrib/opensolaris/cmd/lockstat X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/lockstat X-SVN-Commit-Revision: 351363 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 23:47:01 -0000 Author: markj Date: Wed Aug 21 23:47:01 2019 New Revision: 351363 URL: https://svnweb.freebsd.org/changeset/base/351363 Log: Add hold events for lockmgr probes, missed in r351361. MFC with: r351361 Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Wed Aug 21 23:44:46 2019 (r351362) +++ head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Wed Aug 21 23:47:01 2019 (r351363) @@ -215,8 +215,12 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = { { 'H', "Lock", "SX exclusive hold", "nsec", "lockstat:::sx-release", "arg1 == 0", "lockstat:::sx-acquire" }, - { 'H', "Lock", "Unknown event (type 38)", "units" }, - { 'H', "Lock", "Unknown event (type 39)", "units" }, + { 'H', "Lock", "lockmgr shared hold", "nsec", + "lockstat:::lockmgr-release", "arg1 == 1", + "lockstat:::lockmgr-acquire" }, + { 'H', "Lock", "lockmgr exclusive hold", "nsec", + "lockstat:::lockmgr-release,lockstat:::lockmgr-disown", "arg1 == 0", + "lockstat:::lockmgr-acquire" }, { 'H', "Lock", "Unknown event (type 40)", "units" }, { 'H', "Lock", "Unknown event (type 41)", "units" }, { 'H', "Lock", "Unknown event (type 42)", "units" }, From owner-svn-src-head@freebsd.org Thu Aug 22 00:02:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 40467D8070; Thu, 22 Aug 2019 00:02:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DPps1b0wz3GdK; Thu, 22 Aug 2019 00:02: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F333B237DE; Thu, 22 Aug 2019 00:02: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 x7M02Cdm070136; Thu, 22 Aug 2019 00:02:12 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M028Jh070116; Thu, 22 Aug 2019 00:02:08 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908220002.x7M028Jh070116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 22 Aug 2019 00:02:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351364 - in head/sys: crypto/blowfish crypto/chacha20 crypto/des opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: crypto/blowfish crypto/chacha20 crypto/des opencrypto X-SVN-Commit-Revision: 351364 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 00:02:13 -0000 Author: jhb Date: Thu Aug 22 00:02:08 2019 New Revision: 351364 URL: https://svnweb.freebsd.org/changeset/base/351364 Log: Use 'const' for keys and IVs passed to software encryption algorithms. Specifically, use 'const' for the key passed to the 'setkey' method and 'const' for the 'iv' passed to the 'reinit' method. Reviewed by: cem Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D21347 Modified: head/sys/crypto/blowfish/bf_skey.c head/sys/crypto/blowfish/blowfish.h head/sys/crypto/chacha20/chacha-sw.c head/sys/crypto/des/des.h head/sys/crypto/des/des_setkey.c head/sys/opencrypto/cast.c head/sys/opencrypto/cast.h head/sys/opencrypto/skipjack.c head/sys/opencrypto/skipjack.h head/sys/opencrypto/xform_aes_icm.c head/sys/opencrypto/xform_aes_xts.c head/sys/opencrypto/xform_blf.c head/sys/opencrypto/xform_cast5.c head/sys/opencrypto/xform_cml.c head/sys/opencrypto/xform_des1.c head/sys/opencrypto/xform_des3.c head/sys/opencrypto/xform_enc.h head/sys/opencrypto/xform_null.c head/sys/opencrypto/xform_rijndael.c head/sys/opencrypto/xform_skipjack.c Modified: head/sys/crypto/blowfish/bf_skey.c ============================================================================== --- head/sys/crypto/blowfish/bf_skey.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/crypto/blowfish/bf_skey.c Thu Aug 22 00:02:08 2019 (r351364) @@ -73,11 +73,11 @@ void BF_set_key(key, len, data) BF_KEY *key; int len; - unsigned char *data; + const unsigned char *data; { int i; BF_LONG *p, ri, in[2]; - unsigned char *d, *end; + const unsigned char *d, *end; memcpy((char *)key, (const char *)&bf_init, sizeof(BF_KEY)); p = key->P; Modified: head/sys/crypto/blowfish/blowfish.h ============================================================================== --- head/sys/crypto/blowfish/blowfish.h Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/crypto/blowfish/blowfish.h Thu Aug 22 00:02:08 2019 (r351364) @@ -80,7 +80,7 @@ typedef struct bf_key_st { BF_LONG S[4*256]; } BF_KEY; -void BF_set_key(BF_KEY *, int, unsigned char *); +void BF_set_key(BF_KEY *, int, const unsigned char *); void BF_encrypt(BF_LONG *, BF_KEY *); void BF_decrypt(BF_LONG *, BF_KEY *); void BF_ecb_encrypt(const unsigned char *, unsigned char *, Modified: head/sys/crypto/chacha20/chacha-sw.c ============================================================================== --- head/sys/crypto/chacha20/chacha-sw.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/crypto/chacha20/chacha-sw.c Thu Aug 22 00:02:08 2019 (r351364) @@ -7,7 +7,7 @@ __FBSDID("$FreeBSD$"); #include static int -chacha20_xform_setkey(u_int8_t **sched, u_int8_t *key, int len) +chacha20_xform_setkey(u_int8_t **sched, const u_int8_t *key, int len) { struct chacha_ctx *ctx; @@ -24,7 +24,7 @@ chacha20_xform_setkey(u_int8_t **sched, u_int8_t *key, } static void -chacha20_xform_reinit(caddr_t key, u_int8_t *iv) +chacha20_xform_reinit(caddr_t key, const u_int8_t *iv) { struct chacha_ctx *ctx; Modified: head/sys/crypto/des/des.h ============================================================================== --- head/sys/crypto/des/des.h Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/crypto/des/des.h Thu Aug 22 00:02:08 2019 (r351364) @@ -103,12 +103,12 @@ void des_ede3_cbc_encrypt(const unsigned char *, unsig void des_set_odd_parity(des_cblock *); void des_fixup_key_parity(des_cblock *); -int des_is_weak_key(des_cblock *); -int des_set_key(des_cblock *, des_key_schedule); -int des_key_sched(des_cblock *, des_key_schedule); -int des_set_key_checked(des_cblock *, des_key_schedule); -void des_set_key_unchecked(des_cblock *, des_key_schedule); -int des_check_key_parity(des_cblock *); +int des_is_weak_key(const des_cblock *); +int des_set_key(const des_cblock *, des_key_schedule); +int des_key_sched(const des_cblock *, des_key_schedule); +int des_set_key_checked(const des_cblock *, des_key_schedule); +void des_set_key_unchecked(const des_cblock *, des_key_schedule); +int des_check_key_parity(const des_cblock *); #ifdef __cplusplus } Modified: head/sys/crypto/des/des_setkey.c ============================================================================== --- head/sys/crypto/des/des_setkey.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/crypto/des/des_setkey.c Thu Aug 22 00:02:08 2019 (r351364) @@ -75,7 +75,7 @@ void des_set_odd_parity(des_cblock *key) (*key)[i]=odd_parity[(*key)[i]]; } -int des_check_key_parity(des_cblock *key) +int des_check_key_parity(const des_cblock *key) { int i; @@ -117,7 +117,7 @@ static des_cblock weak_keys[NUM_WEAK_KEY]={ {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE}, {0xFE,0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1}}; -int des_is_weak_key(des_cblock *key) +int des_is_weak_key(const des_cblock *key) { int i; @@ -142,7 +142,7 @@ int des_is_weak_key(des_cblock *key) #define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ (a)=(a)^(t)^(t>>(16-(n)))) -int des_set_key(des_cblock *key, des_key_schedule schedule) +int des_set_key(const des_cblock *key, des_key_schedule schedule) { if (des_check_key) { @@ -159,7 +159,7 @@ int des_set_key(des_cblock *key, des_key_schedule sche * return -1 if key parity error, * return -2 if illegal weak key. */ -int des_set_key_checked(des_cblock *key, des_key_schedule schedule) +int des_set_key_checked(const des_cblock *key, des_key_schedule schedule) { if (!des_check_key_parity(key)) return(-1); @@ -169,7 +169,7 @@ int des_set_key_checked(des_cblock *key, des_key_sched return 0; } -void des_set_key_unchecked(des_cblock *key, des_key_schedule schedule) +void des_set_key_unchecked(const des_cblock *key, des_key_schedule schedule) { static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; DES_LONG c,d,t,s,t2; @@ -225,7 +225,7 @@ void des_set_key_unchecked(des_cblock *key, des_key_sc } } -int des_key_sched(des_cblock *key, des_key_schedule schedule) +int des_key_sched(const des_cblock *key, des_key_schedule schedule) { return(des_set_key(key,schedule)); } Modified: head/sys/opencrypto/cast.c ============================================================================== --- head/sys/opencrypto/cast.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/cast.c Thu Aug 22 00:02:08 2019 (r351364) @@ -129,7 +129,7 @@ u_int32_t t, l, r; /***** Key Schedule *****/ -void cast_setkey(cast_key* key, u_int8_t* rawkey, int keybytes) +void cast_setkey(cast_key* key, const u_int8_t* rawkey, int keybytes) { u_int32_t t[4] = {0, 0, 0, 0}, z[4] = {0, 0, 0, 0}, x[4]; int i; Modified: head/sys/opencrypto/cast.h ============================================================================== --- head/sys/opencrypto/cast.h Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/cast.h Thu Aug 22 00:02:08 2019 (r351364) @@ -16,7 +16,7 @@ typedef struct { int rounds; /* Number of rounds to use, 12 or 16 */ } cast_key; -void cast_setkey(cast_key * key, u_int8_t * rawkey, int keybytes); +void cast_setkey(cast_key * key, const u_int8_t * rawkey, int keybytes); void cast_encrypt(cast_key * key, u_int8_t * inblock, u_int8_t * outblock); void cast_decrypt(cast_key * key, u_int8_t * inblock, u_int8_t * outblock); Modified: head/sys/opencrypto/skipjack.c ============================================================================== --- head/sys/opencrypto/skipjack.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/skipjack.c Thu Aug 22 00:02:08 2019 (r351364) @@ -65,7 +65,7 @@ static const u_int8_t ftable[0x100] = */ void -subkey_table_gen (u_int8_t *key, u_int8_t **key_tables) +subkey_table_gen (const u_int8_t *key, u_int8_t **key_tables) { int i, k; Modified: head/sys/opencrypto/skipjack.h ============================================================================== --- head/sys/opencrypto/skipjack.h Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/skipjack.h Thu Aug 22 00:02:08 2019 (r351364) @@ -19,6 +19,6 @@ extern void skipjack_forwards(u_int8_t *plain, u_int8_t *cipher, u_int8_t **key); extern void skipjack_backwards(u_int8_t *cipher, u_int8_t *plain, u_int8_t **key); -extern void subkey_table_gen(u_int8_t *key, u_int8_t **key_tables); +extern void subkey_table_gen(const u_int8_t *key, u_int8_t **key_tables); #endif Modified: head/sys/opencrypto/xform_aes_icm.c ============================================================================== --- head/sys/opencrypto/xform_aes_icm.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/xform_aes_icm.c Thu Aug 22 00:02:08 2019 (r351364) @@ -52,12 +52,12 @@ __FBSDID("$FreeBSD$"); #include -static int aes_icm_setkey(u_int8_t **, u_int8_t *, int); +static int aes_icm_setkey(u_int8_t **, const u_int8_t *, int); static void aes_icm_crypt(caddr_t, u_int8_t *); static void aes_icm_zerokey(u_int8_t **); -static void aes_icm_reinit(caddr_t, u_int8_t *); -static void aes_gcm_reinit(caddr_t, u_int8_t *); -static void aes_ccm_reinit(caddr_t, u_int8_t *); +static void aes_icm_reinit(caddr_t, const u_int8_t *); +static void aes_gcm_reinit(caddr_t, const u_int8_t *); +static void aes_ccm_reinit(caddr_t, const u_int8_t *); /* Encryption instances */ struct enc_xform enc_xform_aes_icm = { @@ -96,7 +96,7 @@ struct enc_xform enc_xform_ccm = { * Encryption wrapper routines. */ static void -aes_icm_reinit(caddr_t key, u_int8_t *iv) +aes_icm_reinit(caddr_t key, const u_int8_t *iv) { struct aes_icm_ctx *ctx; @@ -105,7 +105,7 @@ aes_icm_reinit(caddr_t key, u_int8_t *iv) } static void -aes_gcm_reinit(caddr_t key, u_int8_t *iv) +aes_gcm_reinit(caddr_t key, const u_int8_t *iv) { struct aes_icm_ctx *ctx; @@ -118,7 +118,7 @@ aes_gcm_reinit(caddr_t key, u_int8_t *iv) } static void -aes_ccm_reinit(caddr_t key, u_int8_t *iv) +aes_ccm_reinit(caddr_t key, const u_int8_t *iv) { struct aes_icm_ctx *ctx; @@ -153,7 +153,7 @@ aes_icm_crypt(caddr_t key, u_int8_t *data) } static int -aes_icm_setkey(u_int8_t **sched, u_int8_t *key, int len) +aes_icm_setkey(u_int8_t **sched, const u_int8_t *key, int len) { struct aes_icm_ctx *ctx; @@ -166,7 +166,7 @@ aes_icm_setkey(u_int8_t **sched, u_int8_t *key, int le return ENOMEM; ctx = (struct aes_icm_ctx *)*sched; - ctx->ac_nr = rijndaelKeySetupEnc(ctx->ac_ek, (u_char *)key, len * 8); + ctx->ac_nr = rijndaelKeySetupEnc(ctx->ac_ek, key, len * 8); return 0; } Modified: head/sys/opencrypto/xform_aes_xts.c ============================================================================== --- head/sys/opencrypto/xform_aes_xts.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/xform_aes_xts.c Thu Aug 22 00:02:08 2019 (r351364) @@ -52,11 +52,11 @@ __FBSDID("$FreeBSD$"); #include -static int aes_xts_setkey(u_int8_t **, u_int8_t *, int); +static int aes_xts_setkey(u_int8_t **, const u_int8_t *, int); static void aes_xts_encrypt(caddr_t, u_int8_t *); static void aes_xts_decrypt(caddr_t, u_int8_t *); static void aes_xts_zerokey(u_int8_t **); -static void aes_xts_reinit(caddr_t, u_int8_t *); +static void aes_xts_reinit(caddr_t, const u_int8_t *); /* Encryption instances */ struct enc_xform enc_xform_aes_xts = { @@ -73,7 +73,7 @@ struct enc_xform enc_xform_aes_xts = { * Encryption wrapper routines. */ static void -aes_xts_reinit(caddr_t key, u_int8_t *iv) +aes_xts_reinit(caddr_t key, const u_int8_t *iv) { struct aes_xts_ctx *ctx = (struct aes_xts_ctx *)key; u_int64_t blocknum; @@ -136,7 +136,7 @@ aes_xts_decrypt(caddr_t key, u_int8_t *data) } static int -aes_xts_setkey(u_int8_t **sched, u_int8_t *key, int len) +aes_xts_setkey(u_int8_t **sched, const u_int8_t *key, int len) { struct aes_xts_ctx *ctx; Modified: head/sys/opencrypto/xform_blf.c ============================================================================== --- head/sys/opencrypto/xform_blf.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/xform_blf.c Thu Aug 22 00:02:08 2019 (r351364) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include -static int blf_setkey(u_int8_t **, u_int8_t *, int); +static int blf_setkey(u_int8_t **, const u_int8_t *, int); static void blf_encrypt(caddr_t, u_int8_t *); static void blf_decrypt(caddr_t, u_int8_t *); static void blf_zerokey(u_int8_t **); @@ -104,7 +104,7 @@ blf_decrypt(caddr_t key, u_int8_t *blk) } static int -blf_setkey(u_int8_t **sched, u_int8_t *key, int len) +blf_setkey(u_int8_t **sched, const u_int8_t *key, int len) { int err; Modified: head/sys/opencrypto/xform_cast5.c ============================================================================== --- head/sys/opencrypto/xform_cast5.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/xform_cast5.c Thu Aug 22 00:02:08 2019 (r351364) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include -static int cast5_setkey(u_int8_t **, u_int8_t *, int); +static int cast5_setkey(u_int8_t **, const u_int8_t *, int); static void cast5_encrypt(caddr_t, u_int8_t *); static void cast5_decrypt(caddr_t, u_int8_t *); static void cast5_zerokey(u_int8_t **); @@ -85,7 +85,7 @@ cast5_decrypt(caddr_t key, u_int8_t *blk) } static int -cast5_setkey(u_int8_t **sched, u_int8_t *key, int len) +cast5_setkey(u_int8_t **sched, const u_int8_t *key, int len) { int err; Modified: head/sys/opencrypto/xform_cml.c ============================================================================== --- head/sys/opencrypto/xform_cml.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/xform_cml.c Thu Aug 22 00:02:08 2019 (r351364) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include -static int cml_setkey(u_int8_t **, u_int8_t *, int); +static int cml_setkey(u_int8_t **, const u_int8_t *, int); static void cml_encrypt(caddr_t, u_int8_t *); static void cml_decrypt(caddr_t, u_int8_t *); static void cml_zerokey(u_int8_t **); @@ -87,7 +87,7 @@ cml_decrypt(caddr_t key, u_int8_t *blk) } static int -cml_setkey(u_int8_t **sched, u_int8_t *key, int len) +cml_setkey(u_int8_t **sched, const u_int8_t *key, int len) { int err; @@ -96,7 +96,7 @@ cml_setkey(u_int8_t **sched, u_int8_t *key, int len) *sched = KMALLOC(sizeof(camellia_ctx), M_CRYPTO_DATA, M_NOWAIT|M_ZERO); if (*sched != NULL) { - camellia_set_key((camellia_ctx *) *sched, (u_char *) key, + camellia_set_key((camellia_ctx *) *sched, key, len * 8); err = 0; } else Modified: head/sys/opencrypto/xform_des1.c ============================================================================== --- head/sys/opencrypto/xform_des1.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/xform_des1.c Thu Aug 22 00:02:08 2019 (r351364) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include -static int des1_setkey(u_int8_t **, u_int8_t *, int); +static int des1_setkey(u_int8_t **, const u_int8_t *, int); static void des1_encrypt(caddr_t, u_int8_t *); static void des1_decrypt(caddr_t, u_int8_t *); static void des1_zerokey(u_int8_t **); @@ -91,7 +91,7 @@ des1_decrypt(caddr_t key, u_int8_t *blk) } static int -des1_setkey(u_int8_t **sched, u_int8_t *key, int len) +des1_setkey(u_int8_t **sched, const u_int8_t *key, int len) { des_key_schedule *p; int err; @@ -99,7 +99,7 @@ des1_setkey(u_int8_t **sched, u_int8_t *key, int len) p = KMALLOC(sizeof (des_key_schedule), M_CRYPTO_DATA, M_NOWAIT|M_ZERO); if (p != NULL) { - des_set_key((des_cblock *) key, p[0]); + des_set_key((const des_cblock *) key, p[0]); err = 0; } else err = ENOMEM; Modified: head/sys/opencrypto/xform_des3.c ============================================================================== --- head/sys/opencrypto/xform_des3.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/xform_des3.c Thu Aug 22 00:02:08 2019 (r351364) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include -static int des3_setkey(u_int8_t **, u_int8_t *, int); +static int des3_setkey(u_int8_t **, const u_int8_t *, int); static void des3_encrypt(caddr_t, u_int8_t *); static void des3_decrypt(caddr_t, u_int8_t *); static void des3_zerokey(u_int8_t **); @@ -92,7 +92,7 @@ des3_decrypt(caddr_t key, u_int8_t *blk) } static int -des3_setkey(u_int8_t **sched, u_int8_t *key, int len) +des3_setkey(u_int8_t **sched, const u_int8_t *key, int len) { des_key_schedule *p; int err; @@ -100,9 +100,9 @@ des3_setkey(u_int8_t **sched, u_int8_t *key, int len) p = KMALLOC(3*sizeof (des_key_schedule), M_CRYPTO_DATA, M_NOWAIT|M_ZERO); if (p != NULL) { - des_set_key((des_cblock *)(key + 0), p[0]); - des_set_key((des_cblock *)(key + 8), p[1]); - des_set_key((des_cblock *)(key + 16), p[2]); + des_set_key((const des_cblock *)(key + 0), p[0]); + des_set_key((const des_cblock *)(key + 8), p[1]); + des_set_key((const des_cblock *)(key + 16), p[2]); err = 0; } else err = ENOMEM; Modified: head/sys/opencrypto/xform_enc.h ============================================================================== --- head/sys/opencrypto/xform_enc.h Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/xform_enc.h Thu Aug 22 00:02:08 2019 (r351364) @@ -56,9 +56,9 @@ struct enc_xform { u_int16_t minkey, maxkey; void (*encrypt) (caddr_t, u_int8_t *); void (*decrypt) (caddr_t, u_int8_t *); - int (*setkey) (u_int8_t **, u_int8_t *, int len); + int (*setkey) (u_int8_t **, const u_int8_t *, int len); void (*zerokey) (u_int8_t **); - void (*reinit) (caddr_t, u_int8_t *); + void (*reinit) (caddr_t, const u_int8_t *); /* * Encrypt/decrypt 1+ blocks of input -- total size is 'len' bytes. * Len is guaranteed to be a multiple of the defined 'blocksize'. Modified: head/sys/opencrypto/xform_null.c ============================================================================== --- head/sys/opencrypto/xform_null.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/xform_null.c Thu Aug 22 00:02:08 2019 (r351364) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include -static int null_setkey(u_int8_t **, u_int8_t *, int); +static int null_setkey(u_int8_t **, const u_int8_t *, int); static void null_encrypt(caddr_t, u_int8_t *); static void null_decrypt(caddr_t, u_int8_t *); static void null_zerokey(u_int8_t **); @@ -104,7 +104,7 @@ null_decrypt(caddr_t key, u_int8_t *blk) } static int -null_setkey(u_int8_t **sched, u_int8_t *key, int len) +null_setkey(u_int8_t **sched, const u_int8_t *key, int len) { *sched = NULL; return 0; Modified: head/sys/opencrypto/xform_rijndael.c ============================================================================== --- head/sys/opencrypto/xform_rijndael.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/xform_rijndael.c Thu Aug 22 00:02:08 2019 (r351364) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include -static int rijndael128_setkey(u_int8_t **, u_int8_t *, int); +static int rijndael128_setkey(u_int8_t **, const u_int8_t *, int); static void rijndael128_encrypt(caddr_t, u_int8_t *); static void rijndael128_decrypt(caddr_t, u_int8_t *); static void rijndael128_zerokey(u_int8_t **); @@ -87,7 +87,7 @@ rijndael128_decrypt(caddr_t key, u_int8_t *blk) } static int -rijndael128_setkey(u_int8_t **sched, u_int8_t *key, int len) +rijndael128_setkey(u_int8_t **sched, const u_int8_t *key, int len) { int err; @@ -96,7 +96,7 @@ rijndael128_setkey(u_int8_t **sched, u_int8_t *key, in *sched = KMALLOC(sizeof(rijndael_ctx), M_CRYPTO_DATA, M_NOWAIT|M_ZERO); if (*sched != NULL) { - rijndael_set_key((rijndael_ctx *) *sched, (u_char *) key, + rijndael_set_key((rijndael_ctx *) *sched, key, len * 8); err = 0; } else Modified: head/sys/opencrypto/xform_skipjack.c ============================================================================== --- head/sys/opencrypto/xform_skipjack.c Wed Aug 21 23:47:01 2019 (r351363) +++ head/sys/opencrypto/xform_skipjack.c Thu Aug 22 00:02:08 2019 (r351364) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include -static int skipjack_setkey(u_int8_t **, u_int8_t *, int); +static int skipjack_setkey(u_int8_t **, const u_int8_t *, int); static void skipjack_encrypt(caddr_t, u_int8_t *); static void skipjack_decrypt(caddr_t, u_int8_t *); static void skipjack_zerokey(u_int8_t **); @@ -85,7 +85,7 @@ skipjack_decrypt(caddr_t key, u_int8_t *blk) } static int -skipjack_setkey(u_int8_t **sched, u_int8_t *key, int len) +skipjack_setkey(u_int8_t **sched, const u_int8_t *key, int len) { int err; From owner-svn-src-head@freebsd.org Thu Aug 22 00:19:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0445D8935; Thu, 22 Aug 2019 00:19:14 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DQBV5BLjz3HVG; Thu, 22 Aug 2019 00:19:14 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 937D123ADE; Thu, 22 Aug 2019 00:19:14 +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 x7M0JE4B076393; Thu, 22 Aug 2019 00:19:14 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M0JEsx076392; Thu, 22 Aug 2019 00:19:14 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908220019.x7M0JEsx076392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 22 Aug 2019 00:19:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351365 - head/sys/gdb X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/gdb X-SVN-Commit-Revision: 351365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 00:19:14 -0000 Author: cem Date: Thu Aug 22 00:19:14 2019 New Revision: 351365 URL: https://svnweb.freebsd.org/changeset/base/351365 Log: gdb(4): Include thread in Target Halt Reason This saves a round trip of the gdb remote inferior attempting to find the thread id of the halted thread. Sponsored by: Dell EMC Isilon Modified: head/sys/gdb/gdb_main.c Modified: head/sys/gdb/gdb_main.c ============================================================================== --- head/sys/gdb/gdb_main.c Thu Aug 22 00:02:08 2019 (r351364) +++ head/sys/gdb/gdb_main.c Thu Aug 22 00:19:14 2019 (r351365) @@ -198,8 +198,11 @@ gdb_trap(int type, int code) /* printf("GDB: got '%s'\n", gdb_rxp); */ switch (gdb_rx_char()) { case '?': /* Last signal. */ - gdb_tx_begin('S'); + gdb_tx_begin('T'); gdb_tx_hex(gdb_cpu_signal(type, code), 2); + gdb_tx_str("thread:"); + gdb_tx_varhex((long)kdb_thread->td_tid); + gdb_tx_char(';'); gdb_tx_end(); break; case 'c': { /* Continue. */ From owner-svn-src-head@freebsd.org Thu Aug 22 00:19:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC977D899A; Thu, 22 Aug 2019 00:19:41 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DQC14ZYYz3Hcn; Thu, 22 Aug 2019 00:19:41 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7EC5123ADF; Thu, 22 Aug 2019 00:19:41 +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 x7M0Jfka076454; Thu, 22 Aug 2019 00:19:41 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M0JfYc076453; Thu, 22 Aug 2019 00:19:41 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908220019.x7M0JfYc076453@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 22 Aug 2019 00:19:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351366 - head/sys/gdb X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/gdb X-SVN-Commit-Revision: 351366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 00:19:41 -0000 Author: cem Date: Thu Aug 22 00:19:41 2019 New Revision: 351366 URL: https://svnweb.freebsd.org/changeset/base/351366 Log: gdb(4): Add basic 'qSupported' support This is where the host GDB tells us what features it supports, and we respond with the list we support. For now, just report PacketSize. Modified: head/sys/gdb/gdb_main.c Modified: head/sys/gdb/gdb_main.c ============================================================================== --- head/sys/gdb/gdb_main.c Thu Aug 22 00:19:14 2019 (r351365) +++ head/sys/gdb/gdb_main.c Thu Aug 22 00:19:41 2019 (r351366) @@ -162,12 +162,117 @@ sendit: gdb_tx_end(); } +#define BIT(n) (1ull << (n)) +enum { + GDB_MULTIPROCESS, + GDB_SWBREAK, + GDB_HWBREAK, + GDB_QRELOCINSN, + GDB_FORK_EVENTS, + GDB_VFORK_EVENTS, + GDB_EXEC_EVENTS, + GDB_VCONT_SUPPORTED, + GDB_QTHREADEVENTS, + GDB_NO_RESUMED, +}; +static const char * const gdb_feature_names[] = { + [GDB_MULTIPROCESS] = "multiprocess", + [GDB_SWBREAK] = "swbreak", + [GDB_HWBREAK] = "hwbreak", + [GDB_QRELOCINSN] = "qRelocInsn", + [GDB_FORK_EVENTS] = "fork-events", + [GDB_VFORK_EVENTS] = "vfork-events", + [GDB_EXEC_EVENTS] = "exec-events", + [GDB_VCONT_SUPPORTED] = "vContSupported", + [GDB_QTHREADEVENTS] = "QThreadEvents", + [GDB_NO_RESUMED] = "no-resumed", +}; +static void +gdb_do_qsupported(uint32_t *feat) +{ + char *tok, *delim, ok; + size_t i, toklen; + + /* Parse supported host features */ + *feat = 0; + if (gdb_rx_char() != ':') + goto error; + + while (gdb_rxsz > 0) { + tok = gdb_rxp; + delim = strchrnul(gdb_rxp, ';'); + toklen = (delim - tok); + + gdb_rxp += toklen; + gdb_rxsz -= toklen; + if (*delim != '\0') { + *delim = '\0'; + gdb_rxp += 1; + gdb_rxsz -= 1; + } + + if (toklen < 2) + goto error; + + ok = tok[toklen - 1]; + if (ok != '-' && ok != '+') { + /* + * GDB only has one KV-pair feature, and we don't + * support it, so ignore and move on. + */ + if (strchr(tok, '=') != NULL) + continue; + /* Not a KV-pair, and not a +/- flag? Malformed. */ + goto error; + } + if (ok != '+') + continue; + tok[toklen - 1] = '\0'; + + for (i = 0; i < nitems(gdb_feature_names); i++) + if (strcmp(gdb_feature_names[i], tok) == 0) + break; + + if (i == nitems(gdb_feature_names)) { + /* Unknown GDB feature. */ + continue; + } + + *feat |= BIT(i); + } + + /* Send a supported feature list back */ + gdb_tx_begin(0); + + gdb_tx_str("PacketSize"); + gdb_tx_char('='); + /* + * We don't buffer framing bytes, but we do need to retain a byte for a + * trailing nul. + */ + gdb_tx_varhex(GDB_BUFSZ + strlen("$#nn") - 1); + + /* + * Future consideration: + * - vCont + * - multiprocess + * - qXfer:threads:read + */ + gdb_tx_end(); + return; + +error: + *feat = 0; + gdb_tx_err(EINVAL); +} + static int gdb_trap(int type, int code) { jmp_buf jb; struct thread *thr_iter; void *prev_jb; + uint32_t host_features; prev_jb = kdb_jmpbuf(jb); if (setjmp(jb) != 0) { @@ -313,6 +418,8 @@ gdb_trap(int type, int code) gdb_tx_char('C'); gdb_tx_varhex((long)kdb_thread->td_tid); gdb_tx_end(); + } else if (gdb_rx_equal("Supported")) { + gdb_do_qsupported(&host_features); } else if (gdb_rx_equal("fThreadInfo")) { thr_iter = kdb_thr_first(); gdb_do_threadinfo(&thr_iter); From owner-svn-src-head@freebsd.org Thu Aug 22 00:34:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B670D8DFB; Thu, 22 Aug 2019 00:34:12 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DQWl6zbFz3JVK; Thu, 22 Aug 2019 00:34:11 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D13C923E7D; Thu, 22 Aug 2019 00:34:11 +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 x7M0YBUo088033; Thu, 22 Aug 2019 00:34:11 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M0YBOw088032; Thu, 22 Aug 2019 00:34:11 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908220034.x7M0YBOw088032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 22 Aug 2019 00:34:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351368 - head/sys/gdb X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/gdb X-SVN-Commit-Revision: 351368 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 00:34:12 -0000 Author: cem Date: Thu Aug 22 00:34:11 2019 New Revision: 351368 URL: https://svnweb.freebsd.org/changeset/base/351368 Log: gdb(4): Implement qXfer:threads:read This streams out an XML document over several GDB packets describing all threads in the system; their ids, name, and any loosely defined "extra info" we feel like including. For now, I have included a string version of the run state, similar to some of the DDB logic to stringify thread state. The benefit of supporting this in addition to the qfThreadInfo/qsThreadInfo packing is that in this mode, the host gdb does not ask for every thread's "qThreadExtraInfo," saving per-thread round-trips on "info threads." To use this feature, (k)gdb needs to be built with the --with-expat option. I would encourage enabling this option by default in our GDB port, if it is not already. Finally, there is another optional attribute you can specify per-thread called a "handle." Handles are arbitrarily long sequences of bytes, represented in the XML as hexadecimal. It is unclear to me how or if GDB actually uses handles for anything. So I have left them out. Modified: head/sys/gdb/gdb_main.c Modified: head/sys/gdb/gdb_main.c ============================================================================== --- head/sys/gdb/gdb_main.c Thu Aug 22 00:33:22 2019 (r351367) +++ head/sys/gdb/gdb_main.c Thu Aug 22 00:34:11 2019 (r351368) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -252,11 +253,12 @@ gdb_do_qsupported(uint32_t *feat) */ gdb_tx_varhex(GDB_BUFSZ + strlen("$#nn") - 1); + gdb_tx_str(";qXfer:threads:read+"); + /* * Future consideration: * - vCont * - multiprocess - * - qXfer:threads:read */ gdb_tx_end(); return; @@ -266,7 +268,306 @@ error: gdb_tx_err(EINVAL); } +/* + * A qXfer_context provides a vaguely generic way to generate a multi-packet + * response on the fly, making some assumptions about the size of sbuf writes + * vs actual packet length constraints. A non-byzantine gdb host should allow + * hundreds of bytes per packet or more. + * + * Upper layers are considered responsible for escaping the four forbidden + * characters '# $ } *'. + */ +struct qXfer_context { + struct sbuf sb; + size_t last_offset; + bool flushed; + bool lastmessage; + char xfer_buf[GDB_BUFSZ]; +}; + static int +qXfer_drain(void *v, const char *buf, int len) +{ + struct qXfer_context *qx; + + if (len < 0) + return (-EINVAL); + + qx = v; + if (qx->flushed) { + /* + * Overflow. We lost some message. Maybe the packet size is + * ridiculously small. + */ + printf("%s: Overflow in qXfer detected.\n", __func__); + return (-ENOBUFS); + } + + qx->last_offset += len; + qx->flushed = true; + + if (qx->lastmessage) + gdb_tx_begin('l'); + else + gdb_tx_begin('m'); + + memcpy(gdb_txp, buf, len); + gdb_txp += len; + + gdb_tx_end(); + return (len); +} + +static int +init_qXfer_ctx(struct qXfer_context *qx, uintmax_t len) +{ + + /* Protocol (max) length field includes framing overhead. */ + if (len < sizeof("$m#nn")) + return (ENOSPC); + + len -= 4; + len = ummin(len, GDB_BUFSZ - 1); + + qx->last_offset = 0; + qx->flushed = false; + qx->lastmessage = false; + sbuf_new(&qx->sb, qx->xfer_buf, len, SBUF_FIXEDLEN); + sbuf_set_drain(&qx->sb, qXfer_drain, qx); + return (0); +} + +/* + * dst must be 2x strlen(max_src) + 1. + * + * Squashes invalid XML characters down to _. Sorry. Then escapes for GDB. + */ +static void +qXfer_escape_xmlattr_str(char *dst, size_t dstlen, const char *src) +{ + static const char *forbidden = "#$}*"; + + size_t i; + char c; + + for (i = 0; i < dstlen - 1 && *src != 0; src++, i++) { + c = *src; + /* XML attr filter */ + if (c < 32) + c = '_'; + /* We assume attributes will be "" quoted. */ + if (c == '<' || c == '&' || c == '"') + c = '_'; + + /* GDB escape. */ + if (strchr(forbidden, c) != NULL) { + *dst++ = '}'; + c ^= 0x20; + } + *dst++ = c; + } + if (*src != 0) + printf("XXX%s: overflow; API misuse\n", __func__); + + *dst = 0; +} + +/* + * Dynamically generate qXfer:threads document, one packet at a time. + * + * The format is loosely described[0], although it does not seem that the + * mentioned on that page is required. + * + * [0]: https://sourceware.org/gdb/current/onlinedocs/gdb/Thread-List-Format.html + */ +static void +do_qXfer_threads_read(void) +{ + /* Kludgy context */ + static struct { + struct qXfer_context qXfer; + /* Kludgy state machine */ + struct thread *iter; + enum { + XML_START_THREAD, /* ' ...' */ + XML_END_THREAD, /* '' */ + XML_SENT_END_THREADS, /* '' */ + } next_step; + } ctx; + static char td_name_escape[MAXCOMLEN * 2 + 1]; + + const char *name_src; + uintmax_t offset, len; + int error; + + /* Annex part must be empty. */ + if (gdb_rx_char() != ':') + goto misformed_request; + + if (gdb_rx_varhex(&offset) != 0 || + gdb_rx_char() != ',' || + gdb_rx_varhex(&len) != 0) + goto misformed_request; + + /* + * Validate resume xfers. + */ + if (offset != 0) { + if (offset != ctx.qXfer.last_offset) { + printf("%s: Resumed offset %ju != expected %ju\n", + __func__, offset, ctx.qXfer.last_offset); + error = ESPIPE; + goto request_error; + } + ctx.qXfer.flushed = false; + } + + if (offset == 0) { + ctx.iter = kdb_thr_first(); + ctx.next_step = XML_START_THREAD; + error = init_qXfer_ctx(&ctx.qXfer, len); + if (error != 0) + goto request_error; + + sbuf_cat(&ctx.qXfer.sb, ""); + } + + while (!ctx.qXfer.flushed && ctx.iter != NULL) { + switch (ctx.next_step) { + case XML_START_THREAD: + ctx.next_step = XML_THREAD_ID; + sbuf_cat(&ctx.qXfer.sb, "td_tid); + continue; + + case XML_THREAD_CORE: + ctx.next_step = XML_THREAD_NAME; + if (ctx.iter->td_oncpu != NOCPU) { + sbuf_printf(&ctx.qXfer.sb, " core=\"%d\"", + ctx.iter->td_oncpu); + } + continue; + + case XML_THREAD_NAME: + ctx.next_step = XML_THREAD_EXTRA; + + if (ctx.iter->td_name[0] != 0) + name_src = ctx.iter->td_name; + else if (ctx.iter->td_proc != NULL && + ctx.iter->td_proc->p_comm[0] != 0) + name_src = ctx.iter->td_proc->p_comm; + else + continue; + + qXfer_escape_xmlattr_str(td_name_escape, + sizeof(td_name_escape), name_src); + sbuf_printf(&ctx.qXfer.sb, " name=\"%s\"", + td_name_escape); + continue; + + case XML_THREAD_EXTRA: + ctx.next_step = XML_END_THREAD; + + sbuf_putc(&ctx.qXfer.sb, '>'); + + if (ctx.iter->td_state == TDS_RUNNING) + sbuf_cat(&ctx.qXfer.sb, "Running"); + else if (ctx.iter->td_state == TDS_RUNQ) + sbuf_cat(&ctx.qXfer.sb, "RunQ"); + else if (ctx.iter->td_state == TDS_CAN_RUN) + sbuf_cat(&ctx.qXfer.sb, "CanRun"); + else if (TD_ON_LOCK(ctx.iter)) + sbuf_cat(&ctx.qXfer.sb, "Blocked"); + else if (TD_IS_SLEEPING(ctx.iter)) + sbuf_cat(&ctx.qXfer.sb, "Sleeping"); + else if (TD_IS_SWAPPED(ctx.iter)) + sbuf_cat(&ctx.qXfer.sb, "Swapped"); + else if (TD_AWAITING_INTR(ctx.iter)) + sbuf_cat(&ctx.qXfer.sb, "IthreadWait"); + else if (TD_IS_SUSPENDED(ctx.iter)) + sbuf_cat(&ctx.qXfer.sb, "Suspended"); + else + sbuf_cat(&ctx.qXfer.sb, "???"); + continue; + + case XML_END_THREAD: + ctx.next_step = XML_START_THREAD; + sbuf_cat(&ctx.qXfer.sb, ""); + ctx.iter = kdb_thr_next(ctx.iter); + continue; + + /* + * This one isn't part of the looping state machine, + * but GCC complains if you leave an enum value out of the + * select. + */ + case XML_SENT_END_THREADS: + /* NOTREACHED */ + break; + } + } + if (ctx.qXfer.flushed) + return; + + if (ctx.next_step != XML_SENT_END_THREADS) { + ctx.next_step = XML_SENT_END_THREADS; + sbuf_cat(&ctx.qXfer.sb, ""); + } + if (ctx.qXfer.flushed) + return; + + ctx.qXfer.lastmessage = true; + sbuf_finish(&ctx.qXfer.sb); + sbuf_delete(&ctx.qXfer.sb); + ctx.qXfer.last_offset = 0; + return; + +misformed_request: + /* + * GDB "General-Query-Packets.html" qXfer-read anchor specifically + * documents an E00 code for malformed requests or invalid annex. + * Non-zero codes indicate invalid offset or "error reading the data." + */ + error = 0; +request_error: + gdb_tx_err(error); + return; +} + +/* + * A set of standardized transfers from "special data areas." + * + * We've already matched on "qXfer:" and advanced the rx packet buffer past + * that bit. Parse out the rest of the packet and generate an appropriate + * response. + */ +static void +do_qXfer(void) +{ + if (!gdb_rx_equal("threads:")) + goto unrecognized; + + if (!gdb_rx_equal("read:")) + goto unrecognized; + + do_qXfer_threads_read(); + return; + +unrecognized: + gdb_tx_empty(); + return; +} + +static int gdb_trap(int type, int code) { jmp_buf jb; @@ -425,6 +726,8 @@ gdb_trap(int type, int code) gdb_do_threadinfo(&thr_iter); } else if (gdb_rx_equal("sThreadInfo")) { gdb_do_threadinfo(&thr_iter); + } else if (gdb_rx_equal("Xfer:")) { + do_qXfer(); } else if (gdb_rx_equal("Search:memory:")) { gdb_do_mem_search(); } else if (!gdb_cpu_query()) From owner-svn-src-head@freebsd.org Thu Aug 22 00:35:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20BA2D8E74; Thu, 22 Aug 2019 00:35:18 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DQY16zpGz3JdQ; Thu, 22 Aug 2019 00:35:17 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D21AB23E7E; Thu, 22 Aug 2019 00:35:17 +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 x7M0ZHqc088143; Thu, 22 Aug 2019 00:35:17 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M0ZH3R088142; Thu, 22 Aug 2019 00:35:17 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908220035.x7M0ZH3R088142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 22 Aug 2019 00:35:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351369 - head/sys/amd64/include X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/amd64/include X-SVN-Commit-Revision: 351369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 00:35:18 -0000 Author: cem Date: Thu Aug 22 00:35:17 2019 New Revision: 351369 URL: https://svnweb.freebsd.org/changeset/base/351369 Log: gdb(4):amd64: Bump MI GDB_BUFSZ for more efficient transfers A bigger buffer reduces the RTTs to transfer long messages and is otherwise relatively harmless, especially on systems with plenty of memory. Modified: head/sys/amd64/include/gdb_machdep.h Modified: head/sys/amd64/include/gdb_machdep.h ============================================================================== --- head/sys/amd64/include/gdb_machdep.h Thu Aug 22 00:34:11 2019 (r351368) +++ head/sys/amd64/include/gdb_machdep.h Thu Aug 22 00:35:17 2019 (r351369) @@ -31,9 +31,10 @@ #ifndef _MACHINE_GDB_MACHDEP_H_ #define _MACHINE_GDB_MACHDEP_H_ -#define GDB_BUFSZ (GDB_NREGS * 16) +#define GDB_BUFSZ 4096 #define GDB_NREGS 56 #define GDB_REG_PC 16 +_Static_assert(GDB_BUFSZ >= (GDB_NREGS * 16), "buffer fits 'g' regs"); static __inline size_t gdb_cpu_regsz(int regnum) From owner-svn-src-head@freebsd.org Thu Aug 22 00:36:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B353FD8EF0; Thu, 22 Aug 2019 00:36:17 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DQZ94Jgrz3JmP; Thu, 22 Aug 2019 00:36:17 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75C2A23E80; Thu, 22 Aug 2019 00:36:17 +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 x7M0aHpj088230; Thu, 22 Aug 2019 00:36:17 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M0aHHJ088228; Thu, 22 Aug 2019 00:36:17 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908220036.x7M0aHHJ088228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 22 Aug 2019 00:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351370 - head/sys/gdb X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/gdb X-SVN-Commit-Revision: 351370 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 00:36:17 -0000 Author: cem Date: Thu Aug 22 00:36:16 2019 New Revision: 351370 URL: https://svnweb.freebsd.org/changeset/base/351370 Log: gdb(4): Style No functional change. I was surprised to find that no sys/ header already defines the -1 EOF convention anywhere, so defined one locally. Modified: head/sys/gdb/gdb_int.h head/sys/gdb/gdb_main.c head/sys/gdb/gdb_packet.c Modified: head/sys/gdb/gdb_int.h ============================================================================== --- head/sys/gdb/gdb_int.h Thu Aug 22 00:35:17 2019 (r351369) +++ head/sys/gdb/gdb_int.h Thu Aug 22 00:36:16 2019 (r351370) @@ -31,6 +31,10 @@ #ifndef _GDB_GDB_INT_H_ #define _GDB_GDB_INT_H_ +#ifndef EOF +#define EOF (-1) +#endif + extern struct gdb_dbgport *gdb_cur; extern int gdb_listening; @@ -54,7 +58,7 @@ gdb_rx_char(void) c = *gdb_rxp++; gdb_rxsz--; } else - c = -1; + c = EOF; return (c); } Modified: head/sys/gdb/gdb_main.c ============================================================================== --- head/sys/gdb/gdb_main.c Thu Aug 22 00:35:17 2019 (r351369) +++ head/sys/gdb/gdb_main.c Thu Aug 22 00:36:16 2019 (r351370) @@ -653,7 +653,10 @@ gdb_trap(int type, int code) case 'H': { /* Set thread. */ intmax_t tid; struct thread *thr; - gdb_rx_char(); + + /* Ignore 'g' (general) or 'c' (continue) flag. */ + (void) gdb_rx_char(); + if (gdb_rx_varhex(&tid)) { gdb_tx_err(EINVAL); break; @@ -768,7 +771,7 @@ gdb_trap(int type, int code) gdb_tx_err(ENOENT); break; } - case -1: + case EOF: /* Empty command. Treat as unknown command. */ /* FALLTHROUGH */ default: Modified: head/sys/gdb/gdb_packet.c ============================================================================== --- head/sys/gdb/gdb_packet.c Thu Aug 22 00:35:17 2019 (r351369) +++ head/sys/gdb/gdb_packet.c Thu Aug 22 00:36:16 2019 (r351370) @@ -197,7 +197,7 @@ gdb_rx_varhex(uintmax_t *vp) v += C2N(c); c = gdb_rx_char(); } while (isxdigit(c)); - if (c != -1) { + if (c != EOF) { gdb_rxp--; gdb_rxsz++; } @@ -343,13 +343,12 @@ gdb_rx_bindata(unsigned char *data, size_t datalen, si while (*amt < datalen) { c = gdb_rx_char(); - /* End of packet? */ - if (c == -1) + if (c == EOF) break; /* Escaped character up next */ if (c == '}') { - /* Truncated packet? Bail out */ - if ((c = gdb_rx_char()) == -1) + /* Malformed packet. */ + if ((c = gdb_rx_char()) == EOF) return (1); c ^= 0x20; } From owner-svn-src-head@freebsd.org Thu Aug 22 01:15:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EDCD0D9906; Thu, 22 Aug 2019 01:15:06 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DRQy637Kz3LQZ; Thu, 22 Aug 2019 01:15:06 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE41D245B3; Thu, 22 Aug 2019 01:15:06 +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 x7M1F6fd011710; Thu, 22 Aug 2019 01:15:06 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M1F6fu011709; Thu, 22 Aug 2019 01:15:06 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201908220115.x7M1F6fu011709@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 22 Aug 2019 01:15:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351372 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351372 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 01:15:07 -0000 Author: rmacklem Date: Thu Aug 22 01:15:06 2019 New Revision: 351372 URL: https://svnweb.freebsd.org/changeset/base/351372 Log: Map ENOTTY to EINVAL for lseek(SEEK_DATA/SEEK_HOLE). Without this patch, when an application performed lseek(SEEK_DATA/SEEK_HOLE) on a file in a file system that does not have its own VOP_IOCTL(), the lseek(2) fails with errno ENOTTY. This didn't seem appropriate, since ENOTTY is not listed as an error return by either the lseek(2) man page nor the POSIX draft for lseek(2). This was discussed on freebsd-current@ here: http://docs.FreeBSD.org/cgi/mid.cgi?CAOtMX2iiQdv1+15e1N_r7V6aCx_VqAJCTP1AW+qs3Yg7sPg9wA This trivial patch maps ENOTTY to EINVAL for lseek(SEEK_DATA/SEEK_HOLE). Reviewed by: markj Relnotes: yes Differential Revision: https://reviews.freebsd.org/D21300 Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Thu Aug 22 00:37:38 2019 (r351371) +++ head/sys/kern/vfs_vnops.c Thu Aug 22 01:15:06 2019 (r351372) @@ -2275,9 +2275,13 @@ vn_seek(struct file *fp, off_t offset, int whence, str break; case SEEK_DATA: error = fo_ioctl(fp, FIOSEEKDATA, &offset, cred, td); + if (error == ENOTTY) + error = EINVAL; break; case SEEK_HOLE: error = fo_ioctl(fp, FIOSEEKHOLE, &offset, cred, td); + if (error == ENOTTY) + error = EINVAL; break; default: error = EINVAL; From owner-svn-src-head@freebsd.org Thu Aug 22 01:18:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6650D998D; Thu, 22 Aug 2019 01:18:36 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DRW05gdnz3LYs; Thu, 22 Aug 2019 01:18:36 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9174245B8; Thu, 22 Aug 2019 01:18:36 +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 x7M1Ia8w011898; Thu, 22 Aug 2019 01:18:36 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M1IacB011897; Thu, 22 Aug 2019 01:18:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908220118.x7M1IacB011897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 22 Aug 2019 01:18:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351373 - head X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 351373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 01:18:37 -0000 Author: markj Date: Thu Aug 22 01:18:36 2019 New Revision: 351373 URL: https://svnweb.freebsd.org/changeset/base/351373 Log: Document r351361. Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Thu Aug 22 01:15:06 2019 (r351372) +++ head/RELNOTES Thu Aug 22 01:18:36 2019 (r351373) @@ -10,6 +10,11 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +r351361: + Add probes for lockmgr(9) to the lockstat DTrace provider, add + corresponding lockstat(1) events, and document the new probes in + dtrace_lockstat.4. + r351201: Add a vop_stdioctl() call, so that file systems that do not support holes will have a trivial implementation of lseek(SEEK_DATA/SEEK_HOLE). From owner-svn-src-head@freebsd.org Thu Aug 22 01:30:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1A40DA0C3; Thu, 22 Aug 2019 01:30:00 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DRm842MRz3MHd; Thu, 22 Aug 2019 01:30:00 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C4DE24780; Thu, 22 Aug 2019 01:30:00 +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 x7M1U0Q0017605; Thu, 22 Aug 2019 01:30:00 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M1U0dA017604; Thu, 22 Aug 2019 01:30:00 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201908220130.x7M1U0dA017604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 22 Aug 2019 01:30:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351374 - head X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 351374 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 01:30:00 -0000 Author: rmacklem Date: Thu Aug 22 01:29:59 2019 New Revision: 351374 URL: https://svnweb.freebsd.org/changeset/base/351374 Log: Add a couple of lines noting that r351372 maps ENOTTY->EINVAL for other cases. Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Thu Aug 22 01:18:36 2019 (r351373) +++ head/RELNOTES Thu Aug 22 01:29:59 2019 (r351374) @@ -15,7 +15,7 @@ r351361: corresponding lockstat(1) events, and document the new probes in dtrace_lockstat.4. -r351201: +r351201, r351372: Add a vop_stdioctl() call, so that file systems that do not support holes will have a trivial implementation of lseek(SEEK_DATA/SEEK_HOLE). The algorithm appears to be compatible with the POSIX draft and @@ -23,6 +23,8 @@ r351201: does not support holes. Prior to this patch, lseek(2) would reply -1 with errno set to ENOTTY for SEEK_DATA/SEEK_HOLE on files in file systems that do not support holes. + r351372 maps ENOTTY to EINVAL for lseek(SEEK_DATA/SEEK_HOLE) for + any other cases, such as a ENOTTY return from vn_bmap_seekhole(). r350665: The fuse driver has been renamed to fusefs(5) and been substantially From owner-svn-src-head@freebsd.org Thu Aug 22 02:53:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7811DBABB; Thu, 22 Aug 2019 02:53:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DTcp3yVrz3QsQ; Thu, 22 Aug 2019 02:53:46 +0000 (UTC) (envelope-from imp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69CB6257A4; Thu, 22 Aug 2019 02:53:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7M2rkTr070389; Thu, 22 Aug 2019 02:53:46 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M2rkqn070388; Thu, 22 Aug 2019 02:53:46 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908220253.x7M2rkqn070388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Aug 2019 02:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351375 - head X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 351375 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 02:53:46 -0000 Author: imp Date: Thu Aug 22 02:53:46 2019 New Revision: 351375 URL: https://svnweb.freebsd.org/changeset/base/351375 Log: Document Intel RST support just added Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Thu Aug 22 01:29:59 2019 (r351374) +++ head/RELNOTES Thu Aug 22 02:53:46 2019 (r351375) @@ -15,6 +15,14 @@ r351361: corresponding lockstat(1) events, and document the new probes in dtrace_lockstat.4. +r351356: + Intel RST is a new 'feature' that remaps NVMe devices from + their normal location to part of the AHCI bar space. This + will eliminate the need to set the BIOS SATA setting from RST + to AHCI causing the nvme drive to be erased before FreeBSD + will see the nvme drive. FreeBSD will now be able to see the + nvme drive now in the default config. + r351201, r351372: Add a vop_stdioctl() call, so that file systems that do not support holes will have a trivial implementation of lseek(SEEK_DATA/SEEK_HOLE). From owner-svn-src-head@freebsd.org Thu Aug 22 02:53:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBF77DBAE2; Thu, 22 Aug 2019 02:53:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DTcv4sd0z3Qyl; Thu, 22 Aug 2019 02:53:51 +0000 (UTC) (envelope-from imp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73058257A5; Thu, 22 Aug 2019 02:53:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7M2rpIc070443; Thu, 22 Aug 2019 02:53:51 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M2rpLq070442; Thu, 22 Aug 2019 02:53:51 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908220253.x7M2rpLq070442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Aug 2019 02:53:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351376 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 351376 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 02:53:51 -0000 Author: imp Date: Thu Aug 22 02:53:51 2019 New Revision: 351376 URL: https://svnweb.freebsd.org/changeset/base/351376 Log: Remove stray line that was duplicated. Noticed by: rpokala@ Modified: head/sys/dev/nvme/nvme.c Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Thu Aug 22 02:53:46 2019 (r351375) +++ head/sys/dev/nvme/nvme.c Thu Aug 22 02:53:51 2019 (r351376) @@ -138,7 +138,6 @@ nvme_attach(device_t dev) /* * Reset controller twice to ensure we do a transition from cc.en==1 - * Reset controller twice to ensure we do a transition from cc.en==1 * to cc.en==0. This is because we don't really know what status * the controller was left in when boot handed off to OS. */ From owner-svn-src-head@freebsd.org Thu Aug 22 03:28:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0E98DC629; Thu, 22 Aug 2019 03:28:31 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DVNv5dBKz3y4d; Thu, 22 Aug 2019 03:28:31 +0000 (UTC) (envelope-from karels@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2A6B25DAE; Thu, 22 Aug 2019 03:28:31 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7M3SVer089701; Thu, 22 Aug 2019 03:28:31 GMT (envelope-from karels@FreeBSD.org) Received: (from karels@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M3SVDU089700; Thu, 22 Aug 2019 03:28:31 GMT (envelope-from karels@FreeBSD.org) Message-Id: <201908220328.x7M3SVDU089700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: karels set sender to karels@FreeBSD.org using -f From: Mike Karels Date: Thu, 22 Aug 2019 03:28:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351379 - head/usr.bin/w X-SVN-Group: head X-SVN-Commit-Author: karels X-SVN-Commit-Paths: head/usr.bin/w X-SVN-Commit-Revision: 351379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 03:28:31 -0000 Author: karels Date: Thu Aug 22 03:28:31 2019 New Revision: 351379 URL: https://svnweb.freebsd.org/changeset/base/351379 Log: Change w(1) to compute FROM (host) field size dynamically It's nice to be able to display a full IPv6 host address if needed, but it's also nice to display more than 3 characters of a command line. Compute the needed size for the FROM column in an earlier pass, and determine the maximum, then print what fits for the command. Reviewed by: marcel@ (markm@ previous revision) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21211 Modified: head/usr.bin/w/w.c Modified: head/usr.bin/w/w.c ============================================================================== --- head/usr.bin/w/w.c Thu Aug 22 03:00:55 2019 (r351378) +++ head/usr.bin/w/w.c Thu Aug 22 03:28:31 2019 (r351379) @@ -96,7 +96,8 @@ static struct winsize ws; static kvm_t *kd; static time_t now; /* the current time of day */ static int ttywidth; /* width of tty */ -static int argwidth; /* width of tty */ +static int fromwidth = 0; /* max width of "from" field */ +static int argwidth; /* width of arguments */ static int header = 1; /* true if -h flag: don't print heading */ static int nflag; /* true if -n flag: don't convert addrs */ static int dflag; /* true if -d flag: output debug info */ @@ -116,13 +117,14 @@ static struct entry { struct kinfo_proc *kp; /* `most interesting' proc */ char *args; /* arg list of interesting process */ struct kinfo_proc *dkp; /* debug option proc list */ + char *from; /* "from": name or addr */ } *ep, *ehead = NULL, **nextp = &ehead; #define debugproc(p) *(&((struct kinfo_proc *)p)->ki_udata) #define W_DISPUSERSIZE 10 #define W_DISPLINESIZE 8 -#define W_DISPHOSTSIZE 40 +#define W_MAXHOSTSIZE 40 static void pr_header(time_t *, int); static struct stat *ttystat(char *); @@ -209,6 +211,13 @@ main(int argc, char *argv[]) setutxent(); for (nusers = 0; (utmp = getutxent()) != NULL;) { + struct addrinfo hints, *res; + struct sockaddr_storage ss; + struct sockaddr *sa = (struct sockaddr *)&ss; + struct sockaddr_in *lsin = (struct sockaddr_in *)&ss; + struct sockaddr_in6 *lsin6 = (struct sockaddr_in6 *)&ss; + int isaddr; + if (utmp->ut_type != USER_PROCESS) continue; if (!(stp = ttystat(utmp->ut_line))) @@ -250,9 +259,76 @@ main(int argc, char *argv[]) } if ((ep->idle = now - touched) < 0) ep->idle = 0; + + save_p = p = *ep->utmp.ut_host ? ep->utmp.ut_host : "-"; + if ((x_suffix = strrchr(p, ':')) != NULL) { + if ((dot = strchr(x_suffix, '.')) != NULL && + strchr(dot+1, '.') == NULL) + *x_suffix++ = '\0'; + else + x_suffix = NULL; + } + + isaddr = 0; + memset(&ss, '\0', sizeof(ss)); + if (inet_pton(AF_INET6, p, &lsin6->sin6_addr) == 1) { + lsin6->sin6_len = sizeof(*lsin6); + lsin6->sin6_family = AF_INET6; + isaddr = 1; + } else if (inet_pton(AF_INET, p, &lsin->sin_addr) == 1) { + lsin->sin_len = sizeof(*lsin); + lsin->sin_family = AF_INET; + isaddr = 1; + } + if (nflag == 0) { + /* Attempt to change an IP address into a name */ + if (isaddr && realhostname_sa(fn, sizeof(fn), sa, + sa->sa_len) == HOSTNAME_FOUND) + p = fn; + } else if (!isaddr && nflag > 1) { + /* + * If a host has only one A/AAAA RR, change a + * name into an IP address + */ + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_PASSIVE; + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + if (getaddrinfo(p, NULL, &hints, &res) == 0) { + if (res->ai_next == NULL && + getnameinfo(res->ai_addr, res->ai_addrlen, + fn, sizeof(fn), NULL, 0, + NI_NUMERICHOST) == 0) + p = fn; + freeaddrinfo(res); + } + } + + if (x_suffix) { + (void)snprintf(buf, sizeof(buf), "%s:%s", p, x_suffix); + p = buf; + } + ep->from = strdup(p); + if ((i = strlen(p)) > fromwidth) + fromwidth = i; } endutxent(); +#define HEADER_USER "USER" +#define HEADER_TTY "TTY" +#define HEADER_FROM "FROM" +#define HEADER_LOGIN_IDLE "LOGIN@ IDLE " +#define HEADER_WHAT "WHAT\n" +#define WUSED (W_DISPUSERSIZE + W_DISPLINESIZE + fromwidth + \ + sizeof(HEADER_LOGIN_IDLE) + 3) /* header width incl. spaces */ + + + if ((int) sizeof(HEADER_FROM) > fromwidth) + fromwidth = sizeof(HEADER_FROM); + fromwidth++; + if (fromwidth > W_MAXHOSTSIZE) + fromwidth = W_MAXHOSTSIZE; + xo_open_container("uptime-information"); if (header || wcmd == 0) { @@ -265,17 +341,10 @@ main(int argc, char *argv[]) exit(0); } -#define HEADER_USER "USER" -#define HEADER_TTY "TTY" -#define HEADER_FROM "FROM" -#define HEADER_LOGIN_IDLE "LOGIN@ IDLE " -#define HEADER_WHAT "WHAT\n" -#define WUSED (W_DISPUSERSIZE + W_DISPLINESIZE + W_DISPHOSTSIZE + \ - sizeof(HEADER_LOGIN_IDLE) + 3) /* header width incl. spaces */ xo_emit("{T:/%-*.*s} {T:/%-*.*s} {T:/%-*.*s} {T:/%s}", W_DISPUSERSIZE, W_DISPUSERSIZE, HEADER_USER, W_DISPLINESIZE, W_DISPLINESIZE, HEADER_TTY, - W_DISPHOSTSIZE, W_DISPHOSTSIZE, HEADER_FROM, + fromwidth, fromwidth, HEADER_FROM, HEADER_LOGIN_IDLE HEADER_WHAT); } @@ -350,64 +419,10 @@ main(int argc, char *argv[]) xo_open_list("user-entry"); for (ep = ehead; ep != NULL; ep = ep->next) { - struct addrinfo hints, *res; - struct sockaddr_storage ss; - struct sockaddr *sa = (struct sockaddr *)&ss; - struct sockaddr_in *lsin = (struct sockaddr_in *)&ss; - struct sockaddr_in6 *lsin6 = (struct sockaddr_in6 *)&ss; time_t t; - int isaddr; xo_open_instance("user-entry"); - save_p = p = *ep->utmp.ut_host ? ep->utmp.ut_host : "-"; - if ((x_suffix = strrchr(p, ':')) != NULL) { - if ((dot = strchr(x_suffix, '.')) != NULL && - strchr(dot+1, '.') == NULL) - *x_suffix++ = '\0'; - else - x_suffix = NULL; - } - - isaddr = 0; - memset(&ss, '\0', sizeof(ss)); - if (inet_pton(AF_INET6, p, &lsin6->sin6_addr) == 1) { - lsin6->sin6_len = sizeof(*lsin6); - lsin6->sin6_family = AF_INET6; - isaddr = 1; - } else if (inet_pton(AF_INET, p, &lsin->sin_addr) == 1) { - lsin->sin_len = sizeof(*lsin); - lsin->sin_family = AF_INET; - isaddr = 1; - } - if (nflag == 0) { - /* Attempt to change an IP address into a name */ - if (isaddr && realhostname_sa(fn, sizeof(fn), sa, - sa->sa_len) == HOSTNAME_FOUND) - p = fn; - } else if (!isaddr && nflag > 1) { - /* - * If a host has only one A/AAAA RR, change a - * name into an IP address - */ - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = AI_PASSIVE; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - if (getaddrinfo(p, NULL, &hints, &res) == 0) { - if (res->ai_next == NULL && - getnameinfo(res->ai_addr, res->ai_addrlen, - fn, sizeof(fn), NULL, 0, - NI_NUMERICHOST) == 0) - p = fn; - freeaddrinfo(res); - } - } - - if (x_suffix) { - (void)snprintf(buf, sizeof(buf), "%s:%s", p, x_suffix); - p = buf; - } if (dflag) { xo_open_container("process-table"); xo_open_list("process-entry"); @@ -438,7 +453,7 @@ main(int argc, char *argv[]) if (save_p && save_p != p) xo_attr("address", "%s", save_p); xo_emit("{:from/%-*.*s/%@**@s} ", - W_DISPHOSTSIZE, W_DISPHOSTSIZE, *p ? p : "-"); + fromwidth, fromwidth, ep->from); t = ep->utmp.ut_tv.tv_sec; longattime = pr_attime(&t, &now); longidle = pr_idle(ep->idle); From owner-svn-src-head@freebsd.org Thu Aug 22 03:33:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF247DC7FE; Thu, 22 Aug 2019 03:33:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DVVG5Mmqz3yR9; Thu, 22 Aug 2019 03:33:10 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A02025F6D; Thu, 22 Aug 2019 03:33:10 +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 x7M3XATe095335; Thu, 22 Aug 2019 03:33:10 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M3XAj2095334; Thu, 22 Aug 2019 03:33:10 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908220333.x7M3XAj2095334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 22 Aug 2019 03:33:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351380 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351380 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 03:33:10 -0000 Author: cy Date: Thu Aug 22 03:33:10 2019 New Revision: 351380 URL: https://svnweb.freebsd.org/changeset/base/351380 Log: Specifying array sizes for fully initialized tables at compile time is redundant. MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Thu Aug 22 03:28:31 2019 (r351379) +++ head/sys/contrib/ipfilter/netinet/fil.c Thu Aug 22 03:33:10 2019 (r351380) @@ -194,7 +194,7 @@ static int ppsratecheck(struct timeval *, int *, int) * hand side to allow for binary searching of the array and include a trailer * with a 0 for the bitmask for linear searches to easily find the end with. */ -static const struct optlist ipopts[20] = { +static const struct optlist ipopts[] = { { IPOPT_NOP, 0x000001 }, { IPOPT_RR, 0x000002 }, { IPOPT_ZSU, 0x000004 }, @@ -235,7 +235,7 @@ static const struct optlist ip6exthdr[] = { /* * bit values for identifying presence of individual IP security options */ -static const struct optlist secopt[8] = { +static const struct optlist secopt[] = { { IPSO_CLASS_RES4, 0x01 }, { IPSO_CLASS_TOPS, 0x02 }, { IPSO_CLASS_SECR, 0x04 }, From owner-svn-src-head@freebsd.org Thu Aug 22 04:31:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75201DD420; Thu, 22 Aug 2019 04:31:08 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DWn82Vrvz41XQ; Thu, 22 Aug 2019 04:31:08 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37AFD268A6; Thu, 22 Aug 2019 04:31:08 +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 x7M4V87o026549; Thu, 22 Aug 2019 04:31:08 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M4V8Df026548; Thu, 22 Aug 2019 04:31:08 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908220431.x7M4V8Df026548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 22 Aug 2019 04:31:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351381 - head/sys/gdb X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/gdb X-SVN-Commit-Revision: 351381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 04:31:08 -0000 Author: cem Date: Thu Aug 22 04:31:07 2019 New Revision: 351381 URL: https://svnweb.freebsd.org/changeset/base/351381 Log: Fix i386 build after r351368 Reported by: cy Submitted by: cy Modified: head/sys/gdb/gdb_main.c Modified: head/sys/gdb/gdb_main.c ============================================================================== --- head/sys/gdb/gdb_main.c Thu Aug 22 03:33:10 2019 (r351380) +++ head/sys/gdb/gdb_main.c Thu Aug 22 04:31:07 2019 (r351381) @@ -418,7 +418,7 @@ do_qXfer_threads_read(void) */ if (offset != 0) { if (offset != ctx.qXfer.last_offset) { - printf("%s: Resumed offset %ju != expected %ju\n", + printf("%s: Resumed offset %ju != expected %zu\n", __func__, offset, ctx.qXfer.last_offset); error = ESPIPE; goto request_error; From owner-svn-src-head@freebsd.org Thu Aug 22 06:14:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 240CCDEB4D; Thu, 22 Aug 2019 06:14:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DZ3y72dKz453W; Thu, 22 Aug 2019 06:14:06 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D335F27C10; Thu, 22 Aug 2019 06:14:06 +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 x7M6E6DT089217; Thu, 22 Aug 2019 06:14:06 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M6E62J089216; Thu, 22 Aug 2019 06:14:06 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908220614.x7M6E62J089216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 22 Aug 2019 06:14:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351382 - head/sbin/newfs_msdos X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/newfs_msdos X-SVN-Commit-Revision: 351382 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 06:14:07 -0000 Author: delphij Date: Thu Aug 22 06:14:06 2019 New Revision: 351382 URL: https://svnweb.freebsd.org/changeset/base/351382 Log: When creating a new FAT32 filesystem, use "unknown" (0xFFFFFFFF) for FSI_Nxt_Free instead of providing a wrong value. With this change, fsck_msdosfs would no longer complain about invalid FSInfo information. MFC after: 2 weeks Modified: head/sbin/newfs_msdos/mkfs_msdos.c Modified: head/sbin/newfs_msdos/mkfs_msdos.c ============================================================================== --- head/sbin/newfs_msdos/mkfs_msdos.c Thu Aug 22 04:31:07 2019 (r351381) +++ head/sbin/newfs_msdos/mkfs_msdos.c Thu Aug 22 06:14:06 2019 (r351382) @@ -717,7 +717,7 @@ mkfs_msdos(const char *fname, const char *dtype, const mk4(img, 0x41615252); mk4(img + MINBPS - 28, 0x61417272); mk4(img + MINBPS - 24, 0xffffffff); - mk4(img + MINBPS - 20, bpb.bpbRootClust); + mk4(img + MINBPS - 20, 0xffffffff); mk2(img + MINBPS - 2, DOSMAGIC); } else if (lsn >= bpb.bpbResSectors && lsn < dir && !((lsn - bpb.bpbResSectors) % From owner-svn-src-head@freebsd.org Thu Aug 22 07:52:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C819FC0619; Thu, 22 Aug 2019 07:52:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DcF24yppz49Np; Thu, 22 Aug 2019 07:52:06 +0000 (UTC) (envelope-from bz@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DB37E75; Thu, 22 Aug 2019 07:52:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7M7q6wp048118; Thu, 22 Aug 2019 07:52:06 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M7q6Mq048117; Thu, 22 Aug 2019 07:52:06 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201908220752.x7M7q6Mq048117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 22 Aug 2019 07:52:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351385 - head/usr.bin/w X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/usr.bin/w X-SVN-Commit-Revision: 351385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 07:52:06 -0000 Author: bz Date: Thu Aug 22 07:52:06 2019 New Revision: 351385 URL: https://svnweb.freebsd.org/changeset/base/351385 Log: w: initialize save_p to silence 'may be used uninitilized' After r351379 save_p may be used uninitialized. Set it to NULL before first assignment so that a later NULL check will work correctly. Reported by: CI system for gcc platforms MFC after: 1 week X-MFC with: 351379 (karels) Modified: head/usr.bin/w/w.c Modified: head/usr.bin/w/w.c ============================================================================== --- head/usr.bin/w/w.c Thu Aug 22 07:37:34 2019 (r351384) +++ head/usr.bin/w/w.c Thu Aug 22 07:52:06 2019 (r351385) @@ -209,6 +209,7 @@ main(int argc, char *argv[]) if (*argv) sel_users = argv; + save_p = NULL; setutxent(); for (nusers = 0; (utmp = getutxent()) != NULL;) { struct addrinfo hints, *res; From owner-svn-src-head@freebsd.org Thu Aug 22 09:24:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 229A8C35A3; Thu, 22 Aug 2019 09:24:44 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DfHw093qz4G2Q; Thu, 22 Aug 2019 09:24:44 +0000 (UTC) (envelope-from bz@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D70091F2A; Thu, 22 Aug 2019 09:24:43 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7M9Oh0Q003007; Thu, 22 Aug 2019 09:24:43 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M9Ohda003006; Thu, 22 Aug 2019 09:24:43 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201908220924.x7M9Ohda003006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 22 Aug 2019 09:24:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351388 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 351388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 09:24:44 -0000 Author: bz Date: Thu Aug 22 09:24:43 2019 New Revision: 351388 URL: https://svnweb.freebsd.org/changeset/base/351388 Log: usb: fix usb_fdt_support.c when altq enabled (usb_ehernet.h changes) After r351243 when ALTQ was enabled in the kernel, the inline functions in ifq.h would not have full type information as if_var.h was not included. Given usb_ethernet.h already includes all the various headers (which) is the cause of the problem here, add if_var.h to it. This fixes the builds again. Reported by: CI system, e.g. FreeBSD-head-aarch64-LINT Modified: head/sys/dev/usb/net/usb_ethernet.h Modified: head/sys/dev/usb/net/usb_ethernet.h ============================================================================== --- head/sys/dev/usb/net/usb_ethernet.h Thu Aug 22 08:49:21 2019 (r351387) +++ head/sys/dev/usb/net/usb_ethernet.h Thu Aug 22 09:24:43 2019 (r351388) @@ -41,6 +41,7 @@ #include #include +#include #include #include #include From owner-svn-src-head@freebsd.org Thu Aug 22 09:39:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C87FFC3896; Thu, 22 Aug 2019 09:39:50 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DfdL4h1Jz4GYh; Thu, 22 Aug 2019 09:39:50 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (cross.sbone.de [195.201.62.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 6D94ED665; Thu, 22 Aug 2019 09:39:50 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 6DC618D4A210; Thu, 22 Aug 2019 09:39:49 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id E457FE7084B; Thu, 22 Aug 2019 09:39:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id Q51KwTrJo8zM; Thu, 22 Aug 2019 09:39:46 +0000 (UTC) Received: from [127.0.0.1] (unknown [IPv6:fde9:577b:c1a9:31:b8c3:fcc4:54a6:5880]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 5B081E70847; Thu, 22 Aug 2019 09:39:46 +0000 (UTC) From: "Bjoern A. Zeeb" To: "John Baldwin" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351364 - in head/sys: crypto/blowfish crypto/chacha20 crypto/des opencrypto Date: Thu, 22 Aug 2019 09:39:45 +0000 X-Mailer: MailMate (2.0BETAr6137) Message-ID: In-Reply-To: <201908220002.x7M028Jh070116@repo.freebsd.org> References: <201908220002.x7M028Jh070116@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 09:39:50 -0000 On 22 Aug 2019, at 0:02, John Baldwin wrote: Hi, > Author: jhb > Date: Thu Aug 22 00:02:08 2019 > New Revision: 351364 > URL: https://svnweb.freebsd.org/changeset/base/351364 > > Log: > Use 'const' for keys and IVs passed to software encryption > algorithms. > > Specifically, use 'const' for the key passed to the 'setkey' method > and 'const' for the 'iv' passed to the 'reinit' method. > > Reviewed by: cem > Sponsored by: Chelsio Communications > Differential Revision: https://reviews.freebsd.org/D21347 can you please review and commit this one to make gcc platforms a bit more happy again (I tested a sparc64 GENERIC kernel build): Reported by: CI system (gcc) Index: sys/opencrypto/xform_des1.c =================================================================== --- sys/opencrypto/xform_des1.c (revision 351384) +++ sys/opencrypto/xform_des1.c (working copy) @@ -99,7 +99,7 @@ des1_setkey(u_int8_t **sched, const u_int8_t *key, p = KMALLOC(sizeof (des_key_schedule), M_CRYPTO_DATA, M_NOWAIT|M_ZERO); if (p != NULL) { - des_set_key((const des_cblock *) key, p[0]); + des_set_key(__DEQUALIFY(const des_cblock *, key), p[0]); err = 0; } else err = ENOMEM; Index: sys/opencrypto/xform_des3.c =================================================================== --- sys/opencrypto/xform_des3.c (revision 351384) +++ sys/opencrypto/xform_des3.c (working copy) @@ -100,9 +100,9 @@ des3_setkey(u_int8_t **sched, const u_int8_t *key, p = KMALLOC(3*sizeof (des_key_schedule), M_CRYPTO_DATA, M_NOWAIT|M_ZERO); if (p != NULL) { - des_set_key((const des_cblock *)(key + 0), p[0]); - des_set_key((const des_cblock *)(key + 8), p[1]); - des_set_key((const des_cblock *)(key + 16), p[2]); + des_set_key(__DEQUALIFY(const des_cblock *,(key + 0)), p[0]); + des_set_key(__DEQUALIFY(const des_cblock *,(key + 8)), p[1]); + des_set_key(__DEQUALIFY(const des_cblock *,(key + 16)), p[2]); err = 0; } else err = ENOMEM; Index: sys/netsmb/smb_crypt.c =================================================================== --- sys/netsmb/smb_crypt.c (revision 351384) +++ sys/netsmb/smb_crypt.c (working copy) @@ -83,7 +83,7 @@ smb_E(const u_char *key, u_char *data, u_char *des kk[6] = key[5] << 2 | (key[6] >> 6 & 0xfe); kk[7] = key[6] << 1; ksp = malloc(sizeof(des_key_schedule), M_SMBTEMP, M_WAITOK); - des_set_key((des_cblock *)kk, *ksp); + des_set_key((const des_cblock *)kk, *ksp); des_ecb_encrypt((des_cblock *)data, (des_cblock *)dest, *ksp, 1); free(ksp, M_SMBTEMP); } Index: sys/kgssapi/krb5/kcrypto_des.c =================================================================== --- sys/kgssapi/krb5/kcrypto_des.c (revision 351384) +++ sys/kgssapi/krb5/kcrypto_des.c (working copy) @@ -136,7 +136,7 @@ des1_random_to_key(struct krb5_key_state *ks, cons | ((inkey[5] & 1) << 6) | ((inkey[6] & 1) << 7)); des_set_odd_parity((des_cblock *) outkey); - if (des_is_weak_key((des_cblock *) outkey)) + if (des_is_weak_key((const des_cblock *) outkey)) outkey[7] ^= 0xf0; des1_set_key(ks, ks->ks_key); Index: sys/kgssapi/krb5/kcrypto_des3.c =================================================================== --- sys/kgssapi/krb5/kcrypto_des3.c (revision 351384) +++ sys/kgssapi/krb5/kcrypto_des3.c (working copy) @@ -145,7 +145,7 @@ des3_random_to_key(struct krb5_key_state *ks, cons | ((inkey[5] & 1) << 6) | ((inkey[6] & 1) << 7)); des_set_odd_parity((des_cblock *) outkey); - if (des_is_weak_key((des_cblock *) outkey)) + if (des_is_weak_key((const des_cblock *) outkey)) outkey[7] ^= 0xf0; } From owner-svn-src-head@freebsd.org Thu Aug 22 10:21:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD6D7C4414; Thu, 22 Aug 2019 10:21:07 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DgXz57BGz4JBb; Thu, 22 Aug 2019 10:21:07 +0000 (UTC) (envelope-from brooks@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91BD12962; Thu, 22 Aug 2019 10:21:07 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7MAL747032378; Thu, 22 Aug 2019 10:21:07 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MAL7O2032377; Thu, 22 Aug 2019 10:21:07 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201908221021.x7MAL7O2032377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 22 Aug 2019 10:21:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351389 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351389 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 10:21:07 -0000 Author: brooks Date: Thu Aug 22 10:21:07 2019 New Revision: 351389 URL: https://svnweb.freebsd.org/changeset/base/351389 Log: Reorganise conditionals to reduce duplication. No functional change. Obtained from: CheriBSD MFC after: 3 days Sponsored by: DARPA, AFRL Modified: head/sys/kern/makesyscalls.sh Modified: head/sys/kern/makesyscalls.sh ============================================================================== --- head/sys/kern/makesyscalls.sh Thu Aug 22 09:24:43 2019 (r351388) +++ head/sys/kern/makesyscalls.sh Thu Aug 22 10:21:07 2019 (r351389) @@ -512,20 +512,20 @@ sed -e ' } printf("\t\t*n_args = %d;\n\t\tbreak;\n\t}\n", argc) > systrace printf("\t\tbreak;\n") > systracetmp - if (argc != 0 && !flag("NOARGS") && !flag("NOPROTO") && \ - !flag("NODEF")) { - printf("struct %s {\n", argalias) > sysarg - for (i = 1; i <= argc; i++) - printf("\tchar %s_l_[PADL_(%s)]; " \ - "%s %s; char %s_r_[PADR_(%s)];\n", - argname[i], argtype[i], - argtype[i], argname[i], - argname[i], argtype[i]) > sysarg - printf("};\n") > sysarg + if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF")) { + if (argc != 0) { + printf("struct %s {\n", argalias) > sysarg + for (i = 1; i <= argc; i++) + printf("\tchar %s_l_[PADL_(%s)]; " \ + "%s %s; char %s_r_[PADR_(%s)];\n", + argname[i], argtype[i], + argtype[i], argname[i], + argname[i], argtype[i]) > sysarg + printf("};\n") > sysarg + } else + printf("struct %s {\n\tregister_t dummy;\n};\n", + argalias) > sysarg } - else if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF")) - printf("struct %s {\n\tregister_t dummy;\n};\n", - argalias) > sysarg if (!flag("NOPROTO") && !flag("NODEF")) { if (funcname == "nosys" || funcname == "lkmnosys" || funcname == "sysarch" || funcname ~ /^freebsd/ || From owner-svn-src-head@freebsd.org Thu Aug 22 12:08:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1794C7941; Thu, 22 Aug 2019 12:08:36 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Djx04khCz4PHG; Thu, 22 Aug 2019 12:08:36 +0000 (UTC) (envelope-from lwhsu@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 843AD3E3B; Thu, 22 Aug 2019 12:08:36 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7MC8aNS097281; Thu, 22 Aug 2019 12:08:36 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MC8aFp097280; Thu, 22 Aug 2019 12:08:36 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201908221208.x7MC8aFp097280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 22 Aug 2019 12:08:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351391 - head/tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/tests/sys/netpfil/pf X-SVN-Commit-Revision: 351391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 12:08:36 -0000 Author: lwhsu Date: Thu Aug 22 12:08:35 2019 New Revision: 351391 URL: https://svnweb.freebsd.org/changeset/base/351391 Log: Fix path issues after r351212 This fixes sys.netpfil.pf.forward.v4 and sys.netpfil.pf.icmp.cve_2019_5598 failures in CI system. Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/netpfil/pf/forward.sh head/tests/sys/netpfil/pf/icmp.sh Modified: head/tests/sys/netpfil/pf/forward.sh ============================================================================== --- head/tests/sys/netpfil/pf/forward.sh Thu Aug 22 11:32:03 2019 (r351390) +++ head/tests/sys/netpfil/pf/forward.sh Thu Aug 22 12:08:35 2019 (r351391) @@ -36,7 +36,7 @@ v4_body() route add -net 198.51.100.0/24 192.0.2.2 # Sanity check, can we forward ICMP echo requests without pf? - atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \ + atf_check -s exit:0 ${common_dir}/pft_ping.py \ --sendif ${epair_send}a \ --to 198.51.100.3 \ --recvif ${epair_recv}a Modified: head/tests/sys/netpfil/pf/icmp.sh ============================================================================== --- head/tests/sys/netpfil/pf/icmp.sh Thu Aug 22 11:32:03 2019 (r351390) +++ head/tests/sys/netpfil/pf/icmp.sh Thu Aug 22 12:08:35 2019 (r351391) @@ -2,6 +2,8 @@ . $(atf_get_srcdir)/utils.subr +common_dir=$(atf_get_srcdir)/../common + atf_test_case "cve_2019_5598" "cleanup" cve_2019_5598_head() { @@ -32,7 +34,8 @@ cve_2019_5598_body() "pass in proto udp to 198.51.100.3 port 53" \ "pass out proto udp to 198.51.100.3 port 53" - atf_check -s exit:0 $(atf_get_srcdir)/CVE-2019-5598.py \ + atf_check -s exit:0 env PYTHONPATH=${common_dir} \ + $(atf_get_srcdir)/CVE-2019-5598.py \ --sendif ${epair_in}a \ --recvif ${epair_out}a \ --src 192.0.2.1 \ From owner-svn-src-head@freebsd.org Thu Aug 22 15:00:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3893CABFA; Thu, 22 Aug 2019 15:00:36 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DnlS6B13z4XW4; Thu, 22 Aug 2019 15:00:36 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF7F15D2B; Thu, 22 Aug 2019 15:00:36 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7MF0aOw097760; Thu, 22 Aug 2019 15:00:36 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MF0aHT097758; Thu, 22 Aug 2019 15:00:36 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908221500.x7MF0aHT097758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 22 Aug 2019 15:00:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351393 - head/sbin/ping/tests X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/ping/tests X-SVN-Commit-Revision: 351393 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 15:00:37 -0000 Author: asomers Date: Thu Aug 22 15:00:36 2019 New Revision: 351393 URL: https://svnweb.freebsd.org/changeset/base/351393 Log: ping: add a basic functional test Submitted by: Ján Sučan MFC after: 2 weeks Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21289 Added: head/sbin/ping/tests/ping_c1_s56_t1.out (contents, props changed) head/sbin/ping/tests/ping_test.sh (contents, props changed) Modified: head/sbin/ping/tests/Makefile Modified: head/sbin/ping/tests/Makefile ============================================================================== --- head/sbin/ping/tests/Makefile Thu Aug 22 12:09:34 2019 (r351392) +++ head/sbin/ping/tests/Makefile Thu Aug 22 15:00:36 2019 (r351393) @@ -5,4 +5,9 @@ WARNS?= 6 ATF_TESTS_C+= in_cksum_test SRCS.in_cksum_test= in_cksum_test.c ../utils.c +PACKAGE= tests + +ATF_TESTS_SH+= ping_test +${PACKAGE}FILES+= ping_c1_s56_t1.out + .include Added: head/sbin/ping/tests/ping_c1_s56_t1.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ping/tests/ping_c1_s56_t1.out Thu Aug 22 15:00:36 2019 (r351393) @@ -0,0 +1,6 @@ +PING localhost: 56 data bytes +64 bytes from localhost: icmp_seq=0 ttl= time= ms + +--- localhost ping statistics --- +1 packets transmitted, 1 packets received, 0.0% packet loss +round-trip min/avg/max/stddev = /// ms Added: head/sbin/ping/tests/ping_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ping/tests/ping_test.sh Thu Aug 22 15:00:36 2019 (r351393) @@ -0,0 +1,55 @@ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (C) 2019 Jan Sucan +# 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$ + +atf_test_case ping_c1_s56_t1 +ping_c1_s56_t1_head() { + atf_set "descr" "Stop after receiving 1 ECHO_RESPONSE packet" +} +ping_c1_s56_t1_body() { + if ! getaddrinfo -f inet localhost 1>/dev/null 2>&1; then + atf_skip "IPv4 is not configured" + fi + atf_check -s exit:0 -o save:std.out -e empty \ + ping -c 1 -s 56 -t 1 localhost + check_ping_statistics std.out $(atf_get_srcdir)/ping_c1_s56_t1.out +} + +atf_init_test_cases() { + atf_add_test_case ping_c1_s56_t1 +} + +check_ping_statistics() { + sed -e 's/0.[0-9]\{3\}//g' \ + -e 's/[1-9][0-9]*.[0-9]\{3\}//g' \ + -e 's/localhost ([0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{1,3\})/localhost/' \ + -e 's/from [0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{1,3\}/from/' \ + -e 's/ttl=[0-9][0-9]*/ttl=/' \ + "$1" >"$1".filtered + atf_check -s exit:0 diff -u "$1".filtered "$2" +} From owner-svn-src-head@freebsd.org Thu Aug 22 15:08:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12355CB005; Thu, 22 Aug 2019 15:08:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Dnw56lscz4YDx; Thu, 22 Aug 2019 15:08:05 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9AED5EE5; Thu, 22 Aug 2019 15:08:05 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7MF85cQ003713; Thu, 22 Aug 2019 15:08:05 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MF84bg003709; Thu, 22 Aug 2019 15:08:04 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908221508.x7MF84bg003709@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 22 Aug 2019 15:08:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351394 - in head: etc/mtree sbin/ping6 sbin/ping6/tests X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: etc/mtree sbin/ping6 sbin/ping6/tests X-SVN-Commit-Revision: 351394 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 15:08:06 -0000 Author: asomers Date: Thu Aug 22 15:08:04 2019 New Revision: 351394 URL: https://svnweb.freebsd.org/changeset/base/351394 Log: ping6: add a basic functional test Submitted by: Ján Sučan MFC after: 2 weeks Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21292 Added: head/sbin/ping6/tests/ head/sbin/ping6/tests/Makefile (contents, props changed) head/sbin/ping6/tests/ping6_c1_s8_X1.out (contents, props changed) head/sbin/ping6/tests/ping6_test.sh (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/sbin/ping6/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Aug 22 15:00:36 2019 (r351393) +++ head/etc/mtree/BSD.tests.dist Thu Aug 22 15:08:04 2019 (r351394) @@ -442,6 +442,8 @@ .. ping .. + ping6 + .. .. secure lib Modified: head/sbin/ping6/Makefile ============================================================================== --- head/sbin/ping6/Makefile Thu Aug 22 15:00:36 2019 (r351393) +++ head/sbin/ping6/Makefile Thu Aug 22 15:08:04 2019 (r351394) @@ -21,4 +21,7 @@ LIBADD+= cap_dns CFLAGS+=-DWITH_CASPER .endif +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include Added: head/sbin/ping6/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ping6/tests/Makefile Thu Aug 22 15:08:04 2019 (r351394) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +PACKAGE= tests + +ATF_TESTS_SH+= ping6_test +${PACKAGE}FILES+= ping6_c1_s8_X1.out + +.include Added: head/sbin/ping6/tests/ping6_c1_s8_X1.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ping6/tests/ping6_c1_s8_X1.out Thu Aug 22 15:08:04 2019 (r351394) @@ -0,0 +1,6 @@ +PING6(56=40+8+8 bytes) ::1 --> ::1 +16 bytes from ::1, icmp_seq=0 hlim= time= ms + +--- localhost ping6 statistics --- +1 packets transmitted, 1 packets received, 0.0% packet loss +round-trip min/avg/max/std-dev = /// ms Added: head/sbin/ping6/tests/ping6_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ping6/tests/ping6_test.sh Thu Aug 22 15:08:04 2019 (r351394) @@ -0,0 +1,53 @@ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (C) 2019 Jan Sucan +# 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$ + +atf_test_case ping6_c1_s8_X1 +ping6_c1_s8_X1_head() { + atf_set "descr" "Stop after receiving 1 ECHO_RESPONSE packet" +} +ping6_c1_s8_X1_body() { + if ! getaddrinfo -f inet6 localhost 1>/dev/null 2>&1; then + atf_skip "IPv6 is not configured" + fi + atf_check -s exit:0 -o save:std.out -e empty \ + ping6 -c 1 -s 8 -X 1 localhost + check_ping_statistics std.out $(atf_get_srcdir)/ping6_c1_s8_X1.out +} + +atf_init_test_cases() { + atf_add_test_case ping6_c1_s8_X1 +} + +check_ping_statistics() { + sed -e 's/0.[0-9]\{3\}//g' \ + -e 's/[1-9][0-9]*.[0-9]\{3\}//g' \ + -e 's/hlim=[0-9][0-9]*/hlim=/' \ + "$1" >"$1".filtered + atf_check -s exit:0 diff -u "$1".filtered "$2" +} From owner-svn-src-head@freebsd.org Thu Aug 22 16:06:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3597FCBDD8; Thu, 22 Aug 2019 16:06:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DqCx0Ph4z4bR6; Thu, 22 Aug 2019 16:06:53 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04A4B69B6; Thu, 22 Aug 2019 16:06: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 x7MG6qgh039057; Thu, 22 Aug 2019 16:06:52 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MG6qcQ039056; Thu, 22 Aug 2019 16:06:52 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908221606.x7MG6qcQ039056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Aug 2019 16:06:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351395 - head/sys/fs/msdosfs X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/fs/msdosfs X-SVN-Commit-Revision: 351395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 16:06:53 -0000 Author: emaste Date: Thu Aug 22 16:06:52 2019 New Revision: 351395 URL: https://svnweb.freebsd.org/changeset/base/351395 Log: msdosfs_fat: reduce diffs with NetBSD and makefs Use pointer arithmetic (as now done in makefs, and in NetBSD) instead of taking the address of array element. No functional change, but this makes it easier to compare different versions of this file. Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21365 Modified: head/sys/fs/msdosfs/msdosfs_fat.c Modified: head/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_fat.c Thu Aug 22 15:08:04 2019 (r351394) +++ head/sys/fs/msdosfs/msdosfs_fat.c Thu Aug 22 16:06:52 2019 (r351395) @@ -214,9 +214,9 @@ pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp return (EIO); } if (FAT32(pmp)) - cn = getulong(&bp->b_data[bo]); + cn = getulong(bp->b_data + bo); else - cn = getushort(&bp->b_data[bo]); + cn = getushort(bp->b_data + bo); if (FAT12(pmp) && (prevcn & 1)) cn >>= 4; cn &= pmp->pm_fatmask; @@ -510,9 +510,9 @@ fatentry(int function, struct msdosfsmount *pmp, u_lon if (function & FAT_GET) { if (FAT32(pmp)) - readcn = getulong(&bp->b_data[bo]); + readcn = getulong(bp->b_data + bo); else - readcn = getushort(&bp->b_data[bo]); + readcn = getushort(bp->b_data + bo); if (FAT12(pmp) & (cn & 1)) readcn >>= 4; readcn &= pmp->pm_fatmask; @@ -524,7 +524,7 @@ fatentry(int function, struct msdosfsmount *pmp, u_lon if (function & FAT_SET) { switch (pmp->pm_fatmask) { case FAT12_MASK: - readcn = getushort(&bp->b_data[bo]); + readcn = getushort(bp->b_data + bo); if (cn & 1) { readcn &= 0x000f; readcn |= newcontents << 4; @@ -532,20 +532,20 @@ fatentry(int function, struct msdosfsmount *pmp, u_lon readcn &= 0xf000; readcn |= newcontents & 0xfff; } - putushort(&bp->b_data[bo], readcn); + putushort(bp->b_data + bo, readcn); break; case FAT16_MASK: - putushort(&bp->b_data[bo], newcontents); + putushort(bp->b_data + bo, newcontents); break; case FAT32_MASK: /* * According to spec we have to retain the * high order bits of the FAT entry. */ - readcn = getulong(&bp->b_data[bo]); + readcn = getulong(bp->b_data + bo); readcn &= ~FAT32_MASK; readcn |= newcontents & FAT32_MASK; - putulong(&bp->b_data[bo], readcn); + putulong(bp->b_data + bo, readcn); break; } updatefats(pmp, bp, bn); @@ -595,7 +595,7 @@ fatchain(struct msdosfsmount *pmp, u_long start, u_lon newc = --count > 0 ? start : fillwith; switch (pmp->pm_fatmask) { case FAT12_MASK: - readcn = getushort(&bp->b_data[bo]); + readcn = getushort(bp->b_data + bo); if (start & 1) { readcn &= 0xf000; readcn |= newc & 0xfff; @@ -603,20 +603,20 @@ fatchain(struct msdosfsmount *pmp, u_long start, u_lon readcn &= 0x000f; readcn |= newc << 4; } - putushort(&bp->b_data[bo], readcn); + putushort(bp->b_data + bo, readcn); bo++; if (!(start & 1)) bo++; break; case FAT16_MASK: - putushort(&bp->b_data[bo], newc); + putushort(bp->b_data + bo, newc); bo += 2; break; case FAT32_MASK: - readcn = getulong(&bp->b_data[bo]); + readcn = getulong(bp->b_data + bo); readcn &= ~pmp->pm_fatmask; readcn |= newc & pmp->pm_fatmask; - putulong(&bp->b_data[bo], readcn); + putulong(bp->b_data + bo, readcn); bo += 4; break; } @@ -852,7 +852,7 @@ freeclusterchain(struct msdosfsmount *pmp, u_long clus usemap_free(pmp, cluster); switch (pmp->pm_fatmask) { case FAT12_MASK: - readcn = getushort(&bp->b_data[bo]); + readcn = getushort(bp->b_data + bo); if (cluster & 1) { cluster = readcn >> 4; readcn &= 0x000f; @@ -862,15 +862,15 @@ freeclusterchain(struct msdosfsmount *pmp, u_long clus readcn &= 0xf000; readcn |= MSDOSFSFREE & 0xfff; } - putushort(&bp->b_data[bo], readcn); + putushort(bp->b_data + bo, readcn); break; case FAT16_MASK: - cluster = getushort(&bp->b_data[bo]); - putushort(&bp->b_data[bo], MSDOSFSFREE); + cluster = getushort(bp->b_data + bo); + putushort(bp->b_data + bo, MSDOSFSFREE); break; case FAT32_MASK: - cluster = getulong(&bp->b_data[bo]); - putulong(&bp->b_data[bo], + cluster = getulong(bp->b_data + bo); + putulong(bp->b_data + bo, (MSDOSFSFREE & FAT32_MASK) | (cluster & ~FAT32_MASK)); break; } @@ -924,9 +924,9 @@ fillinusemap(struct msdosfsmount *pmp) return (error); } if (FAT32(pmp)) - readcn = getulong(&bp->b_data[bo]); + readcn = getulong(bp->b_data + bo); else - readcn = getushort(&bp->b_data[bo]); + readcn = getushort(bp->b_data + bo); if (FAT12(pmp) && (cn & 1)) readcn >>= 4; readcn &= pmp->pm_fatmask; From owner-svn-src-head@freebsd.org Thu Aug 22 16:41:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CACF8CCC3E; Thu, 22 Aug 2019 16:41:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Dqzh53B7z4cx6; Thu, 22 Aug 2019 16:41:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id EBD10107D6; Thu, 22 Aug 2019 16:41:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r351368 - head/sys/gdb To: Conrad Meyer , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201908220034.x7M0YBOw088032@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <718d767b-7bb3-8e10-f9b5-b696642ad24b@FreeBSD.org> Date: Thu, 22 Aug 2019 09:41:18 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: <201908220034.x7M0YBOw088032@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 16:41:20 -0000 On 8/21/19 5:34 PM, Conrad Meyer wrote: > Author: cem > Date: Thu Aug 22 00:34:11 2019 > New Revision: 351368 > URL: https://svnweb.freebsd.org/changeset/base/351368 > > Log: > gdb(4): Implement qXfer:threads:read > > This streams out an XML document over several GDB packets describing all > threads in the system; their ids, name, and any loosely defined "extra info" > we feel like including. For now, I have included a string version of the run > state, similar to some of the DDB logic to stringify thread state. > > The benefit of supporting this in addition to the qfThreadInfo/qsThreadInfo > packing is that in this mode, the host gdb does not ask for every thread's > "qThreadExtraInfo," saving per-thread round-trips on "info threads." > > To use this feature, (k)gdb needs to be built with the --with-expat option. > I would encourage enabling this option by default in our GDB port, if it is > not already. FYI, it is as the 'catch syscall' bits also depend on this. -- John Baldwin From owner-svn-src-head@freebsd.org Thu Aug 22 16:46:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDB54CCDCB; Thu, 22 Aug 2019 16:46:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Dr5m3Qv9z4dLD; Thu, 22 Aug 2019 16:46:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id CE3BF108FE; Thu, 22 Aug 2019 16:46:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r351364 - in head/sys: crypto/blowfish crypto/chacha20 crypto/des opencrypto To: "Bjoern A. Zeeb" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201908220002.x7M028Jh070116@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <0b9d1aa1-d328-30bc-b939-f1407e236855@FreeBSD.org> Date: Thu, 22 Aug 2019 09:46:33 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 16:46:36 -0000 On 8/22/19 2:39 AM, Bjoern A. Zeeb wrote: > On 22 Aug 2019, at 0:02, John Baldwin wrote: > > Hi, > >> Author: jhb >> Date: Thu Aug 22 00:02:08 2019 >> New Revision: 351364 >> URL: https://svnweb.freebsd.org/changeset/base/351364 >> >> Log: >> Use 'const' for keys and IVs passed to software encryption >> algorithms. >> >> Specifically, use 'const' for the key passed to the 'setkey' method >> and 'const' for the 'iv' passed to the 'reinit' method. >> >> Reviewed by: cem >> Sponsored by: Chelsio Communications >> Differential Revision: https://reviews.freebsd.org/D21347 > > can you please review and commit this one to make gcc platforms a bit > more happy again (I tested a sparc64 GENERIC kernel build): I will get tinderbox happy. > Index: sys/opencrypto/xform_des3.c > =================================================================== > --- sys/opencrypto/xform_des3.c (revision 351384) > +++ sys/opencrypto/xform_des3.c (working copy) > @@ -100,9 +100,9 @@ des3_setkey(u_int8_t **sched, const u_int8_t *key, > p = KMALLOC(3*sizeof (des_key_schedule), > M_CRYPTO_DATA, M_NOWAIT|M_ZERO); > if (p != NULL) { > - des_set_key((const des_cblock *)(key + 0), p[0]); > - des_set_key((const des_cblock *)(key + 8), p[1]); > - des_set_key((const des_cblock *)(key + 16), p[2]); > + des_set_key(__DEQUALIFY(const des_cblock *,(key + 0)), p[0]); > + des_set_key(__DEQUALIFY(const des_cblock *,(key + 8)), p[1]); > + des_set_key(__DEQUALIFY(const des_cblock *,(key + 16)), p[2]); This makes no sense. Why are you removing const only to add it back again? -- John Baldwin From owner-svn-src-head@freebsd.org Thu Aug 22 17:49:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 133D0CE0D0; Thu, 22 Aug 2019 17:49:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DsVS6kYpz3Dch; Thu, 22 Aug 2019 17:49:36 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C86E77BB0; Thu, 22 Aug 2019 17:49:36 +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 x7MHnaMH099310; Thu, 22 Aug 2019 17:49:36 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MHnZfP099302; Thu, 22 Aug 2019 17:49:35 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908221749.x7MHnZfP099302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Aug 2019 17:49:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351396 - head/usr.sbin/makefs/msdos X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/makefs/msdos X-SVN-Commit-Revision: 351396 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 17:49:37 -0000 Author: emaste Date: Thu Aug 22 17:49:34 2019 New Revision: 351396 URL: https://svnweb.freebsd.org/changeset/base/351396 Log: makefs: diff reduction to sys/fs/msdosfs No functional change. Modified: head/usr.sbin/makefs/msdos/direntry.h head/usr.sbin/makefs/msdos/msdosfs_conv.c head/usr.sbin/makefs/msdos/msdosfs_denode.c head/usr.sbin/makefs/msdos/msdosfs_fat.c head/usr.sbin/makefs/msdos/msdosfs_lookup.c head/usr.sbin/makefs/msdos/msdosfs_vfsops.c head/usr.sbin/makefs/msdos/msdosfs_vnops.c head/usr.sbin/makefs/msdos/msdosfsmount.h Modified: head/usr.sbin/makefs/msdos/direntry.h ============================================================================== --- head/usr.sbin/makefs/msdos/direntry.h Thu Aug 22 16:06:52 2019 (r351395) +++ head/usr.sbin/makefs/msdos/direntry.h Thu Aug 22 17:49:34 2019 (r351396) @@ -135,12 +135,12 @@ struct winentry { #define DD_YEAR_MASK 0xFE00 /* year - 1980 */ #define DD_YEAR_SHIFT 9 -uint8_t winChksum(uint8_t *name); -int winSlotCnt(const u_char *un, size_t unlen); -int unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen); -int winChkName(const u_char *un, size_t unlen, struct winentry *wep, - int chksum); -int unix2winfn(const u_char *un, size_t unlen, struct winentry *wep, int cnt, - int chksum); +int unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen); +int unix2winfn(const u_char *un, size_t unlen, struct winentry *wep, int cnt, + int chksum); +int winChkName(const u_char *un, size_t unlen, struct winentry *wep, + int chksum); +uint8_t winChksum(uint8_t *name); +int winSlotCnt(const u_char *un, size_t unlen); #endif /* !_FS_MSDOSFS_DIRENTRY_H_ */ Modified: head/usr.sbin/makefs/msdos/msdosfs_conv.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_conv.c Thu Aug 22 16:06:52 2019 (r351395) +++ head/usr.sbin/makefs/msdos/msdosfs_conv.c Thu Aug 22 17:49:34 2019 (r351396) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. * Copyright (C) 1994, 1995, 1997 TooLs GmbH. * All rights reserved. @@ -29,7 +31,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Written by Paul Popelka (paulp@uts.amdahl.com) * * You can do anything you want with this software, just don't say you wrote Modified: head/usr.sbin/makefs/msdos/msdosfs_denode.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_denode.c Thu Aug 22 16:06:52 2019 (r351395) +++ head/usr.sbin/makefs/msdos/msdosfs_denode.c Thu Aug 22 17:49:34 2019 (r351396) @@ -1,6 +1,8 @@ /* $NetBSD: msdosfs_denode.c,v 1.7 2015/03/29 05:52:59 agc Exp $ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. * Copyright (C) 1994, 1995, 1997 TooLs GmbH. * All rights reserved. @@ -31,7 +33,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Written by Paul Popelka (paulp@uts.amdahl.com) * * You can do anything you want with this software, just don't say you wrote @@ -261,7 +263,7 @@ detrunc(struct denode *dep, u_long length, int flags, if (error) { MSDOSFS_DPRINTF(("detrunc(): pcbmap fails %d\n", error)); - return error; + return (error); } } @@ -282,10 +284,9 @@ detrunc(struct denode *dep, u_long length, int flags, MSDOSFS_DPRINTF(("detrunc(): bread fails %d\n", error)); - return error; + return (error); } - memset((char *)bp->b_data + boff, 0, - pmp->pm_bpcluster - boff); + memset(bp->b_data + boff, 0, pmp->pm_bpcluster - boff); if (flags & IO_SYNC) bwrite(bp); else @@ -326,7 +327,7 @@ detrunc(struct denode *dep, u_long length, int flags, if (chaintofree != 0 && !MSDOSFSEOF(pmp, chaintofree)) freeclusterchain(pmp, chaintofree); - return allerror; + return (allerror); } /* @@ -343,16 +344,16 @@ deextend(struct denode *dep, u_long length, struct ucr * The root of a DOS filesystem cannot be extended. */ if (dep->de_vnode != NULL && !FAT32(pmp)) - return EINVAL; + return (EINVAL); /* * Directories cannot be extended. */ if (dep->de_Attributes & ATTR_DIRECTORY) - return EISDIR; + return (EISDIR); if (length <= dep->de_FileSize) - return E2BIG; + return (E2BIG); /* * Compute the number of clusters to allocate. Modified: head/usr.sbin/makefs/msdos/msdosfs_fat.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_fat.c Thu Aug 22 16:06:52 2019 (r351395) +++ head/usr.sbin/makefs/msdos/msdosfs_fat.c Thu Aug 22 17:49:34 2019 (r351396) @@ -870,9 +870,11 @@ freeclusterchain(struct msdosfsmount *pmp, u_long clus int fillinusemap(struct msdosfsmount *pmp) { - struct buf *bp = NULL; + struct buf *bp; u_long bn, bo, bsize, byteoffset, cn, readcn; int error; + + bp = NULL; /* * Mark all clusters in use, we mark the free ones in the FAT scan Modified: head/usr.sbin/makefs/msdos/msdosfs_lookup.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_lookup.c Thu Aug 22 16:06:52 2019 (r351395) +++ head/usr.sbin/makefs/msdos/msdosfs_lookup.c Thu Aug 22 17:49:34 2019 (r351396) @@ -276,7 +276,7 @@ uniqdosname(struct denode *dep, struct componentname * return error; } for (dentp = (struct direntry *)bp->b_data; - (char *)dentp < (char *)bp->b_data + blsize; + (char *)dentp < bp->b_data + blsize; dentp++) { if (dentp->deName[0] == SLOT_EMPTY) { /* Modified: head/usr.sbin/makefs/msdos/msdosfs_vfsops.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_vfsops.c Thu Aug 22 16:06:52 2019 (r351395) +++ head/usr.sbin/makefs/msdos/msdosfs_vfsops.c Thu Aug 22 17:49:34 2019 (r351396) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. * Copyright (C) 1994, 1995, 1997 TooLs GmbH. * All rights reserved. @@ -29,7 +31,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Written by Paul Popelka (paulp@uts.amdahl.com) * * You can do anything you want with this software, just don't say you wrote Modified: head/usr.sbin/makefs/msdos/msdosfs_vnops.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_vnops.c Thu Aug 22 16:06:52 2019 (r351395) +++ head/usr.sbin/makefs/msdos/msdosfs_vnops.c Thu Aug 22 17:49:34 2019 (r351396) @@ -1,6 +1,8 @@ /* $NetBSD: msdosfs_vnops.c,v 1.19 2017/04/13 17:10:12 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. * Copyright (C) 1994, 1995, 1997 TooLs GmbH. * All rights reserved. @@ -31,7 +33,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Written by Paul Popelka (paulp@uts.amdahl.com) * * You can do anything you want with this software, just don't say you wrote @@ -217,7 +219,7 @@ msdosfs_findslot(struct denode *dp, struct componentna for (blkoff = 0; blkoff < blsize; blkoff += sizeof(struct direntry), diroff += sizeof(struct direntry)) { - dep = (struct direntry *)((char *)bp->b_data + blkoff); + dep = (struct direntry *)(bp->b_data + blkoff); /* * If the slot is empty and we are still looking * for an empty then remember this one. If the @@ -493,7 +495,7 @@ msdosfs_wfile(const char *path, struct denode *dep, fs goto out; } cpsize = MIN((nsize - offs), blsize - on); - memcpy((char *)bp->b_data + on, dat + offs, cpsize); + memcpy(bp->b_data + on, dat + offs, cpsize); bwrite(bp); offs += cpsize; } Modified: head/usr.sbin/makefs/msdos/msdosfsmount.h ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfsmount.h Thu Aug 22 16:06:52 2019 (r351395) +++ head/usr.sbin/makefs/msdos/msdosfsmount.h Thu Aug 22 17:49:34 2019 (r351396) @@ -51,7 +51,7 @@ */ #ifndef _MSDOSFS_MSDOSFSMOUNT_H_ -#define _MSDOSFS_MSDOSFSMOUNT_H_ +#define _MSDOSFS_MSDOSFSMOUNT_H_ #include From owner-svn-src-head@freebsd.org Thu Aug 22 18:52:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4FF0CF00B; Thu, 22 Aug 2019 18:52:33 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Dtv55WM9z3HBH; Thu, 22 Aug 2019 18:52:33 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86B28883C; Thu, 22 Aug 2019 18:52:33 +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 x7MIqXgN040101; Thu, 22 Aug 2019 18:52:33 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MIqVba040089; Thu, 22 Aug 2019 18:52:31 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908221852.x7MIqVba040089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 22 Aug 2019 18:52:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351397 - in head/contrib/wpa: hostapd hs20/client src/ap src/common src/crypto src/drivers src/eap_common src/eap_peer src/eap_server src/eapol_auth src/eapol_supp src/p2p src/pae src/... X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in head/contrib/wpa: hostapd hs20/client src/ap src/common src/crypto src/drivers src/eap_common src/eap_peer src/eap_server src/eapol_auth src/eapol_supp src/p2p src/pae src/radius src/rsn_supp src/t... X-SVN-Commit-Revision: 351397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 18:52:33 -0000 Author: cy Date: Thu Aug 22 18:52:30 2019 New Revision: 351397 URL: https://svnweb.freebsd.org/changeset/base/351397 Log: MFV r346563: Update wpa 2.8 --> 2.9 hostapd: * SAE changes - disable use of groups using Brainpool curves - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * EAP-pwd changes - disable use of groups using Brainpool curves - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * fixed FT-EAP initial mobility domain association using PMKSA caching * added configuration of airtime policy * fixed FILS to and RSNE into (Re)Association Response frames * fixed DPP bootstrapping URI parser of channel list * added support for regulatory WMM limitation (for ETSI) * added support for MACsec Key Agreement using IEEE 802.1X/PSK * added experimental support for EAP-TEAP server (RFC 7170) * added experimental support for EAP-TLS server with TLS v1.3 * added support for two server certificates/keys (RSA/ECC) * added AKMSuiteSelector into "STA " control interface data to determine with AKM was used for an association * added eap_sim_id parameter to allow EAP-SIM/AKA server pseudonym and fast reauthentication use to be disabled * fixed an ECDH operation corner case with OpenSSL wpa_supplicant: * SAE changes - disable use of groups using Brainpool curves - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * EAP-pwd changes - disable use of groups using Brainpool curves - allow the set of groups to be configured (eap_pwd_groups) - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * fixed FT-EAP initial mobility domain association using PMKSA caching (disabled by default for backwards compatibility; can be enabled with ft_eap_pmksa_caching=1) * fixed a regression in OpenSSL 1.1+ engine loading * added validation of RSNE in (Re)Association Response frames * fixed DPP bootstrapping URI parser of channel list * extended EAP-SIM/AKA fast re-authentication to allow use with FILS * extended ca_cert_blob to support PEM format * improved robustness of P2P Action frame scheduling * added support for EAP-SIM/AKA using anonymous@realm identity * fixed Hotspot 2.0 credential selection based on roaming consortium to ignore credentials without a specific EAP method * added experimental support for EAP-TEAP peer (RFC 7170) * added experimental support for EAP-TLS peer with TLS v1.3 * fixed a regression in WMM parameter configuration for a TDLS peer * fixed a regression in operation with drivers that offload 802.1X 4-way handshake * fixed an ECDH operation corner case with OpenSSL MFC after: 1 week Security: https://w1.fi/security/2019-6/\ sae-eap-pwd-side-channel-attack-update.txt Added: head/contrib/wpa/src/ap/airtime_policy.c - copied unchanged from r351378, vendor/wpa/dist/src/ap/airtime_policy.c head/contrib/wpa/src/ap/airtime_policy.h - copied unchanged from r351378, vendor/wpa/dist/src/ap/airtime_policy.h head/contrib/wpa/src/ap/wpa_auth_kay.c - copied unchanged from r351378, vendor/wpa/dist/src/ap/wpa_auth_kay.c head/contrib/wpa/src/ap/wpa_auth_kay.h - copied unchanged from r351378, vendor/wpa/dist/src/ap/wpa_auth_kay.h head/contrib/wpa/src/common/dragonfly.c - copied unchanged from r351378, vendor/wpa/dist/src/common/dragonfly.c head/contrib/wpa/src/common/dragonfly.h - copied unchanged from r351378, vendor/wpa/dist/src/common/dragonfly.h head/contrib/wpa/src/drivers/driver_atheros.c - copied unchanged from r351378, vendor/wpa/dist/src/drivers/driver_atheros.c head/contrib/wpa/src/drivers/driver_hostap.c - copied unchanged from r351378, vendor/wpa/dist/src/drivers/driver_hostap.c head/contrib/wpa/src/drivers/nl80211_copy.h - copied unchanged from r351378, vendor/wpa/dist/src/drivers/nl80211_copy.h head/contrib/wpa/src/eap_common/eap_teap_common.c - copied unchanged from r351378, vendor/wpa/dist/src/eap_common/eap_teap_common.c head/contrib/wpa/src/eap_common/eap_teap_common.h - copied unchanged from r351378, vendor/wpa/dist/src/eap_common/eap_teap_common.h head/contrib/wpa/src/eap_peer/eap_teap.c - copied unchanged from r351378, vendor/wpa/dist/src/eap_peer/eap_teap.c head/contrib/wpa/src/eap_peer/eap_teap_pac.c - copied unchanged from r351378, vendor/wpa/dist/src/eap_peer/eap_teap_pac.c head/contrib/wpa/src/eap_peer/eap_teap_pac.h - copied unchanged from r351378, vendor/wpa/dist/src/eap_peer/eap_teap_pac.h head/contrib/wpa/src/eap_server/eap_server_teap.c - copied unchanged from r351378, vendor/wpa/dist/src/eap_server/eap_server_teap.c Modified: head/contrib/wpa/hostapd/ChangeLog head/contrib/wpa/hostapd/config_file.c head/contrib/wpa/hostapd/ctrl_iface.c head/contrib/wpa/hostapd/defconfig head/contrib/wpa/hostapd/eap_register.c head/contrib/wpa/hostapd/hostapd.conf head/contrib/wpa/hostapd/hostapd_cli.c head/contrib/wpa/hostapd/main.c head/contrib/wpa/hs20/client/osu_client.c head/contrib/wpa/src/ap/accounting.c head/contrib/wpa/src/ap/acs.c head/contrib/wpa/src/ap/ap_config.c head/contrib/wpa/src/ap/ap_config.h head/contrib/wpa/src/ap/ap_drv_ops.c head/contrib/wpa/src/ap/ap_drv_ops.h head/contrib/wpa/src/ap/authsrv.c head/contrib/wpa/src/ap/beacon.c head/contrib/wpa/src/ap/ctrl_iface_ap.c head/contrib/wpa/src/ap/dfs.c head/contrib/wpa/src/ap/dpp_hostapd.c head/contrib/wpa/src/ap/dpp_hostapd.h head/contrib/wpa/src/ap/drv_callbacks.c head/contrib/wpa/src/ap/gas_serv.c head/contrib/wpa/src/ap/gas_serv.h head/contrib/wpa/src/ap/hostapd.c head/contrib/wpa/src/ap/hostapd.h head/contrib/wpa/src/ap/hw_features.c head/contrib/wpa/src/ap/ieee802_11.c head/contrib/wpa/src/ap/ieee802_11.h head/contrib/wpa/src/ap/ieee802_11_he.c head/contrib/wpa/src/ap/ieee802_11_vht.c head/contrib/wpa/src/ap/ieee802_1x.c head/contrib/wpa/src/ap/ieee802_1x.h head/contrib/wpa/src/ap/neighbor_db.c head/contrib/wpa/src/ap/sta_info.c head/contrib/wpa/src/ap/sta_info.h head/contrib/wpa/src/ap/wmm.c head/contrib/wpa/src/ap/wpa_auth.c head/contrib/wpa/src/ap/wpa_auth.h head/contrib/wpa/src/ap/wpa_auth_ft.c head/contrib/wpa/src/ap/wpa_auth_glue.c head/contrib/wpa/src/ap/wpa_auth_ie.c head/contrib/wpa/src/common/dpp.c head/contrib/wpa/src/common/dpp.h head/contrib/wpa/src/common/hw_features_common.c head/contrib/wpa/src/common/hw_features_common.h head/contrib/wpa/src/common/ieee802_11_common.c head/contrib/wpa/src/common/ieee802_11_common.h head/contrib/wpa/src/common/ieee802_11_defs.h head/contrib/wpa/src/common/qca-vendor.h head/contrib/wpa/src/common/sae.c head/contrib/wpa/src/common/sae.h head/contrib/wpa/src/common/version.h head/contrib/wpa/src/common/wpa_common.c head/contrib/wpa/src/common/wpa_ctrl.h head/contrib/wpa/src/crypto/aes_i.h head/contrib/wpa/src/crypto/crypto.h head/contrib/wpa/src/crypto/crypto_openssl.c head/contrib/wpa/src/crypto/crypto_wolfssl.c head/contrib/wpa/src/crypto/sha1-internal.c head/contrib/wpa/src/crypto/sha1-prf.c head/contrib/wpa/src/crypto/sha1-tlsprf.c head/contrib/wpa/src/crypto/sha1-tprf.c head/contrib/wpa/src/crypto/sha1.c head/contrib/wpa/src/crypto/sha256-kdf.c head/contrib/wpa/src/crypto/sha256-prf.c head/contrib/wpa/src/crypto/sha256-tlsprf.c head/contrib/wpa/src/crypto/sha256.h head/contrib/wpa/src/crypto/sha384-kdf.c head/contrib/wpa/src/crypto/sha384-prf.c head/contrib/wpa/src/crypto/sha512-kdf.c head/contrib/wpa/src/crypto/sha512-prf.c head/contrib/wpa/src/crypto/tls.h head/contrib/wpa/src/crypto/tls_openssl.c head/contrib/wpa/src/crypto/tls_wolfssl.c head/contrib/wpa/src/drivers/driver.h head/contrib/wpa/src/drivers/driver_bsd.c head/contrib/wpa/src/drivers/driver_common.c head/contrib/wpa/src/drivers/driver_macsec_linux.c head/contrib/wpa/src/drivers/driver_macsec_qca.c head/contrib/wpa/src/drivers/driver_ndis.c head/contrib/wpa/src/drivers/driver_nl80211.h head/contrib/wpa/src/drivers/driver_nl80211_capa.c head/contrib/wpa/src/drivers/driver_nl80211_event.c head/contrib/wpa/src/drivers/driver_privsep.c head/contrib/wpa/src/eap_common/eap_defs.h head/contrib/wpa/src/eap_common/eap_pwd_common.c head/contrib/wpa/src/eap_common/eap_sim_common.c head/contrib/wpa/src/eap_common/eap_sim_common.h head/contrib/wpa/src/eap_peer/eap.c head/contrib/wpa/src/eap_peer/eap.h head/contrib/wpa/src/eap_peer/eap_aka.c head/contrib/wpa/src/eap_peer/eap_config.h head/contrib/wpa/src/eap_peer/eap_eke.c head/contrib/wpa/src/eap_peer/eap_leap.c head/contrib/wpa/src/eap_peer/eap_methods.h head/contrib/wpa/src/eap_peer/eap_peap.c head/contrib/wpa/src/eap_peer/eap_pwd.c head/contrib/wpa/src/eap_peer/eap_sim.c head/contrib/wpa/src/eap_peer/eap_tls.c head/contrib/wpa/src/eap_peer/eap_tls_common.c head/contrib/wpa/src/eap_peer/eap_tls_common.h head/contrib/wpa/src/eap_server/eap.h head/contrib/wpa/src/eap_server/eap_i.h head/contrib/wpa/src/eap_server/eap_methods.h head/contrib/wpa/src/eap_server/eap_server.c head/contrib/wpa/src/eap_server/eap_server_aka.c head/contrib/wpa/src/eap_server/eap_server_pax.c head/contrib/wpa/src/eap_server/eap_server_peap.c head/contrib/wpa/src/eap_server/eap_server_pwd.c head/contrib/wpa/src/eap_server/eap_server_sim.c head/contrib/wpa/src/eap_server/eap_server_tls.c head/contrib/wpa/src/eap_server/eap_server_tls_common.c head/contrib/wpa/src/eap_server/eap_tls_common.h head/contrib/wpa/src/eapol_auth/eapol_auth_sm.c head/contrib/wpa/src/eapol_auth/eapol_auth_sm.h head/contrib/wpa/src/eapol_supp/eapol_supp_sm.c head/contrib/wpa/src/eapol_supp/eapol_supp_sm.h head/contrib/wpa/src/p2p/p2p.c head/contrib/wpa/src/p2p/p2p_go_neg.c head/contrib/wpa/src/p2p/p2p_i.h head/contrib/wpa/src/pae/ieee802_1x_kay.c head/contrib/wpa/src/radius/radius_server.c head/contrib/wpa/src/radius/radius_server.h head/contrib/wpa/src/rsn_supp/wpa.c head/contrib/wpa/src/rsn_supp/wpa.h head/contrib/wpa/src/rsn_supp/wpa_ft.c head/contrib/wpa/src/rsn_supp/wpa_i.h head/contrib/wpa/src/tls/asn1.c head/contrib/wpa/src/tls/libtommath.c head/contrib/wpa/src/tls/x509v3.c head/contrib/wpa/src/utils/common.c head/contrib/wpa/src/utils/common.h head/contrib/wpa/src/utils/trace.c head/contrib/wpa/src/utils/wpa_debug.c head/contrib/wpa/src/wps/wps.h head/contrib/wpa/wpa_supplicant/Android.mk head/contrib/wpa/wpa_supplicant/ChangeLog head/contrib/wpa/wpa_supplicant/README-DPP head/contrib/wpa/wpa_supplicant/ap.c head/contrib/wpa/wpa_supplicant/ap.h head/contrib/wpa/wpa_supplicant/bss.c head/contrib/wpa/wpa_supplicant/config.c head/contrib/wpa/wpa_supplicant/config.h head/contrib/wpa/wpa_supplicant/config_file.c head/contrib/wpa/wpa_supplicant/config_ssid.h head/contrib/wpa/wpa_supplicant/ctrl_iface.c head/contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.c head/contrib/wpa/wpa_supplicant/defconfig head/contrib/wpa/wpa_supplicant/dpp_supplicant.c head/contrib/wpa/wpa_supplicant/dpp_supplicant.h head/contrib/wpa/wpa_supplicant/driver_i.h head/contrib/wpa/wpa_supplicant/eap_register.c head/contrib/wpa/wpa_supplicant/eapol_test.c head/contrib/wpa/wpa_supplicant/events.c head/contrib/wpa/wpa_supplicant/ibss_rsn.c head/contrib/wpa/wpa_supplicant/interworking.c head/contrib/wpa/wpa_supplicant/mesh.c head/contrib/wpa/wpa_supplicant/mesh_mpm.c head/contrib/wpa/wpa_supplicant/notify.c head/contrib/wpa/wpa_supplicant/notify.h head/contrib/wpa/wpa_supplicant/op_classes.c head/contrib/wpa/wpa_supplicant/p2p_supplicant.c head/contrib/wpa/wpa_supplicant/preauth_test.c head/contrib/wpa/wpa_supplicant/rrm.c head/contrib/wpa/wpa_supplicant/sme.c head/contrib/wpa/wpa_supplicant/wnm_sta.c head/contrib/wpa/wpa_supplicant/wpa_cli.c head/contrib/wpa/wpa_supplicant/wpa_supplicant.c head/contrib/wpa/wpa_supplicant/wpa_supplicant.conf head/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h head/contrib/wpa/wpa_supplicant/wpas_glue.c Directory Properties: head/contrib/wpa/ (props changed) Modified: head/contrib/wpa/hostapd/ChangeLog ============================================================================== --- head/contrib/wpa/hostapd/ChangeLog Thu Aug 22 17:49:34 2019 (r351396) +++ head/contrib/wpa/hostapd/ChangeLog Thu Aug 22 18:52:30 2019 (r351397) @@ -1,5 +1,29 @@ ChangeLog for hostapd +2019-08-07 - v2.9 + * SAE changes + - disable use of groups using Brainpool curves + - improved protection against side channel attacks + [https://w1.fi/security/2019-6/] + * EAP-pwd changes + - disable use of groups using Brainpool curves + - improved protection against side channel attacks + [https://w1.fi/security/2019-6/] + * fixed FT-EAP initial mobility domain association using PMKSA caching + * added configuration of airtime policy + * fixed FILS to and RSNE into (Re)Association Response frames + * fixed DPP bootstrapping URI parser of channel list + * added support for regulatory WMM limitation (for ETSI) + * added support for MACsec Key Agreement using IEEE 802.1X/PSK + * added experimental support for EAP-TEAP server (RFC 7170) + * added experimental support for EAP-TLS server with TLS v1.3 + * added support for two server certificates/keys (RSA/ECC) + * added AKMSuiteSelector into "STA " control interface data to + determine with AKM was used for an association + * added eap_sim_id parameter to allow EAP-SIM/AKA server pseudonym and + fast reauthentication use to be disabled + * fixed an ECDH operation corner case with OpenSSL + 2019-04-21 - v2.8 * SAE changes - added support for SAE Password Identifier Modified: head/contrib/wpa/hostapd/config_file.c ============================================================================== --- head/contrib/wpa/hostapd/config_file.c Thu Aug 22 17:49:34 2019 (r351396) +++ head/contrib/wpa/hostapd/config_file.c Thu Aug 22 18:52:30 2019 (r351397) @@ -24,14 +24,6 @@ #include "config_file.h" -#ifndef CONFIG_NO_RADIUS -#ifdef EAP_SERVER -static struct hostapd_radius_attr * -hostapd_parse_radius_attr(const char *value); -#endif /* EAP_SERVER */ -#endif /* CONFIG_NO_RADIUS */ - - #ifndef CONFIG_NO_VLAN static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss, const char *fname) @@ -660,76 +652,7 @@ hostapd_config_read_radius_addr(struct hostapd_radius_ } -static struct hostapd_radius_attr * -hostapd_parse_radius_attr(const char *value) -{ - const char *pos; - char syntax; - struct hostapd_radius_attr *attr; - size_t len; - attr = os_zalloc(sizeof(*attr)); - if (attr == NULL) - return NULL; - - attr->type = atoi(value); - - pos = os_strchr(value, ':'); - if (pos == NULL) { - attr->val = wpabuf_alloc(1); - if (attr->val == NULL) { - os_free(attr); - return NULL; - } - wpabuf_put_u8(attr->val, 0); - return attr; - } - - pos++; - if (pos[0] == '\0' || pos[1] != ':') { - os_free(attr); - return NULL; - } - syntax = *pos++; - pos++; - - switch (syntax) { - case 's': - attr->val = wpabuf_alloc_copy(pos, os_strlen(pos)); - break; - case 'x': - len = os_strlen(pos); - if (len & 1) - break; - len /= 2; - attr->val = wpabuf_alloc(len); - if (attr->val == NULL) - break; - if (hexstr2bin(pos, wpabuf_put(attr->val, len), len) < 0) { - wpabuf_free(attr->val); - os_free(attr); - return NULL; - } - break; - case 'd': - attr->val = wpabuf_alloc(4); - if (attr->val) - wpabuf_put_be32(attr->val, atoi(pos)); - break; - default: - os_free(attr); - return NULL; - } - - if (attr->val == NULL) { - os_free(attr); - return NULL; - } - - return attr; -} - - static int hostapd_parse_das_client(struct hostapd_bss_config *bss, char *val) { char *secret; @@ -2313,6 +2236,42 @@ static unsigned int parse_tls_flags(const char *val) #endif /* EAP_SERVER */ +#ifdef CONFIG_AIRTIME_POLICY +static int add_airtime_weight(struct hostapd_bss_config *bss, char *value) +{ + struct airtime_sta_weight *wt; + char *pos, *next; + + wt = os_zalloc(sizeof(*wt)); + if (!wt) + return -1; + + /* 02:01:02:03:04:05 10 */ + pos = value; + next = os_strchr(pos, ' '); + if (next) + *next++ = '\0'; + if (!next || hwaddr_aton(pos, wt->addr)) { + wpa_printf(MSG_ERROR, "Invalid station address: '%s'", pos); + os_free(wt); + return -1; + } + + pos = next; + wt->weight = atoi(pos); + if (!wt->weight) { + wpa_printf(MSG_ERROR, "Invalid weight: '%s'", pos); + os_free(wt); + return -1; + } + + wt->next = bss->airtime_weight_list; + bss->airtime_weight_list = wt; + return 0; +} +#endif /* CONFIG_AIRTIME_POLICY */ + + #ifdef CONFIG_SAE static int parse_sae_password(struct hostapd_bss_config *bss, const char *val) { @@ -2376,6 +2335,36 @@ fail: #endif /* CONFIG_SAE */ +#ifdef CONFIG_DPP2 +static int hostapd_dpp_controller_parse(struct hostapd_bss_config *bss, + const char *pos) +{ + struct dpp_controller_conf *conf; + char *val; + + conf = os_zalloc(sizeof(*conf)); + if (!conf) + return -1; + val = get_param(pos, "ipaddr="); + if (!val || hostapd_parse_ip_addr(val, &conf->ipaddr)) + goto fail; + os_free(val); + val = get_param(pos, "pkhash="); + if (!val || os_strlen(val) != 2 * SHA256_MAC_LEN || + hexstr2bin(val, conf->pkhash, SHA256_MAC_LEN) < 0) + goto fail; + os_free(val); + conf->next = bss->dpp_controller; + bss->dpp_controller = conf; + return 0; +fail: + os_free(val); + os_free(conf); + return -1; +} +#endif /* CONFIG_DPP2 */ + + static int hostapd_config_fill(struct hostapd_config *conf, struct hostapd_bss_config *bss, const char *buf, char *pos, int line) @@ -2496,7 +2485,11 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "eapol_version") == 0) { int eapol_version = atoi(pos); +#ifdef CONFIG_MACSEC + if (eapol_version < 1 || eapol_version > 3) { +#else /* CONFIG_MACSEC */ if (eapol_version < 1 || eapol_version > 2) { +#endif /* CONFIG_MACSEC */ wpa_printf(MSG_ERROR, "Line %d: invalid EAPOL version (%d): '%s'.", line, eapol_version, pos); @@ -2519,12 +2512,21 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "server_cert") == 0) { os_free(bss->server_cert); bss->server_cert = os_strdup(pos); + } else if (os_strcmp(buf, "server_cert2") == 0) { + os_free(bss->server_cert2); + bss->server_cert2 = os_strdup(pos); } else if (os_strcmp(buf, "private_key") == 0) { os_free(bss->private_key); bss->private_key = os_strdup(pos); + } else if (os_strcmp(buf, "private_key2") == 0) { + os_free(bss->private_key2); + bss->private_key2 = os_strdup(pos); } else if (os_strcmp(buf, "private_key_passwd") == 0) { os_free(bss->private_key_passwd); bss->private_key_passwd = os_strdup(pos); + } else if (os_strcmp(buf, "private_key_passwd2") == 0) { + os_free(bss->private_key_passwd2); + bss->private_key_passwd2 = os_strdup(pos); } else if (os_strcmp(buf, "check_cert_subject") == 0) { if (!pos[0]) { wpa_printf(MSG_ERROR, "Line %d: unknown check_cert_subject '%s'", @@ -2605,6 +2607,20 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "pac_key_refresh_time") == 0) { bss->pac_key_refresh_time = atoi(pos); #endif /* EAP_SERVER_FAST */ +#ifdef EAP_SERVER_TEAP + } else if (os_strcmp(buf, "eap_teap_auth") == 0) { + int val = atoi(pos); + + if (val < 0 || val > 1) { + wpa_printf(MSG_ERROR, + "Line %d: Invalid eap_teap_auth value", + line); + return 1; + } + bss->eap_teap_auth = val; + } else if (os_strcmp(buf, "eap_teap_pac_no_inner") == 0) { + bss->eap_teap_pac_no_inner = atoi(pos); +#endif /* EAP_SERVER_TEAP */ #ifdef EAP_SERVER_SIM } else if (os_strcmp(buf, "eap_sim_db") == 0) { os_free(bss->eap_sim_db); @@ -2613,6 +2629,8 @@ static int hostapd_config_fill(struct hostapd_config * bss->eap_sim_db_timeout = atoi(pos); } else if (os_strcmp(buf, "eap_sim_aka_result_ind") == 0) { bss->eap_sim_aka_result_ind = atoi(pos); + } else if (os_strcmp(buf, "eap_sim_id") == 0) { + bss->eap_sim_id = atoi(pos); #endif /* EAP_SERVER_SIM */ #ifdef EAP_SERVER_TNC } else if (os_strcmp(buf, "tnc") == 0) { @@ -2816,6 +2834,9 @@ static int hostapd_config_fill(struct hostapd_config * a = a->next; a->next = attr; } + } else if (os_strcmp(buf, "radius_req_attr_sqlite") == 0) { + os_free(bss->radius_req_attr_sqlite); + bss->radius_req_attr_sqlite = os_strdup(pos); } else if (os_strcmp(buf, "radius_das_port") == 0) { bss->radius_das_port = atoi(pos); } else if (os_strcmp(buf, "radius_das_client") == 0) { @@ -3442,6 +3463,8 @@ static int hostapd_config_fill(struct hostapd_config * conf->he_op.he_twt_required = atoi(pos); } else if (os_strcmp(buf, "he_rts_threshold") == 0) { conf->he_op.he_rts_threshold = atoi(pos); + } else if (os_strcmp(buf, "he_basic_mcs_nss_set") == 0) { + conf->he_op.he_basic_mcs_nss_set = atoi(pos); } else if (os_strcmp(buf, "he_mu_edca_qos_info_param_count") == 0) { conf->he_mu_edca.he_qos_info |= set_he_cap(atoi(pos), HE_QOS_INFO_EDCA_PARAM_SET_COUNT); @@ -3526,6 +3549,20 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "he_mu_edca_ac_vo_timer") == 0) { conf->he_mu_edca.he_mu_ac_vo_param[HE_MU_AC_PARAM_TIMER_IDX] = atoi(pos) & 0xff; + } else if (os_strcmp(buf, "he_spr_sr_control") == 0) { + conf->spr.sr_control = atoi(pos) & 0xff; + } else if (os_strcmp(buf, "he_spr_non_srg_obss_pd_max_offset") == 0) { + conf->spr.non_srg_obss_pd_max_offset = atoi(pos); + } else if (os_strcmp(buf, "he_spr_srg_obss_pd_min_offset") == 0) { + conf->spr.srg_obss_pd_min_offset = atoi(pos); + } else if (os_strcmp(buf, "he_spr_srg_obss_pd_max_offset") == 0) { + conf->spr.srg_obss_pd_max_offset = atoi(pos); + } else if (os_strcmp(buf, "he_oper_chwidth") == 0) { + conf->he_oper_chwidth = atoi(pos); + } else if (os_strcmp(buf, "he_oper_centr_freq_seg0_idx") == 0) { + conf->he_oper_centr_freq_seg0_idx = atoi(pos); + } else if (os_strcmp(buf, "he_oper_centr_freq_seg1_idx") == 0) { + conf->he_oper_centr_freq_seg1_idx = atoi(pos); #endif /* CONFIG_IEEE80211AX */ } else if (os_strcmp(buf, "max_listen_interval") == 0) { bss->max_listen_interval = atoi(pos); @@ -4298,6 +4335,11 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "dpp_csign") == 0) { if (parse_wpabuf_hex(line, buf, &bss->dpp_csign, pos)) return 1; +#ifdef CONFIG_DPP2 + } else if (os_strcmp(buf, "dpp_controller") == 0) { + if (hostapd_dpp_controller_parse(bss, pos)) + return 1; +#endif /* CONFIG_DPP2 */ #endif /* CONFIG_DPP */ #ifdef CONFIG_OWE } else if (os_strcmp(buf, "owe_transition_bssid") == 0) { @@ -4349,6 +4391,121 @@ static int hostapd_config_fill(struct hostapd_config * conf->rssi_reject_assoc_timeout = atoi(pos); } else if (os_strcmp(buf, "pbss") == 0) { bss->pbss = atoi(pos); +#ifdef CONFIG_AIRTIME_POLICY + } else if (os_strcmp(buf, "airtime_mode") == 0) { + int val = atoi(pos); + + if (val < 0 || val > AIRTIME_MODE_MAX) { + wpa_printf(MSG_ERROR, "Line %d: Unknown airtime_mode", + line); + return 1; + } + conf->airtime_mode = val; + } else if (os_strcmp(buf, "airtime_update_interval") == 0) { + conf->airtime_update_interval = atoi(pos); + } else if (os_strcmp(buf, "airtime_bss_weight") == 0) { + bss->airtime_weight = atoi(pos); + } else if (os_strcmp(buf, "airtime_bss_limit") == 0) { + int val = atoi(pos); + + if (val < 0 || val > 1) { + wpa_printf(MSG_ERROR, + "Line %d: Invalid airtime_bss_limit (must be 0 or 1)", + line); + return 1; + } + bss->airtime_limit = val; + } else if (os_strcmp(buf, "airtime_sta_weight") == 0) { + if (add_airtime_weight(bss, pos) < 0) { + wpa_printf(MSG_ERROR, + "Line %d: Invalid airtime weight '%s'", + line, pos); + return 1; + } +#endif /* CONFIG_AIRTIME_POLICY */ +#ifdef CONFIG_MACSEC + } else if (os_strcmp(buf, "macsec_policy") == 0) { + int macsec_policy = atoi(pos); + + if (macsec_policy < 0 || macsec_policy > 1) { + wpa_printf(MSG_ERROR, + "Line %d: invalid macsec_policy (%d): '%s'.", + line, macsec_policy, pos); + return 1; + } + bss->macsec_policy = macsec_policy; + } else if (os_strcmp(buf, "macsec_integ_only") == 0) { + int macsec_integ_only = atoi(pos); + + if (macsec_integ_only < 0 || macsec_integ_only > 1) { + wpa_printf(MSG_ERROR, + "Line %d: invalid macsec_integ_only (%d): '%s'.", + line, macsec_integ_only, pos); + return 1; + } + bss->macsec_integ_only = macsec_integ_only; + } else if (os_strcmp(buf, "macsec_replay_protect") == 0) { + int macsec_replay_protect = atoi(pos); + + if (macsec_replay_protect < 0 || macsec_replay_protect > 1) { + wpa_printf(MSG_ERROR, + "Line %d: invalid macsec_replay_protect (%d): '%s'.", + line, macsec_replay_protect, pos); + return 1; + } + bss->macsec_replay_protect = macsec_replay_protect; + } else if (os_strcmp(buf, "macsec_replay_window") == 0) { + bss->macsec_replay_window = atoi(pos); + } else if (os_strcmp(buf, "macsec_port") == 0) { + int macsec_port = atoi(pos); + + if (macsec_port < 1 || macsec_port > 65534) { + wpa_printf(MSG_ERROR, + "Line %d: invalid macsec_port (%d): '%s'.", + line, macsec_port, pos); + return 1; + } + bss->macsec_port = macsec_port; + } else if (os_strcmp(buf, "mka_priority") == 0) { + int mka_priority = atoi(pos); + + if (mka_priority < 0 || mka_priority > 255) { + wpa_printf(MSG_ERROR, + "Line %d: invalid mka_priority (%d): '%s'.", + line, mka_priority, pos); + return 1; + } + bss->mka_priority = mka_priority; + } else if (os_strcmp(buf, "mka_cak") == 0) { + size_t len = os_strlen(pos); + + if (len > 2 * MACSEC_CAK_MAX_LEN || + (len != 2 * 16 && len != 2 * 32) || + hexstr2bin(pos, bss->mka_cak, len / 2)) { + wpa_printf(MSG_ERROR, "Line %d: Invalid MKA-CAK '%s'.", + line, pos); + return 1; + } + bss->mka_cak_len = len / 2; + bss->mka_psk_set |= MKA_PSK_SET_CAK; + } else if (os_strcmp(buf, "mka_ckn") == 0) { + size_t len = os_strlen(pos); + + if (len > 2 * MACSEC_CKN_MAX_LEN || /* too long */ + len < 2 || /* too short */ + len % 2 != 0 /* not an integral number of bytes */) { + wpa_printf(MSG_ERROR, "Line %d: Invalid MKA-CKN '%s'.", + line, pos); + return 1; + } + bss->mka_ckn_len = len / 2; + if (hexstr2bin(pos, bss->mka_ckn, bss->mka_ckn_len)) { + wpa_printf(MSG_ERROR, "Line %d: Invalid MKA-CKN '%s'.", + line, pos); + return -1; + } + bss->mka_psk_set |= MKA_PSK_SET_CKN; +#endif /* CONFIG_MACSEC */ } else { wpa_printf(MSG_ERROR, "Line %d: unknown configuration item '%s'", Modified: head/contrib/wpa/hostapd/ctrl_iface.c ============================================================================== --- head/contrib/wpa/hostapd/ctrl_iface.c Thu Aug 22 17:49:34 2019 (r351396) +++ head/contrib/wpa/hostapd/ctrl_iface.c Thu Aug 22 18:52:30 2019 (r351397) @@ -1830,26 +1830,40 @@ static void hostapd_data_test_rx(void *ctx, const u8 * struct iphdr ip; const u8 *pos; unsigned int i; + char extra[30]; - if (len != HWSIM_PACKETLEN) + if (len < sizeof(*eth) + sizeof(ip) || len > HWSIM_PACKETLEN) { + wpa_printf(MSG_DEBUG, + "test data: RX - ignore unexpected length %d", + (int) len); return; + } eth = (const struct ether_header *) buf; os_memcpy(&ip, eth + 1, sizeof(ip)); pos = &buf[sizeof(*eth) + sizeof(ip)]; if (ip.ihl != 5 || ip.version != 4 || - ntohs(ip.tot_len) != HWSIM_IP_LEN) + ntohs(ip.tot_len) > HWSIM_IP_LEN) { + wpa_printf(MSG_DEBUG, + "test data: RX - ignore unexpect IP header"); return; + } - for (i = 0; i < HWSIM_IP_LEN - sizeof(ip); i++) { - if (*pos != (u8) i) + for (i = 0; i < ntohs(ip.tot_len) - sizeof(ip); i++) { + if (*pos != (u8) i) { + wpa_printf(MSG_DEBUG, + "test data: RX - ignore mismatching payload"); return; + } pos++; } - wpa_msg(hapd->msg_ctx, MSG_INFO, "DATA-TEST-RX " MACSTR " " MACSTR, - MAC2STR(eth->ether_dhost), MAC2STR(eth->ether_shost)); + extra[0] = '\0'; + if (ntohs(ip.tot_len) != HWSIM_IP_LEN) + os_snprintf(extra, sizeof(extra), " len=%d", ntohs(ip.tot_len)); + wpa_msg(hapd->msg_ctx, MSG_INFO, "DATA-TEST-RX " MACSTR " " MACSTR "%s", + MAC2STR(eth->ether_dhost), MAC2STR(eth->ether_shost), extra); } @@ -1894,7 +1908,7 @@ static int hostapd_ctrl_iface_data_test_config(struct static int hostapd_ctrl_iface_data_test_tx(struct hostapd_data *hapd, char *cmd) { u8 dst[ETH_ALEN], src[ETH_ALEN]; - char *pos; + char *pos, *pos2; int used; long int val; u8 tos; @@ -1903,11 +1917,12 @@ static int hostapd_ctrl_iface_data_test_tx(struct host struct iphdr *ip; u8 *dpos; unsigned int i; + size_t send_len = HWSIM_IP_LEN; if (hapd->l2_test == NULL) return -1; - /* format: */ + /* format: [len=] */ pos = cmd; used = hwaddr_aton2(pos, dst); @@ -1921,11 +1936,19 @@ static int hostapd_ctrl_iface_data_test_tx(struct host return -1; pos += used; - val = strtol(pos, NULL, 0); + val = strtol(pos, &pos2, 0); if (val < 0 || val > 0xff) return -1; tos = val; + pos = os_strstr(pos2, " len="); + if (pos) { + i = atoi(pos + 5); + if (i < sizeof(*ip) || i > HWSIM_IP_LEN) + return -1; + send_len = i; + } + eth = (struct ether_header *) &buf[2]; os_memcpy(eth->ether_dhost, dst, ETH_ALEN); os_memcpy(eth->ether_shost, src, ETH_ALEN); @@ -1936,17 +1959,17 @@ static int hostapd_ctrl_iface_data_test_tx(struct host ip->version = 4; ip->ttl = 64; ip->tos = tos; - ip->tot_len = htons(HWSIM_IP_LEN); + ip->tot_len = htons(send_len); ip->protocol = 1; ip->saddr = htonl(192U << 24 | 168 << 16 | 1 << 8 | 1); ip->daddr = htonl(192U << 24 | 168 << 16 | 1 << 8 | 2); ip->check = ipv4_hdr_checksum(ip, sizeof(*ip)); dpos = (u8 *) (ip + 1); - for (i = 0; i < HWSIM_IP_LEN - sizeof(*ip); i++) + for (i = 0; i < send_len - sizeof(*ip); i++) *dpos++ = i; if (l2_packet_send(hapd->l2_test, dst, ETHERTYPE_IP, &buf[2], - HWSIM_PACKETLEN) < 0) + sizeof(struct ether_header) + send_len) < 0) return -1; wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "test data: TX dst=" MACSTR Modified: head/contrib/wpa/hostapd/defconfig ============================================================================== --- head/contrib/wpa/hostapd/defconfig Thu Aug 22 17:49:34 2019 (r351396) +++ head/contrib/wpa/hostapd/defconfig Thu Aug 22 18:52:30 2019 (r351397) @@ -108,11 +108,18 @@ CONFIG_EAP_TTLS=y #CONFIG_EAP_GPSK_SHA256=y # EAP-FAST for the integrated EAP server -# Note: If OpenSSL is used as the TLS library, OpenSSL 1.0 or newer is needed -# for EAP-FAST support. Older OpenSSL releases would need to be patched, e.g., -# with openssl-0.9.8x-tls-extensions.patch, to add the needed functions. #CONFIG_EAP_FAST=y +# EAP-TEAP for the integrated EAP server +# Note: The current EAP-TEAP implementation is experimental and should not be +# enabled for production use. The IETF RFC 7170 that defines EAP-TEAP has number +# of conflicting statements and missing details and the implementation has +# vendor specific workarounds for those and as such, may not interoperate with +# any other implementation. This should not be used for anything else than +# experimentation and interoperability testing until those issues has been +# resolved. +#CONFIG_EAP_TEAP=y + # Wi-Fi Protected Setup (WPS) #CONFIG_WPS=y # Enable UPnP support for external WPS Registrars @@ -375,6 +382,9 @@ CONFIG_IPV6=y # Opportunistic Wireless Encryption (OWE) # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y + +# Airtime policy support +#CONFIG_AIRTIME_POLICY=y # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. Modified: head/contrib/wpa/hostapd/eap_register.c ============================================================================== --- head/contrib/wpa/hostapd/eap_register.c Thu Aug 22 17:49:34 2019 (r351396) +++ head/contrib/wpa/hostapd/eap_register.c Thu Aug 22 18:52:30 2019 (r351397) @@ -121,6 +121,11 @@ int eap_server_register_methods(void) ret = eap_server_fast_register(); #endif /* EAP_SERVER_FAST */ +#ifdef EAP_SERVER_TEAP + if (ret == 0) + ret = eap_server_teap_register(); +#endif /* EAP_SERVER_TEAP */ + #ifdef EAP_SERVER_WSC if (ret == 0) ret = eap_server_wsc_register(); Modified: head/contrib/wpa/hostapd/hostapd.conf ============================================================================== --- head/contrib/wpa/hostapd/hostapd.conf Thu Aug 22 17:49:34 2019 (r351396) +++ head/contrib/wpa/hostapd/hostapd.conf Thu Aug 22 18:52:30 2019 (r351397) @@ -782,10 +782,8 @@ wmm_ac_vo_acm=0 # 1 = supported #he_mu_beamformer=1 -# he_bss_color: BSS color -# 0 = no BSS color (default) -# unsigned integer = BSS color -#he_bss_color=0 +# he_bss_color: BSS color (1-63) +#he_bss_color=1 #he_default_pe_duration: The duration of PE field in an HE PPDU in us # Possible values are 0 us (default), 4 us, 8 us, 12 us, and 16 us @@ -801,6 +799,17 @@ wmm_ac_vo_acm=0 # unsigned integer = duration in units of 16 us #he_rts_threshold=0 +# HE operating channel information; see matching vht_* parameters for details. +#he_oper_chwidth +#he_oper_centr_freq_seg0_idx +#he_oper_centr_freq_seg1_idx + +#he_basic_mcs_nss_set: Basic NSS/MCS set +# 16-bit combination of 2-bit values of Max HE-MCS For 1..8 SS; each 2-bit +# value having following meaning: +# 0 = HE-MCS 0-7, 1 = HE-MCS 0-9, 2 = HE-MCS 0-11, 3 = not supported +#he_basic_mcs_nss_set + #he_mu_edca_qos_info_param_count #he_mu_edca_qos_info_q_ack #he_mu_edca_qos_info_queue_request=1 @@ -825,6 +834,12 @@ wmm_ac_vo_acm=0 #he_mu_edca_ac_vo_ecwmax=15 #he_mu_edca_ac_vo_timer=255 +# Spatial Reuse Parameter Set +#he_spr_sr_control +#he_spr_non_srg_obss_pd_max_offset +#he_spr_srg_obss_pd_min_offset +#he_spr_srg_obss_pd_max_offset + ##### IEEE 802.1X-2004 related configuration ################################## # Require IEEE 802.1X authorization @@ -836,6 +851,8 @@ wmm_ac_vo_acm=0 # the new version number correctly (they seem to drop the frames completely). # In order to make hostapd interoperate with these clients, the version number # can be set to the older version (1) with this configuration value. +# Note: When using MACsec, eapol_version shall be set to 3, which is +# defined in IEEE Std 802.1X-2010. #eapol_version=2 # Optional displayable message sent with EAP Request-Identity. The first \0 @@ -879,6 +896,54 @@ eapol_key_index_workaround=0 # ERP is enabled (eap_server_erp=1). #erp_domain=example.com +##### MACsec ################################################################## + +# macsec_policy: IEEE 802.1X/MACsec options +# This determines how sessions are secured with MACsec (only for MACsec +# drivers). +# 0: MACsec not in use (default) +# 1: MACsec enabled - Should secure, accept key server's advice to +# determine whether to use a secure session or not. +# +# macsec_integ_only: IEEE 802.1X/MACsec transmit mode +# This setting applies only when MACsec is in use, i.e., +# - macsec_policy is enabled +# - the key server has decided to enable MACsec +# 0: Encrypt traffic (default) +# 1: Integrity only +# +# macsec_replay_protect: IEEE 802.1X/MACsec replay protection +# This setting applies only when MACsec is in use, i.e., +# - macsec_policy is enabled +# - the key server has decided to enable MACsec +# 0: Replay protection disabled (default) +# 1: Replay protection enabled +# +# macsec_replay_window: IEEE 802.1X/MACsec replay protection window +# This determines a window in which replay is tolerated, to allow receipt +# of frames that have been misordered by the network. +# This setting applies only when MACsec replay protection active, i.e., +# - macsec_replay_protect is enabled +# - the key server has decided to enable MACsec +# 0: No replay window, strict check (default) +# 1..2^32-1: number of packets that could be misordered +# +# macsec_port: IEEE 802.1X/MACsec port +# Port component of the SCI +# Range: 1-65534 (default: 1) +# +# mka_priority (Priority of MKA Actor) +# Range: 0..255 (default: 255) +# +# mka_cak, mka_ckn, and mka_priority: IEEE 802.1X/MACsec pre-shared key mode +# This allows to configure MACsec with a pre-shared key using a (CAK,CKN) pair. +# In this mode, instances of hostapd can act as MACsec peers. The peer +# with lower priority will become the key server and start distributing SAKs. +# mka_cak (CAK = Secure Connectivity Association Key) takes a 16-byte (128-bit) +# hex-string (32 hex-digits) or a 32-byte (256-bit) hex-string (64 hex-digits) +# mka_ckn (CKN = CAK Name) takes a 1..32-bytes (8..256 bit) hex-string +# (2..64 hex-digits) + ##### Integrated EAP server ################################################### # Optionally, hostapd can be configured to use an integrated EAP server @@ -912,6 +977,23 @@ eap_server=0 # Passphrase for private key #private_key_passwd=secret passphrase +# An alternative server certificate and private key can be configured with the +# following parameters (with values just like the parameters above without the +# '2' suffix). The ca_cert file (in PEM encoding) is used to add the trust roots +# for both server certificates and/or client certificates). +# +# The main use case for this alternative server certificate configuration is to +# enable both RSA and ECC public keys. The server will pick which one to use +# based on the client preferences for the cipher suite (in the TLS ClientHello +# message). It should be noted that number of deployed EAP peer implementations +# do not filter out the cipher suite list based on their local configuration and +# as such, configuration of alternative types of certificates on the server may +# result in interoperability issues. +#server_cert2=/etc/hostapd.server-ecc.pem +#private_key2=/etc/hostapd.server-ecc.prv +#private_key_passwd2=secret passphrase + + # Server identity # EAP methods that provide mechanism for authenticated server identity delivery # use this value. If not set, "hostapd" is used as a default. @@ -1109,10 +1191,27 @@ eap_server=0 # (or fewer) of the lifetime remains. #pac_key_refresh_time=86400 +# EAP-TEAP authentication type +# 0 = inner EAP (default) +# 1 = Basic-Password-Auth +#eap_teap_auth=0 + +# EAP-TEAP authentication behavior when using PAC +# 0 = perform inner authentication (default) +# 1 = skip inner authentication (inner EAP/Basic-Password-Auth) +#eap_teap_pac_no_inner=0 + # EAP-SIM and EAP-AKA protected success/failure indication using AT_RESULT_IND # (default: 0 = disabled). #eap_sim_aka_result_ind=1 +# EAP-SIM and EAP-AKA identity options +# 0 = do not use pseudonyms or fast reauthentication +# 1 = use pseudonyms, but not fast reauthentication +# 2 = do not use pseudonyms, but use fast reauthentication +# 3 = use pseudonyms and use fast reauthentication (default) +#eap_sim_id=3 + # Trusted Network Connect (TNC) # If enabled, TNC validation will be required before the peer is allowed to # connect. Note: This is only used with EAP-TTLS and EAP-FAST. If any other @@ -1292,6 +1391,17 @@ own_ip_addr=127.0.0.1 # Operator-Name = "Operator" #radius_acct_req_attr=126:s:Operator +# If SQLite support is included, path to a database from which additional +# RADIUS request attributes are extracted based on the station MAC address. +# +# The schema for the radius_attributes table is: +# id | sta | reqtype | attr : multi-key (sta, reqtype) +# id = autonumber +# sta = station MAC address in `11:22:33:44:55:66` format. +# type = `auth` | `acct` | NULL (match any) +# attr = existing config file format, e.g. `126:s:Test Operator` +#radius_req_attr_sqlite=radius_attr.sqlite + # Dynamic Authorization Extensions (RFC 5176) # This mechanism can be used to allow dynamic changes to user session based on # commands from a RADIUS server (or some other disconnect client that has the @@ -2491,6 +2601,42 @@ own_ip_addr=127.0.0.1 # as a radio measurement even if the request doesn't contain a max age element # that allows sending of such data. Default: 0. #stationary_ap=0 + +##### Airtime policy configuration ########################################### + +# Set the airtime policy operating mode: +# 0 = disabled (default) +# 1 = static config +# 2 = per-BSS dynamic config +# 3 = per-BSS limit mode +#airtime_mode=0 + +# Interval (in milliseconds) to poll the kernel for updated station activity in +# dynamic and limit modes +#airtime_update_interval=200 + +# Static configuration of station weights (when airtime_mode=1). Kernel default +# weight is 256; set higher for larger airtime share, lower for smaller share. +# Each entry is a MAC address followed by a weight. +#airtime_sta_weight=02:01:02:03:04:05 256 +#airtime_sta_weight=02:01:02:03:04:06 512 + +# Per-BSS airtime weight. In multi-BSS mode, set for each BSS and hostapd will +# configure station weights to enforce the correct ratio between BSS weights +# depending on the number of active stations. The *ratios* between different +# BSSes is what's important, not the absolute numbers. +# Must be set for all BSSes if airtime_mode=2 or 3, has no effect otherwise. +#airtime_bss_weight=1 + +# Whether the current BSS should be limited (when airtime_mode=3). +# +# If set, the BSS weight ratio will be applied in the case where the current BSS +# would exceed the share defined by the BSS weight ratio. E.g., if two BSSes are +# set to the same weights, and one is set to limited, the limited BSS will get +# no more than half the available airtime, but if the non-limited BSS has more +# stations active, that *will* be allowed to exceed its half of the available +# airtime. +#airtime_bss_limit=1 ##### TESTING OPTIONS ######################################################### # Modified: head/contrib/wpa/hostapd/hostapd_cli.c ============================================================================== --- head/contrib/wpa/hostapd/hostapd_cli.c Thu Aug 22 17:49:34 2019 (r351396) +++ head/contrib/wpa/hostapd/hostapd_cli.c Thu Aug 22 18:52:30 2019 (r351397) @@ -1214,6 +1214,13 @@ static int hostapd_cli_cmd_disable(struct wpa_ctrl *ct } +static int hostapd_cli_cmd_update_beacon(struct wpa_ctrl *ctrl, int argc, + char *argv[]) +{ + return wpa_ctrl_command(ctrl, "UPDATE_BEACON"); +} + + static int hostapd_cli_cmd_vendor(struct wpa_ctrl *ctrl, int argc, char *argv[]) { char cmd[256]; @@ -1617,6 +1624,8 @@ static const struct hostapd_cli_cmd hostapd_cli_comman "= reload configuration for current interface" }, { "disable", hostapd_cli_cmd_disable, NULL, "= disable hostapd on current interface" }, + { "update_beacon", hostapd_cli_cmd_update_beacon, NULL, + "= update Beacon frame contents\n"}, { "erp_flush", hostapd_cli_cmd_erp_flush, NULL, "= drop all ERP keys"}, { "log_level", hostapd_cli_cmd_log_level, NULL, Modified: head/contrib/wpa/hostapd/main.c ============================================================================== --- head/contrib/wpa/hostapd/main.c Thu Aug 22 17:49:34 2019 (r351396) +++ head/contrib/wpa/hostapd/main.c Thu Aug 22 18:52:30 2019 (r351397) @@ -653,6 +653,9 @@ int main(int argc, char *argv[]) int start_ifaces_in_sync = 0; char **if_names = NULL; size_t if_names_size = 0; +#ifdef CONFIG_DPP + struct dpp_global_config dpp_conf; +#endif /* CONFIG_DPP */ if (os_program_init()) return -1; @@ -672,7 +675,9 @@ int main(int argc, char *argv[]) dl_list_init(&interfaces.eth_p_oui); #endif /* CONFIG_ETH_P_OUI */ #ifdef CONFIG_DPP - interfaces.dpp = dpp_global_init(); + os_memset(&dpp_conf, 0, sizeof(dpp_conf)); + /* TODO: dpp_conf.msg_ctx? */ + interfaces.dpp = dpp_global_init(&dpp_conf); if (!interfaces.dpp) return -1; #endif /* CONFIG_DPP */ Modified: head/contrib/wpa/hs20/client/osu_client.c ============================================================================== --- head/contrib/wpa/hs20/client/osu_client.c Thu Aug 22 17:49:34 2019 (r351396) +++ head/contrib/wpa/hs20/client/osu_client.c Thu Aug 22 18:52:30 2019 (r351397) @@ -1588,6 +1588,7 @@ static void set_pps_cred_digital_cert(struct hs20_osu_ xml_node_t *node, const char *fqdn) { char buf[200], dir[200]; + int res; wpa_printf(MSG_INFO, "- Credential/DigitalCertificate"); @@ -1599,14 +1600,20 @@ static void set_pps_cred_digital_cert(struct hs20_osu_ wpa_printf(MSG_INFO, "Failed to set username"); } - snprintf(buf, sizeof(buf), "%s/SP/%s/client-cert.pem", dir, fqdn); + res = os_snprintf(buf, sizeof(buf), "%s/SP/%s/client-cert.pem", dir, + fqdn); + if (os_snprintf_error(sizeof(buf), res)) + return; if (os_file_exists(buf)) { if (set_cred_quoted(ctx->ifname, id, "client_cert", buf) < 0) { wpa_printf(MSG_INFO, "Failed to set client_cert"); } } - snprintf(buf, sizeof(buf), "%s/SP/%s/client-key.pem", dir, fqdn); + res = os_snprintf(buf, sizeof(buf), "%s/SP/%s/client-key.pem", dir, + fqdn); + if (os_snprintf_error(sizeof(buf), res)) + return; if (os_file_exists(buf)) { if (set_cred_quoted(ctx->ifname, id, "private_key", buf) < 0) { wpa_printf(MSG_INFO, "Failed to set private_key"); @@ -1620,6 +1627,7 @@ static void set_pps_cred_realm(struct hs20_osu_client { char *str = xml_node_get_text(ctx->xml, node); char buf[200], dir[200]; + int res; if (str == NULL) return; @@ -1634,7 +1642,9 @@ static void set_pps_cred_realm(struct hs20_osu_client if (getcwd(dir, sizeof(dir)) == NULL) return; - snprintf(buf, sizeof(buf), "%s/SP/%s/aaa-ca.pem", dir, fqdn); + res = os_snprintf(buf, sizeof(buf), "%s/SP/%s/aaa-ca.pem", dir, fqdn); + if (os_snprintf_error(sizeof(buf), res)) + return; if (os_file_exists(buf)) { if (set_cred_quoted(ctx->ifname, id, "ca_cert", buf) < 0) { wpa_printf(MSG_INFO, "Failed to set CA cert"); @@ -2717,6 +2727,8 @@ static int cmd_pol_upd(struct hs20_osu_client *ctx, co if (!pps_fname) { char buf[256]; + int res; + wpa_printf(MSG_INFO, "Determining PPS file based on Home SP information"); if (address && os_strncmp(address, "fqdn=", 5) == 0) { wpa_printf(MSG_INFO, "Use requested FQDN from command line"); @@ -2737,8 +2749,13 @@ static int cmd_pol_upd(struct hs20_osu_client *ctx, co "SP/%s/pps.xml", ctx->fqdn); pps_fname = pps_fname_buf; - os_snprintf(ca_fname_buf, sizeof(ca_fname_buf), "SP/%s/ca.pem", - buf); + res = os_snprintf(ca_fname_buf, sizeof(ca_fname_buf), + "SP/%s/ca.pem", buf); + if (os_snprintf_error(sizeof(ca_fname_buf), res)) { + os_free(ctx->fqdn); + ctx->fqdn = NULL; + return -1; + } ca_fname = ca_fname_buf; } Modified: head/contrib/wpa/src/ap/accounting.c ============================================================================== --- head/contrib/wpa/src/ap/accounting.c Thu Aug 22 17:49:34 2019 (r351396) +++ head/contrib/wpa/src/ap/accounting.c Thu Aug 22 18:52:30 2019 (r351397) @@ -97,6 +97,9 @@ static struct radius_msg * accounting_msg(struct hosta msg) < 0) goto fail; + if (sta && add_sqlite_radius_attr(hapd, sta, msg, 1) < 0) + goto fail; + if (sta) { for (i = 0; ; i++) { val = ieee802_1x_get_radius_class(sta->eapol_sm, &len, Modified: head/contrib/wpa/src/ap/acs.c ============================================================================== --- head/contrib/wpa/src/ap/acs.c Thu Aug 22 17:49:34 2019 (r351396) +++ head/contrib/wpa/src/ap/acs.c Thu Aug 22 18:52:30 2019 (r351397) @@ -594,12 +594,12 @@ acs_find_ideal_chan(struct hostapd_iface *iface) iface->conf->secondary_channel) n_chans = 2; - if (iface->conf->ieee80211ac) { - switch (iface->conf->vht_oper_chwidth) { - case VHT_CHANWIDTH_80MHZ: + if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) { + switch (hostapd_get_oper_chwidth(iface->conf)) { + case CHANWIDTH_80MHZ: n_chans = 4; break; - case VHT_CHANWIDTH_160MHZ: + case CHANWIDTH_160MHZ: n_chans = 8; break; } @@ -607,7 +607,7 @@ acs_find_ideal_chan(struct hostapd_iface *iface) bw = num_chan_to_bw(n_chans); - /* TODO: VHT80+80. Update acs_adjust_vht_center_freq() too. */ + /* TODO: VHT/HE80+80. Update acs_adjust_center_freq() too. */ wpa_printf(MSG_DEBUG, "ACS: Survey analysis for selected bandwidth %d MHz", bw); @@ -647,9 +647,9 @@ acs_find_ideal_chan(struct hostapd_iface *iface) } if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && - iface->conf->ieee80211ac) { - if (iface->conf->vht_oper_chwidth == *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Aug 22 18:57:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21726CF0C7; Thu, 22 Aug 2019 18:57:26 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Dv0k03ptz3HLr; Thu, 22 Aug 2019 18:57:26 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDFE9884D; Thu, 22 Aug 2019 18:57:25 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7MIvPf9040378; Thu, 22 Aug 2019 18:57:25 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MIvPuN040376; Thu, 22 Aug 2019 18:57:25 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908221857.x7MIvPuN040376@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 22 Aug 2019 18:57:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351398 - in head/sbin/ping: . tests X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head/sbin/ping: . tests X-SVN-Commit-Revision: 351398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 18:57:26 -0000 Author: asomers Date: Thu Aug 22 18:57:24 2019 New Revision: 351398 URL: https://svnweb.freebsd.org/changeset/base/351398 Log: ping: By default, don't reverse lookup IP addresses ping's default is now not to attempt reverse DNS lookups. The -H flag will enable them. This change is not quite a reversion of r351330. That change made the happy path and error path do reverse lookups consistently; this change changes the default for both paths. Submitted by: Ján Sučan Discussed with: cem MFC after: 2 weeks MFC-With: 351330 Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21364 Modified: head/sbin/ping/ping.8 head/sbin/ping/ping.c head/sbin/ping/tests/ping_c1_s56_t1.out Modified: head/sbin/ping/ping.8 ============================================================================== --- head/sbin/ping/ping.8 Thu Aug 22 18:52:30 2019 (r351397) +++ head/sbin/ping/ping.8 Thu Aug 22 18:57:24 2019 (r351398) @@ -28,7 +28,7 @@ .\" @(#)ping.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd August 21, 2019 +.Dd August 22, 2019 .Dt PING 8 .Os .Sh NAME @@ -160,11 +160,9 @@ The default value is 0. .It Fl H Hostname output. Try to do a reverse DNS lookup when displaying addresses. -This is the opposite of -.Fl n , -and it is the default behavior. -.Nm -utility tries reverse-lookup by default. +This is the opposite of the +.Fl n +option. .It Fl h Ar sweepincrsize Specify the number of bytes to increment the size of .Tn ICMP @@ -228,6 +226,9 @@ MIB variable. .It Fl n Numeric output only. No attempt will be made to lookup symbolic names for host addresses. +This is the opposite of +.Fl H , +and it is the default behavior. .It Fl o Exit successfully after receiving one reply packet. .It Fl P Ar policy Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Thu Aug 22 18:52:30 2019 (r351397) +++ head/sbin/ping/ping.c Thu Aug 22 18:57:24 2019 (r351398) @@ -261,6 +261,8 @@ main(int argc, char *const *argv) #endif cap_rights_t rights; + options |= F_NUMERIC; + /* * Do the stuff that we need root priv's for *first*, and * then drop our setuid bit. Save error reporting for Modified: head/sbin/ping/tests/ping_c1_s56_t1.out ============================================================================== --- head/sbin/ping/tests/ping_c1_s56_t1.out Thu Aug 22 18:52:30 2019 (r351397) +++ head/sbin/ping/tests/ping_c1_s56_t1.out Thu Aug 22 18:57:24 2019 (r351398) @@ -1,5 +1,5 @@ PING localhost: 56 data bytes -64 bytes from localhost: icmp_seq=0 ttl= time= ms +64 bytes from: icmp_seq=0 ttl= time= ms --- localhost ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss From owner-svn-src-head@freebsd.org Thu Aug 22 19:10:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5A5CCF326; Thu, 22 Aug 2019 19:10:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DvHr3lR0z3Htt; Thu, 22 Aug 2019 19:10:32 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 628B98A95; Thu, 22 Aug 2019 19:10:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7MJAWQx046407; Thu, 22 Aug 2019 19:10:32 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MJAWZe046406; Thu, 22 Aug 2019 19:10:32 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201908221910.x7MJAWZe046406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Aug 2019 19:10:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351399 - head/tests/sys/fs X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/tests/sys/fs X-SVN-Commit-Revision: 351399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 19:10:32 -0000 Author: kevans Date: Thu Aug 22 19:10:31 2019 New Revision: 351399 URL: https://svnweb.freebsd.org/changeset/base/351399 Log: Fix the build with WITHOUT_GOOGLETEST Attempting to build the fusefs tests WITHOUT_GOOGLETEST will result in an error if the host system or sysroot doesn't already have googletest headers in /usr/include/private (e.g. host built/installed WITHOUT_GOOGLETEST, clean cross-buildworld WITHOUT_GOOGLETEST). Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D21367 Modified: head/tests/sys/fs/Makefile Modified: head/tests/sys/fs/Makefile ============================================================================== --- head/tests/sys/fs/Makefile Thu Aug 22 18:57:24 2019 (r351398) +++ head/tests/sys/fs/Makefile Thu Aug 22 19:10:31 2019 (r351399) @@ -1,5 +1,6 @@ # $FreeBSD$ +.include .include PACKAGE= tests @@ -9,7 +10,8 @@ TESTSDIR= ${TESTSBASE}/sys/fs TESTSRC= ${SRCTOP}/contrib/netbsd-tests/fs #TESTS_SUBDIRS+= nullfs # XXX: needs rump -.if ${COMPILER_FEATURES:Mc++14} +# fusefs tests cannot be compiled/used without the googletest infrastructure. +.if ${COMPILER_FEATURES:Mc++14} && ${MK_GOOGLETEST} != "no" TESTS_SUBDIRS+= fusefs .endif TESTS_SUBDIRS+= tmpfs From owner-svn-src-head@freebsd.org Thu Aug 22 20:09:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6AEC2D180C; Thu, 22 Aug 2019 20:09:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Dwbx269dz3N40; Thu, 22 Aug 2019 20:09:33 +0000 (UTC) (envelope-from imp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B1A6956B; Thu, 22 Aug 2019 20:09:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7MK9WNh082882; Thu, 22 Aug 2019 20:09:32 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MK9W0j082881; Thu, 22 Aug 2019 20:09:32 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908222009.x7MK9W0j082881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Aug 2019 20:09:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351403 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 351403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 20:09:33 -0000 Author: imp Date: Thu Aug 22 20:09:32 2019 New Revision: 351403 URL: https://svnweb.freebsd.org/changeset/base/351403 Log: Move releasing of resources to later Turn off bus master after we detach the device (to match the prior order). Release MSI after we're done detaching and have turned off all the interrupts. Otherwise this may cause problems as other threads race nvme_detach. This more closely matches the old order. Reviewed by: mav@ Modified: head/sys/dev/nvme/nvme_pci.c Modified: head/sys/dev/nvme/nvme_pci.c ============================================================================== --- head/sys/dev/nvme/nvme_pci.c Thu Aug 22 19:49:51 2019 (r351402) +++ head/sys/dev/nvme/nvme_pci.c Thu Aug 22 20:09:32 2019 (r351403) @@ -215,11 +215,13 @@ static int nvme_pci_detach(device_t dev) { struct nvme_controller*ctrlr = DEVICE2SOFTC(dev); + int rv; + rv = nvme_detach(dev); if (ctrlr->msix_enabled) pci_release_msi(dev); pci_disable_busmaster(dev); - return (nvme_detach(dev)); + return (rv); } static int From owner-svn-src-head@freebsd.org Thu Aug 22 21:12:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A5BED2C62; Thu, 22 Aug 2019 21:12:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Dy103Zglz3R6H; Thu, 22 Aug 2019 21:12:52 +0000 (UTC) (envelope-from imp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C587A259; Thu, 22 Aug 2019 21:12:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7MLCqKT023649; Thu, 22 Aug 2019 21:12:52 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MLCpbt023647; Thu, 22 Aug 2019 21:12:51 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908222112.x7MLCpbt023647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Aug 2019 21:12:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351406 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 351406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 21:12:52 -0000 Author: imp Date: Thu Aug 22 21:12:51 2019 New Revision: 351406 URL: https://svnweb.freebsd.org/changeset/base/351406 Log: We need to define version 1 of nvme, not nvme_foo. Otherwise nvd won't load and people who pull in nvme/nvd from modules can't load nvd.ko since it depends on nvme, not nvme_foo. The duplicate doesn't matter since kldxref properly handles that case. Modified: head/sys/dev/nvme/nvme_ahci.c head/sys/dev/nvme/nvme_pci.c Modified: head/sys/dev/nvme/nvme_ahci.c ============================================================================== --- head/sys/dev/nvme/nvme_ahci.c Thu Aug 22 20:26:20 2019 (r351405) +++ head/sys/dev/nvme/nvme_ahci.c Thu Aug 22 21:12:51 2019 (r351406) @@ -55,7 +55,8 @@ static driver_t nvme_ahci_driver = { }; DRIVER_MODULE(nvme, ahci, nvme_ahci_driver, nvme_devclass, NULL, 0); -MODULE_VERSION(nvme_ahci, 1); +MODULE_VERSION(nvme, 1); +MODULE_DEPEND(nvme, cam, 1, 1, 1); static int nvme_ahci_probe (device_t device) Modified: head/sys/dev/nvme/nvme_pci.c ============================================================================== --- head/sys/dev/nvme/nvme_pci.c Thu Aug 22 20:26:20 2019 (r351405) +++ head/sys/dev/nvme/nvme_pci.c Thu Aug 22 21:12:51 2019 (r351406) @@ -62,7 +62,8 @@ static driver_t nvme_pci_driver = { }; DRIVER_MODULE(nvme, pci, nvme_pci_driver, nvme_devclass, NULL, 0); -MODULE_VERSION(nvme_pci, 1); +MODULE_VERSION(nvme, 1); +MODULE_DEPEND(nvme, cam, 1, 1, 1); static struct _pcsid { From owner-svn-src-head@freebsd.org Thu Aug 22 21:27:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04734D30CE; Thu, 22 Aug 2019 21:27:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DyKm6Bcjz3wyQ; Thu, 22 Aug 2019 21:27:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 583DB12A12; Thu, 22 Aug 2019 21:27:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r351406 - head/sys/dev/nvme To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201908222112.x7MLCpbt023647@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Thu, 22 Aug 2019 14:27:20 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: <201908222112.x7MLCpbt023647@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 21:27:25 -0000 On 8/22/19 2:12 PM, Warner Losh wrote: > Author: imp > Date: Thu Aug 22 21:12:51 2019 > New Revision: 351406 > URL: https://svnweb.freebsd.org/changeset/base/351406 > > Log: > We need to define version 1 of nvme, not nvme_foo. Otherwise nvd won't > load and people who pull in nvme/nvd from modules can't load nvd.ko > since it depends on nvme, not nvme_foo. The duplicate doesn't matter > since kldxref properly handles that case. I would perhaps have put the MODULE_VERSION for nvme and its dependency on cam into nvme.c instead of duplicating it. I think that is more consistent with what we have done elsewhere in the tree. -- John Baldwin From owner-svn-src-head@freebsd.org Thu Aug 22 21:40:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 207FED33E0; Thu, 22 Aug 2019 21:40:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DydP01Lpz3xXg; Thu, 22 Aug 2019 21:40:57 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEDEBA612; Thu, 22 Aug 2019 21:40:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7MLeuBe036695; Thu, 22 Aug 2019 21:40:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MLeuLY036694; Thu, 22 Aug 2019 21:40:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201908222140.x7MLeuLY036694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Aug 2019 21:40:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351407 - head/lib/libc/mips/gen X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/mips/gen X-SVN-Commit-Revision: 351407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 21:40:57 -0000 Author: kevans Date: Thu Aug 22 21:40:56 2019 New Revision: 351407 URL: https://svnweb.freebsd.org/changeset/base/351407 Log: libc: mips: remove unused longjmp.c Reviewed by: imp, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21330 Deleted: head/lib/libc/mips/gen/longjmp.c From owner-svn-src-head@freebsd.org Thu Aug 22 21:42:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B937CD367F; Thu, 22 Aug 2019 21:42:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Dyfr4WZdz3xvB; Thu, 22 Aug 2019 21:42:12 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63DEAA684; Thu, 22 Aug 2019 21:42:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7MLgC12041420; Thu, 22 Aug 2019 21:42:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MLgCb6041419; Thu, 22 Aug 2019 21:42:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201908222142.x7MLgCb6041419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Aug 2019 21:42:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351408 - head/stand/libsa/mips X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/libsa/mips X-SVN-Commit-Revision: 351408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 21:42:12 -0000 Author: kevans Date: Thu Aug 22 21:42:11 2019 New Revision: 351408 URL: https://svnweb.freebsd.org/changeset/base/351408 Log: libsa: mips: use _JB_* from machine/asm.h, remove regnum dep This brings the libsa/mips _setjmp implementation closer to parity with the libc version. Reviewed by: imp, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21330 Modified: head/stand/libsa/mips/_setjmp.S Modified: head/stand/libsa/mips/_setjmp.S ============================================================================== --- head/stand/libsa/mips/_setjmp.S Thu Aug 22 21:40:56 2019 (r351407) +++ head/stand/libsa/mips/_setjmp.S Thu Aug 22 21:42:11 2019 (r351408) @@ -36,7 +36,6 @@ * $FreeBSD$ */ -#include #include #if 0 @@ -59,19 +58,19 @@ LEAF(_setjmp) .set noreorder - REG_LI v0, 0xACEDBADE # sigcontext magic number - REG_S ra, (2 * SZREG)(a0) # sc_pc = return address - REG_S v0, (3 * SZREG)(a0) # saved in sc_regs[0] - REG_S s0, ((S0 + 3) * SZREG)(a0) - REG_S s1, ((S1 + 3) * SZREG)(a0) - REG_S s2, ((S2 + 3) * SZREG)(a0) - REG_S s3, ((S3 + 3) * SZREG)(a0) - REG_S s4, ((S4 + 3) * SZREG)(a0) - REG_S s5, ((S5 + 3) * SZREG)(a0) - REG_S s6, ((S6 + 3) * SZREG)(a0) - REG_S s7, ((S7 + 3) * SZREG)(a0) - REG_S sp, ((SP + 3) * SZREG)(a0) - REG_S s8, ((S8 + 3) * SZREG)(a0) + REG_LI v0, _JB_MAGIC__SETJMP # sigcontext magic number + REG_S v0, (_JB_MAGIC * SZREG)(a0) # saved in sc_regs[0] + REG_S ra, (_JB_REG_RA * SZREG)(a0) # sc_pc = return address + REG_S s0, (_JB_REG_S0 * SZREG)(a0) + REG_S s1, (_JB_REG_S1 * SZREG)(a0) + REG_S s2, (_JB_REG_S2 * SZREG)(a0) + REG_S s3, (_JB_REG_S3 * SZREG)(a0) + REG_S s4, (_JB_REG_S4 * SZREG)(a0) + REG_S s5, (_JB_REG_S5 * SZREG)(a0) + REG_S s6, (_JG_REG_S6 * SZREG)(a0) + REG_S s7, (_JB_REG_S7 * SZREG)(a0) + REG_S sp, (_JB_REG_SP * SZREG)(a0) + REG_S s8, (_JB_REG_S8 * SZREG)(a0) j ra move v0, zero END(_setjmp) @@ -82,21 +81,21 @@ LEAF(_longjmp) .cprestore 16 #endif .set noreorder - REG_L v0, (3 * SZREG)(a0) # get magic number - REG_L ra, (2 * SZREG)(a0) - bne v0, 0xACEDBADE, botch # jump if error + REG_L v0, (_JB_MAGIC * SZREG)(a0) # get magic number + REG_L ra, (_JB_REG_RA * SZREG)(a0) + bne v0, _JB_MAGIC__SETJMP, botch # jump if error addu sp, sp, 32 # does not matter, sanity - REG_L s0, ((S0 + 3) * SZREG)(a0) - REG_L s1, ((S1 + 3) * SZREG)(a0) - REG_L s2, ((S2 + 3) * SZREG)(a0) - REG_L s3, ((S3 + 3) * SZREG)(a0) - REG_L s4, ((S4 + 3) * SZREG)(a0) - REG_L s5, ((S5 + 3) * SZREG)(a0) - REG_L s6, ((S6 + 3) * SZREG)(a0) - REG_L s7, ((S7 + 3) * SZREG)(a0) - REG_L sp, ((SP + 3) * SZREG)(a0) - REG_L s8, ((S8 + 3) * SZREG)(a0) + REG_L s0, (_JB_REG_S0 * SZREG)(a0) + REG_L s1, (_JB_REG_S1 * SZREG)(a0) + REG_L s2, (_JB_REG_S2 * SZREG)(a0) + REG_L s3, (_JB_REG_S3 * SZREG)(a0) + REG_L s4, (_JB_REG_S4 * SZREG)(a0) + REG_L s5, (_JB_REG_S5 * SZREG)(a0) + REG_L s6, (_JB_REG_S6 * SZREG)(a0) + REG_L s7, (_JB_REG_S7 * SZREG)(a0) + REG_L sp, (_JB_REG_SP * SZREG)(a0) + REG_L s8, (_JB_REG_S8 * SZREG)(a0) j ra move v0, a1 From owner-svn-src-head@freebsd.org Thu Aug 22 21:43:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 464EED370E; Thu, 22 Aug 2019 21:43:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DyhD0HhTz3y5M; Thu, 22 Aug 2019 21:43:24 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B772CA7BC; Thu, 22 Aug 2019 21:43:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7MLhNOV041518; Thu, 22 Aug 2019 21:43:23 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MLhMhS041510; Thu, 22 Aug 2019 21:43:22 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201908222143.x7MLhMhS041510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Aug 2019 21:43:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351409 - in head: lib/libc/mips/gen lib/libproc lib/libthread_db/arch/mips sys/mips/include tests/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: lib/libc/mips/gen lib/libproc lib/libthread_db/arch/mips sys/mips/include tests/sys/kern X-SVN-Commit-Revision: 351409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 21:43:24 -0000 Author: kevans Date: Thu Aug 22 21:43:21 2019 New Revision: 351409 URL: https://svnweb.freebsd.org/changeset/base/351409 Log: mips: hide regnum definitions behind _KERNEL/_WANT_MIPS_REGNUM machine/regnum.h ends up being included by sys/procfs.h and sys/ptrace.h via machine/reg.h. Many of the regnum definitions are too short and too generic to be exposing to any userland application including one of these two headers. Moreover, these actively cause build failures in googletest (template expanding to template ). Hide the definitions behind _KERNEL or _WANT_MIPS_REGNUM, and patch all of the userland consumers to define as needed. Discussed with: imp, jhb Reviewed by: imp, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21330 Modified: head/lib/libc/mips/gen/_setjmp.S head/lib/libc/mips/gen/makecontext.c head/lib/libc/mips/gen/setjmp.S head/lib/libc/mips/gen/sigsetjmp.S head/lib/libproc/proc_regs.c head/lib/libthread_db/arch/mips/libpthread_md.c head/sys/mips/include/regnum.h head/tests/sys/kern/ptrace_test.c Modified: head/lib/libc/mips/gen/_setjmp.S ============================================================================== --- head/lib/libc/mips/gen/_setjmp.S Thu Aug 22 21:42:11 2019 (r351408) +++ head/lib/libc/mips/gen/_setjmp.S Thu Aug 22 21:43:21 2019 (r351409) @@ -34,7 +34,6 @@ #include __FBSDID("$FreeBSD$"); -#include #include "SYS.h" Modified: head/lib/libc/mips/gen/makecontext.c ============================================================================== --- head/lib/libc/mips/gen/makecontext.c Thu Aug 22 21:42:11 2019 (r351408) +++ head/lib/libc/mips/gen/makecontext.c Thu Aug 22 21:43:21 2019 (r351409) @@ -39,6 +39,7 @@ __RCSID("$NetBSD: makecontext.c,v 1.5 2009/12/14 01:07 #include #include +#define _WANT_MIPS_REGNUM #include #include Modified: head/lib/libc/mips/gen/setjmp.S ============================================================================== --- head/lib/libc/mips/gen/setjmp.S Thu Aug 22 21:42:11 2019 (r351408) +++ head/lib/libc/mips/gen/setjmp.S Thu Aug 22 21:43:21 2019 (r351409) @@ -34,7 +34,6 @@ #include __FBSDID("$FreeBSD$"); -#include #if defined(LIBC_SCCS) && !defined(lint) ASMSTR("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93") Modified: head/lib/libc/mips/gen/sigsetjmp.S ============================================================================== --- head/lib/libc/mips/gen/sigsetjmp.S Thu Aug 22 21:42:11 2019 (r351408) +++ head/lib/libc/mips/gen/sigsetjmp.S Thu Aug 22 21:43:21 2019 (r351409) @@ -34,7 +34,6 @@ #include __FBSDID("$FreeBSD$"); -#include #if defined(LIBC_SCCS) && !defined(lint) ASMSTR("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93") ASMSTR("$NetBSD: sigsetjmp.S,v 1.8 2005/09/17 11:49:39 tsutsui Exp $") Modified: head/lib/libproc/proc_regs.c ============================================================================== --- head/lib/libproc/proc_regs.c Thu Aug 22 21:42:11 2019 (r351408) +++ head/lib/libproc/proc_regs.c Thu Aug 22 21:43:21 2019 (r351409) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include +#define _WANT_MIPS_REGNUM #include #include Modified: head/lib/libthread_db/arch/mips/libpthread_md.c ============================================================================== --- head/lib/libthread_db/arch/mips/libpthread_md.c Thu Aug 22 21:42:11 2019 (r351408) +++ head/lib/libthread_db/arch/mips/libpthread_md.c Thu Aug 22 21:43:21 2019 (r351409) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include +#define _WANT_MIPS_REGNUM #include #include #include Modified: head/sys/mips/include/regnum.h ============================================================================== --- head/sys/mips/include/regnum.h Thu Aug 22 21:42:11 2019 (r351408) +++ head/sys/mips/include/regnum.h Thu Aug 22 21:43:21 2019 (r351409) @@ -44,11 +44,15 @@ #ifndef _MACHINE_REGNUM_H_ #define _MACHINE_REGNUM_H_ +#define NUMSAVEREGS 40 +#define NUMFPREGS 34 + /* * Location of the saved registers relative to ZERO. * This must match struct trapframe defined in frame.h exactly. * This must also match regdef.h. */ +#if defined(_KERNEL) || defined(_WANT_MIPS_REGNUM) #define ZERO 0 #define AST 1 #define V0 2 @@ -105,7 +109,6 @@ */ #define IC 38 #define DUMMY 39 /* for 8 byte alignment */ -#define NUMSAVEREGS 40 /* * Pseudo registers so we save a complete set of registers regardless of @@ -164,10 +167,6 @@ #define FSR (FPBASE+32) #define FIR (FPBASE+33) -#define NUMFPREGS 34 - -#define NREGS (NUMSAVEREGS + NUMFPREGS) - /* * Index of FP registers in 'struct frame', relative to the base * of the FP registers in frame (i.e., *not* including the general @@ -207,5 +206,7 @@ #define F31_NUM (31) #define FSR_NUM (32) #define FIR_NUM (33) + +#endif /* _KERNEL || _WANT_MIPS_REGNUM */ #endif /* !_MACHINE_REGNUM_H_ */ Modified: head/tests/sys/kern/ptrace_test.c ============================================================================== --- head/tests/sys/kern/ptrace_test.c Thu Aug 22 21:42:11 2019 (r351408) +++ head/tests/sys/kern/ptrace_test.c Thu Aug 22 21:43:21 2019 (r351409) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#define _WANT_MIPS_REGNUM #include #include #include From owner-svn-src-head@freebsd.org Thu Aug 22 21:49:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CD51D38D4; Thu, 22 Aug 2019 21:49:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Dypy3WjDz3yHs; Thu, 22 Aug 2019 21:49:14 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A962A7C4; Thu, 22 Aug 2019 21:49:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7MLnE6c041839; Thu, 22 Aug 2019 21:49:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MLnEfq041838; Thu, 22 Aug 2019 21:49:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201908222149.x7MLnEfq041838@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Aug 2019 21:49:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351410 - head/stand/libsa/mips X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/libsa/mips X-SVN-Commit-Revision: 351410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 21:49:14 -0000 Author: kevans Date: Thu Aug 22 21:49:13 2019 New Revision: 351410 URL: https://svnweb.freebsd.org/changeset/base/351410 Log: libsa: mips: fix typo that had slipped into the diff on local machine MFC after: 1 week X-MFC-With: r351408 Modified: head/stand/libsa/mips/_setjmp.S Modified: head/stand/libsa/mips/_setjmp.S ============================================================================== --- head/stand/libsa/mips/_setjmp.S Thu Aug 22 21:43:21 2019 (r351409) +++ head/stand/libsa/mips/_setjmp.S Thu Aug 22 21:49:13 2019 (r351410) @@ -67,7 +67,7 @@ LEAF(_setjmp) REG_S s3, (_JB_REG_S3 * SZREG)(a0) REG_S s4, (_JB_REG_S4 * SZREG)(a0) REG_S s5, (_JB_REG_S5 * SZREG)(a0) - REG_S s6, (_JG_REG_S6 * SZREG)(a0) + REG_S s6, (_JB_REG_S6 * SZREG)(a0) REG_S s7, (_JB_REG_S7 * SZREG)(a0) REG_S sp, (_JB_REG_SP * SZREG)(a0) REG_S s8, (_JB_REG_S8 * SZREG)(a0) From owner-svn-src-head@freebsd.org Thu Aug 22 21:56:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08BA5D3B7D; Thu, 22 Aug 2019 21:56:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Dyyz6Nfnz3yhh; Thu, 22 Aug 2019 21:56:11 +0000 (UTC) (envelope-from imp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC3ADA988; Thu, 22 Aug 2019 21:56:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7MLuBZL047344; Thu, 22 Aug 2019 21:56:11 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7MLuBZH047343; Thu, 22 Aug 2019 21:56:11 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908222156.x7MLuBZH047343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Aug 2019 21:56:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351411 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 351411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 21:56:12 -0000 Author: imp Date: Thu Aug 22 21:56:11 2019 New Revision: 351411 URL: https://svnweb.freebsd.org/changeset/base/351411 Log: When we have errors resetting the device before we allocate the queues, don't try to tear them down in the ctrlr_destroy path. Otherwise, we dereference queue structures that are NULL and we trap. This fix is incomplete: we leak IRQ and MSI resources when this happens. That's preferable to a crash but still should be fixed. Modified: head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Thu Aug 22 21:49:13 2019 (r351410) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Aug 22 21:56:11 2019 (r351411) @@ -1211,12 +1211,14 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev if (ctrlr->cdev) destroy_dev(ctrlr->cdev); - if (!gone) - nvme_ctrlr_destroy_qpairs(ctrlr); - for (i = 0; i < ctrlr->num_io_queues; i++) - nvme_io_qpair_destroy(&ctrlr->ioq[i]); - free(ctrlr->ioq, M_NVME); - nvme_admin_qpair_destroy(&ctrlr->adminq); + if (ctrlr->is_initialized) { + if (!gone) + nvme_ctrlr_destroy_qpairs(ctrlr); + for (i = 0; i < ctrlr->num_io_queues; i++) + nvme_io_qpair_destroy(&ctrlr->ioq[i]); + free(ctrlr->ioq, M_NVME); + nvme_admin_qpair_destroy(&ctrlr->adminq); + } /* * Notify the controller of a shutdown, even though this is due to From owner-svn-src-head@freebsd.org Thu Aug 22 23:54:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 086D8D56A1; Thu, 22 Aug 2019 23:54:36 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46F1bb41h8z43tR; Thu, 22 Aug 2019 23:54:34 +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 x7MNsQTP074840 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 22 Aug 2019 16:54:26 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x7MNsP44074839; Thu, 22 Aug 2019 16:54:25 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Thu, 22 Aug 2019 16:54:25 -0700 From: Gleb Smirnoff To: "Stephen J. Kiernan" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351244 - head/sys/dev/usb/net Message-ID: <20190822235425.GP4556@FreeBSD.org> References: <201908200106.x7K16hWT067244@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MGYHOYXEY6WxJCY8" Content-Disposition: inline In-Reply-To: <201908200106.x7K16hWT067244@repo.freebsd.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-Rspamd-Queue-Id: 46F1bb41h8z43tR X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-2.91 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.91)[-0.911,0]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 23:54:36 -0000 --MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Stephen, On Tue, Aug 20, 2019 at 01:06:43AM +0000, Stephen J. Kiernan wrote: S> Author: stevek S> Date: Tue Aug 20 01:06:43 2019 S> New Revision: 351244 S> URL: https://svnweb.freebsd.org/changeset/base/351244 S> S> Log: S> usb_ethernet.h includes a number of mii headers, but only does so in S> order to have struct mii_data available. However, it only really needs S> a forward declaration of struct mii_data for use in pointer form for S> the return type of a function prototype. S> S> Custom kernel configuration that have usb and fdt enabled, but no miibus, S> end up with compilation failures because miibus_if.h will not get S> generated. S> S> Due to the above, the following changes have been made to usb_ethernet.h: S> * remove the inclusion of mii headers S> * forward-declare struct mii_data S> * include net/ifq.h to satify the need for complete struct ifqueue This is a header (and structure) that is on a kill list :) Polluting another header moves us a bit backwards. Can you please take a look at the attached patch? It substitutes it for mbufq, as already done for many other drivers. -- Gleb Smirnoff --MGYHOYXEY6WxJCY8 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ue_rxq-mbufq.diff" Index: sys/dev/usb/net/if_axe.c =================================================================== --- sys/dev/usb/net/if_axe.c (revision 351411) +++ sys/dev/usb/net/if_axe.c (working copy) @@ -1149,7 +1149,7 @@ axe_rxeof(struct usb_ether *ue, struct usb_page_ca } } - _IF_ENQUEUE(&ue->ue_rxq, m); + (void)mbufq_enqueue(&ue->ue_rxq, m); return (0); } Index: sys/dev/usb/net/if_axge.c =================================================================== --- sys/dev/usb/net/if_axge.c (revision 351411) +++ sys/dev/usb/net/if_axge.c (working copy) @@ -1041,7 +1041,7 @@ axge_rxeof(struct usb_ether *ue, struct usb_page_c } if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); - _IF_ENQUEUE(&ue->ue_rxq, m); + (void)mbufq_enqueue(&ue->ue_rxq, m); } static void Index: sys/dev/usb/net/usb_ethernet.c =================================================================== --- sys/dev/usb/net/usb_ethernet.c (revision 351411) +++ sys/dev/usb/net/usb_ethernet.c (working copy) @@ -598,7 +598,7 @@ uether_rxmbuf(struct usb_ether *ue, struct mbuf *m m->m_pkthdr.len = m->m_len = len; /* enqueue for later when the lock can be released */ - _IF_ENQUEUE(&ue->ue_rxq, m); + (void)mbufq_enqueue(&ue->ue_rxq, m); return (0); } @@ -628,7 +628,7 @@ uether_rxbuf(struct usb_ether *ue, struct usb_page m->m_pkthdr.len = m->m_len = len; /* enqueue for later when the lock can be released */ - _IF_ENQUEUE(&ue->ue_rxq, m); + (void)mbufq_enqueue(&ue->ue_rxq, m); return (0); } @@ -641,7 +641,7 @@ uether_rxflush(struct usb_ether *ue) UE_LOCK_ASSERT(ue, MA_OWNED); for (;;) { - _IF_DEQUEUE(&ue->ue_rxq, m); + m = mbufq_dequeue(&ue->ue_rxq); if (m == NULL) break; Index: sys/dev/usb/net/usb_ethernet.h =================================================================== --- sys/dev/usb/net/usb_ethernet.h (revision 351411) +++ sys/dev/usb/net/usb_ethernet.h (working copy) @@ -46,7 +46,6 @@ #include #include #include -#include #include #include @@ -89,7 +88,7 @@ struct usb_ether { struct usb_process ue_tq; struct sysctl_ctx_list ue_sysctl_ctx; - struct ifqueue ue_rxq; + struct mbufq ue_rxq; struct usb_callout ue_watchdog; struct usb_ether_cfg_task ue_sync_task[2]; struct usb_ether_cfg_task ue_media_task[2]; Index: sys/sys/mbuf.h =================================================================== --- sys/sys/mbuf.h (revision 351411) +++ sys/sys/mbuf.h (working copy) @@ -1432,7 +1432,7 @@ static inline int mbufq_full(const struct mbufq *mq) { - return (mq->mq_len >= mq->mq_maxlen); + return (mq->mq_maxlen > 0 && mq->mq_len >= mq->mq_maxlen); } static inline int --MGYHOYXEY6WxJCY8-- From owner-svn-src-head@freebsd.org Thu Aug 22 23:57:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABB04D5971 for ; Thu, 22 Aug 2019 23:57:45 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46F1gD5gQ2z446W for ; Thu, 22 Aug 2019 23:57:44 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72f.google.com with SMTP id p13so6757446qkg.13 for ; Thu, 22 Aug 2019 16:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GNanXvTZBarcjme4+Gs9g+38Bam3f46t4/uSMBxwxvc=; b=n2KkZan0/GuthY+CxpMFNv29BIjyPNyVd6sppCYntRdcg7h4q70n2jtr/MRzx3ZJ3/ ivE3UppgKmLh6Ns+8c+9C00NUTW1y+fMAr/Y7heicyj1H9OuKowWmvIESpGmVMv1LXLs t1ibQkY0+OJUFnMXKVPMr/5tCnFd1uGBTo0m0o220I4/ExdmFu+hIi+p0XOv60PfYNu6 eqOOYotwBA6LBpEvZ0N5Cu7vvOwvhdg4Dx5UyiZXUPRMOjuvaEHYhJqKHuicBAzZax2I 95Qhjs3xzbxN5yj4hthA95CHxiJSz/5o/Nto3za6hkJw2UVz9Se3nMStr1nTucsLoTNb hefw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GNanXvTZBarcjme4+Gs9g+38Bam3f46t4/uSMBxwxvc=; b=DG0M/QcYoiih33xu/IINAC4aki73YXFoctzDI5QSaPF/CerDJqVMM8ROe4wzsXqru/ u1eZtYQzoTFogvGViWP5RF92A8qoLB7QIN8VLL7XSkKS+P1a3iUivUic66A4JIbLX/Xr qZRu6AKhnYG9eI0OcE7jXJA/Cl1TGMJMkEDU+dzlZ7yIm/PJGTIDSzVv65PhfGbP6y7c lPZJ99lJraJyE3+VHpaI8O6K+IOJnqVo6pTDVsFfVD1y6APg1aq8H/CmMtXnD11XcLxe xAqHy9eAM1b9tQvCgATBWHfL8bGWGogzZBjHLqKjc+eCsilORTpf5TEosSrzpSp8JFmT 8ofA== X-Gm-Message-State: APjAAAWrsTA5plHk7DCRInmkNYqLOT5Kuy2tfm17ACG/2C3XG3tYuhv/ RYinC0Z5+/iSsRcD5Epf2LgAj0f9D7D404J1hOE9OCu8 X-Google-Smtp-Source: APXvYqxoZs7BMaesz+GXEDdyBoqiy3+Cq6xT4NeQn4n8/sMBZTOgNwVZVoBgui34Yxg1FgPEn3UOWBF3oxokxq79crQ= X-Received: by 2002:a05:620a:621:: with SMTP id 1mr1727018qkv.380.1566518263347; Thu, 22 Aug 2019 16:57:43 -0700 (PDT) MIME-Version: 1.0 References: <201908222112.x7MLCpbt023647@repo.freebsd.org> In-Reply-To: From: Warner Losh Date: Thu, 22 Aug 2019 17:57:32 -0600 Message-ID: Subject: Re: svn commit: r351406 - head/sys/dev/nvme To: John Baldwin Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 46F1gD5gQ2z446W X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=n2KkZan0; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72f) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.95 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.99)[-0.991,0]; RCVD_IN_DNSWL_NONE(0.00)[f.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.96)[ip: (-9.49), ipnet: 2607:f8b0::/32(-2.90), asn: 15169(-2.35), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 23:57:45 -0000 On Thu, Aug 22, 2019, 3:27 PM John Baldwin wrote: > On 8/22/19 2:12 PM, Warner Losh wrote: > > Author: imp > > Date: Thu Aug 22 21:12:51 2019 > > New Revision: 351406 > > URL: https://svnweb.freebsd.org/changeset/base/351406 > > > > Log: > > We need to define version 1 of nvme, not nvme_foo. Otherwise nvd won't > > load and people who pull in nvme/nvd from modules can't load nvd.ko > > since it depends on nvme, not nvme_foo. The duplicate doesn't matter > > since kldxref properly handles that case. > > I would perhaps have put the MODULE_VERSION for nvme and its dependency > on cam into nvme.c instead of duplicating it. I think that is more > consistent > with what we have done elsewhere in the tree. > That can't be true. Doing that doesn't work. We wind up dereferencing freed memory, as we discussed on IRC. Each DRIVER_MODULE needs its own MODULE_VERSION given the current code. I'd call that a bug, but not one I could dig into today... Warner > From owner-svn-src-head@freebsd.org Fri Aug 23 00:53:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 382F4D6878; Fri, 23 Aug 2019 00:53:50 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46F2vy0QqTz46Yx; Fri, 23 Aug 2019 00:53:50 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (static-71-168-218-4.cmdnnj.fios.verizon.net [71.168.218.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jkim/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id CF533142E2; Fri, 23 Aug 2019 00:53:49 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: svn commit: r351406 - head/sys/dev/nvme To: Warner Losh , John Baldwin Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201908222112.x7MLCpbt023647@repo.freebsd.org> From: Jung-uk Kim Autocrypt: addr=jkim@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFJBztUBCAChqNyGqmFuNo0U7MBzsD+q/G6Cv0l7LGVrOAsgh34M8wIWhD+tztDWMVfn AhxNDd0ceCj2bYOe67sTQxAScEcbt2FfvPOLp9MEXb9qohZj172Gwkk7dnhOhZZKhVGVZKM4 NcsuBDUzgf4f3Vdzj4wg6WlqplnTZo8lPE4hZWvZHoFIyunPTJWenybeV1xnxK7JkUdSvQR0 fA59RfTTECMwTrSEfYGUnxIDBraxJ7Ecs/0hGQ7sljIj8WBvlRDU5fU1xfF35aw56T8POQRq F4E6RVJW3YGuTpSwgtGZOTfygcLRhAiq3dFC3JNLaTVTpM8PjOinJyt9AU6RoITGOKwDABEB AAG0Hkp1bmctdWsgS2ltIDxqa2ltQEZyZWVCU0Qub3JnPokBPQQTAQoAJwUCUkHO1QIbAwUJ E0/POwULCQgHAwUVCgkICwUWAgMBAAIeAQIXgAAKCRB8n5Ym/NvxRqyzB/wL7QtsIpeGfGIA ZPMtgXMucM3NWzomyQMln2j2efUkDKthzh9jBxgF53TjOr7imwIt0PT2k1bqctPrq5IRqnu9 mGroqaCLE3LG2/E3jEaao4k9PO6efwlioyivUo5NrqIQOQ4k3EAXw7d2y0Dk1VpTgdMrnUAB hj7lGlLqS4ydcrf24DdbCRGdEQwqd9DBeBgbWynxAJMgbZBhYVEyIHuQKkJ8qY0ibIPXXuF0 KYDeH0qUHtWV2K3srNyPtymUkBQD84Pl1GWRYx05XdUHDmnX0JV3lg0BfYJZgZv0ehPQrMfY Fd9abTkf9FHQYz1JtsC8wUuRgqElRd6+YAGf8Tt9uQENBFJBztUBCADLtSrP44El2VoJmH14 OFrlOgxzZnbn+Y/Gf1k12mJBiR+A+pBeRLD50p7AiTrjHRxO3cHcl9Dh0uf1VSbXgp8Or0ye iP/86fZPd4k5HXNmDTLL0HecPE08SCqGZ0W8vllQrokB1QxxRUB+fFMPJyMCjDAZ7P9fFTOS dTw1bJSTtOD8Sx8MpZUa9ti06bXFlVYDlaqSdgk181SSx+ZbSKkQR8CIMARlHwiLsa3Z9q9O EJr20HPyxe0AlTvwvFndH61hg7ds63eRvglwRnNON28VXO/lvKXq7Br/CiiyhFdKfINIx2Z5 htYq22tgGTW7mBURbIKoECFBTX9Lv6BXz6w9ABEBAAGJASUEGAEKAA8FAlJBztUCGwwFCRNP zzsACgkQfJ+WJvzb8UZcJQf+IsTCxUEqY7W/pT84sMg5/QD3s6ufTRncvq14fEOxCNq1Rf4Q 9P+tOFa8GZfKDGB2BFGIrW7uT5mlmKdK1vO6ZIA930y5kUsnCmBUEBJkE2ciSQk01aB/1o62 Q3Gk/F6BwtNY9OXiqF7AcAo+K/BMIaqb26QKeh+IIgK1NN9dQiq3ByTbl4zpGZa6MmsnnRTu mzGKt2nkz7vBzH6+hZp1OzGZikgjjhYWVFoJo1dvf/rv4obs0ZJEqFPQs/1Qa1dbkKBv6odB XJpPH0ssOluTY24d1XxTiKTwmWvHeQkOKRAIfD7VTtF4TesoZYkf7hsh3e3VwXhptSLFnEOi WwYofg== Message-ID: Date: Thu, 22 Aug 2019 20:53:49 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------A5AC9B068D6157EF15B1EC8F" Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 00:53:50 -0000 This is a multi-part message in MIME format. --------------A5AC9B068D6157EF15B1EC8F Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 19. 8. 22., Warner Losh wrote: > On Thu, Aug 22, 2019, 3:27 PM John Baldwin > wrote: > > On 8/22/19 2:12 PM, Warner Losh wrote: > > Author: imp > > Date: Thu Aug 22 21:12:51 2019 > > New Revision: 351406 > > URL: https://svnweb.freebsd.org/changeset/base/351406 > > > > Log: > >   We need to define version 1 of nvme, not nvme_foo. Otherwise nvd > won't > >   load and people who pull in nvme/nvd from modules can't load nvd.ko > >   since it depends on nvme, not nvme_foo. The duplicate doesn't matter > >   since kldxref properly handles that case. > > I would perhaps have put the MODULE_VERSION for nvme and its dependency > on cam into nvme.c instead of duplicating it.  I think that is more > consistent > with what we have done elsewhere in the tree. > > > That can't be true. Doing that doesn't work. We wind up dereferencing > freed memory, as we discussed on IRC. Each DRIVER_MODULE needs its own > MODULE_VERSION given the current code. I'd call that a bug, but not one > I could dig into today... FYI, the attached patch works for me. Jung-uk Kim --------------A5AC9B068D6157EF15B1EC8F Content-Type: text/x-patch; charset=UTF-8; name="nvme.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="nvme.diff" Index: sys/dev/nvme/nvme.c =================================================================== --- sys/dev/nvme/nvme.c (revision 351406) +++ sys/dev/nvme/nvme.c (working copy) @@ -57,6 +57,9 @@ MALLOC_DEFINE(M_NVME, "nvme", "nvme(4) memory allo devclass_t nvme_devclass; +MODULE_VERSION(nvme, 1); +MODULE_DEPEND(nvme, cam, 1, 1, 1); + static void nvme_init(void) { Index: sys/dev/nvme/nvme_ahci.c =================================================================== --- sys/dev/nvme/nvme_ahci.c (revision 351406) +++ sys/dev/nvme/nvme_ahci.c (working copy) @@ -54,9 +54,9 @@ static driver_t nvme_ahci_driver = { sizeof(struct nvme_controller), }; -DRIVER_MODULE(nvme, ahci, nvme_ahci_driver, nvme_devclass, NULL, 0); -MODULE_VERSION(nvme, 1); -MODULE_DEPEND(nvme, cam, 1, 1, 1); +DRIVER_MODULE(nvme_ahci, ahci, nvme_ahci_driver, nvme_devclass, NULL, 0); +MODULE_VERSION(nvme_ahci, 1); +MODULE_DEPEND(nvme_ahci, nvme, 1, 1, 1); static int nvme_ahci_probe (device_t device) Index: sys/dev/nvme/nvme_pci.c =================================================================== --- sys/dev/nvme/nvme_pci.c (revision 351406) +++ sys/dev/nvme/nvme_pci.c (working copy) @@ -61,9 +61,9 @@ static driver_t nvme_pci_driver = { sizeof(struct nvme_controller), }; -DRIVER_MODULE(nvme, pci, nvme_pci_driver, nvme_devclass, NULL, 0); -MODULE_VERSION(nvme, 1); -MODULE_DEPEND(nvme, cam, 1, 1, 1); +DRIVER_MODULE(nvme_pci, pci, nvme_pci_driver, nvme_devclass, NULL, 0); +MODULE_VERSION(nvme_pci, 1); +MODULE_DEPEND(nvme_pci, nvme, 1, 1, 1); static struct _pcsid { --------------A5AC9B068D6157EF15B1EC8F-- From owner-svn-src-head@freebsd.org Fri Aug 23 01:16:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2DB8D6DDA; Fri, 23 Aug 2019 01:16:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46F3Pm5nymz47cw; Fri, 23 Aug 2019 01:16:12 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8B60CF03; Fri, 23 Aug 2019 01:16:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7N1GCbO064821; Fri, 23 Aug 2019 01:16:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7N1GCHB064820; Fri, 23 Aug 2019 01:16:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201908230116.x7N1GCHB064820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Aug 2019 01:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351412 - head/stand/i386/boot2 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/i386/boot2 X-SVN-Commit-Revision: 351412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 01:16:13 -0000 Author: kevans Date: Fri Aug 23 01:16:12 2019 New Revision: 351412 URL: https://svnweb.freebsd.org/changeset/base/351412 Log: stand: boot2: fix amd64-xtoolchain-gcc build -Wno-missing-declarations is the GCC equivalent of -Wno-missing-prototypes... this was overlooked in r351135. MFC after: 3 days X-MFC-With: r351135 Modified: head/stand/i386/boot2/Makefile Modified: head/stand/i386/boot2/Makefile ============================================================================== --- head/stand/i386/boot2/Makefile Thu Aug 22 21:56:11 2019 (r351411) +++ head/stand/i386/boot2/Makefile Fri Aug 23 01:16:12 2019 (r351412) @@ -80,7 +80,7 @@ boot2.bin: boot2.out # For __ashldi3 .PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins -CFLAGS.ashldi3.c= -Wno-missing-prototypes +CFLAGS.ashldi3.c= -Wno-missing-prototypes -Wno-missing-declarations CLEANFILES+= ashldi3.o boot2.out: ${BTXCRT} boot2.o sio.o ashldi3.o From owner-svn-src-head@freebsd.org Fri Aug 23 01:25:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8361ED715F; Fri, 23 Aug 2019 01:25:39 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46F3cg2srcz48RV; Fri, 23 Aug 2019 01:25:39 +0000 (UTC) (envelope-from eugen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44269D0CE; Fri, 23 Aug 2019 01:25:39 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7N1PdSO070891; Fri, 23 Aug 2019 01:25:39 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7N1PdTN070890; Fri, 23 Aug 2019 01:25:39 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201908230125.x7N1PdTN070890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Fri, 23 Aug 2019 01:25:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351413 - head/usr.bin/last X-SVN-Group: head X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: head/usr.bin/last X-SVN-Commit-Revision: 351413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 01:25:39 -0000 Author: eugen Date: Fri Aug 23 01:25:38 2019 New Revision: 351413 URL: https://svnweb.freebsd.org/changeset/base/351413 Log: last(1): unbreak for 8-bit locales Ouput format of last(1) is broken for non UTF-8 locales since it got libxo(3) support. It uses strftime(3) that produces non UTF-8 strings passed to xo_emit(3) with wrong %s format - it should be %hs in this case, so xo_emit(3) produces empty output. This change is basically no-op when locale is of UTF-8 type, f.e. en_GB.UTF-8 or ru_RU.UTF-8 or sr_RS.UTF-8@latin. It fixes output for other locales. MFC after: 2 weeks Modified: head/usr.bin/last/last.c Modified: head/usr.bin/last/last.c ============================================================================== --- head/usr.bin/last/last.c Fri Aug 23 01:16:12 2019 (r351412) +++ head/usr.bin/last/last.c Fri Aug 23 01:25:38 2019 (r351413) @@ -93,6 +93,7 @@ static time_t currentout; /* current logout value */ static long maxrec; /* records to display */ static const char *file = NULL; /* utx.log file */ static int sflag = 0; /* show delta in seconds */ +static int utf8flag; /* current locale is UTF-8 */ static int width = 5; /* show seconds in delta */ static int yflag; /* show year */ static int d_first; @@ -103,6 +104,7 @@ static time_t snaptime; /* if != 0, we will only */ static void addarg(int, char *); +static const char *ctf(const char *); static time_t dateconv(char *); static void doentry(struct utmpx *); static void hostconv(char *); @@ -112,6 +114,31 @@ static int want(struct utmpx *); static void usage(void); static void wtmp(void); +static const char* +ctf(const char *fmt) { + static char buf[31]; + const char *src, *end; + char *dst; + + if (utf8flag) + return (fmt); + + end = buf + sizeof(buf); + for (src = fmt, dst = buf; dst < end; *dst++ = *src++) { + if (*src == '\0') { + *dst = '\0'; + break; + } else if (*src == '%' && *(src+1) == 's') { + *dst++ = '%'; + *dst++ = 'h'; + *dst++ = 's'; + strlcpy(dst, src+2, end - dst); + return (buf); + } + } + return (buf); +} + static void usage(void) { @@ -130,6 +157,9 @@ main(int argc, char *argv[]) (void) setlocale(LC_TIME, ""); d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); + (void) setlocale(LC_CTYPE, ""); + utf8flag = (strcmp(nl_langinfo(CODESET), "UTF-8") == 0); + argc = xo_parse_args(argc, argv); if (argc < 0) exit(1); @@ -262,7 +292,7 @@ wtmp(void) (void) strftime(ct, sizeof(ct), "%+", tm); xo_emit("\n{:utxdb/%s}", (file == NULL) ? "utx.log" : file); xo_attr("seconds", "%lu", (unsigned long) t); - xo_emit(" begins {:begins/%s}\n", ct); + xo_emit(ctf(" begins {:begins/%s}\n"), ct); xo_close_container("last-information"); } @@ -379,7 +409,7 @@ printentry(struct utmpx *bp, struct idtab *tt) break; } xo_attr("seconds", "%lu", (unsigned long)t); - xo_emit(" {:login-time/%s%c/%s}", ct, tt == NULL ? '\n' : ' '); + xo_emit(ctf(" {:login-time/%s%c/%s}"), ct, tt == NULL ? '\n' : ' '); if (tt == NULL) goto end; if (!tt->logout) { @@ -393,7 +423,7 @@ printentry(struct utmpx *bp, struct idtab *tt) tm = localtime(&tt->logout); (void) strftime(ct, sizeof(ct), "%R", tm); xo_attr("seconds", "%lu", (unsigned long)tt->logout); - xo_emit("- {:logout-time/%s}", ct); + xo_emit(ctf("- {:logout-time/%s}"), ct); } delta = tt->logout - bp->ut_tv.tv_sec; xo_attr("seconds", "%ld", (long)delta); @@ -403,9 +433,9 @@ printentry(struct utmpx *bp, struct idtab *tt) tm = gmtime(&delta); (void) strftime(ct, sizeof(ct), width >= 8 ? "%T" : "%R", tm); if (delta < 86400) - xo_emit(" ({:session-length/%s})\n", ct); + xo_emit(ctf(" ({:session-length/%s})\n"), ct); else - xo_emit(" ({:session-length/%ld+%s})\n", + xo_emit(ctf(" ({:session-length/%ld+%s})\n"), (long)delta / 86400, ct); } From owner-svn-src-head@freebsd.org Fri Aug 23 03:01:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15031D8790; Fri, 23 Aug 2019 03:01:32 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46F5lH6nfZz4D8J; Fri, 23 Aug 2019 03:01:31 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f47.google.com with SMTP id t3so16629669ioj.12; Thu, 22 Aug 2019 20:01:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=Zs6o53r0D1JgdCUZjbl6pbzz+ScDhDPsptj3QBl0yD4=; b=TQPk24oJRoxZNzwCczYiRWuQt6rPrRGeM0i+QnEeIKWrl9O+7gdBo/zIMEFZQf6rv8 qoG4VLhA6hk3ZBOdCJWSs45W9MuJn08B/74iqqxqOTUQF/8Au5H6NOB1xy9wfqq6cOq8 PXpwbZCjP+WipHWkqTI2Xu0G/cSB9wMudALTVhLA1IZPqXrRtTq8xSm6DLL9tTnSX2qg d4bQEyQvJSApJhWA6crSFQbQdtzrgD5ZyW9LJ5sc7XavWEnW67VcPNZksNbdG7FSUiuq EbxR/KMvFNScQRrnDdrA8m0i6Ap0MZTrhHd/exbpovE+JF216ZzJQdUBEH3BB09zm7JA +otA== X-Gm-Message-State: APjAAAUAzm0623M2Z4WExsqmcn60SkZm2rPCJRZYzc5wiOlLd8EeGYdn FnelNrMG3pKz3pPR51XowF8HJuvq X-Google-Smtp-Source: APXvYqwCUhrB/vCnkFmNOCP0Onm41O7U8nu1xqO2sjhhqtoPPNQjwQ8KAetVU1lgunkC3emo7nR5Pw== X-Received: by 2002:a6b:761a:: with SMTP id g26mr3875763iom.71.1566529290235; Thu, 22 Aug 2019 20:01:30 -0700 (PDT) Received: from mail-io1-f41.google.com (mail-io1-f41.google.com. [209.85.166.41]) by smtp.gmail.com with ESMTPSA id q3sm1278938ios.70.2019.08.22.20.01.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Aug 2019 20:01:29 -0700 (PDT) Received: by mail-io1-f41.google.com with SMTP id j5so16682993ioj.8; Thu, 22 Aug 2019 20:01:27 -0700 (PDT) X-Received: by 2002:a02:3745:: with SMTP id r66mr2855244jar.23.1566529287696; Thu, 22 Aug 2019 20:01:27 -0700 (PDT) MIME-Version: 1.0 References: <201908230125.x7N1PdTN070890@repo.freebsd.org> In-Reply-To: <201908230125.x7N1PdTN070890@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Thu, 22 Aug 2019 20:01:16 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r351413 - head/usr.bin/last To: Eugene Grosbein Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46F5lH6nfZz4D8J X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 03:01:32 -0000 Hi Eugene, Should this be done more generally? Last time I looked it seemed like libxo was completely locale-unaware and just assumed all input was UTF-8. It might make more sense to have libxo take locale into account when formatting %s strings. Best, Conrad On Thu, Aug 22, 2019 at 6:25 PM Eugene Grosbein wrote: > > Author: eugen > Date: Fri Aug 23 01:25:38 2019 > New Revision: 351413 > URL: https://svnweb.freebsd.org/changeset/base/351413 > > Log: > last(1): unbreak for 8-bit locales > > Ouput format of last(1) is broken for non UTF-8 locales > since it got libxo(3) support. It uses strftime(3) that produces > non UTF-8 strings passed to xo_emit(3) with wrong %s format - > it should be %hs in this case, so xo_emit(3) produces empty output. > > This change is basically no-op when locale is of UTF-8 type, > f.e. en_GB.UTF-8 or ru_RU.UTF-8 or sr_RS.UTF-8@latin. > It fixes output for other locales. > > MFC after: 2 weeks > > Modified: > head/usr.bin/last/last.c > > Modified: head/usr.bin/last/last.c > ============================================================================== > --- head/usr.bin/last/last.c Fri Aug 23 01:16:12 2019 (r351412) > +++ head/usr.bin/last/last.c Fri Aug 23 01:25:38 2019 (r351413) > @@ -93,6 +93,7 @@ static time_t currentout; /* current logout value */ > static long maxrec; /* records to display */ > static const char *file = NULL; /* utx.log file */ > static int sflag = 0; /* show delta in seconds */ > +static int utf8flag; /* current locale is UTF-8 */ > static int width = 5; /* show seconds in delta */ > static int yflag; /* show year */ > static int d_first; > @@ -103,6 +104,7 @@ static time_t snaptime; /* if != 0, we will only > */ > > static void addarg(int, char *); > +static const char *ctf(const char *); > static time_t dateconv(char *); > static void doentry(struct utmpx *); > static void hostconv(char *); > @@ -112,6 +114,31 @@ static int want(struct utmpx *); > static void usage(void); > static void wtmp(void); > > +static const char* > +ctf(const char *fmt) { > + static char buf[31]; > + const char *src, *end; > + char *dst; > + > + if (utf8flag) > + return (fmt); > + > + end = buf + sizeof(buf); > + for (src = fmt, dst = buf; dst < end; *dst++ = *src++) { > + if (*src == '\0') { > + *dst = '\0'; > + break; > + } else if (*src == '%' && *(src+1) == 's') { > + *dst++ = '%'; > + *dst++ = 'h'; > + *dst++ = 's'; > + strlcpy(dst, src+2, end - dst); > + return (buf); > + } > + } > + return (buf); > +} > + > static void > usage(void) > { > @@ -130,6 +157,9 @@ main(int argc, char *argv[]) > (void) setlocale(LC_TIME, ""); > d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); > > + (void) setlocale(LC_CTYPE, ""); > + utf8flag = (strcmp(nl_langinfo(CODESET), "UTF-8") == 0); > + > argc = xo_parse_args(argc, argv); > if (argc < 0) > exit(1); > @@ -262,7 +292,7 @@ wtmp(void) > (void) strftime(ct, sizeof(ct), "%+", tm); > xo_emit("\n{:utxdb/%s}", (file == NULL) ? "utx.log" : file); > xo_attr("seconds", "%lu", (unsigned long) t); > - xo_emit(" begins {:begins/%s}\n", ct); > + xo_emit(ctf(" begins {:begins/%s}\n"), ct); > xo_close_container("last-information"); > } > > @@ -379,7 +409,7 @@ printentry(struct utmpx *bp, struct idtab *tt) > break; > } > xo_attr("seconds", "%lu", (unsigned long)t); > - xo_emit(" {:login-time/%s%c/%s}", ct, tt == NULL ? '\n' : ' '); > + xo_emit(ctf(" {:login-time/%s%c/%s}"), ct, tt == NULL ? '\n' : ' '); > if (tt == NULL) > goto end; > if (!tt->logout) { > @@ -393,7 +423,7 @@ printentry(struct utmpx *bp, struct idtab *tt) > tm = localtime(&tt->logout); > (void) strftime(ct, sizeof(ct), "%R", tm); > xo_attr("seconds", "%lu", (unsigned long)tt->logout); > - xo_emit("- {:logout-time/%s}", ct); > + xo_emit(ctf("- {:logout-time/%s}"), ct); > } > delta = tt->logout - bp->ut_tv.tv_sec; > xo_attr("seconds", "%ld", (long)delta); > @@ -403,9 +433,9 @@ printentry(struct utmpx *bp, struct idtab *tt) > tm = gmtime(&delta); > (void) strftime(ct, sizeof(ct), width >= 8 ? "%T" : "%R", tm); > if (delta < 86400) > - xo_emit(" ({:session-length/%s})\n", ct); > + xo_emit(ctf(" ({:session-length/%s})\n"), ct); > else > - xo_emit(" ({:session-length/%ld+%s})\n", > + xo_emit(ctf(" ({:session-length/%ld+%s})\n"), > (long)delta / 86400, ct); > } > > From owner-svn-src-head@freebsd.org Fri Aug 23 05:23:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1A5DDA948; Fri, 23 Aug 2019 05:23:46 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46F8vQ4gG7z4KTv; Fri, 23 Aug 2019 05:23:46 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81E25FD47; Fri, 23 Aug 2019 05:23:46 +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 x7N5Nk91012289; Fri, 23 Aug 2019 05:23:46 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7N5Nk0M012287; Fri, 23 Aug 2019 05:23:46 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908230523.x7N5Nk0M012287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 23 Aug 2019 05:23:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351415 - in head/usr.sbin/makefs: . msdos X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in head/usr.sbin/makefs: . msdos X-SVN-Commit-Revision: 351415 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 05:23:46 -0000 Author: delphij Date: Fri Aug 23 05:23:45 2019 New Revision: 351415 URL: https://svnweb.freebsd.org/changeset/base/351415 Log: Properly update FSInfo block after generation. After populating the filesystem, write a FSInfo block with proper information. Reviewed by: emaste, cem MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21363 Modified: head/usr.sbin/makefs/msdos.c head/usr.sbin/makefs/msdos.h head/usr.sbin/makefs/msdos/msdosfs_vfsops.c Modified: head/usr.sbin/makefs/msdos.c ============================================================================== --- head/usr.sbin/makefs/msdos.c Fri Aug 23 05:04:41 2019 (r351414) +++ head/usr.sbin/makefs/msdos.c Fri Aug 23 05:23:45 2019 (r351415) @@ -203,6 +203,8 @@ msdos_makefs(const char *image, const char *dir, fsnod errx(1, "Image file `%s' not created.", image); TIMER_RESULTS(start, "msdos_populate_dir"); + if (msdosfs_fsiflush(pmp) != 0) + errx(1, "Unable to update FSInfo block."); if (debug & DEBUG_FS_MAKEFS) putchar('\n'); Modified: head/usr.sbin/makefs/msdos.h ============================================================================== --- head/usr.sbin/makefs/msdos.h Fri Aug 23 05:04:41 2019 (r351414) +++ head/usr.sbin/makefs/msdos.h Fri Aug 23 05:23:45 2019 (r351415) @@ -51,6 +51,7 @@ struct componentname { size_t cn_namelen; }; +int msdosfs_fsiflush(struct msdosfsmount *); struct msdosfsmount *msdosfs_mount(struct vnode *); int msdosfs_root(struct msdosfsmount *, struct vnode *); Modified: head/usr.sbin/makefs/msdos/msdosfs_vfsops.c ============================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_vfsops.c Fri Aug 23 05:04:41 2019 (r351414) +++ head/usr.sbin/makefs/msdos/msdosfs_vfsops.c Fri Aug 23 05:23:45 2019 (r351415) @@ -359,3 +359,33 @@ msdosfs_root(struct msdosfsmount *pmp, struct vnode *v vp->v_data = ndep; return 0; } + +/* + * If we have an FSInfo block, update it. + */ +int +msdosfs_fsiflush(struct msdosfsmount *pmp) +{ + struct fsinfo *fp; + struct buf *bp; + int error; + + if (pmp->pm_fsinfo == 0 || (pmp->pm_flags & MSDOSFS_FSIMOD) == 0) { + error = 0; + goto out; + } + error = bread(pmp->pm_devvp, pmp->pm_fsinfo, pmp->pm_BytesPerSec, + NOCRED, &bp); + if (error != 0) { + brelse(bp); + goto out; + } + fp = (struct fsinfo *)bp->b_data; + putulong(fp->fsinfree, pmp->pm_freeclustercount); + putulong(fp->fsinxtfree, pmp->pm_nxtfree); + pmp->pm_flags &= ~MSDOSFS_FSIMOD; + error = bwrite(bp); + +out: + return (error); +} From owner-svn-src-head@freebsd.org Fri Aug 23 05:24:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD79EDA9AA for ; Fri, 23 Aug 2019 05:24:13 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46F8vw6LYsz4Kcc for ; Fri, 23 Aug 2019 05:24:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x742.google.com with SMTP id p13so7224339qkg.13 for ; Thu, 22 Aug 2019 22:24:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ATqVYdg7EiguXaEPQYsvuoKgDhS/Lt3lcixvB9uAK20=; b=Fvf30ftSqtj4iAz3iLLdTm4jc4lP7SlsdJyaUs5U8zDTe4ZQuUbdTG3uOOlM/k6l8M zOWQiAUct4vq/b2LPzZAsnCWR5OcxOemyhucK7MJdtLzY3Y49zf9NIBtHI5LZ9IoQ3LF P/9iBge888wav3a96UsoiSPQAOvkJDw+16JCPmhQnjUzxi9bD81EN5cP4RPjW00s/yG6 YOrWAeModEJ3BECe/UnKSI/txnut3E4webHeRnpA82edve3A1/av1Gqko/HAQKnkXZNc NQkGUSo9NO1R4FFlFrqSJ7eQTBYRZ6hI46hPZJ7fVzeWhrwxT0e6APCL86fj9RfOpYIO wVsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ATqVYdg7EiguXaEPQYsvuoKgDhS/Lt3lcixvB9uAK20=; b=HK07G3JTd512pNTmnnG/ICjptvlrZRP2jzLNPshFgh6s13iXrnoSJ0/7CrbblnwJoz h0iSwQteABluXFP+234McJfn6cs8vW/1UnPLIxOiqG1xdBYN3+LsxIRbycOV5E9YjTzg aLhn4knncydqaEo3rNpUgxlnCBSRlJ2rOqczvjkW+Uzq2tK8CbYlpJH19XpvdtMTHd/g UsP2F43PFBx2pPGkktfQgP0nTJ5yItq4sgQe4fOH5ye4ywWsfRuOAX0/rdVEgvenihX3 cuG9Lq7A/UtGXTjZt0/Cgdf4S6l+bwI7xR2D/0uFW4WY6TlLcfEgN8JHOWoM0d2qv0Au h6xQ== X-Gm-Message-State: APjAAAXL9clfZmsCVKjyJoOcVqJ2yoKkzFkguHYjwhBUxpQXL7UHn6io 2o9Ghn9MU+nE0y5EgGDrOOyy3+uEQ1dv9Su8GBfbHg== X-Google-Smtp-Source: APXvYqyotHCXAUBb/8jusMVsviPjCSOSFNJRNqATVXnR7tg+6RSIX4KCV1jDNDcmdF6/I4VruAWEzSCtuihUQS4kEe8= X-Received: by 2002:a37:4b03:: with SMTP id y3mr2506294qka.215.1566537851537; Thu, 22 Aug 2019 22:24:11 -0700 (PDT) MIME-Version: 1.0 References: <201908222112.x7MLCpbt023647@repo.freebsd.org> In-Reply-To: From: Warner Losh Date: Thu, 22 Aug 2019 23:24:00 -0600 Message-ID: Subject: Re: svn commit: r351406 - head/sys/dev/nvme To: Jung-uk Kim Cc: John Baldwin , Warner Losh , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46F8vw6LYsz4Kcc X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=Fvf30ftS; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::742) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.33 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.94)[-0.936,0]; RCVD_IN_DNSWL_NONE(0.00)[2.4.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-0.40)[ip: (3.29), ipnet: 2607:f8b0::/32(-2.90), asn: 15169(-2.35), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 05:24:13 -0000 This creates some funky names for the modules (like nvme_pci_pci)... I'd prefer we not do that. Here's a patch that I think will create the module in a way that avoids the bug that we're hitting. It's late here, and I've not had time to test it on all the cases yet. Does it work for you? It eliminates the duplicate module message in the kernel boot I failed to notice before. Warner diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c index e694fcb7747..2963029fc06 100644 --- a/sys/dev/nvme/nvme.c +++ b/sys/dev/nvme/nvme.c @@ -364,3 +364,19 @@ nvme_completion_poll_cb(void *arg, const struct nvme_completion *cpl) memcpy(&status->cpl, cpl, sizeof(*cpl)); atomic_store_rel_int(&status->done, 1); } + +static int +nvme_modevent(module_t mod __unused, int type __unused, void *argp __unused) +{ + return (0); +} + +static moduledata_t nvme_mod = { + "nvme", + nvme_modevent, + 0 +}; + +DECLARE_MODULE(nvme, nvme_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); +MODULE_VERSION(nvme, 1); +MODULE_DEPEND(nvme, cam, 1, 1, 1); diff --git a/sys/dev/nvme/nvme_ahci.c b/sys/dev/nvme/nvme_ahci.c index 29c40d919a7..eae607bcce8 100644 --- a/sys/dev/nvme/nvme_ahci.c +++ b/sys/dev/nvme/nvme_ahci.c @@ -55,8 +55,6 @@ static driver_t nvme_ahci_driver = { }; DRIVER_MODULE(nvme, ahci, nvme_ahci_driver, nvme_devclass, NULL, 0); -MODULE_VERSION(nvme, 1); -MODULE_DEPEND(nvme, cam, 1, 1, 1); static int nvme_ahci_probe (device_t device) diff --git a/sys/dev/nvme/nvme_pci.c b/sys/dev/nvme/nvme_pci.c index 0d4923910ff..68142518404 100644 --- a/sys/dev/nvme/nvme_pci.c +++ b/sys/dev/nvme/nvme_pci.c @@ -62,8 +62,6 @@ static driver_t nvme_pci_driver = { }; DRIVER_MODULE(nvme, pci, nvme_pci_driver, nvme_devclass, NULL, 0); -MODULE_VERSION(nvme, 1); -MODULE_DEPEND(nvme, cam, 1, 1, 1); static struct _pcsid { On Thu, Aug 22, 2019 at 6:53 PM Jung-uk Kim wrote: > On 19. 8. 22., Warner Losh wrote: > > On Thu, Aug 22, 2019, 3:27 PM John Baldwin > > wrote: > > > > On 8/22/19 2:12 PM, Warner Losh wrote: > > > Author: imp > > > Date: Thu Aug 22 21:12:51 2019 > > > New Revision: 351406 > > > URL: https://svnweb.freebsd.org/changeset/base/351406 > > > > > > Log: > > > We need to define version 1 of nvme, not nvme_foo. Otherwise nvd > > won't > > > load and people who pull in nvme/nvd from modules can't load > nvd.ko > > > since it depends on nvme, not nvme_foo. The duplicate doesn't > matter > > > since kldxref properly handles that case. > > > > I would perhaps have put the MODULE_VERSION for nvme and its > dependency > > on cam into nvme.c instead of duplicating it. I think that is more > > consistent > > with what we have done elsewhere in the tree. > > > > > > That can't be true. Doing that doesn't work. We wind up dereferencing > > freed memory, as we discussed on IRC. Each DRIVER_MODULE needs its own > > MODULE_VERSION given the current code. I'd call that a bug, but not one > > I could dig into today... > > FYI, the attached patch works for me. > > Jung-uk Kim > From owner-svn-src-head@freebsd.org Fri Aug 23 05:25:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F5AEDAA2F; Fri, 23 Aug 2019 05:25:22 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46F8xG3FTtz4KlQ; Fri, 23 Aug 2019 05:25:22 +0000 (UTC) (envelope-from lwhsu@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 51DEEFD4B; Fri, 23 Aug 2019 05:25:22 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7N5PM0f012420; Fri, 23 Aug 2019 05:25:22 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7N5PMFa012419; Fri, 23 Aug 2019 05:25:22 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201908230525.x7N5PMFa012419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Fri, 23 Aug 2019 05:25:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351416 - head/lib/libc/tests/gen X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/lib/libc/tests/gen X-SVN-Commit-Revision: 351416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 05:25:22 -0000 Author: lwhsu Date: Fri Aug 23 05:25:21 2019 New Revision: 351416 URL: https://svnweb.freebsd.org/changeset/base/351416 Log: lib.libc.gen.getmntinfo_test.getmntinfo_test is unstable since 8/20, skip it in CI env temporarily for more offline diagnosis PR: 240049 Sponsored by: The FreeBSD Foundation Modified: head/lib/libc/tests/gen/getmntinfo_test.c Modified: head/lib/libc/tests/gen/getmntinfo_test.c ============================================================================== --- head/lib/libc/tests/gen/getmntinfo_test.c Fri Aug 23 05:23:45 2019 (r351415) +++ head/lib/libc/tests/gen/getmntinfo_test.c Fri Aug 23 05:25:21 2019 (r351416) @@ -57,6 +57,9 @@ ATF_TC_BODY(getmntinfo_test, tc) int nmnts; struct statfs *mntinfo; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/240049"); + /* Test bogus mode */ nmnts = getmntinfo(&mntinfo, 199); ATF_REQUIRE_MSG(nmnts == 0 && errno == EINVAL, From owner-svn-src-head@freebsd.org Fri Aug 23 06:39:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2648DBBB4; Fri, 23 Aug 2019 06:39:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FBb04kMrz4P28; Fri, 23 Aug 2019 06:39:40 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F89C189E6; Fri, 23 Aug 2019 06:39:40 +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 x7N6deuQ054209; Fri, 23 Aug 2019 06:39:40 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7N6defT054208; Fri, 23 Aug 2019 06:39:40 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908230639.x7N6defT054208@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 23 Aug 2019 06:39:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351417 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 06:39:40 -0000 Author: delphij Date: Fri Aug 23 06:39:40 2019 New Revision: 351417 URL: https://svnweb.freebsd.org/changeset/base/351417 Log: INVARIANTS: treat LA_LOCKED as the same of LA_XLOCKED in mtx_assert. The Linux lockdep API assumes LA_LOCKED semantic in lockdep_assert_held(), meaning that either a shared lock or write lock is Ok. On the other hand, the timeout code uses lc_assert() with LA_XLOCKED, and we need both to work. For mutexes, because they can not be shared (this is unique among all lock classes, and it is unlikely that we would add new lock class anytime soon), it is easier to simply extend mtx_assert to handle LA_LOCKED there, despite the change itself can be viewed as a slight abstraction violation. Reviewed by: mjg, cem, jhb MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D21362 Modified: head/sys/kern/kern_mutex.c Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Fri Aug 23 05:25:21 2019 (r351416) +++ head/sys/kern/kern_mutex.c Fri Aug 23 06:39:40 2019 (r351417) @@ -176,6 +176,21 @@ void assert_mtx(const struct lock_object *lock, int what) { + /* + * Treat LA_LOCKED as if LA_XLOCKED was asserted. + * + * Some callers of lc_assert uses LA_LOCKED to indicate that either + * a shared lock or write lock was held, while other callers uses + * the more strict LA_XLOCKED (used as MA_OWNED). + * + * Mutex is the only lock class that can not be shared, as a result, + * we can reasonably consider the caller really intends to assert + * LA_XLOCKED when they are asserting LA_LOCKED on a mutex object. + */ + if (what & LA_LOCKED) { + what &= ~LA_LOCKED; + what |= LA_XLOCKED; + } mtx_assert((const struct mtx *)lock, what); } From owner-svn-src-head@freebsd.org Fri Aug 23 07:24:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 947A8DC6D8; Fri, 23 Aug 2019 07:24:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FCZs3PVrz4R2T; Fri, 23 Aug 2019 07:24:37 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52195192DF; Fri, 23 Aug 2019 07:24:37 +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 x7N7ObLG083198; Fri, 23 Aug 2019 07:24:37 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7N7Obpv083197; Fri, 23 Aug 2019 07:24:37 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908230724.x7N7Obpv083197@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 23 Aug 2019 07:24:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351418 - head/sys/netgraph X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sys/netgraph X-SVN-Commit-Revision: 351418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 07:24:37 -0000 Author: delphij Date: Fri Aug 23 07:24:36 2019 New Revision: 351418 URL: https://svnweb.freebsd.org/changeset/base/351418 Log: Convert ng_deflate to use new zlib. This removes the last consumer of the modified zlib originally bundled with Paul's PPP implementation, which will be removed in a follow up commit. PR: 229763 Differential Revision: https://reviews.freebsd.org/D21186 Modified: head/sys/netgraph/ng_deflate.c Modified: head/sys/netgraph/ng_deflate.c ============================================================================== --- head/sys/netgraph/ng_deflate.c Fri Aug 23 06:39:40 2019 (r351417) +++ head/sys/netgraph/ng_deflate.c Fri Aug 23 07:24:36 2019 (r351418) @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include @@ -82,13 +82,9 @@ static ng_rcvdata_t ng_deflate_rcvdata; static ng_disconnect_t ng_deflate_disconnect; /* Helper functions */ -static void *z_alloc(void *, u_int items, u_int size); -static void z_free(void *, void *ptr); -static int ng_deflate_compress(node_p node, - struct mbuf *m, struct mbuf **resultp); -static int ng_deflate_decompress(node_p node, - struct mbuf *m, struct mbuf **resultp); -static void ng_deflate_reset_req(node_p node); +static int ng_deflate_compress(node_p, struct mbuf *, struct mbuf **); +static int ng_deflate_decompress(node_p, struct mbuf *, struct mbuf **); +static void ng_deflate_reset_req(node_p); /* Parse type for struct ng_deflate_config. */ static const struct ng_parse_struct_field ng_deflate_config_type_fields[] @@ -255,8 +251,6 @@ ng_deflate_rcvmsg(node_p node, item_p item, hook_p las if (priv->cfg.enable) { priv->cx.next_in = NULL; - priv->cx.zalloc = z_alloc; - priv->cx.zfree = z_free; int res; if (priv->compress) { if ((res = deflateInit2(&priv->cx, @@ -346,7 +340,6 @@ ng_deflate_rcvdata(hook_p hook, item_p item) log(LOG_NOTICE, "%s: error: %d\n", __func__, error); return (error); } - } else { /* Decompress */ if ((error = ng_deflate_decompress(node, m, &out)) != 0) { NG_FREE_ITEM(item); @@ -420,24 +413,6 @@ ng_deflate_disconnect(hook_p hook) ************************************************************************/ /* - * Space allocation and freeing routines for use by zlib routines. - */ - -static void * -z_alloc(void *notused, u_int items, u_int size) -{ - - return (malloc(items * size, M_NETGRAPH_DEFLATE, M_NOWAIT)); -} - -static void -z_free(void *notused, void *ptr) -{ - - free(ptr, M_NETGRAPH_DEFLATE); -} - -/* * Compress/encrypt a packet and put the result in a new mbuf at *resultp. * The original mbuf is not free'd. */ @@ -486,7 +461,7 @@ ng_deflate_compress(node_p node, struct mbuf *m, struc priv->cx.avail_out = outlen - 2 - DEFLATE_HDRLEN; /* Compress. */ - rtn = deflate(&priv->cx, Z_PACKET_FLUSH); + rtn = deflate(&priv->cx, Z_SYNC_FLUSH); /* Check return value. */ if (rtn != Z_OK) { @@ -499,6 +474,19 @@ ng_deflate_compress(node_p node, struct mbuf *m, struc /* Calculate resulting size. */ outlen -= priv->cx.avail_out; + /* + * Z_SYNC_FLUSH completes the current deflate block and follows + * it with an empty stored block that is three bits plus filler + * bits to the next byte, followed by four bytes (00 00 ff ff). + * RFC 1979 Section 2.1, "Data" requires the four bytes be + * removed before transmission. + */ + outlen -= 4; + MPASS(outlen > 0); + MPASS(priv->outbuf[outlen + 0] == 0x00); + MPASS(priv->outbuf[outlen + 1] == 0x00); + MPASS(priv->outbuf[outlen + 2] == 0xff); + MPASS(priv->outbuf[outlen + 3] == 0xff); /* If we can't compress this packet, send it as-is. */ if (outlen > inlen) { @@ -538,11 +526,13 @@ static int ng_deflate_decompress(node_p node, struct mbuf *m, struct mbuf **resultp) { const priv_p priv = NG_NODE_PRIVATE(node); - int outlen, inlen; + int outlen, inlen, datalen; int rtn; uint16_t proto; int offset; uint16_t rseqnum; + u_char headbuf[5]; + static u_char EMPTY_BLOCK[4] = { 0x00, 0x00, 0xff, 0xff }; /* Initialize. */ *resultp = NULL; @@ -604,7 +594,7 @@ ng_deflate_decompress(node_p node, struct mbuf *m, str priv->cx.avail_out = outlen - 1; /* Decompress. */ - rtn = inflate(&priv->cx, Z_PACKET_FLUSH); + rtn = inflate(&priv->cx, Z_SYNC_FLUSH); /* Check return value. */ if (rtn != Z_OK && rtn != Z_STREAM_END) { @@ -624,6 +614,13 @@ ng_deflate_decompress(node_p node, struct mbuf *m, str } } + /* Handle the EMPTY_BLOCK omitted by sender */ + if (inflateSyncPoint(&priv->cx)) { + priv->cx.avail_in = 4; + priv->cx.next_in = EMPTY_BLOCK; + inflate(&priv->cx, Z_SYNC_FLUSH); + } + /* Calculate resulting size. */ outlen -= priv->cx.avail_out; @@ -648,22 +645,44 @@ ng_deflate_decompress(node_p node, struct mbuf *m, str priv->stats.FramesPlain++; priv->stats.OutOctets+=outlen; - } else { /* Packet is not compressed, just update dictionary. */ + } else { + /* Packet is not compressed, just update dictionary. */ priv->stats.FramesUncomp++; + + /* + * Fake a header for uncompressed data block + */ + datalen = inlen - offset + 1; + headbuf[0] = 0x80; + headbuf[1] = datalen & 0xff; + headbuf[2] = datalen >> 8; + headbuf[3] = (~datalen) & 0xff; + headbuf[4] = (~datalen) >> 8; + + priv->cx.next_in = headbuf; + priv->cx.avail_in = sizeof(headbuf); + priv->cx.next_out = priv->outbuf; + priv->cx.avail_out = DEFLATE_BUF_SIZE; + + rtn = inflate(&priv->cx, Z_NO_FLUSH); + if (priv->inbuf[0] == 0) { - priv->cx.next_in = priv->inbuf + 1; /* compress protocol */ - priv->cx.avail_in = inlen - 1; + priv->cx.next_in = + priv->inbuf + 1; /* compress protocol */ + priv->cx.avail_in = inlen - 1; } else { - priv->cx.next_in = priv->inbuf; - priv->cx.avail_in = inlen; + priv->cx.next_in = priv->inbuf; + priv->cx.avail_in = inlen; } + priv->cx.next_out = priv->outbuf; + priv->cx.avail_out = DEFLATE_BUF_SIZE; - rtn = inflateIncomp(&priv->cx); + rtn = inflate(&priv->cx, Z_SYNC_FLUSH); /* Check return value */ if (rtn != Z_OK) { priv->stats.Errors++; - log(LOG_NOTICE, "%s: inflateIncomp error: %d (%s)\n", + log(LOG_NOTICE, "%s: inflate error: %d (%s)\n", __func__, rtn, priv->cx.msg); NG_FREE_M(m); priv->seqnum = 0; From owner-svn-src-head@freebsd.org Fri Aug 23 10:38:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7E35C0BC5; Fri, 23 Aug 2019 10:38:29 +0000 (UTC) (envelope-from eugen@freebsd.org) Received: from hz.grosbein.net (hz.grosbein.net [IPv6:2a01:4f8:c2c:26d8::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FHtY2VTXz4bdd; Fri, 23 Aug 2019 10:38:28 +0000 (UTC) (envelope-from eugen@freebsd.org) Received: from eg.sd.rdtc.ru (eg.sd.rdtc.ru [IPv6:2a03:3100:c:13:0:0:0:5]) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id x7NAcGGj089425 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Aug 2019 10:38:19 GMT (envelope-from eugen@freebsd.org) X-Envelope-From: eugen@freebsd.org X-Envelope-To: cem@freebsd.org Received: from [10.58.0.4] ([10.58.0.4]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTPS id x7NAc7Cg029537 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Fri, 23 Aug 2019 17:38:07 +0700 (+07) (envelope-from eugen@freebsd.org) Subject: Re: svn commit: r351413 - head/usr.bin/last To: cem@freebsd.org References: <201908230125.x7N1PdTN070890@repo.freebsd.org> Cc: src-committers , svn-src-all , svn-src-head From: Eugene Grosbein Message-ID: <361cc2e7-fba5-d724-dcf0-3c4ae3a8ed6f@freebsd.org> Date: Fri, 23 Aug 2019 17:38:00 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 X-Spam-Report: * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record * 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on hz.grosbein.net X-Rspamd-Queue-Id: 46FHtY2VTXz4bdd X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.93)[-0.930,0]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 10:38:29 -0000 23.08.2019 10:01, Conrad Meyer wrote: > Should this be done more generally? Last time I looked it seemed like > libxo was completely locale-unaware and just assumed all input was > UTF-8. It might make more sense to have libxo take locale into > account when formatting %s strings. libxo is locale-aware but in its own quite peculiar way, as libxo(3) tells: > For strings, the 'h' and 'l' modifiers affect the interpretation of the > bytes pointed to argument. The default '%s' string is a 'char *' pointer > to a string encoded as UTF-8. Since UTF-8 is compatible with ASCII data, > a normal 7-bit ASCII string can be used. "%ls" expects a "wchar_t *" > pointer to a wide-character string, encoded as 32-bit Unicode values. > "%hs" expects a "char *" pointer to a multi-byte string encoded with the > current locale, as given by the LC_CTYPE, LANG, or LC_ALL environment > variables. I'd like it detect UTF-8 automatically instead with strcmp(nl_langinfo(CODESET), "UTF-8") but I'm not going to hack libxo code myself as I'm not familiar with its design. From owner-svn-src-head@freebsd.org Fri Aug 23 11:13:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C859FC15EB; Fri, 23 Aug 2019 11:13:49 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [IPv6:2a01:4f8:c2c:26d8::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FJgJ5TXDz4d9m; Fri, 23 Aug 2019 11:13:48 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (eg.sd.rdtc.ru [IPv6:2a03:3100:c:13:0:0:0:5]) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id x7NBDiau089852 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Aug 2019 11:13:45 GMT (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: cem@freebsd.org Received: from [10.58.0.4] ([10.58.0.4]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTPS id x7NBDaKk029892 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Fri, 23 Aug 2019 18:13:36 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: svn commit: r351413 - head/usr.bin/last To: cem@freebsd.org References: <201908230125.x7N1PdTN070890@repo.freebsd.org> <361cc2e7-fba5-d724-dcf0-3c4ae3a8ed6f@freebsd.org> Cc: src-committers , svn-src-all , svn-src-head From: Eugene Grosbein Message-ID: <6af6c95a-4978-6898-4191-01e734ccb298@grosbein.net> Date: Fri, 23 Aug 2019 18:13:30 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <361cc2e7-fba5-d724-dcf0-3c4ae3a8ed6f@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,LOCAL_FROM, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Report: * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record * -0.0 SPF_PASS SPF: sender matches SPF record * 2.6 LOCAL_FROM From my domains X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on hz.grosbein.net X-Rspamd-Queue-Id: 46FJgJ5TXDz4d9m X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=permerror (mx1.freebsd.org: domain of eugen@grosbein.net uses mechanism not recognized by this client) smtp.mailfrom=eugen@grosbein.net X-Spamd-Result: default: False [-4.25 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[grosbein.net]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-1.24)[ip: (-2.36), ipnet: 2a01:4f8::/29(-1.96), asn: 24940(-1.86), country: DE(-0.01)]; R_SPF_PERMFAIL(0.00)[]; NEURAL_HAM_SHORT(-0.91)[-0.914,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 11:13:49 -0000 23.08.2019 17:38, Eugene Grosbein wrote: >> Should this be done more generally? Last time I looked it seemed like >> libxo was completely locale-unaware and just assumed all input was >> UTF-8. It might make more sense to have libxo take locale into >> account when formatting %s strings. > > libxo is locale-aware but in its own quite peculiar way, as libxo(3) tells: >> For strings, the 'h' and 'l' modifiers affect the interpretation of the >> bytes pointed to argument. The default '%s' string is a 'char *' pointer >> to a string encoded as UTF-8. Since UTF-8 is compatible with ASCII data, >> a normal 7-bit ASCII string can be used. "%ls" expects a "wchar_t *" >> pointer to a wide-character string, encoded as 32-bit Unicode values. >> "%hs" expects a "char *" pointer to a multi-byte string encoded with the >> current locale, as given by the LC_CTYPE, LANG, or LC_ALL environment >> variables. Sorry, this is from xo_format(5) actually. From owner-svn-src-head@freebsd.org Fri Aug 23 12:11:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CFCB3C33F5; Fri, 23 Aug 2019 12:11:46 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FKyB59wfz3Bwm; Fri, 23 Aug 2019 12:11:46 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 939E21C5CC; Fri, 23 Aug 2019 12:11:46 +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 x7NCBkIH055049; Fri, 23 Aug 2019 12:11:46 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NCBkZd055048; Fri, 23 Aug 2019 12:11:46 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201908231211.x7NCBkZd055048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Fri, 23 Aug 2019 12:11:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351421 - head/tests/sys/netpfil/common X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/common X-SVN-Commit-Revision: 351421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 12:11:46 -0000 Author: kp Date: Fri Aug 23 12:11:46 2019 New Revision: 351421 URL: https://svnweb.freebsd.org/changeset/base/351421 Log: netpfil tests: Add forward test for the three firewalls Submitted by: Ahsan Barkati Reviewed by: kp Sponsored by: Google, Inc. (GSoC 2019) Differential Revision: https://reviews.freebsd.org/D21321 Added: head/tests/sys/netpfil/common/forward.sh (contents, props changed) Modified: head/tests/sys/netpfil/common/Makefile Modified: head/tests/sys/netpfil/common/Makefile ============================================================================== --- head/tests/sys/netpfil/common/Makefile Fri Aug 23 10:12:42 2019 (r351420) +++ head/tests/sys/netpfil/common/Makefile Fri Aug 23 12:11:46 2019 (r351421) @@ -9,7 +9,8 @@ ATF_TESTS_SH+= \ pass_block \ nat \ tos \ - fragments + fragments \ + forward ${PACKAGE}FILES+= \ utils.subr \ Added: head/tests/sys/netpfil/common/forward.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/common/forward.sh Fri Aug 23 12:11:46 2019 (r351421) @@ -0,0 +1,101 @@ +#- +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Ahsan Barkati +# +# 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$ +# + +. $(atf_get_srcdir)/utils.subr +. $(atf_get_srcdir)/runner.subr + +v4_head() +{ + atf_set descr 'Basic forwarding test' + atf_set require.user root + atf_set require.progs scapy +} + +v4_body() +{ + firewall=$1 + firewall_init $firewall + + epair_send=$(vnet_mkepair) + ifconfig ${epair_send}a 192.0.2.1/24 up + + epair_recv=$(vnet_mkepair) + ifconfig ${epair_recv}a up + + vnet_mkjail iron ${epair_send}b ${epair_recv}b + jexec iron ifconfig ${epair_send}b 192.0.2.2/24 up + jexec iron ifconfig ${epair_recv}b 198.51.100.2/24 up + jexec iron sysctl net.inet.ip.forwarding=1 + jexec iron arp -s 198.51.100.3 00:01:02:03:04:05 + route add -net 198.51.100.0/24 192.0.2.2 + + + atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \ + --sendif ${epair_send}a \ + --to 198.51.100.3 \ + --recvif ${epair_recv}a + + firewall_config "iron" ${firewall} \ + "pf" \ + "block in" \ + "ipfw" \ + "ipfw -q add 100 deny all from any to any in" \ + "ipf" \ + "block in all" \ + + atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \ + --sendif ${epair_send}a \ + --to 198.51.100.3 \ + --recvif ${epair_recv}a + + firewall_config "iron" ${firewall} \ + "pf" \ + "block out" \ + "ipfw" \ + "ipfw -q add 100 deny all from any to any out" \ + "ipf" \ + "block out all" \ + + atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \ + --sendif ${epair_send}a \ + --to 198.51.100.3 \ + --recv ${epair_recv}a +} + +v4_cleanup() +{ + firewall=$1 + firewall_cleanup $firewall +} + +setup_tests \ + v4 \ + pf \ + ipfw \ + ipf From owner-svn-src-head@freebsd.org Fri Aug 23 15:17:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04061C79BB; Fri, 23 Aug 2019 15:17:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FQ406Jvkz3MyM; Fri, 23 Aug 2019 15:17:04 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA6871E7AF; Fri, 23 Aug 2019 15:17:04 +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 x7NFH45P062256; Fri, 23 Aug 2019 15:17:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NFH4fG062255; Fri, 23 Aug 2019 15:17:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908231517.x7NFH4fG062255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Aug 2019 15:17:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351422 - head/usr.sbin/pciconf X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/usr.sbin/pciconf X-SVN-Commit-Revision: 351422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 15:17:05 -0000 Author: mav Date: Fri Aug 23 15:17:04 2019 New Revision: 351422 URL: https://svnweb.freebsd.org/changeset/base/351422 Log: Report Clock Power Management support and status. Since we already report ASPM, why not to go further. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/usr.sbin/pciconf/cap.c Modified: head/usr.sbin/pciconf/cap.c ============================================================================== --- head/usr.sbin/pciconf/cap.c Fri Aug 23 12:11:46 2019 (r351421) +++ head/usr.sbin/pciconf/cap.c Fri Aug 23 15:17:04 2019 (r351422) @@ -515,6 +515,11 @@ cap_express(int fd, struct pci_conf *p, uint8_t ptr) printf(" ASPM %s(%s)", aspm_string(ctl & PCIEM_LINK_CTL_ASPMC), aspm_string((cap & PCIEM_LINK_CAP_ASPM) >> 10)); } + if ((cap & PCIEM_LINK_CAP_CLOCK_PM) != 0) { + ctl = read_config(fd, &p->pc_sel, ptr + PCIER_LINK_CTL, 2); + printf(" ClockPM %s", (ctl & PCIEM_LINK_CTL_ECPM) ? + "enabled" : "disabled"); + } if (!(flags & PCIEM_FLAGS_SLOT)) return; cap = read_config(fd, &p->pc_sel, ptr + PCIER_SLOT_CAP, 4); From owner-svn-src-head@freebsd.org Fri Aug 23 15:22:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88C9CC7B4A; Fri, 23 Aug 2019 15:22:22 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FQB635gqz3NRy; Fri, 23 Aug 2019 15:22:22 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C1971E95B; Fri, 23 Aug 2019 15:22:22 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7NFMMH3068042; Fri, 23 Aug 2019 15:22:22 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NFMLuJ068037; Fri, 23 Aug 2019 15:22:21 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908231522.x7NFMLuJ068037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 23 Aug 2019 15:22:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: . sbin/ping6 sbin/ping6/tests X-SVN-Commit-Revision: 351423 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 15:22:22 -0000 Author: asomers Date: Fri Aug 23 15:22:20 2019 New Revision: 351423 URL: https://svnweb.freebsd.org/changeset/base/351423 Log: ping6: Rename options for better consistency with ping Now equivalent options have the same flags, and nonequivalent options have different flags. This is a prelude to merging the two commands. Submitted by: Ján Sučan MFC: Never Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21345 Added: head/sbin/ping6/tests/ping6_c1_s8_t1.out - copied unchanged from r351394, head/sbin/ping6/tests/ping6_c1_s8_X1.out Deleted: head/sbin/ping6/tests/ping6_c1_s8_X1.out Modified: head/UPDATING head/sbin/ping6/ping6.8 head/sbin/ping6/ping6.c head/sbin/ping6/tests/Makefile head/sbin/ping6/tests/ping6_test.sh Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Aug 23 15:17:04 2019 (r351422) +++ head/UPDATING Fri Aug 23 15:22:20 2019 (r351423) @@ -26,6 +26,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20190823: + Several of ping6's options have been renamed for better consistency + with ping. If you use any of -ARWXaghmrtwx, you must update your + scripts. See ping6(8) for details. + 20190727: The vfs.fusefs.sync_unmount and vfs.fusefs.init_backgrounded sysctls and the "-o sync_unmount" and "-o init_backgrounded" mount options have Modified: head/sbin/ping6/ping6.8 ============================================================================== --- head/sbin/ping6/ping6.8 Fri Aug 23 15:17:04 2019 (r351422) +++ head/sbin/ping6/ping6.8 Fri Aug 23 15:22:20 2019 (r351423) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 22, 2014 +.Dd August 22, 2019 .Dt PING6 8 .Os .Sh NAME @@ -40,38 +40,32 @@ packets to network hosts .Sh SYNOPSIS .Nm .\" without ipsec, or new ipsec -.Op Fl DdfHmnNoqrRtvwW +.Op Fl aAdDfHnNoOquvyY .\" old ipsec .\" .Op Fl ADdEfmnNqRtvwW .Bk -words -.Op Fl a Ar addrtype -.Ek -.Bk -words .Op Fl b Ar bufsiz .Ek .Bk -words .Op Fl c Ar count .Ek .Bk -words -.Op Fl g Ar gateway +.Op Fl e Ar gateway .Ek .Bk -words -.Op Fl h Ar hoplimit -.Ek -.Bk -words .Op Fl I Ar interface .Ek .Bk -words .Op Fl i Ar wait .Ek .Bk -words -.Op Fl x Ar waittime +.Op Fl k Ar addrtype .Ek .Bk -words -.Op Fl X Ar timeout +.Op Fl l Ar preload .Ek .Bk -words -.Op Fl l Ar preload +.Op Fl m Ar hoplimit .Ek .Bk -words .\" new ipsec @@ -87,6 +81,12 @@ packets to network hosts .Op Fl s Ar packetsize .Ek .Bk -words +.Op Fl t Ar timeout +.Ek +.Bk -words +.Op Fl W Ar waittime +.Ek +.Bk -words .Op Ar hops ... .Ek .Bk -words @@ -110,10 +110,10 @@ header formatted as documented in RFC2463. The options are as follows: .Bl -tag -width Ds .\" old ipsec -.\" .It Fl A +.\" .It Fl Z .\" Enables transport-mode IPsec authentication header .\" (experimental). -.It Fl a Ar addrtype +.It Fl k Ar addrtype Generate ICMPv6 Node Information Node Addresses query, rather than echo-request. .Ar addrtype must be a string constructed of the following characters. @@ -172,7 +172,7 @@ Only the super-user may use this option. .Bf -emphasis This can be very hard on a network and should be used with caution. .Ef -.It Fl g Ar gateway +.It Fl e Ar gateway Specifies to use .Ar gateway as the next hop to the destination. @@ -182,7 +182,7 @@ Specifies to try reverse-lookup of IPv6 addresses. The .Nm utility does not try reverse-lookup unless the option is specified. -.It Fl h Ar hoplimit +.It Fl m Ar hoplimit Set the IPv6 hoplimit. .It Fl I Ar interface Source packets with the given interface address. @@ -197,12 +197,12 @@ The default is to wait for one second between each pac This option is incompatible with the .Fl f option. -.It Fl x Ar waittime +.It Fl W Ar waittime Time in milliseconds to wait for a reply for each packet sent. If a reply arrives later, the packet is not printed as replied, but considered as replied when calculating statistics. -.It Fl X Ar timeout +.It Fl t Ar timeout Specify a timeout, in seconds, before ping exits regardless of how many packets have been received. @@ -214,12 +214,12 @@ is specified, sends that many packets as fast as possible before falling into its normal mode of behavior. Only the super-user may use this option. -.It Fl m +.It Fl u By default, .Nm asks the kernel to fragment packets to fit into the minimum IPv6 MTU. The -.Fl m +.Fl u option will suppress the behavior in the following two levels: when the option is specified once, the behavior will be disabled for @@ -270,13 +270,13 @@ specifies IPsec policy to be used for the probe. Quiet output. Nothing is displayed except the summary lines at startup time and when finished. -.It Fl r +.It Fl a Audible. Include a bell .Tn ( ASCII 0x07) character in the output when any packet is received. -.It Fl R +.It Fl A Audible. Output a bell .Tn ( ASCII @@ -301,12 +301,12 @@ header data. You may need to specify .Fl b as well to extend socket buffer size. -.It Fl t +.It Fl O Generate ICMPv6 Node Information supported query types query, rather than echo-request. .Fl s has no effect if -.Fl t +.Fl O is specified. .It Fl v Verbose output. @@ -314,20 +314,20 @@ Verbose output. packets other than .Tn ECHO_RESPONSE that are received are listed. -.It Fl w +.It Fl y Generate ICMPv6 Node Information DNS Name query, rather than echo-request. .Fl s has no effect if -.Fl w +.Fl y is specified. -.It Fl W +.It Fl Y Same as -.Fl w , +.Fl y , but with old packet format based on 03 draft. This option is present for backward compatibility. .Fl s has no effect if -.Fl w +.Fl y is specified. .It Ar hops IPv6 addresses for intermediate nodes, Modified: head/sbin/ping6/ping6.c ============================================================================== --- head/sbin/ping6/ping6.c Fri Aug 23 15:17:04 2019 (r351422) +++ head/sbin/ping6/ping6.c Fri Aug 23 15:22:20 2019 (r351423) @@ -347,14 +347,14 @@ main(int argc, char *argv[]) #ifdef IPSEC_POLICY_IPSEC #define ADDOPTS "P:" #else -#define ADDOPTS "AE" +#define ADDOPTS "ZE" #endif /*IPSEC_POLICY_IPSEC*/ #endif while ((ch = getopt(argc, argv, - "a:b:c:DdfHg:h:I:i:l:mnNop:qrRS:s:tvwWx:X:" ADDOPTS)) != -1) { + "k:b:c:DdfHe:m:I:i:l:unNop:qaAS:s:OvyYW:t:" ADDOPTS)) != -1) { #undef ADDOPTS switch (ch) { - case 'a': + case 'k': { char *cp; @@ -431,13 +431,13 @@ main(int argc, char *argv[]) options |= F_FLOOD; setbuf(stdout, (char *)NULL); break; - case 'g': + case 'e': gateway = optarg; break; case 'H': options |= F_HOSTNAME; break; - case 'h': /* hoplimit */ + case 'm': /* hoplimit */ hoplimit = strtol(optarg, &e, 10); if (*optarg == '\0' || *e != '\0') errx(1, "illegal hoplimit %s", optarg); @@ -481,7 +481,7 @@ main(int argc, char *argv[]) if (preload < 0 || *optarg == '\0' || *e != '\0') errx(1, "illegal preload value -- %s", optarg); break; - case 'm': + case 'u': #ifdef IPV6_USE_MIN_MTU mflag++; break; @@ -506,10 +506,10 @@ main(int argc, char *argv[]) case 'q': options |= F_QUIET; break; - case 'r': + case 'a': options |= F_AUDIBLE; break; - case 'R': + case 'A': options |= F_MISSED; break; case 'S': @@ -543,22 +543,22 @@ main(int argc, char *argv[]) MAXDATALEN); } break; - case 't': + case 'O': options &= ~F_NOUSERDATA; options |= F_SUPTYPES; break; case 'v': options |= F_VERBOSE; break; - case 'w': + case 'y': options &= ~F_NOUSERDATA; options |= F_FQDN; break; - case 'W': + case 'Y': options &= ~F_NOUSERDATA; options |= F_FQDNOLD; break; - case 'x': + case 'W': t = strtod(optarg, &e); if (*e || e == optarg || t > (double)INT_MAX) err(EX_USAGE, "invalid timing interval: `%s'", @@ -566,7 +566,7 @@ main(int argc, char *argv[]) options |= F_WAITTIME; waittime = (int)t; break; - case 'X': + case 't': alarmtimeout = strtoul(optarg, &e, 0); if ((alarmtimeout < 1) || (alarmtimeout == ULONG_MAX)) errx(EX_USAGE, "invalid timeout: `%s'", @@ -590,7 +590,7 @@ main(int argc, char *argv[]) errx(1, "invalid security policy"); break; #else - case 'A': + case 'Z': options |= F_AUTHHDR; break; case 'E': @@ -1835,7 +1835,7 @@ pr_exthdrs(struct msghdr *mhdr) bufsize = CONTROLLEN - ((caddr_t)CMSG_DATA(cm) - (caddr_t)bufp); if (bufsize <= 0) - continue; + continue; switch (cm->cmsg_type) { case IPV6_HOPOPTS: printf(" HbH Options: "); @@ -2783,7 +2783,7 @@ nigroup(char *name, int nig_oldmcprefix) } if (valid != 1) return NULL; /*XXX*/ - + if (nig_oldmcprefix) { /* draft-ietf-ipngwg-icmp-name-lookup */ bcopy(digest, &in6.s6_addr[12], 4); @@ -2803,27 +2803,27 @@ usage(void) { (void)fprintf(stderr, #if defined(IPSEC) && !defined(IPSEC_POLICY_IPSEC) - "A" + "Z" #endif "usage: ping6 [-" - "Dd" + "aADd" #if defined(IPSEC) && !defined(IPSEC_POLICY_IPSEC) "E" #endif - "fH" + "fHnNoOq" #ifdef IPV6_USE_MIN_MTU - "m" + "u" #endif - "nNoqrRtvwW] " - "[-a addrtype] [-b bufsiz] [-c count] [-g gateway]\n" - " [-h hoplimit] [-I interface] [-i wait] [-l preload]" + "vyY] " + "[-b bufsiz] [-c count] [-e gateway]\n" + " [-I interface] [-i wait] [-k addrtype] [-l preload] " + "[-m hoplimit]\n" + " [-p pattern]" #if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) " [-P policy]" #endif - "\n" - " [-p pattern] [-S sourceaddr] [-s packetsize] " - "[-x waittime]\n" - " [-X timeout] [hops ...] host\n"); + " [-S sourceaddr] [-s packetsize]\n" + " [-t timeout] [-W waittime] [hops ...] host\n"); exit(1); } Modified: head/sbin/ping6/tests/Makefile ============================================================================== --- head/sbin/ping6/tests/Makefile Fri Aug 23 15:17:04 2019 (r351422) +++ head/sbin/ping6/tests/Makefile Fri Aug 23 15:22:20 2019 (r351423) @@ -3,6 +3,6 @@ PACKAGE= tests ATF_TESTS_SH+= ping6_test -${PACKAGE}FILES+= ping6_c1_s8_X1.out +${PACKAGE}FILES+= ping6_c1_s8_t1.out .include Copied: head/sbin/ping6/tests/ping6_c1_s8_t1.out (from r351394, head/sbin/ping6/tests/ping6_c1_s8_X1.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ping6/tests/ping6_c1_s8_t1.out Fri Aug 23 15:22:20 2019 (r351423, copy of r351394, head/sbin/ping6/tests/ping6_c1_s8_X1.out) @@ -0,0 +1,6 @@ +PING6(56=40+8+8 bytes) ::1 --> ::1 +16 bytes from ::1, icmp_seq=0 hlim= time= ms + +--- localhost ping6 statistics --- +1 packets transmitted, 1 packets received, 0.0% packet loss +round-trip min/avg/max/std-dev = /// ms Modified: head/sbin/ping6/tests/ping6_test.sh ============================================================================== --- head/sbin/ping6/tests/ping6_test.sh Fri Aug 23 15:17:04 2019 (r351422) +++ head/sbin/ping6/tests/ping6_test.sh Fri Aug 23 15:22:20 2019 (r351423) @@ -27,21 +27,21 @@ # # $FreeBSD$ -atf_test_case ping6_c1_s8_X1 -ping6_c1_s8_X1_head() { +atf_test_case ping6_c1_s8_t1 +ping6_c1_s8_t1_head() { atf_set "descr" "Stop after receiving 1 ECHO_RESPONSE packet" } -ping6_c1_s8_X1_body() { +ping6_c1_s8_t1_body() { if ! getaddrinfo -f inet6 localhost 1>/dev/null 2>&1; then atf_skip "IPv6 is not configured" fi atf_check -s exit:0 -o save:std.out -e empty \ - ping6 -c 1 -s 8 -X 1 localhost - check_ping_statistics std.out $(atf_get_srcdir)/ping6_c1_s8_X1.out + ping6 -c 1 -s 8 -t 1 localhost + check_ping_statistics std.out $(atf_get_srcdir)/ping6_c1_s8_t1.out } atf_init_test_cases() { - atf_add_test_case ping6_c1_s8_X1 + atf_add_test_case ping6_c1_s8_t1 } check_ping_statistics() { From owner-svn-src-head@freebsd.org Fri Aug 23 15:24:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D763C7DDB; Fri, 23 Aug 2019 15:24:19 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FQDM1pmPz3NjF; Fri, 23 Aug 2019 15:24:19 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FEB41E984; Fri, 23 Aug 2019 15:24:19 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7NFOJc9068284; Fri, 23 Aug 2019 15:24:19 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NFOJl4068283; Fri, 23 Aug 2019 15:24:19 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908231524.x7NFOJl4068283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 23 Aug 2019 15:24:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351424 - head/sbin/ping X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/ping X-SVN-Commit-Revision: 351424 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 15:24:19 -0000 Author: asomers Date: Fri Aug 23 15:24:18 2019 New Revision: 351424 URL: https://svnweb.freebsd.org/changeset/base/351424 Log: ping: fix include guard symbol name to reflect the header file name Submitted by: Ján Sučan MFC after: 2 weeks MFC-With: 351171 Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21374 Modified: head/sbin/ping/utils.h Modified: head/sbin/ping/utils.h ============================================================================== --- head/sbin/ping/utils.h Fri Aug 23 15:22:20 2019 (r351423) +++ head/sbin/ping/utils.h Fri Aug 23 15:24:18 2019 (r351424) @@ -28,8 +28,8 @@ * $FreeBSD$ */ -#ifndef PING_H -#define PING_H 1 +#ifndef UTILS_H +#define UTILS_H 1 #include From owner-svn-src-head@freebsd.org Fri Aug 23 15:53:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A58EAC853B for ; Fri, 23 Aug 2019 15:53:19 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FQsp3F8Vz3Pyl for ; Fri, 23 Aug 2019 15:53:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72b.google.com with SMTP id m10so8577831qkk.1 for ; Fri, 23 Aug 2019 08:53:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NxAVg8SucpmXbz7R3PsLE5rEjDtyo9+OVbunW7SATAM=; b=Mxcz9NPz8JOU2C75yzVkrEvz+TXAanNh2GWvDvFziUAumE5dh7ChOr76dA08tH6BJJ G2YwtmvF5PUJMBtH21kQW9mD1cz3FPR/nJcqCfOqbL4Ex+zM3x+4jIBt0ZT151h2T6dh uygIo2MysOcKiyq98emgZpWLGwLLnRBBElxKJIeo72BnqXE81EXHNJakgJoSx/+Y1Cuv iUAuPh91d+fzHXlGoBu0/WKTtNzjfIavCL1XXzZdER+5Je2WFghckAcs0rJhhSV6fUZm e9yZBh0ZO0GPcq4YT7M5Xft5e5BuixjPOgHJvSBDQw0qE1TtBft54behiCL29zFEna7H 82ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NxAVg8SucpmXbz7R3PsLE5rEjDtyo9+OVbunW7SATAM=; b=eF96R+G77zRIdnhuJCwatQXGAOHvIOME2q1R87Rpi+pRYSPI3zUZDPMVJ7ousQ++Yw garYCdIQ4btqrtWl7S5HuGhbaFrrEDW29Yz64xWOdqejYlTv8HwcywjBT4xeZmRSbb+g TpJ+nM9DI1JFrzrZ80Ii4bJOdqKK5+MqIvmYbSo0XwfSwY95tGPBgcYgQjX/4/xSr0pD ZdiIDsgKH/xV5A7mHw9P5oriXKjcV9jloVrOrXh0271OVADuwiibmvNdlDkUeaOUG33r VPYJ0w69JaX0bvksCKYq6dB3bZzTrSg+ToyW757NeAJk8iSs/+BTpSjgUF1rB5Mays0e Lkhg== X-Gm-Message-State: APjAAAWUoDLuoD6IUJS767EkwlrrGY5YHQRd+KsYyts7v9PEBm38Sjmf j/EVrNxOX0GKrvvAxCgEJRYFR3VUHDRHy/pdAH0CrA== X-Google-Smtp-Source: APXvYqySP5pzFDFBttde27/CbSRXHHurZR80x42pgH3LjMqfahHmLW6YQG2sOE5FzeaNHoLcetFjDhXz+VF4RKbwQKo= X-Received: by 2002:a37:4804:: with SMTP id v4mr4928514qka.60.1566575596923; Fri, 23 Aug 2019 08:53:16 -0700 (PDT) MIME-Version: 1.0 References: <201908220002.x7M028Jh070116@repo.freebsd.org> <0b9d1aa1-d328-30bc-b939-f1407e236855@FreeBSD.org> In-Reply-To: <0b9d1aa1-d328-30bc-b939-f1407e236855@FreeBSD.org> From: Warner Losh Date: Fri, 23 Aug 2019 09:53:05 -0600 Message-ID: Subject: Re: svn commit: r351364 - in head/sys: crypto/blowfish crypto/chacha20 crypto/des opencrypto To: John Baldwin Cc: "Bjoern A. Zeeb" , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46FQsp3F8Vz3Pyl X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=Mxcz9NPz; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72b) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.94 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[9]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.99)[-0.992,0]; RCVD_IN_DNSWL_NONE(0.00)[b.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.95)[ip: (-9.48), ipnet: 2607:f8b0::/32(-2.88), asn: 15169(-2.34), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 15:53:19 -0000 Sorry for top posting... I had planned this for next week, but I think give this insanity of this patch, we should do it now: turn off -Werror for gcc 4.2.1 https://reviews.freebsd.org/D21378 has the review. There's no benefit to these head-scratcher changes when we can get the same benefit by ignoring gcc 4.2.1 errors as discussed on arch@. Warner On Thu, Aug 22, 2019 at 10:46 AM John Baldwin wrote: > On 8/22/19 2:39 AM, Bjoern A. Zeeb wrote: > > On 22 Aug 2019, at 0:02, John Baldwin wrote: > > > > Hi, > > > >> Author: jhb > >> Date: Thu Aug 22 00:02:08 2019 > >> New Revision: 351364 > >> URL: https://svnweb.freebsd.org/changeset/base/351364 > >> > >> Log: > >> Use 'const' for keys and IVs passed to software encryption > >> algorithms. > >> > >> Specifically, use 'const' for the key passed to the 'setkey' method > >> and 'const' for the 'iv' passed to the 'reinit' method. > >> > >> Reviewed by: cem > >> Sponsored by: Chelsio Communications > >> Differential Revision: https://reviews.freebsd.org/D21347 > > > > can you please review and commit this one to make gcc platforms a bit > > more happy again (I tested a sparc64 GENERIC kernel build): > > I will get tinderbox happy. > > > Index: sys/opencrypto/xform_des3.c > > =================================================================== > > --- sys/opencrypto/xform_des3.c (revision 351384) > > +++ sys/opencrypto/xform_des3.c (working copy) > > @@ -100,9 +100,9 @@ des3_setkey(u_int8_t **sched, const u_int8_t *key, > > p = KMALLOC(3*sizeof (des_key_schedule), > > M_CRYPTO_DATA, M_NOWAIT|M_ZERO); > > if (p != NULL) { > > - des_set_key((const des_cblock *)(key + 0), p[0]); > > - des_set_key((const des_cblock *)(key + 8), p[1]); > > - des_set_key((const des_cblock *)(key + 16), p[2]); > > + des_set_key(__DEQUALIFY(const des_cblock *,(key + 0)), > p[0]); > > + des_set_key(__DEQUALIFY(const des_cblock *,(key + 8)), > p[1]); > > + des_set_key(__DEQUALIFY(const des_cblock *,(key + 16)), > p[2]); > > This makes no sense. Why are you removing const only to add it back again? > > -- > John Baldwin > > From owner-svn-src-head@freebsd.org Fri Aug 23 16:03:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C95BC88A5; Fri, 23 Aug 2019 16:03:24 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FR5S0MCzz3QWw; Fri, 23 Aug 2019 16:03:24 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E22011F0F0; Fri, 23 Aug 2019 16:03:23 +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 x7NG3Nnv092182; Fri, 23 Aug 2019 16:03:23 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NG3Nwp092181; Fri, 23 Aug 2019 16:03:23 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908231603.x7NG3Nwp092181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Aug 2019 16:03:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351425 - head/usr.bin/vtfontcvt X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.bin/vtfontcvt X-SVN-Commit-Revision: 351425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 16:03:24 -0000 Author: emaste Date: Fri Aug 23 16:03:23 2019 New Revision: 351425 URL: https://svnweb.freebsd.org/changeset/base/351425 Log: vtfontcvt: simplify rshift_row We don't need to specify the buffer size in both bytes and bits. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/vtfontcvt/vtfontcvt.c Modified: head/usr.bin/vtfontcvt/vtfontcvt.c ============================================================================== --- head/usr.bin/vtfontcvt/vtfontcvt.c Fri Aug 23 15:24:18 2019 (r351424) +++ head/usr.bin/vtfontcvt/vtfontcvt.c Fri Aug 23 16:03:23 2019 (r351425) @@ -224,38 +224,19 @@ add_char(unsigned curchar, unsigned map_idx, uint8_t * } /* - * Right-shift glyph row by _shift_ bits. Row _len_ bits wide, _size_ bytes. + * Right-shift glyph row. */ -static int -rshift_row(uint8_t *line, size_t size, size_t len, size_t shift) +static void +rshift_row(uint8_t *buf, size_t len, size_t shift) { - size_t d, s, i; - uint16_t t; + ssize_t i, off_byte = shift / 8; + size_t off_bit = shift % 8; - assert(size > 0 && len > 0); - assert(size * 8 >= len); - if (shift == 0) - return (0); - - d = shift / 8; - s = 8 - shift % 8; - i = howmany(len, 8); - - while (i > 0) { - i--; - - t = *(line + i); - *(line + i) = 0; - - t <<= s; - - if (i + d + 1 < size) - *(line + i + d + 1) |= (uint8_t)t; - if (i + d < size) - *(line + i + d) = t >> 8; - } - return (0); + return; + for (i = len - 1; i >= 0; i--) + buf[i] = (i >= off_byte ? buf[i - off_byte] >> off_bit : 0) | + (i > off_byte ? buf[i - off_byte - 1] << (8 - off_bit) : 0); } /* @@ -426,11 +407,7 @@ parse_bdf(FILE *fp, unsigned int map_idx) *(line + j) = (uint8_t)val; } - rv = rshift_row(line, wbytes * 2, bbw, - bbox - fbbox); - if (rv != 0) - goto out; - + rshift_row(line, wbytes * 2, bbox - fbbox); rv = split_row(bytes + i * wbytes, bytes_r + i * wbytes, line, dwidth); if (rv != 0) From owner-svn-src-head@freebsd.org Fri Aug 23 16:07:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26B40C8B3E; Fri, 23 Aug 2019 16:07:00 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FR9c0Dhtz3Qms; Fri, 23 Aug 2019 16:07:00 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id C50D81AE09; Fri, 23 Aug 2019 16:06:59 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [10.10.132.3] (ptr-8rh08k03k2b76lheime.18120a2.ip6.access.telenet.be [IPv6:2a02:1811:240e:402:85b6:5ec3:b20e:9ac6]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 09CBD3044B; Fri, 23 Aug 2019 18:06:57 +0200 (CEST) From: "Kristof Provost" To: "Li-Wen Hsu" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351391 - head/tests/sys/netpfil/pf Date: Fri, 23 Aug 2019 18:06:55 +0200 X-Mailer: MailMate (2.0BETAr6137) Message-ID: <691F0645-8BF0-4486-B649-74E48B43F3AB@FreeBSD.org> In-Reply-To: <201908221208.x7MC8aFp097280@repo.freebsd.org> References: <201908221208.x7MC8aFp097280@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 16:07:00 -0000 On 22 Aug 2019, at 14:08, Li-Wen Hsu wrote: > Author: lwhsu > Date: Thu Aug 22 12:08:35 2019 > New Revision: 351391 > URL: https://svnweb.freebsd.org/changeset/base/351391 > > Log: > Fix path issues after r351212 > > This fixes sys.netpfil.pf.forward.v4 and > sys.netpfil.pf.icmp.cve_2019_5598 > failures in CI system. > Thanks! I must have missed those. Best regards, Kristof From owner-svn-src-head@freebsd.org Fri Aug 23 16:10:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CEB0C8C1A; Fri, 23 Aug 2019 16:10:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FRFR3gC2z3QyH; Fri, 23 Aug 2019 16:10:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (cross.sbone.de [195.201.62.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4699F1AE0A; Fri, 23 Aug 2019 16:10:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 22F968D4A13E; Fri, 23 Aug 2019 16:10:17 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 3551DE70846; Fri, 23 Aug 2019 16:10:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id zqUarkOGSJGa; Fri, 23 Aug 2019 16:10:14 +0000 (UTC) Received: from [127.0.0.1] (unknown [IPv6:fde9:577b:c1a9:31:7466:a929:9e2f:a88e]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 91543D21C68; Fri, 23 Aug 2019 16:10:14 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Warner Losh" , "Li-Wen Hsu" Cc: "John Baldwin" , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r351364 - in head/sys: crypto/blowfish crypto/chacha20 crypto/des opencrypto Date: Fri, 23 Aug 2019 16:10:13 +0000 X-Mailer: MailMate (2.0BETAr6137) Message-ID: <3EE09B22-254B-4415-8865-D9542122ACA5@FreeBSD.org> In-Reply-To: References: <201908220002.x7M028Jh070116@repo.freebsd.org> <0b9d1aa1-d328-30bc-b939-f1407e236855@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 16:10:19 -0000 On 23 Aug 2019, at 15:53, Warner Losh wrote: > Sorry for top posting... > > I had planned this for next week, but I think give this insanity of > this > patch, we should do it now: turn off -Werror for gcc 4.2.1 > > https://reviews.freebsd.org/D21378 > > has the review. There's no benefit to these head-scratcher changes > when we > can get the same benefit by ignoring gcc 4.2.1 errors as discussed on > arch@. That brings me to a different question: why does this build https://ci.freebsd.org/job/FreeBSD-head-amd64-gcc/lastBuild/ not fail despite rendering the warnings? /bz From owner-svn-src-head@freebsd.org Fri Aug 23 16:42:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4149C95AC; Fri, 23 Aug 2019 16:42:05 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FRy55CSNz3xw7; Fri, 23 Aug 2019 16:42:05 +0000 (UTC) (envelope-from imp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 946A41F81B; Fri, 23 Aug 2019 16:42:05 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7NGg5GS015392; Fri, 23 Aug 2019 16:42:05 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NGg5GU015390; Fri, 23 Aug 2019 16:42:05 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908231642.x7NGg5GU015390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Aug 2019 16:42:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351429 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 351429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 16:42:05 -0000 Author: imp Date: Fri Aug 23 16:42:04 2019 New Revision: 351429 URL: https://svnweb.freebsd.org/changeset/base/351429 Log: Turn off -Werror for gcc 4.2.1 As part of marching gcc 4.2.1 out of the tree, turn off -Werror on gcc 4.2.1 compiles by default. It generates too many false positives and breaks CI for no benefit. Discussed on: arch@ Reviewed by: jhb@, emaste@, pfg@ Differential Revision: https://reviews.freebsd.org/D21378 Modified: head/sys/conf/kern.pre.mk head/sys/conf/kmod.mk Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Fri Aug 23 16:26:06 2019 (r351428) +++ head/sys/conf/kern.pre.mk Fri Aug 23 16:42:04 2019 (r351429) @@ -93,7 +93,11 @@ CFLAGS.gcc+= -fms-extensions .if defined(CFLAGS_ARCH_PARAMS) CFLAGS.gcc+=${CFLAGS_ARCH_PARAMS} .endif -WERROR?= -Werror +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 50000 +WERROR?= -Wno-error +.else +WERROR?= -Werror +.endif # XXX LOCORE means "don't declare C stuff" not "for locore.s". ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} ${ASM_CFLAGS.${.IMPSRC:T}} Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Fri Aug 23 16:26:06 2019 (r351428) +++ head/sys/conf/kmod.mk Fri Aug 23 16:42:04 2019 (r351429) @@ -107,7 +107,12 @@ __KLD_SHARED=no .if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing) CFLAGS+= -fno-strict-aliasing .endif +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 50000 +WERROR?= -Wno-error +.else WERROR?= -Werror +.endif + CFLAGS+= ${WERROR} CFLAGS+= -D_KERNEL CFLAGS+= -DKLD_MODULE From owner-svn-src-head@freebsd.org Fri Aug 23 16:42:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 174F6C9785; Fri, 23 Aug 2019 16:42:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FRyl6vT4z3y5P; Fri, 23 Aug 2019 16:42:39 +0000 (UTC) (envelope-from imp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE75E1F851; Fri, 23 Aug 2019 16:42:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7NGgdFV016099; Fri, 23 Aug 2019 16:42:39 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NGgd2j016098; Fri, 23 Aug 2019 16:42:39 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908231642.x7NGgd2j016098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Aug 2019 16:42:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351430 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 351430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 16:42:40 -0000 Author: imp Date: Fri Aug 23 16:42:39 2019 New Revision: 351430 URL: https://svnweb.freebsd.org/changeset/base/351430 Log: Turn off -Werror for gcc 4.2.1 for userland As discussed on arch@, gcc 4.2.1 is on its way out. Turn off Werror on gcc versions < 5.0 permantly. This will allow older platforms to continue to compile w/o new errors once we take them out of universe by default. This will also free developers from chasing down obsolete warnings that produce no beneficial changes to the source. Discussed on: arch@ Reviewed by: jhb@, emaste@, pfg@ Differential Revision: https://reviews.freebsd.org/D21378 Modified: head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Fri Aug 23 16:42:04 2019 (r351429) +++ head/share/mk/bsd.sys.mk Fri Aug 23 16:42:39 2019 (r351430) @@ -29,6 +29,15 @@ CFLAGS+= -std=${CSTD} CXXFLAGS+= -std=${CXXSTD} .endif +# +# Turn off -Werror for gcc 4.2.1. The compiler is on the glide path out of the +# system, and any warnings specific to it are no longer relevant as there are +# too many false positives. +# +.if ${COMPILER_VERSION} < 50000 +NO_WERROR.gcc= yes +.endif + # -pedantic is problematic because it also imposes namespace restrictions #CFLAGS+= -pedantic .if defined(WARNS) From owner-svn-src-head@freebsd.org Fri Aug 23 16:46:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 567C0C9836; Fri, 23 Aug 2019 16:46:03 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FS2g1bd7z3yFp; Fri, 23 Aug 2019 16:46:02 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pl1-x62e.google.com with SMTP id go14so5867223plb.0; Fri, 23 Aug 2019 09:46:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=unyL4BVTQ+kiLdztht2PYGTHt5speQknhpXzYtA5AkM=; b=roju8LPxXFJhSdIsgInC06FVTXXCCYs5OVLB17LCG605t4Dei92veCuPUZGl1IdbNd 3fiQdUmC/6uiohwtNu+OP3/dkQ3wk+e27I28UJHQVUF0YgoJ0hOfA8xXbUmacpFuVob2 sJGvBrjd1AP84lkYMKk4w5VIOkRHpCDl9YEdCKb9N+WiI/mzgZPe5Rr0OuJaAKsJi74G gcXh6cRfomURU3tHPu4NFAoQ27il0fdGfSd5KWj8ICHdEX+v1gU//NbTw5j82Gutr7Tj GieIRvKEtvQagGOiSXihzZD8ruBXUK1/+ChNVgx+ew7SaCilrNDopSzRhclAHSjVvu51 Anpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=unyL4BVTQ+kiLdztht2PYGTHt5speQknhpXzYtA5AkM=; b=tKLcb9X40IpM1PgAZD/MQcoT9lG7YoRgwN9f19o2hao4jq02E6tPw7xo4sx6d9MCfM 0wL5CPq7Izpw+1Nz2T01Tfsdeawj58Hv7jzrA+w2+Z1MrLJVDEvIEb18AKB9USZt3Vak abG6Ku3G02rlQ0tBRs7p8LOn51n8zUtr5n2GtpduKDaTab9qvTkyCdH2AQWos1cGsWz1 B/hlH6JcjeAS25Pk5Dc64LM044il05WLHpxngMDH/jxyoe1zOzazpxuFNVCUhk7Mdzn/ 9bgBM3ETB6LligX0P4phu8BYMUZPH0gMHXUNHb+bUI0zQuYu3m1WZdtkDkuMZBMs2Edg y3mg== X-Gm-Message-State: APjAAAXdQbyHPDXDdco4/vPbDvBhOjcEEBkY08qKg+OnezlYNofg6XNm dZ3w/ITXFOT22sQWiVYoFi7C1wrj X-Google-Smtp-Source: APXvYqy7tjQgVQsPefQOJDQ1jVIA0/82mDwX4BlWrZCPnNfoXwu0Osfop4s1wypY4DT8wg6hOE6Wag== X-Received: by 2002:a17:902:1aa:: with SMTP id b39mr5986032plb.333.1566578761314; Fri, 23 Aug 2019 09:46:01 -0700 (PDT) Received: from ?IPv6:2607:fb90:b2d3:19f6:b487:84a4:26ea:3f17? ([2607:fb90:b2d3:19f6:b487:84a4:26ea:3f17]) by smtp.gmail.com with ESMTPSA id e2sm3299956pff.49.2019.08.23.09.46.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Aug 2019 09:46:00 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r351429 - head/sys/conf From: Enji Cooper X-Mailer: iPhone Mail (16G77) In-Reply-To: <201908231642.x7NGg5GU015390@repo.freebsd.org> Date: Fri, 23 Aug 2019 09:45:59 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <82FC5ED8-79C9-480A-A40D-116AC9222112@gmail.com> References: <201908231642.x7NGg5GU015390@repo.freebsd.org> To: Warner Losh X-Rspamd-Queue-Id: 46FS2g1bd7z3yFp X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.97)[-0.969,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 16:46:03 -0000 > On Aug 23, 2019, at 09:42, Warner Losh wrote: >=20 > Author: imp > Date: Fri Aug 23 16:42:04 2019 > New Revision: 351429 > URL: https://svnweb.freebsd.org/changeset/base/351429 >=20 > Log: > Turn off -Werror for gcc 4.2.1 >=20 > As part of marching gcc 4.2.1 out of the tree, turn off -Werror on gcc 4.= 2.1 > compiles by default. It generates too many false positives and breaks CI > for no benefit. >=20 > Discussed on: arch@ > Reviewed by: jhb@, emaste@, pfg@ > Differential Revision: https://reviews.freebsd.org/D21378 >=20 > Modified: > head/sys/conf/kern.pre.mk > head/sys/conf/kmod.mk >=20 Uhhhhh... this change and the other one now turn off -Werror with non-gcc co= mpilers. This needs to be fixed. -Enji= From owner-svn-src-head@freebsd.org Fri Aug 23 16:47:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE279C98C9; Fri, 23 Aug 2019 16:47:27 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FS4G5Ss3z3yNt; Fri, 23 Aug 2019 16:47:26 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf1-x434.google.com with SMTP id i30so6802054pfk.9; Fri, 23 Aug 2019 09:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=T3twd439MUjjvdl/HONVlYzLoy7goWBgCHLMowgIV14=; b=fQv2Yfc/h/SMjXMlRlKte5xnc7yl7ZItyY3nG4OyjnWznc0EA7JV2SzwwIy15A+S7D K6iPwolAHdiDDQEJByrApoKYtGTxKk0s0kXcwcUd/t/lIx+VNsBT03a/pZkVssqntLb2 oQkozoEyCXCDuGj/lkXTfPOl9YVZps4ZOC4wjxigvE+sJW3X/jl7eAgVBrmeiHZdpFjp leEisOVOQR2S9wTZgB5+XQM4Whd8UYEzj0Qwbw7v4B0BSO8YHij+zjg0qUcx12pv0nAU b9GXeEPaMwFanaIDvuToc6GQOdYVYq+wUodAtXlBj3wfQy01FciUWBOiR6R3fhUlE//e BoqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=T3twd439MUjjvdl/HONVlYzLoy7goWBgCHLMowgIV14=; b=lhUsg2OWfUBch6/oDAqyepKP7+W6HVKGw7UYeMoCVjYp3aqOS2kv1tD0hQfN0O2CcA zOiEFFmx+IcWUAtqsY9dJYJWsV5XsFfU864EntsCDPbp57RFDO6SANMyulPPccBKivd/ eAOqaaCdmaiND0h1CnRpiFeBhN726Kukk0TqtedW1M5Q/tGRIB5HIHCihKzaJz7fjZR6 0UCYYjVQd8c6V8qlv/b7YWCpMvxyU9YjwgG5HEKH8wEwlD9fiXPLcK2uuJc6PY3aFzOi 1FYYyeB8XHMWxzs/c5sW+5hbNEVN5ubDTvZx3bmZIZDbBiLx8/m3GR4d2dNX+YC4nL59 SroA== X-Gm-Message-State: APjAAAWmYWTKRawodyQPKl9WYhJu8Tj0CaheXMN+PGCyEGDg0BFlg653 /QlnXelNhQMs0L4fiu8xveGpGoDR X-Google-Smtp-Source: APXvYqxcRBCQBl1xRVQvRBbUBi2MCC8RdKJr42sd4Uf2J1AzrDUpqOCODhEQ7M6fP/Tp3eG9Xyhq3A== X-Received: by 2002:a63:714a:: with SMTP id b10mr4996434pgn.25.1566578844613; Fri, 23 Aug 2019 09:47:24 -0700 (PDT) Received: from ?IPv6:2607:fb90:b2d3:19f6:b487:84a4:26ea:3f17? ([2607:fb90:b2d3:19f6:b487:84a4:26ea:3f17]) by smtp.gmail.com with ESMTPSA id p8sm7766056pfq.129.2019.08.23.09.47.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Aug 2019 09:47:24 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r351429 - head/sys/conf From: Enji Cooper X-Mailer: iPhone Mail (16G77) In-Reply-To: <82FC5ED8-79C9-480A-A40D-116AC9222112@gmail.com> Date: Fri, 23 Aug 2019 09:47:23 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <1BA7357A-B339-4A11-A62A-55FB67319AC6@gmail.com> References: <201908231642.x7NGg5GU015390@repo.freebsd.org> <82FC5ED8-79C9-480A-A40D-116AC9222112@gmail.com> To: Warner Losh X-Rspamd-Queue-Id: 46FS4G5Ss3z3yNt X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=fQv2Yfc/; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::434 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-3.49 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-0.99)[-0.987,0]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (-8.96), ipnet: 2607:f8b0::/32(-2.88), asn: 15169(-2.34), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE_FREEMAIL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[4.3.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 16:47:27 -0000 > On Aug 23, 2019, at 09:45, Enji Cooper wrote: >=20 >=20 >> On Aug 23, 2019, at 09:42, Warner Losh wrote: >>=20 >> Author: imp >> Date: Fri Aug 23 16:42:04 2019 >> New Revision: 351429 >> URL: https://svnweb.freebsd.org/changeset/base/351429 >>=20 >> Log: >> Turn off -Werror for gcc 4.2.1 >>=20 >> As part of marching gcc 4.2.1 out of the tree, turn off -Werror on gcc 4.= 2.1 >> compiles by default. It generates too many false positives and breaks CI >> for no benefit. >>=20 >> Discussed on: arch@ >> Reviewed by: jhb@, emaste@, pfg@ >> Differential Revision: https://reviews.freebsd.org/D21378 >>=20 >> Modified: >> head/sys/conf/kern.pre.mk >> head/sys/conf/kmod.mk >>=20 >=20 > Uhhhhh... this change and the other one now turn off -Werror with non-gcc c= ompilers. This needs to be fixed. Nm. I totally misread the diff :(.. Sorry for the noise! -Enji= From owner-svn-src-head@freebsd.org Fri Aug 23 16:48:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1427CC99B8 for ; Fri, 23 Aug 2019 16:48:21 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FS5H5rTXz3yWy for ; Fri, 23 Aug 2019 16:48:19 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x833.google.com with SMTP id b11so11785161qtp.10 for ; Fri, 23 Aug 2019 09:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IC68LVdpMR0Yro0lFdUjiuijwgzpquDdti2+hEmj7rQ=; b=D73JCq0d81rYy41rZNGPGJd8+e17GecKLa8erG1X2NhIcp+p0+B4lWXczRq+ufg3cQ cG+VuKAhWF1A1Wq5PoipSc3Zk3NZVrRIC2POJJ72SbOKCK/WhtW1acU9nrnyz4FC+xoj y+gu7Ujm6szldRbz4AOtl7g9vn2yDDrda3kPGD5DHR9TSpE8LXIz5ChoPoZn2YCdpWTd 99oWApyQ4YRQ88M+ExhoB2W1EqPDIrpQHWXpYvVq2o/goB7IDzfaDHPLL5EbuBrg4TvO 1Oc4OdngIr/LmPDEYheoWAyMG3K311fjDOBLilfdn5FJRgP/8pqKFRLs6VYGxXZw2elI kTMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IC68LVdpMR0Yro0lFdUjiuijwgzpquDdti2+hEmj7rQ=; b=CapWHekrInUr6LH5AU2SIuC3PnrD4mAzPODGdlvgRz46PL5XlvZdoJZ51do9nwzRp8 zhaLpKCQ0SnUyJgQm/xY8Ax963s65YMpPauqHrJB9GKJfNCXdDDYA0iWyxJPQx3IfKf+ CZAe+jMDoyYMW9tnMlW7QrceWCecrvRi1TJwhUFPzKffgdSXD0CZ7gYESjNY1AENAKfg GAomwudhTi/xPNsfe0c/msGIUY5TqbTnhTd9KLq5+l6pduGWrOTGdGr2OaqzHZ1SHhbB M+t6Bg4yTLj2mtfDP1tU3pezdD5JA6f6CTx7DDNAWMMfTQHAtmzyEoGyS+6Oa8w9SUmH ZVag== X-Gm-Message-State: APjAAAUvLoCosvZXf2FLzhkuS+CU8WwIvKO2OaAva5R8cUaDIPopvkUV w79KvlnyBzZhafQUosBAkyyJ7La2wtjqMOmwm2xDTVAdbcpSgw== X-Google-Smtp-Source: APXvYqwQuLehHRz8Qhhmg+aaUR0DMtnnJO5+kAtasHKsFLmHKWtwa+MtLsgwf7p05lj3O1S58P7pbJuVQmuoK7cuDLg= X-Received: by 2002:aed:3c45:: with SMTP id u5mr5642267qte.175.1566578898198; Fri, 23 Aug 2019 09:48:18 -0700 (PDT) MIME-Version: 1.0 References: <201908220002.x7M028Jh070116@repo.freebsd.org> <0b9d1aa1-d328-30bc-b939-f1407e236855@FreeBSD.org> <3EE09B22-254B-4415-8865-D9542122ACA5@FreeBSD.org> In-Reply-To: <3EE09B22-254B-4415-8865-D9542122ACA5@FreeBSD.org> From: Warner Losh Date: Fri, 23 Aug 2019 10:48:06 -0600 Message-ID: Subject: Re: svn commit: r351364 - in head/sys: crypto/blowfish crypto/chacha20 crypto/des opencrypto To: "Bjoern A. Zeeb" Cc: Li-Wen Hsu , John Baldwin , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46FS5H5rTXz3yWy X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=D73JCq0d; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::833) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-5.91 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-0.996,0]; RCVD_IN_DNSWL_NONE(0.00)[3.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.92)[ip: (-9.33), ipnet: 2607:f8b0::/32(-2.88), asn: 15169(-2.34), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 16:48:21 -0000 On Fri, Aug 23, 2019 at 10:10 AM Bjoern A. Zeeb wrote: > On 23 Aug 2019, at 15:53, Warner Losh wrote: > > > Sorry for top posting... > > > > I had planned this for next week, but I think give this insanity of > > this > > patch, we should do it now: turn off -Werror for gcc 4.2.1 > > > > https://reviews.freebsd.org/D21378 > > > > has the review. There's no benefit to these head-scratcher changes > > when we > > can get the same benefit by ignoring gcc 4.2.1 errors as discussed on > > arch@. > > That brings me to a different question: why does this build > https://ci.freebsd.org/job/FreeBSD-head-amd64-gcc/lastBuild/ not fail > despite rendering the warnings > There's a lot of -Wno-error and -Wno-error=XXX sprinkled in our build for gcc 4.2.1 today, so we see the warnings but aren't stopped by them. My changes take a big hammer and add a global -Wno-error to CFLAGS last to make this the behavior on gcc 4.2.1 platforms. Warner From owner-svn-src-head@freebsd.org Fri Aug 23 16:59:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F002DC9C1C; Fri, 23 Aug 2019 16:59:41 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FSLP5mm1z3yw9; Fri, 23 Aug 2019 16:59:41 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 7810B1B412; Fri, 23 Aug 2019 16:59:41 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 180818D4A166; Fri, 23 Aug 2019 16:59:39 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 2519FE70849; Fri, 23 Aug 2019 16:59:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id HRsKSSNaNLtb; Fri, 23 Aug 2019 16:59:34 +0000 (UTC) Received: from [127.0.0.1] (unknown [IPv6:fde9:577b:c1a9:31:7466:a929:9e2f:a88e]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id BC3AED21C68; Fri, 23 Aug 2019 16:59:33 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Warner Losh" Cc: "Li-Wen Hsu" , "John Baldwin" , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r351364 - in head/sys: crypto/blowfish crypto/chacha20 crypto/des opencrypto Date: Fri, 23 Aug 2019 16:59:32 +0000 X-Mailer: MailMate (2.0BETAr6137) Message-ID: In-Reply-To: References: <201908220002.x7M028Jh070116@repo.freebsd.org> <0b9d1aa1-d328-30bc-b939-f1407e236855@FreeBSD.org> <3EE09B22-254B-4415-8865-D9542122ACA5@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 16:59:42 -0000 On 23 Aug 2019, at 16:48, Warner Losh wrote: > On Fri, Aug 23, 2019 at 10:10 AM Bjoern A. Zeeb > wrote: > >> On 23 Aug 2019, at 15:53, Warner Losh wrote: >> >>> Sorry for top posting... >>> >>> I had planned this for next week, but I think give this insanity of >>> this >>> patch, we should do it now: turn off -Werror for gcc 4.2.1 >>> >>> https://reviews.freebsd.org/D21378 >>> >>> has the review. There's no benefit to these head-scratcher changes >>> when we >>> can get the same benefit by ignoring gcc 4.2.1 errors as discussed >>> on >>> arch@. >> >> That brings me to a different question: why does this build >> https://ci.freebsd.org/job/FreeBSD-head-amd64-gcc/lastBuild/ not fail >> despite rendering the warnings >> > > There's a lot of -Wno-error and -Wno-error=XXX sprinkled in our build > for > gcc 4.2.1 today, so we see the warnings but aren't stopped by them. My > changes take a big hammer and add a global -Wno-error to CFLAGS last > to > make this the behavior on gcc 4.2.1 platforms. Yes, but that didn’t answer my questions. It doesn’t help to try to avoid undefined C behaviour. That jenkins build seems to use the toolchain from ports and with that gcc 6.4.0. We see the same warning but it didn’t error as it seems to have done for other architectures with the in-tree gcc with the same warnings: In file included from /workspace/src/sys/opencrypto/xform.c:94:0: /workspace/src/sys/opencrypto/xform_des1.c: In function 'des1_setkey': /workspace/src/sys/opencrypto/xform_des1.c:102:15: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual] des_set_key((const des_cblock *) key, p[0]); ^ In file included from /workspace/src/sys/opencrypto/xform.c:95:0: /workspace/src/sys/opencrypto/xform_des3.c: In function 'des3_setkey': /workspace/src/sys/opencrypto/xform_des3.c:103:15: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual] des_set_key((const des_cblock *)(key + 0), p[0]); ^ /workspace/src/sys/opencrypto/xform_des3.c:104:15: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual] des_set_key((const des_cblock *)(key + 8), p[1]); ^ /workspace/src/sys/opencrypto/xform_des3.c:105:15: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual] des_set_key((const des_cblock *)(key + 16), p[2]); ^ -- To me this means that we treat different versions of compilers (in-tree and out-of-tree, gcc vs. clang) too different. If two versions of gcc (before your commit) gave the same warning I would have expected them to equally fail and not one fail and one pass? My question was: why was that the case? /bz From owner-svn-src-head@freebsd.org Fri Aug 23 18:26:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D437ACB48B; Fri, 23 Aug 2019 18:26:21 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FVGP4tS9z43Z7; Fri, 23 Aug 2019 18:26:21 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f66.google.com with SMTP id j5so22193312ioj.8; Fri, 23 Aug 2019 11:26:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=E1Yqkly/AW5C/cUEgM3+cPpBdRAikXNNitRGsxCpkHg=; b=qlaLPOYR6Fd5yHUHAF791d1bYksk0kB0HguiXjWrihn2+4hE3JnO+qyYmzAgseWSpy WJ2D1YsE3OCiNpW/4OJipbuBFscVxqvdLx/UVkVJTeNCEfDSVHkzCWCA7hubgEDRhed9 SDGHZQToY4RXZRGZZXhsL8Pt6+SCeU0UjAUKP7Rhul7D1j4mRKNeNvJgzUr6+zmbOi7O MNbs3bB/Q/36Ls1pzdmk8R4zhkmAlcdhZoct7yuEy166scq99zBIP2nyQxC3qiyl3WoB AxfI6GJsCp2VGC/HYtXYWTWFDg6Lknp8NJZR71H69E+Sk+ArIbZMg0OdNJ5l3iUFFuQI A+7g== X-Gm-Message-State: APjAAAV+YajyaZPtm3nGHiajvexBOwcT73Q7d8Ze9giMYDyXSEaEziIi 6bMiGY2zt2paOVZx62eeuor5GGOl X-Google-Smtp-Source: APXvYqxBPcS4+GuoCyKA8Psn+K4fuExNqWgPHagzyE2s6qkSJNlDjHInNNLwhEadwW8y0aF6Dvr48Q== X-Received: by 2002:a6b:f910:: with SMTP id j16mr7868234iog.305.1566584779691; Fri, 23 Aug 2019 11:26:19 -0700 (PDT) Received: from mail-io1-f48.google.com (mail-io1-f48.google.com. [209.85.166.48]) by smtp.gmail.com with ESMTPSA id a7sm2691088iok.41.2019.08.23.11.26.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Aug 2019 11:26:19 -0700 (PDT) Received: by mail-io1-f48.google.com with SMTP id z3so22287609iog.0; Fri, 23 Aug 2019 11:26:19 -0700 (PDT) X-Received: by 2002:a5e:c101:: with SMTP id v1mr7462317iol.231.1566584778871; Fri, 23 Aug 2019 11:26:18 -0700 (PDT) MIME-Version: 1.0 References: <201908220002.x7M028Jh070116@repo.freebsd.org> <0b9d1aa1-d328-30bc-b939-f1407e236855@FreeBSD.org> <3EE09B22-254B-4415-8865-D9542122ACA5@FreeBSD.org> In-Reply-To: Reply-To: cem@freebsd.org From: Conrad Meyer Date: Fri, 23 Aug 2019 11:26:07 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r351364 - in head/sys: crypto/blowfish crypto/chacha20 crypto/des opencrypto To: "Bjoern A. Zeeb" Cc: Warner Losh , Li-Wen Hsu , John Baldwin , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 46FVGP4tS9z43Z7 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 18:26:21 -0000 At expected peril of wading into a thread >4 emails deep, @Warner, modern GCC reports a similar warning; it just doesn't become an error (at least in CI?). I'm not sure of the mechanism. Maybe CI-specific? Old GCC didn't have a -Wno-error for -Wcast-qual, so -Wcast-qual + -Werror there produced an error; that's why $NO_WCAST_QUAL in conf/kern.mk is defined to -Wno-cast-qual for old GCC but -Wno-error=3Dcast-qual for newer compilers. That said, this file does not appear to be compiled with ${NO_WCAST_QUAL} either way. @Bjoern, So... why does GCC warn about this? key is const uint8_t*. The cast is to const des_cblock *. I think the problem is that des_cblock is defined as 'unsigned char [8]', so a 'const des cblock *' is actually a 'const unsigned char**'? So... I think basically the entire des subsystem may be accidentally using the wrong pointer level throughout? The constify change just exposes that because correct const-preserving cast of 'const foo*' to 'foo**' would be 'foo * const *' (if I'm understanding this correctly). Maybe one more reason to excise des from the tree. Best, Conrad On Fri, Aug 23, 2019 at 9:59 AM Bjoern A. Zeeb wrote: > > On 23 Aug 2019, at 16:48, Warner Losh wrote: > > There's a lot of -Wno-error and -Wno-error=3DXXX sprinkled in our build > > for > > gcc 4.2.1 today, so we see the warnings but aren't stopped by them. My > > changes take a big hammer and add a global -Wno-error to CFLAGS last > > to > > make this the behavior on gcc 4.2.1 platforms. > > > Yes, but that didn=E2=80=99t answer my questions. It doesn=E2=80=99t hel= p to try to > avoid undefined C behaviour. > > That jenkins build seems to use the toolchain from ports and with that > gcc 6.4.0. > > We see the same warning but it didn=E2=80=99t error as it seems to have d= one > for other architectures with the in-tree gcc with the same warnings: > > In file included from /workspace/src/sys/opencrypto/xform.c:94:0: > /workspace/src/sys/opencrypto/xform_des1.c: In function 'des1_setkey': > /workspace/src/sys/opencrypto/xform_des1.c:102:15: warning: cast > discards 'const' qualifier from pointer target type [-Wcast-qual] > des_set_key((const des_cblock *) key, p[0]); > ^ > In file included from /workspace/src/sys/opencrypto/xform.c:95:0: > /workspace/src/sys/opencrypto/xform_des3.c: In function 'des3_setkey': > /workspace/src/sys/opencrypto/xform_des3.c:103:15: warning: cast > discards 'const' qualifier from pointer target type [-Wcast-qual] > des_set_key((const des_cblock *)(key + 0), p[0]); > ^ > /workspace/src/sys/opencrypto/xform_des3.c:104:15: warning: cast > discards 'const' qualifier from pointer target type [-Wcast-qual] > des_set_key((const des_cblock *)(key + 8), p[1]); > ^ > /workspace/src/sys/opencrypto/xform_des3.c:105:15: warning: cast > discards 'const' qualifier from pointer target type [-Wcast-qual] > des_set_key((const des_cblock *)(key + 16), p[2]); > ^ > -- > > > > To me this means that we treat different versions of compilers (in-tree > and out-of-tree, gcc vs. clang) too different. > > If two versions of gcc (before your commit) gave the same warning I > would have expected them to equally fail and not one fail and one pass? > > My question was: why was that the case? > > /bz > From owner-svn-src-head@freebsd.org Fri Aug 23 18:26:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A02C9CB4EF; Fri, 23 Aug 2019 18:26:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FVGg3Vbqz43j6; Fri, 23 Aug 2019 18:26:35 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5277B20A25; Fri, 23 Aug 2019 18:26:35 +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 x7NIQZrJ075089; Fri, 23 Aug 2019 18:26:35 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NIQZNj075088; Fri, 23 Aug 2019 18:26:35 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908231826.x7NIQZNj075088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Aug 2019 18:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351434 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 351434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 18:26:35 -0000 Author: jhb Date: Fri Aug 23 18:26:34 2019 New Revision: 351434 URL: https://svnweb.freebsd.org/changeset/base/351434 Log: Fix universe to include arm LINT kernel configs. Strip comments from the NOTES.armv[57] files as is done for other NOTES files when building the corresponding LINT configs. Without this, the LINT configs contained the NO_UNIVERSE comment from the NOTES.armv[57] files. Reviewed by: imp MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21264 Modified: head/sys/conf/makeLINT.mk Modified: head/sys/conf/makeLINT.mk ============================================================================== --- head/sys/conf/makeLINT.mk Fri Aug 23 17:43:41 2019 (r351433) +++ head/sys/conf/makeLINT.mk Fri Aug 23 18:26:34 2019 (r351434) @@ -48,8 +48,10 @@ LINT: ${NOTES} ${MAKELINT_SED} echo "nodevice netmap" >> ${.TARGET}-NOIP .endif .if ${TARGET} == "arm" - cat ${.TARGET} ${.CURDIR}/NOTES.armv5 > ${.TARGET}-V5 - cat ${.TARGET} ${.CURDIR}/NOTES.armv7 > ${.TARGET}-V7 + cat ${NOTES} ${.CURDIR}/NOTES.armv5 | sed -E -n -f ${MAKELINT_SED} > \ + ${.TARGET}-V5 + cat ${NOTES} ${.CURDIR}/NOTES.armv7 | sed -E -n -f ${MAKELINT_SED} > \ + ${.TARGET}-V7 rm ${.TARGET} .endif .if ${TARGET} == "mips" From owner-svn-src-head@freebsd.org Fri Aug 23 19:40:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21549CCC7A; Fri, 23 Aug 2019 19:40:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FWvc05s8z472N; Fri, 23 Aug 2019 19:40:12 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9AF3216B2; Fri, 23 Aug 2019 19:40: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 x7NJeBet016367; Fri, 23 Aug 2019 19:40:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NJeBLt016364; Fri, 23 Aug 2019 19:40:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908231940.x7NJeBLt016364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Aug 2019 19:40:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351435 - in head/sys: kern sys ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: kern sys ufs/ffs X-SVN-Commit-Revision: 351435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 19:40:12 -0000 Author: kib Date: Fri Aug 23 19:40:10 2019 New Revision: 351435 URL: https://svnweb.freebsd.org/changeset/base/351435 Log: De-commision the MNTK_NOINSMNTQ kernel mount flag. After all the changes, its dynamic scope is same as for MNTK_UNMOUNT, but to allow the syncer vnode to be re-installed on unmount failure. But the case of syncer was already handled by using the VV_FORCEINSMQ flag for quite some time. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_mount.c head/sys/kern/vfs_subr.c head/sys/sys/mount.h head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Fri Aug 23 18:26:34 2019 (r351434) +++ head/sys/kern/vfs_mount.c Fri Aug 23 19:40:10 2019 (r351435) @@ -1387,14 +1387,13 @@ dounmount(struct mount *mp, int flags, struct thread * dounmount_cleanup(mp, coveredvp, 0); return (EBUSY); } - mp->mnt_kern_flag |= MNTK_UNMOUNT | MNTK_NOINSMNTQ; + mp->mnt_kern_flag |= MNTK_UNMOUNT; if (flags & MNT_NONBUSY) { MNT_IUNLOCK(mp); error = vfs_check_usecounts(mp); MNT_ILOCK(mp); if (error != 0) { - dounmount_cleanup(mp, coveredvp, MNTK_UNMOUNT | - MNTK_NOINSMNTQ); + dounmount_cleanup(mp, coveredvp, MNTK_UNMOUNT); return (error); } } @@ -1456,7 +1455,6 @@ dounmount(struct mount *mp, int flags, struct thread * */ if (error && error != ENXIO) { MNT_ILOCK(mp); - mp->mnt_kern_flag &= ~MNTK_NOINSMNTQ; if ((mp->mnt_flag & MNT_RDONLY) == 0) { MNT_IUNLOCK(mp); vfs_allocate_syncvnode(mp); Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Fri Aug 23 18:26:34 2019 (r351434) +++ head/sys/kern/vfs_subr.c Fri Aug 23 19:40:10 2019 (r351435) @@ -1698,7 +1698,7 @@ insmntque1(struct vnode *vp, struct mount *mp, */ MNT_ILOCK(mp); VI_LOCK(vp); - if (((mp->mnt_kern_flag & MNTK_NOINSMNTQ) != 0 && + if (((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0 && ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0 || mp->mnt_nvnodelistsize == 0)) && (vp->v_vflag & VV_FORCEINSMQ) == 0) { @@ -3818,7 +3818,6 @@ DB_SHOW_COMMAND(mount, db_show_mount) MNT_KERN_FLAG(MNTK_UNMOUNTF); MNT_KERN_FLAG(MNTK_ASYNC); MNT_KERN_FLAG(MNTK_SOFTDEP); - MNT_KERN_FLAG(MNTK_NOINSMNTQ); MNT_KERN_FLAG(MNTK_DRAINING); MNT_KERN_FLAG(MNTK_REFEXPIRE); MNT_KERN_FLAG(MNTK_EXTENDED_SHARED); Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Fri Aug 23 18:26:34 2019 (r351434) +++ head/sys/sys/mount.h Fri Aug 23 19:40:10 2019 (r351435) @@ -368,23 +368,20 @@ void __mnt_vnode_markerfree_active(struct vno /* * Internal filesystem control flags stored in mnt_kern_flag. * - * MNTK_UNMOUNT locks the mount entry so that name lookup cannot proceed - * past the mount point. This keeps the subtree stable during mounts - * and unmounts. + * MNTK_UNMOUNT locks the mount entry so that name lookup cannot + * proceed past the mount point. This keeps the subtree stable during + * mounts and unmounts. When non-forced unmount flushes all vnodes + * from the mp queue, the MNTK_UNMOUNT flag prevents insmntque() from + * queueing new vnodes. * * MNTK_UNMOUNTF permits filesystems to detect a forced unmount while * dounmount() is still waiting to lock the mountpoint. This allows * the filesystem to cancel operations that might otherwise deadlock * with the unmount attempt (used by NFS). - * - * MNTK_NOINSMNTQ is strict subset of MNTK_UNMOUNT. They are separated - * to allow for failed unmount attempt to restore the syncer vnode for - * the mount. */ #define MNTK_UNMOUNTF 0x00000001 /* forced unmount in progress */ #define MNTK_ASYNC 0x00000002 /* filtered async flag */ #define MNTK_SOFTDEP 0x00000004 /* async disabled by softdep */ -#define MNTK_NOINSMNTQ 0x00000008 /* insmntque is not allowed */ #define MNTK_DRAINING 0x00000010 /* lock draining is happening */ #define MNTK_REFEXPIRE 0x00000020 /* refcount expiring is happening */ #define MNTK_EXTENDED_SHARED 0x00000040 /* Allow shared locking for more ops */ Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Fri Aug 23 18:26:34 2019 (r351434) +++ head/sys/ufs/ffs/ffs_softdep.c Fri Aug 23 19:40:10 2019 (r351435) @@ -2028,8 +2028,6 @@ retry_flush: if (oldmnt->mnt_kern_flag & MNTK_UNMOUNT) { retry = 0; MNT_ILOCK(oldmnt); - KASSERT((oldmnt->mnt_kern_flag & MNTK_NOINSMNTQ) != 0, - ("softdep_flushfiles: !MNTK_NOINSMNTQ")); morework = oldmnt->mnt_nvnodelistsize > 0; #ifdef QUOTA ump = VFSTOUFS(oldmnt); From owner-svn-src-head@freebsd.org Fri Aug 23 19:49:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BDD9CCF47; Fri, 23 Aug 2019 19:49:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FX6L1KZQz47Y0; Fri, 23 Aug 2019 19:49:30 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FE072189D; Fri, 23 Aug 2019 19:49:30 +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 x7NJnTpC022551; Fri, 23 Aug 2019 19:49:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NJnTTE022549; Fri, 23 Aug 2019 19:49:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908231949.x7NJnTTE022549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 23 Aug 2019 19:49:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351436 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 351436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 19:49:30 -0000 Author: markj Date: Fri Aug 23 19:49:29 2019 New Revision: 351436 URL: https://svnweb.freebsd.org/changeset/base/351436 Log: Make vm_pqbatch_submit_page() externally visible. It will become useful for the page daemon to be able to directly create a batch queue entry for a page, and without modifying the page structure. Rename vm_pqbatch_submit_page() to vm_page_pqbatch_submit() to keep the namespace consistent. No functional change intended. Reviewed by: alc, kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21369 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_swapout.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Aug 23 19:40:10 2019 (r351435) +++ head/sys/vm/vm_page.c Fri Aug 23 19:49:29 2019 (r351436) @@ -3130,8 +3130,8 @@ vm_pqbatch_process(struct vm_pagequeue *pq, struct vm_ vm_batchqueue_init(bq); } -static void -vm_pqbatch_submit_page(vm_page_t m, uint8_t queue) +void +vm_page_pqbatch_submit(vm_page_t m, uint8_t queue) { struct vm_batchqueue *bq; struct vm_pagequeue *pq; @@ -3181,14 +3181,14 @@ vm_pqbatch_submit_page(vm_page_t m, uint8_t queue) } /* - * vm_page_drain_pqbatch: [ internal use only ] + * vm_page_pqbatch_drain: [ internal use only ] * * Force all per-CPU page queue batch queues to be drained. This is * intended for use in severe memory shortages, to ensure that pages * do not remain stuck in the batch queues. */ void -vm_page_drain_pqbatch(void) +vm_page_pqbatch_drain(void) { struct thread *td; struct vm_domain *vmd; @@ -3253,7 +3253,7 @@ vm_page_dequeue_deferred(vm_page_t m) if ((queue = vm_page_queue(m)) == PQ_NONE) return; vm_page_aflag_set(m, PGA_DEQUEUE); - vm_pqbatch_submit_page(m, queue); + vm_page_pqbatch_submit(m, queue); } /* @@ -3277,7 +3277,7 @@ vm_page_dequeue_deferred_free(vm_page_t m) if ((queue = m->queue) == PQ_NONE) return; vm_page_aflag_set(m, PGA_DEQUEUE); - vm_pqbatch_submit_page(m, queue); + vm_page_pqbatch_submit(m, queue); } /* @@ -3352,7 +3352,7 @@ vm_page_enqueue(vm_page_t m, uint8_t queue) m->queue = queue; if ((m->aflags & PGA_REQUEUE) == 0) vm_page_aflag_set(m, PGA_REQUEUE); - vm_pqbatch_submit_page(m, queue); + vm_page_pqbatch_submit(m, queue); } /* @@ -3372,7 +3372,7 @@ vm_page_requeue(vm_page_t m) if ((m->aflags & PGA_REQUEUE) == 0) vm_page_aflag_set(m, PGA_REQUEUE); - vm_pqbatch_submit_page(m, atomic_load_8(&m->queue)); + vm_page_pqbatch_submit(m, atomic_load_8(&m->queue)); } /* @@ -3700,7 +3700,7 @@ vm_page_deactivate_noreuse(vm_page_t m) } if ((m->aflags & PGA_REQUEUE_HEAD) == 0) vm_page_aflag_set(m, PGA_REQUEUE_HEAD); - vm_pqbatch_submit_page(m, PQ_INACTIVE); + vm_page_pqbatch_submit(m, PQ_INACTIVE); } /* Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Fri Aug 23 19:40:10 2019 (r351435) +++ head/sys/vm/vm_page.h Fri Aug 23 19:49:29 2019 (r351436) @@ -542,7 +542,6 @@ void vm_page_deactivate(vm_page_t); void vm_page_deactivate_noreuse(vm_page_t); void vm_page_dequeue(vm_page_t m); void vm_page_dequeue_deferred(vm_page_t m); -void vm_page_drain_pqbatch(void); vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t); bool vm_page_free_prep(vm_page_t m); vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); @@ -552,6 +551,8 @@ 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 *); +void vm_page_pqbatch_drain(void); +void vm_page_pqbatch_submit(vm_page_t m, uint8_t queue); vm_page_t vm_page_prev(vm_page_t m); bool vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip_m); void vm_page_putfake(vm_page_t m); Modified: head/sys/vm/vm_swapout.c ============================================================================== --- head/sys/vm/vm_swapout.c Fri Aug 23 19:40:10 2019 (r351435) +++ head/sys/vm/vm_swapout.c Fri Aug 23 19:49:29 2019 (r351436) @@ -409,7 +409,7 @@ vm_daemon(void) * avoidance measure. */ if ((swapout_flags & VM_SWAP_NORMAL) != 0) - vm_page_drain_pqbatch(); + vm_page_pqbatch_drain(); swapout_procs(swapout_flags); } From owner-svn-src-head@freebsd.org Fri Aug 23 19:53:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F218CD1CE; Fri, 23 Aug 2019 19:53:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FXBb6Y9gz486j; Fri, 23 Aug 2019 19:53:11 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2B2321A71; Fri, 23 Aug 2019 19:53:11 +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 x7NJrBJj028019; Fri, 23 Aug 2019 19:53:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NJrBKr028018; Fri, 23 Aug 2019 19:53:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908231953.x7NJrBKr028018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 23 Aug 2019 19:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351437 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 351437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 19:53:12 -0000 Author: markj Date: Fri Aug 23 19:53:11 2019 New Revision: 351437 URL: https://svnweb.freebsd.org/changeset/base/351437 Log: Stop clearing page flags in vm_page_pqbatch_submit(). All existing callers guarantee that the page does not have a pre-existing dequeue pending. Thus, if the page is dequeued before pqbatch_submit() acquires the page queue lock, we do not need to do anything since vm_page_dequeue_complete() takes care of clearing all page queue state flags for us. With this change, vm_page_pqbatch_submit() has the nice property that it does not directly modify any fields in the page structure. Reviewed by: alc, kib Tested by: pho (part of a larger change) MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21372 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Aug 23 19:49:29 2019 (r351436) +++ head/sys/vm/vm_page.c Fri Aug 23 19:53:11 2019 (r351437) @@ -3174,7 +3174,6 @@ vm_page_pqbatch_submit(vm_page_t m, uint8_t queue) ("invalid queue transition for page %p", m)); KASSERT((m->aflags & PGA_ENQUEUED) == 0, ("page %p is enqueued with invalid queue index", m)); - vm_page_aflag_clear(m, PGA_QUEUE_STATE_MASK); } vm_pagequeue_unlock(pq); critical_exit(); From owner-svn-src-head@freebsd.org Fri Aug 23 21:05:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1D8CCE33B; Fri, 23 Aug 2019 21:05:37 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FYp95f76z4BdC; Fri, 23 Aug 2019 21:05:37 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3B8122719; Fri, 23 Aug 2019 21:05:37 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7NL5bSs069279; Fri, 23 Aug 2019 21:05:37 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NL5bFT069278; Fri, 23 Aug 2019 21:05:37 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908232105.x7NL5bFT069278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 23 Aug 2019 21:05:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351438 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 351438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 21:05:37 -0000 Author: mjg Date: Fri Aug 23 21:05:37 2019 New Revision: 351438 URL: https://svnweb.freebsd.org/changeset/base/351438 Log: vfs: assert the lock held in MNT_REF/MNT_REL Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/mount.h Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Fri Aug 23 19:53:11 2019 (r351437) +++ head/sys/sys/mount.h Fri Aug 23 21:05:37 2019 (r351438) @@ -265,8 +265,12 @@ void __mnt_vnode_markerfree_active(struct vno #define MNT_ITRYLOCK(mp) mtx_trylock(&(mp)->mnt_mtx) #define MNT_IUNLOCK(mp) mtx_unlock(&(mp)->mnt_mtx) #define MNT_MTX(mp) (&(mp)->mnt_mtx) -#define MNT_REF(mp) (mp)->mnt_ref++ +#define MNT_REF(mp) do { \ + mtx_assert(MNT_MTX(mp), MA_OWNED); \ + (mp)->mnt_ref++; \ +} while (0) #define MNT_REL(mp) do { \ + mtx_assert(MNT_MTX(mp), MA_OWNED); \ KASSERT((mp)->mnt_ref > 0, ("negative mnt_ref")); \ (mp)->mnt_ref--; \ if ((mp)->mnt_ref == 0) \ From owner-svn-src-head@freebsd.org Fri Aug 23 22:04:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8256BCF822; Fri, 23 Aug 2019 22:04:27 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Fb632YDpz4FQ6; Fri, 23 Aug 2019 22:04:27 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38D1323217; Fri, 23 Aug 2019 22:04:27 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7NM4RRd005351; Fri, 23 Aug 2019 22:04:27 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NM4RI9005350; Fri, 23 Aug 2019 22:04:27 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908232204.x7NM4RI9005350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 23 Aug 2019 22:04:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351440 - head/sbin/ping X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/ping X-SVN-Commit-Revision: 351440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 22:04:27 -0000 Author: asomers Date: Fri Aug 23 22:04:26 2019 New Revision: 351440 URL: https://svnweb.freebsd.org/changeset/base/351440 Log: ping: Fix alignment errors This fixes -Wcast-align errors when compiled with WARNS=6. Submitted by: Ján Sučan MFC after: 2 weeks Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21327 Modified: head/sbin/ping/ping.c Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Fri Aug 23 22:03:50 2019 (r351439) +++ head/sbin/ping/ping.c Fri Aug 23 22:04:26 2019 (r351440) @@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -217,10 +218,10 @@ static void finish(void) __dead2; static void pinger(void); static char *pr_addr(struct in_addr); static char *pr_ntime(n_time); -static void pr_icmph(struct icmp *); +static void pr_icmph(struct icmp *, struct ip *, const u_char *const); static void pr_iph(struct ip *); -static void pr_pack(char *, int, struct sockaddr_in *, struct timespec *); -static void pr_retip(struct ip *); +static void pr_pack(char *, ssize_t, struct sockaddr_in *, struct timespec *); +static void pr_retip(struct ip *, const u_char *); static void status(int); static void stopit(int); static void usage(void) __dead2; @@ -232,7 +233,6 @@ main(int argc, char *const *argv) struct in_addr ifaddr; struct timespec last, intvl; struct iovec iov; - struct ip *ip; struct msghdr msg; struct sigaction si_sa; size_t sz; @@ -687,7 +687,9 @@ main(int argc, char *const *argv) #endif /*IPSEC*/ if (options & F_HDRINCL) { - ip = (struct ip*)outpackhdr; + struct ip ip; + + memcpy(&ip, outpackhdr, sizeof(ip)); if (!(options & (F_TTL | F_MTTL))) { mib[0] = CTL_NET; mib[1] = PF_INET; @@ -698,15 +700,16 @@ main(int argc, char *const *argv) err(1, "sysctl(net.inet.ip.ttl)"); } setsockopt(ssend, IPPROTO_IP, IP_HDRINCL, &hold, sizeof(hold)); - ip->ip_v = IPVERSION; - ip->ip_hl = sizeof(struct ip) >> 2; - ip->ip_tos = tos; - ip->ip_id = 0; - ip->ip_off = htons(df ? IP_DF : 0); - ip->ip_ttl = ttl; - ip->ip_p = IPPROTO_ICMP; - ip->ip_src.s_addr = source ? sock_in.sin_addr.s_addr : INADDR_ANY; - ip->ip_dst = to->sin_addr; + ip.ip_v = IPVERSION; + ip.ip_hl = sizeof(struct ip) >> 2; + ip.ip_tos = tos; + ip.ip_id = 0; + ip.ip_off = htons(df ? IP_DF : 0); + ip.ip_ttl = ttl; + ip.ip_p = IPPROTO_ICMP; + ip.ip_src.s_addr = source ? sock_in.sin_addr.s_addr : INADDR_ANY; + ip.ip_dst = to->sin_addr; + memcpy(outpackhdr, &ip, sizeof(ip)); } /* @@ -898,7 +901,8 @@ main(int argc, char *const *argv) while (!finish_up) { struct timespec now, timeout; fd_set rfds; - int cc, n; + int n; + ssize_t cc; check_status(); if ((unsigned)srecv >= FD_SETSIZE) @@ -1016,18 +1020,17 @@ pinger(void) { struct timespec now; struct tv32 tv32; - struct ip *ip; - struct icmp *icp; + struct icmp icp; int cc, i; u_char *packet; packet = outpack; - icp = (struct icmp *)outpack; - icp->icmp_type = icmp_type; - icp->icmp_code = 0; - icp->icmp_cksum = 0; - icp->icmp_seq = htons(ntransmitted); - icp->icmp_id = ident; /* ID */ + memcpy(&icp, outpack, ICMP_MINLEN + phdr_len); + icp.icmp_type = icmp_type; + icp.icmp_code = 0; + icp.icmp_cksum = 0; + icp.icmp_seq = htons(ntransmitted); + icp.icmp_id = ident; /* ID */ CLR(ntransmitted % mx_dup_ck); @@ -1042,7 +1045,7 @@ pinger(void) tv32.tv32_sec = (uint32_t)htonl(now.tv_sec); tv32.tv32_nsec = (uint32_t)htonl(now.tv_nsec); if (options & F_TIME) - icp->icmp_otime = htonl((now.tv_sec % (24*60*60)) + icp.icmp_otime = htonl((now.tv_sec % (24*60*60)) * 1000 + now.tv_nsec / 1000000); if (timing) bcopy((void *)&tv32, @@ -1050,16 +1053,28 @@ pinger(void) sizeof(tv32)); } + memcpy(outpack, &icp, ICMP_MINLEN + phdr_len); + cc = ICMP_MINLEN + phdr_len + datalen; /* compute ICMP checksum here */ - icp->icmp_cksum = in_cksum((u_char *)icp, cc); + icp.icmp_cksum = in_cksum(outpack, cc); + /* Update icmp_cksum in the raw packet data buffer. */ + memcpy(outpack + offsetof(struct icmp, icmp_cksum), &icp.icmp_cksum, + sizeof(icp.icmp_cksum)); if (options & F_HDRINCL) { + struct ip ip; + cc += sizeof(struct ip); - ip = (struct ip *)outpackhdr; - ip->ip_len = htons(cc); - ip->ip_sum = in_cksum(outpackhdr, cc); + ip.ip_len = htons(cc); + /* Update ip_len in the raw packet data buffer. */ + memcpy(outpackhdr + offsetof(struct ip, ip_len), &ip.ip_len, + sizeof(ip.ip_len)); + ip.ip_sum = in_cksum(outpackhdr, cc); + /* Update ip_sum in the raw packet data buffer. */ + memcpy(outpackhdr + offsetof(struct ip, ip_sum), &ip.ip_sum, + sizeof(ip.ip_sum)); packet = outpackhdr; } i = send(ssend, (char *)packet, cc, 0); @@ -1089,48 +1104,62 @@ pinger(void) * program to be run without having intermingled output (or statistics!). */ static void -pr_pack(char *buf, int cc, struct sockaddr_in *from, struct timespec *tv) +pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec *tv) { struct in_addr ina; - u_char *cp, *dp; - struct icmp *icp; - struct ip *ip; - const void *tp; + u_char *cp, *dp, l; + struct icmp icp; + struct ip ip; + const u_char *icmp_data_raw; double triptime; int dupflag, hlen, i, j, recv_len; uint16_t seq; static int old_rrlen; static char old_rr[MAX_IPOPTLEN]; + struct ip oip; + u_char oip_header_len; + struct icmp oicmp; + const u_char *oicmp_raw; + /* + * Get size of IP header of the received packet. The + * information is contained in the lower four bits of the + * first byte. + */ + memcpy(&l, buf, sizeof(l)); + hlen = (l & 0x0f) << 2; + memcpy(&ip, buf, hlen); + /* Check the IP header */ - ip = (struct ip *)buf; - hlen = ip->ip_hl << 2; recv_len = cc; if (cc < hlen + ICMP_MINLEN) { if (options & F_VERBOSE) - warn("packet too short (%d bytes) from %s", cc, + warn("packet too short (%zd bytes) from %s", cc, inet_ntoa(from->sin_addr)); return; } +#ifndef icmp_data + icmp_data_raw = buf + hlen + offsetof(struct icmp, icmp_ip); +#else + icmp_data_raw = buf + hlen + offsetof(struct icmp, icmp_data); +#endif + /* Now the ICMP part */ cc -= hlen; - icp = (struct icmp *)(buf + hlen); - if (icp->icmp_type == icmp_type_rsp) { - if (icp->icmp_id != ident) + memcpy(&icp, buf + hlen, MIN((ssize_t)sizeof(icp), cc)); + if (icp.icmp_type == icmp_type_rsp) { + if (icp.icmp_id != ident) return; /* 'Twas not our ECHO */ ++nreceived; triptime = 0.0; if (timing) { struct timespec tv1; struct tv32 tv32; -#ifndef icmp_data - tp = &icp->icmp_ip; -#else - tp = icp->icmp_data; -#endif - tp = (const char *)tp + phdr_len; + const u_char *tp; + tp = icmp_data_raw + phdr_len; + if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= sizeof(tv1)) { /* Copy to avoid alignment problems: */ @@ -1150,7 +1179,7 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s timing = 0; } - seq = ntohs(icp->icmp_seq); + seq = ntohs(icp.icmp_seq); if (TST(seq % mx_dup_ck)) { ++nrepeats; @@ -1172,9 +1201,9 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s if (options & F_FLOOD) (void)write(STDOUT_FILENO, &BSPACE, 1); else { - (void)printf("%d bytes from %s: icmp_seq=%u", cc, + (void)printf("%zd bytes from %s: icmp_seq=%u", cc, pr_addr(from->sin_addr), seq); - (void)printf(" ttl=%d", ip->ip_ttl); + (void)printf(" ttl=%d", ip.ip_ttl); if (timing) (void)printf(" time=%.3f ms", triptime); if (dupflag) @@ -1184,12 +1213,12 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s if (options & F_MASK) { /* Just prentend this cast isn't ugly */ (void)printf(" mask=%s", - inet_ntoa(*(struct in_addr *)&(icp->icmp_mask))); + inet_ntoa(*(struct in_addr *)&(icp.icmp_mask))); } if (options & F_TIME) { - (void)printf(" tso=%s", pr_ntime(icp->icmp_otime)); - (void)printf(" tsr=%s", pr_ntime(icp->icmp_rtime)); - (void)printf(" tst=%s", pr_ntime(icp->icmp_ttime)); + (void)printf(" tso=%s", pr_ntime(icp.icmp_otime)); + (void)printf(" tsr=%s", pr_ntime(icp.icmp_rtime)); + (void)printf(" tst=%s", pr_ntime(icp.icmp_ttime)); } if (recv_len != send_len) { (void)printf( @@ -1197,7 +1226,8 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s recv_len, send_len); } /* check the data */ - cp = (u_char*)&icp->icmp_data[phdr_len]; + cp = (u_char*)(buf + hlen + offsetof(struct icmp, + icmp_data) + phdr_len); dp = &outpack[ICMP_MINLEN + phdr_len]; cc -= ICMP_MINLEN + phdr_len; i = 0; @@ -1212,7 +1242,8 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s (void)printf("\nwrong data byte #%d should be 0x%x but was 0x%x", i, *dp, *cp); (void)printf("\ncp:"); - cp = (u_char*)&icp->icmp_data[0]; + cp = (u_char*)(buf + hlen + + offsetof(struct icmp, icmp_data)); for (i = 0; i < datalen; ++i, ++cp) { if ((i % 16) == 8) (void)printf("\n\t"); @@ -1240,22 +1271,22 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s * as root to avoid leaking information not normally * available to those not running as root. */ -#ifndef icmp_data - struct ip *oip = &icp->icmp_ip; -#else - struct ip *oip = (struct ip *)icp->icmp_data; -#endif - struct icmp *oicmp = (struct icmp *)(oip + 1); + memcpy(&oip_header_len, icmp_data_raw, sizeof(oip_header_len)); + oip_header_len = (oip_header_len & 0x0f) << 2; + memcpy(&oip, icmp_data_raw, oip_header_len); + oicmp_raw = icmp_data_raw + oip_header_len; + memcpy(&oicmp, oicmp_raw, offsetof(struct icmp, icmp_id) + + sizeof(oicmp.icmp_id)); if (((options & F_VERBOSE) && uid == 0) || (!(options & F_QUIET2) && - (oip->ip_dst.s_addr == whereto.sin_addr.s_addr) && - (oip->ip_p == IPPROTO_ICMP) && - (oicmp->icmp_type == ICMP_ECHO) && - (oicmp->icmp_id == ident))) { - (void)printf("%d bytes from %s: ", cc, + (oip.ip_dst.s_addr == whereto.sin_addr.s_addr) && + (oip.ip_p == IPPROTO_ICMP) && + (oicmp.icmp_type == ICMP_ECHO) && + (oicmp.icmp_id == ident))) { + (void)printf("%zd bytes from %s: ", cc, pr_addr(from->sin_addr)); - pr_icmph(icp); + pr_icmph(&icp, &oip, oicmp_raw); } else return; } @@ -1441,7 +1472,7 @@ static char *ttab[] = { * Print a descriptive string about an ICMP header. */ static void -pr_icmph(struct icmp *icp) +pr_icmph(struct icmp *icp, struct ip *oip, const u_char *const oicmp_raw) { switch(icp->icmp_type) { @@ -1479,19 +1510,11 @@ pr_icmph(struct icmp *icp) break; } /* Print returned IP header information */ -#ifndef icmp_data - pr_retip(&icp->icmp_ip); -#else - pr_retip((struct ip *)icp->icmp_data); -#endif + pr_retip(oip, oicmp_raw); break; case ICMP_SOURCEQUENCH: (void)printf("Source Quench\n"); -#ifndef icmp_data - pr_retip(&icp->icmp_ip); -#else - pr_retip((struct ip *)icp->icmp_data); -#endif + pr_retip(oip, oicmp_raw); break; case ICMP_REDIRECT: switch(icp->icmp_code) { @@ -1512,11 +1535,7 @@ pr_icmph(struct icmp *icp) break; } (void)printf("(New addr: %s)\n", inet_ntoa(icp->icmp_gwaddr)); -#ifndef icmp_data - pr_retip(&icp->icmp_ip); -#else - pr_retip((struct ip *)icp->icmp_data); -#endif + pr_retip(oip, oicmp_raw); break; case ICMP_ECHO: (void)printf("Echo Request\n"); @@ -1535,20 +1554,12 @@ pr_icmph(struct icmp *icp) icp->icmp_code); break; } -#ifndef icmp_data - pr_retip(&icp->icmp_ip); -#else - pr_retip((struct ip *)icp->icmp_data); -#endif + pr_retip(oip, oicmp_raw); break; case ICMP_PARAMPROB: (void)printf("Parameter problem: pointer = 0x%02x\n", icp->icmp_hun.ih_pptr); -#ifndef icmp_data - pr_retip(&icp->icmp_ip); -#else - pr_retip((struct ip *)icp->icmp_data); -#endif + pr_retip(oip, oicmp_raw); break; case ICMP_TSTAMP: (void)printf("Timestamp\n"); @@ -1646,14 +1657,9 @@ pr_addr(struct in_addr ina) * Dump some info on a returned (via ICMP) IP packet. */ static void -pr_retip(struct ip *ip) +pr_retip(struct ip *ip, const u_char *cp) { - u_char *cp; - int hlen; - pr_iph(ip); - hlen = ip->ip_hl << 2; - cp = (u_char *)ip + hlen; if (ip->ip_p == 6) (void)printf("TCP: from port %u, to port %u (decimal)\n", From owner-svn-src-head@freebsd.org Fri Aug 23 22:05:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B387CCF8E3 for ; Fri, 23 Aug 2019 22:05:39 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Fb7Q46n1z4FYj for ; Fri, 23 Aug 2019 22:05:38 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72d.google.com with SMTP id m10so9562034qkk.1 for ; Fri, 23 Aug 2019 15:05:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KzMGq7lpQxwmhW5C/IZVGmln+AiogLi0Dj1KvKeE29s=; b=ltRHLJTXDC+Cvw2LlXK0Tndc9bASn0ZTGQ0XdrREBVr1In/xROdmJ53yfaOhLR10rG gMQHYnDjpUlnpAlmgoSQGZIUmDnvLbA7cOuUB5tvgW1GIasW/TGqvBr2l2H0kz5XoMEY HiMzEOZusIeyJK/RqCWjb+cTylouchxb5zv0Wmy+YjhWsVwIUtTOw5vOUuv0HAQSVcps mK4QNIJ1g2i2KDLn1Dk7DigqFWMTyxjS2FHwdtzxAPkgBr6JG72O/aeXt1/4lMsjmPwF P2sV9mprK7Yv2aWVCoOp2GcX1Uk7bG9VegonvhDiAh6INTL5PTwvJVyTsFQYyqUY/FKM FKMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KzMGq7lpQxwmhW5C/IZVGmln+AiogLi0Dj1KvKeE29s=; b=NhvKSyTzpfQiZuA69u+L6cnO3fSTB2EH7H4J/pMqxkGxKEq2wfQ44+zXCxhoUhCBT8 SJnzoiB+SEyc78n2zMbywxpjZlR+RbC4OX78Bst8Uq4ATpU7VE+TwIKc8xa0vqukXbYx Ux/DxjKM79rTo1FXJuPIpmiICXHNOXjLtKk/hGSfKjowDWBCuhPMCGKVoJ7xOEhf1Z4j nnZThRbe/BZG+pN+bR5R0pLL/fb6BIt9KOiAA0bZJYe9+NKqO76CAxR6OFSaJjFbilyf 2LdJXIEdJR1dBYTenJfOvuemr68WUkaUNy9KgMVzhvdJjvG9F1YGTlSgQpu+uPc8wY1w J4wg== X-Gm-Message-State: APjAAAXYav7jk7vL0RDhaDLVWumH+T0gOfgAKdWNeHxwZ2lEv8vWGAkA mXWUszYfUqybNGGMsvUtgFuIyttjYivrmiL1gD0IDg== X-Google-Smtp-Source: APXvYqzHLjmNW0awVbjp203tRNPg2ccexaqjwTbCl2oA8zda7jzd4BT4BWV7x2+elNZ3E4CMYrNUkapUMuZ4pQ9jGMU= X-Received: by 2002:a37:4b03:: with SMTP id y3mr6498895qka.215.1566597937184; Fri, 23 Aug 2019 15:05:37 -0700 (PDT) MIME-Version: 1.0 References: <201908220002.x7M028Jh070116@repo.freebsd.org> <0b9d1aa1-d328-30bc-b939-f1407e236855@FreeBSD.org> <3EE09B22-254B-4415-8865-D9542122ACA5@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Fri, 23 Aug 2019 16:05:26 -0600 Message-ID: Subject: Re: svn commit: r351364 - in head/sys: crypto/blowfish crypto/chacha20 crypto/des opencrypto To: "Conrad E. Meyer" Cc: "Bjoern A. Zeeb" , Li-Wen Hsu , John Baldwin , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46Fb7Q46n1z4FYj X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=ltRHLJTX; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72d) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-5.93 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-0.996,0]; RCVD_IN_DNSWL_NONE(0.00)[d.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.93)[ip: (-9.38), ipnet: 2607:f8b0::/32(-2.87), asn: 15169(-2.34), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 22:05:39 -0000 On Fri, Aug 23, 2019 at 12:26 PM Conrad Meyer wrote: > At expected peril of wading into a thread >4 emails deep, > > @Warner, modern GCC reports a similar warning; it just doesn't become > an error (at least in CI?). I'm not sure of the mechanism. Maybe > CI-specific? Old GCC didn't have a -Wno-error for -Wcast-qual, so > -Wcast-qual + -Werror there produced an error; that's why > $NO_WCAST_QUAL in conf/kern.mk is defined to -Wno-cast-qual for old > GCC but -Wno-error=3Dcast-qual for newer compilers. That said, this > file does not appear to be compiled with ${NO_WCAST_QUAL} either way. > Yea. I'm unsure. It's an odd warning, and an odd way to get around it. In general, nobody cares about gcc 4.2.1, so pinning implementing that belief to this specific bug may have been unwise. I just assumed newer versions wouldn't warn on this, but I saw on IRC that the types are stupidly different... > @Bjoern, > > So... why does GCC warn about this? key is const uint8_t*. The cast > is to const des_cblock *. I think the problem is that des_cblock is > defined as 'unsigned char [8]', so a 'const des cblock *' is actually > a 'const unsigned char**'? So... I think basically the entire des > subsystem may be accidentally using the wrong pointer level > throughout? The constify change just exposes that because correct > const-preserving cast of 'const foo*' to 'foo**' would be 'foo * const > *' (if I'm understanding this correctly). > > Maybe one more reason to excise des from the tree. Ha! No comment :) Warner > Best, > Conrad > > > On Fri, Aug 23, 2019 at 9:59 AM Bjoern A. Zeeb wrote: > > > > On 23 Aug 2019, at 16:48, Warner Losh wrote: > > > There's a lot of -Wno-error and -Wno-error=3DXXX sprinkled in our bui= ld > > > for > > > gcc 4.2.1 today, so we see the warnings but aren't stopped by them. M= y > > > changes take a big hammer and add a global -Wno-error to CFLAGS last > > > to > > > make this the behavior on gcc 4.2.1 platforms. > > > > > > Yes, but that didn=E2=80=99t answer my questions. It doesn=E2=80=99t h= elp to try to > > avoid undefined C behaviour. > > > > That jenkins build seems to use the toolchain from ports and with that > > gcc 6.4.0. > > > > We see the same warning but it didn=E2=80=99t error as it seems to have= done > > for other architectures with the in-tree gcc with the same warnings: > > > > In file included from /workspace/src/sys/opencrypto/xform.c:94:0: > > /workspace/src/sys/opencrypto/xform_des1.c: In function 'des1_setkey': > > /workspace/src/sys/opencrypto/xform_des1.c:102:15: warning: cast > > discards 'const' qualifier from pointer target type [-Wcast-qual] > > des_set_key((const des_cblock *) key, p[0]); > > ^ > > In file included from /workspace/src/sys/opencrypto/xform.c:95:0: > > /workspace/src/sys/opencrypto/xform_des3.c: In function 'des3_setkey': > > /workspace/src/sys/opencrypto/xform_des3.c:103:15: warning: cast > > discards 'const' qualifier from pointer target type [-Wcast-qual] > > des_set_key((const des_cblock *)(key + 0), p[0]); > > ^ > > /workspace/src/sys/opencrypto/xform_des3.c:104:15: warning: cast > > discards 'const' qualifier from pointer target type [-Wcast-qual] > > des_set_key((const des_cblock *)(key + 8), p[1]); > > ^ > > /workspace/src/sys/opencrypto/xform_des3.c:105:15: warning: cast > > discards 'const' qualifier from pointer target type [-Wcast-qual] > > des_set_key((const des_cblock *)(key + 16), p[2]); > > ^ > > -- > > > > > > > > To me this means that we treat different versions of compilers (in-tree > > and out-of-tree, gcc vs. clang) too different. > > > > If two versions of gcc (before your commit) gave the same warning I > > would have expected them to equally fail and not one fail and one pass? > > > > My question was: why was that the case? > > > > /bz > > > From owner-svn-src-head@freebsd.org Fri Aug 23 22:22:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC29FCFE21; Fri, 23 Aug 2019 22:22:34 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FbVy60M5z4GTt; Fri, 23 Aug 2019 22:22:34 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEEC5235B3; Fri, 23 Aug 2019 22:22:34 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7NMMYjT017215; Fri, 23 Aug 2019 22:22:34 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NMMYwm017214; Fri, 23 Aug 2019 22:22:34 GMT (envelope-from np@FreeBSD.org) Message-Id: <201908232222.x7NMMYwm017214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 23 Aug 2019 22:22:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351444 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 351444 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 22:22:35 -0000 Author: np Date: Fri Aug 23 22:22:34 2019 New Revision: 351444 URL: https://svnweb.freebsd.org/changeset/base/351444 Log: cxgbe(4): Use the same buffer size for TOE rx queues as the NIC rx queues. This is a minor simplification. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Fri Aug 23 22:17:36 2019 (r351443) +++ head/sys/dev/cxgbe/t4_sge.c Fri Aug 23 22:22:34 2019 (r351444) @@ -1112,26 +1112,12 @@ t4_teardown_adapter_queues(struct adapter *sc) /* Maximum payload that can be delivered with a single iq descriptor */ static inline int -mtu_to_max_payload(struct adapter *sc, int mtu, const int toe) +mtu_to_max_payload(struct adapter *sc, int mtu) { - int payload; -#ifdef TCP_OFFLOAD - if (toe) { - int rxcs = G_RXCOALESCESIZE(t4_read_reg(sc, A_TP_PARA_REG2)); - - /* Note that COP can set rx_coalesce on/off per connection. */ - payload = max(mtu, rxcs); - } else { -#endif - /* large enough even when hw VLAN extraction is disabled */ - payload = sc->params.sge.fl_pktshift + ETHER_HDR_LEN + - ETHER_VLAN_ENCAP_LEN + mtu; -#ifdef TCP_OFFLOAD - } -#endif - - return (payload); + /* large enough even when hw VLAN extraction is disabled */ + return (sc->params.sge.fl_pktshift + ETHER_HDR_LEN + + ETHER_VLAN_ENCAP_LEN + mtu); } int @@ -1201,7 +1187,7 @@ t4_setup_vi_queues(struct vi_info *vi) * Allocate rx queues first because a default iqid is required when * creating a tx queue. */ - maxp = mtu_to_max_payload(sc, mtu, 0); + maxp = mtu_to_max_payload(sc, mtu); oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "rxq", CTLFLAG_RD, NULL, "rx queues"); for_each_rxq(vi, i, rxq) { @@ -1223,7 +1209,6 @@ t4_setup_vi_queues(struct vi_info *vi) intr_idx = saved_idx + max(vi->nrxq, vi->nnmrxq); #endif #ifdef TCP_OFFLOAD - maxp = mtu_to_max_payload(sc, mtu, 1); oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "ofld_rxq", CTLFLAG_RD, NULL, "rx queues for offloaded TCP connections"); for_each_ofld_rxq(vi, i, ofld_rxq) { @@ -2194,7 +2179,7 @@ t4_update_fl_bufsize(struct ifnet *ifp) struct sge_fl *fl; int i, maxp, mtu = ifp->if_mtu; - maxp = mtu_to_max_payload(sc, mtu, 0); + maxp = mtu_to_max_payload(sc, mtu); for_each_rxq(vi, i, rxq) { fl = &rxq->fl; @@ -2203,7 +2188,6 @@ t4_update_fl_bufsize(struct ifnet *ifp) FL_UNLOCK(fl); } #ifdef TCP_OFFLOAD - maxp = mtu_to_max_payload(sc, mtu, 1); for_each_ofld_rxq(vi, i, ofld_rxq) { fl = &ofld_rxq->fl; From owner-svn-src-head@freebsd.org Fri Aug 23 22:34:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 974DCD00FC; Fri, 23 Aug 2019 22:34:15 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FbmR3M77z4Gw8; Fri, 23 Aug 2019 22:34:15 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55A752377B; Fri, 23 Aug 2019 22:34:15 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7NMYFVE023285; Fri, 23 Aug 2019 22:34:15 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NMYF1L023283; Fri, 23 Aug 2019 22:34:15 GMT (envelope-from np@FreeBSD.org) Message-Id: <201908232234.x7NMYF1L023283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 23 Aug 2019 22:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351445 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 351445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 22:34:15 -0000 Author: np Date: Fri Aug 23 22:34:14 2019 New Revision: 351445 URL: https://svnweb.freebsd.org/changeset/base/351445 Log: whitespace nit. Modified: head/sys/dev/cxgbe/tom/t4_listen.c Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Fri Aug 23 22:22:34 2019 (r351444) +++ head/sys/dev/cxgbe/tom/t4_listen.c Fri Aug 23 22:34:14 2019 (r351445) @@ -1145,7 +1145,7 @@ get_l2te_for_nexthop(struct port_info *pi, struct ifne struct l2t_entry *e; struct sockaddr_in6 sin6; struct sockaddr *dst = (void *)&sin6; - + if (inc->inc_flags & INC_ISIPV6) { struct nhop6_basic nh6; From owner-svn-src-head@freebsd.org Fri Aug 23 22:41:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9815D01B8; Fri, 23 Aug 2019 22:41:17 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FbwY41WCz4HHv; Fri, 23 Aug 2019 22:41:17 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6BB05237B8; Fri, 23 Aug 2019 22:41:17 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7NMfHik026828; Fri, 23 Aug 2019 22:41:17 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NMfHT3026809; Fri, 23 Aug 2019 22:41:17 GMT (envelope-from np@FreeBSD.org) Message-Id: <201908232241.x7NMfHT3026809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 23 Aug 2019 22:41:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351446 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 351446 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 22:41:17 -0000 Author: np Date: Fri Aug 23 22:41:16 2019 New Revision: 351446 URL: https://svnweb.freebsd.org/changeset/base/351446 Log: cxgbe/t4_tom: Any invalid scaling factor in the hardware's wsf field implies that window scaling is not in use. MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_listen.c Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Fri Aug 23 22:34:14 2019 (r351445) +++ head/sys/dev/cxgbe/tom/t4_listen.c Fri Aug 23 22:41:16 2019 (r351446) @@ -994,7 +994,7 @@ t4opt_to_tcpopt(const struct tcp_options *t4opt, struc to->to_mss = be16toh(t4opt->mss); } - if (t4opt->wsf) { + if (t4opt->wsf > 0 && t4opt->wsf < 15) { to->to_flags |= TOF_SCALE; to->to_wscale = t4opt->wsf; } From owner-svn-src-head@freebsd.org Fri Aug 23 22:52:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3DBDD04E2; Fri, 23 Aug 2019 22:52:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FcB33m8Xz4HsT; Fri, 23 Aug 2019 22:52:59 +0000 (UTC) (envelope-from imp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62A8023B0B; Fri, 23 Aug 2019 22:52:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7NMqxbh034761; Fri, 23 Aug 2019 22:52:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NMqwLq034758; Fri, 23 Aug 2019 22:52:58 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908232252.x7NMqwLq034758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Aug 2019 22:52:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351447 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 351447 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 22:52:59 -0000 Author: imp Date: Fri Aug 23 22:52:58 2019 New Revision: 351447 URL: https://svnweb.freebsd.org/changeset/base/351447 Log: It turns out the duplication is only mostly harmless. While it worked with the kenrel, it wasn't working with the loader. It failed to handle dependencies correctly. The reason for that is that we never created a nvme module with the DRIVER_MODULE, but instead a nvme_pci and nvme_ahci module. Create a real nvme module that nvd can be dependent on so it can import the nvme symbols it needs from there. Arguably, nvd should just be a simple child of nvme, but transitioning to that (and winning that argument given why it was done this way) is beyond the scope of this change. Reviewed by: jhb@ Differential Revision: https://reviews.freebsd.org/D21382 Modified: head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme_ahci.c head/sys/dev/nvme/nvme_pci.c Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Fri Aug 23 22:41:16 2019 (r351446) +++ head/sys/dev/nvme/nvme.c Fri Aug 23 22:52:58 2019 (r351447) @@ -364,3 +364,19 @@ nvme_completion_poll_cb(void *arg, const struct nvme_c memcpy(&status->cpl, cpl, sizeof(*cpl)); atomic_store_rel_int(&status->done, 1); } + +static int +nvme_modevent(module_t mod __unused, int type __unused, void *argp __unused) +{ + return (0); +} + +static moduledata_t nvme_mod = { + "nvme", + nvme_modevent, + 0 +}; + +DECLARE_MODULE(nvme, nvme_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); +MODULE_VERSION(nvme, 1); +MODULE_DEPEND(nvme, cam, 1, 1, 1); Modified: head/sys/dev/nvme/nvme_ahci.c ============================================================================== --- head/sys/dev/nvme/nvme_ahci.c Fri Aug 23 22:41:16 2019 (r351446) +++ head/sys/dev/nvme/nvme_ahci.c Fri Aug 23 22:52:58 2019 (r351447) @@ -55,8 +55,6 @@ static driver_t nvme_ahci_driver = { }; DRIVER_MODULE(nvme, ahci, nvme_ahci_driver, nvme_devclass, NULL, 0); -MODULE_VERSION(nvme, 1); -MODULE_DEPEND(nvme, cam, 1, 1, 1); static int nvme_ahci_probe (device_t device) Modified: head/sys/dev/nvme/nvme_pci.c ============================================================================== --- head/sys/dev/nvme/nvme_pci.c Fri Aug 23 22:41:16 2019 (r351446) +++ head/sys/dev/nvme/nvme_pci.c Fri Aug 23 22:52:58 2019 (r351447) @@ -62,8 +62,6 @@ static driver_t nvme_pci_driver = { }; DRIVER_MODULE(nvme, pci, nvme_pci_driver, nvme_devclass, NULL, 0); -MODULE_VERSION(nvme, 1); -MODULE_DEPEND(nvme, cam, 1, 1, 1); static struct _pcsid { From owner-svn-src-head@freebsd.org Sat Aug 24 00:01:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A00FD1673; Sat, 24 Aug 2019 00:01:20 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Fdhw396Rz4L6p; Sat, 24 Aug 2019 00:01:20 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4856124784; Sat, 24 Aug 2019 00:01:20 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7O01KC9072801; Sat, 24 Aug 2019 00:01:20 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7O01Jcs072799; Sat, 24 Aug 2019 00:01:19 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908240001.x7O01Jcs072799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 24 Aug 2019 00:01:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351448 - in head/sys: kern vm X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern vm X-SVN-Commit-Revision: 351448 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 00:01:20 -0000 Author: mjg Date: Sat Aug 24 00:01:19 2019 New Revision: 351448 URL: https://svnweb.freebsd.org/changeset/base/351448 Log: Remove the obsolete pcpu_zone_ptr zone. It was only used by flowtable (removed in r321618). Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/subr_pcpu.c head/sys/vm/uma.h Modified: head/sys/kern/subr_pcpu.c ============================================================================== --- head/sys/kern/subr_pcpu.c Fri Aug 23 22:52:58 2019 (r351447) +++ head/sys/kern/subr_pcpu.c Sat Aug 24 00:01:19 2019 (r351448) @@ -131,12 +131,10 @@ SYSINIT(dpcpu, SI_SUB_KLD, SI_ORDER_FIRST, dpcpu_start /* * UMA_PCPU_ZONE zones, that are available for all kernel - * consumers. Right now 64 bit zone is used for counter(9) - * and pointer zone is used by flowtable. + * consumers. Right now 64 bit zone is used for counter(9). */ uma_zone_t pcpu_zone_64; -uma_zone_t pcpu_zone_ptr; static void pcpu_zones_startup(void) @@ -144,12 +142,6 @@ pcpu_zones_startup(void) pcpu_zone_64 = uma_zcreate("64 pcpu", sizeof(uint64_t), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); - - if (sizeof(uint64_t) == sizeof(void *)) - pcpu_zone_ptr = pcpu_zone_64; - else - pcpu_zone_ptr = uma_zcreate("ptr pcpu", sizeof(void *), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); } SYSINIT(pcpu_zones, SI_SUB_VM, SI_ORDER_ANY, pcpu_zones_startup, NULL); Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Fri Aug 23 22:52:58 2019 (r351447) +++ head/sys/vm/uma.h Sat Aug 24 00:01:19 2019 (r351448) @@ -650,7 +650,6 @@ int uma_zone_exhausted_nolock(uma_zone_t zone); * Common UMA_ZONE_PCPU zones. */ extern uma_zone_t pcpu_zone_64; -extern uma_zone_t pcpu_zone_ptr; /* * Exported statistics structures to be used by user space monitoring tools. From owner-svn-src-head@freebsd.org Sat Aug 24 01:28:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06735D3EAF; Sat, 24 Aug 2019 01:28:40 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Fgdg65zYz4TWT; Sat, 24 Aug 2019 01:28:39 +0000 (UTC) (envelope-from lwhsu@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C83F1256AA; Sat, 24 Aug 2019 01:28:39 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7O1Sdo1028850; Sat, 24 Aug 2019 01:28:39 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7O1SdSD028848; Sat, 24 Aug 2019 01:28:39 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201908240128.x7O1SdSD028848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sat, 24 Aug 2019 01:28:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351450 - in head/tests/sys/netpfil: common pf X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: in head/tests/sys/netpfil: common pf X-SVN-Commit-Revision: 351450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 01:28:40 -0000 Author: lwhsu Date: Sat Aug 24 01:28:39 2019 New Revision: 351450 URL: https://svnweb.freebsd.org/changeset/base/351450 Log: Fix failure test cases after r351423 due to ping6(8) options changed Failure test cases: sys.netpfil.common.pass_block.pf_v6 sys.netpfil.pf.pass_block.noalias sys.netpfil.pf.pass_block.v6 Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/netpfil/common/pass_block.sh head/tests/sys/netpfil/pf/pass_block.sh Modified: head/tests/sys/netpfil/common/pass_block.sh ============================================================================== --- head/tests/sys/netpfil/common/pass_block.sh Sat Aug 24 00:35:59 2019 (r351449) +++ head/tests/sys/netpfil/common/pass_block.sh Sat Aug 24 01:28:39 2019 (r351450) @@ -99,7 +99,7 @@ v6_body() "ipf" \ "block in all" - atf_check -s exit:2 -o ignore ping6 -c 1 -x 1 fd7a:803f:cc4b::2 + atf_check -s exit:2 -o ignore ping6 -c 1 -W 1 fd7a:803f:cc4b::2 # Pass All firewall_config "iron" ${firewall} \ @@ -110,7 +110,7 @@ v6_body() "ipf" \ "pass in all" - atf_check -s exit:0 -o ignore ping6 -c 1 -x 1 fd7a:803f:cc4b::2 + atf_check -s exit:0 -o ignore ping6 -c 1 -W 1 fd7a:803f:cc4b::2 } v6_cleanup() @@ -126,4 +126,4 @@ setup_tests "v4" \ "v6" \ "pf" \ "ipfw" \ - "ipf" \ No newline at end of file + "ipf" Modified: head/tests/sys/netpfil/pf/pass_block.sh ============================================================================== --- head/tests/sys/netpfil/pf/pass_block.sh Sat Aug 24 00:35:59 2019 (r351449) +++ head/tests/sys/netpfil/pf/pass_block.sh Sat Aug 24 01:28:39 2019 (r351450) @@ -60,23 +60,23 @@ v6_body() jexec alcatraz ifconfig ${epair}b inet6 2001:db8:42::2/64 up no_dad # Trivial ping to the jail, without pf - atf_check -s exit:0 -o ignore ping6 -c 1 -x 1 2001:db8:42::2 + atf_check -s exit:0 -o ignore ping6 -c 1 -W 1 2001:db8:42::2 # pf without policy will let us ping jexec alcatraz pfctl -e - atf_check -s exit:0 -o ignore ping6 -c 1 -x 1 2001:db8:42::2 + atf_check -s exit:0 -o ignore ping6 -c 1 -W 1 2001:db8:42::2 # Block everything pft_set_rules alcatraz "block in" - atf_check -s exit:2 -o ignore ping6 -c 1 -x 1 2001:db8:42::2 + atf_check -s exit:2 -o ignore ping6 -c 1 -W 1 2001:db8:42::2 # Block everything but ICMP pft_set_rules alcatraz "block in" "pass in proto icmp6" - atf_check -s exit:0 -o ignore ping6 -c 1 -x 1 2001:db8:42::2 + atf_check -s exit:0 -o ignore ping6 -c 1 -W 1 2001:db8:42::2 # Allowing ICMPv4 does not allow ICMPv6 pft_set_rules alcatraz "block in" "pass in proto icmp" - atf_check -s exit:2 -o ignore ping6 -c 1 -x 1 2001:db8:42::2 + atf_check -s exit:2 -o ignore ping6 -c 1 -W 1 2001:db8:42::2 } v6_cleanup() @@ -107,21 +107,21 @@ noalias_body() | cut -d % -f 1) # Sanity check - atf_check -s exit:0 -o ignore ping6 -c 3 -x 1 2001:db8:42::2 - atf_check -s exit:0 -o ignore ping6 -c 3 -x 1 ${linklocaladdr}%${epair}a + atf_check -s exit:0 -o ignore ping6 -c 3 -W 1 2001:db8:42::2 + atf_check -s exit:0 -o ignore ping6 -c 3 -W 1 ${linklocaladdr}%${epair}a jexec alcatraz pfctl -e pft_set_rules alcatraz "block out inet6 from (${epair}b:0) to any" - atf_check -s exit:2 -o ignore ping6 -c 3 -x 1 2001:db8:42::2 + atf_check -s exit:2 -o ignore ping6 -c 3 -W 1 2001:db8:42::2 # We should still be able to ping the link-local address - atf_check -s exit:0 -o ignore ping6 -c 3 -x 1 ${linklocaladdr}%${epair}a + atf_check -s exit:0 -o ignore ping6 -c 3 -W 1 ${linklocaladdr}%${epair}a pft_set_rules alcatraz "block out inet6 from (${epair}b) to any" # We cannot ping to the link-local address - atf_check -s exit:2 -o ignore ping6 -c 3 -x 1 ${linklocaladdr}%${epair}a + atf_check -s exit:2 -o ignore ping6 -c 3 -W 1 ${linklocaladdr}%${epair}a } noalias_cleanup() From owner-svn-src-head@freebsd.org Sat Aug 24 13:26:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BDA1C0329; Sat, 24 Aug 2019 13:26:36 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FzZ36WdCz3Fm3; Sat, 24 Aug 2019 13:26:35 +0000 (UTC) (envelope-from ganbold@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB6115C40; Sat, 24 Aug 2019 13:26:35 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7ODQZ4A055339; Sat, 24 Aug 2019 13:26:35 GMT (envelope-from ganbold@FreeBSD.org) Received: (from ganbold@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7ODQZjm055336; Sat, 24 Aug 2019 13:26:35 GMT (envelope-from ganbold@FreeBSD.org) Message-Id: <201908241326.x7ODQZjm055336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ganbold set sender to ganbold@FreeBSD.org using -f From: Ganbold Tsagaankhuu Date: Sat, 24 Aug 2019 13:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351452 - in head/sys: dts/arm/overlays modules/dtb/allwinner X-SVN-Group: head X-SVN-Commit-Author: ganbold X-SVN-Commit-Paths: in head/sys: dts/arm/overlays modules/dtb/allwinner X-SVN-Commit-Revision: 351452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 13:26:36 -0000 Author: ganbold Date: Sat Aug 24 13:26:34 2019 New Revision: 351452 URL: https://svnweb.freebsd.org/changeset/base/351452 Log: dtso: allwinner: Add an overlay for H3 thermal node Reviewed by: manu Added: head/sys/dts/arm/overlays/sun8i-h3-ths.dtso (contents, props changed) Modified: head/sys/dts/arm/overlays/sun8i-h3-sid.dtso head/sys/modules/dtb/allwinner/Makefile Modified: head/sys/dts/arm/overlays/sun8i-h3-sid.dtso ============================================================================== --- head/sys/dts/arm/overlays/sun8i-h3-sid.dtso Sat Aug 24 12:51:46 2019 (r351451) +++ head/sys/dts/arm/overlays/sun8i-h3-sid.dtso Sat Aug 24 13:26:34 2019 (r351452) @@ -10,5 +10,10 @@ compatible = "allwinner,sun8i-h3-sid"; reg = <0x1c14000 0x400>; status = "okay"; + + /* Data cells */ + ths_calib: calib@234 { + reg = <0x234 0x2>; + }; }; }; Added: head/sys/dts/arm/overlays/sun8i-h3-ths.dtso ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dts/arm/overlays/sun8i-h3-ths.dtso Sat Aug 24 13:26:34 2019 (r351452) @@ -0,0 +1,27 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/ { + compatible = "allwinner,sun8i-h3"; +}; + +&{/soc} { + ths: thermal_sensor@1c25000 { + compatible = "allwinner,sun8i-h3-ths"; + reg = <0x01c25000 0x100>; + interrupts = ; + clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_THS>; + clock-names = "apb", "ths"; + resets = <&ccu RST_BUS_THS>; + reset-names = "apb"; + #thermal-sensor-cells = <0>; + status = "okay"; + + nvmem-cells = <&ths_calib>; + nvmem-cell-names = "ths-calib"; + }; +}; Modified: head/sys/modules/dtb/allwinner/Makefile ============================================================================== --- head/sys/modules/dtb/allwinner/Makefile Sat Aug 24 12:51:46 2019 (r351451) +++ head/sys/modules/dtb/allwinner/Makefile Sat Aug 24 13:26:34 2019 (r351452) @@ -25,7 +25,8 @@ DTS= \ DTSO= sun8i-a83t-sid.dtso \ sun8i-h3-i2c0.dtso \ - sun8i-h3-sid.dtso + sun8i-h3-sid.dtso \ + sun8i-h3-ths.dtso LINKS= \ ${DTBDIR}/sun4i-a10-cubieboard.dtb ${DTBDIR}/cubieboard.dtb \ From owner-svn-src-head@freebsd.org Sat Aug 24 14:29:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06EE7C1648; Sat, 24 Aug 2019 14:29:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46G0yK6M3bz3Hsd; Sat, 24 Aug 2019 14:29:13 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBC92671E; Sat, 24 Aug 2019 14:29:13 +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 x7OETDqq090608; Sat, 24 Aug 2019 14:29:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7OETDMA090607; Sat, 24 Aug 2019 14:29:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908241429.x7OETDMA090607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Aug 2019 14:29:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351453 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 351453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 14:29:14 -0000 Author: kib Date: Sat Aug 24 14:29:13 2019 New Revision: 351453 URL: https://svnweb.freebsd.org/changeset/base/351453 Log: Make stack grow use the same gap as stack create. Store stack_guard_page * PAGE_SIZE into the gap->next_read field at the time of the stack creation. This makes the used guard size consistent between stack creation and stack grow time. Suggested by: alc Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D21384 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sat Aug 24 13:26:34 2019 (r351452) +++ head/sys/vm/vm_map.c Sat Aug 24 14:29:13 2019 (r351453) @@ -4189,8 +4189,20 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, rv = vm_map_insert(map, NULL, 0, gap_bot, gap_top, VM_PROT_NONE, VM_PROT_NONE, MAP_CREATE_GUARD | (orient == MAP_STACK_GROWS_DOWN ? MAP_CREATE_STACK_GAP_DN : MAP_CREATE_STACK_GAP_UP)); - if (rv != KERN_SUCCESS) + if (rv == KERN_SUCCESS) { + /* + * Gap can never successfully handle a fault, so + * read-ahead logic is never used for it. Re-use + * next_read of the gap entry to store + * stack_guard_page for vm_map_growstack(). + */ + if (orient == MAP_STACK_GROWS_DOWN) + new_entry->prev->next_read = sgp; + else + new_entry->next->next_read = sgp; + } else { (void)vm_map_delete(map, bot, top); + } return (rv); } @@ -4231,7 +4243,6 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_ma MPASS(!map->system_map); - guard = stack_guard_page * PAGE_SIZE; lmemlim = lim_cur(curthread, RLIMIT_MEMLOCK); stacklim = lim_cur(curthread, RLIMIT_STACK); vmemlim = lim_cur(curthread, RLIMIT_VMEM); @@ -4258,6 +4269,7 @@ retry: } else { return (KERN_FAILURE); } + guard = gap_entry->next_read; max_grow = gap_entry->end - gap_entry->start; if (guard > max_grow) return (KERN_NO_SPACE); From owner-svn-src-head@freebsd.org Sat Aug 24 15:22:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 768CFC2734; Sat, 24 Aug 2019 15:22:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46G27b2ZNvz3Kx3; Sat, 24 Aug 2019 15:22:19 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A07B71DF; Sat, 24 Aug 2019 15:22: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 x7OFMJjN024838; Sat, 24 Aug 2019 15:22:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7OFMJD3024837; Sat, 24 Aug 2019 15:22:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908241522.x7OFMJD3024837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Aug 2019 15:22:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351454 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 351454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 15:22:19 -0000 Author: kib Date: Sat Aug 24 15:22:18 2019 New Revision: 351454 URL: https://svnweb.freebsd.org/changeset/base/351454 Log: Remove unecessary VM_ALLOC_ZERO from allocation of the domain-local page for pcpu. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21320 Modified: head/sys/amd64/amd64/mp_machdep.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Sat Aug 24 14:29:13 2019 (r351453) +++ head/sys/amd64/amd64/mp_machdep.c Sat Aug 24 15:22:18 2019 (r351454) @@ -401,7 +401,7 @@ mp_realloc_pcpu(int cpuid, int domain) if (_vm_phys_domain(pmap_kextract(oa)) == domain) return; m = vm_page_alloc_domain(NULL, 0, domain, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_ZERO); + VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ); na = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); pagecopy((void *)oa, (void *)na); pmap_enter(kernel_pmap, oa, m, VM_PROT_READ | VM_PROT_WRITE, 0, 0); From owner-svn-src-head@freebsd.org Sat Aug 24 15:25:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EDC36C282A; Sat, 24 Aug 2019 15:25:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46G2Ck53djz3L7X; Sat, 24 Aug 2019 15:25:54 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BB657205; Sat, 24 Aug 2019 15:25:54 +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 x7OFPsjD026011; Sat, 24 Aug 2019 15:25:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7OFPss0026010; Sat, 24 Aug 2019 15:25:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908241525.x7OFPss0026010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Aug 2019 15:25:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351455 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 351455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 15:25:55 -0000 Author: kib Date: Sat Aug 24 15:25:53 2019 New Revision: 351455 URL: https://svnweb.freebsd.org/changeset/base/351455 Log: Style. Modified: head/sys/amd64/amd64/mp_machdep.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Sat Aug 24 15:22:18 2019 (r351454) +++ head/sys/amd64/amd64/mp_machdep.c Sat Aug 24 15:25:53 2019 (r351455) @@ -510,7 +510,7 @@ native_start_all_aps(void) outb(CMOS_DATA, mpbiosreason); /* number of APs actually started */ - return mp_naps; + return (mp_naps); } From owner-svn-src-head@freebsd.org Sat Aug 24 15:28:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66042C28EA; Sat, 24 Aug 2019 15:28:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46G2Gx1l0vz3LGR; Sat, 24 Aug 2019 15:28:41 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18F8B7206; Sat, 24 Aug 2019 15:28:41 +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 x7OFSeMF026183; Sat, 24 Aug 2019 15:28:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7OFSemm026182; Sat, 24 Aug 2019 15:28:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908241528.x7OFSemm026182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Aug 2019 15:28:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351456 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 351456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 15:28:41 -0000 Author: kib Date: Sat Aug 24 15:28:40 2019 New Revision: 351456 URL: https://svnweb.freebsd.org/changeset/base/351456 Log: Do not constrain allocations for doublefault, boot, and mce stacks. All these stacks are used only once (doublefault, boot) or very rare (mce). Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21320 Modified: head/sys/amd64/amd64/mp_machdep.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Sat Aug 24 15:25:53 2019 (r351455) +++ head/sys/amd64/amd64/mp_machdep.c Sat Aug 24 15:28:40 2019 (r351456) @@ -475,13 +475,11 @@ native_start_all_aps(void) domain = acpi_pxm_get_cpu_locality(apic_id); #endif /* allocate and set up an idle stack data page */ - bootstacks[cpu] = (void *)kmem_malloc_domainset( - DOMAINSET_FIXED(domain), kstack_pages * PAGE_SIZE, + bootstacks[cpu] = (void *)kmem_malloc(kstack_pages * PAGE_SIZE, M_WAITOK | M_ZERO); - doublefault_stack = (char *)kmem_malloc_domainset( - DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); - mce_stack = (char *)kmem_malloc_domainset( - DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + doublefault_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | + M_ZERO); + mce_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); nmi_stack = (char *)kmem_malloc_domainset( DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); dbg_stack = (char *)kmem_malloc_domainset( From owner-svn-src-head@freebsd.org Sat Aug 24 15:31:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E332C2A1D; Sat, 24 Aug 2019 15:31:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46G2LD2pYJz3LSV; Sat, 24 Aug 2019 15:31:32 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41DF47251; Sat, 24 Aug 2019 15:31:32 +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 x7OFVWIC028539; Sat, 24 Aug 2019 15:31:32 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7OFVVOs028533; Sat, 24 Aug 2019 15:31:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908241531.x7OFVVOs028533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Aug 2019 15:31:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351457 - in head/sys/amd64: amd64 include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/amd64: amd64 include X-SVN-Commit-Revision: 351457 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 15:31:32 -0000 Author: kib Date: Sat Aug 24 15:31:31 2019 New Revision: 351457 URL: https://svnweb.freebsd.org/changeset/base/351457 Log: amd64: rework PCPU allocation Move pcpu KVA out of .bss into dynamically allocated VA at pmap_bootstrap(). This avoids demoting superpage mapping .data/.bss. Also it makes possible to use pmap_qenter() for installation of domain-local pcpu page on NUMA configs. Refactor pcpu and IST initialization by moving it to helper functions. Reviewed by: markj Tested by: pho Discussed with: jeff Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21320 Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/pmap.c head/sys/amd64/include/counter.h head/sys/amd64/include/md_var.h Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Sat Aug 24 15:28:40 2019 (r351456) +++ head/sys/amd64/amd64/machdep.c Sat Aug 24 15:31:31 2019 (r351457) @@ -215,7 +215,8 @@ struct kva_md_info kmi; static struct trapframe proc0_tf; struct region_descriptor r_gdt, r_idt; -struct pcpu __pcpu[MAXCPU]; +struct pcpu *__pcpu; +struct pcpu temp_bsp_pcpu; struct mtx icu_lock; @@ -1543,13 +1544,68 @@ amd64_conf_fast_syscall(void) wrmsr(MSR_SF_MASK, PSL_NT | PSL_T | PSL_I | PSL_C | PSL_D | PSL_AC); } +void +amd64_bsp_pcpu_init1(struct pcpu *pc) +{ + + PCPU_SET(prvspace, pc); + PCPU_SET(curthread, &thread0); + PCPU_SET(tssp, &common_tss[0]); + PCPU_SET(commontssp, &common_tss[0]); + PCPU_SET(tss, (struct system_segment_descriptor *)&gdt[GPROC0_SEL]); + PCPU_SET(ldt, (struct system_segment_descriptor *)&gdt[GUSERLDT_SEL]); + PCPU_SET(fs32p, &gdt[GUFS32_SEL]); + PCPU_SET(gs32p, &gdt[GUGS32_SEL]); +} + +void +amd64_bsp_pcpu_init2(uint64_t rsp0) +{ + + PCPU_SET(rsp0, rsp0); + PCPU_SET(pti_rsp0, ((vm_offset_t)PCPU_PTR(pti_stack) + + PC_PTI_STACK_SZ * sizeof(uint64_t)) & ~0xful); + PCPU_SET(curpcb, thread0.td_pcb); +} + +void +amd64_bsp_ist_init(struct pcpu *pc) +{ + struct nmi_pcpu *np; + + /* doublefault stack space, runs on ist1 */ + common_tss[0].tss_ist1 = (long)&dblfault_stack[sizeof(dblfault_stack)]; + + /* + * NMI stack, runs on ist2. The pcpu pointer is stored just + * above the start of the ist2 stack. + */ + np = ((struct nmi_pcpu *)&nmi0_stack[sizeof(nmi0_stack)]) - 1; + np->np_pcpu = (register_t)pc; + common_tss[0].tss_ist2 = (long)np; + + /* + * MC# stack, runs on ist3. The pcpu pointer is stored just + * above the start of the ist3 stack. + */ + np = ((struct nmi_pcpu *)&mce0_stack[sizeof(mce0_stack)]) - 1; + np->np_pcpu = (register_t)pc; + common_tss[0].tss_ist3 = (long)np; + + /* + * DB# stack, runs on ist4. + */ + np = ((struct nmi_pcpu *)&dbg0_stack[sizeof(dbg0_stack)]) - 1; + np->np_pcpu = (register_t)pc; + common_tss[0].tss_ist4 = (long)np; +} + u_int64_t hammer_time(u_int64_t modulep, u_int64_t physfree) { caddr_t kmdp; int gsel_tss, x; struct pcpu *pc; - struct nmi_pcpu *np; struct xstate_hdr *xhdr; u_int64_t rsp0; char *env; @@ -1623,7 +1679,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) r_gdt.rd_limit = NGDT * sizeof(gdt[0]) - 1; r_gdt.rd_base = (long) gdt; lgdt(&r_gdt); - pc = &__pcpu[0]; + pc = &temp_bsp_pcpu; wrmsr(MSR_FSBASE, 0); /* User value */ wrmsr(MSR_GSBASE, (u_int64_t)pc); @@ -1632,15 +1688,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) pcpu_init(pc, 0, sizeof(struct pcpu)); dpcpu_init((void *)(physfree + KERNBASE), 0); physfree += DPCPU_SIZE; - PCPU_SET(prvspace, pc); - PCPU_SET(curthread, &thread0); + amd64_bsp_pcpu_init1(pc); /* Non-late cninit() and printf() can be moved up to here. */ - PCPU_SET(tssp, &common_tss[0]); - PCPU_SET(commontssp, &common_tss[0]); - PCPU_SET(tss, (struct system_segment_descriptor *)&gdt[GPROC0_SEL]); - PCPU_SET(ldt, (struct system_segment_descriptor *)&gdt[GUSERLDT_SEL]); - PCPU_SET(fs32p, &gdt[GUFS32_SEL]); - PCPU_SET(gs32p, &gdt[GUGS32_SEL]); /* * Initialize mutexes. @@ -1729,31 +1778,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) finishidentcpu(); /* Final stage of CPU initialization */ initializecpu(); /* Initialize CPU registers */ - /* doublefault stack space, runs on ist1 */ - common_tss[0].tss_ist1 = (long)&dblfault_stack[sizeof(dblfault_stack)]; - - /* - * NMI stack, runs on ist2. The pcpu pointer is stored just - * above the start of the ist2 stack. - */ - np = ((struct nmi_pcpu *) &nmi0_stack[sizeof(nmi0_stack)]) - 1; - np->np_pcpu = (register_t) pc; - common_tss[0].tss_ist2 = (long) np; - - /* - * MC# stack, runs on ist3. The pcpu pointer is stored just - * above the start of the ist3 stack. - */ - np = ((struct nmi_pcpu *) &mce0_stack[sizeof(mce0_stack)]) - 1; - np->np_pcpu = (register_t) pc; - common_tss[0].tss_ist3 = (long) np; - - /* - * DB# stack, runs on ist4. - */ - np = ((struct nmi_pcpu *) &dbg0_stack[sizeof(dbg0_stack)]) - 1; - np->np_pcpu = (register_t) pc; - common_tss[0].tss_ist4 = (long) np; + amd64_bsp_ist_init(pc); /* Set the IO permission bitmap (empty due to tss seg limit) */ common_tss[0].tss_iobase = sizeof(struct amd64tss) + IOPERM_BITMAP_SIZE; @@ -1842,10 +1867,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) /* Ensure the stack is aligned to 16 bytes */ rsp0 &= ~0xFul; common_tss[0].tss_rsp0 = rsp0; - PCPU_SET(rsp0, rsp0); - PCPU_SET(pti_rsp0, ((vm_offset_t)PCPU_PTR(pti_stack) + - PC_PTI_STACK_SZ * sizeof(uint64_t)) & ~0xful); - PCPU_SET(curpcb, thread0.td_pcb); + amd64_bsp_pcpu_init2(rsp0); /* transfer to user mode */ Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Sat Aug 24 15:28:40 2019 (r351456) +++ head/sys/amd64/amd64/mp_machdep.c Sat Aug 24 15:31:31 2019 (r351457) @@ -94,7 +94,7 @@ __FBSDID("$FreeBSD$"); #define AP_BOOTPT_SZ (PAGE_SIZE * 3) -extern struct pcpu __pcpu[]; +extern struct pcpu *__pcpu; /* Temporary variables for init_secondary() */ char *doublefault_stack; @@ -404,7 +404,7 @@ mp_realloc_pcpu(int cpuid, int domain) VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ); na = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); pagecopy((void *)oa, (void *)na); - pmap_enter(kernel_pmap, oa, m, VM_PROT_READ | VM_PROT_WRITE, 0, 0); + pmap_qenter((vm_offset_t)&__pcpu[cpuid], &m, 1); /* XXX old pcpu page leaked. */ } #endif Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Aug 24 15:28:40 2019 (r351456) +++ head/sys/amd64/amd64/pmap.c Sat Aug 24 15:31:31 2019 (r351457) @@ -443,6 +443,10 @@ static pml4_entry_t *pti_pml4; static vm_pindex_t pti_pg_idx; static bool pti_finalized; +extern struct pcpu *__pcpu; +extern struct pcpu temp_bsp_pcpu; +extern pt_entry_t *pcpu_pte; + struct pmap_pkru_range { struct rs_el pkru_rs_el; u_int pkru_keyidx; @@ -1608,8 +1612,8 @@ void pmap_bootstrap(vm_paddr_t *firstaddr) { vm_offset_t va; - pt_entry_t *pte; - uint64_t cr4; + pt_entry_t *pte, *pcpu_pte; + uint64_t cr4, pcpu_phys; u_long res; int i; @@ -1624,6 +1628,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr) */ create_pagetables(firstaddr); + pcpu_phys = allocpages(firstaddr, MAXCPU); + /* * Add a physical memory segment (vm_phys_seg) corresponding to the * preallocated kernel page table pages so that vm_page structures @@ -1691,7 +1697,20 @@ pmap_bootstrap(vm_paddr_t *firstaddr) SYSMAP(caddr_t, CMAP1, crashdumpmap, MAXDUMPPGS) CADDR1 = crashdumpmap; + SYSMAP(struct pcpu *, pcpu_pte, __pcpu, MAXCPU); virtual_avail = va; + + for (i = 0; i < MAXCPU; i++) { + pcpu_pte[i] = (pcpu_phys + ptoa(i)) | X86_PG_V | X86_PG_RW | + pg_g | pg_nx | X86_PG_M | X86_PG_A; + } + STAILQ_INIT(&cpuhead); + wrmsr(MSR_GSBASE, (uint64_t)&__pcpu[0]); + pcpu_init(&__pcpu[0], 0, sizeof(struct pcpu)); + amd64_bsp_pcpu_init1(&__pcpu[0]); + amd64_bsp_ist_init(&__pcpu[0]); + __pcpu[0].pc_dynamic = temp_bsp_pcpu.pc_dynamic; + __pcpu[0].pc_acpi_id = temp_bsp_pcpu.pc_acpi_id; /* * Initialize the PAT MSR. Modified: head/sys/amd64/include/counter.h ============================================================================== --- head/sys/amd64/include/counter.h Sat Aug 24 15:28:40 2019 (r351456) +++ head/sys/amd64/include/counter.h Sat Aug 24 15:31:31 2019 (r351457) @@ -33,9 +33,10 @@ #include -extern struct pcpu __pcpu[]; +extern struct pcpu *__pcpu; +extern struct pcpu temp_bsp_pcpu; -#define EARLY_COUNTER &__pcpu[0].pc_early_dummy_counter +#define EARLY_COUNTER &temp_bsp_pcpu.pc_early_dummy_counter #define counter_enter() do {} while (0) #define counter_exit() do {} while (0) Modified: head/sys/amd64/include/md_var.h ============================================================================== --- head/sys/amd64/include/md_var.h Sat Aug 24 15:28:40 2019 (r351456) +++ head/sys/amd64/include/md_var.h Sat Aug 24 15:31:31 2019 (r351457) @@ -58,6 +58,9 @@ struct sysentvec; void amd64_conf_fast_syscall(void); void amd64_db_resume_dbreg(void); void amd64_lower_shared_page(struct sysentvec *); +void amd64_bsp_pcpu_init1(struct pcpu *pc); +void amd64_bsp_pcpu_init2(uint64_t rsp0); +void amd64_bsp_ist_init(struct pcpu *pc); void amd64_syscall(struct thread *td, int traced); void amd64_syscall_ret_flush_l1d(int error); void amd64_syscall_ret_flush_l1d_recalc(void); From owner-svn-src-head@freebsd.org Sat Aug 24 15:38:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00C11C2D0C; Sat, 24 Aug 2019 15:38:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46G2Tq63pzz3Lp8; Sat, 24 Aug 2019 15:38: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADBDC73C3; Sat, 24 Aug 2019 15:38: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 x7OFc7uu032061; Sat, 24 Aug 2019 15:38:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7OFc7Uf032059; Sat, 24 Aug 2019 15:38:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908241538.x7OFc7Uf032059@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Aug 2019 15:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351458 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 351458 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 15:38:08 -0000 Author: kib Date: Sat Aug 24 15:38:07 2019 New Revision: 351458 URL: https://svnweb.freebsd.org/changeset/base/351458 Log: Add nvdimm(4) man page. Reviewed by: emaste Discussed with: scottl, scottph Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D21386 Added: head/share/man/man4/nvdimm.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sat Aug 24 15:31:31 2019 (r351457) +++ head/share/man/man4/Makefile Sat Aug 24 15:38:07 2019 (r351458) @@ -379,6 +379,7 @@ MAN= aac.4 \ null.4 \ numa.4 \ ${_nvd.4} \ + ${_nvdimm.4} \ ${_nvme.4} \ ${_nvram.4} \ ${_nvram2env.4} \ @@ -825,6 +826,7 @@ _xnb.4= xnb.4 .if ${MACHINE_CPUARCH} == "amd64" _ioat.4= ioat.4 +_nvdimm.4= nvdimm.4 _qlxge.4= qlxge.4 _qlxgb.4= qlxgb.4 _qlxgbe.4= qlxgbe.4 Added: head/share/man/man4/nvdimm.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/nvdimm.4 Sat Aug 24 15:38:07 2019 (r351458) @@ -0,0 +1,122 @@ +.\" Copyright (c) 2019 The FreeBSD Foundation, Inc. +.\" +.\" This documentation was written by +.\" Konstantin Belousov under sponsorship +.\" from the FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd August 23, 2019 +.Dt NVDIMM 4 +.Os +.Sh NAME +.Nm nvdimm +.Nd ACPI NVDIMM driver +.Sh SYNOPSIS +To load the driver as a module at boot, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +nvdimm_load="YES" +.Ed +.Sh DESCRIPTION +.Bf -symbolic +Note: +The +.Nm +driver is under development and has some important limitations +described below. +.Ef +.Pp +The +.Nm +driver provides access to Non-Volatile DIMM (NVDIMM) persistent memory +devices, which are ACPI-enumerated under the root NVDIMM device +with a +.Va _HID +of +.Dv ACPI0012 +and in the +.Dv NFIT +table. +.Pp +For each System Physical Address (SPA) Range described by NFIT, a +device node +.Pa /dev/nvdimm_spaNNN +is created, where +.Dv NNN +is the SPA position in the table. +The node can be used to +.Xr read 2 , +.Xr write 2 , +or +.Xr mmap 2 +the device. +.Pp +Also, for each SPA, the geom provider +.Pa spaNNN +is created, which can be used to create a conventional filesystem (e.g. +by +.Xr newfs 8 ) +and +.Xr mount 8 +it as any storage volume. +Content accessible by +.Pa /dev/nvdimm_spaNNN +and +.Pa /dev/spaNNN +is coherent. +.Sh SEE ALSO +.Xr ACPI 4 , +.Xr GEOM 4 , +.Xr geom 8 , +.Xr mount 8 , +.Xr newfs 8 , +.Xr disk 9 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was originally written by +.An Konstantin Belousov Aq Mt kib@FreeBSD.org , +and then updated by +.An D. Scott Phillips Aq Mt scottph@FreeBSD.org . +.Sh BUGS +The +.Nm +driver does not utilize the Block Window interface, so if the write to +NVDIMM was interrupted due to a system crash or power outage, +the corresponding page might be left in partially updated state. +.Pp +There is no support for Device-Specific Methods (DSM), used to report and +control the device health and wearing. +.Pp +The driver depends on the +.Xr pmap_largemap 9 +pmap interface, which is currently only implemented on amd64. +The interface can be only reasonable implemented on 64bit architectures. From owner-svn-src-head@freebsd.org Sat Aug 24 15:49:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FF70C3059; Sat, 24 Aug 2019 15:49:55 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46G2lR33dzz3MH5; Sat, 24 Aug 2019 15:49:55 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f47.google.com with SMTP id z3so27286372iog.0; Sat, 24 Aug 2019 08:49:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=gmg/nTQ5GrmqYIumAX4MvQzmqy52LKIF2gYgIeuPnII=; b=InJIhVsp2q7Uug+pDfiOpOLNQmfdLMW+4TioJ/k4pv5ilF/DkTsqvq81wdkBYTaN0I 8d7hp+JpIize7Y/TGCVZ5fdBKwhGzW8mTKUeL4LRNzF2pQ2qtlcogxcnwZuJdgrRnMQk 9nIkp7YYB+uZfMAnLbQGHidxtBvJXkXy8IzcOdIw0dEsKr+bfQ+9h1N8RyECp4k4vbxn fbMlTdJjqtKNNtFO9iiteQhNo6SNuU+9LAHl3zC031uUCo49+PSC62GaD55EXQLM8vMf CoAPcL2Bs0G6gn4+EKjCZ0ZZlGe41+h4zsUYtduCeHSN7lV9C3j5Jm9HVmsScP0PnBt+ M/+g== X-Gm-Message-State: APjAAAW/YAzKXHStVbMAov7aKSGr+80A3q79ZmQrRk2dM2AEtAW4WexR 1yt6SqQlrm/dVZxR6kEKGHWzEAkz X-Google-Smtp-Source: APXvYqzSaa1PVWFtuRaUSFsqZK58eSmnBDyIX+30xF2+sLTssMHXSKbVTrKSQuOrRVo38++/G74ZVw== X-Received: by 2002:a05:6638:3af:: with SMTP id z15mr10156907jap.39.1566661793913; Sat, 24 Aug 2019 08:49:53 -0700 (PDT) Received: from mail-io1-f50.google.com (mail-io1-f50.google.com. [209.85.166.50]) by smtp.gmail.com with ESMTPSA id w6sm5040912iob.29.2019.08.24.08.49.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 24 Aug 2019 08:49:53 -0700 (PDT) Received: by mail-io1-f50.google.com with SMTP id p12so27274111iog.5; Sat, 24 Aug 2019 08:49:53 -0700 (PDT) X-Received: by 2002:a6b:f216:: with SMTP id q22mr2637356ioh.65.1566661793111; Sat, 24 Aug 2019 08:49:53 -0700 (PDT) MIME-Version: 1.0 References: <201908241528.x7OFSemm026182@repo.freebsd.org> In-Reply-To: <201908241528.x7OFSemm026182@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Sat, 24 Aug 2019 08:49:42 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r351456 - head/sys/amd64/amd64 To: Konstantin Belousov Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46G2lR33dzz3MH5 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 15:49:55 -0000 Hi Konstantin, What is the motivation for this change? The commit message doesn't really describe why it was done. Thanks, Conrad On Sat, Aug 24, 2019 at 8:28 AM Konstantin Belousov wrote: > > Author: kib > Date: Sat Aug 24 15:28:40 2019 > New Revision: 351456 > URL: https://svnweb.freebsd.org/changeset/base/351456 > > Log: > Do not constrain allocations for doublefault, boot, and mce stacks. > > All these stacks are used only once (doublefault, boot) or very rare > (mce). > > Reviewed by: markj > Tested by: pho > Sponsored by: The FreeBSD Foundation > Differential revision: https://reviews.freebsd.org/D21320 > > Modified: > head/sys/amd64/amd64/mp_machdep.c > > Modified: head/sys/amd64/amd64/mp_machdep.c > ============================================================================== > --- head/sys/amd64/amd64/mp_machdep.c Sat Aug 24 15:25:53 2019 (r351455) > +++ head/sys/amd64/amd64/mp_machdep.c Sat Aug 24 15:28:40 2019 (r351456) > @@ -475,13 +475,11 @@ native_start_all_aps(void) > domain = acpi_pxm_get_cpu_locality(apic_id); > #endif > /* allocate and set up an idle stack data page */ > - bootstacks[cpu] = (void *)kmem_malloc_domainset( > - DOMAINSET_FIXED(domain), kstack_pages * PAGE_SIZE, > + bootstacks[cpu] = (void *)kmem_malloc(kstack_pages * PAGE_SIZE, > M_WAITOK | M_ZERO); > - doublefault_stack = (char *)kmem_malloc_domainset( > - DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); > - mce_stack = (char *)kmem_malloc_domainset( > - DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); > + doublefault_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | > + M_ZERO); > + mce_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); > nmi_stack = (char *)kmem_malloc_domainset( > DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); > dbg_stack = (char *)kmem_malloc_domainset( > From owner-svn-src-head@freebsd.org Sat Aug 24 15:50:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D538C30C6; Sat, 24 Aug 2019 15:50:14 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46G2lp1Qn6z3MPY; Sat, 24 Aug 2019 15:50:14 +0000 (UTC) (envelope-from eugen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 128C2759A; Sat, 24 Aug 2019 15:50:14 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7OFoDQE037927; Sat, 24 Aug 2019 15:50:13 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7OFoD80037926; Sat, 24 Aug 2019 15:50:13 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201908241550.x7OFoD80037926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Sat, 24 Aug 2019 15:50:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351459 - head/usr.bin/last X-SVN-Group: head X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: head/usr.bin/last X-SVN-Commit-Revision: 351459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 15:50:14 -0000 Author: eugen Date: Sat Aug 24 15:50:13 2019 New Revision: 351459 URL: https://svnweb.freebsd.org/changeset/base/351459 Log: last(1): correction after r351413 Make that change no-op for C/POSIX locale just like for UTF-8 that it superset of US-ASCII. MFC after: 2 weeks X-MFC-With: r351413 Modified: head/usr.bin/last/last.c Modified: head/usr.bin/last/last.c ============================================================================== --- head/usr.bin/last/last.c Sat Aug 24 15:38:07 2019 (r351458) +++ head/usr.bin/last/last.c Sat Aug 24 15:50:13 2019 (r351459) @@ -92,8 +92,8 @@ static const char *crmsg; /* cause of last reboot */ static time_t currentout; /* current logout value */ static long maxrec; /* records to display */ static const char *file = NULL; /* utx.log file */ +static int noctfix = 0; /* locale is C or UTF-8 */ static int sflag = 0; /* show delta in seconds */ -static int utf8flag; /* current locale is UTF-8 */ static int width = 5; /* show seconds in delta */ static int yflag; /* show year */ static int d_first; @@ -120,7 +120,7 @@ ctf(const char *fmt) { const char *src, *end; char *dst; - if (utf8flag) + if (noctfix) return (fmt); end = buf + sizeof(buf); @@ -158,7 +158,9 @@ main(int argc, char *argv[]) d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); (void) setlocale(LC_CTYPE, ""); - utf8flag = (strcmp(nl_langinfo(CODESET), "UTF-8") == 0); + p = nl_langinfo(CODESET); + if (strcmp (p, "UTF-8") == 0 || strcmp (p, "US-ASCII") == 0) + noctfix = 1; argc = xo_parse_args(argc, argv); if (argc < 0) From owner-svn-src-head@freebsd.org Sat Aug 24 16:15:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11E75C39D4; Sat, 24 Aug 2019 16:15:19 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46G3Jk5tqmz3NTV; Sat, 24 Aug 2019 16:15:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x7OGF4gp011064 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 24 Aug 2019 19:15:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x7OGF4gp011064 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x7OGF3rU011063; Sat, 24 Aug 2019 19:15:03 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 24 Aug 2019 19:15:03 +0300 From: Konstantin Belousov To: Conrad Meyer Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r351456 - head/sys/amd64/amd64 Message-ID: <20190824161503.GA71821@kib.kiev.ua> References: <201908241528.x7OFSemm026182@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 46G3Jk5tqmz3NTV X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.91 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.91)[-0.910,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 16:15:19 -0000 On Sat, Aug 24, 2019 at 08:49:42AM -0700, Conrad Meyer wrote: > Hi Konstantin, > > What is the motivation for this change? The commit message doesn't > really describe why it was done. Really it does. There is no point to request allocations for e.g. doublefault stack to be at the local domain, because this stack is only used once. Doublefault is definitely a machine halt situation, it does not matter if it generates inter-socket traffic to handle. Same for boot stacks, and for mce. The change avoids unnecessary constraints. > > Thanks, > Conrad > > On Sat, Aug 24, 2019 at 8:28 AM Konstantin Belousov wrote: > > > > Author: kib > > Date: Sat Aug 24 15:28:40 2019 > > New Revision: 351456 > > URL: https://svnweb.freebsd.org/changeset/base/351456 > > > > Log: > > Do not constrain allocations for doublefault, boot, and mce stacks. > > > > All these stacks are used only once (doublefault, boot) or very rare > > (mce). > > > > Reviewed by: markj > > Tested by: pho > > Sponsored by: The FreeBSD Foundation > > Differential revision: https://reviews.freebsd.org/D21320 > > > > Modified: > > head/sys/amd64/amd64/mp_machdep.c > > > > Modified: head/sys/amd64/amd64/mp_machdep.c > > ============================================================================== > > --- head/sys/amd64/amd64/mp_machdep.c Sat Aug 24 15:25:53 2019 (r351455) > > +++ head/sys/amd64/amd64/mp_machdep.c Sat Aug 24 15:28:40 2019 (r351456) > > @@ -475,13 +475,11 @@ native_start_all_aps(void) > > domain = acpi_pxm_get_cpu_locality(apic_id); > > #endif > > /* allocate and set up an idle stack data page */ > > - bootstacks[cpu] = (void *)kmem_malloc_domainset( > > - DOMAINSET_FIXED(domain), kstack_pages * PAGE_SIZE, > > + bootstacks[cpu] = (void *)kmem_malloc(kstack_pages * PAGE_SIZE, > > M_WAITOK | M_ZERO); > > - doublefault_stack = (char *)kmem_malloc_domainset( > > - DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); > > - mce_stack = (char *)kmem_malloc_domainset( > > - DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); > > + doublefault_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | > > + M_ZERO); > > + mce_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); > > nmi_stack = (char *)kmem_malloc_domainset( > > DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); > > dbg_stack = (char *)kmem_malloc_domainset( > > From owner-svn-src-head@freebsd.org Sat Aug 24 18:00:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22B70C6010; Sat, 24 Aug 2019 18:00:19 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46G5dv06y7z3xb0; Sat, 24 Aug 2019 18:00:19 +0000 (UTC) (envelope-from asomers@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9F8A8CF3; Sat, 24 Aug 2019 18:00:18 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7OI0IGr014563; Sat, 24 Aug 2019 18:00:18 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7OI0I7X014562; Sat, 24 Aug 2019 18:00:18 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908241800.x7OI0I7X014562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 24 Aug 2019 18:00:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351461 - head/sbin/ping X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/ping X-SVN-Commit-Revision: 351461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 18:00:19 -0000 Author: asomers Date: Sat Aug 24 18:00:18 2019 New Revision: 351461 URL: https://svnweb.freebsd.org/changeset/base/351461 Log: ping: fix unaligned access to ancillary data Use CMSG_FIRSTHDR rather than assume that an array is correctly aligned. Fixes warnings on sparc64 and powerpcspe. Submitted by: Ján Sučan MFH: 2 weeks Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21406 Modified: head/sbin/ping/ping.c Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Sat Aug 24 16:44:47 2019 (r351460) +++ head/sbin/ping/ping.c Sat Aug 24 18:00:18 2019 (r351461) @@ -875,6 +875,7 @@ main(int argc, char *const *argv) msg.msg_iovlen = 1; #ifdef SO_TIMESTAMP msg.msg_control = (caddr_t)ctrl; + msg.msg_controllen = sizeof(ctrl); #endif iov.iov_base = packet; iov.iov_len = IP_MAXPACKET; @@ -920,9 +921,7 @@ main(int argc, char *const *argv) if (n == 1) { struct timespec *tv = NULL; #ifdef SO_TIMESTAMP - struct cmsghdr *cmsg = (struct cmsghdr *)&ctrl; - - msg.msg_controllen = sizeof(ctrl); + struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); #endif msg.msg_namelen = sizeof(from); if ((cc = recvmsg(srecv, &msg, 0)) < 0) { From owner-svn-src-head@freebsd.org Sat Aug 24 18:48:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87981C6F1D; Sat, 24 Aug 2019 18:48:07 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46G6j16FlYz40N8; Sat, 24 Aug 2019 18:48:05 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f50.google.com with SMTP id x4so27724879iog.13; Sat, 24 Aug 2019 11:48:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=gEaEQQFDg8fw+igFGufqpJQTuIvryn+/S9XTO8Pmhjg=; b=cHRvTSJUrK9ygK3sKvwjLIjd/arJD0d6BrfaH62TKnC7QKXimMj4L3DxVcfpZgWdRD pf9pkpGjMcbOONqiC1Gzs21vmF5o7bvnguDq00vPn1Ygv6VMRyiUz31lpb03jzMX842R mdWudqyI3awPu1/n0devE2ccbADwDmTgR3MFjbpnX1DkXkKSk0uUol8O3+rF4bk5pMbc wh8k0WosL3G7vdAmSmC1DD2njCpwj+R0mAxREIK344IEcqrQA+HGlp06gh2NcYeiiHS3 IrDPHHs971Qk3p76MDydtDH0iIrrhw1egr67xHG0O49g70XeP9tVKzVNJ86AqqYzz4br 53ng== X-Gm-Message-State: APjAAAUji4rUHzH9VQMygCap5vcc5klV0X/NpAPLttgYhkuBrWmoMVvU WFPA/wmMqQxxF25rEDcWP8am9E06 X-Google-Smtp-Source: APXvYqzmQzAm7caKERZSNhT8LOI1Cg+2mx0ImkzSivS+LTcCKc2L4QUEV6/hypF4K+U3co3i8vwpWw== X-Received: by 2002:a5d:8484:: with SMTP id t4mr14100586iom.5.1566672484222; Sat, 24 Aug 2019 11:48:04 -0700 (PDT) Received: from mail-io1-f51.google.com (mail-io1-f51.google.com. [209.85.166.51]) by smtp.gmail.com with ESMTPSA id c11sm10062377ioq.63.2019.08.24.11.48.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 24 Aug 2019 11:48:03 -0700 (PDT) Received: by mail-io1-f51.google.com with SMTP id 18so27798955ioe.10; Sat, 24 Aug 2019 11:48:03 -0700 (PDT) X-Received: by 2002:a5e:a80f:: with SMTP id c15mr10057618ioa.270.1566672483659; Sat, 24 Aug 2019 11:48:03 -0700 (PDT) MIME-Version: 1.0 References: <201908241528.x7OFSemm026182@repo.freebsd.org> <20190824161503.GA71821@kib.kiev.ua> In-Reply-To: <20190824161503.GA71821@kib.kiev.ua> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Sat, 24 Aug 2019 11:47:52 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r351456 - head/sys/amd64/amd64 To: Konstantin Belousov Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46G6j16FlYz40N8 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.166.50 as permitted sender) smtp.mailfrom=csecem@gmail.com X-Spamd-Result: default: False [-5.61 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[cem@freebsd.org]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.99)[-0.988,0]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[50.166.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.62)[ip: (-7.35), ipnet: 209.85.128.0/17(-3.35), asn: 15169(-2.34), country: US(-0.05)]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 18:48:07 -0000 On Sat, Aug 24, 2019 at 9:15 AM Konstantin Belousov wrote: > > On Sat, Aug 24, 2019 at 08:49:42AM -0700, Conrad Meyer wrote: > > Hi Konstantin, > > > > What is the motivation for this change? The commit message doesn't > > really describe why it was done. > > Really it does. There is no point to request allocations for e.g. > doublefault stack to be at the local domain, because this stack is only > used once. Doublefault is definitely a machine halt situation, it does > not matter if it generates inter-socket traffic to handle. > > Same for boot stacks, and for mce. > > The change avoids unnecessary constraints. Sure, but what is the harm of the unnecessary constraints? Does this change fix an actual bug, or is it just a stylistic preference to avoid domain-specific allocations for infrequently used objects? Thanks, Conrad From owner-svn-src-head@freebsd.org Sat Aug 24 18:50:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5D7EC7042; Sat, 24 Aug 2019 18:50:30 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46G6lp4ry0z40XC; Sat, 24 Aug 2019 18:50:30 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f44.google.com with SMTP id s21so27940254ioa.1; Sat, 24 Aug 2019 11:50:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=9l6eI3fzdgyA6+MNnAPvMTchwPsf5g/z+V8G19T6h0I=; b=QUtqTELPCMzmZaDad5HvkOOytB/YivysvRdpuphhpumbnLaAe97uxSvfl7dWX+UMHi wag1JfK2FF/fkAloBq27V2pcyt6uCr0N+Wq722eg6aLplgFKETiRx7Sr4SIlVjQCtMyM D7dDF7gHMQkdsxdiorT3pFMtScUtveOUiSSaXUg6S3dDxHOEt6c7tLFLFvsSINRkWpua MxuuE2zYPSd7fUG37/FEHS6N8EqRdPBvtKUCh16sToBNhFYQofYV/Rzmk3cmCvRPLn2Q X84sdiZQUftF2mFotq+hqe9KE7TZAmPIJR/GKwxO8cAB4ZjD+xra03sbDbWKuM/K1PkO xPeA== X-Gm-Message-State: APjAAAVZGwl1Ivy1dvSa+xJr/f2Bxz0rDPqre/mor22jNWe8NSaTQKQK o/tGIJk4NDDf2h7A3JKQZlLS7PdG X-Google-Smtp-Source: APXvYqyJ5q+2d8NC55MgBeBBtqg/NR/Boe5YlZbPq+gGzT5yr+3/L40y5obx7GTIKJAM2WXtnK9YJw== X-Received: by 2002:a5e:d911:: with SMTP id n17mr2384509iop.32.1566672629496; Sat, 24 Aug 2019 11:50:29 -0700 (PDT) Received: from mail-io1-f49.google.com (mail-io1-f49.google.com. [209.85.166.49]) by smtp.gmail.com with ESMTPSA id l6sm4677845ioc.15.2019.08.24.11.50.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 24 Aug 2019 11:50:29 -0700 (PDT) Received: by mail-io1-f49.google.com with SMTP id t3so27770128ioj.12; Sat, 24 Aug 2019 11:50:29 -0700 (PDT) X-Received: by 2002:a5d:93c4:: with SMTP id j4mr4567964ioo.80.1566672628950; Sat, 24 Aug 2019 11:50:28 -0700 (PDT) MIME-Version: 1.0 References: <201908241550.x7OFoD80037926@repo.freebsd.org> In-Reply-To: <201908241550.x7OFoD80037926@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Sat, 24 Aug 2019 11:50:18 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r351459 - head/usr.bin/last To: Eugene Grosbein Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46G6lp4ry0z40XC X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 18:50:30 -0000 Hi Eugene, This change introduced some style(9) violations. On Sat, Aug 24, 2019 at 8:50 AM Eugene Grosbein wrote: > > Author: eugen > Date: Sat Aug 24 15:50:13 2019 > New Revision: 351459 > URL: https://svnweb.freebsd.org/changeset/base/351459 > ... > --- head/usr.bin/last/last.c Sat Aug 24 15:38:07 2019 (r351458) > +++ head/usr.bin/last/last.c Sat Aug 24 15:50:13 2019 (r351459) > ... > @@ -158,7 +158,9 @@ main(int argc, char *argv[]) > d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); > > (void) setlocale(LC_CTYPE, ""); > - utf8flag = (strcmp(nl_langinfo(CODESET), "UTF-8") == 0); > + p = nl_langinfo(CODESET); > + if (strcmp (p, "UTF-8") == 0 || strcmp (p, "US-ASCII") == 0) > + noctfix = 1; There are extraneous spaces between strcmp and '('. Best, Conrad From owner-svn-src-head@freebsd.org Sat Aug 24 19:15:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BAFBC7C4D for ; Sat, 24 Aug 2019 19:15:01 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic311-24.consmr.mail.ne1.yahoo.com (sonic311-24.consmr.mail.ne1.yahoo.com [66.163.188.205]) (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 46G7J35TtTz41rZ for ; Sat, 24 Aug 2019 19:14:59 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: WC9q3x4VM1mGVYv4v4c2N0SCY_h42Yc7Vw86RWw9GkI_oSTnqiQAqgXNB9mmrF1 vX9Vp7n39uXibaNL6id9lwF7XkIeuBxwDODU5T2viotoLr4FQtB4gPDebl.LqYgIPrlBNO3COP4t o5PsrF3QxUjD6SuJhjKTnTP8hBQeRfjgi_sw7148QGuJalLpIoN94s94LU83N3o9_Y9Xqr5dknNV gaePvcrKyiO9gmqyuTmf9r68ExCWDqVEkj0gTsIO7NC77JaPkanPU4N2ln5fUGKfi.MTvaq.TLsD POcewz6xszCNK3yE2KqwYAx0gS3QJGVN6qkKO6RyekHggEJUS6NBpb.KlWIQUm_4bGSW0V0dH4mY 19sM.oqCnGWhWYpqi3vKrWiW55eiC5nTmhla2cMnicIFlskXmmtveCHsIPi8FoMtSlAST6DhpU0H 3EJx3m_rEBS_78gAzHKiG7B7TooCqaJgMXHqL5XN08kAnEU2O3GDCCdTzkzdjYzhZRFu.KgUtD1u 4eUGvC8TAfcpAFM6uIkBP3COP5MrkYk4_IVvhiNr1rq0NVy8nkDEULMWM04om0o1a8ubmphNTvcN XySQ7iikjNUdAdhUexYUOiZ2eqj5A7U9ul.XGWuyUzR6xohSbf9pIaLn7Cu4ziq3Y3t790L0RK2a Dck.pb1WCbMpyrXb9vlIQSGsQ5RYg2qhdd0JD1hq5LeYb.Q5jsY1v4CcXlyjZ39Yl3irOSe5Ge9s FmaFhuVQoH0erOFIkq2Nq_0.5D9e4wMxtv_s1iaMYNCczIIBDChgS6hxGXIDEeCdc15s2QLY_Ulq KedUKgERnDFNSPKLAg16An9ta_DYnAJE3OSLiNBkh5iWmJ9EoUOA1yFbEb.N.xJfJhQLBCImD9P4 vuNi3kDni11rh89SGPBK.qZGOv_syeQ_qNdAxRcyBjZU_Rkid9_e0KYCltwFNpPGokZn9kg3UqzN errbWwTAOB0cGrr1T1ePzut55jqRs9hDTNqrpKBiCpUiW5Qg91d0bnxlJAtECAMZ2ccqwFytRaRp v1zBABJFZxv558N5F02iSHIq_P3lXp84vZ7Bw5flFi1PCAnfc7gJuXXTfSaaRNVVZjSNVPoGVERf JVRAfn5hbkmdj9YqPcgvqKgzzu1ZsjRW.wPQnSynBw5PRAxrg.iiXKtoVOw1RG1r8BKfoieyU6M6 Jerjkl0zn42Rrdma.Dkn7DfQ_e5rmd1xVAh1xrA0yJeMIFa.ydYyal2iG5sE4sIugwRAvXgL_1Dr Mtip11MMShOWWyGmLhJYycA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ne1.yahoo.com with HTTP; Sat, 24 Aug 2019 19:14:57 +0000 Received: by smtp426.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 51063771831bdec516561a7890a66f37; Sat, 24 Aug 2019 19:14:55 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r351364 - in head/sys: crypto/blowfish crypto/chacha20 crypto/des opencrypto Message-Id: <041F4FA3-8844-419B-80E0-0EEDF46ED6A5@yahoo.com> Date: Sat, 24 Aug 2019 12:14:54 -0700 To: svn-src-head@freebsd.org, Warner Losh X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 46G7J35TtTz41rZ X-Spamd-Bar: ++ X-Spamd-Result: default: False [2.06 / 15.00]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36646, ipnet:66.163.184.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; FAKE_REPLY(1.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.73)[0.730,0]; NEURAL_HAM_LONG(-0.02)[-0.018,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (4.55), ipnet: 66.163.184.0/21(1.29), asn: 36646(1.03), country: US(-0.05)]; NEURAL_SPAM_MEDIUM(0.85)[0.848,0]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[205.188.163.66.list.dnswl.org : 127.0.5.0]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 19:15:01 -0000 Warner Losh imp at bsdimp.com wrote on Fri Aug 23 22:05:39 UTC 2019 : > On Fri, Aug 23, 2019 at 12:26 PM Conrad Meyer wrote: > > > At expected peril of wading into a thread >4 emails deep, > > > > @Warner, modern GCC reports a similar warning; it just doesn't become > > an error (at least in CI?). I'm not sure of the mechanism. Maybe > > CI-specific? Old GCC didn't have a -Wno-error for -Wcast-qual, so > > -Wcast-qual + -Werror there produced an error; that's why > > $NO_WCAST_QUAL in conf/kern.mk is defined to -Wno-cast-qual for old > > GCC but -Wno-error=cast-qual for newer compilers. That said, this > > file does not appear to be compiled with ${NO_WCAST_QUAL} either way. > > > > Yea. I'm unsure. It's an odd warning, and an odd way to get around it. In > general, nobody cares about gcc 4.2.1, so pinning implementing that belief > to this specific bug may have been unwise. I just assumed newer versions > wouldn't warn on this, but I saw on IRC that the types are stupidly > different... . . . While I know how to build for powerpc64 ( using WITHOUT_LIB32= ) without using gcc4.2.1 or the matching binutils, 32-bit powerpc is not so clear for how to target without gcc 4.2.1, at least based on what I'm familiar with. (I normally work with materials from the official FreeBSD svn, not other development material sources.) (Locally reverting the secure-plt change would help for amd64->powerpc cross builds based on system-clang and devel/powerpc64-binutils or base/binutils . Even lld from devel/llvm90 is not ready for 32-bit powerpc as yet, from what I've seen, so llvm90 is not yet a self-contained solution.) May be someone else does know a good way to build FreeBSD for tracking head for targeting 32-bit powerpc as things are now? May I the only one not knowing how to build for this target as things are? I'd been trying to avoid disabling the secure-plt change that causes gnu's modern ld's to revert to bss-plt and return an error code that stops the build when system-clang or llvm90 is used. (The old FreeBSD ld does not return the error code but does report reverting to bss-plt. But it fails for buildkernel via a separate issue when system-clang is used.) As stands I'm not aware of how to target 32-bit power pc from some more modern gcc/binutils combination. As stands it looks like reverting secure-plt's use is the direction I'd have to go to avoid gcc 4.2.1 . === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Sat Aug 24 19:19:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66411C7D30; Sat, 24 Aug 2019 19:19:26 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) (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 46G7PB1f4Kz41vg; Sat, 24 Aug 2019 19:19:25 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id BEF2F3A2; Sat, 24 Aug 2019 15:19:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sat, 24 Aug 2019 15:19:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=T QkDgyhzJycGXVjkA49lPJw8yjJnNR9p8ZD6cF2RBRg=; b=FAppKdNcp1QwS/y72 p2UYPbuSNeBju4tYy5HO8Bs2B4j3zTxAPFk0yRhrmVgzYf2h+hqkG1J/zYiuAdSN mNUenNHEvVkdiqeJ4AZPcSuj4TNxKcg+KVWVY+sNd5tpRYIvYMmIjsGc+BDckLv5 Ymwpz7Imj1BqN/woeGFSUA1cLjMUl/Z4554nNVWiKOxl6MYHoF0YCMjAmnnWZudj L/RmKoAY/+lyuT9xR7wmgFiy6/4vGp04tngsMjajpZd1vVN1C5H186Db3pjyr/lO LLO64geQs5BilQLWtsGqsm98HX2Mkeez8yh5lb15cEPPS0kaCywBAm5px2AG7FkP XjmlQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=TQkDgyhzJycGXVjkA49lPJw8yjJnNR9p8ZD6cF2RB Rg=; b=zYBvaMDsi4KAgC7fBisSoTQyFJfROkML6lxgQXW5nJ2LTEnwGjE++Endx 8TcqoyEddf7G5O2niHUXjJS6IZ0kGMkGYpGIFDGaVy5n6HMlelmxysjh7tGL5E2g tPaNXdGeyNBHKRfsnSVTCzQqlRW2kM4c0KQMO8JXV+hOVjHUBs5yD2Rw6A7IJ163 dFsDpbksjPDz5Ao0P4PdMVzfVSsvIKzwibcvM9Mwcw7EcEEkBS/aBfY1BLuHdql2 UT1OObPnO6Rm1jlWvVBuFfjBbSgf/ebElpLEDev5aZZ0idnaNUaiVmyJcvH65+/+ 02vxXx+dnZn4ywIEoPweVFxkqyawQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudehtddgudeflecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurheptggguffhjgffgffkfhfvofesth hqmhdthhdtvdenucfhrhhomhepufgtohhtthcunfhonhhguceoshgtohhtthhlsehsrghm shgtohdrohhrgheqnecuffhomhgrihhnpehfrhgvvggsshgurdhorhhgpdgrnhgurdhprg dpnhhouggvrdhprgenucfkphepkedrgeeirdekledrvddufeenucfrrghrrghmpehmrghi lhhfrhhomhepshgtohhtthhlsehsrghmshgtohdrohhrghenucevlhhushhtvghrufhiii gvpedt X-ME-Proxy: Received: from [192.168.0.126] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id A135780059; Sat, 24 Aug 2019 15:19:22 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r351458 - head/share/man/man4 From: Scott Long In-Reply-To: <201908241538.x7OFc7Uf032059@repo.freebsd.org> Date: Sat, 24 Aug 2019 13:19:21 -0600 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201908241538.x7OFc7Uf032059@repo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 46G7PB1f4Kz41vg X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 19:19:26 -0000 Thank you! Scott > On Aug 24, 2019, at 9:38 AM, Konstantin Belousov = wrote: >=20 > Author: kib > Date: Sat Aug 24 15:38:07 2019 > New Revision: 351458 > URL: https://svnweb.freebsd.org/changeset/base/351458 >=20 > Log: > Add nvdimm(4) man page. >=20 > Reviewed by: emaste > Discussed with: scottl, scottph > Sponsored by: The FreeBSD Foundation > MFC after: 3 days > Differential revision: https://reviews.freebsd.org/D21386 >=20 > Added: > head/share/man/man4/nvdimm.4 (contents, props changed) > Modified: > head/share/man/man4/Makefile >=20 > Modified: head/share/man/man4/Makefile > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/share/man/man4/Makefile Sat Aug 24 15:31:31 2019 = (r351457) > +++ head/share/man/man4/Makefile Sat Aug 24 15:38:07 2019 = (r351458) > @@ -379,6 +379,7 @@ MAN=3D aac.4 \ > null.4 \ > numa.4 \ > ${_nvd.4} \ > + ${_nvdimm.4} \ > ${_nvme.4} \ > ${_nvram.4} \ > ${_nvram2env.4} \ > @@ -825,6 +826,7 @@ _xnb.4=3D xnb.4 >=20 > .if ${MACHINE_CPUARCH} =3D=3D "amd64" > _ioat.4=3D ioat.4 > +_nvdimm.4=3D nvdimm.4 > _qlxge.4=3D qlxge.4 > _qlxgb.4=3D qlxgb.4 > _qlxgbe.4=3D qlxgbe.4 >=20 > Added: head/share/man/man4/nvdimm.4 > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/share/man/man4/nvdimm.4 Sat Aug 24 15:38:07 2019 = (r351458) > @@ -0,0 +1,122 @@ > +.\" Copyright (c) 2019 The FreeBSD Foundation, Inc. > +.\" > +.\" This documentation was written by > +.\" Konstantin Belousov under sponsorship > +.\" from the FreeBSD Foundation. > +.\" > +.\" Redistribution and use in source and binary forms, with or = without > +.\" modification, are permitted provided that the following = conditions > +.\" are met: > +.\" 1. Redistributions of source code must retain the above copyright > +.\" notice, this list of conditions and the following disclaimer. > +.\" 2. Redistributions in binary form must reproduce the above = copyright > +.\" notice, this list of conditions and the following disclaimer = in the > +.\" documentation and/or other materials provided with the = distribution. > +.\" > +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS = IS'' AND > +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, = THE > +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A = PARTICULAR PURPOSE > +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE = LIABLE > +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL > +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE = GOODS > +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS = INTERRUPTION) > +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN = CONTRACT, STRICT > +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN = ANY WAY > +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE = POSSIBILITY OF > +.\" SUCH DAMAGE. > +.\" > +.\" $FreeBSD$ > +.\" > +.Dd August 23, 2019 > +.Dt NVDIMM 4 > +.Os > +.Sh NAME > +.Nm nvdimm > +.Nd ACPI NVDIMM driver > +.Sh SYNOPSIS > +To load the driver as a module at boot, place the following line in > +.Xr loader.conf 5 : > +.Bd -literal -offset indent > +nvdimm_load=3D"YES" > +.Ed > +.Sh DESCRIPTION > +.Bf -symbolic > +Note: > +The > +.Nm > +driver is under development and has some important limitations > +described below. > +.Ef > +.Pp > +The > +.Nm > +driver provides access to Non-Volatile DIMM (NVDIMM) persistent = memory > +devices, which are ACPI-enumerated under the root NVDIMM device > +with a > +.Va _HID > +of > +.Dv ACPI0012 > +and in the > +.Dv NFIT > +table. > +.Pp > +For each System Physical Address (SPA) Range described by NFIT, a > +device node > +.Pa /dev/nvdimm_spaNNN > +is created, where > +.Dv NNN > +is the SPA position in the table. > +The node can be used to > +.Xr read 2 , > +.Xr write 2 , > +or > +.Xr mmap 2 > +the device. > +.Pp > +Also, for each SPA, the geom provider > +.Pa spaNNN > +is created, which can be used to create a conventional filesystem = (e.g. > +by > +.Xr newfs 8 ) > +and > +.Xr mount 8 > +it as any storage volume. > +Content accessible by > +.Pa /dev/nvdimm_spaNNN > +and > +.Pa /dev/spaNNN > +is coherent. > +.Sh SEE ALSO > +.Xr ACPI 4 , > +.Xr GEOM 4 , > +.Xr geom 8 , > +.Xr mount 8 , > +.Xr newfs 8 , > +.Xr disk 9 > +.Sh HISTORY > +The > +.Nm > +driver first appeared in > +.Fx 12.0 . > +.Sh AUTHORS > +.An -nosplit > +The > +.Nm > +driver was originally written by > +.An Konstantin Belousov Aq Mt kib@FreeBSD.org , > +and then updated by > +.An D. Scott Phillips Aq Mt scottph@FreeBSD.org . > +.Sh BUGS > +The > +.Nm > +driver does not utilize the Block Window interface, so if the write = to > +NVDIMM was interrupted due to a system crash or power outage, > +the corresponding page might be left in partially updated state. > +.Pp > +There is no support for Device-Specific Methods (DSM), used to report = and > +control the device health and wearing. > +.Pp > +The driver depends on the > +.Xr pmap_largemap 9 > +pmap interface, which is currently only implemented on amd64. > +The interface can be only reasonable implemented on 64bit = architectures. >=20 From owner-svn-src-head@freebsd.org Sat Aug 24 20:44:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8569CAB2D; Sat, 24 Aug 2019 20:44:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46G9Gn3BYGz48Gr; Sat, 24 Aug 2019 20:44:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x7OKhrLO084883 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 24 Aug 2019 23:43:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x7OKhrLO084883 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x7OKhrVL084882; Sat, 24 Aug 2019 23:43:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 24 Aug 2019 23:43:53 +0300 From: Konstantin Belousov To: Conrad Meyer Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r351456 - head/sys/amd64/amd64 Message-ID: <20190824204353.GH71821@kib.kiev.ua> References: <201908241528.x7OFSemm026182@repo.freebsd.org> <20190824161503.GA71821@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 46G9Gn3BYGz48Gr X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.90 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.91)[-0.906,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2019 20:44:01 -0000 On Sat, Aug 24, 2019 at 11:47:52AM -0700, Conrad Meyer wrote: > On Sat, Aug 24, 2019 at 9:15 AM Konstantin Belousov wrote: > > > > On Sat, Aug 24, 2019 at 08:49:42AM -0700, Conrad Meyer wrote: > > > Hi Konstantin, > > > > > > What is the motivation for this change? The commit message doesn't > > > really describe why it was done. > > > > Really it does. There is no point to request allocations for e.g. > > doublefault stack to be at the local domain, because this stack is only > > used once. Doublefault is definitely a machine halt situation, it does > > not matter if it generates inter-socket traffic to handle. > > > > Same for boot stacks, and for mce. > > > > The change avoids unnecessary constraints. > > Sure, but what is the harm of the unnecessary constraints? Does this > change fix an actual bug, or is it just a stylistic preference to > avoid domain-specific allocations for infrequently used objects? I am not sure about this being a stylistic preference. We usually write code to express the required actions. I removed constraints which did not added anything neither to code correctness nor to the performance.