From owner-svn-src-stable@freebsd.org Sun Oct 28 00:57:40 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D80FC10DA7B3; Sun, 28 Oct 2018 00:57:40 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 811F484C5A; Sun, 28 Oct 2018 00:57:40 +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 553DF17F14; Sun, 28 Oct 2018 00:57:40 +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 w9S0vejf065823; Sun, 28 Oct 2018 00:57:40 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9S0veaC065822; Sun, 28 Oct 2018 00:57:40 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201810280057.w9S0veaC065822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 28 Oct 2018 00:57:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339828 - stable/12/lib/libc/stdio X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: stable/12/lib/libc/stdio X-SVN-Commit-Revision: 339828 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Oct 2018 00:57:41 -0000 Author: cy Date: Sun Oct 28 00:57:39 2018 New Revision: 339828 URL: https://svnweb.freebsd.org/changeset/base/339828 Log: Follow up on r331936. gets_s(3) will also fail in the same way that gets(3) does. This was missed in r331936. Reported by: emaste@ Approved by: re (kib@) Modified: stable/12/lib/libc/stdio/fgets.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/stdio/fgets.3 ============================================================================== --- stable/12/lib/libc/stdio/fgets.3 Sat Oct 27 23:31:42 2018 (r339827) +++ stable/12/lib/libc/stdio/fgets.3 Sun Oct 28 00:57:39 2018 (r339828) @@ -140,6 +140,8 @@ or .Pp The function .Fn gets +and +.Fn gets_s may also fail and set .Va errno for any of the errors specified for the routine From owner-svn-src-stable@freebsd.org Sun Oct 28 00:57:51 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 658B310DA7E7; Sun, 28 Oct 2018 00:57:51 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5F2384C92; Sun, 28 Oct 2018 00:57:45 +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 CC81D17F15; Sun, 28 Oct 2018 00:57:44 +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 w9S0vi97065870; Sun, 28 Oct 2018 00:57:44 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9S0viag065869; Sun, 28 Oct 2018 00:57:44 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201810280057.w9S0viag065869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 28 Oct 2018 00:57:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339829 - stable/11/lib/libc/stdio X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: stable/11/lib/libc/stdio X-SVN-Commit-Revision: 339829 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Oct 2018 00:57:51 -0000 Author: cy Date: Sun Oct 28 00:57:44 2018 New Revision: 339829 URL: https://svnweb.freebsd.org/changeset/base/339829 Log: Follow up on r331936. gets_s(3) will also fail in the same way that gets(3) does. This was missed in r331936. Reported by: emaste@ Modified: stable/11/lib/libc/stdio/fgets.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/stdio/fgets.3 ============================================================================== --- stable/11/lib/libc/stdio/fgets.3 Sun Oct 28 00:57:39 2018 (r339828) +++ stable/11/lib/libc/stdio/fgets.3 Sun Oct 28 00:57:44 2018 (r339829) @@ -140,6 +140,8 @@ or .Pp The function .Fn gets +and +.Fn gets_s may also fail and set .Va errno for any of the errors specified for the routine From owner-svn-src-stable@freebsd.org Sun Oct 28 07:50:16 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3E6810EB0B2; Sun, 28 Oct 2018 07:50:16 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5D03074437; Sun, 28 Oct 2018 07:50:16 +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 3B0111C7B3; Sun, 28 Oct 2018 07:50:16 +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 w9S7oGvB078162; Sun, 28 Oct 2018 07:50:16 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9S7oGh0078161; Sun, 28 Oct 2018 07:50:16 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201810280750.w9S7oGh0078161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sun, 28 Oct 2018 07:50:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339839 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 339839 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Oct 2018 07:50:17 -0000 Author: vmaffione Date: Sun Oct 28 07:50:15 2018 New Revision: 339839 URL: https://svnweb.freebsd.org/changeset/base/339839 Log: MFC r339548: man: fix vale(4) port naming The current documentation describing the syntax of a VALE port is wrong. This patch fixes it to make it consistent. Approved by: re (gjb) Modified: stable/12/share/man/man4/vale.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/vale.4 ============================================================================== --- stable/12/share/man/man4/vale.4 Sun Oct 28 05:50:04 2018 (r339838) +++ stable/12/share/man/man4/vale.4 Sun Oct 28 07:50:15 2018 (r339839) @@ -59,18 +59,18 @@ API. .Pp .Nm ports are named -.Pa vale[bdg:][port] +.Pa valeSSS:PPP where .Pa vale is the prefix indicating a VALE switch rather than a standard interface, -.Pa bdg +.Pa SSS indicates a specific switch (the colon is a separator), and -.Pa port +.Pa PPP indicates a port within the switch. -Bridge and port names are arbitrary strings, the only -constraint being that the full name must fit within 16 -characters. +Both SSS and PPP have the form [0-9a-zA-Z_]+ , the string cannot +exceed IFNAMSIZ characters, and PPP cannot be the name of any +existing OS network interface. .Pp See .Xr netmap 4 @@ -97,22 +97,20 @@ Set to non-zero values to enable in-kernel diagnostics Create one switch, with a traffic generator connected to one port, and a netmap-enabled tcpdump instance on another port: .Bd -literal -offset indent -tcpdump -ni vale-a:1 & -pkt-gen -i vale-a:0 -f tx & +tcpdump -ni valea:1 & +pkt-gen -i valea:0 -f tx & .Ed .Pp Create two switches, each connected to two qemu machines on different ports. .Bd -literal -offset indent -qemu -net nic -net netmap,ifname=vale-1:a ... & -qemu -net nic -net netmap,ifname=vale-1:b ... & -qemu -net nic -net netmap,ifname=vale-2:c ... & -qemu -net nic -net netmap,ifname=vale-2:d ... & +qemu -net nic -net netmap,ifname=vale1:a ... & +qemu -net nic -net netmap,ifname=vale1:b ... & +qemu -net nic -net netmap,ifname=vale2:c ... & +qemu -net nic -net netmap,ifname=vale2:d ... & .Ed .Sh SEE ALSO .Xr netmap 4 -.Pp -.Xr http://info.iet.unipi.it/~luigi/vale/ .Pp Luigi Rizzo, Giuseppe Lettieri: VALE, a switched ethernet for virtual machines, June 2012, http://info.iet.unipi.it/~luigi/vale/ From owner-svn-src-stable@freebsd.org Sun Oct 28 18:21:15 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F07BB10DC444; Sun, 28 Oct 2018 18:21:14 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A69A18FE2B; Sun, 28 Oct 2018 18:21:14 +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 87C1F22F98; Sun, 28 Oct 2018 18:21:14 +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 w9SILEY8013688; Sun, 28 Oct 2018 18:21:14 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9SILEWH013687; Sun, 28 Oct 2018 18:21:14 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201810281821.w9SILEWH013687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 28 Oct 2018 18:21:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339841 - stable/12/sbin/ipfw X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/sbin/ipfw X-SVN-Commit-Revision: 339841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Oct 2018 18:21:15 -0000 Author: ae Date: Sun Oct 28 18:21:14 2018 New Revision: 339841 URL: https://svnweb.freebsd.org/changeset/base/339841 Log: MFC r339740: Use correct format specificator to print setdscp action. PR: 232642 Approved by: re (rgrimes) Modified: stable/12/sbin/ipfw/ipfw2.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ipfw/ipfw2.c ============================================================================== --- stable/12/sbin/ipfw/ipfw2.c Sun Oct 28 10:59:49 2018 (r339840) +++ stable/12/sbin/ipfw/ipfw2.c Sun Oct 28 18:21:14 2018 (r339841) @@ -1946,7 +1946,7 @@ print_action_instruction(struct buf_pr *bp, const stru if (s != NULL) bprintf(bp, "setdscp %s", s); else - bprintf(bp, "setdscp %s", cmd->arg1 & 0x3F); + bprintf(bp, "setdscp %u", cmd->arg1 & 0x3F); break; case O_REASS: bprintf(bp, "reass"); From owner-svn-src-stable@freebsd.org Sun Oct 28 18:23:14 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CAFD10DC520; Sun, 28 Oct 2018 18:23:14 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2222C69AFD; Sun, 28 Oct 2018 18:23:14 +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 03A0523006; Sun, 28 Oct 2018 18:23:14 +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 w9SINDUV016040; Sun, 28 Oct 2018 18:23:13 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9SINDvq016039; Sun, 28 Oct 2018 18:23:13 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201810281823.w9SINDvq016039@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 28 Oct 2018 18:23:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339842 - stable/11/sbin/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sbin/ipfw X-SVN-Commit-Revision: 339842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Oct 2018 18:23:14 -0000 Author: ae Date: Sun Oct 28 18:23:13 2018 New Revision: 339842 URL: https://svnweb.freebsd.org/changeset/base/339842 Log: MFC r339740: Use correct format specificator to print setdscp action. PR: 232642 Modified: stable/11/sbin/ipfw/ipfw2.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/ipfw2.c ============================================================================== --- stable/11/sbin/ipfw/ipfw2.c Sun Oct 28 18:21:14 2018 (r339841) +++ stable/11/sbin/ipfw/ipfw2.c Sun Oct 28 18:23:13 2018 (r339842) @@ -1946,7 +1946,7 @@ print_action_instruction(struct buf_pr *bp, const stru if (s != NULL) bprintf(bp, "setdscp %s", s); else - bprintf(bp, "setdscp %s", cmd->arg1 & 0x3F); + bprintf(bp, "setdscp %u", cmd->arg1 & 0x3F); break; case O_REASS: bprintf(bp, "reass"); From owner-svn-src-stable@freebsd.org Mon Oct 29 12:08:16 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55FD410D612B; Mon, 29 Oct 2018 12:08:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E2D6C6E1C4; Mon, 29 Oct 2018 12:08:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEF796348; Mon, 29 Oct 2018 12:08:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TC8FNU064329; Mon, 29 Oct 2018 12:08:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TC8FB3064328; Mon, 29 Oct 2018 12:08:15 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201810291208.w9TC8FB3064328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 29 Oct 2018 12:08:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339851 - stable/12/sys/dev/usb/serial X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/usb/serial X-SVN-Commit-Revision: 339851 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 12:08:16 -0000 Author: hselasky Date: Mon Oct 29 12:08:15 2018 New Revision: 339851 URL: https://svnweb.freebsd.org/changeset/base/339851 Log: MFC r339587: Added support for formula-based arbitrary baud rates, in contrast to the current fixed values, which enables use of rates above 1 Mbps. Improved the detection of HXD chips, and the status flag handling as well. Submitted by: Gabor Simon PR: 225932 Approved by: re (kib) Differential revision: https://reviews.freebsd.org/D16639 Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/usb/serial/uplcom.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/serial/uplcom.c ============================================================================== --- stable/12/sys/dev/usb/serial/uplcom.c Mon Oct 29 09:06:20 2018 (r339850) +++ stable/12/sys/dev/usb/serial/uplcom.c Mon Oct 29 12:08:15 2018 (r339851) @@ -134,12 +134,20 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RW #define UPLCOM_SET_CRTSCTS 0x41 #define UPLCOM_SET_CRTSCTS_PL2303X 0x61 #define RSAQ_STATUS_CTS 0x80 +#define RSAQ_STATUS_OVERRUN_ERROR 0x40 +#define RSAQ_STATUS_PARITY_ERROR 0x20 +#define RSAQ_STATUS_FRAME_ERROR 0x10 +#define RSAQ_STATUS_RING 0x08 +#define RSAQ_STATUS_BREAK_ERROR 0x04 #define RSAQ_STATUS_DSR 0x02 #define RSAQ_STATUS_DCD 0x01 #define TYPE_PL2303 0 #define TYPE_PL2303HX 1 +#define TYPE_PL2303HXD 2 +#define UPLCOM_STATE_INDEX 8 + enum { UPLCOM_BULK_DT_WR, UPLCOM_BULK_DT_RD, @@ -369,18 +377,49 @@ uplcom_attach(device_t dev) sc->sc_udev = uaa->device; - /* Determine the chip type. This algorithm is taken from Linux. */ dd = usbd_get_device_descriptor(sc->sc_udev); - if (dd->bDeviceClass == 0x02) - sc->sc_chiptype = TYPE_PL2303; - else if (dd->bMaxPacketSize == 0x40) + + switch (UGETW(dd->bcdDevice)) { + case 0x0300: sc->sc_chiptype = TYPE_PL2303HX; - else - sc->sc_chiptype = TYPE_PL2303; + /* or TA, that is HX with external crystal */ + break; + case 0x0400: + sc->sc_chiptype = TYPE_PL2303HXD; + /* or EA, that is HXD with ESD protection */ + /* or RA, that has internal voltage level converter that works only up to 1Mbaud (!) */ + break; + case 0x0500: + sc->sc_chiptype = TYPE_PL2303HXD; + /* in fact it's TB, that is HXD with external crystal */ + break; + default: + /* NOTE: I have no info about the bcdDevice for the base PL2303 (up to 1.2Mbaud, + only fixed rates) and for PL2303SA (8-pin chip, up to 115200 baud */ + /* Determine the chip type. This algorithm is taken from Linux. */ + if (dd->bDeviceClass == 0x02) + sc->sc_chiptype = TYPE_PL2303; + else if (dd->bMaxPacketSize == 0x40) + sc->sc_chiptype = TYPE_PL2303HX; + else + sc->sc_chiptype = TYPE_PL2303; + break; + } - DPRINTF("chiptype: %s\n", - (sc->sc_chiptype == TYPE_PL2303HX) ? - "2303X" : "2303"); + switch (sc->sc_chiptype) { + case TYPE_PL2303: + DPRINTF("chiptype: 2303\n"); + break; + case TYPE_PL2303HX: + DPRINTF("chiptype: 2303HX/TA\n"); + break; + case TYPE_PL2303HXD: + DPRINTF("chiptype: 2303HXD/TB/RA/EA\n"); + break; + default: + DPRINTF("chiptype: unknown %d\n", sc->sc_chiptype); + break; + } /* * USB-RSAQ1 has two interface @@ -429,13 +468,14 @@ uplcom_attach(device_t dev) goto detach; } - if (sc->sc_chiptype != TYPE_PL2303HX) { + if (sc->sc_chiptype == TYPE_PL2303) { /* HX variants seem to lock up after a clear stall request. */ mtx_lock(&sc->sc_mtx); usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]); usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); } else { + /* reset upstream data pipes */ if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 8, 0, 0) || uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, @@ -554,7 +594,7 @@ uplcom_pl2303_init(struct usb_device *udev, uint8_t ch || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 1, 0, 0)) return (EIO); - if (chiptype == TYPE_PL2303HX) + if (chiptype != TYPE_PL2303) err = uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x44, 0); else err = uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x24, 0); @@ -634,23 +674,52 @@ uplcom_cfg_set_break(struct ucom_softc *ucom, uint8_t &req, NULL, 0, 1000); } +/* + * NOTE: These baud rates are officially supported, they can be written + * directly into dwDTERate register. + * + * Free baudrate setting is not supported by the base PL2303, and on + * other models it requires writing a divisor value to dwDTERate instead + * of the raw baudrate. The formula for divisor calculation is not published + * by the vendor, so it is speculative, though the official product homepage + * refers to the Linux module source as a reference implementation. + */ static const uint32_t uplcom_rates[] = { - 75, 150, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 14400, - 19200, 28800, 38400, 57600, 115200, /* - * Higher speeds are probably possible. PL2303X supports up to - * 6Mb and can set any rate + * Basic 'standard' speed rates, supported by all models + * NOTE: 900 and 56000 actually works as well */ - 230400, 460800, 614400, 921600, 1228800 + 75, 150, 300, 600, 900, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 14400, + 19200, 28800, 38400, 56000, 57600, 115200, + /* + * Advanced speed rates up to 6Mbs, supported by HX/TA and HXD/TB/EA/RA + * NOTE: regardless of the spec, 256000 does not work + */ + 128000, 134400, 161280, 201600, 230400, 268800, 403200, 460800, 614400, + 806400, 921600, 1228800, 2457600, 3000000, 6000000, + /* + * Advanced speed rates up to 12, supported by HXD/TB/EA/RA + */ + 12000000 }; #define N_UPLCOM_RATES nitems(uplcom_rates) static int +uplcom_baud_supported(unsigned int speed) +{ + int i; + for (i = 0; i < N_UPLCOM_RATES; i++) { + if (uplcom_rates[i] == speed) + return 1; + } + return 0; +} + +static int uplcom_pre_param(struct ucom_softc *ucom, struct termios *t) { struct uplcom_softc *sc = ucom->sc_parent; - uint8_t i; DPRINTF("\n"); @@ -658,26 +727,75 @@ uplcom_pre_param(struct ucom_softc *ucom, struct termi * Check requested baud rate. * * The PL2303 can only set specific baud rates, up to 1228800 baud. - * The PL2303X can set any baud rate up to 6Mb. + * The PL2303HX can set any baud rate up to 6Mb. * The PL2303HX rev. D can set any baud rate up to 12Mb. * - * XXX: We currently cannot identify the PL2303HX rev. D, so treat - * it the same as the PL2303X. */ - if (sc->sc_chiptype != TYPE_PL2303HX) { - for (i = 0; i < N_UPLCOM_RATES; i++) { - if (uplcom_rates[i] == t->c_ospeed) + + /* accept raw divisor data, if someone wants to do the math in user domain */ + if (t->c_ospeed & 0x80000000) + return 0; + switch (sc->sc_chiptype) { + case TYPE_PL2303HXD: + if (t->c_ospeed <= 12000000) return (0); - } - } else { - if (t->c_ospeed <= 6000000) - return (0); + break; + case TYPE_PL2303HX: + if (t->c_ospeed <= 6000000) + return (0); + break; + default: + if (uplcom_baud_supported(t->c_ospeed)) + return (0); + break; } DPRINTF("uplcom_param: bad baud rate (%d)\n", t->c_ospeed); return (EIO); } +static unsigned int +uplcom_encode_baud_rate_divisor(uint8_t *buf, unsigned int baud) +{ + unsigned int baseline, mantissa, exponent; + + /* Determine the baud rate divisor. This algorithm is taken from Linux. */ + /* + * Apparently the formula is: + * baudrate = baseline / (mantissa * 4^exponent) + * where + * mantissa = buf[8:0] + * exponent = buf[11:9] + */ + if (baud == 0) + baud = 1; + baseline = 383385600; + mantissa = baseline / baud; + if (mantissa == 0) + mantissa = 1; + exponent = 0; + while (mantissa >= 512) { + if (exponent < 7) { + mantissa >>= 2; /* divide by 4 */ + exponent++; + } else { + /* Exponent is maxed. Trim mantissa and leave. This gives approx. 45.8 baud */ + mantissa = 511; + break; + } + } + + buf[3] = 0x80; + buf[2] = 0; + buf[1] = exponent << 1 | mantissa >> 8; + buf[0] = mantissa & 0xff; + + /* Calculate and return the exact baud rate. */ + baud = (baseline / mantissa) >> (exponent << 1); + DPRINTF("real baud rate will be %u\n", baud); + + return baud; +} static void uplcom_cfg_param(struct ucom_softc *ucom, struct termios *t) { @@ -689,10 +807,24 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termi memset(&ls, 0, sizeof(ls)); - USETDW(ls.dwDTERate, t->c_ospeed); + /* + * NOTE: If unsupported baud rates are set directly, the PL2303* uses 9600 baud. + */ + if ((t->c_ospeed & 0x80000000) || uplcom_baud_supported(t->c_ospeed)) + USETDW(ls.dwDTERate, t->c_ospeed); + else + t->c_ospeed = uplcom_encode_baud_rate_divisor((uint8_t*)&ls.dwDTERate, t->c_ospeed); if (t->c_cflag & CSTOPB) { - ls.bCharFormat = UCDC_STOP_BIT_2; + if ((t->c_cflag & CSIZE) == CS5) { + /* + * NOTE: Comply with "real" UARTs / RS232: + * use 1.5 instead of 2 stop bits with 5 data bits + */ + ls.bCharFormat = UCDC_STOP_BIT_1_5; + } else { + ls.bCharFormat = UCDC_STOP_BIT_2; + } } else { ls.bCharFormat = UCDC_STOP_BIT_1; } @@ -722,7 +854,7 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termi break; } - DPRINTF("rate=%d fmt=%d parity=%d bits=%d\n", + DPRINTF("rate=0x%08x fmt=%d parity=%d bits=%d\n", UGETDW(ls.dwDTERate), ls.bCharFormat, ls.bParityType, ls.bDataBits); @@ -743,7 +875,7 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termi req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UPLCOM_SET_REQUEST; USETW(req.wValue, 0); - if (sc->sc_chiptype == TYPE_PL2303HX) + if (sc->sc_chiptype != TYPE_PL2303) USETW(req.wIndex, UPLCOM_SET_CRTSCTS_PL2303X); else USETW(req.wIndex, UPLCOM_SET_CRTSCTS); @@ -809,7 +941,6 @@ uplcom_cfg_get_status(struct ucom_softc *ucom, uint8_t DPRINTF("\n"); - /* XXX Note: sc_lsr is always zero */ *lsr = sc->sc_lsr; *msr = sc->sc_msr; } @@ -834,18 +965,33 @@ uplcom_intr_callback(struct usb_xfer *xfer, usb_error_ pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_out(pc, 0, buf, sizeof(buf)); - DPRINTF("status = 0x%02x\n", buf[8]); + DPRINTF("status = 0x%02x\n", buf[UPLCOM_STATE_INDEX]); sc->sc_lsr = 0; sc->sc_msr = 0; - if (buf[8] & RSAQ_STATUS_CTS) { + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_CTS) { sc->sc_msr |= SER_CTS; } - if (buf[8] & RSAQ_STATUS_DSR) { + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_OVERRUN_ERROR) { + sc->sc_lsr |= ULSR_OE; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_PARITY_ERROR) { + sc->sc_lsr |= ULSR_PE; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_FRAME_ERROR) { + sc->sc_lsr |= ULSR_FE; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_RING) { + sc->sc_msr |= SER_RI; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_BREAK_ERROR) { + sc->sc_lsr |= ULSR_BI; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_DSR) { sc->sc_msr |= SER_DSR; } - if (buf[8] & RSAQ_STATUS_DCD) { + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_DCD) { sc->sc_msr |= SER_DCD; } ucom_status_change(&sc->sc_ucom); From owner-svn-src-stable@freebsd.org Mon Oct 29 12:10:07 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD28310D6218; Mon, 29 Oct 2018 12:10:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5FD146E361; Mon, 29 Oct 2018 12:10:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3FEC2634F; Mon, 29 Oct 2018 12:10:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TCA7Z4064499; Mon, 29 Oct 2018 12:10:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TCA7qw064498; Mon, 29 Oct 2018 12:10:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201810291210.w9TCA7qw064498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 29 Oct 2018 12:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339852 - stable/11/sys/dev/usb/serial X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/usb/serial X-SVN-Commit-Revision: 339852 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 12:10:07 -0000 Author: hselasky Date: Mon Oct 29 12:10:06 2018 New Revision: 339852 URL: https://svnweb.freebsd.org/changeset/base/339852 Log: MFC r339587: Added support for formula-based arbitrary baud rates, in contrast to the current fixed values, which enables use of rates above 1 Mbps. Improved the detection of HXD chips, and the status flag handling as well. Submitted by: Gabor Simon PR: 225932 Differential revision: https://reviews.freebsd.org/D16639 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/usb/serial/uplcom.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/serial/uplcom.c ============================================================================== --- stable/11/sys/dev/usb/serial/uplcom.c Mon Oct 29 12:08:15 2018 (r339851) +++ stable/11/sys/dev/usb/serial/uplcom.c Mon Oct 29 12:10:06 2018 (r339852) @@ -132,12 +132,20 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RW #define UPLCOM_SET_CRTSCTS 0x41 #define UPLCOM_SET_CRTSCTS_PL2303X 0x61 #define RSAQ_STATUS_CTS 0x80 +#define RSAQ_STATUS_OVERRUN_ERROR 0x40 +#define RSAQ_STATUS_PARITY_ERROR 0x20 +#define RSAQ_STATUS_FRAME_ERROR 0x10 +#define RSAQ_STATUS_RING 0x08 +#define RSAQ_STATUS_BREAK_ERROR 0x04 #define RSAQ_STATUS_DSR 0x02 #define RSAQ_STATUS_DCD 0x01 #define TYPE_PL2303 0 #define TYPE_PL2303HX 1 +#define TYPE_PL2303HXD 2 +#define UPLCOM_STATE_INDEX 8 + enum { UPLCOM_BULK_DT_WR, UPLCOM_BULK_DT_RD, @@ -367,18 +375,49 @@ uplcom_attach(device_t dev) sc->sc_udev = uaa->device; - /* Determine the chip type. This algorithm is taken from Linux. */ dd = usbd_get_device_descriptor(sc->sc_udev); - if (dd->bDeviceClass == 0x02) - sc->sc_chiptype = TYPE_PL2303; - else if (dd->bMaxPacketSize == 0x40) + + switch (UGETW(dd->bcdDevice)) { + case 0x0300: sc->sc_chiptype = TYPE_PL2303HX; - else - sc->sc_chiptype = TYPE_PL2303; + /* or TA, that is HX with external crystal */ + break; + case 0x0400: + sc->sc_chiptype = TYPE_PL2303HXD; + /* or EA, that is HXD with ESD protection */ + /* or RA, that has internal voltage level converter that works only up to 1Mbaud (!) */ + break; + case 0x0500: + sc->sc_chiptype = TYPE_PL2303HXD; + /* in fact it's TB, that is HXD with external crystal */ + break; + default: + /* NOTE: I have no info about the bcdDevice for the base PL2303 (up to 1.2Mbaud, + only fixed rates) and for PL2303SA (8-pin chip, up to 115200 baud */ + /* Determine the chip type. This algorithm is taken from Linux. */ + if (dd->bDeviceClass == 0x02) + sc->sc_chiptype = TYPE_PL2303; + else if (dd->bMaxPacketSize == 0x40) + sc->sc_chiptype = TYPE_PL2303HX; + else + sc->sc_chiptype = TYPE_PL2303; + break; + } - DPRINTF("chiptype: %s\n", - (sc->sc_chiptype == TYPE_PL2303HX) ? - "2303X" : "2303"); + switch (sc->sc_chiptype) { + case TYPE_PL2303: + DPRINTF("chiptype: 2303\n"); + break; + case TYPE_PL2303HX: + DPRINTF("chiptype: 2303HX/TA\n"); + break; + case TYPE_PL2303HXD: + DPRINTF("chiptype: 2303HXD/TB/RA/EA\n"); + break; + default: + DPRINTF("chiptype: unknown %d\n", sc->sc_chiptype); + break; + } /* * USB-RSAQ1 has two interface @@ -427,13 +466,14 @@ uplcom_attach(device_t dev) goto detach; } - if (sc->sc_chiptype != TYPE_PL2303HX) { + if (sc->sc_chiptype == TYPE_PL2303) { /* HX variants seem to lock up after a clear stall request. */ mtx_lock(&sc->sc_mtx); usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]); usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); } else { + /* reset upstream data pipes */ if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 8, 0, 0) || uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, @@ -552,7 +592,7 @@ uplcom_pl2303_init(struct usb_device *udev, uint8_t ch || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 1, 0, 0)) return (EIO); - if (chiptype == TYPE_PL2303HX) + if (chiptype != TYPE_PL2303) err = uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x44, 0); else err = uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x24, 0); @@ -632,23 +672,52 @@ uplcom_cfg_set_break(struct ucom_softc *ucom, uint8_t &req, NULL, 0, 1000); } +/* + * NOTE: These baud rates are officially supported, they can be written + * directly into dwDTERate register. + * + * Free baudrate setting is not supported by the base PL2303, and on + * other models it requires writing a divisor value to dwDTERate instead + * of the raw baudrate. The formula for divisor calculation is not published + * by the vendor, so it is speculative, though the official product homepage + * refers to the Linux module source as a reference implementation. + */ static const uint32_t uplcom_rates[] = { - 75, 150, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 14400, - 19200, 28800, 38400, 57600, 115200, /* - * Higher speeds are probably possible. PL2303X supports up to - * 6Mb and can set any rate + * Basic 'standard' speed rates, supported by all models + * NOTE: 900 and 56000 actually works as well */ - 230400, 460800, 614400, 921600, 1228800 + 75, 150, 300, 600, 900, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 14400, + 19200, 28800, 38400, 56000, 57600, 115200, + /* + * Advanced speed rates up to 6Mbs, supported by HX/TA and HXD/TB/EA/RA + * NOTE: regardless of the spec, 256000 does not work + */ + 128000, 134400, 161280, 201600, 230400, 268800, 403200, 460800, 614400, + 806400, 921600, 1228800, 2457600, 3000000, 6000000, + /* + * Advanced speed rates up to 12, supported by HXD/TB/EA/RA + */ + 12000000 }; #define N_UPLCOM_RATES nitems(uplcom_rates) static int +uplcom_baud_supported(unsigned int speed) +{ + int i; + for (i = 0; i < N_UPLCOM_RATES; i++) { + if (uplcom_rates[i] == speed) + return 1; + } + return 0; +} + +static int uplcom_pre_param(struct ucom_softc *ucom, struct termios *t) { struct uplcom_softc *sc = ucom->sc_parent; - uint8_t i; DPRINTF("\n"); @@ -656,26 +725,75 @@ uplcom_pre_param(struct ucom_softc *ucom, struct termi * Check requested baud rate. * * The PL2303 can only set specific baud rates, up to 1228800 baud. - * The PL2303X can set any baud rate up to 6Mb. + * The PL2303HX can set any baud rate up to 6Mb. * The PL2303HX rev. D can set any baud rate up to 12Mb. * - * XXX: We currently cannot identify the PL2303HX rev. D, so treat - * it the same as the PL2303X. */ - if (sc->sc_chiptype != TYPE_PL2303HX) { - for (i = 0; i < N_UPLCOM_RATES; i++) { - if (uplcom_rates[i] == t->c_ospeed) + + /* accept raw divisor data, if someone wants to do the math in user domain */ + if (t->c_ospeed & 0x80000000) + return 0; + switch (sc->sc_chiptype) { + case TYPE_PL2303HXD: + if (t->c_ospeed <= 12000000) return (0); - } - } else { - if (t->c_ospeed <= 6000000) - return (0); + break; + case TYPE_PL2303HX: + if (t->c_ospeed <= 6000000) + return (0); + break; + default: + if (uplcom_baud_supported(t->c_ospeed)) + return (0); + break; } DPRINTF("uplcom_param: bad baud rate (%d)\n", t->c_ospeed); return (EIO); } +static unsigned int +uplcom_encode_baud_rate_divisor(uint8_t *buf, unsigned int baud) +{ + unsigned int baseline, mantissa, exponent; + + /* Determine the baud rate divisor. This algorithm is taken from Linux. */ + /* + * Apparently the formula is: + * baudrate = baseline / (mantissa * 4^exponent) + * where + * mantissa = buf[8:0] + * exponent = buf[11:9] + */ + if (baud == 0) + baud = 1; + baseline = 383385600; + mantissa = baseline / baud; + if (mantissa == 0) + mantissa = 1; + exponent = 0; + while (mantissa >= 512) { + if (exponent < 7) { + mantissa >>= 2; /* divide by 4 */ + exponent++; + } else { + /* Exponent is maxed. Trim mantissa and leave. This gives approx. 45.8 baud */ + mantissa = 511; + break; + } + } + + buf[3] = 0x80; + buf[2] = 0; + buf[1] = exponent << 1 | mantissa >> 8; + buf[0] = mantissa & 0xff; + + /* Calculate and return the exact baud rate. */ + baud = (baseline / mantissa) >> (exponent << 1); + DPRINTF("real baud rate will be %u\n", baud); + + return baud; +} static void uplcom_cfg_param(struct ucom_softc *ucom, struct termios *t) { @@ -687,10 +805,24 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termi memset(&ls, 0, sizeof(ls)); - USETDW(ls.dwDTERate, t->c_ospeed); + /* + * NOTE: If unsupported baud rates are set directly, the PL2303* uses 9600 baud. + */ + if ((t->c_ospeed & 0x80000000) || uplcom_baud_supported(t->c_ospeed)) + USETDW(ls.dwDTERate, t->c_ospeed); + else + t->c_ospeed = uplcom_encode_baud_rate_divisor((uint8_t*)&ls.dwDTERate, t->c_ospeed); if (t->c_cflag & CSTOPB) { - ls.bCharFormat = UCDC_STOP_BIT_2; + if ((t->c_cflag & CSIZE) == CS5) { + /* + * NOTE: Comply with "real" UARTs / RS232: + * use 1.5 instead of 2 stop bits with 5 data bits + */ + ls.bCharFormat = UCDC_STOP_BIT_1_5; + } else { + ls.bCharFormat = UCDC_STOP_BIT_2; + } } else { ls.bCharFormat = UCDC_STOP_BIT_1; } @@ -720,7 +852,7 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termi break; } - DPRINTF("rate=%d fmt=%d parity=%d bits=%d\n", + DPRINTF("rate=0x%08x fmt=%d parity=%d bits=%d\n", UGETDW(ls.dwDTERate), ls.bCharFormat, ls.bParityType, ls.bDataBits); @@ -741,7 +873,7 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termi req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UPLCOM_SET_REQUEST; USETW(req.wValue, 0); - if (sc->sc_chiptype == TYPE_PL2303HX) + if (sc->sc_chiptype != TYPE_PL2303) USETW(req.wIndex, UPLCOM_SET_CRTSCTS_PL2303X); else USETW(req.wIndex, UPLCOM_SET_CRTSCTS); @@ -807,7 +939,6 @@ uplcom_cfg_get_status(struct ucom_softc *ucom, uint8_t DPRINTF("\n"); - /* XXX Note: sc_lsr is always zero */ *lsr = sc->sc_lsr; *msr = sc->sc_msr; } @@ -832,18 +963,33 @@ uplcom_intr_callback(struct usb_xfer *xfer, usb_error_ pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_out(pc, 0, buf, sizeof(buf)); - DPRINTF("status = 0x%02x\n", buf[8]); + DPRINTF("status = 0x%02x\n", buf[UPLCOM_STATE_INDEX]); sc->sc_lsr = 0; sc->sc_msr = 0; - if (buf[8] & RSAQ_STATUS_CTS) { + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_CTS) { sc->sc_msr |= SER_CTS; } - if (buf[8] & RSAQ_STATUS_DSR) { + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_OVERRUN_ERROR) { + sc->sc_lsr |= ULSR_OE; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_PARITY_ERROR) { + sc->sc_lsr |= ULSR_PE; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_FRAME_ERROR) { + sc->sc_lsr |= ULSR_FE; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_RING) { + sc->sc_msr |= SER_RI; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_BREAK_ERROR) { + sc->sc_lsr |= ULSR_BI; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_DSR) { sc->sc_msr |= SER_DSR; } - if (buf[8] & RSAQ_STATUS_DCD) { + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_DCD) { sc->sc_msr |= SER_DCD; } ucom_status_change(&sc->sc_ucom); From owner-svn-src-stable@freebsd.org Mon Oct 29 12:11:28 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FA0910D62D3; Mon, 29 Oct 2018 12:11:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 553D56E56E; Mon, 29 Oct 2018 12:11:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3687E6485; Mon, 29 Oct 2018 12:11:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TCBRPA065339; Mon, 29 Oct 2018 12:11:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TCBRQ2065338; Mon, 29 Oct 2018 12:11:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201810291211.w9TCBRQ2065338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 29 Oct 2018 12:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r339853 - stable/10/sys/dev/usb/serial X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/usb/serial X-SVN-Commit-Revision: 339853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 12:11:28 -0000 Author: hselasky Date: Mon Oct 29 12:11:27 2018 New Revision: 339853 URL: https://svnweb.freebsd.org/changeset/base/339853 Log: MFC r339587: Added support for formula-based arbitrary baud rates, in contrast to the current fixed values, which enables use of rates above 1 Mbps. Improved the detection of HXD chips, and the status flag handling as well. Submitted by: Gabor Simon PR: 225932 Differential revision: https://reviews.freebsd.org/D16639 Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/usb/serial/uplcom.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/serial/uplcom.c ============================================================================== --- stable/10/sys/dev/usb/serial/uplcom.c Mon Oct 29 12:10:06 2018 (r339852) +++ stable/10/sys/dev/usb/serial/uplcom.c Mon Oct 29 12:11:27 2018 (r339853) @@ -132,12 +132,20 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RW #define UPLCOM_SET_CRTSCTS 0x41 #define UPLCOM_SET_CRTSCTS_PL2303X 0x61 #define RSAQ_STATUS_CTS 0x80 +#define RSAQ_STATUS_OVERRUN_ERROR 0x40 +#define RSAQ_STATUS_PARITY_ERROR 0x20 +#define RSAQ_STATUS_FRAME_ERROR 0x10 +#define RSAQ_STATUS_RING 0x08 +#define RSAQ_STATUS_BREAK_ERROR 0x04 #define RSAQ_STATUS_DSR 0x02 #define RSAQ_STATUS_DCD 0x01 #define TYPE_PL2303 0 #define TYPE_PL2303HX 1 +#define TYPE_PL2303HXD 2 +#define UPLCOM_STATE_INDEX 8 + enum { UPLCOM_BULK_DT_WR, UPLCOM_BULK_DT_RD, @@ -366,18 +374,49 @@ uplcom_attach(device_t dev) sc->sc_udev = uaa->device; - /* Determine the chip type. This algorithm is taken from Linux. */ dd = usbd_get_device_descriptor(sc->sc_udev); - if (dd->bDeviceClass == 0x02) - sc->sc_chiptype = TYPE_PL2303; - else if (dd->bMaxPacketSize == 0x40) + + switch (UGETW(dd->bcdDevice)) { + case 0x0300: sc->sc_chiptype = TYPE_PL2303HX; - else - sc->sc_chiptype = TYPE_PL2303; + /* or TA, that is HX with external crystal */ + break; + case 0x0400: + sc->sc_chiptype = TYPE_PL2303HXD; + /* or EA, that is HXD with ESD protection */ + /* or RA, that has internal voltage level converter that works only up to 1Mbaud (!) */ + break; + case 0x0500: + sc->sc_chiptype = TYPE_PL2303HXD; + /* in fact it's TB, that is HXD with external crystal */ + break; + default: + /* NOTE: I have no info about the bcdDevice for the base PL2303 (up to 1.2Mbaud, + only fixed rates) and for PL2303SA (8-pin chip, up to 115200 baud */ + /* Determine the chip type. This algorithm is taken from Linux. */ + if (dd->bDeviceClass == 0x02) + sc->sc_chiptype = TYPE_PL2303; + else if (dd->bMaxPacketSize == 0x40) + sc->sc_chiptype = TYPE_PL2303HX; + else + sc->sc_chiptype = TYPE_PL2303; + break; + } - DPRINTF("chiptype: %s\n", - (sc->sc_chiptype == TYPE_PL2303HX) ? - "2303X" : "2303"); + switch (sc->sc_chiptype) { + case TYPE_PL2303: + DPRINTF("chiptype: 2303\n"); + break; + case TYPE_PL2303HX: + DPRINTF("chiptype: 2303HX/TA\n"); + break; + case TYPE_PL2303HXD: + DPRINTF("chiptype: 2303HXD/TB/RA/EA\n"); + break; + default: + DPRINTF("chiptype: unknown %d\n", sc->sc_chiptype); + break; + } /* * USB-RSAQ1 has two interface @@ -426,13 +465,14 @@ uplcom_attach(device_t dev) goto detach; } - if (sc->sc_chiptype != TYPE_PL2303HX) { + if (sc->sc_chiptype == TYPE_PL2303) { /* HX variants seem to lock up after a clear stall request. */ mtx_lock(&sc->sc_mtx); usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]); usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); } else { + /* reset upstream data pipes */ if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 8, 0, 0) || uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, @@ -551,7 +591,7 @@ uplcom_pl2303_init(struct usb_device *udev, uint8_t ch || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 1, 0, 0)) return (EIO); - if (chiptype == TYPE_PL2303HX) + if (chiptype != TYPE_PL2303) err = uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x44, 0); else err = uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x24, 0); @@ -631,23 +671,52 @@ uplcom_cfg_set_break(struct ucom_softc *ucom, uint8_t &req, NULL, 0, 1000); } +/* + * NOTE: These baud rates are officially supported, they can be written + * directly into dwDTERate register. + * + * Free baudrate setting is not supported by the base PL2303, and on + * other models it requires writing a divisor value to dwDTERate instead + * of the raw baudrate. The formula for divisor calculation is not published + * by the vendor, so it is speculative, though the official product homepage + * refers to the Linux module source as a reference implementation. + */ static const uint32_t uplcom_rates[] = { - 75, 150, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 14400, - 19200, 28800, 38400, 57600, 115200, /* - * Higher speeds are probably possible. PL2303X supports up to - * 6Mb and can set any rate + * Basic 'standard' speed rates, supported by all models + * NOTE: 900 and 56000 actually works as well */ - 230400, 460800, 614400, 921600, 1228800 + 75, 150, 300, 600, 900, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 14400, + 19200, 28800, 38400, 56000, 57600, 115200, + /* + * Advanced speed rates up to 6Mbs, supported by HX/TA and HXD/TB/EA/RA + * NOTE: regardless of the spec, 256000 does not work + */ + 128000, 134400, 161280, 201600, 230400, 268800, 403200, 460800, 614400, + 806400, 921600, 1228800, 2457600, 3000000, 6000000, + /* + * Advanced speed rates up to 12, supported by HXD/TB/EA/RA + */ + 12000000 }; #define N_UPLCOM_RATES (sizeof(uplcom_rates)/sizeof(uplcom_rates[0])) static int +uplcom_baud_supported(unsigned int speed) +{ + int i; + for (i = 0; i < N_UPLCOM_RATES; i++) { + if (uplcom_rates[i] == speed) + return 1; + } + return 0; +} + +static int uplcom_pre_param(struct ucom_softc *ucom, struct termios *t) { struct uplcom_softc *sc = ucom->sc_parent; - uint8_t i; DPRINTF("\n"); @@ -655,26 +724,75 @@ uplcom_pre_param(struct ucom_softc *ucom, struct termi * Check requested baud rate. * * The PL2303 can only set specific baud rates, up to 1228800 baud. - * The PL2303X can set any baud rate up to 6Mb. + * The PL2303HX can set any baud rate up to 6Mb. * The PL2303HX rev. D can set any baud rate up to 12Mb. * - * XXX: We currently cannot identify the PL2303HX rev. D, so treat - * it the same as the PL2303X. */ - if (sc->sc_chiptype != TYPE_PL2303HX) { - for (i = 0; i < N_UPLCOM_RATES; i++) { - if (uplcom_rates[i] == t->c_ospeed) + + /* accept raw divisor data, if someone wants to do the math in user domain */ + if (t->c_ospeed & 0x80000000) + return 0; + switch (sc->sc_chiptype) { + case TYPE_PL2303HXD: + if (t->c_ospeed <= 12000000) return (0); - } - } else { - if (t->c_ospeed <= 6000000) - return (0); + break; + case TYPE_PL2303HX: + if (t->c_ospeed <= 6000000) + return (0); + break; + default: + if (uplcom_baud_supported(t->c_ospeed)) + return (0); + break; } DPRINTF("uplcom_param: bad baud rate (%d)\n", t->c_ospeed); return (EIO); } +static unsigned int +uplcom_encode_baud_rate_divisor(uint8_t *buf, unsigned int baud) +{ + unsigned int baseline, mantissa, exponent; + + /* Determine the baud rate divisor. This algorithm is taken from Linux. */ + /* + * Apparently the formula is: + * baudrate = baseline / (mantissa * 4^exponent) + * where + * mantissa = buf[8:0] + * exponent = buf[11:9] + */ + if (baud == 0) + baud = 1; + baseline = 383385600; + mantissa = baseline / baud; + if (mantissa == 0) + mantissa = 1; + exponent = 0; + while (mantissa >= 512) { + if (exponent < 7) { + mantissa >>= 2; /* divide by 4 */ + exponent++; + } else { + /* Exponent is maxed. Trim mantissa and leave. This gives approx. 45.8 baud */ + mantissa = 511; + break; + } + } + + buf[3] = 0x80; + buf[2] = 0; + buf[1] = exponent << 1 | mantissa >> 8; + buf[0] = mantissa & 0xff; + + /* Calculate and return the exact baud rate. */ + baud = (baseline / mantissa) >> (exponent << 1); + DPRINTF("real baud rate will be %u\n", baud); + + return baud; +} static void uplcom_cfg_param(struct ucom_softc *ucom, struct termios *t) { @@ -686,10 +804,24 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termi memset(&ls, 0, sizeof(ls)); - USETDW(ls.dwDTERate, t->c_ospeed); + /* + * NOTE: If unsupported baud rates are set directly, the PL2303* uses 9600 baud. + */ + if ((t->c_ospeed & 0x80000000) || uplcom_baud_supported(t->c_ospeed)) + USETDW(ls.dwDTERate, t->c_ospeed); + else + t->c_ospeed = uplcom_encode_baud_rate_divisor((uint8_t*)&ls.dwDTERate, t->c_ospeed); if (t->c_cflag & CSTOPB) { - ls.bCharFormat = UCDC_STOP_BIT_2; + if ((t->c_cflag & CSIZE) == CS5) { + /* + * NOTE: Comply with "real" UARTs / RS232: + * use 1.5 instead of 2 stop bits with 5 data bits + */ + ls.bCharFormat = UCDC_STOP_BIT_1_5; + } else { + ls.bCharFormat = UCDC_STOP_BIT_2; + } } else { ls.bCharFormat = UCDC_STOP_BIT_1; } @@ -719,7 +851,7 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termi break; } - DPRINTF("rate=%d fmt=%d parity=%d bits=%d\n", + DPRINTF("rate=0x%08x fmt=%d parity=%d bits=%d\n", UGETDW(ls.dwDTERate), ls.bCharFormat, ls.bParityType, ls.bDataBits); @@ -740,7 +872,7 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termi req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UPLCOM_SET_REQUEST; USETW(req.wValue, 0); - if (sc->sc_chiptype == TYPE_PL2303HX) + if (sc->sc_chiptype != TYPE_PL2303) USETW(req.wIndex, UPLCOM_SET_CRTSCTS_PL2303X); else USETW(req.wIndex, UPLCOM_SET_CRTSCTS); @@ -830,18 +962,33 @@ uplcom_intr_callback(struct usb_xfer *xfer, usb_error_ pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_out(pc, 0, buf, sizeof(buf)); - DPRINTF("status = 0x%02x\n", buf[8]); + DPRINTF("status = 0x%02x\n", buf[UPLCOM_STATE_INDEX]); sc->sc_lsr = 0; sc->sc_msr = 0; - if (buf[8] & RSAQ_STATUS_CTS) { + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_CTS) { sc->sc_msr |= SER_CTS; } - if (buf[8] & RSAQ_STATUS_DSR) { + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_OVERRUN_ERROR) { + sc->sc_lsr |= ULSR_OE; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_PARITY_ERROR) { + sc->sc_lsr |= ULSR_PE; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_FRAME_ERROR) { + sc->sc_lsr |= ULSR_FE; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_RING) { + sc->sc_msr |= SER_RI; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_BREAK_ERROR) { + sc->sc_lsr |= ULSR_BI; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_DSR) { sc->sc_msr |= SER_DSR; } - if (buf[8] & RSAQ_STATUS_DCD) { + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_DCD) { sc->sc_msr |= SER_DCD; } ucom_status_change(&sc->sc_ucom); From owner-svn-src-stable@freebsd.org Mon Oct 29 12:13:06 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F5CE10D651B; Mon, 29 Oct 2018 12:13:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D7DBB6E8DB; Mon, 29 Oct 2018 12:13:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B41AD64DE; Mon, 29 Oct 2018 12:13:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TCD5BH069721; Mon, 29 Oct 2018 12:13:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TCD5Pt069720; Mon, 29 Oct 2018 12:13:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201810291213.w9TCD5Pt069720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 29 Oct 2018 12:13:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r339854 - stable/9/sys/dev/usb/serial X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/9/sys/dev/usb/serial X-SVN-Commit-Revision: 339854 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 12:13:06 -0000 Author: hselasky Date: Mon Oct 29 12:13:05 2018 New Revision: 339854 URL: https://svnweb.freebsd.org/changeset/base/339854 Log: MFC r339587: Added support for formula-based arbitrary baud rates, in contrast to the current fixed values, which enables use of rates above 1 Mbps. Improved the detection of HXD chips, and the status flag handling as well. Submitted by: Gabor Simon PR: 225932 Differential revision: https://reviews.freebsd.org/D16639 Sponsored by: Mellanox Technologies Modified: stable/9/sys/dev/usb/serial/uplcom.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/usb/serial/uplcom.c ============================================================================== --- stable/9/sys/dev/usb/serial/uplcom.c Mon Oct 29 12:11:27 2018 (r339853) +++ stable/9/sys/dev/usb/serial/uplcom.c Mon Oct 29 12:13:05 2018 (r339854) @@ -132,12 +132,20 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RW #define UPLCOM_SET_CRTSCTS 0x41 #define UPLCOM_SET_CRTSCTS_PL2303X 0x61 #define RSAQ_STATUS_CTS 0x80 +#define RSAQ_STATUS_OVERRUN_ERROR 0x40 +#define RSAQ_STATUS_PARITY_ERROR 0x20 +#define RSAQ_STATUS_FRAME_ERROR 0x10 +#define RSAQ_STATUS_RING 0x08 +#define RSAQ_STATUS_BREAK_ERROR 0x04 #define RSAQ_STATUS_DSR 0x02 #define RSAQ_STATUS_DCD 0x01 #define TYPE_PL2303 0 #define TYPE_PL2303HX 1 +#define TYPE_PL2303HXD 2 +#define UPLCOM_STATE_INDEX 8 + enum { UPLCOM_BULK_DT_WR, UPLCOM_BULK_DT_RD, @@ -366,18 +374,49 @@ uplcom_attach(device_t dev) sc->sc_udev = uaa->device; - /* Determine the chip type. This algorithm is taken from Linux. */ dd = usbd_get_device_descriptor(sc->sc_udev); - if (dd->bDeviceClass == 0x02) - sc->sc_chiptype = TYPE_PL2303; - else if (dd->bMaxPacketSize == 0x40) + + switch (UGETW(dd->bcdDevice)) { + case 0x0300: sc->sc_chiptype = TYPE_PL2303HX; - else - sc->sc_chiptype = TYPE_PL2303; + /* or TA, that is HX with external crystal */ + break; + case 0x0400: + sc->sc_chiptype = TYPE_PL2303HXD; + /* or EA, that is HXD with ESD protection */ + /* or RA, that has internal voltage level converter that works only up to 1Mbaud (!) */ + break; + case 0x0500: + sc->sc_chiptype = TYPE_PL2303HXD; + /* in fact it's TB, that is HXD with external crystal */ + break; + default: + /* NOTE: I have no info about the bcdDevice for the base PL2303 (up to 1.2Mbaud, + only fixed rates) and for PL2303SA (8-pin chip, up to 115200 baud */ + /* Determine the chip type. This algorithm is taken from Linux. */ + if (dd->bDeviceClass == 0x02) + sc->sc_chiptype = TYPE_PL2303; + else if (dd->bMaxPacketSize == 0x40) + sc->sc_chiptype = TYPE_PL2303HX; + else + sc->sc_chiptype = TYPE_PL2303; + break; + } - DPRINTF("chiptype: %s\n", - (sc->sc_chiptype == TYPE_PL2303HX) ? - "2303X" : "2303"); + switch (sc->sc_chiptype) { + case TYPE_PL2303: + DPRINTF("chiptype: 2303\n"); + break; + case TYPE_PL2303HX: + DPRINTF("chiptype: 2303HX/TA\n"); + break; + case TYPE_PL2303HXD: + DPRINTF("chiptype: 2303HXD/TB/RA/EA\n"); + break; + default: + DPRINTF("chiptype: unknown %d\n", sc->sc_chiptype); + break; + } /* * USB-RSAQ1 has two interface @@ -426,13 +465,14 @@ uplcom_attach(device_t dev) goto detach; } - if (sc->sc_chiptype != TYPE_PL2303HX) { + if (sc->sc_chiptype == TYPE_PL2303) { /* HX variants seem to lock up after a clear stall request. */ mtx_lock(&sc->sc_mtx); usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]); usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); } else { + /* reset upstream data pipes */ if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 8, 0, 0) || uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, @@ -551,7 +591,7 @@ uplcom_pl2303_init(struct usb_device *udev, uint8_t ch || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 1, 0, 0)) return (EIO); - if (chiptype == TYPE_PL2303HX) + if (chiptype != TYPE_PL2303) err = uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x44, 0); else err = uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x24, 0); @@ -631,23 +671,52 @@ uplcom_cfg_set_break(struct ucom_softc *ucom, uint8_t &req, NULL, 0, 1000); } +/* + * NOTE: These baud rates are officially supported, they can be written + * directly into dwDTERate register. + * + * Free baudrate setting is not supported by the base PL2303, and on + * other models it requires writing a divisor value to dwDTERate instead + * of the raw baudrate. The formula for divisor calculation is not published + * by the vendor, so it is speculative, though the official product homepage + * refers to the Linux module source as a reference implementation. + */ static const uint32_t uplcom_rates[] = { - 75, 150, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 14400, - 19200, 28800, 38400, 57600, 115200, /* - * Higher speeds are probably possible. PL2303X supports up to - * 6Mb and can set any rate + * Basic 'standard' speed rates, supported by all models + * NOTE: 900 and 56000 actually works as well */ - 230400, 460800, 614400, 921600, 1228800 + 75, 150, 300, 600, 900, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 14400, + 19200, 28800, 38400, 56000, 57600, 115200, + /* + * Advanced speed rates up to 6Mbs, supported by HX/TA and HXD/TB/EA/RA + * NOTE: regardless of the spec, 256000 does not work + */ + 128000, 134400, 161280, 201600, 230400, 268800, 403200, 460800, 614400, + 806400, 921600, 1228800, 2457600, 3000000, 6000000, + /* + * Advanced speed rates up to 12, supported by HXD/TB/EA/RA + */ + 12000000 }; #define N_UPLCOM_RATES (sizeof(uplcom_rates)/sizeof(uplcom_rates[0])) static int +uplcom_baud_supported(unsigned int speed) +{ + int i; + for (i = 0; i < N_UPLCOM_RATES; i++) { + if (uplcom_rates[i] == speed) + return 1; + } + return 0; +} + +static int uplcom_pre_param(struct ucom_softc *ucom, struct termios *t) { struct uplcom_softc *sc = ucom->sc_parent; - uint8_t i; DPRINTF("\n"); @@ -655,26 +724,75 @@ uplcom_pre_param(struct ucom_softc *ucom, struct termi * Check requested baud rate. * * The PL2303 can only set specific baud rates, up to 1228800 baud. - * The PL2303X can set any baud rate up to 6Mb. + * The PL2303HX can set any baud rate up to 6Mb. * The PL2303HX rev. D can set any baud rate up to 12Mb. * - * XXX: We currently cannot identify the PL2303HX rev. D, so treat - * it the same as the PL2303X. */ - if (sc->sc_chiptype != TYPE_PL2303HX) { - for (i = 0; i < N_UPLCOM_RATES; i++) { - if (uplcom_rates[i] == t->c_ospeed) + + /* accept raw divisor data, if someone wants to do the math in user domain */ + if (t->c_ospeed & 0x80000000) + return 0; + switch (sc->sc_chiptype) { + case TYPE_PL2303HXD: + if (t->c_ospeed <= 12000000) return (0); - } - } else { - if (t->c_ospeed <= 6000000) - return (0); + break; + case TYPE_PL2303HX: + if (t->c_ospeed <= 6000000) + return (0); + break; + default: + if (uplcom_baud_supported(t->c_ospeed)) + return (0); + break; } DPRINTF("uplcom_param: bad baud rate (%d)\n", t->c_ospeed); return (EIO); } +static unsigned int +uplcom_encode_baud_rate_divisor(uint8_t *buf, unsigned int baud) +{ + unsigned int baseline, mantissa, exponent; + + /* Determine the baud rate divisor. This algorithm is taken from Linux. */ + /* + * Apparently the formula is: + * baudrate = baseline / (mantissa * 4^exponent) + * where + * mantissa = buf[8:0] + * exponent = buf[11:9] + */ + if (baud == 0) + baud = 1; + baseline = 383385600; + mantissa = baseline / baud; + if (mantissa == 0) + mantissa = 1; + exponent = 0; + while (mantissa >= 512) { + if (exponent < 7) { + mantissa >>= 2; /* divide by 4 */ + exponent++; + } else { + /* Exponent is maxed. Trim mantissa and leave. This gives approx. 45.8 baud */ + mantissa = 511; + break; + } + } + + buf[3] = 0x80; + buf[2] = 0; + buf[1] = exponent << 1 | mantissa >> 8; + buf[0] = mantissa & 0xff; + + /* Calculate and return the exact baud rate. */ + baud = (baseline / mantissa) >> (exponent << 1); + DPRINTF("real baud rate will be %u\n", baud); + + return baud; +} static void uplcom_cfg_param(struct ucom_softc *ucom, struct termios *t) { @@ -686,10 +804,24 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termi memset(&ls, 0, sizeof(ls)); - USETDW(ls.dwDTERate, t->c_ospeed); + /* + * NOTE: If unsupported baud rates are set directly, the PL2303* uses 9600 baud. + */ + if ((t->c_ospeed & 0x80000000) || uplcom_baud_supported(t->c_ospeed)) + USETDW(ls.dwDTERate, t->c_ospeed); + else + t->c_ospeed = uplcom_encode_baud_rate_divisor((uint8_t*)&ls.dwDTERate, t->c_ospeed); if (t->c_cflag & CSTOPB) { - ls.bCharFormat = UCDC_STOP_BIT_2; + if ((t->c_cflag & CSIZE) == CS5) { + /* + * NOTE: Comply with "real" UARTs / RS232: + * use 1.5 instead of 2 stop bits with 5 data bits + */ + ls.bCharFormat = UCDC_STOP_BIT_1_5; + } else { + ls.bCharFormat = UCDC_STOP_BIT_2; + } } else { ls.bCharFormat = UCDC_STOP_BIT_1; } @@ -719,7 +851,7 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termi break; } - DPRINTF("rate=%d fmt=%d parity=%d bits=%d\n", + DPRINTF("rate=0x%08x fmt=%d parity=%d bits=%d\n", UGETDW(ls.dwDTERate), ls.bCharFormat, ls.bParityType, ls.bDataBits); @@ -740,7 +872,7 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termi req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UPLCOM_SET_REQUEST; USETW(req.wValue, 0); - if (sc->sc_chiptype == TYPE_PL2303HX) + if (sc->sc_chiptype != TYPE_PL2303) USETW(req.wIndex, UPLCOM_SET_CRTSCTS_PL2303X); else USETW(req.wIndex, UPLCOM_SET_CRTSCTS); @@ -830,18 +962,33 @@ uplcom_intr_callback(struct usb_xfer *xfer, usb_error_ pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_out(pc, 0, buf, sizeof(buf)); - DPRINTF("status = 0x%02x\n", buf[8]); + DPRINTF("status = 0x%02x\n", buf[UPLCOM_STATE_INDEX]); sc->sc_lsr = 0; sc->sc_msr = 0; - if (buf[8] & RSAQ_STATUS_CTS) { + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_CTS) { sc->sc_msr |= SER_CTS; } - if (buf[8] & RSAQ_STATUS_DSR) { + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_OVERRUN_ERROR) { + sc->sc_lsr |= ULSR_OE; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_PARITY_ERROR) { + sc->sc_lsr |= ULSR_PE; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_FRAME_ERROR) { + sc->sc_lsr |= ULSR_FE; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_RING) { + sc->sc_msr |= SER_RI; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_BREAK_ERROR) { + sc->sc_lsr |= ULSR_BI; + } + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_DSR) { sc->sc_msr |= SER_DSR; } - if (buf[8] & RSAQ_STATUS_DCD) { + if (buf[UPLCOM_STATE_INDEX] & RSAQ_STATUS_DCD) { sc->sc_msr |= SER_DCD; } ucom_status_change(&sc->sc_ucom); From owner-svn-src-stable@freebsd.org Mon Oct 29 12:41:50 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE5A310D6FD5; Mon, 29 Oct 2018 12:41:50 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 62F376F78A; Mon, 29 Oct 2018 12:41:50 +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 459376978; Mon, 29 Oct 2018 12:41:50 +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 w9TCfo9r080839; Mon, 29 Oct 2018 12:41:50 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TCfo8f080838; Mon, 29 Oct 2018 12:41:50 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201810291241.w9TCfo8f080838@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 29 Oct 2018 12:41:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339855 - stable/11/sys/ddb X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/ddb X-SVN-Commit-Revision: 339855 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 12:41:50 -0000 Author: avg Date: Mon Oct 29 12:41:49 2018 New Revision: 339855 URL: https://svnweb.freebsd.org/changeset/base/339855 Log: MFC r303648: Fix ddb "show proc" to show full arguments PR: 200052 Modified: stable/11/sys/ddb/db_ps.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ddb/db_ps.c ============================================================================== --- stable/11/sys/ddb/db_ps.c Mon Oct 29 12:13:05 2018 (r339854) +++ stable/11/sys/ddb/db_ps.c Mon Oct 29 12:41:49 2018 (r339855) @@ -440,9 +440,16 @@ DB_SHOW_COMMAND(proc, db_show_proc) p->p_leader); if (p->p_sysent != NULL) db_printf(" ABI: %s\n", p->p_sysent->sv_name); - if (p->p_args != NULL) - db_printf(" arguments: %.*s\n", (int)p->p_args->ar_length, - p->p_args->ar_args); + if (p->p_args != NULL) { + db_printf(" arguments: "); + for (i = 0; i < (int)p->p_args->ar_length; i++) { + if (p->p_args->ar_args[i] == '\0') + db_printf(" "); + else + db_printf("%c", p->p_args->ar_args[i]); + } + db_printf("\n"); + } db_printf(" threads: %d\n", p->p_numthreads); FOREACH_THREAD_IN_PROC(p, td) { dumpthread(p, td, 1); From owner-svn-src-stable@freebsd.org Mon Oct 29 12:45:09 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCE8610D72A8; Mon, 29 Oct 2018 12:45:09 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C5DB6FA04; Mon, 29 Oct 2018 12:45:09 +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 44D8E69B1; Mon, 29 Oct 2018 12:45:09 +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 w9TCj8SK085150; Mon, 29 Oct 2018 12:45:08 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TCj8Vt085149; Mon, 29 Oct 2018 12:45:08 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201810291245.w9TCj8Vt085149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 29 Oct 2018 12:45:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r339856 - stable/10/sys/ddb X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/10/sys/ddb X-SVN-Commit-Revision: 339856 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 12:45:09 -0000 Author: avg Date: Mon Oct 29 12:45:08 2018 New Revision: 339856 URL: https://svnweb.freebsd.org/changeset/base/339856 Log: MFC r303648: Fix ddb "show proc" to show full arguments PR: 200052 Modified: stable/10/sys/ddb/db_ps.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ddb/db_ps.c ============================================================================== --- stable/10/sys/ddb/db_ps.c Mon Oct 29 12:41:49 2018 (r339855) +++ stable/10/sys/ddb/db_ps.c Mon Oct 29 12:45:08 2018 (r339856) @@ -426,9 +426,16 @@ DB_SHOW_COMMAND(proc, db_show_proc) p->p_leader); if (p->p_sysent != NULL) db_printf(" ABI: %s\n", p->p_sysent->sv_name); - if (p->p_args != NULL) - db_printf(" arguments: %.*s\n", (int)p->p_args->ar_length, - p->p_args->ar_args); + if (p->p_args != NULL) { + db_printf(" arguments: "); + for (i = 0; i < (int)p->p_args->ar_length; i++) { + if (p->p_args->ar_args[i] == '\0') + db_printf(" "); + else + db_printf("%c", p->p_args->ar_args[i]); + } + db_printf("\n"); + } db_printf(" threads: %d\n", p->p_numthreads); FOREACH_THREAD_IN_PROC(p, td) { dumpthread(p, td, 1); From owner-svn-src-stable@freebsd.org Mon Oct 29 12:47:17 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C75810D73F4; Mon, 29 Oct 2018 12:47:17 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C57C06FC60; Mon, 29 Oct 2018 12:47:16 +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 A7A0B69B4; Mon, 29 Oct 2018 12:47:16 +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 w9TClGqg085314; Mon, 29 Oct 2018 12:47:16 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TClGEZ085313; Mon, 29 Oct 2018 12:47:16 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201810291247.w9TClGEZ085313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 29 Oct 2018 12:47:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339857 - in stable/11: share/man/man4 sys/ddb X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/ddb X-SVN-Commit-Revision: 339857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 12:47:17 -0000 Author: avg Date: Mon Oct 29 12:47:15 2018 New Revision: 339857 URL: https://svnweb.freebsd.org/changeset/base/339857 Log: MFC r337528: add an option for ddb ps command to print process arguments Sponsored by: Panzura Modified: stable/11/share/man/man4/ddb.4 stable/11/sys/ddb/db_ps.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/ddb.4 ============================================================================== --- stable/11/share/man/man4/ddb.4 Mon Oct 29 12:45:08 2018 (r339856) +++ stable/11/share/man/man4/ddb.4 Mon Oct 29 12:47:15 2018 (r339857) @@ -537,16 +537,15 @@ If the thread is not found, search the thread stack ca cached stack address. Otherwise, prints nothing. .Pp -.It Ic show Cm all procs Ns Op Li / Ns Cm m -.It Ic ps Ns Op Li / Ns Cm m +.It Ic show Cm all procs Ns Op Li / Ns Cm a +.It Ic ps Ns Op Li / Ns Cm a Display all process information. The process information may not be shown if it is not supported in the machine, or the bottom of the stack of the target process is not in the main memory at that time. The -.Cm m -modifier will alter the display to show VM map -addresses for the process and not show other information. +.Cm a +modifier will print command line arguments for each process. .\" .Pp .It Ic show Cm all trace Modified: stable/11/sys/ddb/db_ps.c ============================================================================== --- stable/11/sys/ddb/db_ps.c Mon Oct 29 12:45:08 2018 (r339856) +++ stable/11/sys/ddb/db_ps.c Mon Oct 29 12:47:15 2018 (r339857) @@ -47,8 +47,13 @@ __FBSDID("$FreeBSD$"); #include +#define PRINT_NONE 0 +#define PRINT_ARGS 1 + static void dumpthread(volatile struct proc *p, volatile struct thread *td, int all); +static int ps_mode; + /* * At least one non-optional show-command must be implemented using * DB_SHOW_ALL_COMMAND() so that db_show_all_cmd_set gets created. @@ -59,6 +64,24 @@ DB_SHOW_ALL_COMMAND(procs, db_procs_cmd) db_ps(addr, have_addr, count, modif); } +static void +dump_args(volatile struct proc *p) +{ + char *args; + int i, len; + + if (p->p_args == NULL) + return; + args = p->p_args->ar_args; + len = (int)p->p_args->ar_length; + for (i = 0; i < len; i++) { + if (args[i] == '\0') + db_printf(" "); + else + db_printf("%c", args[i]); + } +} + /* * Layout: * - column counts @@ -87,6 +110,7 @@ db_ps(db_expr_t addr, bool hasaddr, db_expr_t count, c char state[9]; int np, rflag, sflag, dflag, lflag, wflag; + ps_mode = modif[0] == 'a' ? PRINT_ARGS : PRINT_NONE; np = nprocs; if (!LIST_EMPTY(&allproc)) @@ -204,6 +228,10 @@ db_ps(db_expr_t addr, bool hasaddr, db_expr_t count, c db_printf("%s", p->p_comm); if (p->p_flag & P_SYSTEM) db_printf("]"); + if (ps_mode == PRINT_ARGS) { + db_printf(" "); + dump_args(p); + } db_printf("\n"); } FOREACH_THREAD_IN_PROC(p, td) { @@ -296,6 +324,10 @@ dumpthread(volatile struct proc *p, volatile struct th db_printf("%s", td->td_proc->p_comm); if (p->p_flag & P_SYSTEM) db_printf("]"); + if (ps_mode == PRINT_ARGS && all == 0) { + db_printf(" "); + dump_args(p); + } db_printf("\n"); } @@ -442,12 +474,7 @@ DB_SHOW_COMMAND(proc, db_show_proc) db_printf(" ABI: %s\n", p->p_sysent->sv_name); if (p->p_args != NULL) { db_printf(" arguments: "); - for (i = 0; i < (int)p->p_args->ar_length; i++) { - if (p->p_args->ar_args[i] == '\0') - db_printf(" "); - else - db_printf("%c", p->p_args->ar_args[i]); - } + dump_args(p); db_printf("\n"); } db_printf(" threads: %d\n", p->p_numthreads); From owner-svn-src-stable@freebsd.org Mon Oct 29 12:48:32 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0EED10D74DB; Mon, 29 Oct 2018 12:48:31 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5B4A6FDFF; Mon, 29 Oct 2018 12:48:31 +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 86B4069B6; Mon, 29 Oct 2018 12:48:31 +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 w9TCmVO7085431; Mon, 29 Oct 2018 12:48:31 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TCmVPx085430; Mon, 29 Oct 2018 12:48:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201810291248.w9TCmVPx085430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 29 Oct 2018 12:48:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r339858 - in stable/10: share/man/man4 sys/ddb X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/10: share/man/man4 sys/ddb X-SVN-Commit-Revision: 339858 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 12:48:32 -0000 Author: avg Date: Mon Oct 29 12:48:30 2018 New Revision: 339858 URL: https://svnweb.freebsd.org/changeset/base/339858 Log: MFC r337528: add an option for ddb ps command to print process arguments Sponsored by: Panzura Modified: stable/10/share/man/man4/ddb.4 stable/10/sys/ddb/db_ps.c Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/ddb.4 ============================================================================== --- stable/10/share/man/man4/ddb.4 Mon Oct 29 12:47:15 2018 (r339857) +++ stable/10/share/man/man4/ddb.4 Mon Oct 29 12:48:30 2018 (r339858) @@ -535,16 +535,15 @@ If the thread is not found, search the thread stack ca cached stack address. Otherwise, prints nothing. .Pp -.It Ic show Cm all procs Ns Op Li / Ns Cm m -.It Ic ps Ns Op Li / Ns Cm m +.It Ic show Cm all procs Ns Op Li / Ns Cm a +.It Ic ps Ns Op Li / Ns Cm a Display all process information. The process information may not be shown if it is not supported in the machine, or the bottom of the stack of the target process is not in the main memory at that time. The -.Cm m -modifier will alter the display to show VM map -addresses for the process and not show other information. +.Cm a +modifier will print command line arguments for each process. .\" .Pp .It Ic show Cm all trace Modified: stable/10/sys/ddb/db_ps.c ============================================================================== --- stable/10/sys/ddb/db_ps.c Mon Oct 29 12:47:15 2018 (r339857) +++ stable/10/sys/ddb/db_ps.c Mon Oct 29 12:48:30 2018 (r339858) @@ -44,8 +44,13 @@ __FBSDID("$FreeBSD$"); #include +#define PRINT_NONE 0 +#define PRINT_ARGS 1 + static void dumpthread(volatile struct proc *p, volatile struct thread *td, int all); +static int ps_mode; + /* * At least one non-optional show-command must be implemented using * DB_SHOW_ALL_COMMAND() so that db_show_all_cmd_set gets created. @@ -56,6 +61,24 @@ DB_SHOW_ALL_COMMAND(procs, db_procs_cmd) db_ps(addr, have_addr, count, modif); } +static void +dump_args(volatile struct proc *p) +{ + char *args; + int i, len; + + if (p->p_args == NULL) + return; + args = p->p_args->ar_args; + len = (int)p->p_args->ar_length; + for (i = 0; i < len; i++) { + if (args[i] == '\0') + db_printf(" "); + else + db_printf("%c", args[i]); + } +} + /* * Layout: * - column counts @@ -84,6 +107,7 @@ db_ps(db_expr_t addr, boolean_t hasaddr, db_expr_t cou char state[9]; int np, rflag, sflag, dflag, lflag, wflag; + ps_mode = modif[0] == 'a' ? PRINT_ARGS : PRINT_NONE; np = nprocs; if (!LIST_EMPTY(&allproc)) @@ -201,6 +225,10 @@ db_ps(db_expr_t addr, boolean_t hasaddr, db_expr_t cou db_printf("%s", p->p_comm); if (p->p_flag & P_SYSTEM) db_printf("]"); + if (ps_mode == PRINT_ARGS) { + db_printf(" "); + dump_args(p); + } db_printf("\n"); } FOREACH_THREAD_IN_PROC(p, td) { @@ -293,6 +321,10 @@ dumpthread(volatile struct proc *p, volatile struct th db_printf("%s", td->td_proc->p_comm); if (p->p_flag & P_SYSTEM) db_printf("]"); + if (ps_mode == PRINT_ARGS && all == 0) { + db_printf(" "); + dump_args(p); + } db_printf("\n"); } @@ -428,12 +460,7 @@ DB_SHOW_COMMAND(proc, db_show_proc) db_printf(" ABI: %s\n", p->p_sysent->sv_name); if (p->p_args != NULL) { db_printf(" arguments: "); - for (i = 0; i < (int)p->p_args->ar_length; i++) { - if (p->p_args->ar_args[i] == '\0') - db_printf(" "); - else - db_printf("%c", p->p_args->ar_args[i]); - } + dump_args(p); db_printf("\n"); } db_printf(" threads: %d\n", p->p_numthreads); From owner-svn-src-stable@freebsd.org Mon Oct 29 13:17:42 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54C9210D7D19; Mon, 29 Oct 2018 13:17:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0711670AA7; Mon, 29 Oct 2018 13:17:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE1206E80; Mon, 29 Oct 2018 13:17:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TDHf24000638; Mon, 29 Oct 2018 13:17:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TDHf7F000637; Mon, 29 Oct 2018 13:17:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201810291317.w9TDHf7F000637@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 29 Oct 2018 13:17:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339859 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 339859 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 13:17:42 -0000 Author: hselasky Date: Mon Oct 29 13:17:41 2018 New Revision: 339859 URL: https://svnweb.freebsd.org/changeset/base/339859 Log: MFC r339588: Resolve deadlock between epoch(9) and various network interface SX-locks, during if_purgeaddrs(), by not allowing to hold the epoch read lock over typical network IOCTL code paths. This is a regression issue after r334305. Reviewed by: ae (network) Approved by: re (kib) Differential revision: https://reviews.freebsd.org/D17647 Sponsored by: Mellanox Technologies Modified: stable/12/sys/net/if.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/if.c ============================================================================== --- stable/12/sys/net/if.c Mon Oct 29 12:48:30 2018 (r339858) +++ stable/12/sys/net/if.c Mon Oct 29 13:17:41 2018 (r339859) @@ -964,12 +964,18 @@ if_attachdomain1(struct ifnet *ifp) void if_purgeaddrs(struct ifnet *ifp) { - struct ifaddr *ifa, *next; + struct ifaddr *ifa; - NET_EPOCH_ENTER(); - CK_STAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { - if (ifa->ifa_addr->sa_family == AF_LINK) - continue; + while (1) { + NET_EPOCH_ENTER(); + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family != AF_LINK) + break; + } + NET_EPOCH_EXIT(); + + if (ifa == NULL) + break; #ifdef INET /* XXX: Ugly!! ad hoc just for INET */ if (ifa->ifa_addr->sa_family == AF_INET) { @@ -996,7 +1002,6 @@ if_purgeaddrs(struct ifnet *ifp) IF_ADDR_WUNLOCK(ifp); ifa_free(ifa); } - NET_EPOCH_EXIT(); } /* From owner-svn-src-stable@freebsd.org Mon Oct 29 14:06:21 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3B5210DAC8A; Mon, 29 Oct 2018 14:06:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A88D3727F4; Mon, 29 Oct 2018 14:06:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 896BC76B2; Mon, 29 Oct 2018 14:06:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TE6K4o026281; Mon, 29 Oct 2018 14:06:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TE6K6N026280; Mon, 29 Oct 2018 14:06:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201810291406.w9TE6K6N026280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 29 Oct 2018 14:06:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339860 - stable/12/sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/sys X-SVN-Commit-Revision: 339860 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 14:06:21 -0000 Author: hselasky Date: Mon Oct 29 14:06:20 2018 New Revision: 339860 URL: https://svnweb.freebsd.org/changeset/base/339860 Log: MFC r339600: Make sure returned value is checked and assert a valid refcount. While at it fix a print: Unsigned types cannot be negative. Reviewed by: kib, mjg Approved by: re (gjb) Differential revision: https://reviews.freebsd.org/D17616 Sponsored by: Mellanox Technologies Modified: stable/12/sys/sys/refcount.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/sys/refcount.h ============================================================================== --- stable/12/sys/sys/refcount.h Mon Oct 29 13:17:41 2018 (r339859) +++ stable/12/sys/sys/refcount.h Mon Oct 29 14:06:20 2018 (r339860) @@ -62,7 +62,7 @@ refcount_release(volatile u_int *count) atomic_thread_fence_rel(); old = atomic_fetchadd_int(count, -1); - KASSERT(old > 0, ("negative refcount %p", count)); + KASSERT(old > 0, ("refcount %p is zero", count)); if (old > 1) return (0); @@ -77,15 +77,19 @@ refcount_release(volatile u_int *count) } /* + * This functions returns non-zero if the refcount was + * incremented. Else zero is returned. + * * A temporary hack until refcount_* APIs are sorted out. */ -static __inline int +static __inline __result_use_check int refcount_acquire_if_not_zero(volatile u_int *count) { u_int old; old = *count; for (;;) { + KASSERT(old < UINT_MAX, ("refcount %p overflowed", count)); if (old == 0) return (0); if (atomic_fcmpset_int(count, &old, old + 1)) @@ -93,13 +97,14 @@ refcount_acquire_if_not_zero(volatile u_int *count) } } -static __inline int +static __inline __result_use_check int refcount_release_if_not_last(volatile u_int *count) { u_int old; old = *count; for (;;) { + KASSERT(old > 0, ("refcount %p is zero", count)); if (old == 1) return (0); if (atomic_fcmpset_int(count, &old, old - 1)) From owner-svn-src-stable@freebsd.org Mon Oct 29 14:37:28 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2630310DB6ED; Mon, 29 Oct 2018 14:37:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CDEB573803; Mon, 29 Oct 2018 14:37:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE82C7B92; Mon, 29 Oct 2018 14:37:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TEbRoV041469; Mon, 29 Oct 2018 14:37:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TEbRH1041468; Mon, 29 Oct 2018 14:37:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201810291437.w9TEbRH1041468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 29 Oct 2018 14:37:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339862 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 339862 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 14:37:28 -0000 Author: hselasky Date: Mon Oct 29 14:37:27 2018 New Revision: 339862 URL: https://svnweb.freebsd.org/changeset/base/339862 Log: MFC r339600: Make sure returned value is checked and assert a valid refcount. While at it fix a print: Unsigned types cannot be negative. Reviewed by: kib, mjg Differential revision: https://reviews.freebsd.org/D17616 Sponsored by: Mellanox Technologies Modified: stable/11/sys/sys/refcount.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/refcount.h ============================================================================== --- stable/11/sys/sys/refcount.h Mon Oct 29 14:36:03 2018 (r339861) +++ stable/11/sys/sys/refcount.h Mon Oct 29 14:37:27 2018 (r339862) @@ -60,7 +60,7 @@ refcount_release(volatile u_int *count) atomic_thread_fence_rel(); old = atomic_fetchadd_int(count, -1); - KASSERT(old > 0, ("negative refcount %p", count)); + KASSERT(old > 0, ("refcount %p is zero", count)); if (old > 1) return (0); @@ -75,15 +75,19 @@ refcount_release(volatile u_int *count) } /* + * This functions returns non-zero if the refcount was + * incremented. Else zero is returned. + * * A temporary hack until refcount_* APIs are sorted out. */ -static __inline int +static __inline __result_use_check int refcount_acquire_if_not_zero(volatile u_int *count) { u_int old; old = *count; for (;;) { + KASSERT(old < UINT_MAX, ("refcount %p overflowed", count)); if (old == 0) return (0); if (atomic_fcmpset_int(count, &old, old + 1)) @@ -91,13 +95,14 @@ refcount_acquire_if_not_zero(volatile u_int *count) } } -static __inline int +static __inline __result_use_check int refcount_release_if_not_last(volatile u_int *count) { u_int old; old = *count; for (;;) { + KASSERT(old > 0, ("refcount %p is zero", count)); if (old == 1) return (0); if (atomic_fcmpset_int(count, &old, old - 1)) From owner-svn-src-stable@freebsd.org Mon Oct 29 15:12:16 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94F2810DCF0F; Mon, 29 Oct 2018 15:12:16 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48FEB74FB0; Mon, 29 Oct 2018 15:12:16 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 2AABF1020D; Mon, 29 Oct 2018 15:12:16 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TFCGSO061868; Mon, 29 Oct 2018 15:12:16 GMT (envelope-from whu@FreeBSD.org) Received: (from whu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TFCGPF061867; Mon, 29 Oct 2018 15:12:16 GMT (envelope-from whu@FreeBSD.org) Message-Id: <201810291512.w9TFCGPF061867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: whu set sender to whu@FreeBSD.org using -f From: Wei Hu Date: Mon, 29 Oct 2018 15:12:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339863 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 X-SVN-Commit-Author: whu X-SVN-Commit-Paths: stable/11/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 339863 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 15:12:16 -0000 Author: whu Date: Mon Oct 29 15:12:15 2018 New Revision: 339863 URL: https://svnweb.freebsd.org/changeset/base/339863 Log: MFC: 339585 r339585: Do not drop UDP traffic when TXCSUM_IPV6 flag is on PR: 231797 Submitted by: whu Reviewed by: dexuan Obtained from: Kevin Morse Sponsored by: Microsoft Differential Revision: https://bugs.freebsd.org/bugzilla/attachment.cgi?id=198333&action=diff Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hn.c Mon Oct 29 14:37:27 2018 (r339862) +++ stable/11/sys/dev/hyperv/netvsc/if_hn.c Mon Oct 29 15:12:15 2018 (r339863) @@ -861,7 +861,8 @@ hn_set_hlen(struct mbuf *m_head) PULLUP_HDR(m_head, ehlen + sizeof(*ip6)); ip6 = mtodo(m_head, ehlen); - if (ip6->ip6_nxt != IPPROTO_TCP) { + if (ip6->ip6_nxt != IPPROTO_TCP && + ip6->ip6_nxt != IPPROTO_UDP) { m_freem(m_head); return (NULL); } From owner-svn-src-stable@freebsd.org Mon Oct 29 19:01:49 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0660510E31C1; Mon, 29 Oct 2018 19:01:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AD3877D9B5; Mon, 29 Oct 2018 19:01:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 7404A12763; Mon, 29 Oct 2018 19:01:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TJ1mGp076815; Mon, 29 Oct 2018 19:01:48 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TJ1mxT076814; Mon, 29 Oct 2018 19:01:48 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201810291901.w9TJ1mxT076814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 29 Oct 2018 19:01:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339867 - in stable/12: share/man/man4 sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/netinet X-SVN-Commit-Revision: 339867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 19:01:49 -0000 Author: tuexen Date: Mon Oct 29 19:01:47 2018 New Revision: 339867 URL: https://svnweb.freebsd.org/changeset/base/339867 Log: MFC r339791: Add initial descriptions for SCTP related MIB variable. This work was mostly done by Marie-Helene Kvello-Aune. Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D3583 Modified: stable/12/share/man/man4/sctp.4 stable/12/sys/netinet/sctp_sysctl.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/sctp.4 ============================================================================== --- stable/12/share/man/man4/sctp.4 Mon Oct 29 17:55:26 2018 (r339866) +++ stable/12/share/man/man4/sctp.4 Mon Oct 29 19:01:47 2018 (r339867) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 15, 2006 +.Dd October 10, 2018 .Dt SCTP 4 .Os .Sh NAME @@ -145,7 +145,7 @@ with no regard to the ordering of any other message. The FreeBSD implementation of .Tn SCTP also supports the following extensions: -.Bl -hang -width indent +.Bl -tag -width "sctp partial reliability" .It "sctp partial reliability" This extension allows one to have message be skipped and not delivered based on some user specified parameters. @@ -168,7 +168,7 @@ utilization. This extension allows a user on either side to reset the stream sequence numbers used by any or all streams. .El -.Pp +.Ss Socket Options .Tn SCTP supports a number of socket options which can be set with .Xr setsockopt 2 @@ -176,7 +176,7 @@ and tested with .Xr getsockopt 2 or .Xr sctp_opt_info 3 : -.Bl -tag -width ".Dv SCTP_SET_PEER_PRIMARY_ADDR" +.Bl -tag -indent .It Dv SCTP_NODELAY Under most circumstances, .Tn SCTP @@ -409,6 +409,191 @@ Note that the peer endpoint must also support the stream reset extension as well. .El +.Ss MIB Variables +The +.Tn SCTP +protocol implements a number of variables in the +.Va net.inet.sctp +branch of the +.Xr sysctl 3 +MIB. +.Bl -ohang +.It Sy Congestion Control +.Bl -tag -width indent +.It Va default_cc_module +Default congestion control module. +Default value is 0. +The minimum is 0, and the maximum is 3. +A value of 0 enables the default congestion control algorithm. +A value of 1 enables the High Speed congestion control algorithm. +A value of 2 enables the HTCP congestion control algorithm. +A value of 3 enables the data center congestion control (DCCC) algorithm. +.It Va initial_cwnd +Defines the initial congestion window size in MTUs. +.It Va cwnd_maxburst +Use congestion control instead of 'blind' logic to limit maximum burst when sending. +Default value is 1. May be set to 0 or 1. +.It Va ecn_enable +Enable Explicit Congestion Notification (ECN). +Default value is 1. May be set to 0 or 1. +.It Va rttvar_steady_step +Number of identical bandwidth measurements DCCC takes to try step down the congestion window. +Default value is 20. +The minimum is 0, and the maximum is 65535. +.It Va rttvar_eqret +Whether DCCC reduces the congestion window size when round-trip time and bandwidth remain unchanged. +Default value is 0. +May be set to 0 or 1. +.It Va rttvar_bw +Shift amount DCCC uses for bandwidth smoothing on round-trip-time calculation. +Default value is 4. +The minimum is 0, and the maximum is 32. +.It Va rttvar_rtt +Shift amount DCCC uses for round-trip-time smoothing on round-trip-time calculation. +Default value is 5. +The minimum is 0, and the maximum is 32. +.It Va use_dcccecn +Enable ECN when using DCCC. +Default value is 1. +May be set to 0 or 1. +.El +.It Sy Misc +.Bl -tag -width indent +.It Va getcred +Get the ucred of a SCTP connection. +.It Va assoclist +List of active SCTP associations. +.It Va stats +SCTP statistics (struct sctp_stat). +.It Va diag_info_code +Diagnostic information error cause code. +.It Va blackhole +Enable SCTP blackholing. +See +.Xr blackhole 4 +for more details. +.It Va buffer_splitting +Enable send/receive buffer splitting. +.It Va vtag_time_wait +Vtag wait time in seconds, 0 to disable. +.It Va nat_friendly_init +Enable sending of the NAT-friendly SCTP option on INITs. +.It Va enable_sack_immediately +Enable sending of the SACK-IMMEDIATELY bit. +.It Va udp_tunneling_port +Set the SCTP/UDP tunneling port. +.It Va mobility_fasthandoff +Enable SCTP fast handoff. +.It Va mobility_base +Enable SCTP base mobility +.It Va default_frag_interleave +Default fragment interleave level. +.It Va default_ss_module +Default stream scheduling module. +.It Va log_level +Ltrace/KTR trace logging level. +.It Va max_retran_chunk +Number of retransmissions of a DATA chunk before an association is aborted. +.It Va min_residual +Minimum residual data chunk in second part of split. +.It Va strict_data_order +Enforce strict data ordering, abort if control inside data. +.It Va abort_at_limit +Abort when one-to-one hits qlimit. +.It Va hb_max_burst +Confirmation heartbeat max burst. +.It Va do_sctp_drain +Flush chunks in receive queues with TSN higher than the cumulative TSN if the +system is low on mbufs. +.It Va max_chained_mbufs +Default max number of small mbufs on a chain. +.It Va abc_l_var +SCTP ABC max increase per SACK (L). +.It Va nat_friendly +SCTP NAT friendly operation. +.It Va cmt_use_dac +CMT DAC on/off flag. +.It Va cmt_on_off +CMT settings. +.It Va outgoing_streams +Default number of outgoing streams. +.It Va incoming_streams +Default number of incoming streams. +.It Va add_more_on_output +When space-wise is it worthwhile to try to add more to a socket send buffer. +.It Va path_pf_threshold +Default potentially failed threshold. +.It Va path_rtx_max +Default maximum of retransmissions per path. +.It Va assoc_rtx_max +Default maximum number of retransmissions per association. +.It Va init_rtx_max +Default maximum number of retransmissions for INIT chunks. +.It Va valid_cookie_life +Default cookie lifetime in seconds. +.It Va init_rto_max +Default maximum retransmission timeout during association setup in ms. +.It Va rto_initial +Default initial retransmission timeout in ms. +.It Va rto_min +Default minimum retransmission timeout in ms. +.It Va rto_max +Default maximum retransmission timeout in ms. +.It Va secret_lifetime +Default secret lifetime in seconds. +.It Va shutdown_guard_time +Shutdown guard timer in seconds (0 means 5 times RTO.Max). +.It Va pmtu_raise_time +Default PMTU raise timer in seconds. +.It Va heartbeat_interval +Default heartbeat interval in ms. +.It Va asoc_resource +Max number of cached resources in an association. +.It Va sys_resource +Max number of cached resources in the system. +.It Va sack_freq +Default SACK frequency. +.It Va delayed_sack_time +Default delayed SACK timer in ms. +.It Va chunkscale +Tunable for scaling of number of chunks and messages. +.It Va min_split_point +Minimum size when splitting a chunk. +.It Va pcbhashsize +Tunable for PCB hash table sizes. +.It Va tcbhashsize +Tunable for TCB hash table sizes. +.It Va maxchunks +Default max chunks on queue per association. +.It Va fr_maxburst +Default max burst for SCTP endpoints when fast retransmitting. +.It Va maxburst +Default max burst for SCTP endpoints. +.It Va peer_chkoh +Amount to debit peers rwnd per chunk sent. +.It Va strict_sacks +Enable SCTP Strict SACK checking. +.It Va pktdrop_enable +Enable SCTP PKTDROP. +.It Va nrsack_enable +Enable SCTP NR-SACK. +.It Va reconfig_enable +Enable SCTP RE-CONFIG. +.It Va asconf_enable +Enable SCTP ASCONF. +.It Va auth_enable +Enable SCTP AUTH. +.It Va pr_enable +Enable PR-SCTP. +.It Va auto_asconf +Enable SCTP Auto-ASCONF. +.It Va recvspace +Maximum incoming SCTP buffer size. +.It Va sendspace +Maximum outgoing SCTP buffer size. +.El +.El + .Sh SEE ALSO .Xr accept 2 , .Xr bind 2 , @@ -418,4 +603,5 @@ as well. .Xr sctp_connectx 3 , .Xr sctp_opt_info 3 , .Xr sctp_recvmsg 3 , -.Xr sctp_sendmsg 3 +.Xr sctp_sendmsg 3 , +.Xr blackhole 4 Modified: stable/12/sys/netinet/sctp_sysctl.h ============================================================================== --- stable/12/sys/netinet/sctp_sysctl.h Mon Oct 29 17:55:26 2018 (r339866) +++ stable/12/sys/netinet/sctp_sysctl.h Mon Oct 29 19:01:47 2018 (r339867) @@ -212,7 +212,7 @@ struct sctp_sysctl { #define SCTPCTL_MAXBURST_DEFAULT SCTP_DEF_MAX_BURST /* fr_maxburst: Default max burst for sctp endpoints when fast retransmitting */ -#define SCTPCTL_FRMAXBURST_DESC "Default fr max burst for sctp endpoints" +#define SCTPCTL_FRMAXBURST_DESC "Default max burst for SCTP endpoints when fast retransmitting" #define SCTPCTL_FRMAXBURST_MIN 0 #define SCTPCTL_FRMAXBURST_MAX 0xFFFFFFFF #define SCTPCTL_FRMAXBURST_DEFAULT SCTP_DEF_FRMAX_BURST @@ -243,7 +243,7 @@ struct sctp_sysctl { #define SCTPCTL_MIN_SPLIT_POINT_DEFAULT SCTP_DEFAULT_SPLIT_POINT_MIN /* chunkscale: Tunable for Scaling of number of chunks and messages */ -#define SCTPCTL_CHUNKSCALE_DESC "Tunable for Scaling of number of chunks and messages" +#define SCTPCTL_CHUNKSCALE_DESC "Tunable for scaling of number of chunks and messages" #define SCTPCTL_CHUNKSCALE_MIN 1 #define SCTPCTL_CHUNKSCALE_MAX 0xFFFFFFFF #define SCTPCTL_CHUNKSCALE_DEFAULT SCTP_CHUNKQUEUE_SCALE @@ -327,7 +327,7 @@ struct sctp_sysctl { #define SCTPCTL_VALID_COOKIE_LIFE_DEFAULT SCTP_DEFAULT_COOKIE_LIFE /* init_rtx_max: Default maximum number of retransmission for INIT chunks */ -#define SCTPCTL_INIT_RTX_MAX_DESC "Default maximum number of retransmission for INIT chunks" +#define SCTPCTL_INIT_RTX_MAX_DESC "Default maximum number of retransmissions for INIT chunks" #define SCTPCTL_INIT_RTX_MAX_MIN 0 #define SCTPCTL_INIT_RTX_MAX_MAX 0xFFFFFFFF #define SCTPCTL_INIT_RTX_MAX_DEFAULT SCTP_DEF_MAX_INIT @@ -380,8 +380,8 @@ struct sctp_sysctl { #define SCTPCTL_CMT_USE_DAC_MAX 1 #define SCTPCTL_CMT_USE_DAC_DEFAULT 0 -/* cwnd_maxburst: Use a CWND adjusting maxburst */ -#define SCTPCTL_CWND_MAXBURST_DESC "Use a CWND adjusting maxburst" +/* cwnd_maxburst: Use a CWND adjusting to implement maxburst */ +#define SCTPCTL_CWND_MAXBURST_DESC "Adjust congestion control window to limit maximum burst when sending" #define SCTPCTL_CWND_MAXBURST_MIN 0 #define SCTPCTL_CWND_MAXBURST_MAX 1 #define SCTPCTL_CWND_MAXBURST_DEFAULT 1 @@ -417,7 +417,7 @@ struct sctp_sysctl { #define SCTPCTL_HB_MAX_BURST_DEFAULT SCTP_DEF_HBMAX_BURST /* abort_at_limit: When one-2-one hits qlimit abort */ -#define SCTPCTL_ABORT_AT_LIMIT_DESC "When one-2-one hits qlimit abort" +#define SCTPCTL_ABORT_AT_LIMIT_DESC "Abort when one-to-one hits qlimit" #define SCTPCTL_ABORT_AT_LIMIT_MIN 0 #define SCTPCTL_ABORT_AT_LIMIT_MAX 1 #define SCTPCTL_ABORT_AT_LIMIT_DEFAULT 0 @@ -429,7 +429,7 @@ struct sctp_sysctl { #define SCTPCTL_MIN_RESIDUAL_DEFAULT 1452 /* max_retran_chunk: max chunk retransmissions */ -#define SCTPCTL_MAX_RETRAN_CHUNK_DESC "Maximum times an unlucky chunk can be retran'd before assoc abort" +#define SCTPCTL_MAX_RETRAN_CHUNK_DESC "Maximum times an unlucky chunk can be retransmitted before assoc abort" #define SCTPCTL_MAX_RETRAN_CHUNK_MIN 0 #define SCTPCTL_MAX_RETRAN_CHUNK_MAX 65535 #define SCTPCTL_MAX_RETRAN_CHUNK_DEFAULT 30 @@ -477,63 +477,63 @@ struct sctp_sysctl { #define SCTPCTL_UDP_TUNNELING_PORT_DEFAULT 0 /* Enable sending of the SACK-IMMEDIATELY bit */ -#define SCTPCTL_SACK_IMMEDIATELY_ENABLE_DESC "Enable sending of the SACK-IMMEDIATELY-bit." +#define SCTPCTL_SACK_IMMEDIATELY_ENABLE_DESC "Enable sending of the SACK-IMMEDIATELY-bit" #define SCTPCTL_SACK_IMMEDIATELY_ENABLE_MIN 0 #define SCTPCTL_SACK_IMMEDIATELY_ENABLE_MAX 1 #define SCTPCTL_SACK_IMMEDIATELY_ENABLE_DEFAULT SCTPCTL_SACK_IMMEDIATELY_ENABLE_MAX /* Enable sending of the NAT-FRIENDLY message */ -#define SCTPCTL_NAT_FRIENDLY_INITS_DESC "Enable sending of the nat-friendly SCTP option on INITs." +#define SCTPCTL_NAT_FRIENDLY_INITS_DESC "Enable sending of the nat-friendly SCTP option on INITs" #define SCTPCTL_NAT_FRIENDLY_INITS_MIN 0 #define SCTPCTL_NAT_FRIENDLY_INITS_MAX 1 #define SCTPCTL_NAT_FRIENDLY_INITS_DEFAULT SCTPCTL_NAT_FRIENDLY_INITS_MIN /* Vtag time wait in seconds */ -#define SCTPCTL_TIME_WAIT_DESC "Vtag time wait time in seconds, 0 disables it." +#define SCTPCTL_TIME_WAIT_DESC "Vtag time wait time in seconds, 0 disables it" #define SCTPCTL_TIME_WAIT_MIN 0 #define SCTPCTL_TIME_WAIT_MAX 0xffffffff #define SCTPCTL_TIME_WAIT_DEFAULT SCTP_TIME_WAIT /* Enable Send/Receive buffer splitting */ -#define SCTPCTL_BUFFER_SPLITTING_DESC "Enable send/receive buffer splitting." +#define SCTPCTL_BUFFER_SPLITTING_DESC "Enable send/receive buffer splitting" #define SCTPCTL_BUFFER_SPLITTING_MIN 0 #define SCTPCTL_BUFFER_SPLITTING_MAX 0x3 #define SCTPCTL_BUFFER_SPLITTING_DEFAULT SCTPCTL_BUFFER_SPLITTING_MIN -/* Initial congestion window in MTU */ -#define SCTPCTL_INITIAL_CWND_DESC "Initial congestion window in MTUs" +/* Initial congestion window in MTUs */ +#define SCTPCTL_INITIAL_CWND_DESC "Defines the initial congestion window size in MTUs" #define SCTPCTL_INITIAL_CWND_MIN 0 #define SCTPCTL_INITIAL_CWND_MAX 0xffffffff #define SCTPCTL_INITIAL_CWND_DEFAULT 3 /* rttvar smooth avg for bw calc */ -#define SCTPCTL_RTTVAR_BW_DESC "Shift amount for bw smoothing on rtt calc" +#define SCTPCTL_RTTVAR_BW_DESC "Shift amount DCCC uses for bw smoothing on rtt calc" #define SCTPCTL_RTTVAR_BW_MIN 0 #define SCTPCTL_RTTVAR_BW_MAX 32 #define SCTPCTL_RTTVAR_BW_DEFAULT 4 /* rttvar smooth avg for bw calc */ -#define SCTPCTL_RTTVAR_RTT_DESC "Shift amount for rtt smoothing on rtt calc" +#define SCTPCTL_RTTVAR_RTT_DESC "Shift amount DCCC uses for rtt smoothing on rtt calc" #define SCTPCTL_RTTVAR_RTT_MIN 0 #define SCTPCTL_RTTVAR_RTT_MAX 32 #define SCTPCTL_RTTVAR_RTT_DEFAULT 5 -#define SCTPCTL_RTTVAR_EQRET_DESC "What to return when rtt and bw are unchanged" +#define SCTPCTL_RTTVAR_EQRET_DESC "Whether DCCC increases cwnd when the rtt and bw are unchanged" #define SCTPCTL_RTTVAR_EQRET_MIN 0 #define SCTPCTL_RTTVAR_EQRET_MAX 1 #define SCTPCTL_RTTVAR_EQRET_DEFAULT 0 -#define SCTPCTL_RTTVAR_STEADYS_DESC "How many the sames it takes to try step down of cwnd" +#define SCTPCTL_RTTVAR_STEADYS_DESC "Number of identical bw measurements DCCC takes to try step down of cwnd" #define SCTPCTL_RTTVAR_STEADYS_MIN 0 #define SCTPCTL_RTTVAR_STEADYS_MAX 0xFFFF #define SCTPCTL_RTTVAR_STEADYS_DEFAULT 20 /* 0 means disable feature */ -#define SCTPCTL_RTTVAR_DCCCECN_DESC "Enable for RTCC CC datacenter ECN" +#define SCTPCTL_RTTVAR_DCCCECN_DESC "Enable ECN for DCCC." #define SCTPCTL_RTTVAR_DCCCECN_MIN 0 #define SCTPCTL_RTTVAR_DCCCECN_MAX 1 #define SCTPCTL_RTTVAR_DCCCECN_DEFAULT 1 /* 0 means disable feature */ -#define SCTPCTL_BLACKHOLE_DESC "Enable SCTP blackholing. See blackhole(4) for more details." +#define SCTPCTL_BLACKHOLE_DESC "Enable SCTP blackholing, see blackhole(4) for more details" #define SCTPCTL_BLACKHOLE_MIN 0 #define SCTPCTL_BLACKHOLE_MAX 2 #define SCTPCTL_BLACKHOLE_DEFAULT SCTPCTL_BLACKHOLE_MIN @@ -553,7 +553,7 @@ struct sctp_sysctl { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) -#define SCTPCTL_OUTPUT_UNLOCKED_DESC "Unlock socket when sending packets down to IP." +#define SCTPCTL_OUTPUT_UNLOCKED_DESC "Unlock socket when sending packets down to IP" #define SCTPCTL_OUTPUT_UNLOCKED_MIN 0 #define SCTPCTL_OUTPUT_UNLOCKED_MAX 1 #define SCTPCTL_OUTPUT_UNLOCKED_DEFAULT SCTPCTL_OUTPUT_UNLOCKED_MIN From owner-svn-src-stable@freebsd.org Mon Oct 29 20:08:20 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 261C210E8C0D; Mon, 29 Oct 2018 20:08:20 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CDB7280659; Mon, 29 Oct 2018 20:08:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 A37731311D; Mon, 29 Oct 2018 20:08:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TK8JdN011273; Mon, 29 Oct 2018 20:08:19 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TK8JxU011272; Mon, 29 Oct 2018 20:08:19 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201810292008.w9TK8JxU011272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 29 Oct 2018 20:08:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339871 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 339871 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 20:08:20 -0000 Author: tuexen Date: Mon Oct 29 20:08:19 2018 New Revision: 339871 URL: https://svnweb.freebsd.org/changeset/base/339871 Log: MFC r339869,r339870: Remove empty line. Reported by: gjb@ Approved by: re (gjb@) Modified: stable/12/share/man/man4/sctp.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/sctp.4 ============================================================================== --- stable/12/share/man/man4/sctp.4 Mon Oct 29 19:25:30 2018 (r339870) +++ stable/12/share/man/man4/sctp.4 Mon Oct 29 20:08:19 2018 (r339871) @@ -593,7 +593,6 @@ Maximum incoming SCTP buffer size. Maximum outgoing SCTP buffer size. .El .El - .Sh SEE ALSO .Xr accept 2 , .Xr bind 2 , From owner-svn-src-stable@freebsd.org Mon Oct 29 20:21:12 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A37C10E8FDB; Mon, 29 Oct 2018 20:21:12 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C37AF80CE0; Mon, 29 Oct 2018 20:21:11 +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 8BD60133EB; Mon, 29 Oct 2018 20:21:11 +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 w9TKLBCK020441; Mon, 29 Oct 2018 20:21:11 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TKLBps020439; Mon, 29 Oct 2018 20:21:11 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201810292021.w9TKLBps020439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 29 Oct 2018 20:21:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339872 - in stable/11/sys: amd64/include i386/include x86/include X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/11/sys: amd64/include i386/include x86/include X-SVN-Commit-Revision: 339872 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 20:21:12 -0000 Author: jhb Date: Mon Oct 29 20:21:10 2018 New Revision: 339872 URL: https://svnweb.freebsd.org/changeset/base/339872 Log: MFC 338101: Merge amd64 and i386 headers. Added: stable/11/sys/x86/include/intr_machdep.h - copied, changed from r338101, head/sys/x86/include/intr_machdep.h Modified: stable/11/sys/amd64/include/intr_machdep.h stable/11/sys/i386/include/intr_machdep.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/include/intr_machdep.h ============================================================================== --- stable/11/sys/amd64/include/intr_machdep.h Mon Oct 29 20:08:19 2018 (r339871) +++ stable/11/sys/amd64/include/intr_machdep.h Mon Oct 29 20:21:10 2018 (r339872) @@ -29,112 +29,9 @@ #ifndef __MACHINE_INTR_MACHDEP_H__ #define __MACHINE_INTR_MACHDEP_H__ -#ifdef _KERNEL +#include /* - * The maximum number of I/O interrupts we allow. This number is rather - * arbitrary as it is just the maximum IRQ resource value. The interrupt - * source for a given IRQ maps that I/O interrupt to device interrupt - * source whether it be a pin on an interrupt controller or an MSI interrupt. - * The 16 ISA IRQs are assigned fixed IDT vectors, but all other device - * interrupts allocate IDT vectors on demand. Currently we have 191 IDT - * vectors available for device interrupts. On many systems with I/O APICs, - * a lot of the IRQs are not used, so this number can be much larger than - * 191 and still be safe since only interrupt sources in actual use will - * allocate IDT vectors. - * - * The first 255 IRQs (0 - 254) are reserved for ISA IRQs and PCI intline IRQs. - * IRQ values from 256 to 767 are used by MSI. When running under the Xen - * Hypervisor, IRQ values from 768 to 4863 are available for binding to - * event channel events. We leave 255 unused to avoid confusion since 255 is - * used in PCI to indicate an invalid IRQ. - */ -#define NUM_MSI_INTS 512 -#define FIRST_MSI_INT 256 -#ifdef XENHVM -#include -#include -#define NUM_EVTCHN_INTS NR_EVENT_CHANNELS -#define FIRST_EVTCHN_INT \ - (FIRST_MSI_INT + NUM_MSI_INTS) -#define LAST_EVTCHN_INT \ - (FIRST_EVTCHN_INT + NUM_EVTCHN_INTS - 1) -#else -#define NUM_EVTCHN_INTS 0 -#endif -#define NUM_IO_INTS (FIRST_MSI_INT + NUM_MSI_INTS + NUM_EVTCHN_INTS) - -/* - * Default base address for MSI messages on x86 platforms. - */ -#define MSI_INTEL_ADDR_BASE 0xfee00000 - -/* - * - 1 ??? dummy counter. - * - 2 counters for each I/O interrupt. - * - 1 counter for each CPU for lapic timer. - * - 8 counters for each CPU for IPI counters for SMP. - */ -#ifdef SMP -#define INTRCNT_COUNT (1 + NUM_IO_INTS * 2 + (1 + 8) * MAXCPU) -#else -#define INTRCNT_COUNT (1 + NUM_IO_INTS * 2 + 1) -#endif - -#ifndef LOCORE - -typedef void inthand_t(void); - -#define IDTVEC(name) __CONCAT(X,name) - -struct intsrc; - -/* - * Methods that a PIC provides to mask/unmask a given interrupt source, - * "turn on" the interrupt on the CPU side by setting up an IDT entry, and - * return the vector associated with this source. - */ -struct pic { - void (*pic_enable_source)(struct intsrc *); - void (*pic_disable_source)(struct intsrc *, int); - void (*pic_eoi_source)(struct intsrc *); - void (*pic_enable_intr)(struct intsrc *); - void (*pic_disable_intr)(struct intsrc *); - int (*pic_vector)(struct intsrc *); - int (*pic_source_pending)(struct intsrc *); - void (*pic_suspend)(struct pic *); - void (*pic_resume)(struct pic *, bool suspend_cancelled); - int (*pic_config_intr)(struct intsrc *, enum intr_trigger, - enum intr_polarity); - int (*pic_assign_cpu)(struct intsrc *, u_int apic_id); - void (*pic_reprogram_pin)(struct intsrc *); - TAILQ_ENTRY(pic) pics; -}; - -/* Flags for pic_disable_source() */ -enum { - PIC_EOI, - PIC_NO_EOI, -}; - -/* - * An interrupt source. The upper-layer code uses the PIC methods to - * control a given source. The lower-layer PIC drivers can store additional - * private data in a given interrupt source such as an interrupt pin number - * or an I/O APIC pointer. - */ -struct intsrc { - struct pic *is_pic; - struct intr_event *is_event; - u_long *is_count; - u_long *is_straycount; - u_int is_index; - u_int is_handlers; -}; - -struct trapframe; - -/* * The following data structure holds per-cpu data, and is placed just * above the top of the space used for the NMI and MC# stacks. */ @@ -143,53 +40,4 @@ struct nmi_pcpu { register_t __padding; /* pad to 16 bytes */ }; -#ifdef SMP -extern cpuset_t intr_cpus; -#endif -extern struct mtx icu_lock; -extern int elcr_found; -#ifdef SMP -extern int msix_disable_migration; -#endif - -#ifndef DEV_ATPIC -void atpic_reset(void); -#endif -/* XXX: The elcr_* prototypes probably belong somewhere else. */ -int elcr_probe(void); -enum intr_trigger elcr_read_trigger(u_int irq); -void elcr_resume(void); -void elcr_write_trigger(u_int irq, enum intr_trigger trigger); -#ifdef SMP -void intr_add_cpu(u_int cpu); -#endif -int intr_add_handler(const char *name, int vector, driver_filter_t filter, - driver_intr_t handler, void *arg, enum intr_type flags, - void **cookiep); -#ifdef SMP -int intr_bind(u_int vector, u_char cpu); -#endif -int intr_config_intr(int vector, enum intr_trigger trig, - enum intr_polarity pol); -int intr_describe(u_int vector, void *ih, const char *descr); -void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); -u_int intr_next_cpu(void); -struct intsrc *intr_lookup_source(int vector); -int intr_register_pic(struct pic *pic); -int intr_register_source(struct intsrc *isrc); -int intr_remove_handler(void *cookie); -void intr_resume(bool suspend_cancelled); -void intr_suspend(void); -void intr_reprogram(void); -void intrcnt_add(const char *name, u_long **countp); -void nexus_add_irq(u_long irq); -int msi_alloc(device_t dev, int count, int maxcount, int *irqs); -void msi_init(void); -int msi_map(int irq, uint64_t *addr, uint32_t *data); -int msi_release(int *irqs, int count); -int msix_alloc(device_t dev, int *irq); -int msix_release(int irq); - -#endif /* !LOCORE */ -#endif /* _KERNEL */ #endif /* !__MACHINE_INTR_MACHDEP_H__ */ Modified: stable/11/sys/i386/include/intr_machdep.h ============================================================================== --- stable/11/sys/i386/include/intr_machdep.h Mon Oct 29 20:08:19 2018 (r339871) +++ stable/11/sys/i386/include/intr_machdep.h Mon Oct 29 20:21:10 2018 (r339872) @@ -1,185 +1,6 @@ /*- - * Copyright (c) 2003 John Baldwin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 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$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef __MACHINE_INTR_MACHDEP_H__ -#define __MACHINE_INTR_MACHDEP_H__ - -#ifdef _KERNEL - -/* - * The maximum number of I/O interrupts we allow. This number is rather - * arbitrary as it is just the maximum IRQ resource value. The interrupt - * source for a given IRQ maps that I/O interrupt to device interrupt - * source whether it be a pin on an interrupt controller or an MSI interrupt. - * The 16 ISA IRQs are assigned fixed IDT vectors, but all other device - * interrupts allocate IDT vectors on demand. Currently we have 191 IDT - * vectors available for device interrupts. On many systems with I/O APICs, - * a lot of the IRQs are not used, so this number can be much larger than - * 191 and still be safe since only interrupt sources in actual use will - * allocate IDT vectors. - * - * The first 255 IRQs (0 - 254) are reserved for ISA IRQs and PCI intline IRQs. - * IRQ values from 256 to 767 are used by MSI. When running under the Xen - * Hypervisor, IRQ values from 768 to 4863 are available for binding to - * event channel events. We leave 255 unused to avoid confusion since 255 is - * used in PCI to indicate an invalid IRQ. - */ -#define NUM_MSI_INTS 512 -#define FIRST_MSI_INT 256 -#ifdef XENHVM -#include -#include -#define NUM_EVTCHN_INTS NR_EVENT_CHANNELS -#define FIRST_EVTCHN_INT \ - (FIRST_MSI_INT + NUM_MSI_INTS) -#define LAST_EVTCHN_INT \ - (FIRST_EVTCHN_INT + NUM_EVTCHN_INTS - 1) -#else /* !XENHVM */ -#define NUM_EVTCHN_INTS 0 -#endif -#define NUM_IO_INTS (FIRST_MSI_INT + NUM_MSI_INTS + NUM_EVTCHN_INTS) - -/* - * Default base address for MSI messages on x86 platforms. - */ -#define MSI_INTEL_ADDR_BASE 0xfee00000 - -/* - * - 1 ??? dummy counter. - * - 2 counters for each I/O interrupt. - * - 1 counter for each CPU for lapic timer. - * - 8 counters for each CPU for IPI counters for SMP. - */ -#ifdef SMP -#define INTRCNT_COUNT (1 + NUM_IO_INTS * 2 + (1 + 8) * MAXCPU) -#else -#define INTRCNT_COUNT (1 + NUM_IO_INTS * 2 + 1) -#endif - -#ifndef LOCORE - -typedef void inthand_t(void); - -#define IDTVEC(name) __CONCAT(X,name) - -struct intsrc; - -/* - * Methods that a PIC provides to mask/unmask a given interrupt source, - * "turn on" the interrupt on the CPU side by setting up an IDT entry, and - * return the vector associated with this source. - */ -struct pic { - void (*pic_enable_source)(struct intsrc *); - void (*pic_disable_source)(struct intsrc *, int); - void (*pic_eoi_source)(struct intsrc *); - void (*pic_enable_intr)(struct intsrc *); - void (*pic_disable_intr)(struct intsrc *); - int (*pic_vector)(struct intsrc *); - int (*pic_source_pending)(struct intsrc *); - void (*pic_suspend)(struct pic *); - void (*pic_resume)(struct pic *, bool suspend_cancelled); - int (*pic_config_intr)(struct intsrc *, enum intr_trigger, - enum intr_polarity); - int (*pic_assign_cpu)(struct intsrc *, u_int apic_id); - void (*pic_reprogram_pin)(struct intsrc *); - TAILQ_ENTRY(pic) pics; -}; - -/* Flags for pic_disable_source() */ -enum { - PIC_EOI, - PIC_NO_EOI, -}; - -/* - * An interrupt source. The upper-layer code uses the PIC methods to - * control a given source. The lower-layer PIC drivers can store additional - * private data in a given interrupt source such as an interrupt pin number - * or an I/O APIC pointer. - */ -struct intsrc { - struct pic *is_pic; - struct intr_event *is_event; - u_long *is_count; - u_long *is_straycount; - u_int is_index; - u_int is_handlers; -}; - -struct trapframe; - -#ifdef SMP -extern cpuset_t intr_cpus; -#endif -extern struct mtx icu_lock; -extern int elcr_found; -#ifdef SMP -extern int msix_disable_migration; -#endif - -#ifndef DEV_ATPIC -void atpic_reset(void); -#endif -/* XXX: The elcr_* prototypes probably belong somewhere else. */ -int elcr_probe(void); -enum intr_trigger elcr_read_trigger(u_int irq); -void elcr_resume(void); -void elcr_write_trigger(u_int irq, enum intr_trigger trigger); -#ifdef SMP -void intr_add_cpu(u_int cpu); -#endif -int intr_add_handler(const char *name, int vector, driver_filter_t filter, - driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep); -#ifdef SMP -int intr_bind(u_int vector, u_char cpu); -#endif -int intr_config_intr(int vector, enum intr_trigger trig, - enum intr_polarity pol); -int intr_describe(u_int vector, void *ih, const char *descr); -void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); -u_int intr_next_cpu(void); -struct intsrc *intr_lookup_source(int vector); -int intr_register_pic(struct pic *pic); -int intr_register_source(struct intsrc *isrc); -int intr_remove_handler(void *cookie); -void intr_resume(bool suspend_cancelled); -void intr_suspend(void); -void intr_reprogram(void); -void intrcnt_add(const char *name, u_long **countp); -void nexus_add_irq(u_long irq); -int msi_alloc(device_t dev, int count, int maxcount, int *irqs); -void msi_init(void); -int msi_map(int irq, uint64_t *addr, uint32_t *data); -int msi_release(int* irqs, int count); -int msix_alloc(device_t dev, int *irq); -int msix_release(int irq); - -#endif /* !LOCORE */ -#endif /* _KERNEL */ -#endif /* !__MACHINE_INTR_MACHDEP_H__ */ +#include Copied and modified: stable/11/sys/x86/include/intr_machdep.h (from r338101, head/sys/x86/include/intr_machdep.h) ============================================================================== --- head/sys/x86/include/intr_machdep.h Mon Aug 20 12:31:39 2018 (r338101, copy source) +++ stable/11/sys/x86/include/intr_machdep.h Mon Oct 29 20:21:10 2018 (r339872) @@ -1,6 +1,4 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * * Copyright (c) 2003 John Baldwin * All rights reserved. * @@ -132,8 +130,6 @@ struct intsrc { u_long *is_straycount; u_int is_index; u_int is_handlers; - u_int is_domain; - u_int is_cpu; }; struct trapframe; @@ -158,9 +154,9 @@ void elcr_write_trigger(u_int irq, enum intr_trigger t #ifdef SMP void intr_add_cpu(u_int cpu); #endif -int intr_add_handler(const char *name, int vector, driver_filter_t filter, - driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep, - int domain); +int intr_add_handler(const char *name, int vector, driver_filter_t filter, + driver_intr_t handler, void *arg, enum intr_type flags, + void **cookiep); #ifdef SMP int intr_bind(u_int vector, u_char cpu); #endif @@ -168,7 +164,7 @@ int intr_config_intr(int vector, enum intr_trigger tri enum intr_polarity pol); int intr_describe(u_int vector, void *ih, const char *descr); void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); -u_int intr_next_cpu(int domain); +u_int intr_next_cpu(void); struct intsrc *intr_lookup_source(int vector); int intr_register_pic(struct pic *pic); int intr_register_source(struct intsrc *isrc); From owner-svn-src-stable@freebsd.org Mon Oct 29 21:00:17 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C84110E9DCE; Mon, 29 Oct 2018 21:00:17 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49701829AC; Mon, 29 Oct 2018 21:00:17 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 2083513931; Mon, 29 Oct 2018 21:00:17 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TL0G18036955; Mon, 29 Oct 2018 21:00:16 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TL0GVK036953; Mon, 29 Oct 2018 21:00:16 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201810292100.w9TL0GVK036953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Mon, 29 Oct 2018 21:00:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339874 - stable/11/sys/dev/bxe X-SVN-Group: stable-11 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/11/sys/dev/bxe X-SVN-Commit-Revision: 339874 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 21:00:17 -0000 Author: davidcs Date: Mon Oct 29 21:00:16 2018 New Revision: 339874 URL: https://svnweb.freebsd.org/changeset/base/339874 Log: MFC r338734 Fixed isses: State check before enqueuing transmit task in bxe_link_attn() routine. State check before invoking bxe_nic_unload in bxe_shutdown(). Submitted by:Vaishali.Kulkarni@cavium.com Modified: stable/11/sys/dev/bxe/bxe.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/bxe/bxe.c ============================================================================== --- stable/11/sys/dev/bxe/bxe.c Mon Oct 29 20:53:05 2018 (r339873) +++ stable/11/sys/dev/bxe/bxe.c Mon Oct 29 21:00:16 2018 (r339874) @@ -7072,13 +7072,13 @@ bxe_link_attn(struct bxe_softc *sc) if (sc->state == BXE_STATE_OPEN) { bxe_stats_handle(sc, STATS_EVENT_LINK_UP); + /* Restart tx when the link comes back. */ + FOR_EACH_ETH_QUEUE(sc, i) { + fp = &sc->fp[i]; + taskqueue_enqueue(fp->tq, &fp->tx_task); + } } - /* Restart tx when the link comes back. */ - FOR_EACH_ETH_QUEUE(sc, i) { - fp = &sc->fp[i]; - taskqueue_enqueue(fp->tq, &fp->tx_task); - } } if (sc->link_vars.link_up && sc->link_vars.line_speed) { @@ -16272,9 +16272,11 @@ bxe_shutdown(device_t dev) /* stop the periodic callout */ bxe_periodic_stop(sc); - BXE_CORE_LOCK(sc); - bxe_nic_unload(sc, UNLOAD_NORMAL, FALSE); - BXE_CORE_UNLOCK(sc); + if (sc->state != BXE_STATE_CLOSED) { + BXE_CORE_LOCK(sc); + bxe_nic_unload(sc, UNLOAD_NORMAL, FALSE); + BXE_CORE_UNLOCK(sc); + } return (0); } From owner-svn-src-stable@freebsd.org Mon Oct 29 21:09:41 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B8CF10EA35D; Mon, 29 Oct 2018 21:09:41 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 122638365B; Mon, 29 Oct 2018 21:09:41 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E729413AFE; Mon, 29 Oct 2018 21:09:40 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TL9e38042256; Mon, 29 Oct 2018 21:09:40 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TL9emL042251; Mon, 29 Oct 2018 21:09:40 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201810292109.w9TL9emL042251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Mon, 29 Oct 2018 21:09:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339881 - stable/11/sys/dev/bxe X-SVN-Group: stable-11 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/11/sys/dev/bxe X-SVN-Commit-Revision: 339881 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 21:09:41 -0000 Author: davidcs Date: Mon Oct 29 21:09:39 2018 New Revision: 339881 URL: https://svnweb.freebsd.org/changeset/base/339881 Log: MFC r339366 Add support for Error Recovery Submitted by:Vaishali.Kulkarni@cavium.com Modified: stable/11/sys/dev/bxe/bxe.c stable/11/sys/dev/bxe/bxe.h stable/11/sys/dev/bxe/bxe_stats.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/bxe/bxe.c ============================================================================== --- stable/11/sys/dev/bxe/bxe.c Mon Oct 29 21:08:34 2018 (r339880) +++ stable/11/sys/dev/bxe/bxe.c Mon Oct 29 21:09:39 2018 (r339881) @@ -200,6 +200,7 @@ static int bxe_attach(device_t); static int bxe_detach(device_t); static int bxe_shutdown(device_t); + /* * FreeBSD KLD module/device interface event handler method. */ @@ -701,6 +702,9 @@ static void bxe_interrupt_detach(struct bxe_softc * static void bxe_set_rx_mode(struct bxe_softc *sc); static int bxe_init_locked(struct bxe_softc *sc); static int bxe_stop_locked(struct bxe_softc *sc); +static void bxe_sp_err_timeout_task(void *arg, int pending); +void bxe_parity_recover(struct bxe_softc *sc); +void bxe_handle_error(struct bxe_softc *sc); static __noinline int bxe_nic_load(struct bxe_softc *sc, int load_mode); static __noinline int bxe_nic_unload(struct bxe_softc *sc, @@ -3482,16 +3486,12 @@ bxe_watchdog(struct bxe_softc *sc, } BLOGE(sc, "TX watchdog timeout on fp[%02d], resetting!\n", fp->index); - if(sc->trigger_grcdump) { - /* taking grcdump */ - bxe_grc_dump(sc); - } BXE_FP_TX_UNLOCK(fp); + BXE_SET_ERROR_BIT(sc, BXE_ERR_TXQ_STUCK); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); - atomic_store_rel_long(&sc->chip_tq_flags, CHIP_TQ_REINIT); - taskqueue_enqueue(sc->chip_tq, &sc->chip_tq_task); - return (-1); } @@ -4246,6 +4246,7 @@ bxe_nic_unload(struct bxe_softc *sc, struct bxe_fastpath *fp; fp = &sc->fp[i]; + fp->watchdog_timer = 0; BXE_FP_TX_LOCK(fp); BXE_FP_TX_UNLOCK(fp); } @@ -4261,20 +4262,22 @@ bxe_nic_unload(struct bxe_softc *sc, if (IS_PF(sc) && sc->recovery_state != BXE_RECOVERY_DONE && (sc->state == BXE_STATE_CLOSED || sc->state == BXE_STATE_ERROR)) { - /* - * We can get here if the driver has been unloaded - * during parity error recovery and is either waiting for a - * leader to complete or for other functions to unload and - * then ifconfig down has been issued. In this case we want to - * unload and let other functions to complete a recovery - * process. - */ - sc->recovery_state = BXE_RECOVERY_DONE; - sc->is_leader = 0; - bxe_release_leader_lock(sc); - mb(); - BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n"); + if(CHIP_PORT_MODE(sc) == CHIP_4_PORT_MODE) { + /* + * We can get here if the driver has been unloaded + * during parity error recovery and is either waiting for a + * leader to complete or for other functions to unload and + * then ifconfig down has been issued. In this case we want to + * unload and let other functions to complete a recovery + * process. + */ + sc->recovery_state = BXE_RECOVERY_DONE; + sc->is_leader = 0; + bxe_release_leader_lock(sc); + mb(); + BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n"); + } BLOGE(sc, "Can't unload in closed or error state recover_state 0x%x" " state = 0x%x\n", sc->recovery_state, sc->state); return (-1); @@ -7566,6 +7569,10 @@ bxe_parity_attn(struct bxe_softc *sc, if (print) BLOGI(sc, "\n"); + if( *global == TRUE ) { + BXE_SET_ERROR_BIT(sc, BXE_ERR_GLOBAL); + } + return (TRUE); } @@ -7580,6 +7587,9 @@ bxe_chk_parity_attn(struct bxe_softc *sc, struct attn_route attn = { {0} }; int port = SC_PORT(sc); + if(sc->state != BXE_STATE_OPEN) + return FALSE; + attn.sig[0] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_1_FUNC_0 + port*4); attn.sig[1] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_2_FUNC_0 + port*4); attn.sig[2] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_3_FUNC_0 + port*4); @@ -7606,10 +7616,12 @@ bxe_attn_int_deasserted4(struct bxe_softc *sc, uint32_t attn) { uint32_t val; + boolean_t err_flg = FALSE; if (attn & AEU_INPUTS_ATTN_BITS_PGLUE_HW_INTERRUPT) { val = REG_RD(sc, PGLUE_B_REG_PGLUE_B_INT_STS_CLR); BLOGE(sc, "PGLUE hw attention 0x%08x\n", val); + err_flg = TRUE; if (val & PGLUE_B_PGLUE_B_INT_STS_REG_ADDRESS_ERROR) BLOGE(sc, "PGLUE_B_PGLUE_B_INT_STS_REG_ADDRESS_ERROR\n"); if (val & PGLUE_B_PGLUE_B_INT_STS_REG_INCORRECT_RCV_BEHAVIOR) @@ -7633,6 +7645,7 @@ bxe_attn_int_deasserted4(struct bxe_softc *sc, if (attn & AEU_INPUTS_ATTN_BITS_ATC_HW_INTERRUPT) { val = REG_RD(sc, ATC_REG_ATC_INT_STS_CLR); BLOGE(sc, "ATC hw attention 0x%08x\n", val); + err_flg = TRUE; if (val & ATC_ATC_INT_STS_REG_ADDRESS_ERROR) BLOGE(sc, "ATC_ATC_INT_STS_REG_ADDRESS_ERROR\n"); if (val & ATC_ATC_INT_STS_REG_ATC_TCPL_TO_NOT_PEND) @@ -7652,7 +7665,14 @@ bxe_attn_int_deasserted4(struct bxe_softc *sc, BLOGE(sc, "FATAL parity attention set4 0x%08x\n", (uint32_t)(attn & (AEU_INPUTS_ATTN_BITS_PGLUE_PARITY_ERROR | AEU_INPUTS_ATTN_BITS_ATC_PARITY_ERROR))); + err_flg = TRUE; } + if (err_flg) { + BXE_SET_ERROR_BIT(sc, BXE_ERR_MISC); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + } + } static void @@ -8007,14 +8027,21 @@ bxe_attn_int_deasserted3(struct bxe_softc *sc, REG_WR(sc, MISC_REG_AEU_GENERAL_ATTN_9, 0); REG_WR(sc, MISC_REG_AEU_GENERAL_ATTN_8, 0); REG_WR(sc, MISC_REG_AEU_GENERAL_ATTN_7, 0); - bxe_panic(sc, ("MC assert!\n")); - + bxe_int_disable(sc); + BXE_SET_ERROR_BIT(sc, BXE_ERR_MC_ASSERT); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + } else if (attn & BXE_MCP_ASSERT) { BLOGE(sc, "MCP assert!\n"); REG_WR(sc, MISC_REG_AEU_GENERAL_ATTN_11, 0); - // XXX bxe_fw_dump(sc); + BXE_SET_ERROR_BIT(sc, BXE_ERR_MCP_ASSERT); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + bxe_int_disable(sc); /*avoid repetive assert alert */ + } else { BLOGE(sc, "Unknown HW assert! (attn 0x%08x)\n", attn); } @@ -8042,6 +8069,7 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, int reg_offset; uint32_t val0, mask0, val1, mask1; uint32_t val; + boolean_t err_flg = FALSE; if (attn & AEU_INPUTS_ATTN_BITS_CFC_HW_INTERRUPT) { val = REG_RD(sc, CFC_REG_CFC_INT_STS_CLR); @@ -8049,6 +8077,7 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, /* CFC error attention */ if (val & 0x2) { BLOGE(sc, "FATAL error from CFC\n"); + err_flg = TRUE; } } @@ -8058,11 +8087,13 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, /* RQ_USDMDP_FIFO_OVERFLOW */ if (val & 0x18000) { BLOGE(sc, "FATAL error from PXP\n"); + err_flg = TRUE; } if (!CHIP_IS_E1x(sc)) { val = REG_RD(sc, PXP_REG_PXP_INT_STS_CLR_1); BLOGE(sc, "PXP hw attention-1 0x%08x\n", val); + err_flg = TRUE; } } @@ -8099,6 +8130,7 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, */ if (val0 & PXP2_EOP_ERROR_BIT) { BLOGE(sc, "PXP2_WR_PGLUE_EOP_ERROR\n"); + err_flg = TRUE; /* * if only PXP2_PXP2_INT_STS_0_REG_WR_PGLUE_EOP_ERROR is @@ -8121,8 +8153,15 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, BLOGE(sc, "FATAL HW block attention set2 0x%x\n", (uint32_t)(attn & HW_INTERRUT_ASSERT_SET_2)); + err_flg = TRUE; bxe_panic(sc, ("HW block attention set2\n")); } + if(err_flg) { + BXE_SET_ERROR_BIT(sc, BXE_ERR_GLOBAL); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + } + } static void @@ -8132,6 +8171,7 @@ bxe_attn_int_deasserted1(struct bxe_softc *sc, int port = SC_PORT(sc); int reg_offset; uint32_t val; + boolean_t err_flg = FALSE; if (attn & AEU_INPUTS_ATTN_BITS_DOORBELLQ_HW_INTERRUPT) { val = REG_RD(sc, DORQ_REG_DORQ_INT_STS_CLR); @@ -8139,6 +8179,7 @@ bxe_attn_int_deasserted1(struct bxe_softc *sc, /* DORQ discard attention */ if (val & 0x2) { BLOGE(sc, "FATAL error from DORQ\n"); + err_flg = TRUE; } } @@ -8152,8 +8193,15 @@ bxe_attn_int_deasserted1(struct bxe_softc *sc, BLOGE(sc, "FATAL HW block attention set1 0x%08x\n", (uint32_t)(attn & HW_INTERRUT_ASSERT_SET_1)); + err_flg = TRUE; bxe_panic(sc, ("HW block attention set1\n")); } + if(err_flg) { + BXE_SET_ERROR_BIT(sc, BXE_ERR_MISC); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + } + } static void @@ -8190,6 +8238,11 @@ bxe_attn_int_deasserted0(struct bxe_softc *sc, val &= ~(attn & HW_INTERRUT_ASSERT_SET_0); REG_WR(sc, reg_offset, val); + + BXE_SET_ERROR_BIT(sc, BXE_ERR_MISC); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + bxe_panic(sc, ("FATAL HW block attention set0 0x%lx\n", (attn & HW_INTERRUT_ASSERT_SET_0))); } @@ -8219,10 +8272,12 @@ bxe_attn_int_deasserted(struct bxe_softc *sc, * In case of parity errors don't handle attentions so that * other function would "see" parity errors. */ - sc->recovery_state = BXE_RECOVERY_INIT; // XXX schedule a recovery task... /* disable HW interrupts */ bxe_int_disable(sc); + BXE_SET_ERROR_BIT(sc, BXE_ERR_PARITY); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); bxe_release_alr(sc); return; } @@ -12352,6 +12407,259 @@ bxe_periodic_stop(struct bxe_softc *sc) callout_drain(&sc->periodic_callout); } +void +bxe_parity_recover(struct bxe_softc *sc) +{ + uint8_t global = FALSE; + uint32_t error_recovered, error_unrecovered; + bool is_parity; + + + if ((sc->recovery_state == BXE_RECOVERY_FAILED) && + (sc->state == BXE_STATE_ERROR)) { + BLOGE(sc, "RECOVERY failed, " + "stack notified driver is NOT running! " + "Please reboot/power cycle the system.\n"); + return; + } + + while (1) { + BLOGD(sc, DBG_SP, + "%s sc=%p state=0x%x rec_state=0x%x error_status=%x\n", + __func__, sc, sc->state, sc->recovery_state, sc->error_status); + + switch(sc->recovery_state) { + + case BXE_RECOVERY_INIT: + is_parity = bxe_chk_parity_attn(sc, &global, FALSE); + + if ((CHIP_PORT_MODE(sc) == CHIP_4_PORT_MODE) || + (sc->error_status & BXE_ERR_MCP_ASSERT) || + (sc->error_status & BXE_ERR_GLOBAL)) { + + BXE_CORE_LOCK(sc); + if (if_getdrvflags(sc->ifp) & IFF_DRV_RUNNING) { + bxe_periodic_stop(sc); + } + bxe_nic_unload(sc, UNLOAD_RECOVERY, false); + sc->state = BXE_STATE_ERROR; + sc->recovery_state = BXE_RECOVERY_FAILED; + BLOGE(sc, " No Recovery tried for error 0x%x" + " stack notified driver is NOT running!" + " Please reboot/power cycle the system.\n", + sc->error_status); + BXE_CORE_UNLOCK(sc); + return; + } + + + /* Try to get a LEADER_LOCK HW lock */ + if (bxe_trylock_leader_lock(sc)) { + + bxe_set_reset_in_progress(sc); + /* + * Check if there is a global attention and if + * there was a global attention, set the global + * reset bit. + */ + if (global) { + bxe_set_reset_global(sc); + } + sc->is_leader = 1; + } + + /* If interface has been removed - break */ + + if (if_getdrvflags(sc->ifp) & IFF_DRV_RUNNING) { + bxe_periodic_stop(sc); + } + + BXE_CORE_LOCK(sc); + bxe_nic_unload(sc,UNLOAD_RECOVERY, false); + sc->recovery_state = BXE_RECOVERY_WAIT; + BXE_CORE_UNLOCK(sc); + + /* + * Ensure "is_leader", MCP command sequence and + * "recovery_state" update values are seen on other + * CPUs. + */ + mb(); + break; + case BXE_RECOVERY_WAIT: + + if (sc->is_leader) { + int other_engine = SC_PATH(sc) ? 0 : 1; + bool other_load_status = + bxe_get_load_status(sc, other_engine); + bool load_status = + bxe_get_load_status(sc, SC_PATH(sc)); + global = bxe_reset_is_global(sc); + + /* + * In case of a parity in a global block, let + * the first leader that performs a + * leader_reset() reset the global blocks in + * order to clear global attentions. Otherwise + * the gates will remain closed for that + * engine. + */ + if (load_status || + (global && other_load_status)) { + /* + * Wait until all other functions get + * down. + */ + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + return; + } else { + /* + * If all other functions got down + * try to bring the chip back to + * normal. In any case it's an exit + * point for a leader. + */ + if (bxe_leader_reset(sc)) { + BLOGE(sc, "RECOVERY failed, " + "stack notified driver is NOT running!\n"); + sc->recovery_state = BXE_RECOVERY_FAILED; + sc->state = BXE_STATE_ERROR; + mb(); + return; + } + + /* + * If we are here, means that the + * leader has succeeded and doesn't + * want to be a leader any more. Try + * to continue as a none-leader. + */ + break; + } + + } else { /* non-leader */ + if (!bxe_reset_is_done(sc, SC_PATH(sc))) { + /* + * Try to get a LEADER_LOCK HW lock as + * long as a former leader may have + * been unloaded by the user or + * released a leadership by another + * reason. + */ + if (bxe_trylock_leader_lock(sc)) { + /* + * I'm a leader now! Restart a + * switch case. + */ + sc->is_leader = 1; + break; + } + + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + return; + + } else { + /* + * If there was a global attention, wait + * for it to be cleared. + */ + if (bxe_reset_is_global(sc)) { + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + return; + } + + error_recovered = + sc->eth_stats.recoverable_error; + error_unrecovered = + sc->eth_stats.unrecoverable_error; + BXE_CORE_LOCK(sc); + sc->recovery_state = + BXE_RECOVERY_NIC_LOADING; + if (bxe_nic_load(sc, LOAD_NORMAL)) { + error_unrecovered++; + sc->recovery_state = BXE_RECOVERY_FAILED; + sc->state = BXE_STATE_ERROR; + BLOGE(sc, "Recovery is NOT successfull, " + " state=0x%x recovery_state=0x%x error=%x\n", + sc->state, sc->recovery_state, sc->error_status); + sc->error_status = 0; + } else { + sc->recovery_state = + BXE_RECOVERY_DONE; + error_recovered++; + BLOGI(sc, "Recovery is successfull from errors %x," + " state=0x%x" + " recovery_state=0x%x \n", sc->error_status, + sc->state, sc->recovery_state); + mb(); + } + sc->error_status = 0; + BXE_CORE_UNLOCK(sc); + sc->eth_stats.recoverable_error = + error_recovered; + sc->eth_stats.unrecoverable_error = + error_unrecovered; + + return; + } + } + default: + return; + } + } +} +void +bxe_handle_error(struct bxe_softc * sc) +{ + + if(sc->recovery_state == BXE_RECOVERY_WAIT) { + return; + } + if(sc->error_status) { + if (sc->state == BXE_STATE_OPEN) { + bxe_int_disable(sc); + } + if (sc->link_vars.link_up) { + if_link_state_change(sc->ifp, LINK_STATE_DOWN); + } + sc->recovery_state = BXE_RECOVERY_INIT; + BLOGI(sc, "bxe%d: Recovery started errors 0x%x recovery state 0x%x\n", + sc->unit, sc->error_status, sc->recovery_state); + bxe_parity_recover(sc); + } +} + +static void +bxe_sp_err_timeout_task(void *arg, int pending) +{ + + struct bxe_softc *sc = (struct bxe_softc *)arg; + + BLOGD(sc, DBG_SP, + "%s state = 0x%x rec state=0x%x error_status=%x\n", + __func__, sc->state, sc->recovery_state, sc->error_status); + + if((sc->recovery_state == BXE_RECOVERY_FAILED) && + (sc->state == BXE_STATE_ERROR)) { + return; + } + /* if can be taken */ + if ((sc->error_status) && (sc->trigger_grcdump)) { + bxe_grc_dump(sc); + } + if (sc->recovery_state != BXE_RECOVERY_DONE) { + bxe_handle_error(sc); + bxe_parity_recover(sc); + } else if (sc->error_status) { + bxe_handle_error(sc); + } + + return; +} + /* start the controller */ static __noinline int bxe_nic_load(struct bxe_softc *sc, @@ -12633,6 +12941,15 @@ bxe_init_locked(struct bxe_softc *sc) return (0); } + if((sc->state == BXE_STATE_ERROR) && + (sc->recovery_state == BXE_RECOVERY_FAILED)) { + BLOGE(sc, "Initialization not done, " + "as previous recovery failed." + "Reboot/Power-cycle the system\n" ); + return (ENXIO); + } + + bxe_set_power_state(sc, PCI_PM_D0); /* @@ -16030,6 +16347,10 @@ bxe_attach(device_t dev) taskqueue_start_threads(&sc->chip_tq, 1, PWAIT, /* lower priority */ "%s", sc->chip_tq_name); + TIMEOUT_TASK_INIT(taskqueue_thread, + &sc->sp_err_timeout_task, 0, bxe_sp_err_timeout_task, sc); + + /* get device info and set params */ if (bxe_get_device_info(sc) != 0) { BLOGE(sc, "getting device info\n"); @@ -16205,6 +16526,8 @@ bxe_detach(device_t dev) taskqueue_drain(sc->chip_tq, &sc->chip_tq_task); taskqueue_free(sc->chip_tq); sc->chip_tq = NULL; + taskqueue_drain_timeout(taskqueue_thread, + &sc->sp_err_timeout_task); } /* stop and reset the controller if it was open */ Modified: stable/11/sys/dev/bxe/bxe.h ============================================================================== --- stable/11/sys/dev/bxe/bxe.h Mon Oct 29 21:08:34 2018 (r339880) +++ stable/11/sys/dev/bxe/bxe.h Mon Oct 29 21:09:39 2018 (r339881) @@ -475,6 +475,10 @@ struct bxe_device_type #define BXE_FW_RX_ALIGN_END (1 << BXE_RX_ALIGN_SHIFT) #define BXE_PXP_DRAM_ALIGN (BXE_RX_ALIGN_SHIFT - 5) /* XXX ??? */ +#define BXE_SET_ERROR_BIT(sc, error) \ +{ \ + (sc)->error_status |= (error); \ +} struct bxe_bar { struct resource *resource; @@ -1388,6 +1392,8 @@ struct bxe_softc { struct taskqueue *chip_tq; char chip_tq_name[32]; + struct timeout_task sp_err_timeout_task; + /* slowpath interrupt taskqueue */ struct task sp_tq_task; struct taskqueue *sp_tq; @@ -1541,6 +1547,16 @@ struct bxe_softc { #define BXE_RECOVERY_WAIT 3 #define BXE_RECOVERY_FAILED 4 #define BXE_RECOVERY_NIC_LOADING 5 + +#define BXE_ERR_TXQ_STUCK 0x1 /* Tx queue stuck detected by driver. */ +#define BXE_ERR_MISC 0x2 /* MISC ERR */ +#define BXE_ERR_PARITY 0x4 /* Parity error detected. */ +#define BXE_ERR_STATS_TO 0x8 /* Statistics timeout detected. */ +#define BXE_ERR_MC_ASSERT 0x10 /* MC assert attention received. */ +#define BXE_ERR_PANIC 0x20 /* Driver asserted. */ +#define BXE_ERR_MCP_ASSERT 0x40 /* MCP assert attention received. No Recovery*/ +#define BXE_ERR_GLOBAL 0x80 /* PCIe/PXP/IGU/MISC/NIG device blocks error- needs PCIe/Fundamental reset */ + uint32_t error_status; uint32_t rx_mode; #define BXE_RX_MODE_NONE 0 Modified: stable/11/sys/dev/bxe/bxe_stats.c ============================================================================== --- stable/11/sys/dev/bxe/bxe_stats.c Mon Oct 29 21:08:34 2018 (r339880) +++ stable/11/sys/dev/bxe/bxe_stats.c Mon Oct 29 21:09:39 2018 (r339881) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #define BITS_PER_LONG 64 #endif -extern int bxe_grc_dump(struct bxe_softc *sc); static inline long bxe_hilo(uint32_t *hiref) @@ -236,11 +235,11 @@ bxe_stats_comp(struct bxe_softc *sc) while (*stats_comp != DMAE_COMP_VAL) { if (!cnt) { BLOGE(sc, "Timeout waiting for stats finished\n"); - if(sc->trigger_grcdump) { - /* taking grcdump */ - bxe_grc_dump(sc); - } + BXE_SET_ERROR_BIT(sc, BXE_ERR_STATS_TO); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); break; + } cnt--; @@ -923,6 +922,7 @@ bxe_hw_stats_update(struct bxe_softc *sc) nig_timer_max = SHMEM_RD(sc, port_mb[SC_PORT(sc)].stat_nig_timer); if (nig_timer_max != estats->nig_timer_max) { estats->nig_timer_max = nig_timer_max; + /*NOTE: not setting error bit */ BLOGE(sc, "invalid NIG timer max (%u)\n", estats->nig_timer_max); } @@ -1316,12 +1316,10 @@ bxe_stats_update(struct bxe_softc *sc) if (bxe_storm_stats_update(sc)) { if (sc->stats_pending++ == 3) { if (if_getdrvflags(sc->ifp) & IFF_DRV_RUNNING) { - if(sc->trigger_grcdump) { - /* taking grcdump */ - bxe_grc_dump(sc); - } - atomic_store_rel_long(&sc->chip_tq_flags, CHIP_TQ_REINIT); - taskqueue_enqueue(sc->chip_tq, &sc->chip_tq_task); + BLOGE(sc, "Storm stats not updated for 3 times, resetting\n"); + BXE_SET_ERROR_BIT(sc, BXE_ERR_STATS_TO); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); } } return; From owner-svn-src-stable@freebsd.org Mon Oct 29 21:14:49 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1ECDA10EA685; Mon, 29 Oct 2018 21:14:49 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C7C4B83BED; Mon, 29 Oct 2018 21:14:48 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 A82AB13CA2; Mon, 29 Oct 2018 21:14:48 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TLEmfA046964; Mon, 29 Oct 2018 21:14:48 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TLEmR4046963; Mon, 29 Oct 2018 21:14:48 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201810292114.w9TLEmR4046963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Mon, 29 Oct 2018 21:14:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r339882 - stable/10/sys/dev/bxe X-SVN-Group: stable-10 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/10/sys/dev/bxe X-SVN-Commit-Revision: 339882 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 21:14:49 -0000 Author: davidcs Date: Mon Oct 29 21:14:48 2018 New Revision: 339882 URL: https://svnweb.freebsd.org/changeset/base/339882 Log: MFC r338734 Fixed isses: State check before enqueuing transmit task in bxe_link_attn() routine. State check before invoking bxe_nic_unload in bxe_shutdown(). Submitted by:Vaishali.Kulkarni@cavium.com Modified: stable/10/sys/dev/bxe/bxe.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/bxe/bxe.c ============================================================================== --- stable/10/sys/dev/bxe/bxe.c Mon Oct 29 21:09:39 2018 (r339881) +++ stable/10/sys/dev/bxe/bxe.c Mon Oct 29 21:14:48 2018 (r339882) @@ -7079,13 +7079,13 @@ bxe_link_attn(struct bxe_softc *sc) if (sc->state == BXE_STATE_OPEN) { bxe_stats_handle(sc, STATS_EVENT_LINK_UP); + /* Restart tx when the link comes back. */ + FOR_EACH_ETH_QUEUE(sc, i) { + fp = &sc->fp[i]; + taskqueue_enqueue(fp->tq, &fp->tx_task); + } } - /* Restart tx when the link comes back. */ - FOR_EACH_ETH_QUEUE(sc, i) { - fp = &sc->fp[i]; - taskqueue_enqueue(fp->tq, &fp->tx_task); - } } if (sc->link_vars.link_up && sc->link_vars.line_speed) { @@ -16281,9 +16281,11 @@ bxe_shutdown(device_t dev) /* stop the periodic callout */ bxe_periodic_stop(sc); - BXE_CORE_LOCK(sc); - bxe_nic_unload(sc, UNLOAD_NORMAL, FALSE); - BXE_CORE_UNLOCK(sc); + if (sc->state != BXE_STATE_CLOSED) { + BXE_CORE_LOCK(sc); + bxe_nic_unload(sc, UNLOAD_NORMAL, FALSE); + BXE_CORE_UNLOCK(sc); + } return (0); } From owner-svn-src-stable@freebsd.org Mon Oct 29 21:31:25 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2BB910EAB08; Mon, 29 Oct 2018 21:31:24 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8046B845E7; Mon, 29 Oct 2018 21:31:24 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6111113FBD; Mon, 29 Oct 2018 21:31:24 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TLVOWQ053358; Mon, 29 Oct 2018 21:31:24 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TLVNtC053354; Mon, 29 Oct 2018 21:31:23 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201810292131.w9TLVNtC053354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Mon, 29 Oct 2018 21:31:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r339884 - stable/10/sys/dev/bxe X-SVN-Group: stable-10 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/10/sys/dev/bxe X-SVN-Commit-Revision: 339884 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 21:31:25 -0000 Author: davidcs Date: Mon Oct 29 21:31:23 2018 New Revision: 339884 URL: https://svnweb.freebsd.org/changeset/base/339884 Log: MFC r339366 Add support for Error Recovery Submitted by:Vaishali.Kulkarni@cavium.com Modified: stable/10/sys/dev/bxe/bxe.c stable/10/sys/dev/bxe/bxe.h stable/10/sys/dev/bxe/bxe_stats.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/bxe/bxe.c ============================================================================== --- stable/10/sys/dev/bxe/bxe.c Mon Oct 29 21:16:26 2018 (r339883) +++ stable/10/sys/dev/bxe/bxe.c Mon Oct 29 21:31:23 2018 (r339884) @@ -194,6 +194,7 @@ static int bxe_attach(device_t); static int bxe_detach(device_t); static int bxe_shutdown(device_t); + /* * FreeBSD KLD module/device interface event handler method. */ @@ -706,6 +707,9 @@ static void bxe_interrupt_detach(struct bxe_softc * static void bxe_set_rx_mode(struct bxe_softc *sc); static int bxe_init_locked(struct bxe_softc *sc); static int bxe_stop_locked(struct bxe_softc *sc); +static void bxe_sp_err_timeout_task(void *arg, int pending); +void bxe_parity_recover(struct bxe_softc *sc); +void bxe_handle_error(struct bxe_softc *sc); static __noinline int bxe_nic_load(struct bxe_softc *sc, int load_mode); static __noinline int bxe_nic_unload(struct bxe_softc *sc, @@ -3494,16 +3498,12 @@ bxe_watchdog(struct bxe_softc *sc, } BLOGE(sc, "TX watchdog timeout on fp[%02d], resetting!\n", fp->index); - if(sc->trigger_grcdump) { - /* taking grcdump */ - bxe_grc_dump(sc); - } BXE_FP_TX_UNLOCK(fp); + BXE_SET_ERROR_BIT(sc, BXE_ERR_TXQ_STUCK); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); - atomic_store_rel_long(&sc->chip_tq_flags, CHIP_TQ_REINIT); - taskqueue_enqueue(sc->chip_tq, &sc->chip_tq_task); - return (-1); } @@ -4258,6 +4258,7 @@ bxe_nic_unload(struct bxe_softc *sc, struct bxe_fastpath *fp; fp = &sc->fp[i]; + fp->watchdog_timer = 0; BXE_FP_TX_LOCK(fp); BXE_FP_TX_UNLOCK(fp); } @@ -4273,20 +4274,22 @@ bxe_nic_unload(struct bxe_softc *sc, if (IS_PF(sc) && sc->recovery_state != BXE_RECOVERY_DONE && (sc->state == BXE_STATE_CLOSED || sc->state == BXE_STATE_ERROR)) { - /* - * We can get here if the driver has been unloaded - * during parity error recovery and is either waiting for a - * leader to complete or for other functions to unload and - * then ifconfig down has been issued. In this case we want to - * unload and let other functions to complete a recovery - * process. - */ - sc->recovery_state = BXE_RECOVERY_DONE; - sc->is_leader = 0; - bxe_release_leader_lock(sc); - mb(); - BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n"); + if(CHIP_PORT_MODE(sc) == CHIP_4_PORT_MODE) { + /* + * We can get here if the driver has been unloaded + * during parity error recovery and is either waiting for a + * leader to complete or for other functions to unload and + * then ifconfig down has been issued. In this case we want to + * unload and let other functions to complete a recovery + * process. + */ + sc->recovery_state = BXE_RECOVERY_DONE; + sc->is_leader = 0; + bxe_release_leader_lock(sc); + mb(); + BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n"); + } BLOGE(sc, "Can't unload in closed or error state recover_state 0x%x" " state = 0x%x\n", sc->recovery_state, sc->state); return (-1); @@ -7573,6 +7576,10 @@ bxe_parity_attn(struct bxe_softc *sc, if (print) BLOGI(sc, "\n"); + if( *global == TRUE ) { + BXE_SET_ERROR_BIT(sc, BXE_ERR_GLOBAL); + } + return (TRUE); } @@ -7587,6 +7594,9 @@ bxe_chk_parity_attn(struct bxe_softc *sc, struct attn_route attn = { {0} }; int port = SC_PORT(sc); + if(sc->state != BXE_STATE_OPEN) + return FALSE; + attn.sig[0] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_1_FUNC_0 + port*4); attn.sig[1] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_2_FUNC_0 + port*4); attn.sig[2] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_3_FUNC_0 + port*4); @@ -7613,10 +7623,12 @@ bxe_attn_int_deasserted4(struct bxe_softc *sc, uint32_t attn) { uint32_t val; + boolean_t err_flg = FALSE; if (attn & AEU_INPUTS_ATTN_BITS_PGLUE_HW_INTERRUPT) { val = REG_RD(sc, PGLUE_B_REG_PGLUE_B_INT_STS_CLR); BLOGE(sc, "PGLUE hw attention 0x%08x\n", val); + err_flg = TRUE; if (val & PGLUE_B_PGLUE_B_INT_STS_REG_ADDRESS_ERROR) BLOGE(sc, "PGLUE_B_PGLUE_B_INT_STS_REG_ADDRESS_ERROR\n"); if (val & PGLUE_B_PGLUE_B_INT_STS_REG_INCORRECT_RCV_BEHAVIOR) @@ -7640,6 +7652,7 @@ bxe_attn_int_deasserted4(struct bxe_softc *sc, if (attn & AEU_INPUTS_ATTN_BITS_ATC_HW_INTERRUPT) { val = REG_RD(sc, ATC_REG_ATC_INT_STS_CLR); BLOGE(sc, "ATC hw attention 0x%08x\n", val); + err_flg = TRUE; if (val & ATC_ATC_INT_STS_REG_ADDRESS_ERROR) BLOGE(sc, "ATC_ATC_INT_STS_REG_ADDRESS_ERROR\n"); if (val & ATC_ATC_INT_STS_REG_ATC_TCPL_TO_NOT_PEND) @@ -7659,7 +7672,14 @@ bxe_attn_int_deasserted4(struct bxe_softc *sc, BLOGE(sc, "FATAL parity attention set4 0x%08x\n", (uint32_t)(attn & (AEU_INPUTS_ATTN_BITS_PGLUE_PARITY_ERROR | AEU_INPUTS_ATTN_BITS_ATC_PARITY_ERROR))); + err_flg = TRUE; } + if (err_flg) { + BXE_SET_ERROR_BIT(sc, BXE_ERR_MISC); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + } + } static void @@ -8014,14 +8034,21 @@ bxe_attn_int_deasserted3(struct bxe_softc *sc, REG_WR(sc, MISC_REG_AEU_GENERAL_ATTN_9, 0); REG_WR(sc, MISC_REG_AEU_GENERAL_ATTN_8, 0); REG_WR(sc, MISC_REG_AEU_GENERAL_ATTN_7, 0); - bxe_panic(sc, ("MC assert!\n")); - + bxe_int_disable(sc); + BXE_SET_ERROR_BIT(sc, BXE_ERR_MC_ASSERT); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + } else if (attn & BXE_MCP_ASSERT) { BLOGE(sc, "MCP assert!\n"); REG_WR(sc, MISC_REG_AEU_GENERAL_ATTN_11, 0); - // XXX bxe_fw_dump(sc); + BXE_SET_ERROR_BIT(sc, BXE_ERR_MCP_ASSERT); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + bxe_int_disable(sc); /*avoid repetive assert alert */ + } else { BLOGE(sc, "Unknown HW assert! (attn 0x%08x)\n", attn); } @@ -8049,6 +8076,7 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, int reg_offset; uint32_t val0, mask0, val1, mask1; uint32_t val; + boolean_t err_flg = FALSE; if (attn & AEU_INPUTS_ATTN_BITS_CFC_HW_INTERRUPT) { val = REG_RD(sc, CFC_REG_CFC_INT_STS_CLR); @@ -8056,6 +8084,7 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, /* CFC error attention */ if (val & 0x2) { BLOGE(sc, "FATAL error from CFC\n"); + err_flg = TRUE; } } @@ -8065,11 +8094,13 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, /* RQ_USDMDP_FIFO_OVERFLOW */ if (val & 0x18000) { BLOGE(sc, "FATAL error from PXP\n"); + err_flg = TRUE; } if (!CHIP_IS_E1x(sc)) { val = REG_RD(sc, PXP_REG_PXP_INT_STS_CLR_1); BLOGE(sc, "PXP hw attention-1 0x%08x\n", val); + err_flg = TRUE; } } @@ -8106,6 +8137,7 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, */ if (val0 & PXP2_EOP_ERROR_BIT) { BLOGE(sc, "PXP2_WR_PGLUE_EOP_ERROR\n"); + err_flg = TRUE; /* * if only PXP2_PXP2_INT_STS_0_REG_WR_PGLUE_EOP_ERROR is @@ -8128,8 +8160,15 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, BLOGE(sc, "FATAL HW block attention set2 0x%x\n", (uint32_t)(attn & HW_INTERRUT_ASSERT_SET_2)); + err_flg = TRUE; bxe_panic(sc, ("HW block attention set2\n")); } + if(err_flg) { + BXE_SET_ERROR_BIT(sc, BXE_ERR_GLOBAL); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + } + } static void @@ -8139,6 +8178,7 @@ bxe_attn_int_deasserted1(struct bxe_softc *sc, int port = SC_PORT(sc); int reg_offset; uint32_t val; + boolean_t err_flg = FALSE; if (attn & AEU_INPUTS_ATTN_BITS_DOORBELLQ_HW_INTERRUPT) { val = REG_RD(sc, DORQ_REG_DORQ_INT_STS_CLR); @@ -8146,6 +8186,7 @@ bxe_attn_int_deasserted1(struct bxe_softc *sc, /* DORQ discard attention */ if (val & 0x2) { BLOGE(sc, "FATAL error from DORQ\n"); + err_flg = TRUE; } } @@ -8159,8 +8200,15 @@ bxe_attn_int_deasserted1(struct bxe_softc *sc, BLOGE(sc, "FATAL HW block attention set1 0x%08x\n", (uint32_t)(attn & HW_INTERRUT_ASSERT_SET_1)); + err_flg = TRUE; bxe_panic(sc, ("HW block attention set1\n")); } + if(err_flg) { + BXE_SET_ERROR_BIT(sc, BXE_ERR_MISC); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + } + } static void @@ -8197,6 +8245,11 @@ bxe_attn_int_deasserted0(struct bxe_softc *sc, val &= ~(attn & HW_INTERRUT_ASSERT_SET_0); REG_WR(sc, reg_offset, val); + + BXE_SET_ERROR_BIT(sc, BXE_ERR_MISC); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + bxe_panic(sc, ("FATAL HW block attention set0 0x%lx\n", (attn & HW_INTERRUT_ASSERT_SET_0))); } @@ -8226,10 +8279,12 @@ bxe_attn_int_deasserted(struct bxe_softc *sc, * In case of parity errors don't handle attentions so that * other function would "see" parity errors. */ - sc->recovery_state = BXE_RECOVERY_INIT; // XXX schedule a recovery task... /* disable HW interrupts */ bxe_int_disable(sc); + BXE_SET_ERROR_BIT(sc, BXE_ERR_PARITY); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); bxe_release_alr(sc); return; } @@ -12360,6 +12415,259 @@ bxe_periodic_stop(struct bxe_softc *sc) callout_drain(&sc->periodic_callout); } +void +bxe_parity_recover(struct bxe_softc *sc) +{ + uint8_t global = FALSE; + uint32_t error_recovered, error_unrecovered; + bool is_parity; + + + if ((sc->recovery_state == BXE_RECOVERY_FAILED) && + (sc->state == BXE_STATE_ERROR)) { + BLOGE(sc, "RECOVERY failed, " + "stack notified driver is NOT running! " + "Please reboot/power cycle the system.\n"); + return; + } + + while (1) { + BLOGD(sc, DBG_SP, + "%s sc=%p state=0x%x rec_state=0x%x error_status=%x\n", + __func__, sc, sc->state, sc->recovery_state, sc->error_status); + + switch(sc->recovery_state) { + + case BXE_RECOVERY_INIT: + is_parity = bxe_chk_parity_attn(sc, &global, FALSE); + + if ((CHIP_PORT_MODE(sc) == CHIP_4_PORT_MODE) || + (sc->error_status & BXE_ERR_MCP_ASSERT) || + (sc->error_status & BXE_ERR_GLOBAL)) { + + BXE_CORE_LOCK(sc); + if (sc->ifnet->if_drv_flags & IFF_DRV_RUNNING) { + bxe_periodic_stop(sc); + } + bxe_nic_unload(sc, UNLOAD_RECOVERY, false); + sc->state = BXE_STATE_ERROR; + sc->recovery_state = BXE_RECOVERY_FAILED; + BLOGE(sc, " No Recovery tried for error 0x%x" + " stack notified driver is NOT running!" + " Please reboot/power cycle the system.\n", + sc->error_status); + BXE_CORE_UNLOCK(sc); + return; + } + + + /* Try to get a LEADER_LOCK HW lock */ + if (bxe_trylock_leader_lock(sc)) { + + bxe_set_reset_in_progress(sc); + /* + * Check if there is a global attention and if + * there was a global attention, set the global + * reset bit. + */ + if (global) { + bxe_set_reset_global(sc); + } + sc->is_leader = 1; + } + + /* If interface has been removed - break */ + + if (sc->ifnet->if_drv_flags & IFF_DRV_RUNNING) { + bxe_periodic_stop(sc); + } + + BXE_CORE_LOCK(sc); + bxe_nic_unload(sc,UNLOAD_RECOVERY, false); + sc->recovery_state = BXE_RECOVERY_WAIT; + BXE_CORE_UNLOCK(sc); + + /* + * Ensure "is_leader", MCP command sequence and + * "recovery_state" update values are seen on other + * CPUs. + */ + mb(); + break; + case BXE_RECOVERY_WAIT: + + if (sc->is_leader) { + int other_engine = SC_PATH(sc) ? 0 : 1; + bool other_load_status = + bxe_get_load_status(sc, other_engine); + bool load_status = + bxe_get_load_status(sc, SC_PATH(sc)); + global = bxe_reset_is_global(sc); + + /* + * In case of a parity in a global block, let + * the first leader that performs a + * leader_reset() reset the global blocks in + * order to clear global attentions. Otherwise + * the gates will remain closed for that + * engine. + */ + if (load_status || + (global && other_load_status)) { + /* + * Wait until all other functions get + * down. + */ + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + return; + } else { + /* + * If all other functions got down + * try to bring the chip back to + * normal. In any case it's an exit + * point for a leader. + */ + if (bxe_leader_reset(sc)) { + BLOGE(sc, "RECOVERY failed, " + "stack notified driver is NOT running!\n"); + sc->recovery_state = BXE_RECOVERY_FAILED; + sc->state = BXE_STATE_ERROR; + mb(); + return; + } + + /* + * If we are here, means that the + * leader has succeeded and doesn't + * want to be a leader any more. Try + * to continue as a none-leader. + */ + break; + } + + } else { /* non-leader */ + if (!bxe_reset_is_done(sc, SC_PATH(sc))) { + /* + * Try to get a LEADER_LOCK HW lock as + * long as a former leader may have + * been unloaded by the user or + * released a leadership by another + * reason. + */ + if (bxe_trylock_leader_lock(sc)) { + /* + * I'm a leader now! Restart a + * switch case. + */ + sc->is_leader = 1; + break; + } + + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + return; + + } else { + /* + * If there was a global attention, wait + * for it to be cleared. + */ + if (bxe_reset_is_global(sc)) { + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + return; + } + + error_recovered = + sc->eth_stats.recoverable_error; + error_unrecovered = + sc->eth_stats.unrecoverable_error; + BXE_CORE_LOCK(sc); + sc->recovery_state = + BXE_RECOVERY_NIC_LOADING; + if (bxe_nic_load(sc, LOAD_NORMAL)) { + error_unrecovered++; + sc->recovery_state = BXE_RECOVERY_FAILED; + sc->state = BXE_STATE_ERROR; + BLOGE(sc, "Recovery is NOT successfull, " + " state=0x%x recovery_state=0x%x error=%x\n", + sc->state, sc->recovery_state, sc->error_status); + sc->error_status = 0; + } else { + sc->recovery_state = + BXE_RECOVERY_DONE; + error_recovered++; + BLOGI(sc, "Recovery is successfull from errors %x," + " state=0x%x" + " recovery_state=0x%x \n", sc->error_status, + sc->state, sc->recovery_state); + mb(); + } + sc->error_status = 0; + BXE_CORE_UNLOCK(sc); + sc->eth_stats.recoverable_error = + error_recovered; + sc->eth_stats.unrecoverable_error = + error_unrecovered; + + return; + } + } + default: + return; + } + } +} +void +bxe_handle_error(struct bxe_softc * sc) +{ + + if(sc->recovery_state == BXE_RECOVERY_WAIT) { + return; + } + if(sc->error_status) { + if (sc->state == BXE_STATE_OPEN) { + bxe_int_disable(sc); + } + if (sc->link_vars.link_up) { + if_link_state_change(sc->ifnet, LINK_STATE_DOWN); + } + sc->recovery_state = BXE_RECOVERY_INIT; + BLOGI(sc, "bxe%d: Recovery started errors 0x%x recovery state 0x%x\n", + sc->unit, sc->error_status, sc->recovery_state); + bxe_parity_recover(sc); + } +} + +static void +bxe_sp_err_timeout_task(void *arg, int pending) +{ + + struct bxe_softc *sc = (struct bxe_softc *)arg; + + BLOGD(sc, DBG_SP, + "%s state = 0x%x rec state=0x%x error_status=%x\n", + __func__, sc->state, sc->recovery_state, sc->error_status); + + if((sc->recovery_state == BXE_RECOVERY_FAILED) && + (sc->state == BXE_STATE_ERROR)) { + return; + } + /* if can be taken */ + if ((sc->error_status) && (sc->trigger_grcdump)) { + bxe_grc_dump(sc); + } + if (sc->recovery_state != BXE_RECOVERY_DONE) { + bxe_handle_error(sc); + bxe_parity_recover(sc); + } else if (sc->error_status) { + bxe_handle_error(sc); + } + + return; +} + /* start the controller */ static __noinline int bxe_nic_load(struct bxe_softc *sc, @@ -12641,6 +12949,15 @@ bxe_init_locked(struct bxe_softc *sc) return (0); } + if((sc->state == BXE_STATE_ERROR) && + (sc->recovery_state == BXE_RECOVERY_FAILED)) { + BLOGE(sc, "Initialization not done, " + "as previous recovery failed." + "Reboot/Power-cycle the system\n" ); + return (ENXIO); + } + + bxe_set_power_state(sc, PCI_PM_D0); /* @@ -16039,6 +16356,10 @@ bxe_attach(device_t dev) taskqueue_start_threads(&sc->chip_tq, 1, PWAIT, /* lower priority */ "%s", sc->chip_tq_name); + TIMEOUT_TASK_INIT(taskqueue_thread, + &sc->sp_err_timeout_task, 0, bxe_sp_err_timeout_task, sc); + + /* get device info and set params */ if (bxe_get_device_info(sc) != 0) { BLOGE(sc, "getting device info\n"); @@ -16214,6 +16535,8 @@ bxe_detach(device_t dev) taskqueue_drain(sc->chip_tq, &sc->chip_tq_task); taskqueue_free(sc->chip_tq); sc->chip_tq = NULL; + taskqueue_drain_timeout(taskqueue_thread, + &sc->sp_err_timeout_task); } /* stop and reset the controller if it was open */ Modified: stable/10/sys/dev/bxe/bxe.h ============================================================================== --- stable/10/sys/dev/bxe/bxe.h Mon Oct 29 21:16:26 2018 (r339883) +++ stable/10/sys/dev/bxe/bxe.h Mon Oct 29 21:31:23 2018 (r339884) @@ -475,6 +475,10 @@ struct bxe_device_type #define BXE_FW_RX_ALIGN_END (1 << BXE_RX_ALIGN_SHIFT) #define BXE_PXP_DRAM_ALIGN (BXE_RX_ALIGN_SHIFT - 5) /* XXX ??? */ +#define BXE_SET_ERROR_BIT(sc, error) \ +{ \ + (sc)->error_status |= (error); \ +} struct bxe_bar { struct resource *resource; @@ -1388,6 +1392,8 @@ struct bxe_softc { struct taskqueue *chip_tq; char chip_tq_name[32]; + struct timeout_task sp_err_timeout_task; + /* slowpath interrupt taskqueue */ struct task sp_tq_task; struct taskqueue *sp_tq; @@ -1541,6 +1547,16 @@ struct bxe_softc { #define BXE_RECOVERY_WAIT 3 #define BXE_RECOVERY_FAILED 4 #define BXE_RECOVERY_NIC_LOADING 5 + +#define BXE_ERR_TXQ_STUCK 0x1 /* Tx queue stuck detected by driver. */ +#define BXE_ERR_MISC 0x2 /* MISC ERR */ +#define BXE_ERR_PARITY 0x4 /* Parity error detected. */ +#define BXE_ERR_STATS_TO 0x8 /* Statistics timeout detected. */ +#define BXE_ERR_MC_ASSERT 0x10 /* MC assert attention received. */ +#define BXE_ERR_PANIC 0x20 /* Driver asserted. */ +#define BXE_ERR_MCP_ASSERT 0x40 /* MCP assert attention received. No Recovery*/ +#define BXE_ERR_GLOBAL 0x80 /* PCIe/PXP/IGU/MISC/NIG device blocks error- needs PCIe/Fundamental reset */ + uint32_t error_status; uint32_t rx_mode; #define BXE_RX_MODE_NONE 0 Modified: stable/10/sys/dev/bxe/bxe_stats.c ============================================================================== --- stable/10/sys/dev/bxe/bxe_stats.c Mon Oct 29 21:16:26 2018 (r339883) +++ stable/10/sys/dev/bxe/bxe_stats.c Mon Oct 29 21:31:23 2018 (r339884) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #define BITS_PER_LONG 64 #endif -extern int bxe_grc_dump(struct bxe_softc *sc); static inline long bxe_hilo(uint32_t *hiref) @@ -236,11 +235,11 @@ bxe_stats_comp(struct bxe_softc *sc) while (*stats_comp != DMAE_COMP_VAL) { if (!cnt) { BLOGE(sc, "Timeout waiting for stats finished\n"); - if(sc->trigger_grcdump) { - /* taking grcdump */ - bxe_grc_dump(sc); - } + BXE_SET_ERROR_BIT(sc, BXE_ERR_STATS_TO); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); break; + } cnt--; @@ -923,6 +922,7 @@ bxe_hw_stats_update(struct bxe_softc *sc) nig_timer_max = SHMEM_RD(sc, port_mb[SC_PORT(sc)].stat_nig_timer); if (nig_timer_max != estats->nig_timer_max) { estats->nig_timer_max = nig_timer_max; + /*NOTE: not setting error bit */ BLOGE(sc, "invalid NIG timer max (%u)\n", estats->nig_timer_max); } @@ -1316,12 +1316,10 @@ bxe_stats_update(struct bxe_softc *sc) if (bxe_storm_stats_update(sc)) { if (sc->stats_pending++ == 3) { if (sc->ifnet->if_drv_flags & IFF_DRV_RUNNING) { - if(sc->trigger_grcdump) { - /* taking grcdump */ - bxe_grc_dump(sc); - } - atomic_store_rel_long(&sc->chip_tq_flags, CHIP_TQ_REINIT); - taskqueue_enqueue(sc->chip_tq, &sc->chip_tq_task); + BLOGE(sc, "Storm stats not updated for 3 times, resetting\n"); + BXE_SET_ERROR_BIT(sc, BXE_ERR_STATS_TO); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); } } return; From owner-svn-src-stable@freebsd.org Mon Oct 29 21:36:11 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAE8710EACE7; Mon, 29 Oct 2018 21:36:11 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6820A84828; Mon, 29 Oct 2018 21:36:11 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 3CB251400D; Mon, 29 Oct 2018 21:36:11 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TLaBOZ057564; Mon, 29 Oct 2018 21:36:11 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TLaAtc057563; Mon, 29 Oct 2018 21:36:10 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201810292136.w9TLaAtc057563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Mon, 29 Oct 2018 21:36:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r339885 - stable/9/sys/dev/bxe X-SVN-Group: stable-9 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/9/sys/dev/bxe X-SVN-Commit-Revision: 339885 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 21:36:11 -0000 Author: davidcs Date: Mon Oct 29 21:36:10 2018 New Revision: 339885 URL: https://svnweb.freebsd.org/changeset/base/339885 Log: MFC r338734 Fixed isses: State check before enqueuing transmit task in bxe_link_attn() routine. State check before invoking bxe_nic_unload in bxe_shutdown(). Submitted by:Vaishali.Kulkarni@cavium.com Modified: stable/9/sys/dev/bxe/bxe.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/dev/bxe/bxe.c ============================================================================== --- stable/9/sys/dev/bxe/bxe.c Mon Oct 29 21:31:23 2018 (r339884) +++ stable/9/sys/dev/bxe/bxe.c Mon Oct 29 21:36:10 2018 (r339885) @@ -7081,13 +7081,13 @@ bxe_link_attn(struct bxe_softc *sc) if (sc->state == BXE_STATE_OPEN) { bxe_stats_handle(sc, STATS_EVENT_LINK_UP); + /* Restart tx when the link comes back. */ + FOR_EACH_ETH_QUEUE(sc, i) { + fp = &sc->fp[i]; + taskqueue_enqueue(fp->tq, &fp->tx_task); + } } - /* Restart tx when the link comes back. */ - FOR_EACH_ETH_QUEUE(sc, i) { - fp = &sc->fp[i]; - taskqueue_enqueue(fp->tq, &fp->tx_task); - } } if (sc->link_vars.link_up && sc->link_vars.line_speed) { @@ -16284,9 +16284,11 @@ bxe_shutdown(device_t dev) /* stop the periodic callout */ bxe_periodic_stop(sc); - BXE_CORE_LOCK(sc); - bxe_nic_unload(sc, UNLOAD_NORMAL, FALSE); - BXE_CORE_UNLOCK(sc); + if (sc->state != BXE_STATE_CLOSED) { + BXE_CORE_LOCK(sc); + bxe_nic_unload(sc, UNLOAD_NORMAL, FALSE); + BXE_CORE_UNLOCK(sc); + } return (0); } From owner-svn-src-stable@freebsd.org Mon Oct 29 21:46:16 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E685110EB1D2; Mon, 29 Oct 2018 21:46:15 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9675084ECF; Mon, 29 Oct 2018 21:46:15 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 AFAF6141AE; Mon, 29 Oct 2018 21:46:13 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9TLkD2l062658; Mon, 29 Oct 2018 21:46:13 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9TLkDX4062655; Mon, 29 Oct 2018 21:46:13 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201810292146.w9TLkDX4062655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Mon, 29 Oct 2018 21:46:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r339887 - stable/9/sys/dev/bxe X-SVN-Group: stable-9 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/9/sys/dev/bxe X-SVN-Commit-Revision: 339887 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 21:46:16 -0000 Author: davidcs Date: Mon Oct 29 21:46:12 2018 New Revision: 339887 URL: https://svnweb.freebsd.org/changeset/base/339887 Log: MFC r339366 Add support for Error Recovery Submitted by:Vaishali.Kulkarni@cavium.com Modified: stable/9/sys/dev/bxe/bxe.c stable/9/sys/dev/bxe/bxe.h stable/9/sys/dev/bxe/bxe_stats.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/dev/bxe/bxe.c ============================================================================== --- stable/9/sys/dev/bxe/bxe.c Mon Oct 29 21:46:05 2018 (r339886) +++ stable/9/sys/dev/bxe/bxe.c Mon Oct 29 21:46:12 2018 (r339887) @@ -188,6 +188,7 @@ static int bxe_attach(device_t); static int bxe_detach(device_t); static int bxe_shutdown(device_t); + /* * FreeBSD KLD module/device interface event handler method. */ @@ -700,6 +701,9 @@ static void bxe_interrupt_detach(struct bxe_softc * static void bxe_set_rx_mode(struct bxe_softc *sc); static int bxe_init_locked(struct bxe_softc *sc); static int bxe_stop_locked(struct bxe_softc *sc); +static void bxe_sp_err_timeout_task(void *arg, int pending); +void bxe_parity_recover(struct bxe_softc *sc); +void bxe_handle_error(struct bxe_softc *sc); static __noinline int bxe_nic_load(struct bxe_softc *sc, int load_mode); static __noinline int bxe_nic_unload(struct bxe_softc *sc, @@ -3488,16 +3492,12 @@ bxe_watchdog(struct bxe_softc *sc, } BLOGE(sc, "TX watchdog timeout on fp[%02d], resetting!\n", fp->index); - if(sc->trigger_grcdump) { - /* taking grcdump */ - bxe_grc_dump(sc); - } BXE_FP_TX_UNLOCK(fp); + BXE_SET_ERROR_BIT(sc, BXE_ERR_TXQ_STUCK); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); - atomic_store_rel_long(&sc->chip_tq_flags, CHIP_TQ_REINIT); - taskqueue_enqueue(sc->chip_tq, &sc->chip_tq_task); - return (-1); } @@ -4252,6 +4252,7 @@ bxe_nic_unload(struct bxe_softc *sc, struct bxe_fastpath *fp; fp = &sc->fp[i]; + fp->watchdog_timer = 0; BXE_FP_TX_LOCK(fp); BXE_FP_TX_UNLOCK(fp); } @@ -4267,20 +4268,22 @@ bxe_nic_unload(struct bxe_softc *sc, if (IS_PF(sc) && sc->recovery_state != BXE_RECOVERY_DONE && (sc->state == BXE_STATE_CLOSED || sc->state == BXE_STATE_ERROR)) { - /* - * We can get here if the driver has been unloaded - * during parity error recovery and is either waiting for a - * leader to complete or for other functions to unload and - * then ifconfig down has been issued. In this case we want to - * unload and let other functions to complete a recovery - * process. - */ - sc->recovery_state = BXE_RECOVERY_DONE; - sc->is_leader = 0; - bxe_release_leader_lock(sc); - mb(); - BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n"); + if(CHIP_PORT_MODE(sc) == CHIP_4_PORT_MODE) { + /* + * We can get here if the driver has been unloaded + * during parity error recovery and is either waiting for a + * leader to complete or for other functions to unload and + * then ifconfig down has been issued. In this case we want to + * unload and let other functions to complete a recovery + * process. + */ + sc->recovery_state = BXE_RECOVERY_DONE; + sc->is_leader = 0; + bxe_release_leader_lock(sc); + mb(); + BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n"); + } BLOGE(sc, "Can't unload in closed or error state recover_state 0x%x" " state = 0x%x\n", sc->recovery_state, sc->state); return (-1); @@ -7575,6 +7578,10 @@ bxe_parity_attn(struct bxe_softc *sc, if (print) BLOGI(sc, "\n"); + if( *global == TRUE ) { + BXE_SET_ERROR_BIT(sc, BXE_ERR_GLOBAL); + } + return (TRUE); } @@ -7589,6 +7596,9 @@ bxe_chk_parity_attn(struct bxe_softc *sc, struct attn_route attn = { {0} }; int port = SC_PORT(sc); + if(sc->state != BXE_STATE_OPEN) + return FALSE; + attn.sig[0] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_1_FUNC_0 + port*4); attn.sig[1] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_2_FUNC_0 + port*4); attn.sig[2] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_3_FUNC_0 + port*4); @@ -7615,10 +7625,12 @@ bxe_attn_int_deasserted4(struct bxe_softc *sc, uint32_t attn) { uint32_t val; + boolean_t err_flg = FALSE; if (attn & AEU_INPUTS_ATTN_BITS_PGLUE_HW_INTERRUPT) { val = REG_RD(sc, PGLUE_B_REG_PGLUE_B_INT_STS_CLR); BLOGE(sc, "PGLUE hw attention 0x%08x\n", val); + err_flg = TRUE; if (val & PGLUE_B_PGLUE_B_INT_STS_REG_ADDRESS_ERROR) BLOGE(sc, "PGLUE_B_PGLUE_B_INT_STS_REG_ADDRESS_ERROR\n"); if (val & PGLUE_B_PGLUE_B_INT_STS_REG_INCORRECT_RCV_BEHAVIOR) @@ -7642,6 +7654,7 @@ bxe_attn_int_deasserted4(struct bxe_softc *sc, if (attn & AEU_INPUTS_ATTN_BITS_ATC_HW_INTERRUPT) { val = REG_RD(sc, ATC_REG_ATC_INT_STS_CLR); BLOGE(sc, "ATC hw attention 0x%08x\n", val); + err_flg = TRUE; if (val & ATC_ATC_INT_STS_REG_ADDRESS_ERROR) BLOGE(sc, "ATC_ATC_INT_STS_REG_ADDRESS_ERROR\n"); if (val & ATC_ATC_INT_STS_REG_ATC_TCPL_TO_NOT_PEND) @@ -7661,7 +7674,14 @@ bxe_attn_int_deasserted4(struct bxe_softc *sc, BLOGE(sc, "FATAL parity attention set4 0x%08x\n", (uint32_t)(attn & (AEU_INPUTS_ATTN_BITS_PGLUE_PARITY_ERROR | AEU_INPUTS_ATTN_BITS_ATC_PARITY_ERROR))); + err_flg = TRUE; } + if (err_flg) { + BXE_SET_ERROR_BIT(sc, BXE_ERR_MISC); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + } + } static void @@ -8016,14 +8036,21 @@ bxe_attn_int_deasserted3(struct bxe_softc *sc, REG_WR(sc, MISC_REG_AEU_GENERAL_ATTN_9, 0); REG_WR(sc, MISC_REG_AEU_GENERAL_ATTN_8, 0); REG_WR(sc, MISC_REG_AEU_GENERAL_ATTN_7, 0); - bxe_panic(sc, ("MC assert!\n")); - + bxe_int_disable(sc); + BXE_SET_ERROR_BIT(sc, BXE_ERR_MC_ASSERT); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + } else if (attn & BXE_MCP_ASSERT) { BLOGE(sc, "MCP assert!\n"); REG_WR(sc, MISC_REG_AEU_GENERAL_ATTN_11, 0); - // XXX bxe_fw_dump(sc); + BXE_SET_ERROR_BIT(sc, BXE_ERR_MCP_ASSERT); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + bxe_int_disable(sc); /*avoid repetive assert alert */ + } else { BLOGE(sc, "Unknown HW assert! (attn 0x%08x)\n", attn); } @@ -8051,6 +8078,7 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, int reg_offset; uint32_t val0, mask0, val1, mask1; uint32_t val; + boolean_t err_flg = FALSE; if (attn & AEU_INPUTS_ATTN_BITS_CFC_HW_INTERRUPT) { val = REG_RD(sc, CFC_REG_CFC_INT_STS_CLR); @@ -8058,6 +8086,7 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, /* CFC error attention */ if (val & 0x2) { BLOGE(sc, "FATAL error from CFC\n"); + err_flg = TRUE; } } @@ -8067,11 +8096,13 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, /* RQ_USDMDP_FIFO_OVERFLOW */ if (val & 0x18000) { BLOGE(sc, "FATAL error from PXP\n"); + err_flg = TRUE; } if (!CHIP_IS_E1x(sc)) { val = REG_RD(sc, PXP_REG_PXP_INT_STS_CLR_1); BLOGE(sc, "PXP hw attention-1 0x%08x\n", val); + err_flg = TRUE; } } @@ -8108,6 +8139,7 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, */ if (val0 & PXP2_EOP_ERROR_BIT) { BLOGE(sc, "PXP2_WR_PGLUE_EOP_ERROR\n"); + err_flg = TRUE; /* * if only PXP2_PXP2_INT_STS_0_REG_WR_PGLUE_EOP_ERROR is @@ -8130,8 +8162,15 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc, BLOGE(sc, "FATAL HW block attention set2 0x%x\n", (uint32_t)(attn & HW_INTERRUT_ASSERT_SET_2)); + err_flg = TRUE; bxe_panic(sc, ("HW block attention set2\n")); } + if(err_flg) { + BXE_SET_ERROR_BIT(sc, BXE_ERR_GLOBAL); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + } + } static void @@ -8141,6 +8180,7 @@ bxe_attn_int_deasserted1(struct bxe_softc *sc, int port = SC_PORT(sc); int reg_offset; uint32_t val; + boolean_t err_flg = FALSE; if (attn & AEU_INPUTS_ATTN_BITS_DOORBELLQ_HW_INTERRUPT) { val = REG_RD(sc, DORQ_REG_DORQ_INT_STS_CLR); @@ -8148,6 +8188,7 @@ bxe_attn_int_deasserted1(struct bxe_softc *sc, /* DORQ discard attention */ if (val & 0x2) { BLOGE(sc, "FATAL error from DORQ\n"); + err_flg = TRUE; } } @@ -8161,8 +8202,15 @@ bxe_attn_int_deasserted1(struct bxe_softc *sc, BLOGE(sc, "FATAL HW block attention set1 0x%08x\n", (uint32_t)(attn & HW_INTERRUT_ASSERT_SET_1)); + err_flg = TRUE; bxe_panic(sc, ("HW block attention set1\n")); } + if(err_flg) { + BXE_SET_ERROR_BIT(sc, BXE_ERR_MISC); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + } + } static void @@ -8199,6 +8247,11 @@ bxe_attn_int_deasserted0(struct bxe_softc *sc, val &= ~(attn & HW_INTERRUT_ASSERT_SET_0); REG_WR(sc, reg_offset, val); + + BXE_SET_ERROR_BIT(sc, BXE_ERR_MISC); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + bxe_panic(sc, ("FATAL HW block attention set0 0x%lx\n", (attn & HW_INTERRUT_ASSERT_SET_0))); } @@ -8228,10 +8281,12 @@ bxe_attn_int_deasserted(struct bxe_softc *sc, * In case of parity errors don't handle attentions so that * other function would "see" parity errors. */ - sc->recovery_state = BXE_RECOVERY_INIT; // XXX schedule a recovery task... /* disable HW interrupts */ bxe_int_disable(sc); + BXE_SET_ERROR_BIT(sc, BXE_ERR_PARITY); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); bxe_release_alr(sc); return; } @@ -12363,6 +12418,259 @@ bxe_periodic_stop(struct bxe_softc *sc) callout_drain(&sc->periodic_callout); } +void +bxe_parity_recover(struct bxe_softc *sc) +{ + uint8_t global = FALSE; + uint32_t error_recovered, error_unrecovered; + bool is_parity; + + + if ((sc->recovery_state == BXE_RECOVERY_FAILED) && + (sc->state == BXE_STATE_ERROR)) { + BLOGE(sc, "RECOVERY failed, " + "stack notified driver is NOT running! " + "Please reboot/power cycle the system.\n"); + return; + } + + while (1) { + BLOGD(sc, DBG_SP, + "%s sc=%p state=0x%x rec_state=0x%x error_status=%x\n", + __func__, sc, sc->state, sc->recovery_state, sc->error_status); + + switch(sc->recovery_state) { + + case BXE_RECOVERY_INIT: + is_parity = bxe_chk_parity_attn(sc, &global, FALSE); + + if ((CHIP_PORT_MODE(sc) == CHIP_4_PORT_MODE) || + (sc->error_status & BXE_ERR_MCP_ASSERT) || + (sc->error_status & BXE_ERR_GLOBAL)) { + + BXE_CORE_LOCK(sc); + if (sc->ifnet->if_drv_flags & IFF_DRV_RUNNING) { + bxe_periodic_stop(sc); + } + bxe_nic_unload(sc, UNLOAD_RECOVERY, false); + sc->state = BXE_STATE_ERROR; + sc->recovery_state = BXE_RECOVERY_FAILED; + BLOGE(sc, " No Recovery tried for error 0x%x" + " stack notified driver is NOT running!" + " Please reboot/power cycle the system.\n", + sc->error_status); + BXE_CORE_UNLOCK(sc); + return; + } + + + /* Try to get a LEADER_LOCK HW lock */ + if (bxe_trylock_leader_lock(sc)) { + + bxe_set_reset_in_progress(sc); + /* + * Check if there is a global attention and if + * there was a global attention, set the global + * reset bit. + */ + if (global) { + bxe_set_reset_global(sc); + } + sc->is_leader = 1; + } + + /* If interface has been removed - break */ + + if (sc->ifnet->if_drv_flags & IFF_DRV_RUNNING) { + bxe_periodic_stop(sc); + } + + BXE_CORE_LOCK(sc); + bxe_nic_unload(sc,UNLOAD_RECOVERY, false); + sc->recovery_state = BXE_RECOVERY_WAIT; + BXE_CORE_UNLOCK(sc); + + /* + * Ensure "is_leader", MCP command sequence and + * "recovery_state" update values are seen on other + * CPUs. + */ + mb(); + break; + case BXE_RECOVERY_WAIT: + + if (sc->is_leader) { + int other_engine = SC_PATH(sc) ? 0 : 1; + bool other_load_status = + bxe_get_load_status(sc, other_engine); + bool load_status = + bxe_get_load_status(sc, SC_PATH(sc)); + global = bxe_reset_is_global(sc); + + /* + * In case of a parity in a global block, let + * the first leader that performs a + * leader_reset() reset the global blocks in + * order to clear global attentions. Otherwise + * the gates will remain closed for that + * engine. + */ + if (load_status || + (global && other_load_status)) { + /* + * Wait until all other functions get + * down. + */ + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + return; + } else { + /* + * If all other functions got down + * try to bring the chip back to + * normal. In any case it's an exit + * point for a leader. + */ + if (bxe_leader_reset(sc)) { + BLOGE(sc, "RECOVERY failed, " + "stack notified driver is NOT running!\n"); + sc->recovery_state = BXE_RECOVERY_FAILED; + sc->state = BXE_STATE_ERROR; + mb(); + return; + } + + /* + * If we are here, means that the + * leader has succeeded and doesn't + * want to be a leader any more. Try + * to continue as a none-leader. + */ + break; + } + + } else { /* non-leader */ + if (!bxe_reset_is_done(sc, SC_PATH(sc))) { + /* + * Try to get a LEADER_LOCK HW lock as + * long as a former leader may have + * been unloaded by the user or + * released a leadership by another + * reason. + */ + if (bxe_trylock_leader_lock(sc)) { + /* + * I'm a leader now! Restart a + * switch case. + */ + sc->is_leader = 1; + break; + } + + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + return; + + } else { + /* + * If there was a global attention, wait + * for it to be cleared. + */ + if (bxe_reset_is_global(sc)) { + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); + return; + } + + error_recovered = + sc->eth_stats.recoverable_error; + error_unrecovered = + sc->eth_stats.unrecoverable_error; + BXE_CORE_LOCK(sc); + sc->recovery_state = + BXE_RECOVERY_NIC_LOADING; + if (bxe_nic_load(sc, LOAD_NORMAL)) { + error_unrecovered++; + sc->recovery_state = BXE_RECOVERY_FAILED; + sc->state = BXE_STATE_ERROR; + BLOGE(sc, "Recovery is NOT successfull, " + " state=0x%x recovery_state=0x%x error=%x\n", + sc->state, sc->recovery_state, sc->error_status); + sc->error_status = 0; + } else { + sc->recovery_state = + BXE_RECOVERY_DONE; + error_recovered++; + BLOGI(sc, "Recovery is successfull from errors %x," + " state=0x%x" + " recovery_state=0x%x \n", sc->error_status, + sc->state, sc->recovery_state); + mb(); + } + sc->error_status = 0; + BXE_CORE_UNLOCK(sc); + sc->eth_stats.recoverable_error = + error_recovered; + sc->eth_stats.unrecoverable_error = + error_unrecovered; + + return; + } + } + default: + return; + } + } +} +void +bxe_handle_error(struct bxe_softc * sc) +{ + + if(sc->recovery_state == BXE_RECOVERY_WAIT) { + return; + } + if(sc->error_status) { + if (sc->state == BXE_STATE_OPEN) { + bxe_int_disable(sc); + } + if (sc->link_vars.link_up) { + if_link_state_change(sc->ifnet, LINK_STATE_DOWN); + } + sc->recovery_state = BXE_RECOVERY_INIT; + BLOGI(sc, "bxe%d: Recovery started errors 0x%x recovery state 0x%x\n", + sc->unit, sc->error_status, sc->recovery_state); + bxe_parity_recover(sc); + } +} + +static void +bxe_sp_err_timeout_task(void *arg, int pending) +{ + + struct bxe_softc *sc = (struct bxe_softc *)arg; + + BLOGD(sc, DBG_SP, + "%s state = 0x%x rec state=0x%x error_status=%x\n", + __func__, sc->state, sc->recovery_state, sc->error_status); + + if((sc->recovery_state == BXE_RECOVERY_FAILED) && + (sc->state == BXE_STATE_ERROR)) { + return; + } + /* if can be taken */ + if ((sc->error_status) && (sc->trigger_grcdump)) { + bxe_grc_dump(sc); + } + if (sc->recovery_state != BXE_RECOVERY_DONE) { + bxe_handle_error(sc); + bxe_parity_recover(sc); + } else if (sc->error_status) { + bxe_handle_error(sc); + } + + return; +} + /* start the controller */ static __noinline int bxe_nic_load(struct bxe_softc *sc, @@ -12644,6 +12952,15 @@ bxe_init_locked(struct bxe_softc *sc) return (0); } + if((sc->state == BXE_STATE_ERROR) && + (sc->recovery_state == BXE_RECOVERY_FAILED)) { + BLOGE(sc, "Initialization not done, " + "as previous recovery failed." + "Reboot/Power-cycle the system\n" ); + return (ENXIO); + } + + bxe_set_power_state(sc, PCI_PM_D0); /* @@ -16042,6 +16359,10 @@ bxe_attach(device_t dev) taskqueue_start_threads(&sc->chip_tq, 1, PWAIT, /* lower priority */ "%s", sc->chip_tq_name); + TIMEOUT_TASK_INIT(taskqueue_thread, + &sc->sp_err_timeout_task, 0, bxe_sp_err_timeout_task, sc); + + /* get device info and set params */ if (bxe_get_device_info(sc) != 0) { BLOGE(sc, "getting device info\n"); @@ -16217,6 +16538,8 @@ bxe_detach(device_t dev) taskqueue_drain(sc->chip_tq, &sc->chip_tq_task); taskqueue_free(sc->chip_tq); sc->chip_tq = NULL; + taskqueue_drain_timeout(taskqueue_thread, + &sc->sp_err_timeout_task); } /* stop and reset the controller if it was open */ Modified: stable/9/sys/dev/bxe/bxe.h ============================================================================== --- stable/9/sys/dev/bxe/bxe.h Mon Oct 29 21:46:05 2018 (r339886) +++ stable/9/sys/dev/bxe/bxe.h Mon Oct 29 21:46:12 2018 (r339887) @@ -474,6 +474,10 @@ struct bxe_device_type #define BXE_FW_RX_ALIGN_END (1 << BXE_RX_ALIGN_SHIFT) #define BXE_PXP_DRAM_ALIGN (BXE_RX_ALIGN_SHIFT - 5) /* XXX ??? */ +#define BXE_SET_ERROR_BIT(sc, error) \ +{ \ + (sc)->error_status |= (error); \ +} struct bxe_bar { struct resource *resource; @@ -1387,6 +1391,8 @@ struct bxe_softc { struct taskqueue *chip_tq; char chip_tq_name[32]; + struct timeout_task sp_err_timeout_task; + /* slowpath interrupt taskqueue */ struct task sp_tq_task; struct taskqueue *sp_tq; @@ -1540,6 +1546,16 @@ struct bxe_softc { #define BXE_RECOVERY_WAIT 3 #define BXE_RECOVERY_FAILED 4 #define BXE_RECOVERY_NIC_LOADING 5 + +#define BXE_ERR_TXQ_STUCK 0x1 /* Tx queue stuck detected by driver. */ +#define BXE_ERR_MISC 0x2 /* MISC ERR */ +#define BXE_ERR_PARITY 0x4 /* Parity error detected. */ +#define BXE_ERR_STATS_TO 0x8 /* Statistics timeout detected. */ +#define BXE_ERR_MC_ASSERT 0x10 /* MC assert attention received. */ +#define BXE_ERR_PANIC 0x20 /* Driver asserted. */ +#define BXE_ERR_MCP_ASSERT 0x40 /* MCP assert attention received. No Recovery*/ +#define BXE_ERR_GLOBAL 0x80 /* PCIe/PXP/IGU/MISC/NIG device blocks error- needs PCIe/Fundamental reset */ + uint32_t error_status; uint32_t rx_mode; #define BXE_RX_MODE_NONE 0 Modified: stable/9/sys/dev/bxe/bxe_stats.c ============================================================================== --- stable/9/sys/dev/bxe/bxe_stats.c Mon Oct 29 21:46:05 2018 (r339886) +++ stable/9/sys/dev/bxe/bxe_stats.c Mon Oct 29 21:46:12 2018 (r339887) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #define BITS_PER_LONG 64 #endif -extern int bxe_grc_dump(struct bxe_softc *sc); static inline long bxe_hilo(uint32_t *hiref) @@ -236,11 +235,11 @@ bxe_stats_comp(struct bxe_softc *sc) while (*stats_comp != DMAE_COMP_VAL) { if (!cnt) { BLOGE(sc, "Timeout waiting for stats finished\n"); - if(sc->trigger_grcdump) { - /* taking grcdump */ - bxe_grc_dump(sc); - } + BXE_SET_ERROR_BIT(sc, BXE_ERR_STATS_TO); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); break; + } cnt--; @@ -923,6 +922,7 @@ bxe_hw_stats_update(struct bxe_softc *sc) nig_timer_max = SHMEM_RD(sc, port_mb[SC_PORT(sc)].stat_nig_timer); if (nig_timer_max != estats->nig_timer_max) { estats->nig_timer_max = nig_timer_max; + /*NOTE: not setting error bit */ BLOGE(sc, "invalid NIG timer max (%u)\n", estats->nig_timer_max); } @@ -1316,12 +1316,10 @@ bxe_stats_update(struct bxe_softc *sc) if (bxe_storm_stats_update(sc)) { if (sc->stats_pending++ == 3) { if (sc->ifnet->if_drv_flags & IFF_DRV_RUNNING) { - if(sc->trigger_grcdump) { - /* taking grcdump */ - bxe_grc_dump(sc); - } - atomic_store_rel_long(&sc->chip_tq_flags, CHIP_TQ_REINIT); - taskqueue_enqueue(sc->chip_tq, &sc->chip_tq_task); + BLOGE(sc, "Storm stats not updated for 3 times, resetting\n"); + BXE_SET_ERROR_BIT(sc, BXE_ERR_STATS_TO); + taskqueue_enqueue_timeout(taskqueue_thread, + &sc->sp_err_timeout_task, hz/10); } } return; From owner-svn-src-stable@freebsd.org Tue Oct 30 05:04:20 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCC1010D450E; Tue, 30 Oct 2018 05:04:19 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 843A1727B7; Tue, 30 Oct 2018 05:04:19 +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 6154A18EEB; Tue, 30 Oct 2018 05:04:19 +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 w9U54Jb8092814; Tue, 30 Oct 2018 05:04:19 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9U54J1I092813; Tue, 30 Oct 2018 05:04:19 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810300504.w9U54J1I092813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 30 Oct 2018 05:04:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339905 - stable/12/sys/dev/cxgbe X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe X-SVN-Commit-Revision: 339905 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 05:04:20 -0000 Author: np Date: Tue Oct 30 05:04:18 2018 New Revision: 339905 URL: https://svnweb.freebsd.org/changeset/base/339905 Log: MFC r339626: cxgbe(4): Use automatic cidx updates with ofld and ctrl queues. The bits that explicitly request cidx updates do not work reliably with all possible WRs that can be sent over the queue. The F_FW_WR_EQUIQ requests that still remain may also have to be replaced with explicit credit flush WRs in the future. Approved by: re@ (rgrimes@) Sponsored by: Chelsio Communications Modified: stable/12/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_sge.c Tue Oct 30 02:37:23 2018 (r339904) +++ stable/12/sys/dev/cxgbe/t4_sge.c Tue Oct 30 05:04:18 2018 (r339905) @@ -2089,12 +2089,13 @@ drain_wrq_wr_list(struct adapter *sc, struct sge_wrq * if (available < eq->sidx / 4 && atomic_cmpset_int(&eq->equiq, 0, 1)) { + /* + * XXX: This is not 100% reliable with some + * types of WRs. But this is a very unusual + * situation for an ofld/ctrl queue anyway. + */ dst->equiq_to_len16 |= htobe32(F_FW_WR_EQUIQ | F_FW_WR_EQUEQ); - eq->equeqidx = eq->pidx; - } else if (IDXDIFF(eq->pidx, eq->equeqidx, eq->sidx) >= 32) { - dst->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ); - eq->equeqidx = eq->pidx; } dbdiff += n; @@ -2644,12 +2645,13 @@ commit_wrq_wr(struct sge_wrq *wrq, void *w, struct wrq available = IDXDIFF(eq->cidx, eq->pidx, eq->sidx) - 1; if (available < eq->sidx / 4 && atomic_cmpset_int(&eq->equiq, 0, 1)) { + /* + * XXX: This is not 100% reliable with some + * types of WRs. But this is a very unusual + * situation for an ofld/ctrl queue anyway. + */ dst->equiq_to_len16 |= htobe32(F_FW_WR_EQUIQ | F_FW_WR_EQUEQ); - eq->equeqidx = pidx; - } else if (IDXDIFF(eq->pidx, eq->equeqidx, eq->sidx) >= 32) { - dst->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ); - eq->equeqidx = pidx; } ring_eq_db(wrq->adapter, eq, ndesc); @@ -3584,6 +3586,23 @@ free_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_ } #endif +/* + * Returns a reasonable automatic cidx flush threshold for a given queue size. + */ +static u_int +qsize_to_fthresh(int qsize) +{ + u_int fthresh; + + while (!powerof2(qsize)) + qsize++; + fthresh = ilog2(qsize); + if (fthresh > X_CIDXFLUSHTHRESH_128) + fthresh = X_CIDXFLUSHTHRESH_128; + + return (fthresh); +} + static int ctrl_eq_alloc(struct adapter *sc, struct sge_eq *eq) { @@ -3607,7 +3626,7 @@ ctrl_eq_alloc(struct adapter *sc, struct sge_eq *eq) c.dcaen_to_eqsize = htobe32(V_FW_EQ_CTRL_CMD_FBMIN(X_FETCHBURSTMIN_64B) | V_FW_EQ_CTRL_CMD_FBMAX(X_FETCHBURSTMAX_512B) | - V_FW_EQ_CTRL_CMD_CIDXFTHRESH(X_CIDXFLUSHTHRESH_32) | + V_FW_EQ_CTRL_CMD_CIDXFTHRESH(qsize_to_fthresh(qsize)) | V_FW_EQ_CTRL_CMD_EQSIZE(qsize)); c.eqaddr = htobe64(eq->ba); @@ -3689,12 +3708,13 @@ ofld_eq_alloc(struct adapter *sc, struct vi_info *vi, c.alloc_to_len16 = htonl(F_FW_EQ_OFLD_CMD_ALLOC | F_FW_EQ_OFLD_CMD_EQSTART | FW_LEN16(c)); c.fetchszm_to_iqid = - htonl(V_FW_EQ_OFLD_CMD_HOSTFCMODE(X_HOSTFCMODE_NONE) | + htonl(V_FW_EQ_OFLD_CMD_HOSTFCMODE(X_HOSTFCMODE_STATUS_PAGE) | V_FW_EQ_OFLD_CMD_PCIECHN(eq->tx_chan) | F_FW_EQ_OFLD_CMD_FETCHRO | V_FW_EQ_OFLD_CMD_IQID(eq->iqid)); c.dcaen_to_eqsize = htobe32(V_FW_EQ_OFLD_CMD_FBMIN(X_FETCHBURSTMIN_64B) | V_FW_EQ_OFLD_CMD_FBMAX(X_FETCHBURSTMAX_512B) | + V_FW_EQ_OFLD_CMD_CIDXFTHRESH(qsize_to_fthresh(qsize)) | V_FW_EQ_OFLD_CMD_EQSIZE(qsize)); c.eqaddr = htobe64(eq->ba); @@ -3732,8 +3752,9 @@ alloc_eq(struct adapter *sc, struct vi_info *vi, struc if (rc) return (rc); - eq->pidx = eq->cidx = 0; - eq->equeqidx = eq->dbidx = 0; + eq->pidx = eq->cidx = eq->dbidx = 0; + /* Note that equeqidx is not used with sge_wrq (OFLD/CTRL) queues. */ + eq->equeqidx = 0; eq->doorbells = sc->doorbells; switch (eq->flags & EQ_TYPEMASK) { From owner-svn-src-stable@freebsd.org Tue Oct 30 08:36:38 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBE9110DB0DB; Tue, 30 Oct 2018 08:36:37 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A0F1277C40; Tue, 30 Oct 2018 08:36:37 +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 8316C1B09F; Tue, 30 Oct 2018 08:36:37 +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 w9U8abvV000253; Tue, 30 Oct 2018 08:36:37 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9U8abSf000249; Tue, 30 Oct 2018 08:36:37 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201810300836.w9U8abSf000249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 30 Oct 2018 08:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339906 - in stable/12/sys: conf dev/netmap net X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in stable/12/sys: conf dev/netmap net X-SVN-Commit-Revision: 339906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 08:36:38 -0000 Author: vmaffione Date: Tue Oct 30 08:36:36 2018 New Revision: 339906 URL: https://svnweb.freebsd.org/changeset/base/339906 Log: MFC r339639: netmap: align codebase to the current upstream (sha 8374e1a7e6941) Changelist: - Move large parts of VALE code to a new file and header netmap_bdg.[ch]. This is useful to reuse the code within upcoming projects. - Improvements and bug fixes to pipes and monitors. - Introduce nm_os_onattach(), nm_os_onenter() and nm_os_onexit() to handle differences between FreeBSD and Linux. - Introduce some new helper functions to handle more host rings and fake rings (netmap_all_rings(), netmap_real_rings(), ...) - Added new sysctl to enable/disable hw checksum in emulated netmap mode. - nm_inject: add support for NS_MOREFRAG Approved by: re (gjb) Added: stable/12/sys/dev/netmap/netmap_bdg.c - copied unchanged from r339639, head/sys/dev/netmap/netmap_bdg.c stable/12/sys/dev/netmap/netmap_bdg.h - copied unchanged from r339639, head/sys/dev/netmap/netmap_bdg.h Modified: stable/12/sys/conf/files stable/12/sys/dev/netmap/netmap.c stable/12/sys/dev/netmap/netmap_freebsd.c stable/12/sys/dev/netmap/netmap_generic.c stable/12/sys/dev/netmap/netmap_kern.h stable/12/sys/dev/netmap/netmap_mem2.c stable/12/sys/dev/netmap/netmap_monitor.c stable/12/sys/dev/netmap/netmap_pipe.c stable/12/sys/dev/netmap/netmap_vale.c stable/12/sys/net/netmap.h stable/12/sys/net/netmap_user.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Tue Oct 30 05:04:18 2018 (r339905) +++ stable/12/sys/conf/files Tue Oct 30 08:36:36 2018 (r339906) @@ -2544,6 +2544,7 @@ dev/netmap/netmap_pipe.c optional netmap dev/netmap/netmap_pt.c optional netmap dev/netmap/netmap_vale.c optional netmap dev/netmap/netmap_legacy.c optional netmap +dev/netmap/netmap_bdg.c optional netmap # compile-with "${NORMAL_C} -Wconversion -Wextra" dev/nfsmb/nfsmb.c optional nfsmb pci dev/nge/if_nge.c optional nge Modified: stable/12/sys/dev/netmap/netmap.c ============================================================================== --- stable/12/sys/dev/netmap/netmap.c Tue Oct 30 05:04:18 2018 (r339905) +++ stable/12/sys/dev/netmap/netmap.c Tue Oct 30 08:36:36 2018 (r339906) @@ -521,6 +521,9 @@ int netmap_generic_txqdisc = 1; int netmap_generic_ringsize = 1024; int netmap_generic_rings = 1; +/* Non-zero to enable checksum offloading in NIC drivers */ +int netmap_generic_hwcsum = 0; + /* Non-zero if ptnet devices are allowed to use virtio-net headers. */ int ptnet_vnet_hdr = 1; @@ -549,6 +552,9 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, fwd, CTLFLAG_RW, &ne SYSCTL_INT(_dev_netmap, OID_AUTO, admode, CTLFLAG_RW, &netmap_admode, 0, "Adapter mode. 0 selects the best option available," "1 forces native adapter, 2 forces emulated adapter"); +SYSCTL_INT(_dev_netmap, OID_AUTO, generic_hwcsum, CTLFLAG_RW, &netmap_generic_hwcsum, + 0, "Hardware checksums. 0 to disable checksum generation by the NIC (default)," + "1 to enable checksum generation by the NIC"); SYSCTL_INT(_dev_netmap, OID_AUTO, generic_mit, CTLFLAG_RW, &netmap_generic_mit, 0, "RX notification interval in nanoseconds"); SYSCTL_INT(_dev_netmap, OID_AUTO, generic_ringsize, CTLFLAG_RW, @@ -827,8 +833,8 @@ netmap_krings_create(struct netmap_adapter *na, u_int } /* account for the (possibly fake) host rings */ - n[NR_TX] = na->num_tx_rings + 1; - n[NR_RX] = na->num_rx_rings + 1; + n[NR_TX] = netmap_all_rings(na, NR_TX); + n[NR_RX] = netmap_all_rings(na, NR_RX); len = (n[NR_TX] + n[NR_RX]) * (sizeof(struct netmap_kring) + sizeof(struct netmap_kring *)) @@ -930,11 +936,14 @@ netmap_krings_delete(struct netmap_adapter *na) void netmap_hw_krings_delete(struct netmap_adapter *na) { - struct mbq *q = &na->rx_rings[na->num_rx_rings]->rx_queue; + u_int lim = netmap_real_rings(na, NR_RX), i; - ND("destroy sw mbq with len %d", mbq_len(q)); - mbq_purge(q); - mbq_safe_fini(q); + for (i = nma_get_nrings(na, NR_RX); i < lim; i++) { + struct mbq *q = &NMR(na, NR_RX)[i]->rx_queue; + ND("destroy sw mbq with len %d", mbq_len(q)); + mbq_purge(q); + mbq_safe_fini(q); + } netmap_krings_delete(na); } @@ -1535,7 +1544,7 @@ netmap_get_na(struct nmreq_header *hdr, goto out; /* try to see if this is a bridge port */ - error = netmap_get_bdg_na(hdr, na, nmd, create); + error = netmap_get_vale_na(hdr, na, nmd, create); if (error) goto out; @@ -1827,7 +1836,7 @@ netmap_interp_ringid(struct netmap_priv_d *priv, uint3 } priv->np_qfirst[t] = (nr_mode == NR_REG_SW ? nma_get_nrings(na, t) : 0); - priv->np_qlast[t] = nma_get_nrings(na, t) + 1; + priv->np_qlast[t] = netmap_all_rings(na, t); ND("%s: %s %d %d", nr_mode == NR_REG_SW ? "SW" : "NIC+SW", nm_txrx2str(t), priv->np_qfirst[t], priv->np_qlast[t]); @@ -2543,7 +2552,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c NMG_LOCK(); hdr->nr_reqtype = NETMAP_REQ_REGISTER; hdr->nr_body = (uintptr_t)®req; - error = netmap_get_bdg_na(hdr, &na, NULL, 0); + error = netmap_get_vale_na(hdr, &na, NULL, 0); hdr->nr_reqtype = NETMAP_REQ_PORT_HDR_SET; hdr->nr_body = (uintptr_t)req; if (na && !error) { @@ -3336,6 +3345,12 @@ netmap_attach_common(struct netmap_adapter *na) } na->pdev = na; /* make sure netmap_mem_map() is called */ #endif /* __FreeBSD__ */ + if (na->na_flags & NAF_HOST_RINGS) { + if (na->num_host_rx_rings == 0) + na->num_host_rx_rings = 1; + if (na->num_host_tx_rings == 0) + na->num_host_tx_rings = 1; + } if (na->nm_krings_create == NULL) { /* we assume that we have been called by a driver, * since other port types all provide their own @@ -3357,7 +3372,7 @@ netmap_attach_common(struct netmap_adapter *na) /* no special nm_bdg_attach callback. On VALE * attach, we need to interpose a bwrap */ - na->nm_bdg_attach = netmap_bwrap_attach; + na->nm_bdg_attach = netmap_default_bdg_attach; #endif return 0; @@ -3399,10 +3414,10 @@ out: static void netmap_hw_dtor(struct netmap_adapter *na) { - if (nm_iszombie(na) || na->ifp == NULL) + if (na->ifp == NULL) return; - WNA(na->ifp) = NULL; + NM_DETACH_NA(na->ifp); } @@ -3426,10 +3441,10 @@ netmap_attach_ext(struct netmap_adapter *arg, size_t s } if (arg == NULL || arg->ifp == NULL) - goto fail; + return EINVAL; ifp = arg->ifp; - if (NA(ifp) && !NM_NA_VALID(ifp)) { + if (NM_NA_CLASH(ifp)) { /* If NA(ifp) is not null but there is no valid netmap * adapter it means that someone else is using the same * pointer (e.g. ax25_ptr on linux). This happens for @@ -3456,28 +3471,8 @@ netmap_attach_ext(struct netmap_adapter *arg, size_t s NM_ATTACH_NA(ifp, &hwna->up); -#ifdef linux - if (ifp->netdev_ops) { - /* prepare a clone of the netdev ops */ -#ifndef NETMAP_LINUX_HAVE_NETDEV_OPS - hwna->nm_ndo.ndo_start_xmit = ifp->netdev_ops; -#else - hwna->nm_ndo = *ifp->netdev_ops; -#endif /* NETMAP_LINUX_HAVE_NETDEV_OPS */ - } - hwna->nm_ndo.ndo_start_xmit = linux_netmap_start_xmit; - hwna->nm_ndo.ndo_change_mtu = linux_netmap_change_mtu; - if (ifp->ethtool_ops) { - hwna->nm_eto = *ifp->ethtool_ops; - } - hwna->nm_eto.set_ringparam = linux_netmap_set_ringparam; -#ifdef NETMAP_LINUX_HAVE_SET_CHANNELS - hwna->nm_eto.set_channels = linux_netmap_set_channels; -#endif /* NETMAP_LINUX_HAVE_SET_CHANNELS */ - if (arg->nm_config == NULL) { - hwna->up.nm_config = netmap_linux_config; - } -#endif /* linux */ + nm_os_onattach(ifp); + if (arg->nm_dtor == NULL) { hwna->up.nm_dtor = netmap_hw_dtor; } @@ -3545,7 +3540,10 @@ netmap_hw_krings_create(struct netmap_adapter *na) int ret = netmap_krings_create(na, 0); if (ret == 0) { /* initialize the mbq for the sw rx ring */ - mbq_safe_init(&na->rx_rings[na->num_rx_rings]->rx_queue); + u_int lim = netmap_real_rings(na, NR_RX), i; + for (i = na->num_rx_rings; i < lim; i++) { + mbq_safe_init(&NMR(na, NR_RX)[i]->rx_queue); + } ND("initialized sw rx queue %d", na->num_rx_rings); } return ret; @@ -3608,8 +3606,14 @@ netmap_transmit(struct ifnet *ifp, struct mbuf *m) unsigned int txr; struct mbq *q; int busy; + u_int i; - kring = na->rx_rings[na->num_rx_rings]; + i = MBUF_TXQ(m); + if (i >= na->num_host_rx_rings) { + i = i % na->num_host_rx_rings; + } + kring = NMR(na, NR_RX)[nma_get_nrings(na, NR_RX) + i]; + // XXX [Linux] we do not need this lock // if we follow the down/configure/up protocol -gl // mtx_lock(&na->core_lock); @@ -3639,8 +3643,15 @@ netmap_transmit(struct ifnet *ifp, struct mbuf *m) goto done; } - if (nm_os_mbuf_has_offld(m)) { - RD(1, "%s drop mbuf that needs offloadings", na->name); + if (!netmap_generic_hwcsum) { + if (nm_os_mbuf_has_csum_offld(m)) { + RD(1, "%s drop mbuf that needs checksum offload", na->name); + goto done; + } + } + + if (nm_os_mbuf_has_seg_offld(m)) { + RD(1, "%s drop mbuf that needs generic segmentation offload", na->name); goto done; } @@ -3843,6 +3854,40 @@ netmap_rx_irq(struct ifnet *ifp, u_int q, u_int *work_ } return netmap_common_irq(na, q, work_done); +} + +/* set/clear native flags and if_transmit/netdev_ops */ +void +nm_set_native_flags(struct netmap_adapter *na) +{ + struct ifnet *ifp = na->ifp; + + /* We do the setup for intercepting packets only if we are the + * first user of this adapapter. */ + if (na->active_fds > 0) { + return; + } + + na->na_flags |= NAF_NETMAP_ON; + nm_os_onenter(ifp); + nm_update_hostrings_mode(na); +} + +void +nm_clear_native_flags(struct netmap_adapter *na) +{ + struct ifnet *ifp = na->ifp; + + /* We undo the setup for intercepting packets only if we are the + * last user of this adapapter. */ + if (na->active_fds > 0) { + return; + } + + nm_update_hostrings_mode(na); + nm_os_onexit(ifp); + + na->na_flags &= ~NAF_NETMAP_ON; } Copied: stable/12/sys/dev/netmap/netmap_bdg.c (from r339639, head/sys/dev/netmap/netmap_bdg.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/dev/netmap/netmap_bdg.c Tue Oct 30 08:36:36 2018 (r339906, copy of r339639, head/sys/dev/netmap/netmap_bdg.c) @@ -0,0 +1,1827 @@ +/* + * Copyright (C) 2013-2016 Universita` di Pisa + * 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. + */ + + +/* + * This module implements the VALE switch for netmap + +--- VALE SWITCH --- + +NMG_LOCK() serializes all modifications to switches and ports. +A switch cannot be deleted until all ports are gone. + +For each switch, an SX lock (RWlock on linux) protects +deletion of ports. When configuring or deleting a new port, the +lock is acquired in exclusive mode (after holding NMG_LOCK). +When forwarding, the lock is acquired in shared mode (without NMG_LOCK). +The lock is held throughout the entire forwarding cycle, +during which the thread may incur in a page fault. +Hence it is important that sleepable shared locks are used. + +On the rx ring, the per-port lock is grabbed initially to reserve +a number of slot in the ring, then the lock is released, +packets are copied from source to destination, and then +the lock is acquired again and the receive ring is updated. +(A similar thing is done on the tx ring for NIC and host stack +ports attached to the switch) + + */ + +/* + * OS-specific code that is used only within this file. + * Other OS-specific code that must be accessed by drivers + * is present in netmap_kern.h + */ + +#if defined(__FreeBSD__) +#include /* prerequisite */ +__FBSDID("$FreeBSD$"); + +#include +#include +#include /* defines used in kernel.h */ +#include /* types used in module initialization */ +#include /* cdevsw struct, UID, GID */ +#include +#include /* struct socket */ +#include +#include +#include +#include /* sockaddrs */ +#include +#include +#include +#include +#include /* BIOCIMMEDIATE */ +#include /* bus_dmamap_* */ +#include +#include +#include + + +#elif defined(linux) + +#include "bsd_glue.h" + +#elif defined(__APPLE__) + +#warning OSX support is only partial +#include "osx_glue.h" + +#elif defined(_WIN32) +#include "win_glue.h" + +#else + +#error Unsupported platform + +#endif /* unsupported */ + +/* + * common headers + */ + +#include +#include +#include + +#include + +const char* +netmap_bdg_name(struct netmap_vp_adapter *vp) +{ + struct nm_bridge *b = vp->na_bdg; + if (b == NULL) + return NULL; + return b->bdg_basename; +} + + +#ifndef CONFIG_NET_NS +/* + * XXX in principle nm_bridges could be created dynamically + * Right now we have a static array and deletions are protected + * by an exclusive lock. + */ +static struct nm_bridge *nm_bridges; +#endif /* !CONFIG_NET_NS */ + + +static int +nm_is_id_char(const char c) +{ + return (c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || + (c == '_'); +} + +/* Validate the name of a VALE bridge port and return the + * position of the ":" character. */ +static int +nm_vale_name_validate(const char *name) +{ + int colon_pos = -1; + int i; + + if (!name || strlen(name) < strlen(NM_BDG_NAME)) { + return -1; + } + + for (i = 0; i < NM_BDG_IFNAMSIZ && name[i]; i++) { + if (name[i] == ':') { + colon_pos = i; + break; + } else if (!nm_is_id_char(name[i])) { + return -1; + } + } + + if (strlen(name) - colon_pos > IFNAMSIZ) { + /* interface name too long */ + return -1; + } + + return colon_pos; +} + +/* + * locate a bridge among the existing ones. + * MUST BE CALLED WITH NMG_LOCK() + * + * a ':' in the name terminates the bridge name. Otherwise, just NM_NAME. + * We assume that this is called with a name of at least NM_NAME chars. + */ +struct nm_bridge * +nm_find_bridge(const char *name, int create, struct netmap_bdg_ops *ops) +{ + int i, namelen; + struct nm_bridge *b = NULL, *bridges; + u_int num_bridges; + + NMG_LOCK_ASSERT(); + + netmap_bns_getbridges(&bridges, &num_bridges); + + namelen = nm_vale_name_validate(name); + if (namelen < 0) { + D("invalid bridge name %s", name ? name : NULL); + return NULL; + } + + /* lookup the name, remember empty slot if there is one */ + for (i = 0; i < num_bridges; i++) { + struct nm_bridge *x = bridges + i; + + if ((x->bdg_flags & NM_BDG_ACTIVE) + x->bdg_active_ports == 0) { + if (create && b == NULL) + b = x; /* record empty slot */ + } else if (x->bdg_namelen != namelen) { + continue; + } else if (strncmp(name, x->bdg_basename, namelen) == 0) { + ND("found '%.*s' at %d", namelen, name, i); + b = x; + break; + } + } + if (i == num_bridges && b) { /* name not found, can create entry */ + /* initialize the bridge */ + ND("create new bridge %s with ports %d", b->bdg_basename, + b->bdg_active_ports); + b->ht = nm_os_malloc(sizeof(struct nm_hash_ent) * NM_BDG_HASH); + if (b->ht == NULL) { + D("failed to allocate hash table"); + return NULL; + } + strncpy(b->bdg_basename, name, namelen); + b->bdg_namelen = namelen; + b->bdg_active_ports = 0; + for (i = 0; i < NM_BDG_MAXPORTS; i++) + b->bdg_port_index[i] = i; + /* set the default function */ + b->bdg_ops = ops; + b->private_data = b->ht; + b->bdg_flags = 0; + NM_BNS_GET(b); + } + return b; +} + + +int +netmap_bdg_free(struct nm_bridge *b) +{ + if ((b->bdg_flags & NM_BDG_ACTIVE) + b->bdg_active_ports != 0) { + return EBUSY; + } + + ND("marking bridge %s as free", b->bdg_basename); + nm_os_free(b->ht); + b->bdg_ops = NULL; + b->bdg_flags = 0; + NM_BNS_PUT(b); + return 0; +} + + +/* remove from bridge b the ports in slots hw and sw + * (sw can be -1 if not needed) + */ +void +netmap_bdg_detach_common(struct nm_bridge *b, int hw, int sw) +{ + int s_hw = hw, s_sw = sw; + int i, lim =b->bdg_active_ports; + uint32_t *tmp = b->tmp_bdg_port_index; + + /* + New algorithm: + make a copy of bdg_port_index; + lookup NA(ifp)->bdg_port and SWNA(ifp)->bdg_port + in the array of bdg_port_index, replacing them with + entries from the bottom of the array; + decrement bdg_active_ports; + acquire BDG_WLOCK() and copy back the array. + */ + + if (netmap_verbose) + D("detach %d and %d (lim %d)", hw, sw, lim); + /* make a copy of the list of active ports, update it, + * and then copy back within BDG_WLOCK(). + */ + memcpy(b->tmp_bdg_port_index, b->bdg_port_index, sizeof(b->tmp_bdg_port_index)); + for (i = 0; (hw >= 0 || sw >= 0) && i < lim; ) { + if (hw >= 0 && tmp[i] == hw) { + ND("detach hw %d at %d", hw, i); + lim--; /* point to last active port */ + tmp[i] = tmp[lim]; /* swap with i */ + tmp[lim] = hw; /* now this is inactive */ + hw = -1; + } else if (sw >= 0 && tmp[i] == sw) { + ND("detach sw %d at %d", sw, i); + lim--; + tmp[i] = tmp[lim]; + tmp[lim] = sw; + sw = -1; + } else { + i++; + } + } + if (hw >= 0 || sw >= 0) { + D("XXX delete failed hw %d sw %d, should panic...", hw, sw); + } + + BDG_WLOCK(b); + if (b->bdg_ops->dtor) + b->bdg_ops->dtor(b->bdg_ports[s_hw]); + b->bdg_ports[s_hw] = NULL; + if (s_sw >= 0) { + b->bdg_ports[s_sw] = NULL; + } + memcpy(b->bdg_port_index, b->tmp_bdg_port_index, sizeof(b->tmp_bdg_port_index)); + b->bdg_active_ports = lim; + BDG_WUNLOCK(b); + + ND("now %d active ports", lim); + netmap_bdg_free(b); +} + + +/* nm_bdg_ctl callback for VALE ports */ +int +netmap_vp_bdg_ctl(struct nmreq_header *hdr, struct netmap_adapter *na) +{ + struct netmap_vp_adapter *vpna = (struct netmap_vp_adapter *)na; + struct nm_bridge *b = vpna->na_bdg; + + if (hdr->nr_reqtype == NETMAP_REQ_VALE_ATTACH) { + return 0; /* nothing to do */ + } + if (b) { + netmap_set_all_rings(na, 0 /* disable */); + netmap_bdg_detach_common(b, vpna->bdg_port, -1); + vpna->na_bdg = NULL; + netmap_set_all_rings(na, 1 /* enable */); + } + /* I have took reference just for attach */ + netmap_adapter_put(na); + return 0; +} + +int +netmap_default_bdg_attach(const char *name, struct netmap_adapter *na, + struct nm_bridge *b) +{ + return NM_NEED_BWRAP; +} + +/* Try to get a reference to a netmap adapter attached to a VALE switch. + * If the adapter is found (or is created), this function returns 0, a + * non NULL pointer is returned into *na, and the caller holds a + * reference to the adapter. + * If an adapter is not found, then no reference is grabbed and the + * function returns an error code, or 0 if there is just a VALE prefix + * mismatch. Therefore the caller holds a reference when + * (*na != NULL && return == 0). + */ +int +netmap_get_bdg_na(struct nmreq_header *hdr, struct netmap_adapter **na, + struct netmap_mem_d *nmd, int create, struct netmap_bdg_ops *ops) +{ + char *nr_name = hdr->nr_name; + const char *ifname; + struct ifnet *ifp = NULL; + int error = 0; + struct netmap_vp_adapter *vpna, *hostna = NULL; + struct nm_bridge *b; + uint32_t i, j; + uint32_t cand = NM_BDG_NOPORT, cand2 = NM_BDG_NOPORT; + int needed; + + *na = NULL; /* default return value */ + + /* first try to see if this is a bridge port. */ + NMG_LOCK_ASSERT(); + if (strncmp(nr_name, ops->name, strlen(ops->name) - 1)) { + return 0; /* no error, but no VALE prefix */ + } + + b = nm_find_bridge(nr_name, create, ops); + if (b == NULL) { + ND("no bridges available for '%s'", nr_name); + return (create ? ENOMEM : ENXIO); + } + if (strlen(nr_name) < b->bdg_namelen) /* impossible */ + panic("x"); + + /* Now we are sure that name starts with the bridge's name, + * lookup the port in the bridge. We need to scan the entire + * list. It is not important to hold a WLOCK on the bridge + * during the search because NMG_LOCK already guarantees + * that there are no other possible writers. + */ + + /* lookup in the local list of ports */ + for (j = 0; j < b->bdg_active_ports; j++) { + i = b->bdg_port_index[j]; + vpna = b->bdg_ports[i]; + ND("checking %s", vpna->up.name); + if (!strcmp(vpna->up.name, nr_name)) { + netmap_adapter_get(&vpna->up); + ND("found existing if %s refs %d", nr_name) + *na = &vpna->up; + return 0; + } + } + /* not found, should we create it? */ + if (!create) + return ENXIO; + /* yes we should, see if we have space to attach entries */ + needed = 2; /* in some cases we only need 1 */ + if (b->bdg_active_ports + needed >= NM_BDG_MAXPORTS) { + D("bridge full %d, cannot create new port", b->bdg_active_ports); + return ENOMEM; + } + /* record the next two ports available, but do not allocate yet */ + cand = b->bdg_port_index[b->bdg_active_ports]; + cand2 = b->bdg_port_index[b->bdg_active_ports + 1]; + ND("+++ bridge %s port %s used %d avail %d %d", + b->bdg_basename, ifname, b->bdg_active_ports, cand, cand2); + + /* + * try see if there is a matching NIC with this name + * (after the bridge's name) + */ + ifname = nr_name + b->bdg_namelen + 1; + ifp = ifunit_ref(ifname); + if (!ifp) { + /* Create an ephemeral virtual port. + * This block contains all the ephemeral-specific logic. + */ + + if (hdr->nr_reqtype != NETMAP_REQ_REGISTER) { + error = EINVAL; + goto out; + } + + /* bdg_netmap_attach creates a struct netmap_adapter */ + error = b->bdg_ops->vp_create(hdr, NULL, nmd, &vpna); + if (error) { + D("error %d", error); + goto out; + } + /* shortcut - we can skip get_hw_na(), + * ownership check and nm_bdg_attach() + */ + + } else { + struct netmap_adapter *hw; + + /* the vale:nic syntax is only valid for some commands */ + switch (hdr->nr_reqtype) { + case NETMAP_REQ_VALE_ATTACH: + case NETMAP_REQ_VALE_DETACH: + case NETMAP_REQ_VALE_POLLING_ENABLE: + case NETMAP_REQ_VALE_POLLING_DISABLE: + break; /* ok */ + default: + error = EINVAL; + goto out; + } + + error = netmap_get_hw_na(ifp, nmd, &hw); + if (error || hw == NULL) + goto out; + + /* host adapter might not be created */ + error = hw->nm_bdg_attach(nr_name, hw, b); + if (error == NM_NEED_BWRAP) { + error = b->bdg_ops->bwrap_attach(nr_name, hw); + } + if (error) + goto out; + vpna = hw->na_vp; + hostna = hw->na_hostvp; + if (hdr->nr_reqtype == NETMAP_REQ_VALE_ATTACH) { + /* Check if we need to skip the host rings. */ + struct nmreq_vale_attach *areq = + (struct nmreq_vale_attach *)(uintptr_t)hdr->nr_body; + if (areq->reg.nr_mode != NR_REG_NIC_SW) { + hostna = NULL; + } + } + } + + BDG_WLOCK(b); + vpna->bdg_port = cand; + ND("NIC %p to bridge port %d", vpna, cand); + /* bind the port to the bridge (virtual ports are not active) */ + b->bdg_ports[cand] = vpna; + vpna->na_bdg = b; + b->bdg_active_ports++; + if (hostna != NULL) { + /* also bind the host stack to the bridge */ + b->bdg_ports[cand2] = hostna; + hostna->bdg_port = cand2; + hostna->na_bdg = b; + b->bdg_active_ports++; + ND("host %p to bridge port %d", hostna, cand2); + } + ND("if %s refs %d", ifname, vpna->up.na_refcount); + BDG_WUNLOCK(b); + *na = &vpna->up; + netmap_adapter_get(*na); + +out: + if (ifp) + if_rele(ifp); + + return error; +} + +/* Process NETMAP_REQ_VALE_ATTACH. + */ +int +nm_bdg_ctl_attach(struct nmreq_header *hdr, void *auth_token) +{ + struct nmreq_vale_attach *req = + (struct nmreq_vale_attach *)(uintptr_t)hdr->nr_body; + struct netmap_vp_adapter * vpna; + struct netmap_adapter *na = NULL; + struct netmap_mem_d *nmd = NULL; + struct nm_bridge *b = NULL; + int error; + + NMG_LOCK(); + /* permission check for modified bridges */ + b = nm_find_bridge(hdr->nr_name, 0 /* don't create */, NULL); + if (b && !nm_bdg_valid_auth_token(b, auth_token)) { + error = EACCES; + goto unlock_exit; + } + + if (req->reg.nr_mem_id) { + nmd = netmap_mem_find(req->reg.nr_mem_id); + if (nmd == NULL) { + error = EINVAL; + goto unlock_exit; + } + } + + /* check for existing one */ + error = netmap_get_vale_na(hdr, &na, nmd, 0); + if (na) { + error = EBUSY; + goto unref_exit; + } + error = netmap_get_vale_na(hdr, &na, + nmd, 1 /* create if not exists */); + if (error) { /* no device */ + goto unlock_exit; + } + + if (na == NULL) { /* VALE prefix missing */ + error = EINVAL; + goto unlock_exit; + } + + if (NETMAP_OWNED_BY_ANY(na)) { + error = EBUSY; + goto unref_exit; + } + + if (na->nm_bdg_ctl) { + /* nop for VALE ports. The bwrap needs to put the hwna + * in netmap mode (see netmap_bwrap_bdg_ctl) + */ + error = na->nm_bdg_ctl(hdr, na); + if (error) + goto unref_exit; + ND("registered %s to netmap-mode", na->name); + } + vpna = (struct netmap_vp_adapter *)na; + req->port_index = vpna->bdg_port; + NMG_UNLOCK(); + return 0; + +unref_exit: + netmap_adapter_put(na); +unlock_exit: + NMG_UNLOCK(); + return error; +} + +static inline int +nm_is_bwrap(struct netmap_adapter *na) +{ + return na->nm_register == netmap_bwrap_reg; +} + +/* Process NETMAP_REQ_VALE_DETACH. + */ +int +nm_bdg_ctl_detach(struct nmreq_header *hdr, void *auth_token) +{ + struct nmreq_vale_detach *nmreq_det = (void *)(uintptr_t)hdr->nr_body; + struct netmap_vp_adapter *vpna; + struct netmap_adapter *na; + struct nm_bridge *b = NULL; + int error; + + NMG_LOCK(); + /* permission check for modified bridges */ + b = nm_find_bridge(hdr->nr_name, 0 /* don't create */, NULL); + if (b && !nm_bdg_valid_auth_token(b, auth_token)) { + error = EACCES; + goto unlock_exit; + } + + error = netmap_get_vale_na(hdr, &na, NULL, 0 /* don't create */); + if (error) { /* no device, or another bridge or user owns the device */ + goto unlock_exit; + } + + if (na == NULL) { /* VALE prefix missing */ + error = EINVAL; + goto unlock_exit; + } else if (nm_is_bwrap(na) && + ((struct netmap_bwrap_adapter *)na)->na_polling_state) { + /* Don't detach a NIC with polling */ + error = EBUSY; + goto unref_exit; + } + + vpna = (struct netmap_vp_adapter *)na; + if (na->na_vp != vpna) { + /* trying to detach first attach of VALE persistent port attached + * to 2 bridges + */ + error = EBUSY; + goto unref_exit; + } + nmreq_det->port_index = vpna->bdg_port; + + if (na->nm_bdg_ctl) { + /* remove the port from bridge. The bwrap + * also needs to put the hwna in normal mode + */ + error = na->nm_bdg_ctl(hdr, na); + } + +unref_exit: + netmap_adapter_put(na); +unlock_exit: + NMG_UNLOCK(); + return error; + +} + +struct nm_bdg_polling_state; +struct +nm_bdg_kthread { + struct nm_kctx *nmk; + u_int qfirst; + u_int qlast; + struct nm_bdg_polling_state *bps; +}; + +struct nm_bdg_polling_state { + bool configured; + bool stopped; + struct netmap_bwrap_adapter *bna; + uint32_t mode; + u_int qfirst; + u_int qlast; + u_int cpu_from; + u_int ncpus; + struct nm_bdg_kthread *kthreads; +}; + +static void +netmap_bwrap_polling(void *data, int is_kthread) +{ + struct nm_bdg_kthread *nbk = data; + struct netmap_bwrap_adapter *bna; + u_int qfirst, qlast, i; + struct netmap_kring **kring0, *kring; + + if (!nbk) + return; + qfirst = nbk->qfirst; + qlast = nbk->qlast; + bna = nbk->bps->bna; + kring0 = NMR(bna->hwna, NR_RX); + + for (i = qfirst; i < qlast; i++) { + kring = kring0[i]; + kring->nm_notify(kring, 0); + } +} + +static int +nm_bdg_create_kthreads(struct nm_bdg_polling_state *bps) +{ + struct nm_kctx_cfg kcfg; + int i, j; + + bps->kthreads = nm_os_malloc(sizeof(struct nm_bdg_kthread) * bps->ncpus); + if (bps->kthreads == NULL) + return ENOMEM; + + bzero(&kcfg, sizeof(kcfg)); + kcfg.worker_fn = netmap_bwrap_polling; + kcfg.use_kthread = 1; + for (i = 0; i < bps->ncpus; i++) { + struct nm_bdg_kthread *t = bps->kthreads + i; + int all = (bps->ncpus == 1 && + bps->mode == NETMAP_POLLING_MODE_SINGLE_CPU); + int affinity = bps->cpu_from + i; + + t->bps = bps; + t->qfirst = all ? bps->qfirst /* must be 0 */: affinity; + t->qlast = all ? bps->qlast : t->qfirst + 1; + D("kthread %d a:%u qf:%u ql:%u", i, affinity, t->qfirst, + t->qlast); + + kcfg.type = i; + kcfg.worker_private = t; + t->nmk = nm_os_kctx_create(&kcfg, NULL); + if (t->nmk == NULL) { + goto cleanup; + } + nm_os_kctx_worker_setaff(t->nmk, affinity); + } + return 0; + +cleanup: + for (j = 0; j < i; j++) { + struct nm_bdg_kthread *t = bps->kthreads + i; + nm_os_kctx_destroy(t->nmk); + } + nm_os_free(bps->kthreads); + return EFAULT; +} + +/* A variant of ptnetmap_start_kthreads() */ +static int +nm_bdg_polling_start_kthreads(struct nm_bdg_polling_state *bps) +{ + int error, i, j; + + if (!bps) { + D("polling is not configured"); + return EFAULT; + } + bps->stopped = false; + + for (i = 0; i < bps->ncpus; i++) { + struct nm_bdg_kthread *t = bps->kthreads + i; + error = nm_os_kctx_worker_start(t->nmk); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Oct 30 10:01:17 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D367910DDB40; Tue, 30 Oct 2018 10:01:16 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 869A57AF31; Tue, 30 Oct 2018 10:01:16 +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 66F4C1BDDE; Tue, 30 Oct 2018 10:01:16 +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 w9UA1GTF043755; Tue, 30 Oct 2018 10:01:16 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9UA1FUK043750; Tue, 30 Oct 2018 10:01:15 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201810301001.w9UA1FUK043750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 30 Oct 2018 10:01:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339910 - in stable/12: share/man/man4 tools/tools/netmap X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in stable/12: share/man/man4 tools/tools/netmap X-SVN-Commit-Revision: 339910 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 10:01:17 -0000 Author: vmaffione Date: Tue Oct 30 10:01:15 2018 New Revision: 339910 URL: https://svnweb.freebsd.org/changeset/base/339910 Log: MFC r339659: netmap: add man page for the bridge program Added bridge(8). Also, minor fixes to the netmap "bridge" application: - indentation fixes and code cleanup - better usage description - better processing of netmap flags Approved by: re (rgrimes) Added: stable/12/tools/tools/netmap/bridge.8 - copied unchanged from r339659, head/tools/tools/netmap/bridge.8 Modified: stable/12/share/man/man4/netmap.4 stable/12/tools/tools/netmap/bridge.c stable/12/tools/tools/netmap/pkt-gen.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/netmap.4 ============================================================================== --- stable/12/share/man/man4/netmap.4 Tue Oct 30 09:53:57 2018 (r339909) +++ stable/12/share/man/man4/netmap.4 Tue Oct 30 10:01:15 2018 (r339910) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 2, 2017 +.Dd October 23, 2018 .Dt NETMAP 4 .Os .Sh NAME @@ -1073,6 +1073,9 @@ Other clients attached to the same switch can now communicate with the network card or the host. .Sh SEE ALSO +.Xr pkt-gen 8 , +.Xr bridge 8 +.Pp .Pa http://info.iet.unipi.it/~luigi/netmap/ .Pp Luigi Rizzo, Revisiting network I/O APIs: the netmap framework, Copied: stable/12/tools/tools/netmap/bridge.8 (from r339659, head/tools/tools/netmap/bridge.8) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/tools/netmap/bridge.8 Tue Oct 30 10:01:15 2018 (r339910, copy of r339659, head/tools/tools/netmap/bridge.8) @@ -0,0 +1,82 @@ +.\" Copyright (c) 2016 Luigi Rizzo, Universita` di Pisa +.\" +.\" 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 October 23, 2018 +.Dt BRIDGE 8 +.Os +.Sh NAME +.Nm bridge +.Nd netmap client to bridge two netmap ports +.Sh SYNOPSIS +.Bk -words +.Bl -tag -width "bridge" +.It Nm +.Op Fl i Ar port +.Op Fl b Ar batch size +.Op Fl w Ar wait-link +.Op Fl v +.Op Fl c +.El +.Ek +.Sh DESCRIPTION +.Nm +is a simple netmap application that bridges packets between two netmap ports. +If the two netmap ports use the same netmap memory region +.Nm +forwards packets without copying the packets payload (zero-copy mode), unless +explicitly prevented by the +.Fl c +flag. +.Bl -tag -width Ds +.It Fl i Ar port +Name of the netmap port. +It can be supplied up to two times to identify the ports that must be bridged. +Any netmap port type (physical interface, VALE switch, pipe, monitor port...) +can be used. +If the option is supplied only once, then it must be for a physical interface and, in that case, +.Nm +will bridge the port and the host stack. +.It Fl b Ar batch-size +Maximum number of packets to send in one operation. +.It Fl w Ar wait-link +indicates the number of seconds to wait before transmitting. +It defaults to 2, and may be useful when talking to physical +ports to let link negotiation complete before starting transmission. +.It Fl v +Enable verbose mode +.It Fl c +Disable zero-copy mode. +.El +.Sh SEE ALSO +.Xr netmap 4 , +.Xr pkt-gen 8 +.Sh AUTHORS +.An -nosplit +.Nm +has been written by +.An Luigi Rizzo +and +.An Matteo Landi +at the Universita` di Pisa, Italy. Modified: stable/12/tools/tools/netmap/bridge.c ============================================================================== --- stable/12/tools/tools/netmap/bridge.c Tue Oct 30 09:53:57 2018 (r339909) +++ stable/12/tools/tools/netmap/bridge.c Tue Oct 30 10:01:15 2018 (r339910) @@ -34,18 +34,18 @@ sigint_h(int sig) int pkt_queued(struct nm_desc *d, int tx) { - u_int i, tot = 0; + u_int i, tot = 0; - if (tx) { - for (i = d->first_tx_ring; i <= d->last_tx_ring; i++) { - tot += nm_ring_space(NETMAP_TXRING(d->nifp, i)); - } - } else { - for (i = d->first_rx_ring; i <= d->last_rx_ring; i++) { - tot += nm_ring_space(NETMAP_RXRING(d->nifp, i)); - } - } - return tot; + if (tx) { + for (i = d->first_tx_ring; i <= d->last_tx_ring; i++) { + tot += nm_ring_space(NETMAP_TXRING(d->nifp, i)); + } + } else { + for (i = d->first_rx_ring; i <= d->last_rx_ring; i++) { + tot += nm_ring_space(NETMAP_RXRING(d->nifp, i)); + } + } + return tot; } /* @@ -76,13 +76,13 @@ process_rings(struct netmap_ring *rxring, struct netma /* swap packets */ if (ts->buf_idx < 2 || rs->buf_idx < 2) { - D("wrong index rx[%d] = %d -> tx[%d] = %d", + RD(5, "wrong index rx[%d] = %d -> tx[%d] = %d", j, rs->buf_idx, k, ts->buf_idx); sleep(2); } /* copy the packet length. */ - if (rs->len > 2048) { - D("wrong len %d rx[%d] -> tx[%d]", rs->len, j, k); + if (rs->len > rxring->nr_buf_size) { + RD(5, "wrong len %d rx[%d] -> tx[%d]", rs->len, j, k); rs->len = 0; } else if (verbose > 1) { D("%s send len %d rx[%d] -> tx[%d]", msg, rs->len, j, k); @@ -95,6 +95,8 @@ process_rings(struct netmap_ring *rxring, struct netma /* report the buffer change. */ ts->flags |= NS_BUF_CHANGED; rs->flags |= NS_BUF_CHANGED; + /* copy the NS_MOREFRAG */ + rs->flags = (rs->flags & ~NS_MOREFRAG) | (ts->flags & NS_MOREFRAG); } else { char *rxbuf = NETMAP_BUF(rxring, rs->buf_idx); char *txbuf = NETMAP_BUF(txring, ts->buf_idx); @@ -117,7 +119,7 @@ move(struct nm_desc *src, struct nm_desc *dst, u_int l { struct netmap_ring *txring, *rxring; u_int m = 0, si = src->first_rx_ring, di = dst->first_tx_ring; - const char *msg = (src->req.nr_ringid & NETMAP_SW_RING) ? + const char *msg = (src->req.nr_flags == NR_REG_SW) ? "host->net" : "net->host"; while (si <= src->last_rx_ring && di <= dst->last_tx_ring) { @@ -143,7 +145,20 @@ static void usage(void) { fprintf(stderr, - "usage: bridge [-v] [-i ifa] [-i ifb] [-b burst] [-w wait_time] [ifa [ifb [burst]]]\n"); + "netmap bridge program: forward packets between two " + "network interfaces\n" + " usage(1): bridge [-v] [-i ifa] [-i ifb] [-b burst] " + "[-w wait_time] [-L]\n" + " usage(2): bridge [-v] [-w wait_time] [-L] " + "[ifa [ifb [burst]]]\n" + "\n" + " ifa and ifb are specified using the nm_open() syntax.\n" + " When ifb is missing (or is equal to ifa), bridge will\n" + " forward between between ifa and the host stack if -L\n" + " is not specified, otherwise loopback traffic on ifa.\n" + "\n" + " example: bridge -w 10 -i netmap:eth3 -i netmap:eth1\n" + ); exit(1); } @@ -163,14 +178,16 @@ main(int argc, char **argv) struct nm_desc *pa = NULL, *pb = NULL; char *ifa = NULL, *ifb = NULL; char ifabuf[64] = { 0 }; + int loopback = 0; - fprintf(stderr, "%s built %s %s\n", - argv[0], __DATE__, __TIME__); + fprintf(stderr, "%s built %s %s\n\n", argv[0], __DATE__, __TIME__); - while ( (ch = getopt(argc, argv, "b:ci:vw:")) != -1) { + while ((ch = getopt(argc, argv, "hb:ci:vw:L")) != -1) { switch (ch) { default: D("bad option %c %s", ch, optarg); + /* fallthrough */ + case 'h': usage(); break; case 'b': /* burst */ @@ -194,6 +211,9 @@ main(int argc, char **argv) case 'w': wait_link = atoi(optarg); break; + case 'L': + loopback = 1; + break; } } @@ -222,9 +242,13 @@ main(int argc, char **argv) wait_link = 4; } if (!strcmp(ifa, ifb)) { - D("same interface, endpoint 0 goes to host"); - snprintf(ifabuf, sizeof(ifabuf) - 1, "%s^", ifa); - ifa = ifabuf; + if (!loopback) { + D("same interface, endpoint 0 goes to host"); + snprintf(ifabuf, sizeof(ifabuf) - 1, "%s^", ifa); + ifa = ifabuf; + } else { + D("same interface, loopbacking traffic"); + } } else { /* two different interfaces. Take all rings on if1 */ } @@ -243,7 +267,7 @@ main(int argc, char **argv) zerocopy = zerocopy && (pa->mem == pb->mem); D("------- zerocopy %ssupported", zerocopy ? "" : "NOT "); - /* setup poll(2) variables. */ + /* setup poll(2) array */ memset(pollfd, 0, sizeof(pollfd)); pollfd[0].fd = pa->fd; pollfd[1].fd = pb->fd; @@ -263,18 +287,16 @@ main(int argc, char **argv) n0 = pkt_queued(pa, 0); n1 = pkt_queued(pb, 0); #if defined(_WIN32) || defined(BUSYWAIT) - if (n0){ + if (n0) { ioctl(pollfd[1].fd, NIOCTXSYNC, NULL); pollfd[1].revents = POLLOUT; - } - else { + } else { ioctl(pollfd[0].fd, NIOCRXSYNC, NULL); } - if (n1){ + if (n1) { ioctl(pollfd[0].fd, NIOCTXSYNC, NULL); pollfd[0].revents = POLLOUT; - } - else { + } else { ioctl(pollfd[1].fd, NIOCRXSYNC, NULL); } ret = 1; @@ -287,8 +309,10 @@ main(int argc, char **argv) pollfd[0].events |= POLLOUT; else pollfd[1].events |= POLLIN; + + /* poll() also cause kernel to txsync/rxsync the NICs */ ret = poll(pollfd, 2, 2500); -#endif //defined(_WIN32) || defined(BUSYWAIT) +#endif /* defined(_WIN32) || defined(BUSYWAIT) */ if (ret <= 0 || verbose) D("poll %s [0] ev %x %x rx %d@%d tx %d," " [1] ev %x %x rx %d@%d tx %d", @@ -316,18 +340,15 @@ main(int argc, char **argv) D("error on fd1, rx [%d,%d,%d)", rx->head, rx->cur, rx->tail); } - if (pollfd[0].revents & POLLOUT) { + if (pollfd[0].revents & POLLOUT) move(pb, pa, burst); - // XXX we don't need the ioctl */ - // ioctl(me[0].fd, NIOCTXSYNC, NULL); - } - if (pollfd[1].revents & POLLOUT) { + + if (pollfd[1].revents & POLLOUT) move(pa, pb, burst); - // XXX we don't need the ioctl */ - // ioctl(me[1].fd, NIOCTXSYNC, NULL); - } + + /* We don't need ioctl(NIOCTXSYNC) on the two file descriptors here, + * kernel will txsync on next poll(). */ } - D("exiting"); nm_close(pb); nm_close(pa); Modified: stable/12/tools/tools/netmap/pkt-gen.8 ============================================================================== --- stable/12/tools/tools/netmap/pkt-gen.8 Tue Oct 30 09:53:57 2018 (r339909) +++ stable/12/tools/tools/netmap/pkt-gen.8 Tue Oct 30 10:01:15 2018 (r339910) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 1, 2016 +.Dd October 23, 2018 .Dt PKT-GEN 8 .Os .Sh NAME @@ -170,10 +170,9 @@ packets to be received by the target host. .Dl .Nm -i netmap:ncxl0 -f tx -s 172.16.0.1:53 -d 172.16.1.3:53 -D 00:07:43:29:2a:e0 -.Sh FILES -.Xr netmap 4 .Sh SEE ALSO -.Xr netmap 4 +.Xr netmap 4 , +.Xr bridge 8 .Sh AUTHORS This manual page was written by .An George V. Neville-Neil Aq gnn@FreeBSD.org . From owner-svn-src-stable@freebsd.org Tue Oct 30 14:25:17 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B30E10E9C7F; Tue, 30 Oct 2018 14:25:17 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0EA9886A2B; Tue, 30 Oct 2018 14:25:17 +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 E3D7D1E9C7; Tue, 30 Oct 2018 14:25:16 +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 w9UEPGmT082648; Tue, 30 Oct 2018 14:25:16 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9UEPGQr082647; Tue, 30 Oct 2018 14:25:16 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201810301425.w9UEPGQr082647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 30 Oct 2018 14:25:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339915 - stable/12/tools/tools/netmap X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/tools/tools/netmap X-SVN-Commit-Revision: 339915 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 14:25:17 -0000 Author: vmaffione Date: Tue Oct 30 14:25:16 2018 New Revision: 339915 URL: https://svnweb.freebsd.org/changeset/base/339915 Log: MFC r339685 netmap: add man page for the vale-ctl program Added man page for vale-ctl program. Small fixes to vale-ctl, including the support for -m option (to specify the netmap memory allocator id). Approved by: re (rgrimes) Added: stable/12/tools/tools/netmap/vale-ctl.4 - copied unchanged from r339685, head/tools/tools/netmap/vale-ctl.4 Modified: stable/12/tools/tools/netmap/vale-ctl.c Directory Properties: stable/12/ (props changed) Copied: stable/12/tools/tools/netmap/vale-ctl.4 (from r339685, head/tools/tools/netmap/vale-ctl.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/tools/netmap/vale-ctl.4 Tue Oct 30 14:25:16 2018 (r339915, copy of r339685, head/tools/tools/netmap/vale-ctl.4) @@ -0,0 +1,163 @@ +.\" Copyright (c) 2016 Michio Honda. +.\" 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$ +.\" +.Dd October 24, 2018 +.Dt VALE-CTL 4 +.Os +.Sh NAME +.Nm vale-ctl +.Nd manage VALE switches provided by netmap +.Sh SYNOPSIS +.Bk -words +.Bl -tag -width "vale-ctl" +.It Nm +.Op Fl g Ar valeSSS:PPP +.Op Fl a Ar valeSSS:interface +.Op Fl h Ar valeSSS:interface +.Op Fl d Ar valeSSS:interface +.Op Fl n Ar interface +.Op Fl r Ar interface +.Op Fl l Ar valeSSS:PPP +.Op Fl l +.Op Fl p Ar valeSSS:PPP +.Op Fl P Ar valeSSS:PPP +.Op Fl C Ar spec +.Op Fl m Ar memid +.El +.Ek +.Sh DESCRIPTION +.Nm +manages and inspects +.Xr vale 4 +switches, for instance attaching and detaching interfaces, creating +and deleting persistent VALE ports, or listing the existing switches +and their ports. +In the following, +.Ar valeSSS +is the name of a VALE switch, while +.Ar valeSSS:PPP +is the name of a VALE port of +.Ar valeSSS . +.Pp +When issued without options it lists all the existing switch ports together +with their internal bridge number and port number. +.Bl -tag -width Ds +.It Fl g Ar valeSSS:PPP +Print the number of receive rings of +.Ar valeSSS:PPP . +.It Fl a Ar valeSSS:interface +Attach +.Ar interface +(which must be an existing network interface) to +.Ar valeSSS +and detach it from the host stack. +.It Fl h Ar valeSSS:interface +Attach +.Ar interface +(which must be an existing network interface) to +.Ar valeSSS +while keeping it attached to the host stack. +More precisely, packets coming from +the host stack and directed to the interface will go through the switch, where +they can still reach the interface if the switch rules allow it. +Conversely, packets coming from the interface will go through the switch and, +if appropriate, will reach the host stack. +.It Fl d Ar valeSSS:interface +Detach +.Ar interface +from +.Ar valeSSS . +.It Fl n Ar interface +Create a new persistent VALE port with name +.Ar interface . +The name must be different from any other network interface +already present in the system. +.It Fl d Ar interface +Destroy the persistent VALE port with name +.Ar inteface . +.It Fl l Ar valeSSS:PPP +Show the internal bridge number and port number of the given switch port. +.It Fl p Ar valeSSS:PPP +Enable polling mode for +.Ar valeSSS:PPP . +In polling mode, a dedicated kernel thread is spawned to handle packets +received from +.Ar valeSSS:PPP +and push them into the switch. +The kernel thread busy waits on the switch port rather than relying on +interrupts or notifications. +Polling mode can only be used on physical NICs attached to a VALE switch. +.It Fl P Ar valeSSS:PPP +Disable polling mode for +.Ar valeSSS:PPP . +.It Fl C Ar x | Ar x,y | Ar x,y,z | Ar x,y,z,w +When used in conjunction with +.Fl n +it supplies the number of tx and rx rings and slots. +The full format with four numbers gives, in order, number of tx slots, number +of rx slots, number of tx rings and number of rx rings. +The form with three numbers uses +.Ar z +for both the number of tx and the number of rx rings. +The forms with less than two numbers use the default values for the number +of rings. +The form with two numbers supplies the numbers of tx and rx slots. +The form with only one number uses +.Ar x +for both the number of tx and the number of rx slots. +.Pp +When used in conjunction with +.Fl p +only the first three forms are used. +The first number may be either 0 or 1. +If 0, then all interface rings will be polled by a single thread, running +on the core id given by the second number (the third number, if present, +must be 1). +If the first number is 1, then the ring identified by the second number will +be polled by the core with the same id. +If a third number is given, then this is repeated for as many consecutive +rings and cores. +.It Fl m Ar memid +Used in conjunction with +.Fl n +supplies the netmap memory region identifier to use together with the newly +created persistent VALE port. +These ports use a private memory region by default. +Using this option you can let them share memory with other ports. +Pass 1 as +.Ar memid +to use the global memory region already shared by all +harware netmap ports. +.El +.Sh SEE ALSO +.Xr netmap 4 , +.Xr vale 4 +.Sh AUTHORS +.An -nosplit +.Nm +has been written by +.An Michio Honda +at NetApp. Modified: stable/12/tools/tools/netmap/vale-ctl.c ============================================================================== --- stable/12/tools/tools/netmap/vale-ctl.c Tue Oct 30 11:51:09 2018 (r339914) +++ stable/12/tools/tools/netmap/vale-ctl.c Tue Oct 30 14:25:16 2018 (r339915) @@ -82,7 +82,7 @@ void parse_nmr_config(const char* conf, struct nmreq * } static int -bdg_ctl(const char *name, int nr_cmd, int nr_arg, char *nmr_config) +bdg_ctl(const char *name, int nr_cmd, int nr_arg, char *nmr_config, int nr_arg2) { struct nmreq nmr; int error = 0; @@ -96,9 +96,10 @@ bdg_ctl(const char *name, int nr_cmd, int nr_arg, char bzero(&nmr, sizeof(nmr)); nmr.nr_version = NETMAP_API; if (name != NULL) /* might be NULL */ - strncpy(nmr.nr_name, name, sizeof(nmr.nr_name)); + strncpy(nmr.nr_name, name, sizeof(nmr.nr_name)-1); nmr.nr_cmd = nr_cmd; parse_nmr_config(nmr_config, &nmr); + nmr.nr_arg2 = nr_arg2; switch (nr_cmd) { case NETMAP_BDG_DELIF: @@ -195,42 +196,44 @@ bdg_ctl(const char *name, int nr_cmd, int nr_arg, char return error; } +static void +usage(int errcode) +{ + fprintf(stderr, + "Usage:\n" + "vale-ctl arguments\n" + "\t-g interface interface name to get info\n" + "\t-d interface interface name to be detached\n" + "\t-a interface interface name to be attached\n" + "\t-h interface interface name to be attached with the host stack\n" + "\t-n interface interface name to be created\n" + "\t-r interface interface name to be deleted\n" + "\t-l list all or specified bridge's interfaces (default)\n" + "\t-C string ring/slot setting of an interface creating by -n\n" + "\t-p interface start polling. Additional -C x,y,z configures\n" + "\t\t x: 0 (REG_ALL_NIC) or 1 (REG_ONE_NIC),\n" + "\t\t y: CPU core id for ALL_NIC and core/ring for ONE_NIC\n" + "\t\t z: (ONE_NIC only) num of total cores/rings\n" + "\t-P interface stop polling\n" + "\t-m memid to use when creating a new interface\n"); + exit(errcode); +} + int main(int argc, char *argv[]) { int ch, nr_cmd = 0, nr_arg = 0; - const char *command = basename(argv[0]); char *name = NULL, *nmr_config = NULL; + int nr_arg2 = 0; - if (argc > 5) { -usage: - fprintf(stderr, - "Usage:\n" - "%s arguments\n" - "\t-g interface interface name to get info\n" - "\t-d interface interface name to be detached\n" - "\t-a interface interface name to be attached\n" - "\t-h interface interface name to be attached with the host stack\n" - "\t-n interface interface name to be created\n" - "\t-r interface interface name to be deleted\n" - "\t-l list all or specified bridge's interfaces (default)\n" - "\t-C string ring/slot setting of an interface creating by -n\n" - "\t-p interface start polling. Additional -C x,y,z configures\n" - "\t\t x: 0 (REG_ALL_NIC) or 1 (REG_ONE_NIC),\n" - "\t\t y: CPU core id for ALL_NIC and core/ring for ONE_NIC\n" - "\t\t z: (ONE_NIC only) num of total cores/rings\n" - "\t-P interface stop polling\n" - "", command); - return 0; - } - - while ((ch = getopt(argc, argv, "d:a:h:g:l:n:r:C:p:P:")) != -1) { - if (ch != 'C') + while ((ch = getopt(argc, argv, "d:a:h:g:l:n:r:C:p:P:m:")) != -1) { + if (ch != 'C' && ch != 'm') name = optarg; /* default */ switch (ch) { default: fprintf(stderr, "bad option %c %s", ch, optarg); - goto usage; + usage(-1); + break; case 'd': nr_cmd = NETMAP_BDG_DETACH; break; @@ -252,8 +255,6 @@ usage: break; case 'l': nr_cmd = NETMAP_BDG_LIST; - if (optind < argc && argv[optind][0] == '-') - name = NULL; break; case 'C': nmr_config = strdup(optarg); @@ -264,13 +265,18 @@ usage: case 'P': nr_cmd = NETMAP_BDG_POLLING_OFF; break; + case 'm': + nr_arg2 = atoi(optarg); + break; } } if (optind != argc) { // fprintf(stderr, "optind %d argc %d\n", optind, argc); - goto usage; + usage(-1); } - if (argc == 1) + if (argc == 1) { nr_cmd = NETMAP_BDG_LIST; - return bdg_ctl(name, nr_cmd, nr_arg, nmr_config) ? 1 : 0; + name = NULL; + } + return bdg_ctl(name, nr_cmd, nr_arg, nmr_config, nr_arg2) ? 1 : 0; } From owner-svn-src-stable@freebsd.org Tue Oct 30 15:11:35 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3573410EB276; Tue, 30 Oct 2018 15:11:35 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF1766A96B; Tue, 30 Oct 2018 15:11:34 +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 A7C091F18B; Tue, 30 Oct 2018 15:11:34 +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 w9UFBY02008297; Tue, 30 Oct 2018 15:11:34 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9UFBYEq008296; Tue, 30 Oct 2018 15:11:34 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201810301511.w9UFBYEq008296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 30 Oct 2018 15:11:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339918 - stable/12/sys/geom/eli X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/12/sys/geom/eli X-SVN-Commit-Revision: 339918 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 15:11:35 -0000 Author: delphij Date: Tue Oct 30 15:11:34 2018 New Revision: 339918 URL: https://svnweb.freebsd.org/changeset/base/339918 Log: Restore backward compatibility for "attach" verb. In r332361 and r333439, two new parameters were added to geli attach verb using gctl_get_paraml, which requires the value to be present. This would prevent old geli(8) binary from attaching geli(4) device as they have no knowledge about the new parameters. Restore backward compatibility by treating the absense of these two values as seeing the default value supplied by userland. PR: 232595 Reviewed by: oshogbo Approved by: re (rgrimes) Modified: stable/12/sys/geom/eli/g_eli_ctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/geom/eli/g_eli_ctl.c ============================================================================== --- stable/12/sys/geom/eli/g_eli_ctl.c Tue Oct 30 14:54:15 2018 (r339917) +++ stable/12/sys/geom/eli/g_eli_ctl.c Tue Oct 30 15:11:34 2018 (r339918) @@ -59,8 +59,8 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class struct g_provider *pp; const char *name; u_char *key, mkey[G_ELI_DATAIVKEYLEN]; - int *nargs, *detach, *readonly, *dryrun; - int keysize, error, nkey; + int *nargs, *detach, *readonly, *dryrunp; + int keysize, error, nkey, dryrun, dummy; intmax_t *valp; g_topology_assert(); @@ -81,12 +81,14 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class return; } - valp = gctl_get_paraml(req, "keyno", sizeof(*valp)); - if (valp == NULL) { - gctl_error(req, "No '%s' argument.", "keyno"); - return; + /* "keyno" is optional for backward compatibility */ + nkey = -1; + valp = gctl_get_param(req, "keyno", &dummy); + if (valp != NULL) { + valp = gctl_get_paraml(req, "keyno", sizeof(*valp)); + if (valp != NULL) + nkey = *valp; } - nkey = *valp; if (nkey < -1 || nkey >= G_ELI_MAXMKEYS) { gctl_error(req, "Invalid '%s' argument.", "keyno"); return; @@ -98,10 +100,13 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class return; } - dryrun = gctl_get_paraml(req, "dryrun", sizeof(*dryrun)); - if (dryrun == NULL) { - gctl_error(req, "No '%s' argument.", "dryrun"); - return; + /* "dryrun" is optional for backward compatibility */ + dryrun = 0; + dryrunp = gctl_get_param(req, "dryrun", &dummy); + if (dryrunp != NULL) { + dryrunp = gctl_get_paraml(req, "dryrun", sizeof(*dryrunp)); + if (dryrunp != NULL) + dryrun = *dryrunp; } if (*detach && *readonly) { @@ -161,7 +166,7 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class md.md_flags |= G_ELI_FLAG_WO_DETACH; if (*readonly) md.md_flags |= G_ELI_FLAG_RO; - if (!*dryrun) + if (!dryrun) g_eli_create(req, mp, pp, &md, mkey, nkey); explicit_bzero(mkey, sizeof(mkey)); explicit_bzero(&md, sizeof(md)); From owner-svn-src-stable@freebsd.org Tue Oct 30 19:10:42 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A6C110F1A80; Tue, 30 Oct 2018 19:10:42 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 200CD75050; Tue, 30 Oct 2018 19:10:42 +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 012232181B; Tue, 30 Oct 2018 19:10:42 +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 w9UJAfA0030116; Tue, 30 Oct 2018 19:10:41 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9UJAfxJ030114; Tue, 30 Oct 2018 19:10:41 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201810301910.w9UJAfxJ030114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 30 Oct 2018 19:10:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339928 - stable/11/sys/x86/isa X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/x86/isa X-SVN-Commit-Revision: 339928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 19:10:42 -0000 Author: jhb Date: Tue Oct 30 19:10:41 2018 New Revision: 339928 URL: https://svnweb.freebsd.org/changeset/base/339928 Log: MFC 338148: Remove 'imen' global variable from atpic(4). In pre-SMPng, the global 'imen' was used to track mask state of the hardware interrupts and was aligned to the masks used by spl*(). When the atpic code was converted to using the x86 interrupt source abstraction, the global 'imen' was preserved by having each PIC instance point to an individual byte in the global 'imen' to hold its 8-bit interrupt mask. The global 'imen' is no longer used for anything however, so rather than storing pointers in 'struct atpic', just store the individual 8-bit mask for each PIC as a char. While here, convert the ATPIC macro to using C99 initializers. Modified: stable/11/sys/x86/isa/atpic.c stable/11/sys/x86/isa/icu.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/isa/atpic.c ============================================================================== --- stable/11/sys/x86/isa/atpic.c Tue Oct 30 18:26:34 2018 (r339927) +++ stable/11/sys/x86/isa/atpic.c Tue Oct 30 19:10:41 2018 (r339928) @@ -73,12 +73,12 @@ __FBSDID("$FreeBSD$"); #define MASTER 0 #define SLAVE 1 +#define IMEN_MASK(ai) (IRQ_MASK((ai)->at_irq)) + #define NUM_ISA_IRQS 16 static void atpic_init(void *dummy); -unsigned int imen; /* XXX */ - inthand_t IDTVEC(atpic_intr0), IDTVEC(atpic_intr1), IDTVEC(atpic_intr2), IDTVEC(atpic_intr3), IDTVEC(atpic_intr4), IDTVEC(atpic_intr5), @@ -99,12 +99,24 @@ inthand_t #define IRQ(ap, ai) ((ap)->at_irqbase + (ai)->at_irq) -#define ATPIC(io, base, eoi, imenptr) \ - { { atpic_enable_source, atpic_disable_source, (eoi), \ - atpic_enable_intr, atpic_disable_intr, atpic_vector, \ - atpic_source_pending, NULL, atpic_resume, atpic_config_intr,\ - atpic_assign_cpu }, (io), (base), IDT_IO_INTS + (base), \ - (imenptr) } +#define ATPIC(io, base, eoi) { \ + .at_pic = { \ + .pic_enable_source = atpic_enable_source, \ + .pic_disable_source = atpic_disable_source, \ + .pic_eoi_source = (eoi), \ + .pic_enable_intr = atpic_enable_intr, \ + .pic_disable_intr = atpic_disable_intr, \ + .pic_vector = atpic_vector, \ + .pic_source_pending = atpic_source_pending, \ + .pic_resume = atpic_resume, \ + .pic_config_intr = atpic_config_intr, \ + .pic_assign_cpu = atpic_assign_cpu \ + }, \ + .at_ioaddr = (io), \ + .at_irqbase = (base), \ + .at_intbase = IDT_IO_INTS + (base), \ + .at_imen = 0xff, \ + } #define INTSRC(irq) \ { { &atpics[(irq) / 8].at_pic }, IDTVEC(atpic_intr ## irq ), \ @@ -115,7 +127,7 @@ struct atpic { int at_ioaddr; int at_irqbase; uint8_t at_intbase; - uint8_t *at_imen; + uint8_t at_imen; }; struct atpic_intsrc { @@ -142,8 +154,8 @@ static int atpic_assign_cpu(struct intsrc *isrc, u_int static void i8259_init(struct atpic *pic, int slave); static struct atpic atpics[] = { - ATPIC(IO_ICU1, 0, atpic_eoi_master, (uint8_t *)&imen), - ATPIC(IO_ICU2, 8, atpic_eoi_slave, ((uint8_t *)&imen) + 1) + ATPIC(IO_ICU1, 0, atpic_eoi_master), + ATPIC(IO_ICU2, 8, atpic_eoi_slave) }; static struct atpic_intsrc atintrs[] = { @@ -203,9 +215,9 @@ atpic_enable_source(struct intsrc *isrc) struct atpic *ap = (struct atpic *)isrc->is_pic; spinlock_enter(); - if (*ap->at_imen & IMEN_MASK(ai)) { - *ap->at_imen &= ~IMEN_MASK(ai); - outb(ap->at_ioaddr + ICU_IMR_OFFSET, *ap->at_imen); + if (ap->at_imen & IMEN_MASK(ai)) { + ap->at_imen &= ~IMEN_MASK(ai); + outb(ap->at_ioaddr + ICU_IMR_OFFSET, ap->at_imen); } spinlock_exit(); } @@ -218,8 +230,8 @@ atpic_disable_source(struct intsrc *isrc, int eoi) spinlock_enter(); if (ai->at_trigger != INTR_TRIGGER_EDGE) { - *ap->at_imen |= IMEN_MASK(ai); - outb(ap->at_ioaddr + ICU_IMR_OFFSET, *ap->at_imen); + ap->at_imen |= IMEN_MASK(ai); + outb(ap->at_ioaddr + ICU_IMR_OFFSET, ap->at_imen); } /* @@ -413,7 +425,7 @@ i8259_init(struct atpic *pic, int slave) outb(imr_addr, MASTER_MODE); /* Set interrupt enable mask. */ - outb(imr_addr, *pic->at_imen); + outb(imr_addr, pic->at_imen); /* Reset is finished, default to IRR on read. */ outb(pic->at_ioaddr, OCW3_SEL | OCW3_RR); @@ -433,7 +445,6 @@ atpic_startup(void) int i; /* Start off with all interrupts disabled. */ - imen = 0xffff; i8259_init(&atpics[MASTER], 0); i8259_init(&atpics[SLAVE], 1); atpic_enable_source((struct intsrc *)&atintrs[ICU_SLAVEID]); Modified: stable/11/sys/x86/isa/icu.h ============================================================================== --- stable/11/sys/x86/isa/icu.h Tue Oct 30 18:26:34 2018 (r339927) +++ stable/11/sys/x86/isa/icu.h Tue Oct 30 19:10:41 2018 (r339928) @@ -87,7 +87,6 @@ #endif #define IRQ_MASK(irq) (1 << (irq)) -#define IMEN_MASK(ai) (IRQ_MASK((ai)->at_irq)) void atpic_handle_intr(u_int vector, struct trapframe *frame); void atpic_startup(void); From owner-svn-src-stable@freebsd.org Tue Oct 30 21:31:33 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8763510F534D; Tue, 30 Oct 2018 21:31:33 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3CDF67B600; Tue, 30 Oct 2018 21:31:33 +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 1DF9623030; Tue, 30 Oct 2018 21:31:33 +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 w9ULVWYe005791; Tue, 30 Oct 2018 21:31:32 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9ULVWlT005790; Tue, 30 Oct 2018 21:31:32 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201810302131.w9ULVWlT005790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 30 Oct 2018 21:31:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r339932 - in stable: 10/sys/dev/pci 11/sys/dev/pci X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/sys/dev/pci 11/sys/dev/pci X-SVN-Commit-Revision: 339932 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 21:31:33 -0000 Author: jhb Date: Tue Oct 30 21:31:32 2018 New Revision: 339932 URL: https://svnweb.freebsd.org/changeset/base/339932 Log: MFC 338408: Don't directly dereference a user pointer in the VPD ioctl. The PCIOCLISTVPD ioctl on /dev/pci is used to fetch a list of VPD key-value pairs for a specific PCI function. It is used by 'pciconf -l -V'. The list is stored in a userland-supplied buffer as an array of variable-length structures where the key and data length are stored in a fixed-size header followed by the variable-length value as a byte array. To facilitate walking this array in userland, provides a PVE_NEXT() helper macro to return a pointer to the next array element by reading the the length out of the current header and using it to compute the address of the next header. To simplify the implementation, the ioctl handler was also using PVE_NEXT() when on the user address of the user buffer to compute the user address of the next array element. However, the PVE_NEXT() macro when used with a user address was reading the value's length by indirecting the user pointer. The value was ready after the current record had been copied out to the user buffer, so it appeared to work on architectures where user addresses are directly dereferencable from the kernel (all but powerpc and i386 after the 4:4 split). The recent enablement of SMAP on amd64 caught this violation however. To fix, add a variant of PVE_NEXT() for use in the ioctl handler that takes an explicit value length. Modified: stable/10/sys/dev/pci/pci_user.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/pci/pci_user.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/dev/pci/pci_user.c ============================================================================== --- stable/10/sys/dev/pci/pci_user.c Tue Oct 30 20:51:03 2018 (r339931) +++ stable/10/sys/dev/pci/pci_user.c Tue Oct 30 21:31:32 2018 (r339932) @@ -406,6 +406,14 @@ pci_conf_match_old32(struct pci_match_conf_old32 *matc #endif /* COMPAT_FREEBSD32 */ #endif /* PRE7_COMPAT */ +/* + * Like PVE_NEXT but takes an explicit length since 'pve' is a user + * pointer that cannot be dereferenced. + */ +#define PVE_NEXT_LEN(pve, datalen) \ + ((struct pci_vpd_element *)((char *)(pve) + \ + sizeof(struct pci_vpd_element) + (datalen))) + static int pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvio) { @@ -454,7 +462,7 @@ pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvi strlen(vpd->vpd_ident)); if (error) return (error); - vpd_user = PVE_NEXT(vpd_user); + vpd_user = PVE_NEXT_LEN(vpd_user, vpd_element.pve_datalen); vpd_element.pve_flags = 0; for (i = 0; i < vpd->vpd_rocnt; i++) { vpd_element.pve_keyword[0] = vpd->vpd_ros[i].keyword[0]; @@ -467,7 +475,7 @@ pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvi vpd->vpd_ros[i].len); if (error) return (error); - vpd_user = PVE_NEXT(vpd_user); + vpd_user = PVE_NEXT_LEN(vpd_user, vpd_element.pve_datalen); } vpd_element.pve_flags = PVE_FLAG_RW; for (i = 0; i < vpd->vpd_wcnt; i++) { @@ -481,7 +489,7 @@ pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvi vpd->vpd_w[i].len); if (error) return (error); - vpd_user = PVE_NEXT(vpd_user); + vpd_user = PVE_NEXT_LEN(vpd_user, vpd_element.pve_datalen); } KASSERT((char *)vpd_user - (char *)lvio->plvi_data == len, ("length mismatch")); From owner-svn-src-stable@freebsd.org Tue Oct 30 21:31:34 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECE2510F5353; Tue, 30 Oct 2018 21:31:33 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 790B17B602; Tue, 30 Oct 2018 21:31:33 +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 5A33823031; Tue, 30 Oct 2018 21:31:33 +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 w9ULVXEL005797; Tue, 30 Oct 2018 21:31:33 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9ULVXjk005796; Tue, 30 Oct 2018 21:31:33 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201810302131.w9ULVXjk005796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 30 Oct 2018 21:31:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339932 - in stable: 10/sys/dev/pci 11/sys/dev/pci X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/sys/dev/pci 11/sys/dev/pci X-SVN-Commit-Revision: 339932 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 21:31:34 -0000 Author: jhb Date: Tue Oct 30 21:31:32 2018 New Revision: 339932 URL: https://svnweb.freebsd.org/changeset/base/339932 Log: MFC 338408: Don't directly dereference a user pointer in the VPD ioctl. The PCIOCLISTVPD ioctl on /dev/pci is used to fetch a list of VPD key-value pairs for a specific PCI function. It is used by 'pciconf -l -V'. The list is stored in a userland-supplied buffer as an array of variable-length structures where the key and data length are stored in a fixed-size header followed by the variable-length value as a byte array. To facilitate walking this array in userland, provides a PVE_NEXT() helper macro to return a pointer to the next array element by reading the the length out of the current header and using it to compute the address of the next header. To simplify the implementation, the ioctl handler was also using PVE_NEXT() when on the user address of the user buffer to compute the user address of the next array element. However, the PVE_NEXT() macro when used with a user address was reading the value's length by indirecting the user pointer. The value was ready after the current record had been copied out to the user buffer, so it appeared to work on architectures where user addresses are directly dereferencable from the kernel (all but powerpc and i386 after the 4:4 split). The recent enablement of SMAP on amd64 caught this violation however. To fix, add a variant of PVE_NEXT() for use in the ioctl handler that takes an explicit value length. Modified: stable/11/sys/dev/pci/pci_user.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/pci/pci_user.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/dev/pci/pci_user.c ============================================================================== --- stable/11/sys/dev/pci/pci_user.c Tue Oct 30 20:51:03 2018 (r339931) +++ stable/11/sys/dev/pci/pci_user.c Tue Oct 30 21:31:32 2018 (r339932) @@ -406,6 +406,14 @@ pci_conf_match_old32(struct pci_match_conf_old32 *matc #endif /* COMPAT_FREEBSD32 */ #endif /* PRE7_COMPAT */ +/* + * Like PVE_NEXT but takes an explicit length since 'pve' is a user + * pointer that cannot be dereferenced. + */ +#define PVE_NEXT_LEN(pve, datalen) \ + ((struct pci_vpd_element *)((char *)(pve) + \ + sizeof(struct pci_vpd_element) + (datalen))) + static int pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvio) { @@ -454,7 +462,7 @@ pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvi strlen(vpd->vpd_ident)); if (error) return (error); - vpd_user = PVE_NEXT(vpd_user); + vpd_user = PVE_NEXT_LEN(vpd_user, vpd_element.pve_datalen); vpd_element.pve_flags = 0; for (i = 0; i < vpd->vpd_rocnt; i++) { vpd_element.pve_keyword[0] = vpd->vpd_ros[i].keyword[0]; @@ -467,7 +475,7 @@ pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvi vpd->vpd_ros[i].len); if (error) return (error); - vpd_user = PVE_NEXT(vpd_user); + vpd_user = PVE_NEXT_LEN(vpd_user, vpd_element.pve_datalen); } vpd_element.pve_flags = PVE_FLAG_RW; for (i = 0; i < vpd->vpd_wcnt; i++) { @@ -481,7 +489,7 @@ pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvi vpd->vpd_w[i].len); if (error) return (error); - vpd_user = PVE_NEXT(vpd_user); + vpd_user = PVE_NEXT_LEN(vpd_user, vpd_element.pve_datalen); } KASSERT((char *)vpd_user - (char *)lvio->plvi_data == len, ("length mismatch")); From owner-svn-src-stable@freebsd.org Tue Oct 30 23:09:05 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 694B31037167; Tue, 30 Oct 2018 23:09: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F7D47F34E; Tue, 30 Oct 2018 23:09: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 F05C124051; Tue, 30 Oct 2018 23:09: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 w9UN94lv054039; Tue, 30 Oct 2018 23:09:04 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9UN94jg054038; Tue, 30 Oct 2018 23:09:04 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201810302309.w9UN94jg054038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 30 Oct 2018 23:09:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339935 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 339935 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 23:09:05 -0000 Author: markj Date: Tue Oct 30 23:09:04 2018 New Revision: 339935 URL: https://svnweb.freebsd.org/changeset/base/339935 Log: MFC r339934: Revert r336984. Approved by: re (kib) Modified: stable/12/sys/vm/vm_object.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_object.c ============================================================================== --- stable/12/sys/vm/vm_object.c Tue Oct 30 22:40:40 2018 (r339934) +++ stable/12/sys/vm/vm_object.c Tue Oct 30 23:09:04 2018 (r339935) @@ -2142,9 +2142,8 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset next_size >>= PAGE_SHIFT; next_pindex = OFF_TO_IDX(prev_offset) + prev_size; - if (prev_object->ref_count > 1 && - prev_object->size != next_pindex && - (prev_object->flags & OBJ_ONEMAPPING) == 0) { + if ((prev_object->ref_count > 1) && + (prev_object->size != next_pindex)) { VM_OBJECT_WUNLOCK(prev_object); return (FALSE); } From owner-svn-src-stable@freebsd.org Wed Oct 31 01:57:54 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2BC4107251B; Wed, 31 Oct 2018 01:57:53 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5A3F84DCB; Wed, 31 Oct 2018 01:57:53 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 8697825C3B; Wed, 31 Oct 2018 01:57:53 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9V1vrig040855; Wed, 31 Oct 2018 01:57:53 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9V1vp4S040847; Wed, 31 Oct 2018 01:57:51 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201810310157.w9V1vp4S040847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Wed, 31 Oct 2018 01:57:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339937 - stable/12/contrib/tzdata X-SVN-Group: stable-12 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: stable/12/contrib/tzdata X-SVN-Commit-Revision: 339937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 01:57:54 -0000 Author: philip Date: Wed Oct 31 01:57:51 2018 New Revision: 339937 URL: https://svnweb.freebsd.org/changeset/base/339937 Log: MFC r339848: mport tzdata 2018g Approved by: re (kib) Modified: stable/12/contrib/tzdata/NEWS stable/12/contrib/tzdata/africa stable/12/contrib/tzdata/europe stable/12/contrib/tzdata/northamerica stable/12/contrib/tzdata/theory.html stable/12/contrib/tzdata/version stable/12/contrib/tzdata/ziguard.awk stable/12/contrib/tzdata/zishrink.awk Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/tzdata/NEWS ============================================================================== --- stable/12/contrib/tzdata/NEWS Wed Oct 31 01:27:44 2018 (r339936) +++ stable/12/contrib/tzdata/NEWS Wed Oct 31 01:57:51 2018 (r339937) @@ -1,5 +1,40 @@ News for the tz database +Release 2018g - 2018-10-26 22:22:45 -0700 + + Briefly: + Morocco switches to permanent +01 on 2018-10-27. + + Changes to future timestamps + + Morocco switches from +00/+01 to permanent +01 effective 2018-10-27, + so its clocks will not fall back on 2018-10-28 as previously scheduled. + (Thanks to Mohamed Essedik Najd and Brian Inglis.) + + Changes to code + + When generating TZif files with leap seconds, zic no longer uses a + format that trips up older 32-bit clients, fixing a bug introduced + in 2018f. (Reported by Daniel Fischer.) Also, the zic workaround + for QTBUG-53071 now also works for TZif files with leap seconds. + + The translator to rearguard format now rewrites the line + "Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S" to + "Rule Japan 1948 1951 - Sep Sun>=9 1:00 0 S". + This caters to zic before 2007 and to Oracle TZUpdater 2.2.0 + and earlier. (Reported by Christos Zoulas.) + + Changes to past time zone abbreviations + + Change HDT to HWT/HPT for WWII-era abbreviations in Hawaii. + This reverts to 2011h, as the abbreviation change in 2011i was + likely inadvertent. + + Changes to documentation + + tzfile.5 has new sections on interoperability issues. + + Release 2018f - 2018-10-18 00:14:18 -0700 Briefly: Modified: stable/12/contrib/tzdata/africa ============================================================================== --- stable/12/contrib/tzdata/africa Wed Oct 31 01:27:44 2018 (r339936) +++ stable/12/contrib/tzdata/africa Wed Oct 31 01:57:51 2018 (r339937) @@ -844,94 +844,61 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # agrees # with the patch. -# From Paul Eggert (2015-06-08): -# For now, guess that later spring and fall transitions will use 2015's rules, -# and guess that Morocco will switch to standard time at 03:00 the last -# Sunday before Ramadan, and back to DST at 02:00 the first Sunday after -# Ramadan. To implement this, transition dates for 2016 through 2037 were -# determined by running the following program under GNU Emacs 24.3, with the -# results integrated by hand into the table below. -# (let ((islamic-year 1437)) -# (require 'cal-islam) -# (while (< islamic-year 1460) -# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) -# (b (calendar-islamic-to-absolute (list 10 1 islamic-year))) -# (sunday 0)) -# (while (/= sunday (mod (setq a (1- a)) 7))) -# (while (/= sunday (mod b 7)) -# (setq b (1+ b))) -# (setq a (calendar-gregorian-from-absolute a)) -# (setq b (calendar-gregorian-from-absolute b)) -# (insert -# (format -# (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 3:00\t0\t-\n" -# "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 2:00\t1:00\tS\n") -# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a)) -# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b))))) -# (setq islamic-year (+ 1 islamic-year)))) +# From Mohamed Essedik Najd (2018-10-26): +# Today, a Moroccan government council approved the perpetual addition +# of 60 minutes to the regular Moroccan timezone. +# From Brian Inglis (2018-10-26): +# http://www.maroc.ma/fr/actualites/le-conseil-de-gouvernement-adopte-un-projet-de-decret-relatif-lheure-legale-stipulant-le # RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S - -Rule Morocco 1939 only - Sep 12 0:00 1:00 S +Rule Morocco 1939 only - Sep 12 0:00 1:00 - Rule Morocco 1939 only - Nov 19 0:00 0 - -Rule Morocco 1940 only - Feb 25 0:00 1:00 S +Rule Morocco 1940 only - Feb 25 0:00 1:00 - Rule Morocco 1945 only - Nov 18 0:00 0 - -Rule Morocco 1950 only - Jun 11 0:00 1:00 S +Rule Morocco 1950 only - Jun 11 0:00 1:00 - Rule Morocco 1950 only - Oct 29 0:00 0 - -Rule Morocco 1967 only - Jun 3 12:00 1:00 S +Rule Morocco 1967 only - Jun 3 12:00 1:00 - Rule Morocco 1967 only - Oct 1 0:00 0 - -Rule Morocco 1974 only - Jun 24 0:00 1:00 S +Rule Morocco 1974 only - Jun 24 0:00 1:00 - Rule Morocco 1974 only - Sep 1 0:00 0 - -Rule Morocco 1976 1977 - May 1 0:00 1:00 S +Rule Morocco 1976 1977 - May 1 0:00 1:00 - Rule Morocco 1976 only - Aug 1 0:00 0 - Rule Morocco 1977 only - Sep 28 0:00 0 - -Rule Morocco 1978 only - Jun 1 0:00 1:00 S +Rule Morocco 1978 only - Jun 1 0:00 1:00 - Rule Morocco 1978 only - Aug 4 0:00 0 - -Rule Morocco 2008 only - Jun 1 0:00 1:00 S +Rule Morocco 2008 only - Jun 1 0:00 1:00 - Rule Morocco 2008 only - Sep 1 0:00 0 - -Rule Morocco 2009 only - Jun 1 0:00 1:00 S +Rule Morocco 2009 only - Jun 1 0:00 1:00 - Rule Morocco 2009 only - Aug 21 0:00 0 - -Rule Morocco 2010 only - May 2 0:00 1:00 S +Rule Morocco 2010 only - May 2 0:00 1:00 - Rule Morocco 2010 only - Aug 8 0:00 0 - -Rule Morocco 2011 only - Apr 3 0:00 1:00 S +Rule Morocco 2011 only - Apr 3 0:00 1:00 - Rule Morocco 2011 only - Jul 31 0:00 0 - -Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 S +Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 - Rule Morocco 2012 only - Jul 20 3:00 0 - -Rule Morocco 2012 only - Aug 20 2:00 1:00 S +Rule Morocco 2012 only - Aug 20 2:00 1:00 - Rule Morocco 2012 only - Sep 30 3:00 0 - Rule Morocco 2013 only - Jul 7 3:00 0 - -Rule Morocco 2013 only - Aug 10 2:00 1:00 S -Rule Morocco 2013 max - Oct lastSun 3:00 0 - -Rule Morocco 2014 2021 - Mar lastSun 2:00 1:00 S +Rule Morocco 2013 only - Aug 10 2:00 1:00 - +Rule Morocco 2013 2018 - Oct lastSun 3:00 0 - +Rule Morocco 2014 2018 - Mar lastSun 2:00 1:00 - Rule Morocco 2014 only - Jun 28 3:00 0 - -Rule Morocco 2014 only - Aug 2 2:00 1:00 S +Rule Morocco 2014 only - Aug 2 2:00 1:00 - Rule Morocco 2015 only - Jun 14 3:00 0 - -Rule Morocco 2015 only - Jul 19 2:00 1:00 S +Rule Morocco 2015 only - Jul 19 2:00 1:00 - Rule Morocco 2016 only - Jun 5 3:00 0 - -Rule Morocco 2016 only - Jul 10 2:00 1:00 S +Rule Morocco 2016 only - Jul 10 2:00 1:00 - Rule Morocco 2017 only - May 21 3:00 0 - -Rule Morocco 2017 only - Jul 2 2:00 1:00 S +Rule Morocco 2017 only - Jul 2 2:00 1:00 - Rule Morocco 2018 only - May 13 3:00 0 - -Rule Morocco 2018 only - Jun 17 2:00 1:00 S -Rule Morocco 2019 only - May 5 3:00 0 - -Rule Morocco 2019 only - Jun 9 2:00 1:00 S -Rule Morocco 2020 only - Apr 19 3:00 0 - -Rule Morocco 2020 only - May 24 2:00 1:00 S -Rule Morocco 2021 only - Apr 11 3:00 0 - -Rule Morocco 2021 only - May 16 2:00 1:00 S -Rule Morocco 2022 only - May 8 2:00 1:00 S -Rule Morocco 2023 only - Apr 23 2:00 1:00 S -Rule Morocco 2024 only - Apr 14 2:00 1:00 S -Rule Morocco 2025 only - Apr 6 2:00 1:00 S -Rule Morocco 2026 max - Mar lastSun 2:00 1:00 S -Rule Morocco 2036 only - Oct 19 3:00 0 - -Rule Morocco 2037 only - Oct 4 3:00 0 - +Rule Morocco 2018 only - Jun 17 2:00 1:00 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 - 0:00 Morocco WE%sT 1984 Mar 16 - 1:00 - CET 1986 - 0:00 Morocco WE%sT + 0:00 Morocco +00/+01 1984 Mar 16 + 1:00 - +01 1986 + 0:00 Morocco +00/+01 2018 Oct 27 + 1:00 - +01 # Western Sahara # @@ -946,7 +913,8 @@ Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 Zone Africa/El_Aaiun -0:52:48 - LMT 1934 Jan # El Aaiún -1:00 - -01 1976 Apr 14 - 0:00 Morocco WE%sT + 0:00 Morocco +00/+01 2018 Oct 27 + 1:00 - +01 # Mozambique # Modified: stable/12/contrib/tzdata/europe ============================================================================== --- stable/12/contrib/tzdata/europe Wed Oct 31 01:27:44 2018 (r339936) +++ stable/12/contrib/tzdata/europe Wed Oct 31 01:57:51 2018 (r339937) @@ -3440,7 +3440,8 @@ Rule Spain 1978 only - Oct 1 2:00s 0 - #Rule NatSpain 1937 only - May 22 23:00 1:00 S #Rule NatSpain 1937 1938 - Oct Sat>=1 24:00s 0 - #Rule NatSpain 1938 only - Mar 26 23:00 1:00 S -# The following rules are copied from Morocco from 1967 through 1978. +# The following rules are copied from Morocco from 1967 through 1978, +# except with "S" letters. Rule SpainAfrica 1967 only - Jun 3 12:00 1:00 S Rule SpainAfrica 1967 only - Oct 1 0:00 0 - Rule SpainAfrica 1974 only - Jun 24 0:00 1:00 S Modified: stable/12/contrib/tzdata/northamerica ============================================================================== --- stable/12/contrib/tzdata/northamerica Wed Oct 31 01:27:44 2018 (r339936) +++ stable/12/contrib/tzdata/northamerica Wed Oct 31 01:57:51 2018 (r339937) @@ -439,6 +439,19 @@ Zone America/North_Dakota/Beulah -6:47:07 - LMT 1883 N # western South Dakota, far western Texas (El Paso County, Hudspeth County, # and Pine Springs and Nickel Creek in Culberson County), Utah, Wyoming # +# From Paul Eggert (2018-10-25): +# On 1921-03-04 federal law placed all of Texas into the central time zone. +# However, El Paso ignored the law for decades and continued to observe +# mountain time, on the grounds that that's what they had always done +# and they weren't about to let the federal government tell them what to do. +# Eventually the federal government gave in and changed the law on +# 1970-04-10 to match what El Paso was actually doing. Although +# that's slightly after our 1970 cutoff, there is no need to create a +# separate zone for El Paso since they were ignoring the law anyway. See: +# Long T. El Pasoans were time rebels, fought to stay in Mountain zone. +# El Paso Times. 2018-10-24 06:40 -06. +# https://www.elpasotimes.com/story/news/local/el-paso/2018/10/24/el-pasoans-were-time-rebels-fought-stay-mountain-zone/1744509002/ +# # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER Rule Denver 1920 1921 - Mar lastSun 2:00 1:00 D Rule Denver 1920 only - Oct lastSun 2:00 0 S @@ -708,9 +721,7 @@ Zone America/Adak 12:13:22 - LMT 1867 Oct 19 12:44:35 Zone Pacific/Honolulu -10:31:26 - LMT 1896 Jan 13 12:00 -10:30 - HST 1933 Apr 30 2:00 -10:30 1:00 HDT 1933 May 21 12:00 - -10:30 - HST 1942 Feb 9 2:00 - -10:30 1:00 HDT 1945 Sep 30 2:00 - -10:30 - HST 1947 Jun 8 2:00 + -10:30 US H%sT 1947 Jun 8 2:00 -10:00 - HST # Now we turn to US areas that have diverged from the consensus since 1970. Modified: stable/12/contrib/tzdata/theory.html ============================================================================== --- stable/12/contrib/tzdata/theory.html Wed Oct 31 01:27:44 2018 (r339936) +++ stable/12/contrib/tzdata/theory.html Wed Oct 31 01:57:51 2018 (r339937) @@ -407,7 +407,7 @@ in decreasing order of importance: EST/EDT/EWT/EPT/EDDT Eastern [North America], EET/EEST Eastern European, GST Guam, - HST/HDT Hawaii, + HST/HDT/HWT/HPT Hawaii, HKT/HKST Hong Kong, IST India, IST/GMT Irish, Modified: stable/12/contrib/tzdata/version ============================================================================== --- stable/12/contrib/tzdata/version Wed Oct 31 01:27:44 2018 (r339936) +++ stable/12/contrib/tzdata/version Wed Oct 31 01:57:51 2018 (r339937) @@ -1 +1 @@ -2018f +2018g Modified: stable/12/contrib/tzdata/ziguard.awk ============================================================================== --- stable/12/contrib/tzdata/ziguard.awk Wed Oct 31 01:27:44 2018 (r339936) +++ stable/12/contrib/tzdata/ziguard.awk Wed Oct 31 01:57:51 2018 (r339937) @@ -80,6 +80,13 @@ DATAFORM != "main" { if (comment_out) { sub(/^/, "#") } + + # In rearguard format, change the Japan rule line with "Sat>=8 25:00" + # to "Sun>=9 1:00", to cater to zic before 2007 and to older Java. + if (!vanguard && $1 == "Rule" && $7 == "Sat>=8" && $8 == "25:00") { + sub(/Sat>=8/, "Sun>=9") + sub(/25:00/, " 1:00") + } } # If a Link line is followed by a Zone line for the same data, comment Modified: stable/12/contrib/tzdata/zishrink.awk ============================================================================== --- stable/12/contrib/tzdata/zishrink.awk Wed Oct 31 01:27:44 2018 (r339936) +++ stable/12/contrib/tzdata/zishrink.awk Wed Oct 31 01:57:51 2018 (r339937) @@ -172,11 +172,6 @@ function process_input_line(line, field, end, i, n, st if (line ~ /^R /) return line = substr(line, 1, RSTART) substr(line, RSTART + 5) } - # Replace SpainAfrica rules with Morocco, as they are duplicates. - if (match(line, / SpainAfrica /)) { - if (line ~ /^R /) return - line = substr(line, 1, RSTART) "Morocco" substr(line, RSTART + RLENGTH - 1) - } # Abbreviate times. while (match(line, /[: ]0+[0-9]/)) From owner-svn-src-stable@freebsd.org Wed Oct 31 02:01:31 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2024310727D5; Wed, 31 Oct 2018 02:01:31 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA462850F0; Wed, 31 Oct 2018 02:01:30 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 AB4FF25C8E; Wed, 31 Oct 2018 02:01:30 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9V21UO5045897; Wed, 31 Oct 2018 02:01:30 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9V21Sks045889; Wed, 31 Oct 2018 02:01:28 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201810310201.w9V21Sks045889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Wed, 31 Oct 2018 02:01:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339938 - stable/11/contrib/tzdata X-SVN-Group: stable-11 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: stable/11/contrib/tzdata X-SVN-Commit-Revision: 339938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 02:01:31 -0000 Author: philip Date: Wed Oct 31 02:01:28 2018 New Revision: 339938 URL: https://svnweb.freebsd.org/changeset/base/339938 Log: MFC r339848: Import tzdata 2018g Modified: stable/11/contrib/tzdata/NEWS stable/11/contrib/tzdata/africa stable/11/contrib/tzdata/europe stable/11/contrib/tzdata/northamerica stable/11/contrib/tzdata/theory.html stable/11/contrib/tzdata/version stable/11/contrib/tzdata/ziguard.awk stable/11/contrib/tzdata/zishrink.awk Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/tzdata/NEWS ============================================================================== --- stable/11/contrib/tzdata/NEWS Wed Oct 31 01:57:51 2018 (r339937) +++ stable/11/contrib/tzdata/NEWS Wed Oct 31 02:01:28 2018 (r339938) @@ -1,5 +1,40 @@ News for the tz database +Release 2018g - 2018-10-26 22:22:45 -0700 + + Briefly: + Morocco switches to permanent +01 on 2018-10-27. + + Changes to future timestamps + + Morocco switches from +00/+01 to permanent +01 effective 2018-10-27, + so its clocks will not fall back on 2018-10-28 as previously scheduled. + (Thanks to Mohamed Essedik Najd and Brian Inglis.) + + Changes to code + + When generating TZif files with leap seconds, zic no longer uses a + format that trips up older 32-bit clients, fixing a bug introduced + in 2018f. (Reported by Daniel Fischer.) Also, the zic workaround + for QTBUG-53071 now also works for TZif files with leap seconds. + + The translator to rearguard format now rewrites the line + "Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S" to + "Rule Japan 1948 1951 - Sep Sun>=9 1:00 0 S". + This caters to zic before 2007 and to Oracle TZUpdater 2.2.0 + and earlier. (Reported by Christos Zoulas.) + + Changes to past time zone abbreviations + + Change HDT to HWT/HPT for WWII-era abbreviations in Hawaii. + This reverts to 2011h, as the abbreviation change in 2011i was + likely inadvertent. + + Changes to documentation + + tzfile.5 has new sections on interoperability issues. + + Release 2018f - 2018-10-18 00:14:18 -0700 Briefly: Modified: stable/11/contrib/tzdata/africa ============================================================================== --- stable/11/contrib/tzdata/africa Wed Oct 31 01:57:51 2018 (r339937) +++ stable/11/contrib/tzdata/africa Wed Oct 31 02:01:28 2018 (r339938) @@ -844,94 +844,61 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # agrees # with the patch. -# From Paul Eggert (2015-06-08): -# For now, guess that later spring and fall transitions will use 2015's rules, -# and guess that Morocco will switch to standard time at 03:00 the last -# Sunday before Ramadan, and back to DST at 02:00 the first Sunday after -# Ramadan. To implement this, transition dates for 2016 through 2037 were -# determined by running the following program under GNU Emacs 24.3, with the -# results integrated by hand into the table below. -# (let ((islamic-year 1437)) -# (require 'cal-islam) -# (while (< islamic-year 1460) -# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) -# (b (calendar-islamic-to-absolute (list 10 1 islamic-year))) -# (sunday 0)) -# (while (/= sunday (mod (setq a (1- a)) 7))) -# (while (/= sunday (mod b 7)) -# (setq b (1+ b))) -# (setq a (calendar-gregorian-from-absolute a)) -# (setq b (calendar-gregorian-from-absolute b)) -# (insert -# (format -# (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 3:00\t0\t-\n" -# "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 2:00\t1:00\tS\n") -# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a)) -# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b))))) -# (setq islamic-year (+ 1 islamic-year)))) +# From Mohamed Essedik Najd (2018-10-26): +# Today, a Moroccan government council approved the perpetual addition +# of 60 minutes to the regular Moroccan timezone. +# From Brian Inglis (2018-10-26): +# http://www.maroc.ma/fr/actualites/le-conseil-de-gouvernement-adopte-un-projet-de-decret-relatif-lheure-legale-stipulant-le # RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S - -Rule Morocco 1939 only - Sep 12 0:00 1:00 S +Rule Morocco 1939 only - Sep 12 0:00 1:00 - Rule Morocco 1939 only - Nov 19 0:00 0 - -Rule Morocco 1940 only - Feb 25 0:00 1:00 S +Rule Morocco 1940 only - Feb 25 0:00 1:00 - Rule Morocco 1945 only - Nov 18 0:00 0 - -Rule Morocco 1950 only - Jun 11 0:00 1:00 S +Rule Morocco 1950 only - Jun 11 0:00 1:00 - Rule Morocco 1950 only - Oct 29 0:00 0 - -Rule Morocco 1967 only - Jun 3 12:00 1:00 S +Rule Morocco 1967 only - Jun 3 12:00 1:00 - Rule Morocco 1967 only - Oct 1 0:00 0 - -Rule Morocco 1974 only - Jun 24 0:00 1:00 S +Rule Morocco 1974 only - Jun 24 0:00 1:00 - Rule Morocco 1974 only - Sep 1 0:00 0 - -Rule Morocco 1976 1977 - May 1 0:00 1:00 S +Rule Morocco 1976 1977 - May 1 0:00 1:00 - Rule Morocco 1976 only - Aug 1 0:00 0 - Rule Morocco 1977 only - Sep 28 0:00 0 - -Rule Morocco 1978 only - Jun 1 0:00 1:00 S +Rule Morocco 1978 only - Jun 1 0:00 1:00 - Rule Morocco 1978 only - Aug 4 0:00 0 - -Rule Morocco 2008 only - Jun 1 0:00 1:00 S +Rule Morocco 2008 only - Jun 1 0:00 1:00 - Rule Morocco 2008 only - Sep 1 0:00 0 - -Rule Morocco 2009 only - Jun 1 0:00 1:00 S +Rule Morocco 2009 only - Jun 1 0:00 1:00 - Rule Morocco 2009 only - Aug 21 0:00 0 - -Rule Morocco 2010 only - May 2 0:00 1:00 S +Rule Morocco 2010 only - May 2 0:00 1:00 - Rule Morocco 2010 only - Aug 8 0:00 0 - -Rule Morocco 2011 only - Apr 3 0:00 1:00 S +Rule Morocco 2011 only - Apr 3 0:00 1:00 - Rule Morocco 2011 only - Jul 31 0:00 0 - -Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 S +Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 - Rule Morocco 2012 only - Jul 20 3:00 0 - -Rule Morocco 2012 only - Aug 20 2:00 1:00 S +Rule Morocco 2012 only - Aug 20 2:00 1:00 - Rule Morocco 2012 only - Sep 30 3:00 0 - Rule Morocco 2013 only - Jul 7 3:00 0 - -Rule Morocco 2013 only - Aug 10 2:00 1:00 S -Rule Morocco 2013 max - Oct lastSun 3:00 0 - -Rule Morocco 2014 2021 - Mar lastSun 2:00 1:00 S +Rule Morocco 2013 only - Aug 10 2:00 1:00 - +Rule Morocco 2013 2018 - Oct lastSun 3:00 0 - +Rule Morocco 2014 2018 - Mar lastSun 2:00 1:00 - Rule Morocco 2014 only - Jun 28 3:00 0 - -Rule Morocco 2014 only - Aug 2 2:00 1:00 S +Rule Morocco 2014 only - Aug 2 2:00 1:00 - Rule Morocco 2015 only - Jun 14 3:00 0 - -Rule Morocco 2015 only - Jul 19 2:00 1:00 S +Rule Morocco 2015 only - Jul 19 2:00 1:00 - Rule Morocco 2016 only - Jun 5 3:00 0 - -Rule Morocco 2016 only - Jul 10 2:00 1:00 S +Rule Morocco 2016 only - Jul 10 2:00 1:00 - Rule Morocco 2017 only - May 21 3:00 0 - -Rule Morocco 2017 only - Jul 2 2:00 1:00 S +Rule Morocco 2017 only - Jul 2 2:00 1:00 - Rule Morocco 2018 only - May 13 3:00 0 - -Rule Morocco 2018 only - Jun 17 2:00 1:00 S -Rule Morocco 2019 only - May 5 3:00 0 - -Rule Morocco 2019 only - Jun 9 2:00 1:00 S -Rule Morocco 2020 only - Apr 19 3:00 0 - -Rule Morocco 2020 only - May 24 2:00 1:00 S -Rule Morocco 2021 only - Apr 11 3:00 0 - -Rule Morocco 2021 only - May 16 2:00 1:00 S -Rule Morocco 2022 only - May 8 2:00 1:00 S -Rule Morocco 2023 only - Apr 23 2:00 1:00 S -Rule Morocco 2024 only - Apr 14 2:00 1:00 S -Rule Morocco 2025 only - Apr 6 2:00 1:00 S -Rule Morocco 2026 max - Mar lastSun 2:00 1:00 S -Rule Morocco 2036 only - Oct 19 3:00 0 - -Rule Morocco 2037 only - Oct 4 3:00 0 - +Rule Morocco 2018 only - Jun 17 2:00 1:00 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 - 0:00 Morocco WE%sT 1984 Mar 16 - 1:00 - CET 1986 - 0:00 Morocco WE%sT + 0:00 Morocco +00/+01 1984 Mar 16 + 1:00 - +01 1986 + 0:00 Morocco +00/+01 2018 Oct 27 + 1:00 - +01 # Western Sahara # @@ -946,7 +913,8 @@ Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 Zone Africa/El_Aaiun -0:52:48 - LMT 1934 Jan # El Aaiún -1:00 - -01 1976 Apr 14 - 0:00 Morocco WE%sT + 0:00 Morocco +00/+01 2018 Oct 27 + 1:00 - +01 # Mozambique # Modified: stable/11/contrib/tzdata/europe ============================================================================== --- stable/11/contrib/tzdata/europe Wed Oct 31 01:57:51 2018 (r339937) +++ stable/11/contrib/tzdata/europe Wed Oct 31 02:01:28 2018 (r339938) @@ -3440,7 +3440,8 @@ Rule Spain 1978 only - Oct 1 2:00s 0 - #Rule NatSpain 1937 only - May 22 23:00 1:00 S #Rule NatSpain 1937 1938 - Oct Sat>=1 24:00s 0 - #Rule NatSpain 1938 only - Mar 26 23:00 1:00 S -# The following rules are copied from Morocco from 1967 through 1978. +# The following rules are copied from Morocco from 1967 through 1978, +# except with "S" letters. Rule SpainAfrica 1967 only - Jun 3 12:00 1:00 S Rule SpainAfrica 1967 only - Oct 1 0:00 0 - Rule SpainAfrica 1974 only - Jun 24 0:00 1:00 S Modified: stable/11/contrib/tzdata/northamerica ============================================================================== --- stable/11/contrib/tzdata/northamerica Wed Oct 31 01:57:51 2018 (r339937) +++ stable/11/contrib/tzdata/northamerica Wed Oct 31 02:01:28 2018 (r339938) @@ -439,6 +439,19 @@ Zone America/North_Dakota/Beulah -6:47:07 - LMT 1883 N # western South Dakota, far western Texas (El Paso County, Hudspeth County, # and Pine Springs and Nickel Creek in Culberson County), Utah, Wyoming # +# From Paul Eggert (2018-10-25): +# On 1921-03-04 federal law placed all of Texas into the central time zone. +# However, El Paso ignored the law for decades and continued to observe +# mountain time, on the grounds that that's what they had always done +# and they weren't about to let the federal government tell them what to do. +# Eventually the federal government gave in and changed the law on +# 1970-04-10 to match what El Paso was actually doing. Although +# that's slightly after our 1970 cutoff, there is no need to create a +# separate zone for El Paso since they were ignoring the law anyway. See: +# Long T. El Pasoans were time rebels, fought to stay in Mountain zone. +# El Paso Times. 2018-10-24 06:40 -06. +# https://www.elpasotimes.com/story/news/local/el-paso/2018/10/24/el-pasoans-were-time-rebels-fought-stay-mountain-zone/1744509002/ +# # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER Rule Denver 1920 1921 - Mar lastSun 2:00 1:00 D Rule Denver 1920 only - Oct lastSun 2:00 0 S @@ -708,9 +721,7 @@ Zone America/Adak 12:13:22 - LMT 1867 Oct 19 12:44:35 Zone Pacific/Honolulu -10:31:26 - LMT 1896 Jan 13 12:00 -10:30 - HST 1933 Apr 30 2:00 -10:30 1:00 HDT 1933 May 21 12:00 - -10:30 - HST 1942 Feb 9 2:00 - -10:30 1:00 HDT 1945 Sep 30 2:00 - -10:30 - HST 1947 Jun 8 2:00 + -10:30 US H%sT 1947 Jun 8 2:00 -10:00 - HST # Now we turn to US areas that have diverged from the consensus since 1970. Modified: stable/11/contrib/tzdata/theory.html ============================================================================== --- stable/11/contrib/tzdata/theory.html Wed Oct 31 01:57:51 2018 (r339937) +++ stable/11/contrib/tzdata/theory.html Wed Oct 31 02:01:28 2018 (r339938) @@ -407,7 +407,7 @@ in decreasing order of importance: EST/EDT/EWT/EPT/EDDT Eastern [North America], EET/EEST Eastern European, GST Guam, - HST/HDT Hawaii, + HST/HDT/HWT/HPT Hawaii, HKT/HKST Hong Kong, IST India, IST/GMT Irish, Modified: stable/11/contrib/tzdata/version ============================================================================== --- stable/11/contrib/tzdata/version Wed Oct 31 01:57:51 2018 (r339937) +++ stable/11/contrib/tzdata/version Wed Oct 31 02:01:28 2018 (r339938) @@ -1 +1 @@ -2018f +2018g Modified: stable/11/contrib/tzdata/ziguard.awk ============================================================================== --- stable/11/contrib/tzdata/ziguard.awk Wed Oct 31 01:57:51 2018 (r339937) +++ stable/11/contrib/tzdata/ziguard.awk Wed Oct 31 02:01:28 2018 (r339938) @@ -80,6 +80,13 @@ DATAFORM != "main" { if (comment_out) { sub(/^/, "#") } + + # In rearguard format, change the Japan rule line with "Sat>=8 25:00" + # to "Sun>=9 1:00", to cater to zic before 2007 and to older Java. + if (!vanguard && $1 == "Rule" && $7 == "Sat>=8" && $8 == "25:00") { + sub(/Sat>=8/, "Sun>=9") + sub(/25:00/, " 1:00") + } } # If a Link line is followed by a Zone line for the same data, comment Modified: stable/11/contrib/tzdata/zishrink.awk ============================================================================== --- stable/11/contrib/tzdata/zishrink.awk Wed Oct 31 01:57:51 2018 (r339937) +++ stable/11/contrib/tzdata/zishrink.awk Wed Oct 31 02:01:28 2018 (r339938) @@ -172,11 +172,6 @@ function process_input_line(line, field, end, i, n, st if (line ~ /^R /) return line = substr(line, 1, RSTART) substr(line, RSTART + 5) } - # Replace SpainAfrica rules with Morocco, as they are duplicates. - if (match(line, / SpainAfrica /)) { - if (line ~ /^R /) return - line = substr(line, 1, RSTART) "Morocco" substr(line, RSTART + RLENGTH - 1) - } # Abbreviate times. while (match(line, /[: ]0+[0-9]/)) From owner-svn-src-stable@freebsd.org Wed Oct 31 02:02:14 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0FEA1072837; Wed, 31 Oct 2018 02:02:14 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 65BBD8539C; Wed, 31 Oct 2018 02:02:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 478A325CC0; Wed, 31 Oct 2018 02:02:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9V22EKv045995; Wed, 31 Oct 2018 02:02:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9V22C20045988; Wed, 31 Oct 2018 02:02:12 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201810310202.w9V22C20045988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 31 Oct 2018 02:02:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339939 - in stable/12: share/man/man9 sys/kern sys/sys sys/vm sys/x86/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12: share/man/man9 sys/kern sys/sys sys/vm sys/x86/acpica X-SVN-Commit-Revision: 339939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 02:02:15 -0000 Author: markj Date: Wed Oct 31 02:02:12 2018 New Revision: 339939 URL: https://svnweb.freebsd.org/changeset/base/339939 Log: MFC r339452, r339664: Create some global domainsets and refactor NUMA registration. Approved by: re (kib) Modified: stable/12/share/man/man9/domainset.9 stable/12/sys/kern/kern_cpuset.c stable/12/sys/sys/domainset.h stable/12/sys/vm/vm_init.c stable/12/sys/vm/vm_phys.c stable/12/sys/vm/vm_phys.h stable/12/sys/x86/acpica/srat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man9/domainset.9 ============================================================================== --- stable/12/share/man/man9/domainset.9 Wed Oct 31 02:01:28 2018 (r339938) +++ stable/12/share/man/man9/domainset.9 Wed Oct 31 02:02:12 2018 (r339939) @@ -24,14 +24,11 @@ .\" .\" $FreeBSD$ .\" -.Dd March 24, 2018 +.Dd October 20, 2018 .Dt DOMAINSET 9 .Os .Sh NAME .Nm domainset(9) -\(em -.Nm domainset_create , -.Nm sysctl_handle_domainset . .Nd domainset functions and operation .Sh SYNOPSIS .In sys/_domainset.h @@ -46,6 +43,8 @@ struct domainset { }; .Ed .Pp +.Fn DOMAINSET_RR +.Fn DOMAINSET_PREF domain .Ft struct domainset * .Fn domainset_create "const struct domainset *key" .Ft int @@ -98,6 +97,12 @@ This gives good distribution among memory domains whil efficiency higher and is preferential to round-robin for general use. .El .Pp +The +.Fn DOMAINSET_RR +and +.Fn DOMAINSET_PREF +provide pointers to global pre-defined policies for use when the +desired policy is known at compile time. The .Fn domainset_create function takes a partially filled in domainset as a key and returns a Modified: stable/12/sys/kern/kern_cpuset.c ============================================================================== --- stable/12/sys/kern/kern_cpuset.c Wed Oct 31 02:01:28 2018 (r339938) +++ stable/12/sys/kern/kern_cpuset.c Wed Oct 31 02:02:12 2018 (r339939) @@ -119,6 +119,8 @@ __FBSDID("$FreeBSD$"); */ LIST_HEAD(domainlist, domainset); +struct domainset __read_mostly domainset_prefer[MAXMEMDOM]; +struct domainset __read_mostly domainset_roundrobin; static uma_zone_t cpuset_zone; static uma_zone_t domainset_zone; @@ -1369,28 +1371,53 @@ cpuset_setithread(lwpid_t id, int cpu) } /* + * Initialize static domainsets after NUMA information is available. This is + * called very early during boot. + */ +void +domainset_init(void) +{ + struct domainset *dset; + int i; + + dset = &domainset_roundrobin; + DOMAINSET_COPY(&all_domains, &dset->ds_mask); + dset->ds_policy = DOMAINSET_POLICY_ROUNDROBIN; + dset->ds_prefer = -1; + _domainset_create(dset, NULL); + + for (i = 0; i < vm_ndomains; i++) { + dset = &domainset_prefer[i]; + DOMAINSET_COPY(&all_domains, &dset->ds_mask); + dset->ds_policy = DOMAINSET_POLICY_PREFER; + dset->ds_prefer = i; + _domainset_create(dset, NULL); + } +} + +/* * Create the domainset for cpuset 0, 1 and cpuset 2. */ void domainset_zero(void) { struct domainset *dset; - int i; mtx_init(&cpuset_lock, "cpuset", NULL, MTX_SPIN | MTX_RECURSE); dset = &domainset0; - DOMAINSET_ZERO(&dset->ds_mask); - for (i = 0; i < vm_ndomains; i++) - DOMAINSET_SET(i, &dset->ds_mask); + DOMAINSET_COPY(&all_domains, &dset->ds_mask); dset->ds_policy = DOMAINSET_POLICY_FIRSTTOUCH; dset->ds_prefer = -1; - (void)domainset_empty_vm(dset); curthread->td_domain.dr_policy = _domainset_create(dset, NULL); domainset_copy(dset, &domainset2); domainset2.ds_policy = DOMAINSET_POLICY_INTERLEAVE; kernel_object->domain.dr_policy = _domainset_create(&domainset2, NULL); + + /* Remove empty domains from the global policies. */ + LIST_FOREACH(dset, &cpuset_domains, ds_link) + (void)domainset_empty_vm(dset); } /* Modified: stable/12/sys/sys/domainset.h ============================================================================== --- stable/12/sys/sys/domainset.h Wed Oct 31 02:01:28 2018 (r339938) +++ stable/12/sys/sys/domainset.h Wed Oct 31 02:02:12 2018 (r339939) @@ -32,8 +32,8 @@ #define _SYS_DOMAINSET_H_ #include - #include +#include #define _NDOMAINSETBITS _BITSET_BITS #define _NDOMAINSETWORDS __bitset_words(DOMAINSET_SETSIZE) @@ -96,6 +96,12 @@ struct domainset { domainid_t ds_order[MAXMEMDOM]; /* nth domain table. */ }; +extern struct domainset domainset_prefer[MAXMEMDOM]; +#define DOMAINSET_PREF(domain) (&domainset_prefer[(domain)]) +extern struct domainset domainset_roundrobin; +#define DOMAINSET_RR() (&domainset_roundrobin) + +void domainset_init(void); void domainset_zero(void); /* Modified: stable/12/sys/vm/vm_init.c ============================================================================== --- stable/12/sys/vm/vm_init.c Wed Oct 31 02:01:28 2018 (r339938) +++ stable/12/sys/vm/vm_init.c Wed Oct 31 02:02:12 2018 (r339939) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -115,6 +116,11 @@ SYSINIT(vm_mem, SI_SUB_VM, SI_ORDER_FIRST, vm_mem_init static void vm_mem_init(void *dummy) { + + /* + * Initialize static domainsets, used by various allocators. + */ + domainset_init(); /* * Initializes resident memory structures. From here on, all physical Modified: stable/12/sys/vm/vm_phys.c ============================================================================== --- stable/12/sys/vm/vm_phys.c Wed Oct 31 02:01:28 2018 (r339938) +++ stable/12/sys/vm/vm_phys.c Wed Oct 31 02:02:12 2018 (r339939) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -584,6 +585,31 @@ vm_phys_init(void) } rw_init(&vm_phys_fictitious_reg_lock, "vmfctr"); +} + +/* + * Register info about the NUMA topology of the system. + * + * Invoked by platform-dependent code prior to vm_phys_init(). + */ +void +vm_phys_register_domains(int ndomains, struct mem_affinity *affinity, + int *locality) +{ +#ifdef NUMA + int i; + + vm_ndomains = ndomains; + mem_affinity = affinity; + mem_locality = locality; + + for (i = 0; i < vm_ndomains; i++) + DOMAINSET_SET(i, &all_domains); +#else + (void)ndomains; + (void)affinity; + (void)locality; +#endif } /* Modified: stable/12/sys/vm/vm_phys.h ============================================================================== --- stable/12/sys/vm/vm_phys.h Wed Oct 31 02:01:28 2018 (r339938) +++ stable/12/sys/vm/vm_phys.h Wed Oct 31 02:02:12 2018 (r339939) @@ -88,6 +88,8 @@ void vm_phys_free_contig(vm_page_t m, u_long npages); void vm_phys_free_pages(vm_page_t m, int order); void vm_phys_init(void); vm_page_t vm_phys_paddr_to_vm_page(vm_paddr_t pa); +void vm_phys_register_domains(int ndomains, struct mem_affinity *affinity, + int *locality); vm_page_t vm_phys_scan_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, int options); void vm_phys_set_pool(int pool, vm_page_t m, int order); Modified: stable/12/sys/x86/acpica/srat.c ============================================================================== --- stable/12/sys/x86/acpica/srat.c Wed Oct 31 02:01:28 2018 (r339938) +++ stable/12/sys/x86/acpica/srat.c Wed Oct 31 02:02:12 2018 (r339939) @@ -153,10 +153,6 @@ parse_slit(void) acpi_unmap_table(slit); slit = NULL; -#ifdef NUMA - /* Tell the VM about it! */ - mem_locality = vm_locality_table; -#endif return (0); } @@ -481,13 +477,6 @@ parse_srat(void) return (-1); } -#ifdef NUMA - vm_ndomains = ndomain; - for (int i = 0; i < vm_ndomains; i++) - DOMAINSET_SET(i, &all_domains); - mem_affinity = mem_info; -#endif - return (0); } @@ -511,7 +500,8 @@ parse_acpi_tables(void *dummy) if (parse_srat() < 0) return; init_mem_locality(); - (void) parse_slit(); + (void)parse_slit(); + vm_phys_register_domains(ndomain, mem_info, vm_locality_table); } SYSINIT(parse_acpi_tables, SI_SUB_VM - 1, SI_ORDER_FIRST, parse_acpi_tables, NULL); From owner-svn-src-stable@freebsd.org Wed Oct 31 02:02:43 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9859A10728A3; Wed, 31 Oct 2018 02:02:43 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45343856A3; Wed, 31 Oct 2018 02:02:43 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 2646225DE7; Wed, 31 Oct 2018 02:02:43 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9V22h9O046061; Wed, 31 Oct 2018 02:02:43 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9V22feO046054; Wed, 31 Oct 2018 02:02:41 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201810310202.w9V22feO046054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Wed, 31 Oct 2018 02:02:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r339940 - stable/10/contrib/tzdata X-SVN-Group: stable-10 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: stable/10/contrib/tzdata X-SVN-Commit-Revision: 339940 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 02:02:43 -0000 Author: philip Date: Wed Oct 31 02:02:41 2018 New Revision: 339940 URL: https://svnweb.freebsd.org/changeset/base/339940 Log: MFC r339848: Import tzdata 2018g Modified: stable/10/contrib/tzdata/NEWS stable/10/contrib/tzdata/africa stable/10/contrib/tzdata/europe stable/10/contrib/tzdata/northamerica stable/10/contrib/tzdata/theory.html stable/10/contrib/tzdata/version stable/10/contrib/tzdata/ziguard.awk stable/10/contrib/tzdata/zishrink.awk Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/tzdata/NEWS ============================================================================== --- stable/10/contrib/tzdata/NEWS Wed Oct 31 02:02:12 2018 (r339939) +++ stable/10/contrib/tzdata/NEWS Wed Oct 31 02:02:41 2018 (r339940) @@ -1,5 +1,40 @@ News for the tz database +Release 2018g - 2018-10-26 22:22:45 -0700 + + Briefly: + Morocco switches to permanent +01 on 2018-10-27. + + Changes to future timestamps + + Morocco switches from +00/+01 to permanent +01 effective 2018-10-27, + so its clocks will not fall back on 2018-10-28 as previously scheduled. + (Thanks to Mohamed Essedik Najd and Brian Inglis.) + + Changes to code + + When generating TZif files with leap seconds, zic no longer uses a + format that trips up older 32-bit clients, fixing a bug introduced + in 2018f. (Reported by Daniel Fischer.) Also, the zic workaround + for QTBUG-53071 now also works for TZif files with leap seconds. + + The translator to rearguard format now rewrites the line + "Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S" to + "Rule Japan 1948 1951 - Sep Sun>=9 1:00 0 S". + This caters to zic before 2007 and to Oracle TZUpdater 2.2.0 + and earlier. (Reported by Christos Zoulas.) + + Changes to past time zone abbreviations + + Change HDT to HWT/HPT for WWII-era abbreviations in Hawaii. + This reverts to 2011h, as the abbreviation change in 2011i was + likely inadvertent. + + Changes to documentation + + tzfile.5 has new sections on interoperability issues. + + Release 2018f - 2018-10-18 00:14:18 -0700 Briefly: Modified: stable/10/contrib/tzdata/africa ============================================================================== --- stable/10/contrib/tzdata/africa Wed Oct 31 02:02:12 2018 (r339939) +++ stable/10/contrib/tzdata/africa Wed Oct 31 02:02:41 2018 (r339940) @@ -844,94 +844,61 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # agrees # with the patch. -# From Paul Eggert (2015-06-08): -# For now, guess that later spring and fall transitions will use 2015's rules, -# and guess that Morocco will switch to standard time at 03:00 the last -# Sunday before Ramadan, and back to DST at 02:00 the first Sunday after -# Ramadan. To implement this, transition dates for 2016 through 2037 were -# determined by running the following program under GNU Emacs 24.3, with the -# results integrated by hand into the table below. -# (let ((islamic-year 1437)) -# (require 'cal-islam) -# (while (< islamic-year 1460) -# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) -# (b (calendar-islamic-to-absolute (list 10 1 islamic-year))) -# (sunday 0)) -# (while (/= sunday (mod (setq a (1- a)) 7))) -# (while (/= sunday (mod b 7)) -# (setq b (1+ b))) -# (setq a (calendar-gregorian-from-absolute a)) -# (setq b (calendar-gregorian-from-absolute b)) -# (insert -# (format -# (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 3:00\t0\t-\n" -# "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 2:00\t1:00\tS\n") -# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a)) -# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b))))) -# (setq islamic-year (+ 1 islamic-year)))) +# From Mohamed Essedik Najd (2018-10-26): +# Today, a Moroccan government council approved the perpetual addition +# of 60 minutes to the regular Moroccan timezone. +# From Brian Inglis (2018-10-26): +# http://www.maroc.ma/fr/actualites/le-conseil-de-gouvernement-adopte-un-projet-de-decret-relatif-lheure-legale-stipulant-le # RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S - -Rule Morocco 1939 only - Sep 12 0:00 1:00 S +Rule Morocco 1939 only - Sep 12 0:00 1:00 - Rule Morocco 1939 only - Nov 19 0:00 0 - -Rule Morocco 1940 only - Feb 25 0:00 1:00 S +Rule Morocco 1940 only - Feb 25 0:00 1:00 - Rule Morocco 1945 only - Nov 18 0:00 0 - -Rule Morocco 1950 only - Jun 11 0:00 1:00 S +Rule Morocco 1950 only - Jun 11 0:00 1:00 - Rule Morocco 1950 only - Oct 29 0:00 0 - -Rule Morocco 1967 only - Jun 3 12:00 1:00 S +Rule Morocco 1967 only - Jun 3 12:00 1:00 - Rule Morocco 1967 only - Oct 1 0:00 0 - -Rule Morocco 1974 only - Jun 24 0:00 1:00 S +Rule Morocco 1974 only - Jun 24 0:00 1:00 - Rule Morocco 1974 only - Sep 1 0:00 0 - -Rule Morocco 1976 1977 - May 1 0:00 1:00 S +Rule Morocco 1976 1977 - May 1 0:00 1:00 - Rule Morocco 1976 only - Aug 1 0:00 0 - Rule Morocco 1977 only - Sep 28 0:00 0 - -Rule Morocco 1978 only - Jun 1 0:00 1:00 S +Rule Morocco 1978 only - Jun 1 0:00 1:00 - Rule Morocco 1978 only - Aug 4 0:00 0 - -Rule Morocco 2008 only - Jun 1 0:00 1:00 S +Rule Morocco 2008 only - Jun 1 0:00 1:00 - Rule Morocco 2008 only - Sep 1 0:00 0 - -Rule Morocco 2009 only - Jun 1 0:00 1:00 S +Rule Morocco 2009 only - Jun 1 0:00 1:00 - Rule Morocco 2009 only - Aug 21 0:00 0 - -Rule Morocco 2010 only - May 2 0:00 1:00 S +Rule Morocco 2010 only - May 2 0:00 1:00 - Rule Morocco 2010 only - Aug 8 0:00 0 - -Rule Morocco 2011 only - Apr 3 0:00 1:00 S +Rule Morocco 2011 only - Apr 3 0:00 1:00 - Rule Morocco 2011 only - Jul 31 0:00 0 - -Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 S +Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 - Rule Morocco 2012 only - Jul 20 3:00 0 - -Rule Morocco 2012 only - Aug 20 2:00 1:00 S +Rule Morocco 2012 only - Aug 20 2:00 1:00 - Rule Morocco 2012 only - Sep 30 3:00 0 - Rule Morocco 2013 only - Jul 7 3:00 0 - -Rule Morocco 2013 only - Aug 10 2:00 1:00 S -Rule Morocco 2013 max - Oct lastSun 3:00 0 - -Rule Morocco 2014 2021 - Mar lastSun 2:00 1:00 S +Rule Morocco 2013 only - Aug 10 2:00 1:00 - +Rule Morocco 2013 2018 - Oct lastSun 3:00 0 - +Rule Morocco 2014 2018 - Mar lastSun 2:00 1:00 - Rule Morocco 2014 only - Jun 28 3:00 0 - -Rule Morocco 2014 only - Aug 2 2:00 1:00 S +Rule Morocco 2014 only - Aug 2 2:00 1:00 - Rule Morocco 2015 only - Jun 14 3:00 0 - -Rule Morocco 2015 only - Jul 19 2:00 1:00 S +Rule Morocco 2015 only - Jul 19 2:00 1:00 - Rule Morocco 2016 only - Jun 5 3:00 0 - -Rule Morocco 2016 only - Jul 10 2:00 1:00 S +Rule Morocco 2016 only - Jul 10 2:00 1:00 - Rule Morocco 2017 only - May 21 3:00 0 - -Rule Morocco 2017 only - Jul 2 2:00 1:00 S +Rule Morocco 2017 only - Jul 2 2:00 1:00 - Rule Morocco 2018 only - May 13 3:00 0 - -Rule Morocco 2018 only - Jun 17 2:00 1:00 S -Rule Morocco 2019 only - May 5 3:00 0 - -Rule Morocco 2019 only - Jun 9 2:00 1:00 S -Rule Morocco 2020 only - Apr 19 3:00 0 - -Rule Morocco 2020 only - May 24 2:00 1:00 S -Rule Morocco 2021 only - Apr 11 3:00 0 - -Rule Morocco 2021 only - May 16 2:00 1:00 S -Rule Morocco 2022 only - May 8 2:00 1:00 S -Rule Morocco 2023 only - Apr 23 2:00 1:00 S -Rule Morocco 2024 only - Apr 14 2:00 1:00 S -Rule Morocco 2025 only - Apr 6 2:00 1:00 S -Rule Morocco 2026 max - Mar lastSun 2:00 1:00 S -Rule Morocco 2036 only - Oct 19 3:00 0 - -Rule Morocco 2037 only - Oct 4 3:00 0 - +Rule Morocco 2018 only - Jun 17 2:00 1:00 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 - 0:00 Morocco WE%sT 1984 Mar 16 - 1:00 - CET 1986 - 0:00 Morocco WE%sT + 0:00 Morocco +00/+01 1984 Mar 16 + 1:00 - +01 1986 + 0:00 Morocco +00/+01 2018 Oct 27 + 1:00 - +01 # Western Sahara # @@ -946,7 +913,8 @@ Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 Zone Africa/El_Aaiun -0:52:48 - LMT 1934 Jan # El Aaiún -1:00 - -01 1976 Apr 14 - 0:00 Morocco WE%sT + 0:00 Morocco +00/+01 2018 Oct 27 + 1:00 - +01 # Mozambique # Modified: stable/10/contrib/tzdata/europe ============================================================================== --- stable/10/contrib/tzdata/europe Wed Oct 31 02:02:12 2018 (r339939) +++ stable/10/contrib/tzdata/europe Wed Oct 31 02:02:41 2018 (r339940) @@ -3440,7 +3440,8 @@ Rule Spain 1978 only - Oct 1 2:00s 0 - #Rule NatSpain 1937 only - May 22 23:00 1:00 S #Rule NatSpain 1937 1938 - Oct Sat>=1 24:00s 0 - #Rule NatSpain 1938 only - Mar 26 23:00 1:00 S -# The following rules are copied from Morocco from 1967 through 1978. +# The following rules are copied from Morocco from 1967 through 1978, +# except with "S" letters. Rule SpainAfrica 1967 only - Jun 3 12:00 1:00 S Rule SpainAfrica 1967 only - Oct 1 0:00 0 - Rule SpainAfrica 1974 only - Jun 24 0:00 1:00 S Modified: stable/10/contrib/tzdata/northamerica ============================================================================== --- stable/10/contrib/tzdata/northamerica Wed Oct 31 02:02:12 2018 (r339939) +++ stable/10/contrib/tzdata/northamerica Wed Oct 31 02:02:41 2018 (r339940) @@ -439,6 +439,19 @@ Zone America/North_Dakota/Beulah -6:47:07 - LMT 1883 N # western South Dakota, far western Texas (El Paso County, Hudspeth County, # and Pine Springs and Nickel Creek in Culberson County), Utah, Wyoming # +# From Paul Eggert (2018-10-25): +# On 1921-03-04 federal law placed all of Texas into the central time zone. +# However, El Paso ignored the law for decades and continued to observe +# mountain time, on the grounds that that's what they had always done +# and they weren't about to let the federal government tell them what to do. +# Eventually the federal government gave in and changed the law on +# 1970-04-10 to match what El Paso was actually doing. Although +# that's slightly after our 1970 cutoff, there is no need to create a +# separate zone for El Paso since they were ignoring the law anyway. See: +# Long T. El Pasoans were time rebels, fought to stay in Mountain zone. +# El Paso Times. 2018-10-24 06:40 -06. +# https://www.elpasotimes.com/story/news/local/el-paso/2018/10/24/el-pasoans-were-time-rebels-fought-stay-mountain-zone/1744509002/ +# # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER Rule Denver 1920 1921 - Mar lastSun 2:00 1:00 D Rule Denver 1920 only - Oct lastSun 2:00 0 S @@ -708,9 +721,7 @@ Zone America/Adak 12:13:22 - LMT 1867 Oct 19 12:44:35 Zone Pacific/Honolulu -10:31:26 - LMT 1896 Jan 13 12:00 -10:30 - HST 1933 Apr 30 2:00 -10:30 1:00 HDT 1933 May 21 12:00 - -10:30 - HST 1942 Feb 9 2:00 - -10:30 1:00 HDT 1945 Sep 30 2:00 - -10:30 - HST 1947 Jun 8 2:00 + -10:30 US H%sT 1947 Jun 8 2:00 -10:00 - HST # Now we turn to US areas that have diverged from the consensus since 1970. Modified: stable/10/contrib/tzdata/theory.html ============================================================================== --- stable/10/contrib/tzdata/theory.html Wed Oct 31 02:02:12 2018 (r339939) +++ stable/10/contrib/tzdata/theory.html Wed Oct 31 02:02:41 2018 (r339940) @@ -407,7 +407,7 @@ in decreasing order of importance: EST/EDT/EWT/EPT/EDDT Eastern [North America], EET/EEST Eastern European, GST Guam, - HST/HDT Hawaii, + HST/HDT/HWT/HPT Hawaii, HKT/HKST Hong Kong, IST India, IST/GMT Irish, Modified: stable/10/contrib/tzdata/version ============================================================================== --- stable/10/contrib/tzdata/version Wed Oct 31 02:02:12 2018 (r339939) +++ stable/10/contrib/tzdata/version Wed Oct 31 02:02:41 2018 (r339940) @@ -1 +1 @@ -2018f +2018g Modified: stable/10/contrib/tzdata/ziguard.awk ============================================================================== --- stable/10/contrib/tzdata/ziguard.awk Wed Oct 31 02:02:12 2018 (r339939) +++ stable/10/contrib/tzdata/ziguard.awk Wed Oct 31 02:02:41 2018 (r339940) @@ -80,6 +80,13 @@ DATAFORM != "main" { if (comment_out) { sub(/^/, "#") } + + # In rearguard format, change the Japan rule line with "Sat>=8 25:00" + # to "Sun>=9 1:00", to cater to zic before 2007 and to older Java. + if (!vanguard && $1 == "Rule" && $7 == "Sat>=8" && $8 == "25:00") { + sub(/Sat>=8/, "Sun>=9") + sub(/25:00/, " 1:00") + } } # If a Link line is followed by a Zone line for the same data, comment Modified: stable/10/contrib/tzdata/zishrink.awk ============================================================================== --- stable/10/contrib/tzdata/zishrink.awk Wed Oct 31 02:02:12 2018 (r339939) +++ stable/10/contrib/tzdata/zishrink.awk Wed Oct 31 02:02:41 2018 (r339940) @@ -172,11 +172,6 @@ function process_input_line(line, field, end, i, n, st if (line ~ /^R /) return line = substr(line, 1, RSTART) substr(line, RSTART + 5) } - # Replace SpainAfrica rules with Morocco, as they are duplicates. - if (match(line, / SpainAfrica /)) { - if (line ~ /^R /) return - line = substr(line, 1, RSTART) "Morocco" substr(line, RSTART + RLENGTH - 1) - } # Abbreviate times. while (match(line, /[: ]0+[0-9]/)) From owner-svn-src-stable@freebsd.org Wed Oct 31 06:24:08 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D612C107ADAE; Wed, 31 Oct 2018 06:24:08 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B8D38DD7E; Wed, 31 Oct 2018 06:24:08 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6C96F8D8; Wed, 31 Oct 2018 06:24:08 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9V6O8Ei079631; Wed, 31 Oct 2018 06:24:08 GMT (envelope-from whu@FreeBSD.org) Received: (from whu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9V6O8L5079630; Wed, 31 Oct 2018 06:24:08 GMT (envelope-from whu@FreeBSD.org) Message-Id: <201810310624.w9V6O8L5079630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: whu set sender to whu@FreeBSD.org using -f From: Wei Hu Date: Wed, 31 Oct 2018 06:24:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r339942 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 X-SVN-Commit-Author: whu X-SVN-Commit-Paths: stable/10/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 339942 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 06:24:09 -0000 Author: whu Date: Wed Oct 31 06:24:07 2018 New Revision: 339942 URL: https://svnweb.freebsd.org/changeset/base/339942 Log: MFC: 339585 r339585: Do not drop UDP traffic when TXCSUM_IPV6 flag is on PR: 231797 Submitted by: whu Reviewed by: dexuan Obtained from: Kevin Morse Sponsored by: Microsoft Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hn.c Wed Oct 31 05:17:53 2018 (r339941) +++ stable/10/sys/dev/hyperv/netvsc/if_hn.c Wed Oct 31 06:24:07 2018 (r339942) @@ -857,7 +857,8 @@ hn_set_hlen(struct mbuf *m_head) PULLUP_HDR(m_head, ehlen + sizeof(*ip6)); ip6 = mtodo(m_head, ehlen); - if (ip6->ip6_nxt != IPPROTO_TCP) { + if (ip6->ip6_nxt != IPPROTO_TCP && + ip6->ip6_nxt != IPPROTO_UDP) { m_freem(m_head); return (NULL); } From owner-svn-src-stable@freebsd.org Wed Oct 31 11:37:06 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C907E10D443C; Wed, 31 Oct 2018 11:37: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7992170845; Wed, 31 Oct 2018 11:37: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 575053F0F; Wed, 31 Oct 2018 11:37: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 w9VBb6td038622; Wed, 31 Oct 2018 11:37:06 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9VBb5hb038618; Wed, 31 Oct 2018 11:37:05 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201810311137.w9VBb5hb038618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 31 Oct 2018 11:37:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339947 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/11/usr.sbin/bhyve X-SVN-Commit-Revision: 339947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 11:37:07 -0000 Author: bz Date: Wed Oct 31 11:37:05 2018 New Revision: 339947 URL: https://svnweb.freebsd.org/changeset/base/339947 Log: MFC r339586: In bhyve's fbuf emulation improve the overall "usage" message and for the vga option, rather than printing the entire option string, only print vga (as we do for everything else). MFC r339681: Allow the bhyve VNC server to listen on IPv6 for incoming connections. Alternatively to IPv4 address:port this will allow to listen on IPv6 link-local (incl. scope), a specific address, or ::. Addresses have to be given in RFC2732 format so that [::]:port parsing will work. This patch also starts to introduce WITH_INET/INET6_SUPPORT to bhyve. PR: 232018 Submitted by: Dave Rush (northwoodlogic.free gmail.com) (original) Reviewed by: Dave Rush (updated verison) Modified: stable/11/usr.sbin/bhyve/Makefile stable/11/usr.sbin/bhyve/bhyve.8 stable/11/usr.sbin/bhyve/pci_fbuf.c stable/11/usr.sbin/bhyve/rfb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/Makefile ============================================================================== --- stable/11/usr.sbin/bhyve/Makefile Wed Oct 31 10:45:28 2018 (r339946) +++ stable/11/usr.sbin/bhyve/Makefile Wed Oct 31 11:37:05 2018 (r339947) @@ -65,6 +65,12 @@ SRCS+= vmm_instruction_emul.c LIBADD= vmmapi md pthread z +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+=-DINET +.endif +.if ${MK_INET6_SUPPORT} != "no" +CFLAGS+=-DINET6 +.endif .if ${MK_OPENSSL} == "no" CFLAGS+=-DNO_OPENSSL .else Modified: stable/11/usr.sbin/bhyve/bhyve.8 ============================================================================== --- stable/11/usr.sbin/bhyve/bhyve.8 Wed Oct 31 10:45:28 2018 (r339946) +++ stable/11/usr.sbin/bhyve/bhyve.8 Wed Oct 31 11:37:05 2018 (r339947) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Jul 11, 2018 +.Dd October 24, 2018 .Dt BHYVE 8 .Os .Sh NAME @@ -311,14 +311,15 @@ Framebuffer devices: .Bl -tag -width 10n .It Oo rfb= Ns Oo Ar IP: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar width Oc Ns Oo ,h= Ns Ar height Oc Ns Oo ,vga= Ns Ar vgaconf Oc Ns Oo Ns ,wait Oc Ns Oo ,password= Ns Ar password Oc .Bl -tag -width 8n -.It Ar IP:port +.It Ar IPv4:port No or Ar [IPv6%zone]:port An .Ar IP address and a .Ar port VNC should listen on. The default is to listen on localhost IPv4 address and default VNC port 5900. -Listening on an IPv6 address is not supported. +An IPv6 address must be enclosed in square brackets and may contain an +optional zone identifer. .It Ar width No and Ar height A display resolution, width and height, respectively. If not specified, a default resolution of 1024x768 pixels will be used. @@ -485,6 +486,20 @@ bhyve -c 2 -m 4G -w -H \\ -s 4,ahci-hd,disk.img \\ -s 5,virtio-net,tap0 \\ -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \\ + -s 30,xhci,tablet \\ + -s 31,lpc -l com1,stdio \\ + -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\ + uefivm +.Ed +.Pp +Run a UEFI virtual machine with a VNC display that is bound to all IPv6 +addresses on port 5900. +.Bd -literal -offset indent +bhyve -c 2 -m 4G -w -H \\ + -s 0,hostbridge \\ + -s 4,ahci-hd,disk.img \\ + -s 5,virtio-net,tap0 \\ + -s 29,fbuf,tcp=[::]:5900,w=800,h=600 \\ -s 30,xhci,tablet \\ -s 31,lpc -l com1,stdio \\ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\ Modified: stable/11/usr.sbin/bhyve/pci_fbuf.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_fbuf.c Wed Oct 31 10:45:28 2018 (r339946) +++ stable/11/usr.sbin/bhyve/pci_fbuf.c Wed Oct 31 11:37:05 2018 (r339947) @@ -117,8 +117,9 @@ static void pci_fbuf_usage(char *opt) { - fprintf(stderr, "Invalid fbuf emulation \"%s\"\r\n", opt); - fprintf(stderr, "fbuf: {wait,}{vga=on|io|off,}rfb=:port\r\n"); + fprintf(stderr, "Invalid fbuf emulation option \"%s\"\r\n", opt); + fprintf(stderr, "fbuf: {wait,}{vga=on|io|off,}rfb=:port" + "{,w=width}{,h=height}\r\n"); } static void @@ -250,13 +251,33 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o xopts, config)); if (!strcmp(xopts, "tcp") || !strcmp(xopts, "rfb")) { - /* parse host-ip:port */ - tmpstr = strsep(&config, ":"); - if (!config) - sc->rfb_port = atoi(tmpstr); - else { - sc->rfb_port = atoi(config); + /* + * IPv4 -- host-ip:port + * IPv6 -- [host-ip%zone]:port + * XXX for now port is mandatory. + */ + tmpstr = strsep(&config, "]"); + if (config) { + if (tmpstr[0] == '[') + tmpstr++; sc->rfb_host = tmpstr; + if (config[0] == ':') + config++; + else { + pci_fbuf_usage(xopts); + ret = -1; + goto done; + } + sc->rfb_port = atoi(config); + } else { + config = tmpstr; + tmpstr = strsep(&config, ":"); + if (!config) + sc->rfb_port = atoi(tmpstr); + else { + sc->rfb_port = atoi(config); + sc->rfb_host = tmpstr; + } } } else if (!strcmp(xopts, "vga")) { if (!strcmp(config, "off")) { @@ -268,7 +289,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o sc->vga_enabled = 1; sc->vga_full = 1; } else { - pci_fbuf_usage(opts); + pci_fbuf_usage(xopts); ret = -1; goto done; } Modified: stable/11/usr.sbin/bhyve/rfb.c ============================================================================== --- stable/11/usr.sbin/bhyve/rfb.c Wed Oct 31 10:45:28 2018 (r339946) +++ stable/11/usr.sbin/bhyve/rfb.c Wed Oct 31 11:37:05 2018 (r339947) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -977,8 +978,11 @@ sse42_supported(void) int rfb_init(char *hostname, int port, int wait, char *password) { + int e; + char servname[6]; struct rfb_softc *rc; - struct sockaddr_in sin; + struct addrinfo *ai; + struct addrinfo hints; int on = 1; #ifndef WITHOUT_CAPSICUM cap_rights_t rights; @@ -995,29 +999,43 @@ rfb_init(char *hostname, int port, int wait, char *pas rc->password = password; - rc->sfd = socket(AF_INET, SOCK_STREAM, 0); + snprintf(servname, sizeof(servname), "%d", port ? port : 5900); + + if (!hostname || strlen(hostname) == 0) +#if defined(INET) + hostname = "127.0.0.1"; +#elif defined(INET6) + hostname = "[::1]"; +#endif + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV | AI_PASSIVE; + + if ((e = getaddrinfo(hostname, servname, &hints, &ai)) != 0) { + fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(e)); + return(-1); + } + + rc->sfd = socket(ai->ai_family, ai->ai_socktype, 0); if (rc->sfd < 0) { perror("socket"); + freeaddrinfo(ai); return (-1); } setsockopt(rc->sfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); - sin.sin_len = sizeof(sin); - sin.sin_family = AF_INET; - sin.sin_port = port ? htons(port) : htons(5900); - if (hostname && strlen(hostname) > 0) - inet_pton(AF_INET, hostname, &(sin.sin_addr)); - else - sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - if (bind(rc->sfd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { + if (bind(rc->sfd, ai->ai_addr, ai->ai_addrlen) < 0) { perror("bind"); + freeaddrinfo(ai); return (-1); } if (listen(rc->sfd, 1) < 0) { perror("listen"); + freeaddrinfo(ai); return (-1); } @@ -1045,5 +1063,6 @@ rfb_init(char *hostname, int port, int wait, char *pas pthread_mutex_unlock(&rc->mtx); } + freeaddrinfo(ai); return (0); } From owner-svn-src-stable@freebsd.org Wed Oct 31 12:05:47 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20F2F10D5C8D; Wed, 31 Oct 2018 12:05:47 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C825771C22; Wed, 31 Oct 2018 12:05:46 +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 A4ECA4424; Wed, 31 Oct 2018 12:05:46 +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 w9VC5klH053959; Wed, 31 Oct 2018 12:05:46 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9VC5jM4053953; Wed, 31 Oct 2018 12:05:45 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201810311205.w9VC5jM4053953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 31 Oct 2018 12:05:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339949 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 339949 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 12:05:47 -0000 Author: bz Date: Wed Oct 31 12:05:45 2018 New Revision: 339949 URL: https://svnweb.freebsd.org/changeset/base/339949 Log: MFC r339586: In bhyve's fbuf emulation improve the overall "usage" message and for the vga option, rather than printing the entire option string, only print vga (as we do for everything else). MFC r339681: Allow the bhyve VNC server to listen on IPv6 for incoming connections. Alternatively to IPv4 address:port this will allow to listen on IPv6 link-local (incl. scope), a specific address, or ::. Addresses have to be given in RFC2732 format so that [::]:port parsing will work. This patch also starts to introduce WITH_INET/INET6_SUPPORT to bhyve. PR: 232018 Submitted by: Dave Rush (northwoodlogic.free gmail.com) (original) Reviewed by: Dave Rush (updated verison) Approved by: re (kib) Modified: stable/12/usr.sbin/bhyve/Makefile stable/12/usr.sbin/bhyve/bhyve.8 stable/12/usr.sbin/bhyve/pci_fbuf.c stable/12/usr.sbin/bhyve/rfb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/Makefile ============================================================================== --- stable/12/usr.sbin/bhyve/Makefile Wed Oct 31 12:00:35 2018 (r339948) +++ stable/12/usr.sbin/bhyve/Makefile Wed Oct 31 12:05:45 2018 (r339949) @@ -73,6 +73,12 @@ SRCS+= vmm_instruction_emul.c LIBADD= vmmapi md pthread z util sbuf cam +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+=-DINET +.endif +.if ${MK_INET6_SUPPORT} != "no" +CFLAGS+=-DINET6 +.endif .if ${MK_OPENSSL} == "no" CFLAGS+=-DNO_OPENSSL .else Modified: stable/12/usr.sbin/bhyve/bhyve.8 ============================================================================== --- stable/12/usr.sbin/bhyve/bhyve.8 Wed Oct 31 12:00:35 2018 (r339948) +++ stable/12/usr.sbin/bhyve/bhyve.8 Wed Oct 31 12:05:45 2018 (r339949) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Aug 23, 2018 +.Dd October 24, 2018 .Dt BHYVE 8 .Os .Sh NAME @@ -369,14 +369,15 @@ Framebuffer devices: .Bl -tag -width 10n .It Oo rfb= Ns Oo Ar IP: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar width Oc Ns Oo ,h= Ns Ar height Oc Ns Oo ,vga= Ns Ar vgaconf Oc Ns Oo Ns ,wait Oc Ns Oo ,password= Ns Ar password Oc .Bl -tag -width 8n -.It Ar IP:port +.It Ar IPv4:port No or Ar [IPv6%zone]:port An .Ar IP address and a .Ar port VNC should listen on. The default is to listen on localhost IPv4 address and default VNC port 5900. -Listening on an IPv6 address is not supported. +An IPv6 address must be enclosed in square brackets and may contain an +optional zone identifer. .It Ar width No and Ar height A display resolution, width and height, respectively. If not specified, a default resolution of 1024x768 pixels will be used. @@ -582,6 +583,20 @@ bhyve -c 2 -m 4G -w -H \\ -s 4,ahci-hd,disk.img \\ -s 5,virtio-net,tap0 \\ -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \\ + -s 30,xhci,tablet \\ + -s 31,lpc -l com1,stdio \\ + -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\ + uefivm +.Ed +.Pp +Run a UEFI virtual machine with a VNC display that is bound to all IPv6 +addresses on port 5900. +.Bd -literal -offset indent +bhyve -c 2 -m 4G -w -H \\ + -s 0,hostbridge \\ + -s 4,ahci-hd,disk.img \\ + -s 5,virtio-net,tap0 \\ + -s 29,fbuf,tcp=[::]:5900,w=800,h=600 \\ -s 30,xhci,tablet \\ -s 31,lpc -l com1,stdio \\ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\ Modified: stable/12/usr.sbin/bhyve/pci_fbuf.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_fbuf.c Wed Oct 31 12:00:35 2018 (r339948) +++ stable/12/usr.sbin/bhyve/pci_fbuf.c Wed Oct 31 12:05:45 2018 (r339949) @@ -117,8 +117,9 @@ static void pci_fbuf_usage(char *opt) { - fprintf(stderr, "Invalid fbuf emulation \"%s\"\r\n", opt); - fprintf(stderr, "fbuf: {wait,}{vga=on|io|off,}rfb=:port\r\n"); + fprintf(stderr, "Invalid fbuf emulation option \"%s\"\r\n", opt); + fprintf(stderr, "fbuf: {wait,}{vga=on|io|off,}rfb=:port" + "{,w=width}{,h=height}\r\n"); } static void @@ -250,13 +251,33 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o xopts, config)); if (!strcmp(xopts, "tcp") || !strcmp(xopts, "rfb")) { - /* parse host-ip:port */ - tmpstr = strsep(&config, ":"); - if (!config) - sc->rfb_port = atoi(tmpstr); - else { - sc->rfb_port = atoi(config); + /* + * IPv4 -- host-ip:port + * IPv6 -- [host-ip%zone]:port + * XXX for now port is mandatory. + */ + tmpstr = strsep(&config, "]"); + if (config) { + if (tmpstr[0] == '[') + tmpstr++; sc->rfb_host = tmpstr; + if (config[0] == ':') + config++; + else { + pci_fbuf_usage(xopts); + ret = -1; + goto done; + } + sc->rfb_port = atoi(config); + } else { + config = tmpstr; + tmpstr = strsep(&config, ":"); + if (!config) + sc->rfb_port = atoi(tmpstr); + else { + sc->rfb_port = atoi(config); + sc->rfb_host = tmpstr; + } } } else if (!strcmp(xopts, "vga")) { if (!strcmp(config, "off")) { @@ -268,7 +289,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o sc->vga_enabled = 1; sc->vga_full = 1; } else { - pci_fbuf_usage(opts); + pci_fbuf_usage(xopts); ret = -1; goto done; } Modified: stable/12/usr.sbin/bhyve/rfb.c ============================================================================== --- stable/12/usr.sbin/bhyve/rfb.c Wed Oct 31 12:00:35 2018 (r339948) +++ stable/12/usr.sbin/bhyve/rfb.c Wed Oct 31 12:05:45 2018 (r339949) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -960,8 +961,11 @@ sse42_supported(void) int rfb_init(char *hostname, int port, int wait, char *password) { + int e; + char servname[6]; struct rfb_softc *rc; - struct sockaddr_in sin; + struct addrinfo *ai; + struct addrinfo hints; int on = 1; #ifndef WITHOUT_CAPSICUM cap_rights_t rights; @@ -978,29 +982,43 @@ rfb_init(char *hostname, int port, int wait, char *pas rc->password = password; - rc->sfd = socket(AF_INET, SOCK_STREAM, 0); + snprintf(servname, sizeof(servname), "%d", port ? port : 5900); + + if (!hostname || strlen(hostname) == 0) +#if defined(INET) + hostname = "127.0.0.1"; +#elif defined(INET6) + hostname = "[::1]"; +#endif + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV | AI_PASSIVE; + + if ((e = getaddrinfo(hostname, servname, &hints, &ai)) != 0) { + fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(e)); + return(-1); + } + + rc->sfd = socket(ai->ai_family, ai->ai_socktype, 0); if (rc->sfd < 0) { perror("socket"); + freeaddrinfo(ai); return (-1); } setsockopt(rc->sfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); - sin.sin_len = sizeof(sin); - sin.sin_family = AF_INET; - sin.sin_port = port ? htons(port) : htons(5900); - if (hostname && strlen(hostname) > 0) - inet_pton(AF_INET, hostname, &(sin.sin_addr)); - else - sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - if (bind(rc->sfd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { + if (bind(rc->sfd, ai->ai_addr, ai->ai_addrlen) < 0) { perror("bind"); + freeaddrinfo(ai); return (-1); } if (listen(rc->sfd, 1) < 0) { perror("listen"); + freeaddrinfo(ai); return (-1); } @@ -1028,5 +1046,6 @@ rfb_init(char *hostname, int port, int wait, char *pas pthread_mutex_unlock(&rc->mtx); } + freeaddrinfo(ai); return (0); } From owner-svn-src-stable@freebsd.org Wed Oct 31 12:49:19 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A12F010D70AE; Wed, 31 Oct 2018 12:49:19 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 504C373418; Wed, 31 Oct 2018 12:49:19 +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 2BABC4AA1; Wed, 31 Oct 2018 12:49:19 +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 w9VCnJJM075471; Wed, 31 Oct 2018 12:49:19 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9VCnJWf075470; Wed, 31 Oct 2018 12:49:19 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201810311249.w9VCnJWf075470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 31 Oct 2018 12:49:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339950 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 339950 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 12:49:19 -0000 Author: bz Date: Wed Oct 31 12:49:18 2018 New Revision: 339950 URL: https://svnweb.freebsd.org/changeset/base/339950 Log: MFC r339682: rip6_input() inp validation after epoch(9) After r335924 rip6_input() needs inp validation to avoid working on FREED inps. Apply the relevant bits from r335497,r335501 (rip_input() change) to the IPv6 counterpart. PR: 232194 Reviewed by: rgrimes, ae (,hps) Approved by: re (kib) Modified: stable/12/sys/netinet6/raw_ip6.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/raw_ip6.c ============================================================================== --- stable/12/sys/netinet6/raw_ip6.c Wed Oct 31 12:05:45 2018 (r339949) +++ stable/12/sys/netinet6/raw_ip6.c Wed Oct 31 12:49:18 2018 (r339950) @@ -187,6 +187,45 @@ rip6_input(struct mbuf **mp, int *offp, int proto) if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr) && !IN6_ARE_ADDR_EQUAL(&in6p->in6p_faddr, &ip6->ip6_src)) continue; + if (last != NULL) { + struct mbuf *n = m_copym(m, 0, M_COPYALL, M_NOWAIT); + +#if defined(IPSEC) || defined(IPSEC_SUPPORT) + /* + * Check AH/ESP integrity. + */ + if (IPSEC_ENABLED(ipv6)) { + if (n != NULL && + IPSEC_CHECK_POLICY(ipv6, n, last) != 0) { + m_freem(n); + /* Do not inject data into pcb. */ + n = NULL; + } + } +#endif /* IPSEC */ + if (n) { + if (last->inp_flags & INP_CONTROLOPTS || + last->inp_socket->so_options & SO_TIMESTAMP) + ip6_savecontrol(last, n, &opts); + /* strip intermediate headers */ + m_adj(n, *offp); + if (sbappendaddr(&last->inp_socket->so_rcv, + (struct sockaddr *)&fromsa, + n, opts) == 0) { + m_freem(n); + if (opts) + m_freem(opts); + RIP6STAT_INC(rip6s_fullsock); + } else + sorwakeup(last->inp_socket); + opts = NULL; + } + INP_RUNLOCK(last); + last = NULL; + } + INP_RLOCK(in6p); + if (__predict_false(in6p->inp_flags2 & INP_FREED)) + goto skip_2; if (jailed_without_vnet(in6p->inp_cred)) { /* * Allow raw socket in jail to receive multicast; @@ -196,16 +235,14 @@ rip6_input(struct mbuf **mp, int *offp, int proto) if (!IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) && prison_check_ip6(in6p->inp_cred, &ip6->ip6_dst) != 0) - continue; + goto skip_2; } - INP_RLOCK(in6p); if (in6p->in6p_cksum != -1) { RIP6STAT_INC(rip6s_isum); if (in6_cksum(m, proto, *offp, m->m_pkthdr.len - *offp)) { - INP_RUNLOCK(in6p); RIP6STAT_INC(rip6s_badsum); - continue; + goto skip_2; } } /* @@ -251,46 +288,13 @@ rip6_input(struct mbuf **mp, int *offp, int proto) } if (blocked != MCAST_PASS) { IP6STAT_INC(ip6s_notmember); - INP_RUNLOCK(in6p); - continue; + goto skip_2; } } - if (last != NULL) { - struct mbuf *n = m_copym(m, 0, M_COPYALL, M_NOWAIT); - -#if defined(IPSEC) || defined(IPSEC_SUPPORT) - /* - * Check AH/ESP integrity. - */ - if (IPSEC_ENABLED(ipv6)) { - if (n != NULL && - IPSEC_CHECK_POLICY(ipv6, n, last) != 0) { - m_freem(n); - /* Do not inject data into pcb. */ - n = NULL; - } - } -#endif /* IPSEC */ - if (n) { - if (last->inp_flags & INP_CONTROLOPTS || - last->inp_socket->so_options & SO_TIMESTAMP) - ip6_savecontrol(last, n, &opts); - /* strip intermediate headers */ - m_adj(n, *offp); - if (sbappendaddr(&last->inp_socket->so_rcv, - (struct sockaddr *)&fromsa, - n, opts) == 0) { - m_freem(n); - if (opts) - m_freem(opts); - RIP6STAT_INC(rip6s_fullsock); - } else - sorwakeup(last->inp_socket); - opts = NULL; - } - INP_RUNLOCK(last); - } last = in6p; + continue; +skip_2: + INP_RUNLOCK(in6p); } INP_INFO_RUNLOCK_ET(&V_ripcbinfo, et); #if defined(IPSEC) || defined(IPSEC_SUPPORT) From owner-svn-src-stable@freebsd.org Wed Oct 31 12:50:40 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79DEF10D7186; Wed, 31 Oct 2018 12:50:40 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3004B73595; Wed, 31 Oct 2018 12:50:40 +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 114544AAC; Wed, 31 Oct 2018 12:50:40 +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 w9VCodML075622; Wed, 31 Oct 2018 12:50:39 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9VCodFN075621; Wed, 31 Oct 2018 12:50:39 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201810311250.w9VCodFN075621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 31 Oct 2018 12:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339951 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 339951 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 12:50:40 -0000 Author: bz Date: Wed Oct 31 12:50:39 2018 New Revision: 339951 URL: https://svnweb.freebsd.org/changeset/base/339951 Log: MFC r339930: With more excessive use of modules, more kernel parts working with VIMAGE, and feature richness and global state increasing the 8k of vnet module space are no longer sufficient for people and loading multiple modules, e.g., pf(4) and ipl(4) or ipsec(4) will fail on the second module. Increase the module space to 8 * PAGE_SIZE which should be enough to hold multiple firewalls, ipsec, multicast (as in the old days was a problem), epair, carp, and any kind of other vnet enabled modules. Sadly this is a global byte array part of the vnet_set, so we cannot dynamically change its size; otherwise a TUNABLE would have been a better solution. PR: 228854 Reported by: Ernie Luzar, Marek Zarychta Approved by: re (kib) Modified: stable/12/sys/net/vnet.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/vnet.c ============================================================================== --- stable/12/sys/net/vnet.c Wed Oct 31 12:49:18 2018 (r339950) +++ stable/12/sys/net/vnet.c Wed Oct 31 12:50:39 2018 (r339951) @@ -171,7 +171,7 @@ static MALLOC_DEFINE(M_VNET_DATA, "vnet_data", "VNET d * we want the virtualized global variable space to be page-sized, we may * have more space than that in practice. */ -#define VNET_MODMIN 8192 +#define VNET_MODMIN (8 * PAGE_SIZE) #define VNET_SIZE roundup2(VNET_BYTES, PAGE_SIZE) /* From owner-svn-src-stable@freebsd.org Wed Oct 31 14:03:49 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5485E10DA152; Wed, 31 Oct 2018 14:03:49 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 09F4F76409; Wed, 31 Oct 2018 14:03:49 +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 C3BE357C7; Wed, 31 Oct 2018 14:03:48 +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 w9VE3mFn017575; Wed, 31 Oct 2018 14:03:48 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9VE3m9S017572; Wed, 31 Oct 2018 14:03:48 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201810311403.w9VE3m9S017572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 31 Oct 2018 14:03:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339953 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 339953 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 14:03:49 -0000 Author: bz Date: Wed Oct 31 14:03:48 2018 New Revision: 339953 URL: https://svnweb.freebsd.org/changeset/base/339953 Log: MFC r339931,r339933: As a follow-up to r339930 (r339951 in stable/12) and various reports implement logging in case we fail during module load because the pcpu or vnet module sections are full. We did return a proper error but not leaving any indication to the user as to what the actual problem was. Even worse, on 12/13 currently we are seeing an unrelated error (ENOSYS instead of ENOSPC, which gets skipped over in kern_linker.c) to be printed which made problem diagnostics even harder. PR: 228854 Approved by: re (kib) Modified: stable/12/sys/kern/link_elf.c stable/12/sys/kern/link_elf_obj.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/link_elf.c ============================================================================== --- stable/12/sys/kern/link_elf.c Wed Oct 31 12:53:58 2018 (r339952) +++ stable/12/sys/kern/link_elf.c Wed Oct 31 14:03:48 2018 (r339953) @@ -637,8 +637,12 @@ parse_dpcpu(elf_file_t ef) * all per-cpu storage from that. */ ef->pcpu_base = (Elf_Addr)(uintptr_t)dpcpu_alloc(size); - if (ef->pcpu_base == 0) + if (ef->pcpu_base == 0) { + printf("%s: pcpu module space is out of space; " + "cannot allocate %d for %s\n", + __func__, size, ef->lf.pathname); return (ENOSPC); + } memcpy((void *)ef->pcpu_base, (void *)ef->pcpu_start, size); dpcpu_copy((void *)ef->pcpu_base, size); elf_set_add(&set_pcpu_list, ef->pcpu_start, ef->pcpu_stop, @@ -670,8 +674,12 @@ parse_vnet(elf_file_t ef) * all per-vnet storage from that. */ ef->vnet_base = (Elf_Addr)(uintptr_t)vnet_data_alloc(size); - if (ef->vnet_base == 0) + if (ef->vnet_base == 0) { + printf("%s: vnet module space is out of space; " + "cannot allocate %d for %s\n", + __func__, size, ef->lf.pathname); return (ENOSPC); + } memcpy((void *)ef->vnet_base, (void *)ef->vnet_start, size); vnet_data_copy((void *)ef->vnet_base, size); elf_set_add(&set_vnet_list, ef->vnet_start, ef->vnet_stop, Modified: stable/12/sys/kern/link_elf_obj.c ============================================================================== --- stable/12/sys/kern/link_elf_obj.c Wed Oct 31 12:53:58 2018 (r339952) +++ stable/12/sys/kern/link_elf_obj.c Wed Oct 31 14:03:48 2018 (r339953) @@ -368,6 +368,11 @@ link_elf_link_preload(linker_class_t cls, const char * dpcpu = dpcpu_alloc(shdr[i].sh_size); if (dpcpu == NULL) { + printf("%s: pcpu module space is out " + "of space; cannot allocate %#jx " + "for %s\n", __func__, + (uintmax_t)shdr[i].sh_size, + filename); error = ENOSPC; goto out; } @@ -382,6 +387,11 @@ link_elf_link_preload(linker_class_t cls, const char * vnet_data = vnet_data_alloc(shdr[i].sh_size); if (vnet_data == NULL) { + printf("%s: vnet module space is out " + "of space; cannot allocate %#jx " + "for %s\n", __func__, + (uintmax_t)shdr[i].sh_size, + filename); error = ENOSPC; goto out; } @@ -847,14 +857,30 @@ link_elf_load_file(linker_class_t cls, const char *fil else ef->progtab[pb].name = "<>"; if (ef->progtab[pb].name != NULL && - !strcmp(ef->progtab[pb].name, DPCPU_SETNAME)) + !strcmp(ef->progtab[pb].name, DPCPU_SETNAME)) { ef->progtab[pb].addr = dpcpu_alloc(shdr[i].sh_size); + if (ef->progtab[pb].addr == NULL) { + printf("%s: pcpu module space is out " + "of space; cannot allocate %#jx " + "for %s\n", __func__, + (uintmax_t)shdr[i].sh_size, + filename); + } + } #ifdef VIMAGE else if (ef->progtab[pb].name != NULL && - !strcmp(ef->progtab[pb].name, VNET_SETNAME)) + !strcmp(ef->progtab[pb].name, VNET_SETNAME)) { ef->progtab[pb].addr = vnet_data_alloc(shdr[i].sh_size); + if (ef->progtab[pb].addr == NULL) { + printf("%s: vnet module space is out " + "of space; cannot allocate %#jx " + "for %s\n", __func__, + (uintmax_t)shdr[i].sh_size, + filename); + } + } #endif else ef->progtab[pb].addr = From owner-svn-src-stable@freebsd.org Wed Oct 31 18:01:02 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB64210E104A; Wed, 31 Oct 2018 18:01:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8DF4D81351; Wed, 31 Oct 2018 18:01:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6F2007E37; Wed, 31 Oct 2018 18:01:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9VI12PN045535; Wed, 31 Oct 2018 18:01:02 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9VI12EC045534; Wed, 31 Oct 2018 18:01:02 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201810311801.w9VI12EC045534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 31 Oct 2018 18:01:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339963 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 339963 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 18:01:03 -0000 Author: glebius Date: Wed Oct 31 18:01:02 2018 New Revision: 339963 URL: https://svnweb.freebsd.org/changeset/base/339963 Log: MFhead r339596: If we lost race or were migrated during bucket allocation for the per-CPU cache, then we put new bucket on generic bucket cache. However, code didn't honor UMA_ZONE_NOBUCKETCACHE flag, so potentially we could start a cache on a zone that clearly forbids that. Fix this. Approved by: re (gjb) Modified: stable/12/sys/vm/uma_core.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/uma_core.c ============================================================================== --- stable/12/sys/vm/uma_core.c Wed Oct 31 17:47:08 2018 (r339962) +++ stable/12/sys/vm/uma_core.c Wed Oct 31 18:01:02 2018 (r339963) @@ -2410,6 +2410,7 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags * the current cache; when we re-acquire the critical section, we * must detect and handle migration if it has occurred. */ +zalloc_restart: critical_enter(); cpu = curcpu; cache = &zone->uz_cpu[cpu]; @@ -2551,12 +2552,18 @@ zalloc_start: * initialized bucket to make this less likely or claim * the memory directly. */ - if (cache->uc_allocbucket != NULL || - (zone->uz_flags & UMA_ZONE_NUMA && - domain != PCPU_GET(domain))) - LIST_INSERT_HEAD(&zdom->uzd_buckets, bucket, ub_link); - else + if (cache->uc_allocbucket == NULL && + ((zone->uz_flags & UMA_ZONE_NUMA) == 0 || + domain == PCPU_GET(domain))) { cache->uc_allocbucket = bucket; + } else if ((zone->uz_flags & UMA_ZONE_NOBUCKETCACHE) != 0) { + critical_exit(); + ZONE_UNLOCK(zone); + bucket_drain(zone, bucket); + bucket_free(zone, bucket, udata); + goto zalloc_restart; + } else + LIST_INSERT_HEAD(&zdom->uzd_buckets, bucket, ub_link); ZONE_UNLOCK(zone); goto zalloc_start; } From owner-svn-src-stable@freebsd.org Wed Oct 31 19:09:49 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35A6310E2B3B; Wed, 31 Oct 2018 19:09:49 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DEE8E843C5; Wed, 31 Oct 2018 19:09:48 +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 BBAFB1099B; Wed, 31 Oct 2018 19:09:48 +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 w9VJ9mgc081385; Wed, 31 Oct 2018 19:09:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9VJ9m8R081384; Wed, 31 Oct 2018 19:09:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201810311909.w9VJ9m8R081384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 31 Oct 2018 19:09:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339966 - stable/11/sys/conf X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/conf X-SVN-Commit-Revision: 339966 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 19:09:49 -0000 Author: markj Date: Wed Oct 31 19:09:48 2018 New Revision: 339966 URL: https://svnweb.freebsd.org/changeset/base/339966 Log: MFC r313557 (by bz): Allow Dtrace to be compiled into the kernel again after r313177. PR: 232825 Modified: stable/11/sys/conf/files Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Wed Oct 31 18:30:17 2018 (r339965) +++ stable/11/sys/conf/files Wed Oct 31 19:09:48 2018 (r339966) @@ -310,6 +310,7 @@ cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lzio.c # dtrace specific cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c optional dtrace compile-with "${DTRACE_C}" \ warning "kernel contains CDDL licensed DTRACE" +cddl/contrib/opensolaris/uts/common/dtrace/dtrace_xoroshiro128_plus.c optional dtrace compile-with "${DTRACE_C}" cddl/dev/dtmalloc/dtmalloc.c optional dtmalloc | dtraceall compile-with "${CDDL_C}" cddl/dev/profile/profile.c optional dtrace_profile | dtraceall compile-with "${CDDL_C}" cddl/dev/sdt/sdt.c optional dtrace_sdt | dtraceall compile-with "${CDDL_C}" From owner-svn-src-stable@freebsd.org Wed Oct 31 19:28:06 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF58C10E3265; Wed, 31 Oct 2018 19:28:06 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6DBF3850D1; Wed, 31 Oct 2018 19:28:06 +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 4C59210CDB; Wed, 31 Oct 2018 19:28:06 +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 w9VJS6IM091686; Wed, 31 Oct 2018 19:28:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9VJS5QK091684; Wed, 31 Oct 2018 19:28:05 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201810311928.w9VJS5QK091684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 31 Oct 2018 19:28:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339968 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 339968 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 19:28:07 -0000 Author: markj Date: Wed Oct 31 19:28:05 2018 New Revision: 339968 URL: https://svnweb.freebsd.org/changeset/base/339968 Log: MFC r339601, r339603: Swap in processes unless there's a global memory shortage. Approved by: re (gjb) Modified: stable/12/sys/vm/vm_glue.c stable/12/sys/vm/vm_swapout.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_glue.c ============================================================================== --- stable/12/sys/vm/vm_glue.c Wed Oct 31 19:19:13 2018 (r339967) +++ stable/12/sys/vm/vm_glue.c Wed Oct 31 19:28:05 2018 (r339968) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -298,7 +299,7 @@ vm_sync_icache(vm_map_t map, vm_offset_t va, vm_offset struct kstack_cache_entry *kstack_cache; static int kstack_cache_size = 128; -static int kstacks; +static int kstacks, kstack_domain_iter; static struct mtx kstack_cache_mtx; MTX_SYSINIT(kstack_cache, &kstack_cache_mtx, "kstkch", MTX_DEF); @@ -367,6 +368,17 @@ vm_thread_new(struct thread *td, int pages) printf("vm_thread_new: kstack allocation failed\n"); vm_object_deallocate(ksobj); return (0); + } + + /* + * Ensure that kstack objects can draw pages from any memory + * domain. Otherwise a local memory shortage can block a process + * swap-in. + */ + if (vm_ndomains > 1) { + ksobj->domain.dr_policy = DOMAINSET_RR(); + ksobj->domain.dr_iterator = + atomic_fetchadd_int(&kstack_domain_iter, 1); } atomic_add_int(&kstacks, 1); Modified: stable/12/sys/vm/vm_swapout.c ============================================================================== --- stable/12/sys/vm/vm_swapout.c Wed Oct 31 19:19:13 2018 (r339967) +++ stable/12/sys/vm/vm_swapout.c Wed Oct 31 19:28:05 2018 (r339968) @@ -742,7 +742,8 @@ swapper_selector(bool wkilled_only) /* * Limit swapper to swap in one non-WKILLED process in MAXSLP/2 * interval, assuming that there is: - * - no memory shortage; + * - there exists at least one domain that is not suffering from a shortage of + * free memory; * - no parallel swap-ins; * - no other swap-ins in the current SWAPIN_INTERVAL. */ @@ -750,7 +751,7 @@ static bool swapper_wkilled_only(void) { - return (vm_page_count_min() || swap_inprogress > 0 || + return (vm_page_count_min_set(&all_domains) || swap_inprogress > 0 || (u_int)(ticks - last_swapin) < SWAPIN_INTERVAL); } From owner-svn-src-stable@freebsd.org Wed Oct 31 23:03:00 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33CC910EBF1A; Wed, 31 Oct 2018 23:03:00 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA9366FA87; Wed, 31 Oct 2018 23:02:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 A6097130D3; Wed, 31 Oct 2018 23:02:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9VN2x5o008916; Wed, 31 Oct 2018 23:02:59 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9VN2xxw008915; Wed, 31 Oct 2018 23:02:59 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201810312302.w9VN2xxw008915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 31 Oct 2018 23:02:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339975 - stable/12/sys/dev/ipw X-SVN-Group: stable-12 X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: stable/12/sys/dev/ipw X-SVN-Commit-Revision: 339975 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 23:03:00 -0000 Author: glebius Date: Wed Oct 31 23:02:59 2018 New Revision: 339975 URL: https://svnweb.freebsd.org/changeset/base/339975 Log: MFhead r339643: Fix ipw_start(), where logic was reverted in r287197. PR 232554 Approved by: re (kib) Modified: stable/12/sys/dev/ipw/if_ipw.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ipw/if_ipw.c ============================================================================== --- stable/12/sys/dev/ipw/if_ipw.c Wed Oct 31 22:55:43 2018 (r339974) +++ stable/12/sys/dev/ipw/if_ipw.c Wed Oct 31 23:02:59 2018 (r339975) @@ -1732,7 +1732,7 @@ ipw_start(struct ipw_softc *sc) IPW_LOCK_ASSERT(sc); - while (sc->txfree < 1 + IPW_MAX_NSEG && + while (sc->txfree >= 1 + IPW_MAX_NSEG && (m = mbufq_dequeue(&sc->sc_snd)) != NULL) { ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; if (ipw_tx_start(sc, m, ni) != 0) { From owner-svn-src-stable@freebsd.org Wed Oct 31 23:05:47 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE995108807B; Wed, 31 Oct 2018 23:05:47 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 89C986FD54; Wed, 31 Oct 2018 23:05:47 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B4F19130D6; Wed, 31 Oct 2018 23:05:44 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9VN5iFn009392; Wed, 31 Oct 2018 23:05:44 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9VN5im8009391; Wed, 31 Oct 2018 23:05:44 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201810312305.w9VN5im8009391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 31 Oct 2018 23:05:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339976 - stable/11/sys/dev/ipw X-SVN-Group: stable-11 X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: stable/11/sys/dev/ipw X-SVN-Commit-Revision: 339976 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 23:05:48 -0000 Author: glebius Date: Wed Oct 31 23:05:44 2018 New Revision: 339976 URL: https://svnweb.freebsd.org/changeset/base/339976 Log: MFhead r339643: Fix ipw_start(), where logic was reverted in r287197. PR: 232554 Modified: stable/11/sys/dev/ipw/if_ipw.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ipw/if_ipw.c ============================================================================== --- stable/11/sys/dev/ipw/if_ipw.c Wed Oct 31 23:02:59 2018 (r339975) +++ stable/11/sys/dev/ipw/if_ipw.c Wed Oct 31 23:05:44 2018 (r339976) @@ -1728,7 +1728,7 @@ ipw_start(struct ipw_softc *sc) IPW_LOCK_ASSERT(sc); - while (sc->txfree < 1 + IPW_MAX_NSEG && + while (sc->txfree >= 1 + IPW_MAX_NSEG && (m = mbufq_dequeue(&sc->sc_snd)) != NULL) { ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; if (ipw_tx_start(sc, m, ni) != 0) { From owner-svn-src-stable@freebsd.org Wed Oct 31 23:07:49 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6BC5108823B; Wed, 31 Oct 2018 23:07:48 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9CC0170167; Wed, 31 Oct 2018 23:07:48 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 66948130DD; Wed, 31 Oct 2018 23:07:48 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9VN7mYF009563; Wed, 31 Oct 2018 23:07:48 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9VN7lfW009560; Wed, 31 Oct 2018 23:07:47 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201810312307.w9VN7lfW009560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Wed, 31 Oct 2018 23:07:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339977 - stable/12/share/examples/jails X-SVN-Group: stable-12 X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: stable/12/share/examples/jails X-SVN-Commit-Revision: 339977 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 23:07:49 -0000 Author: dteske Date: Wed Oct 31 23:07:47 2018 New Revision: 339977 URL: https://svnweb.freebsd.org/changeset/base/339977 Log: MFC r339843: Fix jail examples in jib, jng, README Submitted by: Ryan Moeller Reported by: Ryan Moeller Approved by: re (gjb) Sponsored by: Smule, Inc. Differential Revision: https://reviews.freebsd.org/D17697 Modified: stable/12/share/examples/jails/README stable/12/share/examples/jails/jib stable/12/share/examples/jails/jng Directory Properties: stable/12/ (props changed) Modified: stable/12/share/examples/jails/README ============================================================================== --- stable/12/share/examples/jails/README Wed Oct 31 23:05:44 2018 (r339976) +++ stable/12/share/examples/jails/README Wed Oct 31 23:07:47 2018 (r339977) @@ -8,6 +8,16 @@ The below 4 samples require a VIMAGE enabled kernel: $ make KERNCONF=VIMAGE kernel $ reboot +FreeBSD 12 has VIMAGE enabled in GENERIC on amd64. +In that case, for jng simply load the ng_ether module first +(ng_bridge and ng_eiface will load on demand): + + # (as root) + # Load the ng_ether module at boot: + $ sysrc kld_list+=ng_ether + # Load ng_ether at once without rebooting: + $ kldload ng_ether + Sample 1: jail.conf(5) $ cp jib jng /usr/sbin/ Modified: stable/12/share/examples/jails/jib ============================================================================== --- stable/12/share/examples/jails/jib Wed Oct 31 23:05:44 2018 (r339976) +++ stable/12/share/examples/jails/jib Wed Oct 31 23:07:47 2018 (r339977) @@ -51,7 +51,7 @@ # # arguments given to `jib addm xxx' in exec.prestart value. # # # vnet; -# vnet.interface = "e0b_xxx e1b_xxx ..."; +# vnet.interface = e0b_xxx, e1b_xxx, ...; # # exec.clean; # exec.system_user = "root"; Modified: stable/12/share/examples/jails/jng ============================================================================== --- stable/12/share/examples/jails/jng Wed Oct 31 23:05:44 2018 (r339976) +++ stable/12/share/examples/jails/jng Wed Oct 31 23:07:47 2018 (r339977) @@ -51,7 +51,7 @@ # # arguments given to `jng bridge xxx' in exec.prestart value. # # # vnet; -# vnet.interface = "ng0_xxx ng1_xxx ..."; +# vnet.interface = ng0_xxx, ng1_xxx, ...; # # exec.clean; # exec.system_user = "root"; From owner-svn-src-stable@freebsd.org Wed Oct 31 23:08:51 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E2031088348; Wed, 31 Oct 2018 23:08:51 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B346F70391; Wed, 31 Oct 2018 23:08:50 +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 940CA130DE; Wed, 31 Oct 2018 23:08:50 +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 w9VN8ooq009676; Wed, 31 Oct 2018 23:08:50 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9VN8oU1009673; Wed, 31 Oct 2018 23:08:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201810312308.w9VN8oU1009673@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 31 Oct 2018 23:08:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339978 - in stable/12/stand: liblua lua X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand: liblua lua X-SVN-Commit-Revision: 339978 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 23:08:51 -0000 Author: kevans Date: Wed Oct 31 23:08:49 2018 New Revision: 339978 URL: https://svnweb.freebsd.org/changeset/base/339978 Log: MFC r339677-r339678, r339702, r339805: Lualoader Bugfixes r339677: lualoader: unload upon kernel change if a kernel was previously loaded In the majority of cases, a kernel is not loaded before we hit the menu. However, if a password is set, we'll trigger autoboot and have loadelf'd beforehand. We also need to take into account one dropping to the loader prompt and twiddling with things manually; if they try to toggle through kernels, we'll assume they mean it. r339678: menu.lua: Abort autoboot sequence on failed command Currently, a timeout in the menu autoboot sequence would effectively do nothing. We would return from the autoboot handling, then begin processing the menu without redrawing it. This change makes the behavior a little more friendly. Returning the user to the menu can't have any good effects, so abort the autoboot sequence and drop to the loader prompt. r339702: lualoader: Improve module loading diagnostics Some fixes: - Maintain historical behavior more accurately w.r.t verbose_loading; verbose_loading strictly prints "${module_name...}" and later "failed!" or "ok" based on load success - With or without verbose_loading, dump command_errbuf on load failure. This usually happens prior to ok/failed if we're verbose_loading r339805: lualoader: Always return a proper dictionary for blacklist If module_blacklist isn't specified, we have an empty blacklist; effectively the same as if module_blacklist="" were specified in loader.conf(5). This was reported when switching to a BE that predated the module_blacklist introduction, but the problem is valid all the same and likely to be tripped over in other scenarios. Approved by: re (kib) Modified: stable/12/stand/liblua/lutils.c stable/12/stand/lua/config.lua stable/12/stand/lua/menu.lua Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/liblua/lutils.c ============================================================================== --- stable/12/stand/liblua/lutils.c Wed Oct 31 23:07:47 2018 (r339977) +++ stable/12/stand/liblua/lutils.c Wed Oct 31 23:08:49 2018 (r339978) @@ -77,6 +77,14 @@ lua_perform(lua_State *L) return 1; } +static int +lua_command_error(lua_State *L) +{ + + lua_pushstring(L, command_errbuf); + return 1; +} + /* * Accepts a space-delimited loader command and runs it through the standard * loader parsing, as if it were executed at the loader prompt by the user. @@ -341,6 +349,7 @@ lua_writefile(lua_State *L) #define REG_SIMPLE(n) { #n, lua_ ## n } static const struct luaL_Reg loaderlib[] = { REG_SIMPLE(delay), + REG_SIMPLE(command_error), REG_SIMPLE(command), REG_SIMPLE(interpret), REG_SIMPLE(parse), Modified: stable/12/stand/lua/config.lua ============================================================================== --- stable/12/stand/lua/config.lua Wed Oct 31 23:07:47 2018 (r339977) +++ stable/12/stand/lua/config.lua Wed Oct 31 23:08:49 2018 (r339978) @@ -55,7 +55,6 @@ local MSG_XENKERNLOADING = "Loading Xen kernel..." local MSG_KERNLOADING = "Loading kernel..." local MSG_MODLOADING = "Loading configured modules..." local MSG_MODBLACKLIST = "Not loading blacklisted module '%s'" -local MSG_MODLOADFAIL = "Could not load one or more modules!" local MODULEEXPR = '([%w-_]+)' local QVALEXPR = "\"([%w%s%p]-)\"" @@ -267,12 +266,12 @@ local function isValidComment(line) end local function getBlacklist() + local blacklist = {} local blacklist_str = loader.getenv('module_blacklist') if blacklist_str == nil then - return nil + return blacklist end - local blacklist = {} for mod in blacklist_str:gmatch("[;, ]?([%w-_]+)[;, ]?") do blacklist[mod] = true end @@ -292,6 +291,9 @@ local function loadModule(mod, silent) end goto continue end + if not silent then + loader.printc(module_name .. "...") + end local str = "load " if v.type ~= nil then str = str .. "-t " .. v.type .. " " @@ -309,23 +311,29 @@ local function loadModule(mod, silent) end if cli_execute_unparsed(str) ~= 0 then + -- XXX Temporary shim: don't break the boot if + -- loader hadn't been recompiled with this + -- function exposed. + if loader.command_error then + print(loader.command_error()) + end if not silent then - print(MSG_FAILEXMOD:format(str)) + print("failed!") end if v.error ~= nil then cli_execute_unparsed(v.error) end status = false - end - - if v.after ~= nil then + elseif v.after ~= nil then pstatus = cli_execute_unparsed(v.after) == 0 if not pstatus and not silent then print(MSG_FAILEXAF:format(v.after, k)) end + if not silent then + print("ok") + end status = status and pstatus end - end ::continue:: end @@ -622,20 +630,18 @@ function config.loadelf() print(MSG_XENKERNLOADING) if cli_execute_unparsed('load ' .. xen_kernel) ~= 0 then print(MSG_XENKERNFAIL:format(xen_kernel)) - return + return false end end print(MSG_KERNLOADING) loaded = config.loadKernel(kernel) if not loaded then - return + return false end print(MSG_MODLOADING) - if not loadModule(modules, not config.verbose) then - print(MSG_MODLOADFAIL) - end + return loadModule(modules, not config.verbose) end hook.registerType("config.loaded") Modified: stable/12/stand/lua/menu.lua ============================================================================== --- stable/12/stand/lua/menu.lua Wed Oct 31 23:07:47 2018 (r339977) +++ stable/12/stand/lua/menu.lua Wed Oct 31 23:08:49 2018 (r339978) @@ -312,6 +312,9 @@ menu.welcome = { #all_choices .. ")" end, func = function(_, choice, _) + if loader.getenv("kernelname") ~= nil then + loader.perform("unload") + end config.selectKernel(choice) end, alias = {"k", "K"}, @@ -370,7 +373,9 @@ function menu.process(menudef, keypress) break elseif key == core.KEY_ENTER then core.boot() - -- Should not return + -- Should not return. If it does, escape menu handling + -- and drop to loader prompt. + return false end key = string.char(key) @@ -401,6 +406,7 @@ function menu.process(menudef, keypress) end function menu.run() + local autoboot_key local delay = loader.getenv("autoboot_delay") if delay ~= nil and delay:lower() == "no" then @@ -416,8 +422,17 @@ function menu.run() menu.draw(menu.default) - local autoboot_key = menu.autoboot(delay) + if delay ~= nil then + autoboot_key = menu.autoboot(delay) + -- autoboot_key should return the key pressed. It will only + -- return nil if we hit the timeout and executed the timeout + -- command. Bail out. + if autoboot_key == nil then + return + end + end + menu.process(menu.default, autoboot_key) drawn_menu = nil @@ -426,11 +441,6 @@ function menu.run() end function menu.autoboot(delay) - -- If we've specified a nil delay, we can do nothing but assume that - -- we aren't supposed to be autobooting. - if delay == nil then - return nil - end local x = loader.getenv("loader_menu_timeout_x") or 4 local y = loader.getenv("loader_menu_timeout_y") or 23 local endtime = loader.time() + delay @@ -464,6 +474,7 @@ function menu.autoboot(delay) local cmd = loader.getenv("menu_timeout_command") or "boot" cli_execute_unparsed(cmd) + return nil end -- CLI commands From owner-svn-src-stable@freebsd.org Wed Oct 31 23:54:37 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 304AA10D2928; Wed, 31 Oct 2018 23:54:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D80B57279A; Wed, 31 Oct 2018 23:54:36 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BAB7C13927; Wed, 31 Oct 2018 23:54:36 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9VNsaJj036183; Wed, 31 Oct 2018 23:54:36 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9VNsaBd036181; Wed, 31 Oct 2018 23:54:36 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201810312354.w9VNsaBd036181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 31 Oct 2018 23:54:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339980 - stable/12/release X-SVN-Group: stable-12 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/12/release X-SVN-Commit-Revision: 339980 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 23:54:37 -0000 Author: gjb Date: Wed Oct 31 23:54:36 2018 New Revision: 339980 URL: https://svnweb.freebsd.org/changeset/base/339980 Log: MFC r339873: Set OPTIONS_UNSET in the argument list to env(1), and add AVAHI to the list. This fixes the textproc/docproj build seemingly following FLAVORS being added. Specifically, the problem with the dependency chain here is: - textproc/docproj depends on print/cups, which sets AVAHI=on by default; - net/avahi-app depends on devel/gobject-introspection, which requires python3+; - graphics/netpbm depends on graphics/mesa-libs, which can only be built with python2.7; - textproc/docproj depends on a number of graphics ports for font rendering, etc. MFC r339875: Pass _BRANCH in the reldoc target to ensure the correct src branch is used when generating the hardware.html page. Approved by: re (kib) Sponsored by: The FreeBSD Foundation Modified: stable/12/release/Makefile stable/12/release/release.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/release/Makefile ============================================================================== --- stable/12/release/Makefile Wed Oct 31 23:17:00 2018 (r339979) +++ stable/12/release/Makefile Wed Oct 31 23:54:36 2018 (r339980) @@ -174,6 +174,7 @@ reldoc: cd ${DOCDIR}/en_US.ISO8859-1/htdocs/releases/${REVISION}R && \ env MAN4DIR=${WORLDDIR}/share/man/man4 \ SVN=${SVN} \ + _BRANCH=${BRANCH} \ ${MAKE} all install clean "FORMATS=html txt" \ INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc \ WEBDIR=${DOCDIR} DESTDIR=${.OBJDIR}/rdoc Modified: stable/12/release/release.sh ============================================================================== --- stable/12/release/release.sh Wed Oct 31 23:17:00 2018 (r339979) +++ stable/12/release/release.sh Wed Oct 31 23:54:36 2018 (r339980) @@ -287,9 +287,9 @@ extra_chroot_setup() { PBUILD_FLAGS="${PBUILD_FLAGS} OSREL=${REVISION}" PBUILD_FLAGS="${PBUILD_FLAGS} WRKDIRPREFIX=/tmp/ports" PBUILD_FLAGS="${PBUILD_FLAGS} DISTDIR=/tmp/distfiles" - chroot ${CHROOTDIR} env ${PBUILD_FLAGS} make -C \ + chroot ${CHROOTDIR} env ${PBUILD_FLAGS} \ + OPTIONS_UNSET="AVAHI FOP IGOR" make -C \ /usr/ports/textproc/docproj \ - OPTIONS_UNSET="FOP IGOR" \ FORCE_PKG_REGISTER=1 \ install clean distclean fi From owner-svn-src-stable@freebsd.org Thu Nov 1 08:08:09 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECAAB10F014C; Thu, 1 Nov 2018 08:08:08 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9EFC26F494; Thu, 1 Nov 2018 08:08:08 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 80F1318F2D; Thu, 1 Nov 2018 08:08:08 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA1888G6088713; Thu, 1 Nov 2018 08:08:08 GMT (envelope-from whu@FreeBSD.org) Received: (from whu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1888vX088712; Thu, 1 Nov 2018 08:08:08 GMT (envelope-from whu@FreeBSD.org) Message-Id: <201811010808.wA1888vX088712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: whu set sender to whu@FreeBSD.org using -f From: Wei Hu Date: Thu, 1 Nov 2018 08:08:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339984 - stable/12/sys/dev/hyperv/netvsc X-SVN-Group: stable-12 X-SVN-Commit-Author: whu X-SVN-Commit-Paths: stable/12/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 339984 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 08:08:09 -0000 Author: whu Date: Thu Nov 1 08:08:08 2018 New Revision: 339984 URL: https://svnweb.freebsd.org/changeset/base/339984 Log: MFC r339585: Do not drop UDP traffic when TXCSUM_IPV6 flag is on. PR: 231797 Submitted by: whu Reviewed by: dexuan Obtained from: Kevin Morse Approved by: re (rgrimes) Sponsored by: Microsoft Modified: stable/12/sys/dev/hyperv/netvsc/if_hn.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/12/sys/dev/hyperv/netvsc/if_hn.c Thu Nov 1 03:38:57 2018 (r339983) +++ stable/12/sys/dev/hyperv/netvsc/if_hn.c Thu Nov 1 08:08:08 2018 (r339984) @@ -861,7 +861,8 @@ hn_set_hlen(struct mbuf *m_head) PULLUP_HDR(m_head, ehlen + sizeof(*ip6)); ip6 = mtodo(m_head, ehlen); - if (ip6->ip6_nxt != IPPROTO_TCP) { + if (ip6->ip6_nxt != IPPROTO_TCP && + ip6->ip6_nxt != IPPROTO_UDP) { m_freem(m_head); return (NULL); } From owner-svn-src-stable@freebsd.org Thu Nov 1 10:09:02 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89ECA10D2C90; Thu, 1 Nov 2018 10:09:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9B93471DEB; Thu, 1 Nov 2018 09:00:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D1C219775; Thu, 1 Nov 2018 09:00:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA190bib014604; Thu, 1 Nov 2018 09:00:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA190bap014603; Thu, 1 Nov 2018 09:00:37 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201811010900.wA190bap014603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 1 Nov 2018 09:00:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339987 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 339987 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 10:09:02 -0000 Author: hselasky Date: Thu Nov 1 09:00:37 2018 New Revision: 339987 URL: https://svnweb.freebsd.org/changeset/base/339987 Log: MFC r339868: Implement dma_pool_zalloc() in the LinuxKPI. Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/dmapool.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/dmapool.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/dmapool.h Thu Nov 1 08:59:18 2018 (r339986) +++ stable/11/sys/compat/linuxkpi/common/include/linux/dmapool.h Thu Nov 1 09:00:37 2018 (r339987) @@ -77,6 +77,13 @@ dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, return (vaddr); } +static inline void * +dma_pool_zalloc(struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle) +{ + + return (dma_pool_alloc(pool, mem_flags | __GFP_ZERO, handle)); +} + static inline void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr) { From owner-svn-src-stable@freebsd.org Thu Nov 1 10:09:03 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06DB810D2CCE; Thu, 1 Nov 2018 10:09:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BC33371B98; Thu, 1 Nov 2018 08:59:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D25F1976E; Thu, 1 Nov 2018 08:59:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA18xIp5014360; Thu, 1 Nov 2018 08:59:18 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA18xI91014359; Thu, 1 Nov 2018 08:59:18 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201811010859.wA18xI91014359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 1 Nov 2018 08:59:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339986 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 339986 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 10:09:03 -0000 Author: hselasky Date: Thu Nov 1 08:59:18 2018 New Revision: 339986 URL: https://svnweb.freebsd.org/changeset/base/339986 Log: MFC r339868: Implement dma_pool_zalloc() in the LinuxKPI. Approved by: re (rgrimes) Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/dmapool.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/dmapool.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/dmapool.h Thu Nov 1 08:17:27 2018 (r339985) +++ stable/12/sys/compat/linuxkpi/common/include/linux/dmapool.h Thu Nov 1 08:59:18 2018 (r339986) @@ -77,6 +77,13 @@ dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, return (vaddr); } +static inline void * +dma_pool_zalloc(struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle) +{ + + return (dma_pool_alloc(pool, mem_flags | __GFP_ZERO, handle)); +} + static inline void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr) { From owner-svn-src-stable@freebsd.org Thu Nov 1 14:42:15 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3944810F4950; Thu, 1 Nov 2018 14:42:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE9F4788C1; Thu, 1 Nov 2018 14:42:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0C641D1D5; Thu, 1 Nov 2018 14:42:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA1EgE92091465; Thu, 1 Nov 2018 14:42:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1EgE7H091464; Thu, 1 Nov 2018 14:42:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201811011442.wA1EgE7H091464@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 1 Nov 2018 14:42:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339996 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 339996 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 14:42:15 -0000 Author: hselasky Date: Thu Nov 1 14:42:14 2018 New Revision: 339996 URL: https://svnweb.freebsd.org/changeset/base/339996 Log: MFC r339923: Implement __KERNEL_DIV_ROUND_UP() function macro in the LinuxKPI. Approved by: re (kib) Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Thu Nov 1 14:24:12 2018 (r339995) +++ stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Thu Nov 1 14:42:14 2018 (r339996) @@ -131,6 +131,7 @@ #undef PTR_ALIGN #define PTR_ALIGN(p, a) ((__typeof(p))ALIGN((uintptr_t)(p), (a))) #define DIV_ROUND_UP(x, n) howmany(x, n) +#define __KERNEL_DIV_ROUND_UP(x, n) howmany(x, n) #define DIV_ROUND_UP_ULL(x, n) DIV_ROUND_UP((unsigned long long)(x), (n)) #define FIELD_SIZEOF(t, f) sizeof(((t *)0)->f) From owner-svn-src-stable@freebsd.org Thu Nov 1 14:43:35 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F91110F4A30; Thu, 1 Nov 2018 14:43:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E2ED378F7C; Thu, 1 Nov 2018 14:43:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C42011D1F9; Thu, 1 Nov 2018 14:43:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA1EhYlC092394; Thu, 1 Nov 2018 14:43:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1EhYvR092393; Thu, 1 Nov 2018 14:43:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201811011443.wA1EhYvR092393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 1 Nov 2018 14:43:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339997 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 339997 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 14:43:35 -0000 Author: hselasky Date: Thu Nov 1 14:43:34 2018 New Revision: 339997 URL: https://svnweb.freebsd.org/changeset/base/339997 Log: MFC r339923: Implement __KERNEL_DIV_ROUND_UP() function macro in the LinuxKPI. Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h Thu Nov 1 14:42:14 2018 (r339996) +++ stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h Thu Nov 1 14:43:34 2018 (r339997) @@ -131,6 +131,7 @@ #undef PTR_ALIGN #define PTR_ALIGN(p, a) ((__typeof(p))ALIGN((uintptr_t)(p), (a))) #define DIV_ROUND_UP(x, n) howmany(x, n) +#define __KERNEL_DIV_ROUND_UP(x, n) howmany(x, n) #define DIV_ROUND_UP_ULL(x, n) DIV_ROUND_UP((unsigned long long)(x), (n)) #define FIELD_SIZEOF(t, f) sizeof(((t *)0)->f) From owner-svn-src-stable@freebsd.org Thu Nov 1 15:19:38 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84AC410F58FB; Thu, 1 Nov 2018 15:19:38 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3145F7A97B; Thu, 1 Nov 2018 15:19:38 +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 107761D70F; Thu, 1 Nov 2018 15:19:38 +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 wA1FJb7K009431; Thu, 1 Nov 2018 15:19:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1FJaxd009424; Thu, 1 Nov 2018 15:19:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201811011519.wA1FJaxd009424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 1 Nov 2018 15:19:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339998 - in stable/12/sys: sys vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys: sys vm X-SVN-Commit-Revision: 339998 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 15:19:38 -0000 Author: markj Date: Thu Nov 1 15:19:36 2018 New Revision: 339998 URL: https://svnweb.freebsd.org/changeset/base/339998 Log: MFC r339661, r339669: Refactor domainset iterators for use by malloc(9) and UMA. Approved by: re (gjb) Modified: stable/12/sys/sys/_domainset.h stable/12/sys/vm/vm_domainset.c stable/12/sys/vm/vm_domainset.h stable/12/sys/vm/vm_glue.c stable/12/sys/vm/vm_kern.c stable/12/sys/vm/vm_object.c stable/12/sys/vm/vm_page.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/sys/_domainset.h ============================================================================== --- stable/12/sys/sys/_domainset.h Thu Nov 1 14:43:34 2018 (r339997) +++ stable/12/sys/sys/_domainset.h Thu Nov 1 15:19:36 2018 (r339998) @@ -54,7 +54,7 @@ typedef struct _domainset domainset_t; struct domainset; struct domainset_ref { struct domainset * volatile dr_policy; - unsigned int dr_iterator; + unsigned int dr_iter; }; #endif /* !_SYS__DOMAINSET_H_ */ Modified: stable/12/sys/vm/vm_domainset.c ============================================================================== --- stable/12/sys/vm/vm_domainset.c Thu Nov 1 14:43:34 2018 (r339997) +++ stable/12/sys/vm/vm_domainset.c Thu Nov 1 15:19:36 2018 (r339998) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -62,26 +63,13 @@ static int vm_domainset_default_stride = 64; * Determine which policy is to be used for this allocation. */ static void -vm_domainset_iter_init(struct vm_domainset_iter *di, struct vm_object *obj, - vm_pindex_t pindex) +vm_domainset_iter_init(struct vm_domainset_iter *di, struct domainset *ds, + int *iter, struct vm_object *obj, vm_pindex_t pindex) { - struct domainset *domain; - struct thread *td; - /* - * object policy takes precedence over thread policy. The policies - * are immutable and unsynchronized. Updates can race but pointer - * loads are assumed to be atomic. - */ - if (obj != NULL && (domain = obj->domain.dr_policy) != NULL) { - di->di_domain = domain; - di->di_iter = &obj->domain.dr_iterator; - } else { - td = curthread; - di->di_domain = td->td_domain.dr_policy; - di->di_iter = &td->td_domain.dr_iterator; - } - di->di_policy = di->di_domain->ds_policy; + di->di_domain = ds; + di->di_iter = iter; + di->di_policy = ds->ds_policy; if (di->di_policy == DOMAINSET_POLICY_INTERLEAVE) { #if VM_NRESERVLEVEL > 0 if (vm_object_reserv(obj)) { @@ -211,33 +199,39 @@ void vm_domainset_iter_page_init(struct vm_domainset_iter *di, struct vm_object *obj, vm_pindex_t pindex, int *domain, int *req) { + struct domainset_ref *dr; - vm_domainset_iter_init(di, obj, pindex); + /* + * Object policy takes precedence over thread policy. The policies + * are immutable and unsynchronized. Updates can race but pointer + * loads are assumed to be atomic. + */ + if (obj != NULL && obj->domain.dr_policy != NULL) + dr = &obj->domain; + else + dr = &curthread->td_domain; + vm_domainset_iter_init(di, dr->dr_policy, &dr->dr_iter, obj, pindex); di->di_flags = *req; *req = (di->di_flags & ~(VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL)) | VM_ALLOC_NOWAIT; vm_domainset_iter_first(di, domain); if (vm_page_count_min_domain(*domain)) - vm_domainset_iter_page(di, domain, req); + vm_domainset_iter_page(di, obj, domain); } int -vm_domainset_iter_page(struct vm_domainset_iter *di, int *domain, int *req) +vm_domainset_iter_page(struct vm_domainset_iter *di, struct vm_object *obj, + int *domain) { - /* - * If we exhausted all options with NOWAIT and did a WAITFAIL it - * is time to return an error to the caller. - */ - if ((*req & VM_ALLOC_WAITFAIL) != 0) - return (ENOMEM); - /* If there are more domains to visit we run the iterator. */ while (--di->di_n != 0) { vm_domainset_iter_next(di, domain); if (!di->di_minskip || !vm_page_count_min_domain(*domain)) return (0); } + + /* If we skipped domains below min restart the search. */ if (di->di_minskip) { di->di_minskip = false; vm_domainset_iter_first(di, domain); @@ -248,34 +242,53 @@ vm_domainset_iter_page(struct vm_domainset_iter *di, i if ((di->di_flags & (VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL)) == 0) return (ENOMEM); - /* - * We have visited all domains with non-blocking allocations, try - * from the beginning with a blocking allocation. - */ + /* Wait for one of the domains to accumulate some free pages. */ + if (obj != NULL) + VM_OBJECT_WUNLOCK(obj); + vm_wait_doms(&di->di_domain->ds_mask); + if (obj != NULL) + VM_OBJECT_WLOCK(obj); + if ((di->di_flags & VM_ALLOC_WAITFAIL) != 0) + return (ENOMEM); + + /* Restart the search. */ vm_domainset_iter_first(di, domain); - *req = di->di_flags; return (0); } - -void -vm_domainset_iter_malloc_init(struct vm_domainset_iter *di, - struct vm_object *obj, int *domain, int *flags) +static void +_vm_domainset_iter_policy_init(struct vm_domainset_iter *di, int *domain, + int *flags) { - vm_domainset_iter_init(di, obj, 0); - if (di->di_policy == DOMAINSET_POLICY_INTERLEAVE) - di->di_policy = DOMAINSET_POLICY_ROUNDROBIN; di->di_flags = *flags; *flags = (di->di_flags & ~M_WAITOK) | M_NOWAIT; vm_domainset_iter_first(di, domain); if (vm_page_count_min_domain(*domain)) - vm_domainset_iter_malloc(di, domain, flags); + vm_domainset_iter_policy(di, domain); } +void +vm_domainset_iter_policy_init(struct vm_domainset_iter *di, + struct domainset *ds, int *domain, int *flags) +{ + + vm_domainset_iter_init(di, ds, &curthread->td_domain.dr_iter, NULL, 0); + _vm_domainset_iter_policy_init(di, domain, flags); +} + +void +vm_domainset_iter_policy_ref_init(struct vm_domainset_iter *di, + struct domainset_ref *dr, int *domain, int *flags) +{ + + vm_domainset_iter_init(di, dr->dr_policy, &dr->dr_iter, NULL, 0); + _vm_domainset_iter_policy_init(di, domain, flags); +} + int -vm_domainset_iter_malloc(struct vm_domainset_iter *di, int *domain, int *flags) +vm_domainset_iter_policy(struct vm_domainset_iter *di, int *domain) { /* If there are more domains to visit we run the iterator. */ @@ -296,45 +309,54 @@ vm_domainset_iter_malloc(struct vm_domainset_iter *di, if ((di->di_flags & M_WAITOK) == 0) return (ENOMEM); - /* - * We have visited all domains with non-blocking allocations, try - * from the beginning with a blocking allocation. - */ + /* Wait for one of the domains to accumulate some free pages. */ + vm_wait_doms(&di->di_domain->ds_mask); + + /* Restart the search. */ vm_domainset_iter_first(di, domain); - *flags = di->di_flags; return (0); } #else /* !NUMA */ + int -vm_domainset_iter_page(struct vm_domainset_iter *di, int *domain, int *flags) +vm_domainset_iter_page(struct vm_domainset_iter *di, struct vm_object *obj, + int *domain) { return (EJUSTRETURN); } void -vm_domainset_iter_page_init(struct vm_domainset_iter *di, - struct vm_object *obj, vm_pindex_t pindex, int *domain, int *flags) +vm_domainset_iter_page_init(struct vm_domainset_iter *di, struct vm_object *obj, + vm_pindex_t pindex, int *domain, int *flags) { *domain = 0; } int -vm_domainset_iter_malloc(struct vm_domainset_iter *di, int *domain, int *flags) +vm_domainset_iter_policy(struct vm_domainset_iter *di, int *domain) { return (EJUSTRETURN); } void -vm_domainset_iter_malloc_init(struct vm_domainset_iter *di, - struct vm_object *obj, int *domain, int *flags) +vm_domainset_iter_policy_init(struct vm_domainset_iter *di, + struct domainset *ds, int *domain, int *flags) { *domain = 0; } -#endif +void +vm_domainset_iter_policy_ref_init(struct vm_domainset_iter *di, + struct domainset_ref *dr, int *domain, int *flags) +{ + + *domain = 0; +} + +#endif /* NUMA */ Modified: stable/12/sys/vm/vm_domainset.h ============================================================================== --- stable/12/sys/vm/vm_domainset.h Thu Nov 1 14:43:34 2018 (r339997) +++ stable/12/sys/vm/vm_domainset.h Thu Nov 1 15:19:36 2018 (r339998) @@ -40,12 +40,15 @@ struct vm_domainset_iter { bool di_minskip; }; -int vm_domainset_iter_page(struct vm_domainset_iter *, int *, int *); +int vm_domainset_iter_page(struct vm_domainset_iter *, struct vm_object *, + int *); void vm_domainset_iter_page_init(struct vm_domainset_iter *, struct vm_object *, vm_pindex_t, int *, int *); -int vm_domainset_iter_malloc(struct vm_domainset_iter *, int *, int *); -void vm_domainset_iter_malloc_init(struct vm_domainset_iter *, - struct vm_object *, int *, int *); +int vm_domainset_iter_policy(struct vm_domainset_iter *, int *); +void vm_domainset_iter_policy_init(struct vm_domainset_iter *, + struct domainset *, int *, int *); +void vm_domainset_iter_policy_ref_init(struct vm_domainset_iter *, + struct domainset_ref *, int *, int *); void vm_wait_doms(const domainset_t *); Modified: stable/12/sys/vm/vm_glue.c ============================================================================== --- stable/12/sys/vm/vm_glue.c Thu Nov 1 14:43:34 2018 (r339997) +++ stable/12/sys/vm/vm_glue.c Thu Nov 1 15:19:36 2018 (r339998) @@ -377,7 +377,7 @@ vm_thread_new(struct thread *td, int pages) */ if (vm_ndomains > 1) { ksobj->domain.dr_policy = DOMAINSET_RR(); - ksobj->domain.dr_iterator = + ksobj->domain.dr_iter = atomic_fetchadd_int(&kstack_domain_iter, 1); } Modified: stable/12/sys/vm/vm_kern.c ============================================================================== --- stable/12/sys/vm/vm_kern.c Thu Nov 1 14:43:34 2018 (r339997) +++ stable/12/sys/vm/vm_kern.c Thu Nov 1 15:19:36 2018 (r339998) @@ -235,13 +235,13 @@ kmem_alloc_attr(vm_size_t size, int flags, vm_paddr_t vm_offset_t addr; int domain; - vm_domainset_iter_malloc_init(&di, kernel_object, &domain, &flags); + vm_domainset_iter_policy_init(&di, DOMAINSET_RR(), &domain, &flags); do { addr = kmem_alloc_attr_domain(domain, size, flags, low, high, memattr); if (addr != 0) break; - } while (vm_domainset_iter_malloc(&di, &domain, &flags) == 0); + } while (vm_domainset_iter_policy(&di, &domain) == 0); return (addr); } @@ -319,13 +319,13 @@ kmem_alloc_contig(vm_size_t size, int flags, vm_paddr_ vm_offset_t addr; int domain; - vm_domainset_iter_malloc_init(&di, kernel_object, &domain, &flags); + vm_domainset_iter_policy_init(&di, DOMAINSET_RR(), &domain, &flags); do { addr = kmem_alloc_contig_domain(domain, size, flags, low, high, alignment, boundary, memattr); if (addr != 0) break; - } while (vm_domainset_iter_malloc(&di, &domain, &flags) == 0); + } while (vm_domainset_iter_policy(&di, &domain) == 0); return (addr); } @@ -406,12 +406,12 @@ kmem_malloc(vm_size_t size, int flags) vm_offset_t addr; int domain; - vm_domainset_iter_malloc_init(&di, kernel_object, &domain, &flags); + vm_domainset_iter_policy_init(&di, DOMAINSET_RR(), &domain, &flags); do { addr = kmem_malloc_domain(domain, size, flags); if (addr != 0) break; - } while (vm_domainset_iter_malloc(&di, &domain, &flags) == 0); + } while (vm_domainset_iter_policy(&di, &domain) == 0); return (addr); } Modified: stable/12/sys/vm/vm_object.c ============================================================================== --- stable/12/sys/vm/vm_object.c Thu Nov 1 14:43:34 2018 (r339997) +++ stable/12/sys/vm/vm_object.c Thu Nov 1 15:19:36 2018 (r339998) @@ -274,6 +274,7 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, panic("_vm_object_allocate: type %d is undefined", type); } object->size = size; + object->domain.dr_policy = NULL; object->generation = 1; object->ref_count = 1; object->memattr = VM_MEMATTR_DEFAULT; Modified: stable/12/sys/vm/vm_page.c ============================================================================== --- stable/12/sys/vm/vm_page.c Thu Nov 1 14:43:34 2018 (r339997) +++ stable/12/sys/vm/vm_page.c Thu Nov 1 15:19:36 2018 (r339998) @@ -1753,7 +1753,7 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_t pi mpred); if (m != NULL) break; - } while (vm_domainset_iter_page(&di, &domain, &req) == 0); + } while (vm_domainset_iter_page(&di, object, &domain) == 0); return (m); } @@ -1990,7 +1990,7 @@ vm_page_alloc_contig(vm_object_t object, vm_pindex_t p npages, low, high, alignment, boundary, memattr); if (m != NULL) break; - } while (vm_domainset_iter_page(&di, &domain, &req) == 0); + } while (vm_domainset_iter_page(&di, object, &domain) == 0); return (m); } @@ -2191,7 +2191,7 @@ vm_page_alloc_freelist(int freelist, int req) m = vm_page_alloc_freelist_domain(domain, freelist, req); if (m != NULL) break; - } while (vm_domainset_iter_page(&di, &domain, &req) == 0); + } while (vm_domainset_iter_page(&di, NULL, &domain) == 0); return (m); } @@ -2830,7 +2830,7 @@ vm_page_reclaim_contig(int req, u_long npages, vm_padd high, alignment, boundary); if (ret) break; - } while (vm_domainset_iter_page(&di, &domain, &req) == 0); + } while (vm_domainset_iter_page(&di, NULL, &domain) == 0); return (ret); } From owner-svn-src-stable@freebsd.org Thu Nov 1 15:47:09 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BDBE10F6748; Thu, 1 Nov 2018 15:47:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 962C67C225; Thu, 1 Nov 2018 15:47:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72BD71DC4B; Thu, 1 Nov 2018 15:47:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA1Fl8W0025266; Thu, 1 Nov 2018 15:47:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1Fl7SX025262; Thu, 1 Nov 2018 15:47:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201811011547.wA1Fl7SX025262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 1 Nov 2018 15:47:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r340002 - in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src modules/linuxkpi X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src modules/linuxkpi X-SVN-Commit-Revision: 340002 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 15:47:09 -0000 Author: hselasky Date: Thu Nov 1 15:47:07 2018 New Revision: 340002 URL: https://svnweb.freebsd.org/changeset/base/340002 Log: MFC r339924: Implement the dump_stack() function in the LinuxKPI. Approved by: re (gjb) Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h stable/12/sys/compat/linuxkpi/common/src/linux_compat.c stable/12/sys/modules/linuxkpi/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Thu Nov 1 15:40:57 2018 (r340001) +++ stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Thu Nov 1 15:47:07 2018 (r340002) @@ -138,6 +138,9 @@ #define printk(...) printf(__VA_ARGS__) #define vprintk(f, a) vprintf(f, a) +extern void linux_dump_stack(void); +#define dump_stack() linux_dump_stack() + struct va_format { const char *fmt; va_list *va; Modified: stable/12/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Thu Nov 1 15:40:57 2018 (r340001) +++ stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Thu Nov 1 15:47:07 2018 (r340002) @@ -30,6 +30,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_stack.h" + #include #include #include @@ -46,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -2205,6 +2208,18 @@ __unregister_chrdev(unsigned int major, unsigned int b if (cdevp != NULL) cdev_del(cdevp); } +} + +void +linux_dump_stack(void) +{ +#ifdef STACK + struct stack st; + + stack_zero(&st); + stack_save(&st); + stack_print(&st); +#endif } #if defined(__i386__) || defined(__amd64__) Modified: stable/12/sys/modules/linuxkpi/Makefile ============================================================================== --- stable/12/sys/modules/linuxkpi/Makefile Thu Nov 1 15:40:57 2018 (r340001) +++ stable/12/sys/modules/linuxkpi/Makefile Thu Nov 1 15:47:07 2018 (r340002) @@ -24,7 +24,8 @@ SRCS+= bus_if.h \ pci_if.h \ vnode_if.h \ usb_if.h \ - opt_usb.h + opt_usb.h \ + opt_stack.h CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include From owner-svn-src-stable@freebsd.org Thu Nov 1 15:50:59 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EA4410F68DF; Thu, 1 Nov 2018 15:50:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 32C1C7C621; Thu, 1 Nov 2018 15:50:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF0051DD6B; Thu, 1 Nov 2018 15:50:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA1Fowxp025608; Thu, 1 Nov 2018 15:50:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1Fowv6025605; Thu, 1 Nov 2018 15:50:58 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201811011550.wA1Fowv6025605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 1 Nov 2018 15:50:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r340003 - in stable/11/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src modules/linuxkpi X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src modules/linuxkpi X-SVN-Commit-Revision: 340003 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 15:50:59 -0000 Author: hselasky Date: Thu Nov 1 15:50:57 2018 New Revision: 340003 URL: https://svnweb.freebsd.org/changeset/base/340003 Log: MFC r339924: Implement the dump_stack() function in the LinuxKPI. Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h stable/11/sys/compat/linuxkpi/common/src/linux_compat.c stable/11/sys/modules/linuxkpi/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h Thu Nov 1 15:47:07 2018 (r340002) +++ stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h Thu Nov 1 15:50:57 2018 (r340003) @@ -138,6 +138,9 @@ #define printk(...) printf(__VA_ARGS__) #define vprintk(f, a) vprintf(f, a) +extern void linux_dump_stack(void); +#define dump_stack() linux_dump_stack() + struct va_format { const char *fmt; va_list *va; Modified: stable/11/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Thu Nov 1 15:47:07 2018 (r340002) +++ stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Thu Nov 1 15:50:57 2018 (r340003) @@ -30,6 +30,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_stack.h" + #include #include #include @@ -46,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -2205,6 +2208,18 @@ __unregister_chrdev(unsigned int major, unsigned int b if (cdevp != NULL) cdev_del(cdevp); } +} + +void +linux_dump_stack(void) +{ +#ifdef STACK + struct stack st; + + stack_zero(&st); + stack_save(&st); + stack_print(&st); +#endif } #if defined(__i386__) || defined(__amd64__) Modified: stable/11/sys/modules/linuxkpi/Makefile ============================================================================== --- stable/11/sys/modules/linuxkpi/Makefile Thu Nov 1 15:47:07 2018 (r340002) +++ stable/11/sys/modules/linuxkpi/Makefile Thu Nov 1 15:50:57 2018 (r340003) @@ -24,7 +24,8 @@ SRCS+= bus_if.h \ pci_if.h \ vnode_if.h \ usb_if.h \ - opt_usb.h + opt_usb.h \ + opt_stack.h CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include From owner-svn-src-stable@freebsd.org Thu Nov 1 16:00:01 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A74B710F7040; Thu, 1 Nov 2018 16:00: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E2557D13C; Thu, 1 Nov 2018 16:00: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 119F21DE33; Thu, 1 Nov 2018 16:00: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 wA1G00A1030953; Thu, 1 Nov 2018 16:00:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1G00og030952; Thu, 1 Nov 2018 16:00:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201811011600.wA1G00og030952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 1 Nov 2018 16:00:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r340006 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 340006 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 16:00:01 -0000 Author: markj Date: Thu Nov 1 16:00:00 2018 New Revision: 340006 URL: https://svnweb.freebsd.org/changeset/base/340006 Log: MFC r339686: Use a vm_domainset iterator in keg_fetch_slab(). Approved by: re (kib) Modified: stable/12/sys/vm/uma_core.c stable/12/sys/vm/uma_int.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/uma_core.c ============================================================================== --- stable/12/sys/vm/uma_core.c Thu Nov 1 15:52:49 2018 (r340005) +++ stable/12/sys/vm/uma_core.c Thu Nov 1 16:00:00 2018 (r340006) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -79,6 +80,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -991,6 +993,8 @@ zone_drain(uma_zone_t zone) /* * Allocate a new slab for a keg. This does not insert the slab onto a list. + * If the allocation was successful, the keg lock will be held upon return, + * otherwise the keg will be left unlocked. * * Arguments: * wait Shall we wait? @@ -1012,13 +1016,12 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom KASSERT(domain >= 0 && domain < vm_ndomains, ("keg_alloc_slab: domain %d out of range", domain)); mtx_assert(&keg->uk_lock, MA_OWNED); - slab = NULL; - mem = NULL; allocf = keg->uk_allocf; KEG_UNLOCK(keg); - size = keg->uk_ppera * PAGE_SIZE; + slab = NULL; + mem = NULL; if (keg->uk_flags & UMA_ZONE_OFFPAGE) { slab = zone_alloc_item(keg->uk_slabzone, NULL, domain, wait); if (slab == NULL) @@ -1041,6 +1044,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom wait |= M_NODUMP; /* zone is passed for legacy reasons. */ + size = keg->uk_ppera * PAGE_SIZE; mem = allocf(zone, size, domain, &flags, wait); if (mem == NULL) { if (keg->uk_flags & UMA_ZONE_OFFPAGE) @@ -1079,20 +1083,18 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom goto out; } } -out: KEG_LOCK(keg); CTR3(KTR_UMA, "keg_alloc_slab: allocated slab %p for %s(%p)", slab, keg->uk_name, keg); - if (slab != NULL) { - if (keg->uk_flags & UMA_ZONE_HASH) - UMA_HASH_INSERT(&keg->uk_hash, slab, mem); + if (keg->uk_flags & UMA_ZONE_HASH) + UMA_HASH_INSERT(&keg->uk_hash, slab, mem); - keg->uk_pages += keg->uk_ppera; - keg->uk_free += keg->uk_ipers; - } + keg->uk_pages += keg->uk_ppera; + keg->uk_free += keg->uk_ipers; +out: return (slab); } @@ -1559,7 +1561,6 @@ keg_ctor(void *mem, int size, void *udata, int flags) keg->uk_init = arg->uminit; keg->uk_fini = arg->fini; keg->uk_align = arg->align; - keg->uk_cursor = 0; keg->uk_free = 0; keg->uk_reserve = 0; keg->uk_pages = 0; @@ -1567,6 +1568,14 @@ keg_ctor(void *mem, int size, void *udata, int flags) keg->uk_slabzone = NULL; /* + * We use a global round-robin policy by default. Zones with + * UMA_ZONE_NUMA set will use first-touch instead, in which case the + * iterator is never run. + */ + keg->uk_dr.dr_policy = DOMAINSET_RR(); + keg->uk_dr.dr_iter = 0; + + /* * The master zone is passed to us at keg-creation time. */ zone = arg->zone; @@ -2607,7 +2616,7 @@ uma_zalloc_domain(uma_zone_t zone, void *udata, int do * only 'domain'. */ static uma_slab_t -keg_first_slab(uma_keg_t keg, int domain, int rr) +keg_first_slab(uma_keg_t keg, int domain, bool rr) { uma_domain_t dom; uma_slab_t slab; @@ -2636,43 +2645,51 @@ keg_first_slab(uma_keg_t keg, int domain, int rr) } static uma_slab_t -keg_fetch_slab(uma_keg_t keg, uma_zone_t zone, int rdomain, int flags) +keg_fetch_free_slab(uma_keg_t keg, int domain, bool rr, int flags) { + uint32_t reserve; + + mtx_assert(&keg->uk_lock, MA_OWNED); + + reserve = (flags & M_USE_RESERVE) != 0 ? 0 : keg->uk_reserve; + if (keg->uk_free <= reserve) + return (NULL); + return (keg_first_slab(keg, domain, rr)); +} + +static uma_slab_t +keg_fetch_slab(uma_keg_t keg, uma_zone_t zone, int rdomain, const int flags) +{ + struct vm_domainset_iter di; uma_domain_t dom; uma_slab_t slab; - int allocflags, domain, reserve, rr, start; + int aflags, domain; + bool rr; +restart: mtx_assert(&keg->uk_lock, MA_OWNED); - slab = NULL; - reserve = 0; - allocflags = flags; - if ((flags & M_USE_RESERVE) == 0) - reserve = keg->uk_reserve; /* - * Round-robin for non first-touch zones when there is more than one - * domain. + * Use the keg's policy if upper layers haven't already specified a + * domain (as happens with first-touch zones). + * + * To avoid races we run the iterator with the keg lock held, but that + * means that we cannot allow the vm_domainset layer to sleep. Thus, + * clear M_WAITOK and handle low memory conditions locally. */ - if (vm_ndomains == 1) - rdomain = 0; rr = rdomain == UMA_ANYDOMAIN; if (rr) { - start = keg->uk_cursor; - do { - keg->uk_cursor = (keg->uk_cursor + 1) % vm_ndomains; - domain = keg->uk_cursor; - } while (VM_DOMAIN_EMPTY(domain) && domain != start); - domain = start = keg->uk_cursor; - /* Only block on the second pass. */ - if ((flags & (M_WAITOK | M_NOVM)) == M_WAITOK) - allocflags = (allocflags & ~M_WAITOK) | M_NOWAIT; - } else - domain = start = rdomain; + aflags = (flags & ~M_WAITOK) | M_NOWAIT; + vm_domainset_iter_policy_ref_init(&di, &keg->uk_dr, &domain, + &aflags); + } else { + aflags = flags; + domain = rdomain; + } -again: - do { - if (keg->uk_free > reserve && - (slab = keg_first_slab(keg, domain, rr)) != NULL) { + for (;;) { + slab = keg_fetch_free_slab(keg, domain, rr, flags); + if (slab != NULL) { MPASS(slab->us_keg == keg); return (slab); } @@ -2700,7 +2717,7 @@ again: msleep(keg, &keg->uk_lock, PVM, "keglimit", 0); continue; } - slab = keg_alloc_slab(keg, zone, domain, allocflags); + slab = keg_alloc_slab(keg, zone, domain, aflags); /* * If we got a slab here it's safe to mark it partially used * and return. We assume that the caller is going to remove @@ -2712,17 +2729,16 @@ again: LIST_INSERT_HEAD(&dom->ud_part_slab, slab, us_link); return (slab); } - if (rr) { - do { - domain = (domain + 1) % vm_ndomains; - } while (VM_DOMAIN_EMPTY(domain) && domain != start); + KEG_LOCK(keg); + if (rr && vm_domainset_iter_policy(&di, &domain) != 0) { + if ((flags & M_WAITOK) != 0) { + KEG_UNLOCK(keg); + vm_wait_doms(&keg->uk_dr.dr_policy->ds_mask); + KEG_LOCK(keg); + goto restart; + } + break; } - } while (domain != start); - - /* Retry domain scan with blocking. */ - if (allocflags != flags) { - allocflags = flags; - goto again; } /* @@ -2730,8 +2746,7 @@ again: * could have while we were unlocked. Check again before we * fail. */ - if (keg->uk_free > reserve && - (slab = keg_first_slab(keg, domain, rr)) != NULL) { + if ((slab = keg_fetch_free_slab(keg, domain, rr, flags)) != NULL) { MPASS(slab->us_keg == keg); return (slab); } @@ -3606,14 +3621,13 @@ uma_prealloc(uma_zone_t zone, int items) domain = 0; if (slabs * keg->uk_ipers < items) slabs++; - while (slabs > 0) { + while (slabs-- > 0) { slab = keg_alloc_slab(keg, zone, domain, M_WAITOK); if (slab == NULL) - break; + return; MPASS(slab->us_keg == keg); dom = &keg->uk_domain[slab->us_domain]; LIST_INSERT_HEAD(&dom->ud_free_slab, slab, us_link); - slabs--; do { domain = (domain + 1) % vm_ndomains; } while (VM_DOMAIN_EMPTY(domain)); Modified: stable/12/sys/vm/uma_int.h ============================================================================== --- stable/12/sys/vm/uma_int.h Thu Nov 1 15:52:49 2018 (r340005) +++ stable/12/sys/vm/uma_int.h Thu Nov 1 16:00:00 2018 (r340006) @@ -226,7 +226,7 @@ struct uma_keg { struct uma_hash uk_hash; LIST_HEAD(,uma_zone) uk_zones; /* Keg's zones */ - uint32_t uk_cursor; /* Domain alloc cursor. */ + struct domainset_ref uk_dr; /* Domain selection policy. */ uint32_t uk_align; /* Alignment mask */ uint32_t uk_pages; /* Total page count */ uint32_t uk_free; /* Count of items free in slabs */ From owner-svn-src-stable@freebsd.org Thu Nov 1 16:50:21 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5438C10F835C; Thu, 1 Nov 2018 16:50:21 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 056097F51C; Thu, 1 Nov 2018 16:50:21 +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 D960E1E690; Thu, 1 Nov 2018 16:50:20 +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 wA1GoKT0056918; Thu, 1 Nov 2018 16:50:20 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1GoJ4a056913; Thu, 1 Nov 2018 16:50:19 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201811011650.wA1GoJ4a056913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 1 Nov 2018 16:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r340007 - in stable/12: share/man/man4 sys/arm64/arm64 sys/kern sys/vm sys/x86/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/arm64/arm64 sys/kern sys/vm sys/x86/acpica X-SVN-Commit-Revision: 340007 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 16:50:21 -0000 Author: markj Date: Thu Nov 1 16:50:19 2018 New Revision: 340007 URL: https://svnweb.freebsd.org/changeset/base/340007 Log: MFC r339616: Make it possible to disable NUMA support with a tunable. PR: 231460 Approved by: re (gjb) Modified: stable/12/share/man/man4/numa.4 stable/12/sys/arm64/arm64/mp_machdep.c stable/12/sys/kern/kern_cpuset.c stable/12/sys/vm/vm_phys.c stable/12/sys/x86/acpica/srat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/numa.4 ============================================================================== --- stable/12/share/man/man4/numa.4 Thu Nov 1 16:00:00 2018 (r340006) +++ stable/12/share/man/man4/numa.4 Thu Nov 1 16:50:19 2018 (r340007) @@ -24,18 +24,16 @@ .\" .\" $FreeBSD$ .\" -.Dd July 10, 2018 +.Dd October 22, 2018 .Dt NUMA 4 .Os .Sh NAME .Nm NUMA .Nd Non-Uniform Memory Access .Sh SYNOPSIS -.Cd options SMP -.Cd options MAXMEMDOM=16 +.Cd options MAXMEMDOM +.Cd options NUMA .Pp -.In sys/cpuset.h -.In sys/bus.h .Sh DESCRIPTION Non-Uniform Memory Access is a computer architecture design which involves unequal costs between processors, memory and IO devices @@ -47,14 +45,26 @@ architecture, the latency to access specific memory or depends upon which processor the memory or device is attached to. Accessing memory local to a processor is faster than accessing memory that is connected to one of the other processors. +.Fx +implements NUMA-aware memory allocation policies. +By default it attempts to ensure that allocations are balanced across +each domain. +Users may override the default domain selection policy using +.Xr cpuset 1 . .Pp .Nm -is enabled when the +support is enabled when the .Cd NUMA -option is used in a kernel configuration -file and the +option is specified in the kernel configuration file. +Each platform defines the .Cd MAXMEMDOM -option is set to a value greater than 1. +constant, which specifies the maximum number of supported NUMA domains. +This constant may be specified in the kernel configuration file. +.Nm +support can be disabled at boot time by setting the +.Va vm.numa.disabled +tunable to 1. +Other values for this tunable are currently ignored. .Pp Thread and process .Nm @@ -128,7 +138,7 @@ tool first appeared in .Fx 11.0 and were removed in .Fx 12.0 . -Current implementation appeared in +The current implementation appeared in .Fx 12.0 . .Pp .Sh AUTHORS Modified: stable/12/sys/arm64/arm64/mp_machdep.c ============================================================================== --- stable/12/sys/arm64/arm64/mp_machdep.c Thu Nov 1 16:00:00 2018 (r340006) +++ stable/12/sys/arm64/arm64/mp_machdep.c Thu Nov 1 16:50:19 2018 (r340007) @@ -576,11 +576,12 @@ cpu_init_fdt(u_int id, phandle_t node, u_int addr_size return (FALSE); /* Try to read the numa node of this cpu */ - if (OF_getencprop(node, "numa-node-id", &domain, sizeof(domain)) > 0) { - __pcpu[id].pc_domain = domain; - if (domain < MAXMEMDOM) - CPU_SET(id, &cpuset_domain[domain]); - } + if (vm_ndomains == 1 || + OF_getencprop(node, "numa-node-id", &domain, sizeof(domain)) <= 0) + domain = 0; + __pcpu[id].pc_domain = domain; + if (domain < MAXMEMDOM) + CPU_SET(id, &cpuset_domain[domain]); return (TRUE); } Modified: stable/12/sys/kern/kern_cpuset.c ============================================================================== --- stable/12/sys/kern/kern_cpuset.c Thu Nov 1 16:00:00 2018 (r340006) +++ stable/12/sys/kern/kern_cpuset.c Thu Nov 1 16:50:19 2018 (r340007) @@ -458,6 +458,12 @@ _domainset_create(struct domainset *domain, struct dom struct domainset *ndomain; int i, j, max; + KASSERT(domain->ds_cnt <= vm_ndomains, + ("invalid domain count in domainset %p", domain)); + KASSERT(domain->ds_policy != DOMAINSET_POLICY_PREFER || + domain->ds_prefer < vm_ndomains, + ("invalid preferred domain in domains %p", domain)); + mtx_lock_spin(&cpuset_lock); LIST_FOREACH(ndomain, &cpuset_domains, ds_link) if (domainset_equal(ndomain, domain)) Modified: stable/12/sys/vm/vm_phys.c ============================================================================== --- stable/12/sys/vm/vm_phys.c Thu Nov 1 16:00:00 2018 (r340006) +++ stable/12/sys/vm/vm_phys.c Thu Nov 1 16:50:19 2018 (r340007) @@ -597,11 +597,22 @@ vm_phys_register_domains(int ndomains, struct mem_affi int *locality) { #ifdef NUMA - int i; + int d, i; - vm_ndomains = ndomains; - mem_affinity = affinity; - mem_locality = locality; + /* + * For now the only override value that we support is 1, which + * effectively disables NUMA-awareness in the allocators. + */ + d = 0; + TUNABLE_INT_FETCH("vm.numa.disabled", &d); + if (d) + ndomains = 1; + + if (ndomains > 1) { + vm_ndomains = ndomains; + mem_affinity = affinity; + mem_locality = locality; + } for (i = 0; i < vm_ndomains; i++) DOMAINSET_SET(i, &all_domains); Modified: stable/12/sys/x86/acpica/srat.c ============================================================================== --- stable/12/sys/x86/acpica/srat.c Thu Nov 1 16:00:00 2018 (r340006) +++ stable/12/sys/x86/acpica/srat.c Thu Nov 1 16:50:19 2018 (r340007) @@ -535,11 +535,7 @@ srat_set_cpus(void *dummy) if (!cpu->enabled) panic("SRAT: CPU with APIC ID %u is not known", pc->pc_apic_id); -#ifdef NUMA - pc->pc_domain = cpu->domain; -#else - pc->pc_domain = 0; -#endif + pc->pc_domain = vm_ndomains > 1 ? cpu->domain : 0; CPU_SET(i, &cpuset_domain[pc->pc_domain]); if (bootverbose) printf("SRAT: CPU %u has memory domain %d\n", i, @@ -564,7 +560,7 @@ acpi_map_pxm_to_vm_domainid(int pxm) for (i = 0; i < ndomain; i++) { if (domain_pxm[i] == pxm) - return (i); + return (vm_ndomains > 1 ? i : 0); } return (-1); From owner-svn-src-stable@freebsd.org Thu Nov 1 17:36:43 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6BFB10F9791; Thu, 1 Nov 2018 17:36:43 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8CBDB8179A; Thu, 1 Nov 2018 17:36:43 +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 6EFAF1EECE; Thu, 1 Nov 2018 17:36:43 +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 wA1Hah1K082544; Thu, 1 Nov 2018 17:36:43 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1Hahmn082543; Thu, 1 Nov 2018 17:36:43 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201811011736.wA1Hahmn082543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 1 Nov 2018 17:36:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r340011 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 340011 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 17:36:44 -0000 Author: markj Date: Thu Nov 1 17:36:42 2018 New Revision: 340011 URL: https://svnweb.freebsd.org/changeset/base/340011 Log: MFC r339688: Add an #include required after r339686. Reported by: lwhsu Approved by: re (gjb) Modified: stable/12/sys/vm/uma_int.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/uma_int.h ============================================================================== --- stable/12/sys/vm/uma_int.h Thu Nov 1 17:29:14 2018 (r340010) +++ stable/12/sys/vm/uma_int.h Thu Nov 1 17:36:42 2018 (r340011) @@ -31,6 +31,7 @@ */ #include +#include #include /* From owner-svn-src-stable@freebsd.org Thu Nov 1 17:37:21 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5810310F981D; Thu, 1 Nov 2018 17:37:21 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 09E9A818DF; Thu, 1 Nov 2018 17:37:21 +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 C60831EED1; Thu, 1 Nov 2018 17:37:20 +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 wA1HbKV1082629; Thu, 1 Nov 2018 17:37:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1HbKjJ082627; Thu, 1 Nov 2018 17:37:20 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201811011737.wA1HbKjJ082627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 1 Nov 2018 17:37:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r340012 - stable/12/stand/lua X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/lua X-SVN-Commit-Revision: 340012 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 17:37:21 -0000 Author: kevans Date: Thu Nov 1 17:37:20 2018 New Revision: 340012 URL: https://svnweb.freebsd.org/changeset/base/340012 Log: MFC r339849: lualoader: Fix try_include error handling The previous iteration of try_include attempted to be 'friendly' and error() out if we hit an error that wasn't ENOENT. This was semi-OK, but fragile as it relied on pattern matching the error message. Move the responsibility for handling failure to the caller. Following a common lua pattern, we'll return the return value of the underlying require() on success, or false and an error message. Approved by: re (gjb) Modified: stable/12/stand/lua/core.lua Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/lua/core.lua ============================================================================== --- stable/12/stand/lua/core.lua Thu Nov 1 17:36:42 2018 (r340011) +++ stable/12/stand/lua/core.lua Thu Nov 1 17:37:20 2018 (r340012) @@ -66,23 +66,15 @@ end -- Globals --- try_include will return the loaded module on success, or nil on failure. --- A message will also be printed on failure, with one exception: non-verbose --- loading will suppress 'module not found' errors. +-- try_include will return the loaded module on success, or false and the error +-- message on failure. function try_include(module) local status, ret = pcall(require, module) -- ret is the module if we succeeded. if status then return ret end - -- Otherwise, ret is just a message; filter out ENOENT unless we're - -- doing a verbose load. As a consequence, try_include prior to loading - -- configuration will not display 'module not found'. All other errors - -- in loading will be printed. - if config.verbose or ret:match("^module .+ not found") == nil then - error(ret, 2) - end - return nil + return false, ret end -- Module exports From owner-svn-src-stable@freebsd.org Thu Nov 1 18:34:30 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54D3910FB2F2; Thu, 1 Nov 2018 18:34:30 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EE6FD84D1D; Thu, 1 Nov 2018 18:34:29 +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 CA2331F8FE; Thu, 1 Nov 2018 18:34:29 +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 wA1IYTlT015463; Thu, 1 Nov 2018 18:34:29 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1IYRqc015449; Thu, 1 Nov 2018 18:34:27 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201811011834.wA1IYRqc015449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Nov 2018 18:34:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r340016 - in stable/11: sys/sys sys/x86/acpica sys/x86/include sys/x86/iommu sys/x86/isa sys/x86/x86 sys/x86/xen sys/xen usr.bin/vmstat X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/11: sys/sys sys/x86/acpica sys/x86/include sys/x86/iommu sys/x86/isa sys/x86/x86 sys/x86/xen sys/xen usr.bin/vmstat X-SVN-Commit-Revision: 340016 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 18:34:30 -0000 Author: jhb Date: Thu Nov 1 18:34:26 2018 New Revision: 340016 URL: https://svnweb.freebsd.org/changeset/base/340016 Log: MFC 338360,338415,338624,338630,338631,338725: Dynamic x86 IRQ layout. 338360: Dynamically allocate IRQ ranges on x86. Previously, x86 used static ranges of IRQ values for different types of I/O interrupts. Interrupt pins on I/O APICs and 8259A PICs used IRQ values from 0 to 254. MSI interrupts used a compile-time-defined range starting at 256, and Xen event channels used a compile-time-defined range after MSI. Some recent systems have more than 255 I/O APIC interrupt pins which resulted in those IRQ values overflowing into the MSI range triggering an assertion failure. Replace statically assigned ranges with dynamic ranges. Do a single pass computing the sizes of the IRQ ranges (PICs, MSI, Xen) to determine the total number of IRQs required. Allocate the interrupt source and interrupt count arrays dynamically once this pass has completed. To minimize runtime complexity these arrays are only sized once during bootup. The PIC range is determined by the PICs present in the system. The MSI and Xen ranges continue to use a fixed size, though this does make it possible to turn the MSI range size into a tunable in the future. As a result, various places are updated to use dynamic limits instead of constants. In addition, the vmstat(8) utility has been taught to understand that some kernels may treat 'intrcnt' and 'intrnames' as pointers rather than arrays when extracting interrupt stats from a crashdump. This is determined by the presence (vs absence) of a global 'nintrcnt' symbol. This change reverts r189404 which worked around a buggy BIOS which enumerated an I/O APIC twice (using the same memory mapped address for both entries but using an IRQ base of 256 for one entry and a valid IRQ base for the second entry). Making the "base" of MSI IRQ values dynamic avoids the panic that r189404 worked around, and there may now be valid I/O APICs with an IRQ base above 256 which this workaround would incorrectly skip. If in the future the issue reported in PR 130483 reoccurs, we will have to add a pass over the I/O APIC entries in the MADT to detect duplicates using the memory mapped address and use some strategy to choose the "correct" one. While here, reserve room in intrcnts for the Hyper-V counters. 338415: Fix build of x86 UP kernels after dynamic IRQ changes in r338360. 338624: msi: remove the check that interrupt sources have been added When running as a specific type of Xen guest the hypervisor won't provide any emulated IO-APICs or legacy PICs at all, thus hitting the following assert in the MSI code: panic: Assertion num_io_irqs > 0 failed at /usr/src/sys/x86/x86/msi.c:334 cpuid = 0 time = 1 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff826ffa70 vpanic() at vpanic+0x1a3/frame 0xffffffff826ffad0 panic() at panic+0x43/frame 0xffffffff826ffb30 msi_init() at msi_init+0xed/frame 0xffffffff826ffb40 apic_setup_io() at apic_setup_io+0x72/frame 0xffffffff826ffb50 mi_startup() at mi_startup+0x118/frame 0xffffffff826ffb70 start_kernel() at start_kernel+0x10 Fix this by removing the assert in the MSI code, since it's possible to get to the MSI initialization without having registered any other interrupt sources. 338630: lapic: skip setting intrcnt if lapic is not present Instead of panicking. Legacy PVH mode doesn't provide a lapic, and since native_lapic_intrcnt is called unconditionally this would cause the assert to trigger. Change the assert into a continue in order to take into account the possibility of systems without a lapic. 338631: xen: legacy PVH fixes for the new interrupt count Register interrupts using the PIC pic_register_sources method instead of doing it in apic_setup_io. This is now required, since the internal interrupt structures are not yet setup when calling apic_setup_io. 338725: Fix a regression in r338360 when booting an x86 machine without APIC. The atpic_register_sources callback tries to avoid registering interrupt sources that would collide with an I/O APIC. However, the previous implementation was failing to register IRQs 8-15 since the slave PIC saw valid IRQs from the master and assumed an I/O APIC was present. To fix, go back to registering all 8259A interrupt sources in one loop when the master's register_sources method is invoked. PR: 229429, 130483, 231291 Modified: stable/11/sys/sys/interrupt.h stable/11/sys/x86/acpica/madt.c stable/11/sys/x86/include/apicvar.h stable/11/sys/x86/include/intr_machdep.h stable/11/sys/x86/iommu/intel_intrmap.c stable/11/sys/x86/isa/atpic.c stable/11/sys/x86/x86/intr_machdep.c stable/11/sys/x86/x86/io_apic.c stable/11/sys/x86/x86/local_apic.c stable/11/sys/x86/x86/msi.c stable/11/sys/x86/x86/nexus.c stable/11/sys/x86/xen/pvcpu_enum.c stable/11/sys/x86/xen/xen_intr.c stable/11/sys/x86/xen/xen_msi.c stable/11/sys/x86/xen/xen_nexus.c stable/11/sys/xen/xen_intr.h stable/11/usr.bin/vmstat/vmstat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/interrupt.h ============================================================================== --- stable/11/sys/sys/interrupt.h Thu Nov 1 18:19:10 2018 (r340015) +++ stable/11/sys/sys/interrupt.h Thu Nov 1 18:34:26 2018 (r340016) @@ -149,8 +149,13 @@ extern struct intr_event *clk_intr_event; extern void *vm_ih; /* Counts and names for statistics (defined in MD code). */ +#if defined(__amd64__) || defined(__i386__) +extern u_long *intrcnt; /* counts for for each device and stray */ +extern char *intrnames; /* string table containing device names */ +#else extern u_long intrcnt[]; /* counts for for each device and stray */ extern char intrnames[]; /* string table containing device names */ +#endif extern size_t sintrcnt; /* size of intrcnt table */ extern size_t sintrnames; /* size of intrnames table */ Modified: stable/11/sys/x86/acpica/madt.c ============================================================================== --- stable/11/sys/x86/acpica/madt.c Thu Nov 1 18:19:10 2018 (r340015) +++ stable/11/sys/x86/acpica/madt.c Thu Nov 1 18:34:26 2018 (r340016) @@ -370,10 +370,6 @@ madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *ar apic->Id); if (ioapics[apic->Id].io_apic != NULL) panic("%s: Double APIC ID %u", __func__, apic->Id); - if (apic->GlobalIrqBase >= FIRST_MSI_INT) { - printf("MADT: Ignoring bogus I/O APIC ID %u", apic->Id); - break; - } ioapics[apic->Id].io_apic = ioapic_create(apic->Address, apic->Id, apic->GlobalIrqBase); ioapics[apic->Id].io_vector = apic->GlobalIrqBase; Modified: stable/11/sys/x86/include/apicvar.h ============================================================================== --- stable/11/sys/x86/include/apicvar.h Thu Nov 1 18:19:10 2018 (r340015) +++ stable/11/sys/x86/include/apicvar.h Thu Nov 1 18:34:26 2018 (r340016) @@ -152,10 +152,10 @@ #define APIC_BUS_PCI 2 #define APIC_BUS_MAX APIC_BUS_PCI -#define IRQ_EXTINT (NUM_IO_INTS + 1) -#define IRQ_NMI (NUM_IO_INTS + 2) -#define IRQ_SMI (NUM_IO_INTS + 3) -#define IRQ_DISABLED (NUM_IO_INTS + 4) +#define IRQ_EXTINT -1 +#define IRQ_NMI -2 +#define IRQ_SMI -3 +#define IRQ_DISABLED -4 /* * An APIC enumerator is a psuedo bus driver that enumerates APIC's including Modified: stable/11/sys/x86/include/intr_machdep.h ============================================================================== --- stable/11/sys/x86/include/intr_machdep.h Thu Nov 1 18:19:10 2018 (r340015) +++ stable/11/sys/x86/include/intr_machdep.h Thu Nov 1 18:34:26 2018 (r340016) @@ -32,55 +32,41 @@ #ifdef _KERNEL /* - * The maximum number of I/O interrupts we allow. This number is rather - * arbitrary as it is just the maximum IRQ resource value. The interrupt - * source for a given IRQ maps that I/O interrupt to device interrupt - * source whether it be a pin on an interrupt controller or an MSI interrupt. - * The 16 ISA IRQs are assigned fixed IDT vectors, but all other device - * interrupts allocate IDT vectors on demand. Currently we have 191 IDT - * vectors available for device interrupts. On many systems with I/O APICs, - * a lot of the IRQs are not used, so this number can be much larger than - * 191 and still be safe since only interrupt sources in actual use will - * allocate IDT vectors. + * Values used in determining the allocation of IRQ values among + * different types of I/O interrupts. These values are used as + * indices into a interrupt source array to map I/O interrupts to a + * device interrupt source whether it be a pin on an interrupt + * controller or an MSI interrupt. The 16 ISA IRQs are assigned fixed + * IDT vectors, but all other device interrupts allocate IDT vectors + * on demand. Currently we have 191 IDT vectors available for device + * interrupts on each CPU. On many systems with I/O APICs, a lot of + * the IRQs are not used, so the total number of IRQ values reserved + * can exceed the number of available IDT slots. * - * The first 255 IRQs (0 - 254) are reserved for ISA IRQs and PCI intline IRQs. - * IRQ values from 256 to 767 are used by MSI. When running under the Xen - * Hypervisor, IRQ values from 768 to 4863 are available for binding to - * event channel events. We leave 255 unused to avoid confusion since 255 is - * used in PCI to indicate an invalid IRQ. + * The first 16 IRQs (0 - 15) are reserved for ISA IRQs. Interrupt + * pins on I/O APICs for non-ISA interrupts use IRQ values starting at + * IRQ 17. This layout matches the GSI numbering used by ACPI so that + * IRQ values returned by ACPI methods such as _CRS can be used + * directly by the ACPI bus driver. + * + * MSI interrupts allocate a block of interrupts starting at either + * the end of the I/O APIC range or 256, whichever is higher. When + * running under the Xen Hypervisor, an additional range of IRQ values + * are available for binding to event channel events. We use 256 as + * the minimum IRQ value for MSI interrupts to attempt to leave 255 + * unused since 255 is used in PCI to indicate an invalid INTx IRQ. */ #define NUM_MSI_INTS 512 -#define FIRST_MSI_INT 256 -#ifdef XENHVM -#include -#include -#define NUM_EVTCHN_INTS NR_EVENT_CHANNELS -#define FIRST_EVTCHN_INT \ - (FIRST_MSI_INT + NUM_MSI_INTS) -#define LAST_EVTCHN_INT \ - (FIRST_EVTCHN_INT + NUM_EVTCHN_INTS - 1) -#else -#define NUM_EVTCHN_INTS 0 -#endif -#define NUM_IO_INTS (FIRST_MSI_INT + NUM_MSI_INTS + NUM_EVTCHN_INTS) +#define MINIMUM_MSI_INT 256 +extern u_int first_msi_irq; +extern u_int num_io_irqs; + /* * Default base address for MSI messages on x86 platforms. */ #define MSI_INTEL_ADDR_BASE 0xfee00000 -/* - * - 1 ??? dummy counter. - * - 2 counters for each I/O interrupt. - * - 1 counter for each CPU for lapic timer. - * - 8 counters for each CPU for IPI counters for SMP. - */ -#ifdef SMP -#define INTRCNT_COUNT (1 + NUM_IO_INTS * 2 + (1 + 8) * MAXCPU) -#else -#define INTRCNT_COUNT (1 + NUM_IO_INTS * 2 + 1) -#endif - #ifndef LOCORE typedef void inthand_t(void); @@ -95,6 +81,7 @@ struct intsrc; * return the vector associated with this source. */ struct pic { + void (*pic_register_sources)(struct pic *); void (*pic_enable_source)(struct intsrc *); void (*pic_disable_source)(struct intsrc *, int); void (*pic_eoi_source)(struct intsrc *); @@ -180,6 +167,9 @@ int msi_map(int irq, uint64_t *addr, uint32_t *data); int msi_release(int *irqs, int count); int msix_alloc(device_t dev, int *irq); int msix_release(int irq); +#ifdef XENHVM +void xen_intr_alloc_irqs(void); +#endif #endif /* !LOCORE */ #endif /* _KERNEL */ Modified: stable/11/sys/x86/iommu/intel_intrmap.c ============================================================================== --- stable/11/sys/x86/iommu/intel_intrmap.c Thu Nov 1 18:19:10 2018 (r340015) +++ stable/11/sys/x86/iommu/intel_intrmap.c Thu Nov 1 18:34:26 2018 (r340016) @@ -337,7 +337,7 @@ dmar_init_irt(struct dmar_unit *unit) "QI disabled, disabling interrupt remapping\n"); return (0); } - unit->irte_cnt = clp2(NUM_IO_INTS); + unit->irte_cnt = clp2(num_io_irqs); unit->irt = (dmar_irte_t *)(uintptr_t)kmem_alloc_contig(kernel_arena, unit->irte_cnt * sizeof(dmar_irte_t), M_ZERO | M_WAITOK, 0, dmar_high, PAGE_SIZE, 0, DMAR_IS_COHERENT(unit) ? Modified: stable/11/sys/x86/isa/atpic.c ============================================================================== --- stable/11/sys/x86/isa/atpic.c Thu Nov 1 18:19:10 2018 (r340015) +++ stable/11/sys/x86/isa/atpic.c Thu Nov 1 18:34:26 2018 (r340016) @@ -101,6 +101,7 @@ inthand_t #define ATPIC(io, base, eoi) { \ .at_pic = { \ + .pic_register_sources = atpic_register_sources, \ .pic_enable_source = atpic_enable_source, \ .pic_disable_source = atpic_disable_source, \ .pic_eoi_source = (eoi), \ @@ -139,6 +140,7 @@ struct atpic_intsrc { u_long at_straycount; }; +static void atpic_register_sources(struct pic *pic); static void atpic_enable_source(struct intsrc *isrc); static void atpic_disable_source(struct intsrc *isrc, int eoi); static void atpic_eoi_master(struct intsrc *isrc); @@ -209,6 +211,42 @@ _atpic_eoi_slave(struct intsrc *isrc) } static void +atpic_register_sources(struct pic *pic) +{ + struct atpic *ap = (struct atpic *)pic; + struct atpic_intsrc *ai; + int i; + + /* + * If any of the ISA IRQs have an interrupt source already, then + * assume that the I/O APICs are being used and don't register any + * of our interrupt sources. This makes sure we don't accidentally + * use mixed mode. The "accidental" use could otherwise occur on + * machines that route the ACPI SCI interrupt to a different ISA + * IRQ (at least one machine routes it to IRQ 13) thus disabling + * that APIC ISA routing and allowing the ATPIC source for that IRQ + * to leak through. We used to depend on this feature for routing + * IRQ0 via mixed mode, but now we don't use mixed mode at all. + * + * To avoid the slave not register sources after the master + * registers its sources, register all IRQs when this function is + * called on the master. + */ + if (ap != &atpics[MASTER]) + return; + for (i = 0; i < NUM_ISA_IRQS; i++) + if (intr_lookup_source(i) != NULL) + return; + + /* Loop through all interrupt sources and add them. */ + for (i = 0, ai = atintrs; i < NUM_ISA_IRQS; i++, ai++) { + if (i == ICU_SLAVEID) + continue; + intr_register_source(&ai->at_intsrc); + } +} + +static void atpic_enable_source(struct intsrc *isrc) { struct atpic_intsrc *ai = (struct atpic_intsrc *)isrc; @@ -517,8 +555,6 @@ atpic_startup(void) static void atpic_init(void *dummy __unused) { - struct atpic_intsrc *ai; - int i; /* * Register our PICs, even if we aren't going to use any of their @@ -528,27 +564,8 @@ atpic_init(void *dummy __unused) intr_register_pic(&atpics[1].at_pic) != 0) panic("Unable to register ATPICs"); - /* - * If any of the ISA IRQs have an interrupt source already, then - * assume that the APICs are being used and don't register any - * of our interrupt sources. This makes sure we don't accidentally - * use mixed mode. The "accidental" use could otherwise occur on - * machines that route the ACPI SCI interrupt to a different ISA - * IRQ (at least one machines routes it to IRQ 13) thus disabling - * that APIC ISA routing and allowing the ATPIC source for that IRQ - * to leak through. We used to depend on this feature for routing - * IRQ0 via mixed mode, but now we don't use mixed mode at all. - */ - for (i = 0; i < NUM_ISA_IRQS; i++) - if (intr_lookup_source(i) != NULL) - return; - - /* Loop through all interrupt sources and add them. */ - for (i = 0, ai = atintrs; i < NUM_ISA_IRQS; i++, ai++) { - if (i == ICU_SLAVEID) - continue; - intr_register_source(&ai->at_intsrc); - } + if (num_io_irqs == 0) + num_io_irqs = NUM_ISA_IRQS; } SYSINIT(atpic_init, SI_SUB_INTR, SI_ORDER_FOURTH, atpic_init, NULL); Modified: stable/11/sys/x86/x86/intr_machdep.c ============================================================================== --- stable/11/sys/x86/x86/intr_machdep.c Thu Nov 1 18:19:10 2018 (r340015) +++ stable/11/sys/x86/x86/intr_machdep.c Thu Nov 1 18:34:26 2018 (r340016) @@ -36,6 +36,7 @@ #include "opt_atpic.h" #include "opt_ddb.h" +#include "opt_smp.h" #include #include @@ -43,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -74,21 +76,25 @@ typedef void (*mask_fn)(void *); static int intrcnt_index; -static struct intsrc *interrupt_sources[NUM_IO_INTS]; +static struct intsrc **interrupt_sources; static struct sx intrsrc_lock; static struct mtx intrpic_lock; static struct mtx intrcnt_lock; static TAILQ_HEAD(pics_head, pic) pics; +u_int num_io_irqs; #if defined(SMP) && !defined(EARLY_AP_STARTUP) static int assign_cpu; #endif -u_long intrcnt[INTRCNT_COUNT]; -char intrnames[INTRCNT_COUNT * (MAXCOMLEN + 1)]; +u_long *intrcnt; +char *intrnames; size_t sintrcnt = sizeof(intrcnt); size_t sintrnames = sizeof(intrnames); +int nintrcnt; +static MALLOC_DEFINE(M_INTR, "intr", "Interrupt Sources"); + static int intr_assign_cpu(void *arg, int cpu); static void intr_disable_src(void *arg); static void intr_init(void *__dummy); @@ -97,6 +103,18 @@ static void intrcnt_setname(const char *name, int inde static void intrcnt_updatename(struct intsrc *is); static void intrcnt_register(struct intsrc *is); +/* + * SYSINIT levels for SI_SUB_INTR: + * + * SI_ORDER_FIRST: Initialize locks and pics TAILQ, xen_hvm_cpu_init + * SI_ORDER_SECOND: Xen PICs + * SI_ORDER_THIRD: Add I/O APIC PICs, alloc MSI and Xen IRQ ranges + * SI_ORDER_FOURTH: Add 8259A PICs + * SI_ORDER_FOURTH + 1: Finalize interrupt count and add interrupt sources + * SI_ORDER_MIDDLE: SMP interrupt counters + * SI_ORDER_ANY: Enable interrupts on BSP + */ + static int intr_pic_registered(struct pic *pic) { @@ -132,6 +150,56 @@ intr_register_pic(struct pic *pic) } /* + * Allocate interrupt source arrays and register interrupt sources + * once the number of interrupts is known. + */ +static void +intr_init_sources(void *arg) +{ + struct pic *pic; + + MPASS(num_io_irqs > 0); + + interrupt_sources = mallocarray(num_io_irqs, sizeof(*interrupt_sources), + M_INTR, M_WAITOK | M_ZERO); + + /* + * - 1 ??? dummy counter. + * - 2 counters for each I/O interrupt. + * - 1 counter for each CPU for lapic timer. + * - 1 counter for each CPU for the Hyper-V vmbus driver. + * - 8 counters for each CPU for IPI counters for SMP. + */ + nintrcnt = 1 + num_io_irqs * 2 + mp_ncpus * 2; +#ifdef COUNT_IPIS + if (mp_ncpus > 1) + nintrcnt += 8 * mp_ncpus; +#endif + intrcnt = mallocarray(nintrcnt, sizeof(u_long), M_INTR, M_WAITOK | + M_ZERO); + intrnames = mallocarray(nintrcnt, MAXCOMLEN + 1, M_INTR, M_WAITOK | + M_ZERO); + sintrcnt = nintrcnt * sizeof(u_long); + sintrnames = nintrcnt * (MAXCOMLEN + 1); + + intrcnt_setname("???", 0); + intrcnt_index = 1; + + /* + * NB: intrpic_lock is not held here to avoid LORs due to + * malloc() in intr_register_source(). However, we are still + * single-threaded at this point in startup so the list of + * PICs shouldn't change. + */ + TAILQ_FOREACH(pic, &pics, pics) { + if (pic->pic_register_sources != NULL) + pic->pic_register_sources(pic); + } +} +SYSINIT(intr_init_sources, SI_SUB_INTR, SI_ORDER_FOURTH + 1, intr_init_sources, + NULL); + +/* * Register a new interrupt source with the global interrupt system. * The global interrupts need to be disabled when this function is * called. @@ -143,6 +211,8 @@ intr_register_source(struct intsrc *isrc) KASSERT(intr_pic_registered(isrc->is_pic), ("unregistered PIC")); vector = isrc->is_pic->pic_vector(isrc); + KASSERT(vector < num_io_irqs, ("IRQ %d too large (%u irqs)", vector, + num_io_irqs)); if (interrupt_sources[vector] != NULL) return (EEXIST); error = intr_event_create(&isrc->is_event, isrc, 0, vector, @@ -168,7 +238,7 @@ struct intsrc * intr_lookup_source(int vector) { - if (vector < 0 || vector >= nitems(interrupt_sources)) + if (vector < 0 || vector >= num_io_irqs) return (NULL); return (interrupt_sources[vector]); } @@ -362,6 +432,7 @@ intrcnt_register(struct intsrc *is) KASSERT(is->is_event != NULL, ("%s: isrc with no event", __func__)); mtx_lock_spin(&intrcnt_lock); + MPASS(intrcnt_index + 2 <= nintrcnt); is->is_index = intrcnt_index; intrcnt_index += 2; snprintf(straystr, MAXCOMLEN + 1, "stray irq%d", @@ -378,6 +449,7 @@ intrcnt_add(const char *name, u_long **countp) { mtx_lock_spin(&intrcnt_lock); + MPASS(intrcnt_index < nintrcnt); *countp = &intrcnt[intrcnt_index]; intrcnt_setname(name, intrcnt_index); intrcnt_index++; @@ -388,8 +460,6 @@ static void intr_init(void *dummy __unused) { - intrcnt_setname("???", 0); - intrcnt_index = 1; TAILQ_INIT(&pics); mtx_init(&intrpic_lock, "intrpic", NULL, MTX_DEF); sx_init(&intrsrc_lock, "intrsrc"); @@ -455,10 +525,10 @@ void intr_reprogram(void) { struct intsrc *is; - int v; + u_int v; sx_xlock(&intrsrc_lock); - for (v = 0; v < NUM_IO_INTS; v++) { + for (v = 0; v < num_io_irqs; v++) { is = interrupt_sources[v]; if (is == NULL) continue; @@ -475,14 +545,15 @@ intr_reprogram(void) DB_SHOW_COMMAND(irqs, db_show_irqs) { struct intsrc **isrc; - int i, verbose; + u_int i; + int verbose; if (strcmp(modif, "v") == 0) verbose = 1; else verbose = 0; isrc = interrupt_sources; - for (i = 0; i < NUM_IO_INTS && !db_pager_quit; i++, isrc++) + for (i = 0; i < num_io_irqs && !db_pager_quit; i++, isrc++) if (*isrc != NULL) db_dump_intr_event((*isrc)->is_event, verbose); } @@ -565,7 +636,7 @@ static void intr_shuffle_irqs(void *arg __unused) { struct intsrc *isrc; - int i; + u_int i; /* Don't bother on UP. */ if (mp_ncpus == 1) @@ -574,7 +645,7 @@ intr_shuffle_irqs(void *arg __unused) /* Round-robin assign a CPU to each enabled source. */ sx_xlock(&intrsrc_lock); assign_cpu = 1; - for (i = 0; i < NUM_IO_INTS; i++) { + for (i = 0; i < num_io_irqs; i++) { isrc = interrupt_sources[i]; if (isrc != NULL && isrc->is_handlers > 0) { /* Modified: stable/11/sys/x86/x86/io_apic.c ============================================================================== --- stable/11/sys/x86/x86/io_apic.c Thu Nov 1 18:19:10 2018 (r340015) +++ stable/11/sys/x86/x86/io_apic.c Thu Nov 1 18:34:26 2018 (r340016) @@ -78,7 +78,7 @@ static MALLOC_DEFINE(M_IOAPIC, "io_apic", "I/O APIC st struct ioapic_intsrc { struct intsrc io_intsrc; - u_int io_irq; + int io_irq; u_int io_intpin:8; u_int io_vector:8; u_int io_cpu; @@ -110,6 +110,7 @@ static u_int ioapic_read(volatile ioapic_t *apic, int static void ioapic_write(volatile ioapic_t *apic, int reg, u_int val); static const char *ioapic_bus_string(int bus_type); static void ioapic_print_irq(struct ioapic_intsrc *intpin); +static void ioapic_register_sources(struct pic *pic); static void ioapic_enable_source(struct intsrc *isrc); static void ioapic_disable_source(struct intsrc *isrc, int eoi); static void ioapic_eoi_source(struct intsrc *isrc); @@ -126,6 +127,7 @@ static void ioapic_reprogram_intpin(struct intsrc *isr static STAILQ_HEAD(,ioapic) ioapic_list = STAILQ_HEAD_INITIALIZER(ioapic_list); struct pic ioapic_template = { + .pic_register_sources = ioapic_register_sources, .pic_enable_source = ioapic_enable_source, .pic_disable_source = ioapic_disable_source, .pic_eoi_source = ioapic_eoi_source, @@ -140,7 +142,7 @@ struct pic ioapic_template = { .pic_reprogram_pin = ioapic_reprogram_intpin, }; -static int next_ioapic_base; +static u_int next_ioapic_base; static u_int next_id; static int enable_extint; @@ -248,7 +250,7 @@ ioapic_print_irq(struct ioapic_intsrc *intpin) printf("SMI"); break; default: - printf("%s IRQ %u", ioapic_bus_string(intpin->io_bus), + printf("%s IRQ %d", ioapic_bus_string(intpin->io_bus), intpin->io_irq); } } @@ -316,7 +318,7 @@ ioapic_program_intpin(struct ioapic_intsrc *intpin) * been enabled yet, just ensure that the pin is masked. */ mtx_assert(&icu_lock, MA_OWNED); - if (intpin->io_irq == IRQ_DISABLED || (intpin->io_irq < NUM_IO_INTS && + if (intpin->io_irq == IRQ_DISABLED || (intpin->io_irq >= 0 && intpin->io_vector == 0)) { low = ioapic_read(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin)); @@ -649,6 +651,8 @@ ioapic_create(vm_paddr_t addr, int32_t apic_id, int in io->io_id, intbase, next_ioapic_base); io->io_intbase = intbase; next_ioapic_base = intbase + numintr; + if (next_ioapic_base > num_io_irqs) + num_io_irqs = next_ioapic_base; io->io_numintr = numintr; io->io_addr = apic; io->io_paddr = addr; @@ -757,7 +761,7 @@ ioapic_remap_vector(void *cookie, u_int pin, int vecto io = (struct ioapic *)cookie; if (pin >= io->io_numintr || vector < 0) return (EINVAL); - if (io->io_pins[pin].io_irq >= NUM_IO_INTS) + if (io->io_pins[pin].io_irq < 0) return (EINVAL); io->io_pins[pin].io_irq = vector; if (bootverbose) @@ -776,7 +780,7 @@ ioapic_set_bus(void *cookie, u_int pin, int bus_type) io = (struct ioapic *)cookie; if (pin >= io->io_numintr) return (EINVAL); - if (io->io_pins[pin].io_irq >= NUM_IO_INTS) + if (io->io_pins[pin].io_irq < 0) return (EINVAL); if (io->io_pins[pin].io_bus == bus_type) return (0); @@ -797,7 +801,7 @@ ioapic_set_nmi(void *cookie, u_int pin) return (EINVAL); if (io->io_pins[pin].io_irq == IRQ_NMI) return (0); - if (io->io_pins[pin].io_irq >= NUM_IO_INTS) + if (io->io_pins[pin].io_irq < 0) return (EINVAL); io->io_pins[pin].io_bus = APIC_BUS_UNKNOWN; io->io_pins[pin].io_irq = IRQ_NMI; @@ -820,7 +824,7 @@ ioapic_set_smi(void *cookie, u_int pin) return (EINVAL); if (io->io_pins[pin].io_irq == IRQ_SMI) return (0); - if (io->io_pins[pin].io_irq >= NUM_IO_INTS) + if (io->io_pins[pin].io_irq < 0) return (EINVAL); io->io_pins[pin].io_bus = APIC_BUS_UNKNOWN; io->io_pins[pin].io_irq = IRQ_SMI; @@ -843,7 +847,7 @@ ioapic_set_extint(void *cookie, u_int pin) return (EINVAL); if (io->io_pins[pin].io_irq == IRQ_EXTINT) return (0); - if (io->io_pins[pin].io_irq >= NUM_IO_INTS) + if (io->io_pins[pin].io_irq < 0) return (EINVAL); io->io_pins[pin].io_bus = APIC_BUS_UNKNOWN; io->io_pins[pin].io_irq = IRQ_EXTINT; @@ -868,7 +872,7 @@ ioapic_set_polarity(void *cookie, u_int pin, enum intr io = (struct ioapic *)cookie; if (pin >= io->io_numintr || pol == INTR_POLARITY_CONFORM) return (EINVAL); - if (io->io_pins[pin].io_irq >= NUM_IO_INTS) + if (io->io_pins[pin].io_irq < 0) return (EINVAL); activehi = (pol == INTR_POLARITY_HIGH); if (io->io_pins[pin].io_activehi == activehi) @@ -889,7 +893,7 @@ ioapic_set_triggermode(void *cookie, u_int pin, enum i io = (struct ioapic *)cookie; if (pin >= io->io_numintr || trigger == INTR_TRIGGER_CONFORM) return (EINVAL); - if (io->io_pins[pin].io_irq >= NUM_IO_INTS) + if (io->io_pins[pin].io_irq < 0) return (EINVAL); edgetrigger = (trigger == INTR_TRIGGER_EDGE); if (io->io_pins[pin].io_edgetrigger == edgetrigger) @@ -925,12 +929,26 @@ ioapic_register(void *cookie) /* * Reprogram pins to handle special case pins (such as NMI and - * SMI) and register valid pins as interrupt sources. + * SMI) and disable normal pins until a handler is registered. */ intr_register_pic(&io->io_pic); - for (i = 0, pin = io->io_pins; i < io->io_numintr; i++, pin++) { + for (i = 0, pin = io->io_pins; i < io->io_numintr; i++, pin++) ioapic_reprogram_intpin(&pin->io_intsrc); - if (pin->io_irq < NUM_IO_INTS) +} + +/* + * Add interrupt sources for I/O APIC interrupt pins. + */ +static void +ioapic_register_sources(struct pic *pic) +{ + struct ioapic_intsrc *pin; + struct ioapic *io; + int i; + + io = (struct ioapic *)pic; + for (i = 0, pin = io->io_pins; i < io->io_numintr; i++, pin++) { + if (pin->io_irq >= 0) intr_register_source(&pin->io_intsrc); } } Modified: stable/11/sys/x86/x86/local_apic.c ============================================================================== --- stable/11/sys/x86/x86/local_apic.c Thu Nov 1 18:19:10 2018 (r340015) +++ stable/11/sys/x86/x86/local_apic.c Thu Nov 1 18:34:26 2018 (r340016) @@ -89,11 +89,16 @@ CTASSERT(APIC_TIMER_INT < APIC_LOCAL_INTS); CTASSERT(APIC_LOCAL_INTS == 240); CTASSERT(IPI_STOP < APIC_SPURIOUS_INT); -/* Magic IRQ values for the timer and syscalls. */ -#define IRQ_TIMER (NUM_IO_INTS + 1) -#define IRQ_SYSCALL (NUM_IO_INTS + 2) -#define IRQ_DTRACE_RET (NUM_IO_INTS + 3) -#define IRQ_EVTCHN (NUM_IO_INTS + 4) +/* + * I/O interrupts use non-negative IRQ values. These values are used + * to mark unused IDT entries or IDT entries reserved for a non-I/O + * interrupt. + */ +#define IRQ_FREE -1 +#define IRQ_TIMER -2 +#define IRQ_SYSCALL -3 +#define IRQ_DTRACE_RET -4 +#define IRQ_EVTCHN -5 enum lat_timer_mode { LAT_MODE_UNDEF = 0, @@ -644,7 +649,7 @@ native_lapic_create(u_int apic_id, int boot_cpu) lapics[apic_id].la_elvts[i].lvt_active = 0; } for (i = 0; i <= APIC_NUM_IOINTS; i++) - lapics[apic_id].la_ioint_irqs[i] = -1; + lapics[apic_id].la_ioint_irqs[i] = IRQ_FREE; lapics[apic_id].la_ioint_irqs[IDT_SYSCALL - APIC_IO_INTS] = IRQ_SYSCALL; lapics[apic_id].la_ioint_irqs[APIC_TIMER_INT - APIC_IO_INTS] = IRQ_TIMER; @@ -747,7 +752,6 @@ native_lapic_setup(int boot) uint32_t version; uint32_t maxlvt; register_t saveintr; - char buf[MAXCOMLEN + 1]; int elvt_count; int i; @@ -776,15 +780,11 @@ native_lapic_setup(int boot) LAPIC_LVT_PCINT)); } - /* Program timer LVT and setup handler. */ + /* Program timer LVT. */ la->lvt_timer_base = lvt_mode(la, APIC_LVT_TIMER, lapic_read32(LAPIC_LVT_TIMER)); la->lvt_timer_last = la->lvt_timer_base; lapic_write32(LAPIC_LVT_TIMER, la->lvt_timer_base); - if (boot) { - snprintf(buf, sizeof(buf), "cpu%d:timer", PCPU_GET(cpuid)); - intrcnt_add(buf, &la->la_timer_count); - } /* Calibrate the timer parameters using BSP. */ if (boot && IS_BSP()) { @@ -839,6 +839,25 @@ native_lapic_setup(int boot) } static void +native_lapic_intrcnt(void *dummy __unused) +{ + struct pcpu *pc; + struct lapic *la; + char buf[MAXCOMLEN + 1]; + + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { + la = &lapics[pc->pc_apic_id]; + if (!la->la_present) + continue; + + snprintf(buf, sizeof(buf), "cpu%d:timer", pc->pc_cpuid); + intrcnt_add(buf, &la->la_timer_count); + } +} +SYSINIT(native_lapic_intrcnt, SI_SUB_INTR, SI_ORDER_MIDDLE, native_lapic_intrcnt, + NULL); + +static void native_lapic_reenable_pmc(void) { #ifdef HWPMC_HOOKS @@ -1488,7 +1507,7 @@ native_apic_alloc_vector(u_int apic_id, u_int irq) { u_int vector; - KASSERT(irq < NUM_IO_INTS, ("Invalid IRQ %u", irq)); + KASSERT(irq < num_io_irqs, ("Invalid IRQ %u", irq)); /* * Search for a free vector. Currently we just use a very simple @@ -1496,7 +1515,7 @@ native_apic_alloc_vector(u_int apic_id, u_int irq) */ mtx_lock_spin(&icu_lock); for (vector = 0; vector < APIC_NUM_IOINTS; vector++) { - if (lapics[apic_id].la_ioint_irqs[vector] != -1) + if (lapics[apic_id].la_ioint_irqs[vector] != IRQ_FREE) continue; lapics[apic_id].la_ioint_irqs[vector] = irq; mtx_unlock_spin(&icu_lock); @@ -1522,7 +1541,7 @@ native_apic_alloc_vectors(u_int apic_id, u_int *irqs, KASSERT(align >= count, ("align < count")); #ifdef INVARIANTS for (run = 0; run < count; run++) - KASSERT(irqs[run] < NUM_IO_INTS, ("Invalid IRQ %u at index %u", + KASSERT(irqs[run] < num_io_irqs, ("Invalid IRQ %u at index %u", irqs[run], run)); #endif @@ -1536,7 +1555,7 @@ native_apic_alloc_vectors(u_int apic_id, u_int *irqs, for (vector = 0; vector < APIC_NUM_IOINTS; vector++) { /* Vector is in use, end run. */ - if (lapics[apic_id].la_ioint_irqs[vector] != -1) { + if (lapics[apic_id].la_ioint_irqs[vector] != IRQ_FREE) { run = 0; first = 0; continue; @@ -1617,7 +1636,7 @@ native_apic_free_vector(u_int apic_id, u_int vector, u KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL && vector <= APIC_IO_INTS + APIC_NUM_IOINTS, ("Vector %u does not map to an IRQ line", vector)); - KASSERT(irq < NUM_IO_INTS, ("Invalid IRQ %u", irq)); + KASSERT(irq < num_io_irqs, ("Invalid IRQ %u", irq)); KASSERT(lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] == irq, ("IRQ mismatch")); #ifdef KDTRACE_HOOKS @@ -1638,7 +1657,7 @@ native_apic_free_vector(u_int apic_id, u_int vector, u thread_unlock(td); } mtx_lock_spin(&icu_lock); - lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = -1; + lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = IRQ_FREE; mtx_unlock_spin(&icu_lock); if (!rebooting) { thread_lock(td); @@ -1689,7 +1708,7 @@ DB_SHOW_COMMAND(apic, db_show_apic) db_printf("Interrupts bound to lapic %u\n", apic_id); for (i = 0; i < APIC_NUM_IOINTS + 1 && !db_pager_quit; i++) { irq = lapics[apic_id].la_ioint_irqs[i]; - if (irq == -1 || irq == IRQ_SYSCALL) + if (irq == IRQ_FREE || irq == IRQ_SYSCALL) continue; #ifdef KDTRACE_HOOKS if (irq == IRQ_DTRACE_RET) @@ -1702,7 +1721,7 @@ DB_SHOW_COMMAND(apic, db_show_apic) db_printf("vec 0x%2x -> ", i + APIC_IO_INTS); if (irq == IRQ_TIMER) db_printf("lapic timer\n"); - else if (irq < NUM_IO_INTS) { + else if (irq < num_io_irqs) { isrc = intr_lookup_source(irq); if (isrc == NULL || verbose == 0) db_printf("IRQ %u\n", irq); @@ -1926,6 +1945,10 @@ apic_setup_io(void *dummy __unused) /* Enable the MSI "pic". */ init_ops.msi_init(); + +#ifdef XENHVM + xen_intr_alloc_irqs(); +#endif } SYSINIT(apic_setup_io, SI_SUB_INTR, SI_ORDER_THIRD, apic_setup_io, NULL); Modified: stable/11/sys/x86/x86/msi.c ============================================================================== --- stable/11/sys/x86/x86/msi.c Thu Nov 1 18:19:10 2018 (r340015) +++ stable/11/sys/x86/x86/msi.c Thu Nov 1 18:34:26 2018 (r340016) @@ -118,7 +118,7 @@ struct msi_intsrc { u_int msi_cpu; /* Local APIC ID. (g) */ u_int msi_count:8; /* Messages in this group. (g) */ u_int msi_maxcount:8; /* Alignment for this group. (g) */ - int *msi_irqs; /* Group's IRQ list. (g) */ + u_int *msi_irqs; /* Group's IRQ list. (g) */ u_int msi_remap_cookie; }; @@ -149,6 +149,8 @@ struct pic msi_pic = { .pic_reprogram_pin = NULL, }; +u_int first_msi_irq; + #ifdef SMP /** * Xen hypervisors prior to 4.6.0 do not properly handle updates to @@ -166,7 +168,7 @@ SYSCTL_INT(_machdep, OID_AUTO, disable_msix_migration, #endif static int msi_enabled; -static int msi_last_irq; +static u_int msi_last_irq; static struct mtx msi_lock; static void @@ -327,6 +329,9 @@ msi_init(void) } #endif + first_msi_irq = max(MINIMUM_MSI_INT, num_io_irqs); + num_io_irqs = first_msi_irq + NUM_MSI_INTS; + msi_enabled = 1; intr_register_pic(&msi_pic); mtx_init(&msi_lock, "msi", NULL, MTX_DEF); @@ -343,7 +348,7 @@ msi_create_source(void) mtx_unlock(&msi_lock); return; } - irq = msi_last_irq + FIRST_MSI_INT; + irq = msi_last_irq + first_msi_irq; msi_last_irq++; mtx_unlock(&msi_lock); @@ -361,8 +366,8 @@ int msi_alloc(device_t dev, int count, int maxcount, int *irqs) { struct msi_intsrc *msi, *fsrc; - u_int cpu; - int cnt, i, *mirqs, vector; + u_int cpu, *mirqs; + int cnt, i, vector; #ifdef ACPI_DMAR u_int cookies[count]; int error; @@ -380,7 +385,7 @@ again: /* Try to find 'count' free IRQs. */ cnt = 0; - for (i = FIRST_MSI_INT; i < FIRST_MSI_INT + NUM_MSI_INTS; i++) { + for (i = first_msi_irq; i < first_msi_irq + NUM_MSI_INTS; i++) { msi = (struct msi_intsrc *)intr_lookup_source(i); /* End of allocated sources, so break. */ @@ -399,7 +404,7 @@ again: /* Do we need to create some new sources? */ if (cnt < count) { /* If we would exceed the max, give up. */ - if (i + (count - cnt) >= FIRST_MSI_INT + NUM_MSI_INTS) { + if (i + (count - cnt) >= first_msi_irq + NUM_MSI_INTS) { mtx_unlock(&msi_lock); free(mirqs, M_MSI); return (ENXIO); @@ -574,8 +579,8 @@ msi_map(int irq, uint64_t *addr, uint32_t *data) #ifdef ACPI_DMAR if (!msi->msi_msix) { - for (k = msi->msi_count - 1, i = FIRST_MSI_INT; k > 0 && - i < FIRST_MSI_INT + NUM_MSI_INTS; i++) { + for (k = msi->msi_count - 1, i = first_msi_irq; k > 0 && + i < first_msi_irq + NUM_MSI_INTS; i++) { if (i == msi->msi_irq) continue; msi1 = (struct msi_intsrc *)intr_lookup_source(i); @@ -622,7 +627,7 @@ again: mtx_lock(&msi_lock); /* Find a free IRQ. */ - for (i = FIRST_MSI_INT; i < FIRST_MSI_INT + NUM_MSI_INTS; i++) { + for (i = first_msi_irq; i < first_msi_irq + NUM_MSI_INTS; i++) { msi = (struct msi_intsrc *)intr_lookup_source(i); /* End of allocated sources, so break. */ @@ -637,7 +642,7 @@ again: /* Do we need to create a new source? */ if (msi == NULL) { /* If we would exceed the max, give up. */ - if (i + 1 >= FIRST_MSI_INT + NUM_MSI_INTS) { + if (i + 1 >= first_msi_irq + NUM_MSI_INTS) { mtx_unlock(&msi_lock); return (ENXIO); } Modified: stable/11/sys/x86/x86/nexus.c ============================================================================== --- stable/11/sys/x86/x86/nexus.c Thu Nov 1 18:19:10 2018 (r340015) +++ stable/11/sys/x86/x86/nexus.c Thu Nov 1 18:34:26 2018 (r340016) @@ -226,7 +226,7 @@ nexus_init_resources(void) irq_rman.rm_start = 0; irq_rman.rm_type = RMAN_ARRAY; irq_rman.rm_descr = "Interrupt request lines"; - irq_rman.rm_end = NUM_IO_INTS - 1; + irq_rman.rm_end = num_io_irqs - 1; if (rman_init(&irq_rman)) panic("nexus_init_resources irq_rman"); @@ -234,7 +234,7 @@ nexus_init_resources(void) * We search for regions of existing IRQs and add those to the IRQ * resource manager. */ - for (irq = 0; irq < NUM_IO_INTS; irq++) + for (irq = 0; irq < num_io_irqs; irq++) if (intr_lookup_source(irq) != NULL) if (rman_manage_region(&irq_rman, irq, irq) != 0) panic("nexus_init_resources irq_rman add"); Modified: stable/11/sys/x86/xen/pvcpu_enum.c ============================================================================== --- stable/11/sys/x86/xen/pvcpu_enum.c Thu Nov 1 18:19:10 2018 (r340015) +++ stable/11/sys/x86/xen/pvcpu_enum.c Thu Nov 1 18:34:26 2018 (r340016) @@ -179,52 +179,65 @@ xenpv_setup_io(void) { if (xen_initial_domain()) { - int i, ret; + /* + * NB: we could iterate over the MADT IOAPIC entries in order + * to figure out the exact number of IOAPIC interrupts, but + * this is legacy code so just keep using the previous + * behaviour and assume a maximum of 256 interrupts. + */ + num_io_irqs = max(MINIMUM_MSI_INT - 1, num_io_irqs); - /* Map MADT */ - madt_physaddr = acpi_find_table(ACPI_SIG_MADT); - madt = acpi_map_table(madt_physaddr, ACPI_SIG_MADT); - madt_length = madt->Header.Length; + acpi_SetDefaultIntrModel(ACPI_INTR_APIC); + } + return (0); +} - /* Try to initialize ACPI so that we can access the FADT. */ - i = acpi_Startup(); - if (ACPI_FAILURE(i)) { - printf("MADT: ACPI Startup failed with %s\n", - AcpiFormatException(i)); - printf("Try disabling either ACPI or apic support.\n"); - panic("Using MADT but ACPI doesn't work"); - } +void +xenpv_register_pirqs(struct pic *pic __unused) +{ + unsigned int i; + int ret; - /* Run through the table to see if there are any overrides. */ - madt_walk_table(madt_parse_ints, NULL); + /* Map MADT */ + madt_physaddr = acpi_find_table(ACPI_SIG_MADT); + madt = acpi_map_table(madt_physaddr, ACPI_SIG_MADT); + madt_length = madt->Header.Length; - /* - * If there was not an explicit override entry for the SCI, - * force it to use level trigger and active-low polarity. - */ - if (!madt_found_sci_override) { - printf( - "MADT: Forcing active-low polarity and level trigger for SCI\n"); - ret = xen_register_pirq(AcpiGbl_FADT.SciInterrupt, - INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW); - if (ret != 0) - panic("Unable to register SCI IRQ"); - } + /* Try to initialize ACPI so that we can access the FADT. */ + ret = acpi_Startup(); + if (ACPI_FAILURE(ret)) { + printf("MADT: ACPI Startup failed with %s\n", + AcpiFormatException(ret)); + printf("Try disabling either ACPI or apic support.\n"); + panic("Using MADT but ACPI doesn't work"); + } - /* Register legacy ISA IRQs */ - for (i = 1; i < 16; i++) { - if (intr_lookup_source(i) != NULL) - continue; - ret = xen_register_pirq(i, INTR_TRIGGER_EDGE, - INTR_POLARITY_LOW); - if (ret != 0 && bootverbose) - printf("Unable to register legacy IRQ#%d: %d\n", - i, ret); - } + /* Run through the table to see if there are any overrides. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Thu Nov 1 20:42:55 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E7B510D7004; Thu, 1 Nov 2018 20:42:55 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D0458B5AC; Thu, 1 Nov 2018 20:42:55 +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 0CC4A20DFC; Thu, 1 Nov 2018 20:42:55 +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 wA1Kgsu7086254; Thu, 1 Nov 2018 20:42:54 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1KgswL086253; Thu, 1 Nov 2018 20:42:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201811012042.wA1KgswL086253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Nov 2018 20:42:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r340017 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/arm64/arm64 X-SVN-Commit-Revision: 340017 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 20:42:55 -0000 Author: jhb Date: Thu Nov 1 20:42:54 2018 New Revision: 340017 URL: https://svnweb.freebsd.org/changeset/base/340017 Log: MFC 338813: Clear all of the VFP state in fill_fpregs(). Zero the entire FP register set structure returned for ptrace() if a thread hasn't used FP registers rather than leaking garbage in the fp_sr and fp_cr fields. Modified: stable/11/sys/arm64/arm64/machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/machdep.c ============================================================================== --- stable/11/sys/arm64/arm64/machdep.c Thu Nov 1 18:34:26 2018 (r340016) +++ stable/11/sys/arm64/arm64/machdep.c Thu Nov 1 20:42:54 2018 (r340017) @@ -222,7 +222,7 @@ fill_fpregs(struct thread *td, struct fpreg *regs) regs->fp_sr = pcb->pcb_fpsr; } else #endif - memset(regs->fp_q, 0, sizeof(regs->fp_q)); + memset(regs, 0, sizeof(*regs)); return (0); } From owner-svn-src-stable@freebsd.org Thu Nov 1 21:28:23 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1CCD10D92CB; Thu, 1 Nov 2018 21:28:23 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 580898CE89; Thu, 1 Nov 2018 21:28:23 +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 34E5F2148E; Thu, 1 Nov 2018 21:28:23 +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 wA1LSMS6007841; Thu, 1 Nov 2018 21:28:22 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1LSM4p007840; Thu, 1 Nov 2018 21:28:22 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201811012128.wA1LSM4p007840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 1 Nov 2018 21:28:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r340019 - stable/12/stand/efi/loader X-SVN-Group: stable-12 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: stable/12/stand/efi/loader X-SVN-Commit-Revision: 340019 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 21:28:23 -0000 Author: imp Date: Thu Nov 1 21:28:22 2018 New Revision: 340019 URL: https://svnweb.freebsd.org/changeset/base/340019 Log: MFC: r339800 and r339802: Fixes to ignore partial DEVICE_PATH items in BOOT_PARAM objects that are too short. Approved by: re@ (glen) Modified: stable/12/stand/efi/loader/main.c Modified: stable/12/stand/efi/loader/main.c ============================================================================== --- stable/12/stand/efi/loader/main.c Thu Nov 1 21:25:26 2018 (r340018) +++ stable/12/stand/efi/loader/main.c Thu Nov 1 21:28:22 2018 (r340019) @@ -298,6 +298,8 @@ fix_dosisms(char *p) } } +#define SIZE(dp, edp) (size_t)((intptr_t)(void *)edp - (intptr_t)(void *)dp) + enum { BOOT_INFO_OK = 0, BAD_CHOICE = 1, NOT_SPECIFIC = 2 }; static int match_boot_info(EFI_LOADED_IMAGE *img __unused, char *boot_info, size_t bisz) @@ -349,7 +351,7 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char * edp = (EFI_DEVICE_PATH *)(walker + fplen); if ((char *)edp > ep) return NOT_SPECIFIC; - while (dp < edp) { + while (dp < edp && SIZE(dp, edp) > sizeof(EFI_DEVICE_PATH)) { text = efi_devpath_name(dp); if (text != NULL) { printf(" BootInfo Path: %S\n", text); From owner-svn-src-stable@freebsd.org Thu Nov 1 23:56:11 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D037D10DD608; Thu, 1 Nov 2018 23:56:11 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8252A6C5D1; Thu, 1 Nov 2018 23:56:11 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62AEA22D93; Thu, 1 Nov 2018 23:56:11 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA1NuBte085104; Thu, 1 Nov 2018 23:56:11 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1NuBrh085103; Thu, 1 Nov 2018 23:56:11 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201811012356.wA1NuBrh085103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 1 Nov 2018 23:56:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r340039 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 340039 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 23:56:12 -0000 Author: gjb Date: Thu Nov 1 23:56:10 2018 New Revision: 340039 URL: https://svnweb.freebsd.org/changeset/base/340039 Log: Update stable/12 from BETA2 to BETA3 as part of the 12.0-RELEASE cycle. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/conf/newvers.sh Modified: stable/12/sys/conf/newvers.sh ============================================================================== --- stable/12/sys/conf/newvers.sh Thu Nov 1 23:46:23 2018 (r340038) +++ stable/12/sys/conf/newvers.sh Thu Nov 1 23:56:10 2018 (r340039) @@ -46,7 +46,7 @@ TYPE="FreeBSD" REVISION="12.0" -BRANCH="BETA2" +BRANCH="BETA3" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-stable@freebsd.org Fri Nov 2 14:07:07 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90DAA10F8017; Fri, 2 Nov 2018 14:07:07 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 454A46C3C9; Fri, 2 Nov 2018 14:07:07 +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 270BE3D51; Fri, 2 Nov 2018 14:07:07 +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 wA2E77vK041286; Fri, 2 Nov 2018 14:07:07 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA2E77vv041285; Fri, 2 Nov 2018 14:07:07 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201811021407.wA2E77vv041285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 2 Nov 2018 14:07:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r340051 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 340051 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2018 14:07:07 -0000 Author: bz Date: Fri Nov 2 14:07:06 2018 New Revision: 340051 URL: https://svnweb.freebsd.org/changeset/base/340051 Log: MFC r339930: With more excessive use of modules, more kernel parts working with VIMAGE, and feature richness and global state increasing the 8k of vnet module space are no longer sufficient for people and loading multiple modules, e.g., pf(4) and ipl(4) or ipsec(4) will fail on the second module. Increase the module space to 8 * PAGE_SIZE which should be enough to hold multiple firewalls, ipsec, multicast (as in the old days was a problem), epair, carp, and any kind of other vnet enabled modules. Sadly this is a global byte array part of the vnet_set, so we cannot dynamically change its size; otherwise a TUNABLE would have been a better solution. PR: 228854 Modified: stable/11/sys/net/vnet.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/vnet.c ============================================================================== --- stable/11/sys/net/vnet.c Fri Nov 2 13:48:06 2018 (r340050) +++ stable/11/sys/net/vnet.c Fri Nov 2 14:07:06 2018 (r340051) @@ -169,7 +169,7 @@ static MALLOC_DEFINE(M_VNET_DATA, "vnet_data", "VNET d * we want the virtualized global variable space to be page-sized, we may * have more space than that in practice. */ -#define VNET_MODMIN 8192 +#define VNET_MODMIN (8 * PAGE_SIZE) #define VNET_SIZE roundup2(VNET_BYTES, PAGE_SIZE) /* From owner-svn-src-stable@freebsd.org Fri Nov 2 14:10:30 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BA4010F826E; Fri, 2 Nov 2018 14:10:30 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3EB046C7C8; Fri, 2 Nov 2018 14:10:30 +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 1B8723D5D; Fri, 2 Nov 2018 14:10:30 +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 wA2EAT24041633; Fri, 2 Nov 2018 14:10:29 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA2EAT78041632; Fri, 2 Nov 2018 14:10:29 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201811021410.wA2EAT78041632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 2 Nov 2018 14:10:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r340052 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 340052 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2018 14:10:30 -0000 Author: bz Date: Fri Nov 2 14:10:29 2018 New Revision: 340052 URL: https://svnweb.freebsd.org/changeset/base/340052 Log: MFC r339407: The countp argument passed to linker_file_lookup_set() in linker_load_dependencies() is unused, so no need to ask for the value in first place. Remove the unused "count" variable. Modified: stable/11/sys/kern/kern_linker.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_linker.c ============================================================================== --- stable/11/sys/kern/kern_linker.c Fri Nov 2 14:07:06 2018 (r340051) +++ stable/11/sys/kern/kern_linker.c Fri Nov 2 14:10:29 2018 (r340052) @@ -2084,7 +2084,7 @@ linker_load_dependencies(linker_file_t lf) const struct mod_depend *verinfo; modlist_t mod; const char *modname, *nmodname; - int ver, error = 0, count; + int ver, error = 0; /* * All files are dependent on /kernel. @@ -2097,7 +2097,7 @@ linker_load_dependencies(linker_file_t lf) return (error); } if (linker_file_lookup_set(lf, MDT_SETNAME, &start, &stop, - &count) != 0) + NULL) != 0) return (0); for (mdp = start; mdp < stop; mdp++) { mp = *mdp; From owner-svn-src-stable@freebsd.org Fri Nov 2 14:13:32 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9E3C10F8508; Fri, 2 Nov 2018 14:13: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 680EF6CC19; Fri, 2 Nov 2018 14:13: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 4754E3EFF; Fri, 2 Nov 2018 14:13: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 wA2EDW47046223; Fri, 2 Nov 2018 14:13:32 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA2EDWdR046222; Fri, 2 Nov 2018 14:13:32 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201811021413.wA2EDWdR046222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 2 Nov 2018 14:13:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r340053 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 340053 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2018 14:13:33 -0000 Author: bz Date: Fri Nov 2 14:13:31 2018 New Revision: 340053 URL: https://svnweb.freebsd.org/changeset/base/340053 Log: MFC r339431: In r78161 the lookup_set linker method was introduced which optionally returns the section start and stop locations as well as a count if the caller asks for them. There was only one out-of-file consumer of count which did not actually use it and hence was eliminated in r339407. In r194784 parse_dpcpu(), and in r195699 parse_vnet() (a copy of the former) started to use the link_elf_lookup_set() interface internally also asking for the count. count is computed as the difference of the void **stop - void **start locations and as such, if the absoulte numbers (stop - start) % sizeof(void *) != 0 a round-down happens, e.g., **stop 0x1003 - **start 0x1000 => count 0. To get the section size instead of "count is the number of pointer elements in the section", the parse_*() functions do a count *= sizeof(void *). They use the result to allocate memory and copy the section data into the "master" and per-instance memory regions with a size of count. As a result of count possibly round-down this can miss the last bytes of the section. The good news is that we do not touch out of bounds memory during these operations (we may at a later stage if the last bytes would overflow the master sections). Given relocation in elf_relocaddr() works based on the absolute numbers of start and stop, this means that we can possibly try to access relocated data which was never copied and hence we get random garbage or at best zeroed memory. Stop the two (last) consumers of count (the parse_*() functions) from using count as well, and calculate the section size based on the absolute numbers of stop and start and use the proper size for the memory allocation and data copies. This will make the symbols in the last bytes of the pcpu or vnet sections be presented as expected. PR: 232289 Modified: stable/11/sys/kern/link_elf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/link_elf.c ============================================================================== --- stable/11/sys/kern/link_elf.c Fri Nov 2 14:10:29 2018 (r340052) +++ stable/11/sys/kern/link_elf.c Fri Nov 2 14:13:31 2018 (r340053) @@ -611,27 +611,29 @@ parse_dynamic(elf_file_t ef) static int parse_dpcpu(elf_file_t ef) { - int count; - int error; + int error, size; ef->pcpu_start = 0; ef->pcpu_stop = 0; error = link_elf_lookup_set(&ef->lf, "pcpu", (void ***)&ef->pcpu_start, - (void ***)&ef->pcpu_stop, &count); + (void ***)&ef->pcpu_stop, NULL); /* Error just means there is no pcpu set to relocate. */ if (error != 0) return (0); - count *= sizeof(void *); + size = (uintptr_t)ef->pcpu_stop - (uintptr_t)ef->pcpu_start; + /* Empty set? */ + if (size < 1) + return (0); /* * Allocate space in the primary pcpu area. Copy in our * initialization from the data section and then initialize * all per-cpu storage from that. */ - ef->pcpu_base = (Elf_Addr)(uintptr_t)dpcpu_alloc(count); + ef->pcpu_base = (Elf_Addr)(uintptr_t)dpcpu_alloc(size); if (ef->pcpu_base == 0) return (ENOSPC); - memcpy((void *)ef->pcpu_base, (void *)ef->pcpu_start, count); - dpcpu_copy((void *)ef->pcpu_base, count); + memcpy((void *)ef->pcpu_base, (void *)ef->pcpu_start, size); + dpcpu_copy((void *)ef->pcpu_base, size); elf_set_add(&set_pcpu_list, ef->pcpu_start, ef->pcpu_stop, ef->pcpu_base); @@ -642,27 +644,29 @@ parse_dpcpu(elf_file_t ef) static int parse_vnet(elf_file_t ef) { - int count; - int error; + int error, size; ef->vnet_start = 0; ef->vnet_stop = 0; error = link_elf_lookup_set(&ef->lf, "vnet", (void ***)&ef->vnet_start, - (void ***)&ef->vnet_stop, &count); + (void ***)&ef->vnet_stop, NULL); /* Error just means there is no vnet data set to relocate. */ if (error != 0) return (0); - count *= sizeof(void *); + size = (uintptr_t)ef->vnet_stop - (uintptr_t)ef->vnet_start; + /* Empty set? */ + if (size < 1) + return (0); /* * Allocate space in the primary vnet area. Copy in our * initialization from the data section and then initialize * all per-vnet storage from that. */ - ef->vnet_base = (Elf_Addr)(uintptr_t)vnet_data_alloc(count); + ef->vnet_base = (Elf_Addr)(uintptr_t)vnet_data_alloc(size); if (ef->vnet_base == 0) return (ENOSPC); - memcpy((void *)ef->vnet_base, (void *)ef->vnet_start, count); - vnet_data_copy((void *)ef->vnet_base, count); + memcpy((void *)ef->vnet_base, (void *)ef->vnet_start, size); + vnet_data_copy((void *)ef->vnet_base, size); elf_set_add(&set_vnet_list, ef->vnet_start, ef->vnet_stop, ef->vnet_base); From owner-svn-src-stable@freebsd.org Fri Nov 2 14:15:53 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71D8110F85F7; Fri, 2 Nov 2018 14:15: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 190316CE23; Fri, 2 Nov 2018 14:15: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 EFCC53F07; Fri, 2 Nov 2018 14:15:52 +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 wA2EFqOr046421; Fri, 2 Nov 2018 14:15:52 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA2EFqmZ046419; Fri, 2 Nov 2018 14:15:52 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201811021415.wA2EFqmZ046419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 2 Nov 2018 14:15:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r340054 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 340054 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2018 14:15:53 -0000 Author: bz Date: Fri Nov 2 14:15:52 2018 New Revision: 340054 URL: https://svnweb.freebsd.org/changeset/base/340054 Log: MFC r339931,r339933 As a follow-up to r339930 and various reports implement logging in case we fail during module load because the pcpu or vnet module sections are full. We did return a proper error but not leaving any indication to the user as to what the actual problem was. PR: 228854 Modified: stable/11/sys/kern/link_elf.c stable/11/sys/kern/link_elf_obj.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/link_elf.c ============================================================================== --- stable/11/sys/kern/link_elf.c Fri Nov 2 14:13:31 2018 (r340053) +++ stable/11/sys/kern/link_elf.c Fri Nov 2 14:15:52 2018 (r340054) @@ -630,8 +630,12 @@ parse_dpcpu(elf_file_t ef) * all per-cpu storage from that. */ ef->pcpu_base = (Elf_Addr)(uintptr_t)dpcpu_alloc(size); - if (ef->pcpu_base == 0) + if (ef->pcpu_base == 0) { + printf("%s: pcpu module space is out of space; " + "cannot allocate %d for %s\n", + __func__, size, ef->lf.pathname); return (ENOSPC); + } memcpy((void *)ef->pcpu_base, (void *)ef->pcpu_start, size); dpcpu_copy((void *)ef->pcpu_base, size); elf_set_add(&set_pcpu_list, ef->pcpu_start, ef->pcpu_stop, @@ -663,8 +667,12 @@ parse_vnet(elf_file_t ef) * all per-vnet storage from that. */ ef->vnet_base = (Elf_Addr)(uintptr_t)vnet_data_alloc(size); - if (ef->vnet_base == 0) + if (ef->vnet_base == 0) { + printf("%s: vnet module space is out of space; " + "cannot allocate %d for %s\n", + __func__, size, ef->lf.pathname); return (ENOSPC); + } memcpy((void *)ef->vnet_base, (void *)ef->vnet_start, size); vnet_data_copy((void *)ef->vnet_base, size); elf_set_add(&set_vnet_list, ef->vnet_start, ef->vnet_stop, Modified: stable/11/sys/kern/link_elf_obj.c ============================================================================== --- stable/11/sys/kern/link_elf_obj.c Fri Nov 2 14:13:31 2018 (r340053) +++ stable/11/sys/kern/link_elf_obj.c Fri Nov 2 14:15:52 2018 (r340054) @@ -366,6 +366,11 @@ link_elf_link_preload(linker_class_t cls, const char * dpcpu = dpcpu_alloc(shdr[i].sh_size); if (dpcpu == NULL) { + printf("%s: pcpu module space is out " + "of space; cannot allocate %#jx " + "for %s\n", __func__, + (uintmax_t)shdr[i].sh_size, + filename); error = ENOSPC; goto out; } @@ -380,6 +385,11 @@ link_elf_link_preload(linker_class_t cls, const char * vnet_data = vnet_data_alloc(shdr[i].sh_size); if (vnet_data == NULL) { + printf("%s: vnet module space is out " + "of space; cannot allocate %#jx " + "for %s\n", __func__, + (uintmax_t)shdr[i].sh_size, + filename); error = ENOSPC; goto out; } @@ -840,14 +850,30 @@ link_elf_load_file(linker_class_t cls, const char *fil else ef->progtab[pb].name = "<>"; if (ef->progtab[pb].name != NULL && - !strcmp(ef->progtab[pb].name, DPCPU_SETNAME)) + !strcmp(ef->progtab[pb].name, DPCPU_SETNAME)) { ef->progtab[pb].addr = dpcpu_alloc(shdr[i].sh_size); + if (ef->progtab[pb].addr == NULL) { + printf("%s: pcpu module space is out " + "of space; cannot allocate %#jx " + "for %s\n", __func__, + (uintmax_t)shdr[i].sh_size, + filename); + } + } #ifdef VIMAGE else if (ef->progtab[pb].name != NULL && - !strcmp(ef->progtab[pb].name, VNET_SETNAME)) + !strcmp(ef->progtab[pb].name, VNET_SETNAME)) { ef->progtab[pb].addr = vnet_data_alloc(shdr[i].sh_size); + if (ef->progtab[pb].addr == NULL) { + printf("%s: vnet module space is out " + "of space; cannot allocate %#jx " + "for %s\n", __func__, + (uintmax_t)shdr[i].sh_size, + filename); + } + } #endif else ef->progtab[pb].addr = From owner-svn-src-stable@freebsd.org Fri Nov 2 14:59:53 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6F1A10FA260; Fri, 2 Nov 2018 14:59: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C64C6F4B1; Fri, 2 Nov 2018 14:59: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 3EB4945C8; Fri, 2 Nov 2018 14:59: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 wA2ExrJg067416; Fri, 2 Nov 2018 14:59:53 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA2Exrd4067415; Fri, 2 Nov 2018 14:59:53 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201811021459.wA2Exrd4067415@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 2 Nov 2018 14:59:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r340056 - stable/11/lib/libsysdecode X-SVN-Group: stable-11 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/11/lib/libsysdecode X-SVN-Commit-Revision: 340056 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2018 14:59:53 -0000 Author: bz Date: Fri Nov 2 14:59:52 2018 New Revision: 340056 URL: https://svnweb.freebsd.org/changeset/base/340056 Log: MFC r330795: The vmresult table was missing most of the values apart from two due to extra "_" in the names we grep for. Add the "_" to the pattern. Reviewed by: jhb Sponsored by: iXsystems, Inc. Modified: stable/11/lib/libsysdecode/mktables Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/mktables ============================================================================== --- stable/11/lib/libsysdecode/mktables Fri Nov 2 14:42:36 2018 (r340055) +++ stable/11/lib/libsysdecode/mktables Fri Nov 2 14:59:52 2018 (r340056) @@ -146,7 +146,7 @@ gen_table "socktype" "SOCK_[A-Z]+[[:space:]]+[1 gen_table "thrcreateflags" "THR_[A-Z]+[[:space:]]+0x[0-9]+" "sys/thr.h" gen_table "umtxop" "UMTX_OP_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/umtx.h" gen_table "vmprot" "VM_PROT_[A-Z]+[[:space:]]+\(\(vm_prot_t\)[[:space:]]+0x[0-9]+\)" "vm/vm.h" -gen_table "vmresult" "KERN_[A-Z]+[[:space:]]+[0-9]+" "vm/vm_param.h" +gen_table "vmresult" "KERN_[A-Z_]+[[:space:]]+[0-9]+" "vm/vm_param.h" gen_table "wait6opt" "W[A-Z]+[[:space:]]+[0-9]+" "sys/wait.h" gen_table "seekwhence" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "sys/unistd.h" gen_table "fcntlcmd" "F_[A-Z0-9_]+[[:space:]]+[0-9]+[[:space:]]+" "sys/fcntl.h" "F_CANCEL|F_..LCK" From owner-svn-src-stable@freebsd.org Fri Nov 2 15:02:45 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C31410FA52E; Fri, 2 Nov 2018 15:02:45 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 114836FA76; Fri, 2 Nov 2018 15:02:45 +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 E8221476D; Fri, 2 Nov 2018 15:02:44 +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 wA2F2iNE072405; Fri, 2 Nov 2018 15:02:44 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA2F2iDJ072403; Fri, 2 Nov 2018 15:02:44 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201811021502.wA2F2iDJ072403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 2 Nov 2018 15:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r340058 - in stable/11: lib/libc/resolv share/man/man5 X-SVN-Group: stable-11 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in stable/11: lib/libc/resolv share/man/man5 X-SVN-Commit-Revision: 340058 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2018 15:02:45 -0000 Author: bz Date: Fri Nov 2 15:02:44 2018 New Revision: 340058 URL: https://svnweb.freebsd.org/changeset/base/340058 Log: MFC r337904: Allow the use of TCP instead of UDP for queries by setting options usevc in resolv.conf which sets RES_USEVC. Reviewed by: ume Modified: stable/11/lib/libc/resolv/res_init.c stable/11/share/man/man5/resolver.5 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/resolv/res_init.c ============================================================================== --- stable/11/lib/libc/resolv/res_init.c Fri Nov 2 15:01:59 2018 (r340057) +++ stable/11/lib/libc/resolv/res_init.c Fri Nov 2 15:02:44 2018 (r340058) @@ -677,6 +677,8 @@ res_setoptions(res_state statp, const char *options, c statp->options |= RES_INSECURE2; } else if (!strncmp(cp, "rotate", sizeof("rotate") - 1)) { statp->options |= RES_ROTATE; + } else if (!strncmp(cp, "usevc", sizeof("usevc") - 1)) { + statp->options |= RES_USEVC; } else if (!strncmp(cp, "no-check-names", sizeof("no-check-names") - 1)) { statp->options |= RES_NOCHECKNAME; Modified: stable/11/share/man/man5/resolver.5 ============================================================================== --- stable/11/share/man/man5/resolver.5 Fri Nov 2 15:01:59 2018 (r340057) +++ stable/11/share/man/man5/resolver.5 Fri Nov 2 15:02:44 2018 (r340058) @@ -28,7 +28,7 @@ .\" @(#)resolver.5 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd October 12, 2015 +.Dd August 16, 2018 .Dt RESOLVER 5 .Os .Sh NAME @@ -127,6 +127,10 @@ is one of the following: sets .Dv RES_DEBUG in _res.options. +.It Sy usevc +sets +.Dv RES_USEVC +to use TCP instead of UDP for queries. .It Sy ndots: Ns Ar n sets a threshold for the number of dots which must appear in a name given to .Fn res_query From owner-svn-src-stable@freebsd.org Sat Nov 3 20:35:40 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9704310E37CD; Sat, 3 Nov 2018 20:35:40 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4AA7969C36; Sat, 3 Nov 2018 20:35:40 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 278231EB08; Sat, 3 Nov 2018 20:35:40 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA3KZeEu086540; Sat, 3 Nov 2018 20:35:40 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA3KZd4i086539; Sat, 3 Nov 2018 20:35:40 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201811032035.wA3KZd4i086539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 3 Nov 2018 20:35:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r340101 - stable/12/sys/powerpc/powermac X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/powerpc/powermac X-SVN-Commit-Revision: 340101 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Nov 2018 20:35:40 -0000 Author: tuexen Date: Sat Nov 3 20:35:39 2018 New Revision: 340101 URL: https://svnweb.freebsd.org/changeset/base/340101 Log: MFC r339914: Bump the number of fans supported from 8 to 12. The number of fans on a PowerMac7,3 with liquid cooling is 9. Approved by: re (kib@) Reviewed by: andreast@ Differential Revision: https://reviews.freebsd.org/D17754 Modified: stable/12/sys/powerpc/powermac/fcu.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/powerpc/powermac/fcu.c ============================================================================== --- stable/12/sys/powerpc/powermac/fcu.c Sat Nov 3 20:05:50 2018 (r340100) +++ stable/12/sys/powerpc/powermac/fcu.c Sat Nov 3 20:35:39 2018 (r340101) @@ -451,9 +451,9 @@ fcu_fill_fan_prop(device_t dev) { phandle_t child; struct fcu_softc *sc; - u_int id[8]; - char location[96]; - char type[64]; + u_int id[12]; + char location[144]; + char type[96]; int i = 0, j, len = 0, prop_len, prev_len = 0; sc = device_get_softc(dev);