From owner-svn-src-head@freebsd.org Sun Mar 18 03:42:58 2018 Return-Path: Delivered-To: svn-src-head@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 8A8B5F5B500; Sun, 18 Mar 2018 03:42:58 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 3309D7C598; Sun, 18 Mar 2018 03:42:58 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DE731B64A; Sun, 18 Mar 2018 03:42:58 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2I3gwc9075658; Sun, 18 Mar 2018 03:42:58 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2I3gvlQ075656; Sun, 18 Mar 2018 03:42:57 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803180342.w2I3gvlQ075656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 18 Mar 2018 03:42:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331115 - in head: lib/libzstd sys/contrib/zstd/lib/freebsd X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: lib/libzstd sys/contrib/zstd/lib/freebsd X-SVN-Commit-Revision: 331115 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 03:42:58 -0000 Author: cem Date: Sun Mar 18 03:42:57 2018 New Revision: 331115 URL: https://svnweb.freebsd.org/changeset/base/331115 Log: lib(private)zstd: Fix riscv build Link __bswap[ds]i2() intrinsics in to libzstd for riscv, where the C runtime apparently lacks such intrinsics. Broken in r330894. Reported by: asomers Sponsored by: Dell EMC Isilon Modified: head/lib/libzstd/Makefile head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c Modified: head/lib/libzstd/Makefile ============================================================================== --- head/lib/libzstd/Makefile Sun Mar 18 02:59:14 2018 (r331114) +++ head/lib/libzstd/Makefile Sun Mar 18 03:42:57 2018 (r331115) @@ -43,4 +43,11 @@ ZSTDDIR= ${SRCTOP}/sys/contrib/zstd CFLAGS.zstd_compress.c+= -O0 .endif +# Work around lack of __bswap[sd]i2() intrinsics on riscv. Probably should be +# added to one of the runtime C libraries instead. +.if ${MACHINE_CPUARCH} == "riscv" +.PATH: ${ZSTDDIR}/lib/freebsd +SRCS+= zstd_kfreebsd.c +.endif + .include Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c ============================================================================== --- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c Sun Mar 18 02:59:14 2018 (r331114) +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c Sun Mar 18 03:42:57 2018 (r331115) @@ -27,7 +27,12 @@ */ #include "zstd_kfreebsd.h" +#include #include + +#ifndef _KERNEL +#include +#endif /* * The kernel as a standalone target does not link against libgcc or From owner-svn-src-head@freebsd.org Sun Mar 18 14:20:42 2018 Return-Path: Delivered-To: svn-src-head@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 CB47AF57587; Sun, 18 Mar 2018 14:20:41 +0000 (UTC) (envelope-from oshogbo.vx@gmail.com) Received: from mail-lf0-x22f.google.com (mail-lf0-x22f.google.com [IPv6:2a00:1450:4010:c07::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D32773215; Sun, 18 Mar 2018 14:20:41 +0000 (UTC) (envelope-from oshogbo.vx@gmail.com) Received: by mail-lf0-x22f.google.com with SMTP id e5-v6so17680655lfb.7; Sun, 18 Mar 2018 07:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=J51dShppaTHJetKK6xQ5wP33teFQEbNbPnFHUxZsujY=; b=dtM9+5H3W86VyRD/K/TzFQz7ROmzH8QET50Tyfm8dUzhEJCkUahTiTApErS7C8OgJk tm6Db381VuG1bxC+APBcjsO8lHctu4/OiEFLia8SFJhkV6kCpjxCNRBqspWQHoaM/UVk MDszBPwT1ZfolP/kjDX9XTViAl0KWn6NMpDxD+TzuyaO6ofPIIIELD6jqaCDXDIrK4Y5 63CuoBl6sl6NxWimo1aYlrsPm8npNTNOnqukQGnswflf6DD8MDSHklT4xaufHvqd0mq2 /zOYP96Y5DzfCnKyzmjb/TOcS0Hrnm+y8Ds/IGej6c1Zi95xFd+NMHxfVDpqF/JWoStj l9Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=J51dShppaTHJetKK6xQ5wP33teFQEbNbPnFHUxZsujY=; b=P8kSq0fJhLw2t80VmfFZAC32LbppETsGeer3YMo4uCHCM8WFsHQHUAZEhqGFe9xyk9 owMHa+NKQHz7JgqgrvegZ+F8Txs3MIP2APtPzxzwKJnYgtxGClGyrH8oxKSh+9Dgpe2l 3/lUsOOtee5CzHlCJyUtmIW2f5HahtpMqvmIJifG8RIaeUyDtAvq0C9OKYZMHk9FgLFz fuluaa+DHLDlPbxEBH8Wur8WQdUnpId667zGpn00ET4XyvA8Nrg4/wDboqZazZRxJ7Js p3T8mBNommRbhNHl/lSbSKvHrVhVWEG/4Cl7eMCRQJDSJvzptjkPFdYzz39o40fh6fCJ Fogg== X-Gm-Message-State: AElRT7ExKXyodNbafhpyE9vuACWFLanmRgnMp3ywwSUCENKcxWx66XQC ICWF2gV10Jkj5q/BMTpf7eEpsuvX X-Google-Smtp-Source: AG47ELudQnhPyRT80Ri5ckYGd9ox/fHXKYBSIqME5nvTN/cZGitKMtKBqjXbnogGOPhAekrmTaMdiQ== X-Received: by 10.46.146.84 with SMTP id v20mr6030821ljg.128.1521382839745; Sun, 18 Mar 2018 07:20:39 -0700 (PDT) Received: from x-wing (87-206-170-77.dynamic.chello.pl. [87.206.170.77]) by smtp.gmail.com with ESMTPSA id 93-v6sm2898652lfy.5.2018.03.18.07.20.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Mar 2018 07:20:38 -0700 (PDT) Sender: Mariusz Zaborski Date: Sun, 18 Mar 2018 15:20:39 +0100 From: Mariusz Zaborski To: Mark Linimon Cc: Mark Johnston , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r325739 - in head: lib/libcasper/services lib/libcasper/services/cap_syslog share/mk Message-ID: <20180318142039.GA81224@x-wing> References: <201711120834.vAC8YQUq006611@repo.freebsd.org> <20180305161358.GA704@raichu> <20180305171916.GA2359@lonesome.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="liOOAslEiF7prFVr" Content-Disposition: inline In-Reply-To: <20180305171916.GA2359@lonesome.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 14:20:42 -0000 --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 05, 2018 at 11:19:16AM -0600, Mark Linimon wrote: > On Mon, Mar 05, 2018 at 11:13:58AM -0500, Mark Johnston wrote: > > The growing divergence with stable/11 makes it rather painful to > > maintain a port, depending on libcasper, that aims to work on both 11 > > and head. >=20 > Even an MFC won't help you, in the medium-term. >=20 > e.g. via https://www.freebsd.org/security/#sup, even if the MFC made it > into 11.2, you would still have several months of supporting the old > one. (The FreeBSD package builds are based on the oldest supported > point release from a branch.) The current estimate for 11.2 is late June. >=20 > mcl Hi, Sorry for delay I just get back. Yes I can integrate all my changes in libcasper and I guess libcapsicum. I'm did do a lot of integrations to stable so I have one question - if I understand correctly all changes which change API/ABI but are pointed as SHLIB_MAJOR I can safety integrate. Mark what else can I do? Thanks, --=20 Mariusz Zaborski oshogbo//vx | http://oshogbo.vexillium.org FreeBSD commiter | https://freebsd.org Software developer | http://wheelsystems.com If it's not broken, let's fix it till it is!!1 --liOOAslEiF7prFVr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEkD1x0xkJXVVY1Gwf38KEGuLGxWQFAlqudbMACgkQ38KEGuLG xWQXhhAArTM4AppzMSMMFl2laqtWmeeQEXHD2pm82ElVM1KOqFipC1Kek4V7/E2p BR9YmYuCvhLq+CprX+mZBdxCD7IdFZRqj962IF+Gh5e/7fTlXQ6BI2YVTwe0dgJh DU6WawMciGZwgX1ZjmZNWrySh2kLeGgjlUeYqnFI6JClb80Eo+CrMiXgw9WLA6wt 4FZPbRewUwTxz0kWxAEPBZkqsdiwVWrw+SUhdtNaiA3YnUkAT6ZkTzevg7/ZUI30 X6YPJHWF/Js3xlnEoxGS7SYakkNMg7ppqApfmgxXuSrfr1gsGuw1H7lcywFDAdO4 QtkdCOKvs/vQ/SAqUClUIqv73HsXlmS0zY435ye42XfDTMhzQFQk0z0vu+RwkeVp yNU2yeFVNLOSbdE9pVH6VvB9HcH5eXDEOZ5MEdOuCw+jbmQbr/fETI4V+0bUpfzZ 4Mj0FPmFnSZGMORADu8cFdCj/3KCAsk4solaQG6kShQZyxeG+YKRA3uZSjpi+fLY hVWCEdevu92Xo8tknHC9zu6rp094X0uKkadraGCGzr/j7zuJDpxhe7XBEmwmfDTU lEY+IK1WgrRc1lV3z5UYB0Zd8dPEwRn3W5oBA3+M4NgOkaV5ZSS5SCIqP5jmssUs qrq/PH+Q95kBnJheesCE5dIocXiWPOiYDErLeRdCjkVr9GGIWkk= =GbBu -----END PGP SIGNATURE----- --liOOAslEiF7prFVr-- From owner-svn-src-head@freebsd.org Sun Mar 18 15:09:55 2018 Return-Path: Delivered-To: svn-src-head@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 BC15CF5B23A; Sun, 18 Mar 2018 15:09:55 +0000 (UTC) (envelope-from oshogbo@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 71C247562D; Sun, 18 Mar 2018 15:09:55 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6AE252202F; Sun, 18 Mar 2018 15:09:55 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IF9tNN019996; Sun, 18 Mar 2018 15:09:55 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IF9tIv019995; Sun, 18 Mar 2018 15:09:55 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181509.w2IF9tIv019995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 15:09:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331118 - head/sys/geom/label X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sys/geom/label X-SVN-Commit-Revision: 331118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 15:09:55 -0000 Author: oshogbo Date: Sun Mar 18 15:09:55 2018 New Revision: 331118 URL: https://svnweb.freebsd.org/changeset/base/331118 Log: Remove unneeded variable which was introduced in r328472. Pointed out by: pjd@ Modified: head/sys/geom/label/g_label.c Modified: head/sys/geom/label/g_label.c ============================================================================== --- head/sys/geom/label/g_label.c Sun Mar 18 11:26:07 2018 (r331117) +++ head/sys/geom/label/g_label.c Sun Mar 18 15:09:55 2018 (r331118) @@ -200,7 +200,6 @@ g_label_create(struct gctl_req *req, struct g_class *m struct g_provider *pp2; struct g_consumer *cp; char name[64]; - int n; g_topology_assert(); @@ -214,8 +213,7 @@ g_label_create(struct gctl_req *req, struct g_class *m } gp = NULL; cp = NULL; - n = snprintf(name, sizeof(name), "%s/%s", dir, label); - if (n >= sizeof(name)) { + if (snprintf(name, sizeof(name), "%s/%s", dir, label) >= sizeof(name)) { if (req != NULL) gctl_error(req, "Label name %s is too long.", label); return (NULL); From owner-svn-src-head@freebsd.org Sun Mar 18 15:13:38 2018 Return-Path: Delivered-To: svn-src-head@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 39F78F5B888; Sun, 18 Mar 2018 15:13:38 +0000 (UTC) (envelope-from oshogbo@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 BB53275C7D; Sun, 18 Mar 2018 15:13:37 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B08EF221AA; Sun, 18 Mar 2018 15:13:37 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IFDb39024928; Sun, 18 Mar 2018 15:13:37 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IFDbUM024926; Sun, 18 Mar 2018 15:13:37 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181513.w2IFDbUM024926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 15:13:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331119 - head/lib/libcasper/services/cap_pwd X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_pwd X-SVN-Commit-Revision: 331119 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 15:13:38 -0000 Author: oshogbo Date: Sun Mar 18 15:13:37 2018 New Revision: 331119 URL: https://svnweb.freebsd.org/changeset/base/331119 Log: Document the pwd Casper service. PR: 226102 Reviewed by: bcr@ Differential Revision: https://reviews.freebsd.org/D14605 Added: head/lib/libcasper/services/cap_pwd/cap_pwd.3 (contents, props changed) Modified: head/lib/libcasper/services/cap_pwd/Makefile Modified: head/lib/libcasper/services/cap_pwd/Makefile ============================================================================== --- head/lib/libcasper/services/cap_pwd/Makefile Sun Mar 18 15:09:55 2018 (r331118) +++ head/lib/libcasper/services/cap_pwd/Makefile Sun Mar 18 15:13:37 2018 (r331119) @@ -24,4 +24,20 @@ CFLAGS+=-I${.CURDIR} HAS_TESTS= SUBDIR.${MK_TESTS}+= tests +MAN+= cap_pwd.3 + +MLINKS+=cap_pwd.3 libcap_pwd.3 +MLINKS+=cap_pwd.3 cap_getpwent.3 +MLINKS+=cap_pwd.3 cap_getpwnam.3 +MLINKS+=cap_pwd.3 cap_getpwuid.3 +MLINKS+=cap_pwd.3 cap_getpwent_r.3 +MLINKS+=cap_pwd.3 cap_getpwnam_r.3 +MLINKS+=cap_pwd.3 cap_getpwuid_r.3 +MLINKS+=cap_pwd.3 cap_setpassent.3 +MLINKS+=cap_pwd.3 cap_setpwent.3 +MLINKS+=cap_pwd.3 cap_endpwent.3 +MLINKS+=cap_pwd.3 cap_pwd_limit_cmds.3 +MLINKS+=cap_pwd.3 cap_pwd_limit_fields.3 +MLINKS+=cap_pwd.3 cap_pwd_limit_users.3 + .include Added: head/lib/libcasper/services/cap_pwd/cap_pwd.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcasper/services/cap_pwd/cap_pwd.3 Sun Mar 18 15:13:37 2018 (r331119) @@ -0,0 +1,234 @@ +.\" Copyright (c) 2018 Mariusz Zaborski +.\" 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 AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd March 18, 2018 +.Dt CAP_PWD 3 +.Os +.Sh NAME +.Nm cap_getpwent , +.Nm cap_getpwnam , +.Nm cap_getpwuid , +.Nm cap_getpwent_r , +.Nm cap_getpwnam_r , +.Nm cap_getpwuid_r , +.Nm cap_setpassent , +.Nm cap_setpwent , +.Nm cap_endpwent , +.Nm cap_pwd_limit_cmds , +.Nm cap_pwd_limit_fields , +.Nm cap_pwd_limit_users +.Nd "library for password database operations in capability mode" +.Sh LIBRARY +.Lb libcap_grp +.Sh SYNOPSIS +.In libcasper.h +.In casper/cap_pwd.h +.Ft struct passwd * +.Fn cap_getpwent "cap_channel_t *chan" +.Ft struct passwd * +.Fn cap_getpwnam "cap_channel_t *chan" "const char *login" +.Ft struct passwd * +.Fn cap_getpwuid "cap_channel_t *chan" "uid_t uid" +.Ft int +.Fn cap_getpwent_r "cap_channel_t *chan" "struct passwd *pwd" "char *buffer" "size_t bufsize" "struct passwd **result" +.Ft int +.Fn cap_getpwnam_r "cap_channel_t *chan" "const char *name" "struct passwd *pwd" "char *buffer" "size_t bufsize" "struct passwd **result" +.Ft int +.Fn cap_getpwuid_r "cap_channel_t *chan" "uid_t uid" "struct passwd *pwd" "char *buffer" "size_t bufsize" "struct passwd **result" +.Ft int +.Fn cap_setpassent "cap_channel_t *chan" "int stayopen" +.Ft void +.Fn cap_setpwent "cap_channel_t *chan" +.Ft void +.Fn cap_endpwent "cap_channel_t *chan" +.Ft int +.Fn cap_pwd_limit_cmds "cap_channel_t *chan" "const char * const *cmds" "size_t ncmds" +.Ft int +.Fn cap_pwd_limit_fields "cap_channel_t *chan" "const char * const *fields" "size_t nfields" +.Ft int +.Fn cap_pwd_limit_users "cap_channel_t *chan" "const char * const *names" "size_t nnames" "uid_t *uids" "size_t nuids" +.Sh DESCRIPTION +The functions +.Fn cap_getpwent , +.Fn cap_getpwnam , +.Fn cap_getpwuid , +.Fn cap_getpwent_r , +.Fn cap_getpwnam_r , +.Fn cap_getpwuid_r , +.Fn cap_setpassent , +.Fn cap_setpwent , +and +.Fn cap_endpwent +are respectively equivalent to +.Xr getpwent 3 , +.Xr getpwnam 3 , +.Xr getpwuid 3 , +.Xr getpwent_r 3 , +.Xr getpwnam_r 3 , +.Xr getpwuid_r 3 , +.Xr setpassent 3 , +.Xr setpwent 3 , +and +.Xr cap_endpwent 3 +except that the connection to the +.Nm system.pwd +service needs to be provided. +.Pp +The +.Fn cap_pwd_limit_cmds +function limits the functions allowed in the service. +The +.Fa cmds +variable can be set to +.Dv getpwent , +.Dv getpwnam , +.Dv getpwuid , +.Dv getpwent_r , +.Dv getpwnam_r , +.Dv getpwuid_r , +.Dv setpassent , +.Dv setpwent , +or +.Dv endpwent +which will allow to use the function associated with the name. +The +.Fa ncmds +variable contains the number of +.Fa cmds +provided. +.Pp +The +.Fn cap_pwd_limit_fields +function allows limit fields returned in the structure +.Vt passwd . +The +.Fa fields +variable can be set to +.Dv pw_name , +.Dv pw_passwd , +.Dv pw_uid , +.Dv pw_gid , +.Dv pw_change , +.Dv pw_class , +.Dv pw_gecos , +.Dv pw_dir , +.Dv pw_shell , +.Dv pw_expire +or +.Dv pw_fields +The field which was set as the limit will be returned, while the rest of the +values not set this way will have default values. +The +.Fa nfields +variable contains the number of +.Fa fields +provided. +.Pp +The +.Fn cap_pwd_limit_users +function allows to limit access to users. +The +.Fa names +variable allows to limit users by name and the +.Fa uids +variable by the user number. +The +.Fa nnames +and +.Fa nuids +variables provide numbers of limited names and uids. +.Sh EXAMPLES +The following example first opens a capability to casper and then uses this +capability to create the +.Nm system.pwd +casper service and uses it to get a user name. +.Bd -literal +cap_channel_t *capcas, *cappwd; +const char *cmds[] = { "getpwuid" }; +const char *fields[] = { "pw_name" }; +uid_t uid[] = { 1 }; +struct passwd *passwd; + +/* Open capability to Casper. */ +capcas = cap_init(); +if (capcas == NULL) + err(1, "Unable to contact Casper"); + +/* Enter capability mode sandbox. */ +if (cap_enter() < 0 && errno != ENOSYS) + err(1, "Unable to enter capability mode"); + +/* Use Casper capability to create capability to the system.pwd service. */ +cappwd = cap_service_open(capcas, "system.pwd"); +if (cappwd == NULL) + err(1, "Unable to open system.pwd service"); + +/* Close Casper capability, we don't need it anymore. */ +cap_close(capcas); + +/* Limit service to one single function. */ +if (cap_pwd_limit_cmds(cappwd, cmds, nitems(cmds))) + err(1, "Unable to limit access to system.pwd service"); + +/* Limit service to one field as we only need name of the user. */ +if (cap_pwd_limit_fields(cappwd, fields, nitems(fields))) + err(1, "Unable to limit access to system.pwd service"); + +/* Limit service to one uid. */ +if (cap_pwd_limit_users(cappwd, NULL, 0, uid, nitems(uid))) + err(1, "Unable to limit access to system.pwd service"); + +passwd = cap_getpwuid(cappwd, uid[0]); +if (passwd == NULL) + err(1, "Unable to get name of user"); + +printf("UID %d is associated with name %s.\\n", uid[0], passwd->pw_name); + +cap_close(cappwd); +.Ed +.Sh SEE ALSO +.Xr cap_enter 2 , +.Xr endpwent 3 , +.Xr err 3 , +.Xr getpwent 3 , +.Xr getpwent_r 3 , +.Xr getpwnam 3 , +.Xr getpwnam_r 3 , +.Xr getpwuid 3 , +.Xr getpwuid_r 3 , +.Xr setpassent 3 , +.Xr setpwent 3 , +.Xr capsicum 4, +.Xr nv 9 +.Sh AUTHORS +The +.Nm cap_pwd +service was implemented by +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net +under sponsorship from the FreeBSD Foundation. +.Pp +This manual page was written by +.An Mariusz Zaborski Aq Mt oshogbo@FreeBSD.org . From owner-svn-src-head@freebsd.org Sun Mar 18 15:16:48 2018 Return-Path: Delivered-To: svn-src-head@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 0B50CF5BC93; Sun, 18 Mar 2018 15:16:48 +0000 (UTC) (envelope-from oshogbo@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 AE99975F2C; Sun, 18 Mar 2018 15:16:47 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 A95AF221BF; Sun, 18 Mar 2018 15:16:47 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IFGlxf025124; Sun, 18 Mar 2018 15:16:47 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IFGlIZ025122; Sun, 18 Mar 2018 15:16:47 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181516.w2IFGlIZ025122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 15:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331120 - head/lib/libcasper/services/cap_sysctl X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_sysctl X-SVN-Commit-Revision: 331120 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 15:16:48 -0000 Author: oshogbo Date: Sun Mar 18 15:16:47 2018 New Revision: 331120 URL: https://svnweb.freebsd.org/changeset/base/331120 Log: Document the sysctl Casper service. PR: 226102 Reviewed by: bcr@ Differential Revision: https://reviews.freebsd.org/D14606 Added: head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 (contents, props changed) Modified: head/lib/libcasper/services/cap_sysctl/Makefile Modified: head/lib/libcasper/services/cap_sysctl/Makefile ============================================================================== --- head/lib/libcasper/services/cap_sysctl/Makefile Sun Mar 18 15:13:37 2018 (r331119) +++ head/lib/libcasper/services/cap_sysctl/Makefile Sun Mar 18 15:16:47 2018 (r331120) @@ -24,4 +24,9 @@ CFLAGS+=-I${.CURDIR} HAS_TESTS= SUBDIR.${MK_TESTS}+= tests +MAN+= cap_sysctl + +MLINKS+=cap_sysctl.3 libcap_sysctl.3 +MLINKS+=cap_sysctl.3 cap_sysctlbyname.3 + .include Added: head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 Sun Mar 18 15:16:47 2018 (r331120) @@ -0,0 +1,143 @@ +.\" Copyright (c) 2018 Mariusz Zaborski +.\" 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 AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd March 18, 2018 +.Dt CAP_SYSCTL 3 +.Os +.Sh NAME +.Nm cap_sysctlbyname +.Nd "library for getting or setting system information in capability mode" +.Sh LIBRARY +.Lb libcap_sysctl +.Sh SYNOPSIS +.In sys/nv.h +.In libcasper.h +.In casper/cap_sysctl.h +.Ft int +.Fn cap_sysctlbyname "cap_channel_t *chan" " const char *name" " void *oldp" " size_t *oldlenp" " const void *newp" " size_t newlen" +.Sh DESCRIPTION +The function +.Fn cap_sysctlbyname +is equivalent to +.Xr sysctlbyname 3 +except that the connection to the +.Nm system.sysctl +service needs to be provided. +.Sh LIMITS +The service can be limited using +.Xr cap_limit_set 3 +function. +The +.Xr nvlist 9 +for that function can contain the following values and types: +.Bl -ohang -offset indent +.It ( NV_TYPE_NUMBER ) +The name of the element with type number will be treated as the limited sysctl. +The value of the element will describe the access rights for given sysctl. +There are four different rights +.Dv CAP_SYSCTL_READ , +.Dv CAP_SYSCTL_WRITE , +.Dv CAP_SYSCTL_RDWR , +and +.Dv CAP_SYSCTL_RECURSIVE . +The +.Dv CAP_SYSCTL_READ +flag allows to fetch the value of a given sysctl. +The +.Dv CAP_SYSCTL_WIRTE +flag allows to override the value of a given sysctl. +The +.Dv CAP_SYSCTL_RDWR +is combination of the +.Dv CAP_SYSCTL_WIRTE +and +.Dv CAP_SYSCTL_READ +and allows to read and write the value of a given sysctl. +The +.Dv CAP_SYSCTL_RECURSIVE +allows access to all children of a given sysctl. +This right must be combined with at least one other right. +.Sh EXAMPLES +The following example first opens a capability to casper and then uses this +capability to create the +.Nm system.sysctl +casper service and uses it to get the value of +.Dv kern.trap_enotcap . +.Bd -literal +cap_channel_t *capcas, *capsysctl; +const char *name = "kern.trap_enotcap"; +nvlist_t *limits; +int value; +size_t size; + +/* Open capability to Casper. */ +capcas = cap_init(); +if (capcas == NULL) + err(1, "Unable to contact Casper"); + +/* Enter capability mode sandbox. */ +if (cap_enter() < 0 && errno != ENOSYS) + err(1, "Unable to enter capability mode"); + +/* Use Casper capability to create capability to the system.sysctl service. */ +capsysctl = cap_service_open(capcas, "system.sysctl"); +if (capsysctl == NULL) + err(1, "Unable to open system.sysctl service"); + +/* Close Casper capability, we don't need it anymore. */ +cap_close(capcas); + +/* Create limit for one MIB with read access only. */ +limits = nvlist_create(0); +nvlist_add_number(limits, name, CAP_SYSCTL_READ); + +/* Limit system.sysctl. */ +if (cap_limit_set(capsysctl, limits) < 0) + err(1, "Unable to set limits"); + +/* Fetch value. */ +if (cap_sysctlbyname(capsysctl, name, &value, &size, NULL, 0) < 0) + err(1, "Unable to get value of sysctl"); + +printf("The value of %s is %d.\\n", name, value); + +cap_close(capsysctl); +.Ed +.Sh SEE ALSO +.Xr cap_enter 2 , +.Xr err 3 , +.Xr sysctlbyname 3, +.Xr capsicum 4 , +.Xr nv 9 +.Sh AUTHORS +The +.Nm cap_sysctl +service was implemented by +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net +under sponsorship from the FreeBSD Foundation. +.Pp +This manual page was written by +.An Mariusz Zaborski Aq Mt oshogbo@FreeBSD.org . From owner-svn-src-head@freebsd.org Sun Mar 18 15:24:46 2018 Return-Path: Delivered-To: svn-src-head@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 77438F5C699; Sun, 18 Mar 2018 15:24:46 +0000 (UTC) (envelope-from oshogbo@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 18A17766B4; Sun, 18 Mar 2018 15:24:46 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 EE18822365; Sun, 18 Mar 2018 15:24:45 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IFOjBk030379; Sun, 18 Mar 2018 15:24:45 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IFOj9O030378; Sun, 18 Mar 2018 15:24:45 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181524.w2IFOj9O030378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 15:24:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331121 - head/lib/libcasper/libcasper X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/libcasper X-SVN-Commit-Revision: 331121 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 15:24:46 -0000 Author: oshogbo Date: Sun Mar 18 15:24:45 2018 New Revision: 331121 URL: https://svnweb.freebsd.org/changeset/base/331121 Log: Update libcasper references to all new man pages. Remove obsolete example. All services has they own example. This example also show old type of limiting method which is not recommended to use. Reviewed by: bcr@ Differential Revision: https://reviews.freebsd.org/D14607 Modified: head/lib/libcasper/libcasper/libcasper.3 Modified: head/lib/libcasper/libcasper/libcasper.3 ============================================================================== --- head/lib/libcasper/libcasper/libcasper.3 Sun Mar 18 15:16:47 2018 (r331120) +++ head/lib/libcasper/libcasper/libcasper.3 Sun Mar 18 15:24:45 2018 (r331121) @@ -1,4 +1,5 @@ .\" Copyright (c) 2013 The FreeBSD Foundation +.\" Copyright (c) 2018 Mariusz Zaborski .\" All rights reserved. .\" .\" This documentation was written by Pawel Jakub Dawidek under sponsorship @@ -27,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2018 +.Dd March 6, 2018 .Dt LIBCASPER 3 .Os .Sh NAME @@ -252,63 +253,18 @@ The and .Fn cap_unwrap functions always succeed. -.Sh EXAMPLES -The following example first opens capability to the casper then using this -capability creates new capability to the -.Nm system.dns -casper service and uses the latter capability to resolve IP address. -.Bd -literal -cap_channel_t *capcas, *capdns; -nvlist_t *limits; -const char *ipstr = "127.0.0.1"; -struct in_addr ip; -struct hostent *hp; - -/* Open capability to the Casper. */ -capcas = cap_init(); -if (capcas == NULL) - err(1, "Unable to contact Casper"); - -/* Enter capability mode sandbox. */ -if (cap_enter() < 0 && errno != ENOSYS) - err(1, "Unable to enter capability mode"); - -/* Use Casper capability to create capability to the system.dns service. */ -capdns = cap_service_open(capcas, "system.dns"); -if (capdns == NULL) - err(1, "Unable to open system.dns service"); - -/* Close Casper capability, we don't need it anymore. */ -cap_close(capcas); - -/* Limit system.dns to reverse DNS lookups and IPv4 addresses. */ -limits = nvlist_create(0); -nvlist_add_string(limits, "type", "ADDR"); -nvlist_add_number(limits, "family", (uint64_t)AF_INET); -if (cap_limit_set(capdns, limits) < 0) - err(1, "Unable to limit access to the system.dns service"); - -/* Convert IP address in C-string to in_addr. */ -if (!inet_aton(ipstr, &ip)) - errx(1, "Unable to parse IP address %s.", ipstr); - -/* Find hostname for the given IP address. */ -hp = cap_gethostbyaddr(capdns, (const void *)&ip, sizeof(ip), AF_INET); -if (hp == NULL) - errx(1, "No name associated with %s.", ipstr); - -printf("Name associated with %s is %s.\\n", ipstr, hp->h_name); -.Ed .Sh SEE ALSO -.Xr cap_enter 2 , +.Xr errno 2 , .Xr execve 2 , .Xr kevent 2 , .Xr poll 2 , .Xr select 2 , -.Xr cap_gethostbyaddr 3 , -.Xr err 3 , -.Xr gethostbyaddr 3 , -.Xr inet_aton 3 , +.Xr cap_dns 3 , +.Xr cap_grp 3 , +.Xr cap_pwd 3 , +.Xr cap_ranodm 3 , +.Xr cap_sysctl 3 , +.Xr cap_syslog 3 , .Xr capsicum 4 , .Xr unix 4 , .Xr nv 9 From owner-svn-src-head@freebsd.org Sun Mar 18 15:44:08 2018 Return-Path: Delivered-To: svn-src-head@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 21E5EF5DDC4; Sun, 18 Mar 2018 15:44:08 +0000 (UTC) (envelope-from trasz@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 CBF51777F2; Sun, 18 Mar 2018 15:44:07 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6BCF22684; Sun, 18 Mar 2018 15:44:07 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IFi7u2040684; Sun, 18 Mar 2018 15:44:07 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IFi773040683; Sun, 18 Mar 2018 15:44:07 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201803181544.w2IFi773040683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 18 Mar 2018 15:44:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331122 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 331122 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 15:44:08 -0000 Author: trasz Date: Sun Mar 18 15:44:07 2018 New Revision: 331122 URL: https://svnweb.freebsd.org/changeset/base/331122 Log: Here's the new development(7), which removes information that's no longer relevant (read: most of what was there) and adds some quick links to point newcomers in the right direction. Reviewed by: imp@ MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D14680 Modified: head/share/man/man7/development.7 Modified: head/share/man/man7/development.7 ============================================================================== --- head/share/man/man7/development.7 Sun Mar 18 15:24:45 2018 (r331121) +++ head/share/man/man7/development.7 Sun Mar 18 15:44:07 2018 (r331122) @@ -1,4 +1,5 @@ -.\" Copyright (C) 1998 Matthew Dillon. All rights reserved. +.\" Copyright (c) 2018 Edward Tomasz Napierala +.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -9,10 +10,10 @@ .\" 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -23,446 +24,91 @@ .\" .\" $FreeBSD$ .\" -.Dd March 7, 2013 +.Dd March 13, 2018 .Dt DEVELOPMENT 7 .Os .Sh NAME .Nm development -.Nd "introduction to development with the FreeBSD codebase" +.Nd introduction to FreeBSD development process .Sh DESCRIPTION -This manual page describes how an ordinary system operator, -.Ux -administrator, or developer -can, without any special permission, obtain, maintain, and modify the .Fx -codebase as well as how to maintain a master build which can -then be exported to other machines in your network. -This manual page -is targeted to system operators, programmers, and developers. +development is split into three major suprojects: doc, ports, and src. +Doc is the documentation, such as the FreeBSD Handbook. +To read more, see: .Pp -Please note that what is being described here is based on a complete -.Fx -environment, not just the -.Fx -kernel. -The methods described -here are as applicable to production installations as it is to development -environments. -.Sh SETTING UP THE ENVIRONMENT ON THE MASTER SERVER -Your master server should always run a stable, production version of the -.Fx -operating system. -This does not prevent you from doing -CURRENT -builds or development. -The last thing you want to do is to run an -unstable environment on your master server which could lead to a situation -where you lose the environment and/or cannot recover from a mistake. +.Lk https://www.FreeBSD.org/doc/en/books/fdp-primer/ .Pp -Create a partition called -.Pa /FreeBSD . -Approximately 20GB is recommended. -This partition will contain nearly all the development environment, -including the subversion tree, broken-out source, and possibly even object files. -You are going to export this partition to your other machines via a -READ-ONLY NFS export so do not mix it with other more security-sensitive -partitions. +Ports, described further in +.Xr ports 7 , +are the way to build, package, and install third party software. +To read more, see: .Pp -You have to make a choice in regards to -.Pa /usr/obj . -You can put -.Pa /usr/obj -in -.Pa /FreeBSD -or you can make -.Pa /usr/obj -its own partition. -I recommend making it a separate partition for several reasons. -First, -as a safety measure since this partition is written to a great deal. -Second, because you typically do not have to back it up. -Third, because it makes it far easier to mix and match the development -environments which are described later in this document. -I recommend a -.Pa /usr/obj -partition of at least 12GB. +.Lk https://www.FreeBSD.org/doc/en/books/porters-handbook/ .Pp -On the master server, use -.Xr svn 1 -to pull down and maintain -the -.Fx -source. -The first pull will take a long time, -it is several gigabytes, but once you have it, -the updates will be quite small. -Run all -.Xr svn 1 -operations as -.Dq Li root +The last one, src, revolves around the source code for the base system, +consisting of the kernel, and the libraries and utilities commonly called +the world. .Pp -Keeping the broken-out source and ports in -.Pa /FreeBSD -allows you to export -it to other machines via read-only NFS. -This also means you only need to edit/maintain files in one place and all -your clients automatically pick up the changes. -.Bd -literal -offset 4n -mkdir /FreeBSD -cd /FreeBSD -svn co https://svn.freebsd.org/ports/head ports -svn co https://svn.freebsd.org/doc/head doc -svn co https://svn.freebsd.org/base/head src -cd /usr -rm -rf src -ln -s /FreeBSD/src src -.Ed +The Committer's Guide, describing topics relevant to all committers, +can be found at: .Pp -Note that exporting -.Pa /usr/obj -via read-only NFS to your other boxes will -allow you to build on your main server and install from your other boxes. -If you also want to do builds on some or all of the clients you can simply -have -.Pa /usr/obj -be a local directory on those clients. -You should never export -.Pa /usr/obj -read-write, it will lead to all sorts of -problems and issues down the line and presents a security problem as well. -It is far easier to do builds on the master server and then only do installs -on the clients. +.Lk https://www.FreeBSD.org/doc/en/articles/committers-guide/ .Pp -I usually maintain my ports tree via svn or portsnap. -With some fancy softlinks you can make the ports tree available both on your -master server and on all of your other machines. -Note that the ports tree exists only on the HEAD ports branch, so its always -usable even on a -STABLE box. -This is what you do: -.Bd -literal -offset 4n -(THESE COMMANDS ON THE MASTER SERVER AND ON ALL CLIENTS) -cd /usr -rm -rf ports -ln -s /FreeBSD/ports ports - -cd /usr/ports (this pushes into the softlink) -rm -rf distfiles (ON MASTER SERVER ONLY) -ln -s /usr/ports.distfiles distfiles (ON MASTER SERVER ONLY) - -mkdir /usr/ports.distfiles -mkdir /usr/ports.workdir -.Ed +FreeBSD src development takes place in the CURRENT branch in Subversion, +located at: .Pp -Since -.Pa /usr/ports -is softlinked into what will be read-only on all of your -clients, you have to tell the ports system to use a different working -directory to hold ports builds. -You want to add a line to your -.Xr make.conf 5 -file on the master server -and on all your clients: -.Bd -literal -offset 4n -WRKDIRPREFIX=/usr/ports.workdir -.Ed +.Lk http://svn.FreeBSD.org/base/head .Pp -You should try to make the directory you use for the ports working directory -as well as the directory used to hold distfiles consistent across all of your -machines. -If there is not enough room in -.Pa /usr/ports.distfiles -and -.Pa /usr/ports.workdir -I usually make those softlinks (since this is on -.Pa /usr -these are per-machine) to -where the distfiles and working space really are. -.Sh EXPORTING VIA NFS FROM THE MASTER SERVER -The master server needs to export -.Pa /FreeBSD -and -.Pa /usr/obj -via NFS so all the -rest of your machines can get at them. -I strongly recommend using a read-only export for both security and safety. -The environment I am describing in this manual page is designed primarily -around read-only NFS exports. -Your exports file on the master server should contain the following lines: -.Bd -literal -offset 4n -/FreeBSD -ro -alldirs -maproot=root: -network YOURLAN -mask YOURLANMASK -/usr/obj -ro -alldirs -maproot=root: -network YOURLAN -mask YOURLANMASK -.Ed +There is also a read-only GitHub mirror at: .Pp -Of course, NFS server operations must also be configured on that machine. -This is typically done via your -.Pa /etc/rc.conf : -.Bd -literal -offset 4n -nfs_server_enable="YES" -nfs_server_flags="-u -t -n 4" -.Ed -.Sh THE CLIENT ENVIRONMENT -All of your client machines can import the development/build environment -directory simply by NFS mounting -.Pa /FreeBSD -and -.Pa /usr/obj -from the master server. -A typical -.Pa /etc/fstab -entry on your client machines will be something like this: -.Bd -literal -offset 4n -masterserver:/FreeBSD /FreeBSD nfs ro,bg 0 0 -masterserver:/usr/obj /usr/obj nfs ro,bg 0 0 -.Ed +.Lk https://github.com/freebsd/freebsd .Pp -And, of course, you should configure the client for NFS client operations -via -.Pa /etc/rc.conf . -In particular, this will turn on -.Xr nfsiod 8 -which will improve client-side NFS -performance: -.Bd -literal -offset 4n -nfs_client_enable="YES" -.Ed +Changes are first committed to CURRENT and then usually merged back +to STABLE. +Every few years the CURRENT branch is renamed to STABLE, and a new +CURRENT is branched, with an incremented major version number. +Releases are then branched off STABLE and numbered with consecutive minor numbers. .Pp -Each client should create softlinks for -.Pa /usr/ports +Layout of the source tree is described in +.Xr hier 7 . +Build Instructions can be found in +.Xr build 7 and -.Pa /usr/src -that point -into the NFS-mounted environment. -If a particular client is running -CURRENT, -.Pa /usr/src -should be a softlink to -.Pa /FreeBSD/src . -If it is running -STABLE, -.Pa /usr/src -should be a softlink to -.Pa /FreeBSD/FreeBSD-4.x/src . -I do not usually create a -.Pa /usr/src2 -softlink on -clients, that is used as a convenient shortcut when working on the source -code on the master server only and could create massive confusion (of the -human variety) on a client. -.Bd -literal -offset 4n -(ON EACH CLIENT) -cd /usr -rm -rf ports src -ln -s /FreeBSD/ports ports -ln -s /FreeBSD/src src -.Ed +.Xr release 7 . +For coding conventions, see +.Xr style 9 . .Pp -Do not forget to create the working directories so you can build ports, as -previously described. -If these are not good locations, make them softlinks to the correct location. -Remember that -.Pa /usr/ports/distfiles -is exported by -the master server and is therefore going to point to the same place -(typically -.Pa /usr/ports.distfiles ) -on every machine. -.Bd -literal -offset 4n -mkdir /usr/ports.distfiles -mkdir /usr/ports.workdir -.Ed -.Sh BUILDING KERNELS -Here is how you build a -STABLE kernel (on your main development box). -If you want to create a custom kernel, copy -.Pa GENERIC -to -.Pa KERNELNAME -and then edit it before configuring and building. -The kernel configuration file lives in -.Pa /usr/src/sys/i386/conf/KERNELNAME . -.Bd -literal -offset 4n -cd /usr/src -make buildkernel KERNCONF=KERNELNAME -.Ed +To ask questions regarding development, use the mailing lists, +such as freebsd-arch@ and freebsd-hackers@: .Pp -.Sy WARNING! -If you are familiar with the old config/cd/make method of building -a -STABLE kernel, note that the -.Xr config 8 -method will put the build environment in -.Pa /usr/src/sys/i386/compile/KERNELNAME -instead of in -.Pa /usr/obj . +.Lk https://lists.FreeBSD.org/ .Pp -Building a -CURRENT kernel -.Bd -literal -offset 4n -cd /usr/src2 (on the master server) -make buildkernel KERNCONF=KERNELNAME -.Ed -.Sh INSTALLING KERNELS -Installing a -STABLE kernel (typically done on a client, -only do this on your main development server if you want to install a new -kernel for your main development server): -.Bd -literal -offset 4n -cd /usr/src -make installkernel KERNCONF=KERNELNAME -.Ed +To get your patches integrated into the main freebsd repository use Phabricator; +it is a code review tool that allows other developers to review the changes, +suggest improvements, and, eventually, allows them to pick up the change and +commit it: .Pp -If you are using the older config/cd/make build mechanism for -STABLE, you -would install using: -.Bd -literal -offset 4n -cd /usr/src/sys/i386/compile/KERNELNAME -make install -.Ed +.Lk https://reviews.FreeBSD.org .Pp -Installing a -CURRENT kernel (typically done only on a client) -.Bd -literal -offset 4n -(remember /usr/src is pointing to the client's specific environment) -cd /usr/src -make installkernel KERNCONF=KERNELNAME -.Ed -.Sh BUILDING THE WORLD -This environment is designed such that you do all builds on the master server, -and then install from each client. -You can do builds on a client only if -.Pa /usr/obj -is local to that client. -Building the world is easy: -.Bd -literal -offset 4n -cd /usr/src -make buildworld -.Ed +.Sh EXAMPLES +Check out the CURRENT branch, build it, and install, overwriting the current +system: +.Dl svnlite co https://svn.FreeBSD.org/base/head src +.Dl cd src +.Dl make -j8 buildworld buildkernel installkernel +.Dl reboot .Pp -If you are on the master server you are running in a -STABLE environment, but -that does not prevent you from building the -CURRENT world. -Just -.Xr cd 1 -into the appropriate source directory and you are set. -Do not -accidentally install it on your master server though! -.Bd -literal -offset 4n -cd /usr/src2 -make buildworld -.Ed -.Sh INSTALLING THE WORLD -You can build on your main development server and install on clients. -The main development server must export -.Pa /FreeBSD -and -.Pa /usr/obj -via read-only NFS to the clients. +After reboot: +.Dl cd src +.Dl make -j8 installworld .Pp -.Em NOTE!!! -If -.Pa /usr/obj -is a softlink on the master server, it must also be the EXACT -SAME softlink on each client. -If -.Pa /usr/obj -is a directory in -.Pa /usr -or a mount point on the master server, -then it must be (interchangeably) a directory in -.Pa /usr -or a mount point on -each client. -This is because the -absolute paths are expected to be the same when building the world as when -installing it, and you generally build it on your main development box -and install it from a client. -If you do not set up -.Pa /usr/obj -properly you will not be able to build on -machine and install on another. -.Bd -literal -offset 4n -(ON THE CLIENT) -(remember /usr/src is pointing to the client's specific environment) -cd /usr/src -make installworld -.Ed -.Pp -.Sy WARNING! -If builds work on the master server but installs do not work from the -clients, for example you try to install and the client complains that -the install tried to write into the read-only -.Pa /usr/obj , -then it is likely -that the -.Xr make.conf 5 -file on the client does not match the one on the -master server closely enough and the install is trying to install something -that was not built. -.Sh DOING DEVELOPMENT ON A CLIENT (NOT JUST INSTALLING) -Developers often want to run buildkernel's or buildworld's on client -boxes simply to life-test the box. -You do this in the same manner that you buildkernel and buildworld on your -master server. -All you have to do is make sure that -.Pa /usr/obj -is pointing to local storage. -If you followed my advise and made -.Pa /usr/obj -its own partition on the master -server, -then it is typically going to be an NFS mount on the client. -Simply unmounting -.Pa /usr/obj -will leave you with a -.Pa /usr/obj -that is a -subdirectory in -.Pa /usr -which is typically local to the client. -You can then do builds to your heart's content! -.Sh MAINTAINING A LOCAL BRANCH -There is absolutely nothing preventing you -from breaking out other versions of the source tree -into -.Pa /FreeBSD/XXX . -In fact, my -.Pa /FreeBSD -partition also contains -.Ox , -.Nx , -and various flavors of -.Tn Linux . -You may not necessarily be able to build -.Pf non- Fx -operating systems on -your master server, but being able -to collect and manage source distributions from a central server is a very -useful thing to be able to do and you can certainly export to machines -which can build those other operating systems. -.Pp -Many developers choose to maintain a local branch of -.Fx -to test patches or build a custom distribution. -This can be done with svn or another source code management system -(git, mercurial, Perforce, BitKeeper) with its own repository. -.Sh "UPDATING VIA SVN" -By using a -.Xr cron 8 -job to maintain an updated svn repository, -the source tree can be -updated at any time as follows: -.Bd -literal -offset 4n -(on the main development server) -cd /usr -svn update src doc ports -.Ed -.Pp -It is that simple, and since you are exporting the whole lot to your -clients, your clients have immediate visibility into the updated -source. -This is a good time to also remind you that most of the -.Xr svn 1 -operations you do will be done as -.Dq Li root . .Sh SEE ALSO -.Xr crontab 1 , -.Xr crontab 5 , -.Xr make.conf 5 , +.Xr witness 4 , .Xr build 7 , -.Xr firewall 7 , +.Xr hier 7 , .Xr release 7 , -.Xr tuning 7 , -.Xr diskless 8 +.Xr locking 9 , +.Xr style 9 .Sh HISTORY The .Nm @@ -478,3 +124,7 @@ to reflect the repository conversion from .Xr cvs 1 to .Xr svn 1 . +It was rewritten from scratch by +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org +for +.Fx 12.0 . From owner-svn-src-head@freebsd.org Sun Mar 18 15:56:10 2018 Return-Path: Delivered-To: svn-src-head@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 C5B93F5E938; Sun, 18 Mar 2018 15:56:10 +0000 (UTC) (envelope-from ian@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 7944A77F54; Sun, 18 Mar 2018 15:56:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 7413622820; Sun, 18 Mar 2018 15:56:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IFuAXb046017; Sun, 18 Mar 2018 15:56:10 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IFuA9d046016; Sun, 18 Mar 2018 15:56:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181556.w2IFuA9d046016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 15:56:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331123 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331123 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 15:56:10 -0000 Author: ian Date: Sun Mar 18 15:56:10 2018 New Revision: 331123 URL: https://svnweb.freebsd.org/changeset/base/331123 Log: Do not overwrite the contents of BIO_WRITE buffers. SPI inherently transfers data in both directions at once. When writing to the device, use a dummy buffer for the incoming data, not the same buffer as the outgoing data. Writes are done in FLASH_PAGE_SIZE chunks, which is only 256 bytes, so just put the dummy buffer into the softc. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 15:44:07 2018 (r331122) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 15:56:10 2018 (r331123) @@ -90,6 +90,7 @@ struct mx25l_softc struct bio_queue_head sc_bio_queue; unsigned int sc_flags; unsigned int sc_taskstate; + uint8_t sc_dummybuf[FLASH_PAGE_SIZE]; }; #define TSTATE_STOPPED 0 @@ -344,7 +345,7 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, cmd.rx_cmd = rxBuf; cmd.tx_data = data + bytes_writen; cmd.tx_data_sz = bytes_to_write; - cmd.rx_data = data + bytes_writen; + cmd.rx_data = sc->sc_dummybuf; cmd.rx_data_sz = bytes_to_write; /* From owner-svn-src-head@freebsd.org Sun Mar 18 16:02:41 2018 Return-Path: Delivered-To: svn-src-head@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 D92C7F5F08B; Sun, 18 Mar 2018 16:02:41 +0000 (UTC) (envelope-from oshogbo@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 83A207848B; Sun, 18 Mar 2018 16:02:41 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 7E034229B4; Sun, 18 Mar 2018 16:02:41 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IG2fIV050931; Sun, 18 Mar 2018 16:02:41 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IG2fOD050930; Sun, 18 Mar 2018 16:02:41 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181602.w2IG2fOD050930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 16:02:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331124 - head/lib/libcasper/services/cap_pwd X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_pwd X-SVN-Commit-Revision: 331124 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:02:42 -0000 Author: oshogbo Date: Sun Mar 18 16:02:41 2018 New Revision: 331124 URL: https://svnweb.freebsd.org/changeset/base/331124 Log: Fix typo. Submitted by: Trond Endrestøl Modified: head/lib/libcasper/services/cap_pwd/cap_pwd.3 Modified: head/lib/libcasper/services/cap_pwd/cap_pwd.3 ============================================================================== --- head/lib/libcasper/services/cap_pwd/cap_pwd.3 Sun Mar 18 15:56:10 2018 (r331123) +++ head/lib/libcasper/services/cap_pwd/cap_pwd.3 Sun Mar 18 16:02:41 2018 (r331124) @@ -221,7 +221,7 @@ cap_close(cappwd); .Xr getpwuid_r 3 , .Xr setpassent 3 , .Xr setpwent 3 , -.Xr capsicum 4, +.Xr capsicum 4 , .Xr nv 9 .Sh AUTHORS The From owner-svn-src-head@freebsd.org Sun Mar 18 16:06:36 2018 Return-Path: Delivered-To: svn-src-head@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 7E733F5F4DD; Sun, 18 Mar 2018 16:06:36 +0000 (UTC) (envelope-from oshogbo@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 289D1786DC; Sun, 18 Mar 2018 16:06:36 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 1F83D229B9; Sun, 18 Mar 2018 16:06:36 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IG6ZiY051145; Sun, 18 Mar 2018 16:06:35 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IG6ZRa051142; Sun, 18 Mar 2018 16:06:35 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181606.w2IG6ZRa051142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 16:06:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331125 - in head/lib/libcasper: libcasper services/cap_dns services/cap_sysctl X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in head/lib/libcasper: libcasper services/cap_dns services/cap_sysctl X-SVN-Commit-Revision: 331125 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:06:36 -0000 Author: oshogbo Date: Sun Mar 18 16:06:35 2018 New Revision: 331125 URL: https://svnweb.freebsd.org/changeset/base/331125 Log: Fix similar typos to r331124. Modified: head/lib/libcasper/libcasper/libcasper.3 head/lib/libcasper/services/cap_dns/cap_dns.3 head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 Modified: head/lib/libcasper/libcasper/libcasper.3 ============================================================================== --- head/lib/libcasper/libcasper/libcasper.3 Sun Mar 18 16:02:41 2018 (r331124) +++ head/lib/libcasper/libcasper/libcasper.3 Sun Mar 18 16:06:35 2018 (r331125) @@ -182,7 +182,7 @@ over the given capability. The .Fn cap_xfer_nvlist function sends the given -.Xr nvlist 9, +.Xr nvlist 9 , destroys it and receives new .Xr nvlist 9 in response over the given capability. Modified: head/lib/libcasper/services/cap_dns/cap_dns.3 ============================================================================== --- head/lib/libcasper/services/cap_dns/cap_dns.3 Sun Mar 18 16:02:41 2018 (r331124) +++ head/lib/libcasper/services/cap_dns/cap_dns.3 Sun Mar 18 16:06:35 2018 (r331125) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2018 +.Dd March 18, 2018 .Dt CAP_DNS 3 .Os .Sh NAME @@ -193,7 +193,7 @@ printf("Name associated with %s is %s.\\n", ipstr, hp- .Xr gethostbyaddr 3 , .Xr gethostbyname 3 , .Xr gethostbyname2 3 , -.Xr getnameinfo 3, +.Xr getnameinfo 3 , .Xr capsicum 4 , .Xr nv 9 .Sh AUTHORS Modified: head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 ============================================================================== --- head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 Sun Mar 18 16:02:41 2018 (r331124) +++ head/lib/libcasper/services/cap_sysctl/cap_sysctl.3 Sun Mar 18 16:06:35 2018 (r331125) @@ -129,7 +129,7 @@ cap_close(capsysctl); .Sh SEE ALSO .Xr cap_enter 2 , .Xr err 3 , -.Xr sysctlbyname 3, +.Xr sysctlbyname 3 , .Xr capsicum 4 , .Xr nv 9 .Sh AUTHORS From owner-svn-src-head@freebsd.org Sun Mar 18 16:10:15 2018 Return-Path: Delivered-To: svn-src-head@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 279BEF5F823; Sun, 18 Mar 2018 16:10:15 +0000 (UTC) (envelope-from ian@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 BB61C7893D; Sun, 18 Mar 2018 16:10:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B63D1229D8; Sun, 18 Mar 2018 16:10:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IGAEVG051427; Sun, 18 Mar 2018 16:10:14 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGAEpn051426; Sun, 18 Mar 2018 16:10:14 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181610.w2IGAEpn051426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 16:10:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331126 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331126 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:10:15 -0000 Author: ian Date: Sun Mar 18 16:10:14 2018 New Revision: 331126 URL: https://svnweb.freebsd.org/changeset/base/331126 Log: Remove a pointless KASSERT and reword a comment a bit. The KASSERT tested for the same condition that the preceeding lines checked for and would have returned EIO, so the assert could never possibly trigger (sc_sectorsize must inherently be an integer multiple of FLASH_PAGE_SIZE). Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 16:06:35 2018 (r331125) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 16:10:14 2018 (r331126) @@ -300,19 +300,11 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, write_offset = offset; /* - * Use the erase sectorsize here since blocks are fully erased - * first before they're written to. + * Writes must be aligned to the erase sectorsize, since blocks are + * fully erased before they're written to. */ if (count % sc->sc_sectorsize != 0 || offset % sc->sc_sectorsize != 0) return (EIO); - - /* - * Assume here that we write per-sector only - * and sector size should be 256 bytes aligned - */ - KASSERT(write_offset % FLASH_PAGE_SIZE == 0, - ("offset for BIO_WRITE is not page size (%d bytes) aligned", - FLASH_PAGE_SIZE)); /* * Maximum write size for CMD_PAGE_PROGRAM is From owner-svn-src-head@freebsd.org Sun Mar 18 16:24:12 2018 Return-Path: Delivered-To: svn-src-head@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 838E3F60B34; Sun, 18 Mar 2018 16:24:12 +0000 (UTC) (envelope-from trasz@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 2CBE4796E6; Sun, 18 Mar 2018 16:24:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2695F22CE2; Sun, 18 Mar 2018 16:24:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IGOBYX061355; Sun, 18 Mar 2018 16:24:11 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGOBLn061354; Sun, 18 Mar 2018 16:24:11 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201803181624.w2IGOBLn061354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 18 Mar 2018 16:24:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331127 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 331127 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:24:12 -0000 Author: trasz Date: Sun Mar 18 16:24:11 2018 New Revision: 331127 URL: https://svnweb.freebsd.org/changeset/base/331127 Log: Fix typo. MFC after: 2 weeks Modified: head/share/man/man7/development.7 Modified: head/share/man/man7/development.7 ============================================================================== --- head/share/man/man7/development.7 Sun Mar 18 16:10:14 2018 (r331126) +++ head/share/man/man7/development.7 Sun Mar 18 16:24:11 2018 (r331127) @@ -71,7 +71,7 @@ Releases are then branched off STABLE and numbered wit .Pp Layout of the source tree is described in .Xr hier 7 . -Build Instructions can be found in +Build instructions can be found in .Xr build 7 and .Xr release 7 . From owner-svn-src-head@freebsd.org Sun Mar 18 16:35:40 2018 Return-Path: Delivered-To: svn-src-head@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 BF461F61890; Sun, 18 Mar 2018 16:35:40 +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 6C5BB79F69; Sun, 18 Mar 2018 16:35:40 +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 609EA22EBB; Sun, 18 Mar 2018 16:35:40 +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 w2IGZe6J066495; Sun, 18 Mar 2018 16:35:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGZe3b066494; Sun, 18 Mar 2018 16:35:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803181635.w2IGZe3b066494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 18 Mar 2018 16:35:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331128 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331128 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:35:40 -0000 Author: markj Date: Sun Mar 18 16:35:40 2018 New Revision: 331128 URL: https://svnweb.freebsd.org/changeset/base/331128 Log: Have vm_page_replace() assert that the new page is not enqueued. The new page does not belong to a VM object, but the page daemon does not expect to encounter such pages. Reviewed by: alc, kib Tested by: pho MFC after: 1 week X-Differential Revision: https://reviews.freebsd.org/D14625 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Mar 18 16:24:11 2018 (r331127) +++ head/sys/vm/vm_page.c Sun Mar 18 16:35:40 2018 (r331128) @@ -1505,7 +1505,9 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm VM_OBJECT_ASSERT_WLOCKED(object); KASSERT(mnew->object == NULL, - ("vm_page_replace: page already in object")); + ("vm_page_replace: page %p already in object", mnew)); + KASSERT(mnew->queue == PQ_NONE, + ("vm_page_replace: new page %p is on a paging queue", mnew)); /* * This function mostly follows vm_page_insert() and @@ -1517,7 +1519,7 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm mnew->pindex = pindex; mold = vm_radix_replace(&object->rtree, mnew); KASSERT(mold->queue == PQ_NONE, - ("vm_page_replace: mold is on a paging queue")); + ("vm_page_replace: old page %p is on a paging queue", mold)); /* Keep the resident page list in sorted order. */ TAILQ_INSERT_AFTER(&object->memq, mold, mnew, listq); From owner-svn-src-head@freebsd.org Sun Mar 18 16:36:15 2018 Return-Path: Delivered-To: svn-src-head@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 14DFCF61989; Sun, 18 Mar 2018 16:36:15 +0000 (UTC) (envelope-from ian@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 B97BD7A0D9; Sun, 18 Mar 2018 16:36:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B473422EC5; Sun, 18 Mar 2018 16:36:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IGaEDK066563; Sun, 18 Mar 2018 16:36:14 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGaErq066562; Sun, 18 Mar 2018 16:36:14 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181636.w2IGaErq066562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 16:36:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331129 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331129 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:36:15 -0000 Author: ian Date: Sun Mar 18 16:36:14 2018 New Revision: 331129 URL: https://svnweb.freebsd.org/changeset/base/331129 Log: Eliminate some unneeded intermediate variables. Eliminate some redundant parens in shift-and-mask expressions. Reword and reflow some comments. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 16:35:40 2018 (r331128) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 16:36:14 2018 (r331129) @@ -280,8 +280,7 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, struct mx25l_softc *sc; uint8_t txBuf[8], rxBuf[8]; struct spi_command cmd; - off_t write_offset; - long bytes_to_write, bytes_writen; + off_t bytes_to_write; device_t pdev; int err = 0; @@ -296,9 +295,6 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, cmd.rx_cmd_sz = 4; } - bytes_writen = 0; - write_offset = offset; - /* * Writes must be aligned to the erase sectorsize, since blocks are * fully erased before they're written to. @@ -307,43 +303,37 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, return (EIO); /* - * Maximum write size for CMD_PAGE_PROGRAM is - * FLASH_PAGE_SIZE, so split data to chunks - * FLASH_PAGE_SIZE bytes eash and write them - * one by one + * Maximum write size for CMD_PAGE_PROGRAM is FLASH_PAGE_SIZE, so loop + * to write chunks of FLASH_PAGE_SIZE bytes each. */ - while (bytes_writen < count) { - /* - * If we crossed sector boundary - erase next sector - */ - if (((offset + bytes_writen) % sc->sc_sectorsize) == 0) - mx25l_erase_cmd(dev, offset + bytes_writen, CMD_SECTOR_ERASE); + while (count != 0) { + /* If we crossed a sector boundary, erase the next sector. */ + if (((offset) % sc->sc_sectorsize) == 0) + mx25l_erase_cmd(dev, offset, CMD_SECTOR_ERASE); txBuf[0] = CMD_PAGE_PROGRAM; if (sc->sc_flags & FL_ENABLE_4B_ADDR) { - txBuf[1] = ((write_offset >> 24) & 0xff); - txBuf[2] = ((write_offset >> 16) & 0xff); - txBuf[3] = ((write_offset >> 8) & 0xff); - txBuf[4] = (write_offset & 0xff); + txBuf[1] = (offset >> 24) & 0xff; + txBuf[2] = (offset >> 16) & 0xff; + txBuf[3] = (offset >> 8) & 0xff; + txBuf[4] = offset & 0xff; } else { - txBuf[1] = ((write_offset >> 16) & 0xff); - txBuf[2] = ((write_offset >> 8) & 0xff); - txBuf[3] = (write_offset & 0xff); + txBuf[1] = (offset >> 16) & 0xff; + txBuf[2] = (offset >> 8) & 0xff; + txBuf[3] = offset & 0xff; } - bytes_to_write = MIN(FLASH_PAGE_SIZE, - count - bytes_writen); + bytes_to_write = MIN(FLASH_PAGE_SIZE, count); cmd.tx_cmd = txBuf; cmd.rx_cmd = rxBuf; - cmd.tx_data = data + bytes_writen; - cmd.tx_data_sz = bytes_to_write; + cmd.tx_data = data; cmd.rx_data = sc->sc_dummybuf; - cmd.rx_data_sz = bytes_to_write; + cmd.tx_data_sz = (uint32_t)bytes_to_write; + cmd.rx_data_sz = (uint32_t)bytes_to_write; /* - * Eash completed write operation resets WEL - * (write enable latch) to disabled state, - * so we re-enable it here + * Each completed write operation resets WEL (write enable + * latch) to disabled state, so we re-enable it here. */ mx25l_wait_for_device_ready(dev); mx25l_set_writable(dev, 1); @@ -352,8 +342,9 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, if (err) break; - bytes_writen += bytes_to_write; - write_offset += bytes_to_write; + data += bytes_to_write; + offset += bytes_to_write; + count -= bytes_to_write; } return (err); @@ -372,12 +363,12 @@ mx25l_read(device_t dev, off_t offset, caddr_t data, o sc = device_get_softc(dev); /* - * Enforce the disk read sectorsize not the erase sectorsize. - * In this way, smaller read IO is possible,dramatically - * speeding up filesystem/geom_compress access. + * Enforce that reads are aligned to the disk sectorsize, not the + * erase sectorsize. In this way, smaller read IO is possible, + * dramatically speeding up filesystem/geom_compress access. */ - if (count % sc->sc_disk->d_sectorsize != 0 - || offset % sc->sc_disk->d_sectorsize != 0) + if (count % sc->sc_disk->d_sectorsize != 0 || + offset % sc->sc_disk->d_sectorsize != 0) return (EIO); txBuf[0] = CMD_FAST_READ; @@ -385,19 +376,19 @@ mx25l_read(device_t dev, off_t offset, caddr_t data, o cmd.tx_cmd_sz = 6; cmd.rx_cmd_sz = 6; - txBuf[1] = ((offset >> 24) & 0xff); - txBuf[2] = ((offset >> 16) & 0xff); - txBuf[3] = ((offset >> 8) & 0xff); - txBuf[4] = (offset & 0xff); + txBuf[1] = (offset >> 24) & 0xff; + txBuf[2] = (offset >> 16) & 0xff; + txBuf[3] = (offset >> 8) & 0xff; + txBuf[4] = offset & 0xff; /* Dummy byte */ txBuf[5] = 0; } else { cmd.tx_cmd_sz = 5; cmd.rx_cmd_sz = 5; - txBuf[1] = ((offset >> 16) & 0xff); - txBuf[2] = ((offset >> 8) & 0xff); - txBuf[3] = (offset & 0xff); + txBuf[1] = (offset >> 16) & 0xff; + txBuf[2] = (offset >> 8) & 0xff; + txBuf[3] = offset & 0xff; /* Dummy byte */ txBuf[4] = 0; } @@ -405,8 +396,8 @@ mx25l_read(device_t dev, off_t offset, caddr_t data, o cmd.tx_cmd = txBuf; cmd.rx_cmd = rxBuf; cmd.tx_data = data; - cmd.tx_data_sz = count; cmd.rx_data = data; + cmd.tx_data_sz = count; cmd.rx_data_sz = count; err = SPIBUS_TRANSFER(pdev, dev, &cmd); From owner-svn-src-head@freebsd.org Sun Mar 18 16:40:58 2018 Return-Path: Delivered-To: svn-src-head@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 ECE67F62013; Sun, 18 Mar 2018 16:40:57 +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 9906C7A478; Sun, 18 Mar 2018 16:40:57 +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 93E3C22EF7; Sun, 18 Mar 2018 16:40:57 +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 w2IGevwO066825; Sun, 18 Mar 2018 16:40:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGevY0066821; Sun, 18 Mar 2018 16:40:57 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803181640.w2IGevY0066821@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 18 Mar 2018 16:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331130 - in head/sys: kern vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: kern vm X-SVN-Commit-Revision: 331130 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:40:58 -0000 Author: markj Date: Sun Mar 18 16:40:56 2018 New Revision: 331130 URL: https://svnweb.freebsd.org/changeset/base/331130 Log: Have vm_page_{deactivate,launder}() requeue already-queued pages. In many cases the page is not enqueued so the change will have no effect. However, the change is needed to support an optimization in the fault handler and in some cases (sendfile, the buffer cache) it was being emulated by the caller anyway. Reviewed by: alc Tested by: pho MFC after: 2 weeks X-Differential Revision: https://reviews.freebsd.org/D14625 Modified: head/sys/kern/kern_sendfile.c head/sys/kern/vfs_bio.c head/sys/vm/vm_fault.c head/sys/vm/vm_page.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Sun Mar 18 16:36:14 2018 (r331129) +++ head/sys/kern/kern_sendfile.c Sun Mar 18 16:40:56 2018 (r331130) @@ -167,10 +167,8 @@ sendfile_free_page(vm_page_t pg, bool nocache) vm_page_deactivate_noreuse(pg); else if (pg->queue == PQ_ACTIVE) vm_page_reference(pg); - else if (pg->queue != PQ_INACTIVE) - vm_page_deactivate(pg); else - vm_page_requeue(pg); + vm_page_deactivate(pg); } } } Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sun Mar 18 16:36:14 2018 (r331129) +++ head/sys/kern/vfs_bio.c Sun Mar 18 16:40:56 2018 (r331130) @@ -2936,10 +2936,8 @@ vfs_vmio_unwire(struct buf *bp, vm_page_t m) vm_page_deactivate_noreuse(m); else if (m->queue == PQ_ACTIVE) vm_page_reference(m); - else if (m->queue != PQ_INACTIVE) - vm_page_deactivate(m); else - vm_page_requeue(m); + vm_page_deactivate(m); } } vm_page_unlock(m); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Mar 18 16:36:14 2018 (r331129) +++ head/sys/vm/vm_fault.c Sun Mar 18 16:40:56 2018 (r331130) @@ -1379,7 +1379,8 @@ vm_fault_dontneed(const struct faultstate *fs, vm_offs * active queue. */ vm_page_lock(m); - vm_page_deactivate(m); + if (!vm_page_inactive(m)) + vm_page_deactivate(m); vm_page_unlock(m); } } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Mar 18 16:36:14 2018 (r331129) +++ head/sys/vm/vm_page.c Sun Mar 18 16:40:56 2018 (r331130) @@ -3363,7 +3363,8 @@ vm_page_unwire_noq(vm_page_t m) } /* - * Move the specified page to the inactive queue. + * Move the specified page to the inactive queue, or requeue the page if it is + * already in the inactive queue. * * Normally, "noreuse" is FALSE, resulting in LRU ordering of the inactive * queue. However, setting "noreuse" to TRUE will accelerate the specified @@ -3381,15 +3382,10 @@ _vm_page_deactivate(vm_page_t m, boolean_t noreuse) vm_page_assert_locked(m); - /* - * Ignore if the page is already inactive, unless it is unlikely to be - * reactivated. - */ - if ((queue = m->queue) == PQ_INACTIVE && !noreuse) - return; if (m->wire_count == 0 && (m->oflags & VPO_UNMANAGED) == 0) { pq = &vm_pagequeue_domain(m)->vmd_pagequeues[PQ_INACTIVE]; /* Avoid multiple acquisitions of the inactive queue lock. */ + queue = m->queue; if (queue == PQ_INACTIVE) { vm_pagequeue_lock(pq); vm_page_dequeue_locked(m); @@ -3411,7 +3407,8 @@ _vm_page_deactivate(vm_page_t m, boolean_t noreuse) } /* - * Move the specified page to the inactive queue. + * Move the specified page to the inactive queue, or requeue the page if it is + * already in the inactive queue. * * The page must be locked. */ @@ -3438,19 +3435,20 @@ vm_page_deactivate_noreuse(vm_page_t m) /* * vm_page_launder * - * Put a page in the laundry. + * Put a page in the laundry, or requeue it if it is already there. */ void vm_page_launder(vm_page_t m) { - int queue; vm_page_assert_locked(m); - if ((queue = m->queue) != PQ_LAUNDRY && m->wire_count == 0 && - (m->oflags & VPO_UNMANAGED) == 0) { - if (queue != PQ_NONE) - vm_page_dequeue(m); - vm_page_enqueue(PQ_LAUNDRY, m); + if (m->wire_count == 0 && (m->oflags & VPO_UNMANAGED) == 0) { + if (m->queue == PQ_LAUNDRY) + vm_page_requeue(m); + else { + vm_page_remque(m); + vm_page_enqueue(PQ_LAUNDRY, m); + } } } @@ -3540,7 +3538,7 @@ vm_page_advise(vm_page_t m, int advice) */ if (m->dirty == 0) vm_page_deactivate_noreuse(m); - else + else if (!vm_page_in_laundry(m)) vm_page_launder(m); } From owner-svn-src-head@freebsd.org Sun Mar 18 16:49:31 2018 Return-Path: Delivered-To: svn-src-head@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 062EAF628C7; Sun, 18 Mar 2018 16:49:31 +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 986817A9AB; Sun, 18 Mar 2018 16:49:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 900F82306C; Sun, 18 Mar 2018 16:49:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IGnUNv071780; Sun, 18 Mar 2018 16:49:30 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGnULZ071778; Sun, 18 Mar 2018 16:49:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803181649.w2IGnULZ071778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 18 Mar 2018 16:49:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331131 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331131 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:49:31 -0000 Author: markj Date: Sun Mar 18 16:49:30 2018 New Revision: 331131 URL: https://svnweb.freebsd.org/changeset/base/331131 Log: Avoid dequeuing the fault page during a soft fault. Such pages are re-enqueued at the end of the fault handler, preserving LRU. Rather than performing two separate operations per fault, simply requeue the page at the end of the fault (or bump its activation count if it resides in PQ_ACTIVE, avoiding the page queue lock entirely). This elides some page lock and page queue lock operations in common cases, e.g., CoW faults. Note that we must still dequeue the source page for "optimized" CoW faults since the page may not remain enqueued while it is moved to another object. Reviewed by: alc, kib Tested by: pho MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D14625 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Mar 18 16:40:56 2018 (r331130) +++ head/sys/vm/vm_fault.c Sun Mar 18 16:49:30 2018 (r331131) @@ -682,7 +682,7 @@ RetryFault:; /* * Reference the page before unlocking and * sleeping so that the page daemon is less - * likely to reclaim it. + * likely to reclaim it. */ vm_page_aflag_set(fs.m, PGA_REFERENCED); if (fs.object != fs.first_object) { @@ -710,9 +710,6 @@ RetryFault:; vm_object_deallocate(fs.first_object); goto RetryFault; } - vm_page_lock(fs.m); - vm_page_remque(fs.m); - vm_page_unlock(fs.m); /* * Mark page busy for other processes, and the @@ -723,7 +720,7 @@ RetryFault:; vm_page_xbusy(fs.m); if (fs.m->valid != VM_PAGE_BITS_ALL) goto readrest; - break; + break; /* break to PAGE HAS BEEN FOUND */ } KASSERT(fs.m == NULL, ("fs.m should be NULL, not %p", fs.m)); @@ -1105,6 +1102,7 @@ readrest: */ fs.object == fs.first_object->backing_object) { vm_page_lock(fs.m); + vm_page_remque(fs.m); vm_page_remove(fs.m); vm_page_unlock(fs.m); vm_page_lock(fs.first_m); From owner-svn-src-head@freebsd.org Sun Mar 18 16:52:32 2018 Return-Path: Delivered-To: svn-src-head@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 27730F62D05; Sun, 18 Mar 2018 16:52:32 +0000 (UTC) (envelope-from ian@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 A2B5B7AE84; Sun, 18 Mar 2018 16:52:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 9D473231EE; Sun, 18 Mar 2018 16:52:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IGqVUn076646; Sun, 18 Mar 2018 16:52:31 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGqVve076645; Sun, 18 Mar 2018 16:52:31 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181652.w2IGqVve076645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 16:52:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331132 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331132 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 16:52:32 -0000 Author: ian Date: Sun Mar 18 16:52:31 2018 New Revision: 331132 URL: https://svnweb.freebsd.org/changeset/base/331132 Log: Bugfix: wait for writes/erases to complete after starting them, instead of before starting them. Using the wait-before logic would make sense if there was useful time- consuming work that could be done between the end of one write and the beginning of the next, but it also requires doing the wait-for-ready before reading, because a prior write or erase could still be in progress. Reading is the far more common case, so adding a whole extra bus transaction to check for ready before each read would soak up any small gains that might be had from doing async writes. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 16:49:30 2018 (r331131) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 16:52:31 2018 (r331132) @@ -247,7 +247,6 @@ mx25l_erase_cmd(device_t dev, off_t sector, uint8_t ec sc = device_get_softc(dev); - mx25l_wait_for_device_ready(dev); mx25l_set_writable(dev, 1); memset(&cmd, 0, sizeof(cmd)); @@ -272,6 +271,7 @@ mx25l_erase_cmd(device_t dev, off_t sector, uint8_t ec txBuf[3] = (sector & 0xff); } err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); + mx25l_wait_for_device_ready(dev); } static int @@ -339,6 +339,7 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, mx25l_set_writable(dev, 1); err = SPIBUS_TRANSFER(pdev, dev, &cmd); + mx25l_wait_for_device_ready(dev); if (err) break; From owner-svn-src-head@freebsd.org Sun Mar 18 17:01:51 2018 Return-Path: Delivered-To: svn-src-head@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 7E6C9F638A3; Sun, 18 Mar 2018 17:01:51 +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 2FF9C7B61E; Sun, 18 Mar 2018 17:01:51 +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 2B0EB23264; Sun, 18 Mar 2018 17:01:51 +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 w2IH1pd6080399; Sun, 18 Mar 2018 17:01:51 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IH1pY2080398; Sun, 18 Mar 2018 17:01:51 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803181701.w2IH1pY2080398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 18 Mar 2018 17:01:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331134 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Commit-Revision: 331134 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 17:01:51 -0000 Author: markj Date: Sun Mar 18 17:01:50 2018 New Revision: 331134 URL: https://svnweb.freebsd.org/changeset/base/331134 Log: Fix an access of an uninitialized variable in dtrace_probe(). Reported by: Coverity, via cem MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sun Mar 18 16:57:40 2018 (r331133) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sun Mar 18 17:01:50 2018 (r331134) @@ -7318,7 +7318,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t } now = mstate.dtms_timestamp = dtrace_gethrtime(); - mstate.dtms_present |= DTRACE_MSTATE_TIMESTAMP; + mstate.dtms_present = DTRACE_MSTATE_TIMESTAMP; vtime = dtrace_vtime_references != 0; if (vtime && curthread->t_dtrace_start) From owner-svn-src-head@freebsd.org Sun Mar 18 17:03:27 2018 Return-Path: Delivered-To: svn-src-head@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 EB4F3F63A98; Sun, 18 Mar 2018 17:03:26 +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 959357B951; Sun, 18 Mar 2018 17:03:26 +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 9083C23387; Sun, 18 Mar 2018 17:03:26 +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 w2IH3Q5U082087; Sun, 18 Mar 2018 17:03:26 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IH3QgB082086; Sun, 18 Mar 2018 17:03:26 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803181703.w2IH3QgB082086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 18 Mar 2018 17:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331135 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall X-SVN-Commit-Revision: 331135 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 17:03:27 -0000 Author: markj Date: Sun Mar 18 17:03:26 2018 New Revision: 331135 URL: https://svnweb.freebsd.org/changeset/base/331135 Log: Use __syscall(2) rather than syscall(2) in syscall/tst.args.c. Some of mmap(2)'s arguments are 64 bits wide. MFC after: 3 days Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c Sun Mar 18 17:01:50 2018 (r331134) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c Sun Mar 18 17:03:26 2018 (r331135) @@ -35,7 +35,7 @@ int main(int argc, char **argv) { for (;;) { - (void) syscall(SYS_mmap, NULL, 1, 2, 3, -1, 0x12345678); + (void) __syscall(SYS_mmap, NULL, 1, 2, 3, -1, 0x12345678); } return (0); From owner-svn-src-head@freebsd.org Sun Mar 18 17:07:47 2018 Return-Path: Delivered-To: svn-src-head@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 62288F63F4C; Sun, 18 Mar 2018 17:07:47 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pl0-x234.google.com (mail-pl0-x234.google.com [IPv6:2607:f8b0:400e:c01::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 585297BBE3; Sun, 18 Mar 2018 17:07:44 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pl0-x234.google.com with SMTP id b7-v6so4746296plr.8; Sun, 18 Mar 2018 10:07:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vkexWCvhXOJqY6qQ4TOZi/ES5aTwML9BqgL7SoMys/U=; b=EmkbCVLmVMBwd/BUTqeBY0Wkp+qqSbo71+i7n7mgoRUqW6DWt3HM+O97OfjpYHnXKm R+wl2r+lXAxneoh/MNCuIIn0Q5m96Vll/8UCFKiOh+8ZjT8Mx2rjX2i9N4C0qv8lCksB 1h5JU2r7zuMlTRJuHk4n5do4efFuwbsf1WitbWxvrPUGPdR5BmXxVoPuAZwxGUL6a0wk d/nd+e/9Vt15RuYgKnGi+AmdjWBv2+cKpKqhmJ5hZdYKN4NSetvH8yg5gKJtdPx04zT/ t64R8XUri/g/eja5MzfF1Xc/30GbQA03i3F9pwuMCwnbgtjwnDhiTHLVE7x7IDFPJyUw VrFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=vkexWCvhXOJqY6qQ4TOZi/ES5aTwML9BqgL7SoMys/U=; b=OhpphuUZq+l2qDxx/XW1If6ftSB9WIG3kc5OCQ98OgNunRQdBJqGE1rGq5gB+pUFsi XO0wPavyhsoao7Tj7U94UYJFtPiq3iiq7kicOkm3w+jgxN3UEWdqjuhnyGd9QHnpoOWb CQgewjsH6zYKn/4+SmsJK+xUjj3BCRqI4PoNYiUVVclANyj7a3bKhYUktsxV8tjMG/2J uMSvK2dcFVL+3sPXiROhXW49hiN4t03yLX1e40Hvu9EkX2msDFsqRxPD2PRbAE2oQfou x9Oxtck8gwt7TYRe1UOAT3cgvimaxJDh3bj/R6zx/kUbG0PHNN67uqsbepeMK3S1QMZ+ KM1A== X-Gm-Message-State: AElRT7GQqc5i0xVN5FJdHZN7s8HeynHIOaJ53XnmgXeUZ2rSF5somPbA /FB0zRcCcmrbXc46j7P3GFb8Og== X-Google-Smtp-Source: AG47ELvZMiVfIB0MEcpEI0LAK1MUy5G6E5DUnz3WySAnkqfU8KVD1jGBSKvJDwT0J8dxvUwqgQyW8Q== X-Received: by 2002:a17:902:24a5:: with SMTP id w34-v6mr9468788pla.328.1521392862804; Sun, 18 Mar 2018 10:07:42 -0700 (PDT) Received: from raichu (toroon0560w-lp130-01-174-88-76-226.dsl.bell.ca. [174.88.76.226]) by smtp.gmail.com with ESMTPSA id o86sm27065601pfi.87.2018.03.18.10.07.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Mar 2018 10:07:41 -0700 (PDT) Sender: Mark Johnston Date: Sun, 18 Mar 2018 13:07:38 -0400 From: Mark Johnston To: Mariusz Zaborski Cc: Mark Linimon , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r325739 - in head: lib/libcasper/services lib/libcasper/services/cap_syslog share/mk Message-ID: <20180318170738.GB35894@raichu> References: <201711120834.vAC8YQUq006611@repo.freebsd.org> <20180305161358.GA704@raichu> <20180305171916.GA2359@lonesome.com> <20180318142039.GA81224@x-wing> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180318142039.GA81224@x-wing> User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 17:07:47 -0000 On Sun, Mar 18, 2018 at 03:20:39PM +0100, Mariusz Zaborski wrote: > On Mon, Mar 05, 2018 at 11:19:16AM -0600, Mark Linimon wrote: > > On Mon, Mar 05, 2018 at 11:13:58AM -0500, Mark Johnston wrote: > > > The growing divergence with stable/11 makes it rather painful to > > > maintain a port, depending on libcasper, that aims to work on both 11 > > > and head. > > > > Even an MFC won't help you, in the medium-term. > > > > e.g. via https://www.freebsd.org/security/#sup, even if the MFC made it > > into 11.2, you would still have several months of supporting the old > > one. (The FreeBSD package builds are based on the oldest supported > > point release from a branch.) The current estimate for 11.2 is late June. > > > > mcl > > Hi, > > Sorry for delay I just get back. > > Yes I can integrate all my changes in libcasper and I guess libcapsicum. > I'm did do a lot of integrations to stable so I have one question - > if I understand correctly all changes which change API/ABI but are > pointed as SHLIB_MAJOR I can safety integrate. > > Mark what else can I do? Sorry, I don't quite follow. I don't think SHLIB_MAJOR bumps can be MFCed: what happens if an SA is later released for the library in question? From owner-svn-src-head@freebsd.org Sun Mar 18 17:25:24 2018 Return-Path: Delivered-To: svn-src-head@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 7D478F65286; Sun, 18 Mar 2018 17:25:24 +0000 (UTC) (envelope-from ian@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 2F0D17CA48; Sun, 18 Mar 2018 17:25:24 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 2A02C236A9; Sun, 18 Mar 2018 17:25:24 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IHPOwJ092438; Sun, 18 Mar 2018 17:25:24 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IHPOVc092437; Sun, 18 Mar 2018 17:25:24 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181725.w2IHPOVc092437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 17:25:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331136 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331136 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 17:25:24 -0000 Author: ian Date: Sun Mar 18 17:25:23 2018 New Revision: 331136 URL: https://svnweb.freebsd.org/changeset/base/331136 Log: Add sc_parent to the softc and use it in place of device_get_parent() calls all over the place. Also pass the softc as the arg to all the internal functions instead of passing a device_t and calling device_get_softc() in each function. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 17:03:26 2018 (r331135) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 17:25:23 2018 (r331136) @@ -81,6 +81,7 @@ struct mx25l_flash_ident struct mx25l_softc { device_t sc_dev; + device_t sc_parent; uint8_t sc_manufacturer_id; uint16_t sc_device_id; unsigned int sc_sectorsize; @@ -150,7 +151,7 @@ struct mx25l_flash_ident flash_devices[] = { }; static uint8_t -mx25l_get_status(device_t dev) +mx25l_get_status(struct mx25l_softc *sc) { uint8_t txBuf[2], rxBuf[2]; struct spi_command cmd; @@ -165,21 +166,20 @@ mx25l_get_status(device_t dev) cmd.rx_cmd = rxBuf; cmd.rx_cmd_sz = 2; cmd.tx_cmd_sz = 2; - err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); return (rxBuf[1]); } static void -mx25l_wait_for_device_ready(device_t dev) +mx25l_wait_for_device_ready(struct mx25l_softc *sc) { - while ((mx25l_get_status(dev) & STATUS_WIP)) + while ((mx25l_get_status(sc) & STATUS_WIP)) continue; } static struct mx25l_flash_ident* mx25l_get_device_ident(struct mx25l_softc *sc) { - device_t dev = sc->sc_dev; uint8_t txBuf[8], rxBuf[8]; struct spi_command cmd; uint8_t manufacturer_id; @@ -199,7 +199,7 @@ mx25l_get_device_ident(struct mx25l_softc *sc) */ cmd.tx_cmd_sz = 4; cmd.rx_cmd_sz = 4; - err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); if (err) return (NULL); @@ -213,13 +213,14 @@ mx25l_get_device_ident(struct mx25l_softc *sc) return &flash_devices[i]; } - printf("Unknown SPI flash device. Vendor: %02x, device id: %04x\n", + device_printf(sc->sc_dev, + "Unknown SPI flash device. Vendor: %02x, device id: %04x\n", manufacturer_id, dev_id); return (NULL); } static void -mx25l_set_writable(device_t dev, int writable) +mx25l_set_writable(struct mx25l_softc *sc, int writable) { uint8_t txBuf[1], rxBuf[1]; struct spi_command cmd; @@ -234,21 +235,18 @@ mx25l_set_writable(device_t dev, int writable) cmd.rx_cmd = rxBuf; cmd.rx_cmd_sz = 1; cmd.tx_cmd_sz = 1; - err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); } static void -mx25l_erase_cmd(device_t dev, off_t sector, uint8_t ecmd) +mx25l_erase_cmd(struct mx25l_softc *sc, off_t sector, uint8_t ecmd) { - struct mx25l_softc *sc; uint8_t txBuf[5], rxBuf[5]; struct spi_command cmd; int err; - sc = device_get_softc(dev); + mx25l_set_writable(sc, 1); - mx25l_set_writable(dev, 1); - memset(&cmd, 0, sizeof(cmd)); memset(txBuf, 0, sizeof(txBuf)); memset(rxBuf, 0, sizeof(rxBuf)); @@ -270,23 +268,18 @@ mx25l_erase_cmd(device_t dev, off_t sector, uint8_t ec txBuf[2] = ((sector >> 8) & 0xff); txBuf[3] = (sector & 0xff); } - err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); - mx25l_wait_for_device_ready(dev); + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); + mx25l_wait_for_device_ready(sc); } static int -mx25l_write(device_t dev, off_t offset, caddr_t data, off_t count) +mx25l_write(struct mx25l_softc *sc, off_t offset, caddr_t data, off_t count) { - struct mx25l_softc *sc; uint8_t txBuf[8], rxBuf[8]; struct spi_command cmd; off_t bytes_to_write; - device_t pdev; int err = 0; - pdev = device_get_parent(dev); - sc = device_get_softc(dev); - if (sc->sc_flags & FL_ENABLE_4B_ADDR) { cmd.tx_cmd_sz = 5; cmd.rx_cmd_sz = 5; @@ -309,7 +302,7 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, while (count != 0) { /* If we crossed a sector boundary, erase the next sector. */ if (((offset) % sc->sc_sectorsize) == 0) - mx25l_erase_cmd(dev, offset, CMD_SECTOR_ERASE); + mx25l_erase_cmd(sc, offset, CMD_SECTOR_ERASE); txBuf[0] = CMD_PAGE_PROGRAM; if (sc->sc_flags & FL_ENABLE_4B_ADDR) { @@ -335,11 +328,11 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, * Each completed write operation resets WEL (write enable * latch) to disabled state, so we re-enable it here. */ - mx25l_wait_for_device_ready(dev); - mx25l_set_writable(dev, 1); + mx25l_wait_for_device_ready(sc); + mx25l_set_writable(sc, 1); - err = SPIBUS_TRANSFER(pdev, dev, &cmd); - mx25l_wait_for_device_ready(dev); + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); + mx25l_wait_for_device_ready(sc); if (err) break; @@ -352,17 +345,12 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, } static int -mx25l_read(device_t dev, off_t offset, caddr_t data, off_t count) +mx25l_read(struct mx25l_softc *sc, off_t offset, caddr_t data, off_t count) { - struct mx25l_softc *sc; uint8_t txBuf[8], rxBuf[8]; struct spi_command cmd; - device_t pdev; int err = 0; - pdev = device_get_parent(dev); - sc = device_get_softc(dev); - /* * Enforce that reads are aligned to the disk sectorsize, not the * erase sectorsize. In this way, smaller read IO is possible, @@ -401,25 +389,22 @@ mx25l_read(device_t dev, off_t offset, caddr_t data, o cmd.tx_data_sz = count; cmd.rx_data_sz = count; - err = SPIBUS_TRANSFER(pdev, dev, &cmd); + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); return (err); } static int -mx25l_set_4b_mode(device_t dev, uint8_t command) +mx25l_set_4b_mode(struct mx25l_softc *sc, uint8_t command) { uint8_t txBuf[1], rxBuf[1]; struct spi_command cmd; - device_t pdev; int err; memset(&cmd, 0, sizeof(cmd)); memset(txBuf, 0, sizeof(txBuf)); memset(rxBuf, 0, sizeof(rxBuf)); - pdev = device_get_parent(dev); - cmd.tx_cmd_sz = cmd.rx_cmd_sz = 1; cmd.tx_cmd = txBuf; @@ -427,9 +412,9 @@ mx25l_set_4b_mode(device_t dev, uint8_t command) txBuf[0] = command; - err = SPIBUS_TRANSFER(pdev, dev, &cmd); + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); - mx25l_wait_for_device_ready(dev); + mx25l_wait_for_device_ready(sc); return (err); } @@ -479,13 +464,15 @@ mx25l_attach(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; + sc->sc_parent = device_get_parent(sc->sc_dev); + M25PXX_LOCK_INIT(sc); ident = mx25l_get_device_ident(sc); if (ident == NULL) return (ENXIO); - mx25l_wait_for_device_ready(sc->sc_dev); + mx25l_wait_for_device_ready(sc); sc->sc_disk = disk_alloc(); sc->sc_disk->d_open = mx25l_open; @@ -505,10 +492,10 @@ mx25l_attach(device_t dev) sc->sc_flags = ident->flags; if (sc->sc_flags & FL_ENABLE_4B_ADDR) - mx25l_set_4b_mode(dev, CMD_ENTER_4B_MODE); + mx25l_set_4b_mode(sc, CMD_ENTER_4B_MODE); if (sc->sc_flags & FL_DISABLE_4B_ADDR) - mx25l_set_4b_mode(dev, CMD_EXIT_4B_MODE); + mx25l_set_4b_mode(sc, CMD_EXIT_4B_MODE); /* NB: use stripesize to hold the erase/region size for RedBoot */ sc->sc_disk->d_stripesize = ident->sectorsize; @@ -542,7 +529,7 @@ mx25l_detach(device_t dev) err = msleep(sc, &sc->sc_mtx, 0, "mx25dt", hz * 3); if (err != 0) { sc->sc_taskstate = TSTATE_RUNNING; - device_printf(dev, + device_printf(sc->sc_dev, "Failed to stop queue task\n"); } } @@ -637,11 +624,11 @@ mx25l_task(void *arg) switch (bp->bio_cmd) { case BIO_READ: - bp->bio_error = mx25l_read(dev, bp->bio_offset, + bp->bio_error = mx25l_read(sc, bp->bio_offset, bp->bio_data, bp->bio_bcount); break; case BIO_WRITE: - bp->bio_error = mx25l_write(dev, bp->bio_offset, + bp->bio_error = mx25l_write(sc, bp->bio_offset, bp->bio_data, bp->bio_bcount); break; default: From owner-svn-src-head@freebsd.org Sun Mar 18 17:27:37 2018 Return-Path: Delivered-To: svn-src-head@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 DBF10F654A8; Sun, 18 Mar 2018 17:27:37 +0000 (UTC) (envelope-from oshogbo@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 7D59B7CC2F; Sun, 18 Mar 2018 17:27:37 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 71B0E236AB; Sun, 18 Mar 2018 17:27:37 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IHRbSU092554; Sun, 18 Mar 2018 17:27:37 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IHRbwm092553; Sun, 18 Mar 2018 17:27:37 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181727.w2IHRbwm092553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 17:27:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331137 - head/lib/libcasper/services/cap_sysctl X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_sysctl X-SVN-Commit-Revision: 331137 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 17:27:38 -0000 Author: oshogbo Date: Sun Mar 18 17:27:37 2018 New Revision: 331137 URL: https://svnweb.freebsd.org/changeset/base/331137 Log: Fix reference to man page in Makefile. I broke it in r331120. Modified: head/lib/libcasper/services/cap_sysctl/Makefile Modified: head/lib/libcasper/services/cap_sysctl/Makefile ============================================================================== --- head/lib/libcasper/services/cap_sysctl/Makefile Sun Mar 18 17:25:23 2018 (r331136) +++ head/lib/libcasper/services/cap_sysctl/Makefile Sun Mar 18 17:27:37 2018 (r331137) @@ -24,7 +24,7 @@ CFLAGS+=-I${.CURDIR} HAS_TESTS= SUBDIR.${MK_TESTS}+= tests -MAN+= cap_sysctl +MAN+= cap_sysctl.3 MLINKS+=cap_sysctl.3 libcap_sysctl.3 MLINKS+=cap_sysctl.3 cap_sysctlbyname.3 From owner-svn-src-head@freebsd.org Sun Mar 18 17:47:58 2018 Return-Path: Delivered-To: svn-src-head@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 0B726F670E3; Sun, 18 Mar 2018 17:47:58 +0000 (UTC) (envelope-from ian@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 A30527DFEC; Sun, 18 Mar 2018 17:47:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 9D028239E2; Sun, 18 Mar 2018 17:47:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IHlveq003012; Sun, 18 Mar 2018 17:47:57 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IHlvBW003011; Sun, 18 Mar 2018 17:47:57 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181747.w2IHlvBW003011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 17:47:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331138 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 17:47:58 -0000 Author: ian Date: Sun Mar 18 17:47:57 2018 New Revision: 331138 URL: https://svnweb.freebsd.org/changeset/base/331138 Log: Make all internal routines return an int error status, and check the status at all call points. Combine the get_status and wait_for_ready routines, since waiting for ready is the only reason to ever get status. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 17:27:37 2018 (r331137) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 17:47:57 2018 (r331138) @@ -150,31 +150,25 @@ struct mx25l_flash_ident flash_devices[] = { { "gd25q64", 0xc8, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, }; -static uint8_t -mx25l_get_status(struct mx25l_softc *sc) +static int +mx25l_wait_for_device_ready(struct mx25l_softc *sc) { uint8_t txBuf[2], rxBuf[2]; struct spi_command cmd; int err; memset(&cmd, 0, sizeof(cmd)); - memset(txBuf, 0, sizeof(txBuf)); - memset(rxBuf, 0, sizeof(rxBuf)); - txBuf[0] = CMD_READ_STATUS; - cmd.tx_cmd = txBuf; - cmd.rx_cmd = rxBuf; - cmd.rx_cmd_sz = 2; - cmd.tx_cmd_sz = 2; - err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); - return (rxBuf[1]); -} + do { + txBuf[0] = CMD_READ_STATUS; + cmd.tx_cmd = txBuf; + cmd.rx_cmd = rxBuf; + cmd.rx_cmd_sz = 2; + cmd.tx_cmd_sz = 2; + err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); + } while (err == 0 && (rxBuf[1] & STATUS_WIP)); -static void -mx25l_wait_for_device_ready(struct mx25l_softc *sc) -{ - while ((mx25l_get_status(sc) & STATUS_WIP)) - continue; + return (err); } static struct mx25l_flash_ident* @@ -206,8 +200,7 @@ mx25l_get_device_ident(struct mx25l_softc *sc) manufacturer_id = rxBuf[1]; dev_id = (rxBuf[2] << 8) | (rxBuf[3]); - for (i = 0; - i < nitems(flash_devices); i++) { + for (i = 0; i < nitems(flash_devices); i++) { if ((flash_devices[i].manufacturer_id == manufacturer_id) && (flash_devices[i].device_id == dev_id)) return &flash_devices[i]; @@ -219,7 +212,7 @@ mx25l_get_device_ident(struct mx25l_softc *sc) return (NULL); } -static void +static int mx25l_set_writable(struct mx25l_softc *sc, int writable) { uint8_t txBuf[1], rxBuf[1]; @@ -236,16 +229,18 @@ mx25l_set_writable(struct mx25l_softc *sc, int writabl cmd.rx_cmd_sz = 1; cmd.tx_cmd_sz = 1; err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); + return (err); } -static void +static int mx25l_erase_cmd(struct mx25l_softc *sc, off_t sector, uint8_t ecmd) { uint8_t txBuf[5], rxBuf[5]; struct spi_command cmd; int err; - mx25l_set_writable(sc, 1); + if ((err = mx25l_set_writable(sc, 1)) != 0) + return (err); memset(&cmd, 0, sizeof(cmd)); memset(txBuf, 0, sizeof(txBuf)); @@ -268,8 +263,10 @@ mx25l_erase_cmd(struct mx25l_softc *sc, off_t sector, txBuf[2] = ((sector >> 8) & 0xff); txBuf[3] = (sector & 0xff); } - err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); - mx25l_wait_for_device_ready(sc); + if ((err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd)) != 0) + return (err); + err = mx25l_wait_for_device_ready(sc); + return (err); } static int @@ -301,8 +298,11 @@ mx25l_write(struct mx25l_softc *sc, off_t offset, cadd */ while (count != 0) { /* If we crossed a sector boundary, erase the next sector. */ - if (((offset) % sc->sc_sectorsize) == 0) - mx25l_erase_cmd(sc, offset, CMD_SECTOR_ERASE); + if (((offset) % sc->sc_sectorsize) == 0) { + err = mx25l_erase_cmd(sc, offset, CMD_SECTOR_ERASE); + if (err) + break; + } txBuf[0] = CMD_PAGE_PROGRAM; if (sc->sc_flags & FL_ENABLE_4B_ADDR) { @@ -328,11 +328,15 @@ mx25l_write(struct mx25l_softc *sc, off_t offset, cadd * Each completed write operation resets WEL (write enable * latch) to disabled state, so we re-enable it here. */ - mx25l_wait_for_device_ready(sc); - mx25l_set_writable(sc, 1); + if ((err = mx25l_wait_for_device_ready(sc)) != 0) + break; + if ((err = mx25l_set_writable(sc, 1)) != 0) + break; err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); - mx25l_wait_for_device_ready(sc); + if (err != 0) + break; + err = mx25l_wait_for_device_ready(sc); if (err) break; @@ -390,7 +394,6 @@ mx25l_read(struct mx25l_softc *sc, off_t offset, caddr cmd.rx_data_sz = count; err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); - return (err); } @@ -412,10 +415,9 @@ mx25l_set_4b_mode(struct mx25l_softc *sc, uint8_t comm txBuf[0] = command; - err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd); + if ((err = SPIBUS_TRANSFER(sc->sc_parent, sc->sc_dev, &cmd)) == 0) + err = mx25l_wait_for_device_ready(sc); - mx25l_wait_for_device_ready(sc); - return (err); } @@ -461,6 +463,7 @@ mx25l_attach(device_t dev) { struct mx25l_softc *sc; struct mx25l_flash_ident *ident; + int err; sc = device_get_softc(dev); sc->sc_dev = dev; @@ -472,8 +475,17 @@ mx25l_attach(device_t dev) if (ident == NULL) return (ENXIO); - mx25l_wait_for_device_ready(sc); + if ((err = mx25l_wait_for_device_ready(sc)) != 0) + return (err); + if (sc->sc_flags & FL_ENABLE_4B_ADDR) { + if ((err = mx25l_set_4b_mode(sc, CMD_ENTER_4B_MODE)) != 0) + return (err); + } else if (sc->sc_flags & FL_DISABLE_4B_ADDR) { + if ((err = mx25l_set_4b_mode(sc, CMD_EXIT_4B_MODE)) != 0) + return (err); + } + sc->sc_disk = disk_alloc(); sc->sc_disk->d_open = mx25l_open; sc->sc_disk->d_close = mx25l_close; @@ -491,13 +503,7 @@ mx25l_attach(device_t dev) sc->sc_sectorsize = ident->sectorsize; sc->sc_flags = ident->flags; - if (sc->sc_flags & FL_ENABLE_4B_ADDR) - mx25l_set_4b_mode(sc, CMD_ENTER_4B_MODE); - - if (sc->sc_flags & FL_DISABLE_4B_ADDR) - mx25l_set_4b_mode(sc, CMD_EXIT_4B_MODE); - - /* NB: use stripesize to hold the erase/region size for RedBoot */ + /* NB: use stripesize to hold the erase/region size for RedBoot */ sc->sc_disk->d_stripesize = ident->sectorsize; disk_create(sc->sc_disk, DISK_VERSION); From owner-svn-src-head@freebsd.org Sun Mar 18 18:37:47 2018 Return-Path: Delivered-To: svn-src-head@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 CB4CFF423AD; Sun, 18 Mar 2018 18:37:47 +0000 (UTC) (envelope-from ian@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 7F74E801AC; Sun, 18 Mar 2018 18:37:47 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 79E672421F; Sun, 18 Mar 2018 18:37:47 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IIblJM027803; Sun, 18 Mar 2018 18:37:47 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IIblcd027802; Sun, 18 Mar 2018 18:37:47 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181837.w2IIblcd027802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 18:37:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331139 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331139 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 18:37:48 -0000 Author: ian Date: Sun Mar 18 18:37:47 2018 New Revision: 331139 URL: https://svnweb.freebsd.org/changeset/base/331139 Log: Add support for 4K and 32K erase block sizes. Many of the supported chips have these flags set in the ident table, but there was no code to support using the smaller erase sizes. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 17:47:57 2018 (r331138) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 18:37:47 2018 (r331139) @@ -84,7 +84,7 @@ struct mx25l_softc device_t sc_parent; uint8_t sc_manufacturer_id; uint16_t sc_device_id; - unsigned int sc_sectorsize; + unsigned int sc_erasesize; struct mtx sc_mtx; struct disk *sc_disk; struct proc *sc_p; @@ -233,7 +233,7 @@ mx25l_set_writable(struct mx25l_softc *sc, int writabl } static int -mx25l_erase_cmd(struct mx25l_softc *sc, off_t sector, uint8_t ecmd) +mx25l_erase_cmd(struct mx25l_softc *sc, off_t sector) { uint8_t txBuf[5], rxBuf[5]; struct spi_command cmd; @@ -246,9 +246,16 @@ mx25l_erase_cmd(struct mx25l_softc *sc, off_t sector, memset(txBuf, 0, sizeof(txBuf)); memset(rxBuf, 0, sizeof(rxBuf)); - txBuf[0] = ecmd; cmd.tx_cmd = txBuf; cmd.rx_cmd = rxBuf; + + if (sc->sc_flags & FL_ERASE_4K) + txBuf[0] = CMD_BLOCK_4K_ERASE; + else if (sc->sc_flags & FL_ERASE_32K) + txBuf[0] = CMD_BLOCK_32K_ERASE; + else + txBuf[0] = CMD_SECTOR_ERASE; + if (sc->sc_flags & FL_ENABLE_4B_ADDR) { cmd.rx_cmd_sz = 5; cmd.tx_cmd_sz = 5; @@ -289,7 +296,7 @@ mx25l_write(struct mx25l_softc *sc, off_t offset, cadd * Writes must be aligned to the erase sectorsize, since blocks are * fully erased before they're written to. */ - if (count % sc->sc_sectorsize != 0 || offset % sc->sc_sectorsize != 0) + if (count % sc->sc_erasesize != 0 || offset % sc->sc_erasesize != 0) return (EIO); /* @@ -298,8 +305,8 @@ mx25l_write(struct mx25l_softc *sc, off_t offset, cadd */ while (count != 0) { /* If we crossed a sector boundary, erase the next sector. */ - if (((offset) % sc->sc_sectorsize) == 0) { - err = mx25l_erase_cmd(sc, offset, CMD_SECTOR_ERASE); + if (((offset) % sc->sc_erasesize) == 0) { + err = mx25l_erase_cmd(sc, offset); if (err) break; } @@ -478,6 +485,15 @@ mx25l_attach(device_t dev) if ((err = mx25l_wait_for_device_ready(sc)) != 0) return (err); + sc->sc_flags = ident->flags; + + if (sc->sc_flags & FL_ERASE_4K) + sc->sc_erasesize = 4 * 1024; + else if (sc->sc_flags & FL_ERASE_32K) + sc->sc_erasesize = 32 * 1024; + else + sc->sc_erasesize = ident->sectorsize; + if (sc->sc_flags & FL_ENABLE_4B_ADDR) { if ((err = mx25l_set_4b_mode(sc, CMD_ENTER_4B_MODE)) != 0) return (err); @@ -497,14 +513,9 @@ mx25l_attach(device_t dev) sc->sc_disk->d_maxsize = DFLTPHYS; sc->sc_disk->d_sectorsize = MX25L_SECTORSIZE; sc->sc_disk->d_mediasize = ident->sectorsize * ident->sectorcount; + sc->sc_disk->d_stripesize = sc->sc_erasesize; sc->sc_disk->d_unit = device_get_unit(sc->sc_dev); sc->sc_disk->d_dump = NULL; /* NB: no dumps */ - /* Sectorsize for erase operations */ - sc->sc_sectorsize = ident->sectorsize; - sc->sc_flags = ident->flags; - - /* NB: use stripesize to hold the erase/region size for RedBoot */ - sc->sc_disk->d_stripesize = ident->sectorsize; disk_create(sc->sc_disk, DISK_VERSION); bioq_init(&sc->sc_bio_queue); From owner-svn-src-head@freebsd.org Sun Mar 18 18:50:49 2018 Return-Path: Delivered-To: svn-src-head@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 21DA1F46635; Sun, 18 Mar 2018 18:50:49 +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 BF71780A11; Sun, 18 Mar 2018 18:50:48 +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 B6D9A244B7; Sun, 18 Mar 2018 18:50:48 +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 w2IIomfa033163; Sun, 18 Mar 2018 18:50:48 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IIom80033162; Sun, 18 Mar 2018 18:50:48 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803181850.w2IIom80033162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 18 Mar 2018 18:50:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331140 - head/stand X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand X-SVN-Commit-Revision: 331140 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 18:50:49 -0000 Author: imp Date: Sun Mar 18 18:50:48 2018 New Revision: 331140 URL: https://svnweb.freebsd.org/changeset/base/331140 Log: Don't add links or cleanfiles for NO_OBJ case, in addition to not creating them. Move them under the if after the all: target. They are just defines, so it doesn't really matter where we have them. MFC After: 3 days Modified: head/stand/defs.mk Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Sun Mar 18 18:37:47 2018 (r331139) +++ head/stand/defs.mk Sun Mar 18 18:50:48 2018 (r331140) @@ -152,6 +152,9 @@ CFLAGS+= -mlittle-endian # Make sure we use the machine link we're about to create CFLAGS+=-I. +all: ${PROG} + +.if !defined(NO_OBJ) _ILINKS=machine .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" _ILINKS+=${MACHINE_CPUARCH} @@ -161,9 +164,6 @@ _ILINKS+=x86 .endif CLEANFILES+=${_ILINKS} -all: ${PROG} - -.if !defined(NO_OBJ) beforedepend: ${_ILINKS} beforebuild: ${_ILINKS} @@ -172,7 +172,7 @@ beforebuild: ${_ILINKS} .for _link in ${_ILINKS} .if !exists(${.OBJDIR}/${_link}) ${OBJS}: ${_link} -.endif +.endif # _link exists .endfor .NOPATH: ${_ILINKS} @@ -191,5 +191,5 @@ ${_ILINKS}: path=`(cd $$path && /bin/pwd)` ; \ ${ECHO} ${.TARGET:T} "->" $$path ; \ ln -fhs $$path ${.TARGET:T} -.endif +.endif # !NO_OBJ .endif # __BOOT_DEFS_MK__ From owner-svn-src-head@freebsd.org Sun Mar 18 18:58:48 2018 Return-Path: Delivered-To: svn-src-head@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 2AD1DF4A3C6; Sun, 18 Mar 2018 18:58:48 +0000 (UTC) (envelope-from ian@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 CE72D811EC; Sun, 18 Mar 2018 18:58:47 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 C969124538; Sun, 18 Mar 2018 18:58:47 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IIwl5Y037830; Sun, 18 Mar 2018 18:58:47 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IIwlg8037829; Sun, 18 Mar 2018 18:58:47 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181858.w2IIwlg8037829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 18:58:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331141 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331141 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 18:58:48 -0000 Author: ian Date: Sun Mar 18 18:58:47 2018 New Revision: 331141 URL: https://svnweb.freebsd.org/changeset/base/331141 Log: Add the device/chip type to the disk d_descr field, and print more info about the chip including the erase block size at attach time. Also add myself to the copyrights since at this point svn blame would point to me as the culprit for much of this. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 18:50:48 2018 (r331140) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 18:58:47 2018 (r331141) @@ -3,6 +3,7 @@ * * Copyright (c) 2006 M. Warner Losh. All rights reserved. * Copyright (c) 2009 Oleksandr Tymoshenko. All rights reserved. + * Copyright (c) 2018 Ian Lepore. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -516,6 +517,8 @@ mx25l_attach(device_t dev) sc->sc_disk->d_stripesize = sc->sc_erasesize; sc->sc_disk->d_unit = device_get_unit(sc->sc_dev); sc->sc_disk->d_dump = NULL; /* NB: no dumps */ + strlcpy(sc->sc_disk->d_descr, ident->name, + sizeof(sc->sc_disk->d_descr)); disk_create(sc->sc_disk, DISK_VERSION); bioq_init(&sc->sc_bio_queue); @@ -523,8 +526,12 @@ mx25l_attach(device_t dev) kproc_create(&mx25l_task, sc, &sc->sc_p, 0, 0, "task: mx25l flash"); sc->sc_taskstate = TSTATE_RUNNING; - device_printf(sc->sc_dev, "%s, sector %d bytes, %d sectors\n", - ident->name, ident->sectorsize, ident->sectorcount); + device_printf(sc->sc_dev, + "device type %s, size %dK in %d sectors of %dK, erase size %dK\n", + ident->name, + ident->sectorcount * ident->sectorsize / 1024, + ident->sectorcount, ident->sectorsize / 1024, + sc->sc_erasesize / 1024); return (0); } From owner-svn-src-head@freebsd.org Sun Mar 18 19:50:34 2018 Return-Path: Delivered-To: svn-src-head@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 00C1AF4E865; Sun, 18 Mar 2018 19:50:34 +0000 (UTC) (envelope-from oshogbo@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 A0595837AB; Sun, 18 Mar 2018 19:50:33 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 981C024D36; Sun, 18 Mar 2018 19:50:33 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IJoXh4063015; Sun, 18 Mar 2018 19:50:33 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IJoXRT063012; Sun, 18 Mar 2018 19:50:33 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201803181950.w2IJoXRT063012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Mar 2018 19:50:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331146 - head/lib/libcasper/services/cap_grp X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_grp X-SVN-Commit-Revision: 331146 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 19:50:34 -0000 Author: oshogbo Date: Sun Mar 18 19:50:32 2018 New Revision: 331146 URL: https://svnweb.freebsd.org/changeset/base/331146 Log: The gids argument can be declared as const. We don't modified it in this function. Modified: head/lib/libcasper/services/cap_grp/cap_grp.3 head/lib/libcasper/services/cap_grp/cap_grp.c head/lib/libcasper/services/cap_grp/cap_grp.h Modified: head/lib/libcasper/services/cap_grp/cap_grp.3 ============================================================================== --- head/lib/libcasper/services/cap_grp/cap_grp.3 Sun Mar 18 19:34:30 2018 (r331145) +++ head/lib/libcasper/services/cap_grp/cap_grp.3 Sun Mar 18 19:50:32 2018 (r331146) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2018 +.Dd March 18, 2018 .Dt CAP_GRP 3 .Os .Sh NAME @@ -70,7 +70,7 @@ .Ft int .Fn cap_grp_limit_fields "cap_channel_t *chan" "const char * const *fields" "size_t nfields" .Ft int -.Fn cap_grp_limit_groups "cap_channel_t *chan" "const char * const *names" "size_t nnames" "gid_t *gids" "size_t ngids" +.Fn cap_grp_limit_groups "cap_channel_t *chan" "const char * const *names" "size_t nnames" "const gid_t *gids" "size_t ngids" .Sh DESCRIPTION The functions .Fn cap_getgrent , @@ -163,7 +163,7 @@ casper service and uses it to get a group name. cap_channel_t *capcas, *capgrp; const char *cmds[] = { "getgrgid" }; const char *fields[] = { "gr_name" }; -gid_t gid[] = { 1 }; +const gid_t gid[] = { 1 }; struct group *group; /* Open capability to Casper. */ Modified: head/lib/libcasper/services/cap_grp/cap_grp.c ============================================================================== --- head/lib/libcasper/services/cap_grp/cap_grp.c Sun Mar 18 19:34:30 2018 (r331145) +++ head/lib/libcasper/services/cap_grp/cap_grp.c Sun Mar 18 19:50:32 2018 (r331146) @@ -410,7 +410,7 @@ cap_grp_limit_fields(cap_channel_t *chan, const char * int cap_grp_limit_groups(cap_channel_t *chan, const char * const *names, - size_t nnames, gid_t *gids, size_t ngids) + size_t nnames, const gid_t *gids, size_t ngids) { nvlist_t *limits, *groups; unsigned int i; Modified: head/lib/libcasper/services/cap_grp/cap_grp.h ============================================================================== --- head/lib/libcasper/services/cap_grp/cap_grp.h Sun Mar 18 19:34:30 2018 (r331145) +++ head/lib/libcasper/services/cap_grp/cap_grp.h Sun Mar 18 19:50:32 2018 (r331146) @@ -57,7 +57,7 @@ int cap_grp_limit_cmds(cap_channel_t *chan, const char int cap_grp_limit_fields(cap_channel_t *chan, const char * const *fields, size_t nfields); int cap_grp_limit_groups(cap_channel_t *chan, const char * const *names, - size_t nnames, gid_t *gids, size_t ngids); + size_t nnames, const gid_t *gids, size_t ngids); #else #define cap_getgrent(chan) getgrent() #define cap_getgrnam(chan, name) getgrnam(name) From owner-svn-src-head@freebsd.org Sun Mar 18 22:26:08 2018 Return-Path: Delivered-To: svn-src-head@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 CFE3BF594FA for ; Sun, 18 Mar 2018 22:26:08 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-yw0-x230.google.com (mail-yw0-x230.google.com [IPv6:2607:f8b0:4002:c05::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F5CF6A157 for ; Sun, 18 Mar 2018 22:26:08 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: by mail-yw0-x230.google.com with SMTP id x17so10374750ywj.1 for ; Sun, 18 Mar 2018 15:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+Onsl0hVrIPTrfE4dLw25PSVHTaYW0ApRfEYzLBieFc=; b=K+k6uVtDExOq4v5CZ+IMbol+BkMDCQu0+O9L7bX73yKVj/SF3P/2YPOUOM7aRnOWg4 U7QQQUjgRA5JMAiCClAIbVhL48hgCzd0KOKkhLdDjwWrmKGb/+sLI0KOimyAXypYWI4Q norD6zXAdVp45I9iDNjhoQ5W2rsMkYxDjthDU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+Onsl0hVrIPTrfE4dLw25PSVHTaYW0ApRfEYzLBieFc=; b=baARZRi0Zmpc8zdBVGYWZ6JJ80fubet++CcLJtiQrYzNHMLslkcYM+HK6TXMhiw+gj k4oGlNVkHSQaE9sVbWkaHAyEBa7TiK5dTqp6PvMuKx7YO2km7Y/B2BEzHO3uTpN6rDLX xDi8QgoamUSRJ6XC+5SIpK8JNs/ze6ZrWabS+xKsM9poYknJXl4IYRaONlhDM5Lbms/i wgaXifeQnqTdnOOLGNHYFdXMKC1ynAre1F+X2ziA5wrK3QfnvoQPNOR84rFO62AfZo/u vO6HO9Y7H4EKL8Aq04g5BMu4wyDLOzMFueGXKR5e4og9IIbGzfqYJYeSMtckUHJqj35n Xkyg== X-Gm-Message-State: AElRT7Fl73HwajWfN5djlsswSq048mkj7ZRuHdK3LhQbt29rQtGOT7gp zgZnCBTGf3KBXaELUsdjFomofblPEFpU73IK8zvM9A== X-Google-Smtp-Source: AG47ELtImSRWypBKJCLrMvKUBRX/g+rPfMSQUfiWjsznPtD89pu9QmdIFeyFqQzaqSW95EjHQQEXnAZmmcmN92MKkw8= X-Received: by 10.129.120.130 with SMTP id t124mr5624721ywc.37.1521411967455; Sun, 18 Mar 2018 15:26:07 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:23d2:0:0:0:0:0 with HTTP; Sun, 18 Mar 2018 15:25:37 -0700 (PDT) In-Reply-To: <201706030242.v532gni4072040@repo.freebsd.org> References: <201706030242.v532gni4072040@repo.freebsd.org> From: Eitan Adler Date: Sun, 18 Mar 2018 15:25:37 -0700 Message-ID: Subject: Re: svn commit: r319510 - head/contrib/xz/src/liblzma/check To: Ed Maste Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2018 22:26:09 -0000 On 2 June 2017 at 19:42, Ed Maste wrote: > Author: emaste > Date: Sat Jun 3 02:42:49 2017 > New Revision: 319510 > URL: https://svnweb.freebsd.org/changeset/base/319510 > > Log: > xz: set noexec stack flag on FreeBSD Heya. Is this one safe to MFC ? -- Eitan Adler From owner-svn-src-head@freebsd.org Mon Mar 19 00:25:11 2018 Return-Path: Delivered-To: svn-src-head@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 AB300F61254; Mon, 19 Mar 2018 00:25:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 5E3CB6F2F0; Mon, 19 Mar 2018 00:25:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CA1727829; Mon, 19 Mar 2018 00:25:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J0PBmj004539; Mon, 19 Mar 2018 00:25:11 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J0PBqV004538; Mon, 19 Mar 2018 00:25:11 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201803190025.w2J0PBqV004538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 19 Mar 2018 00:25:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331153 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 331153 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 00:25:11 -0000 Author: mjg Date: Mon Mar 19 00:25:10 2018 New Revision: 331153 URL: https://svnweb.freebsd.org/changeset/base/331153 Log: Update my calendar entry to be more specific now that UTF8 turns out to be fine Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Sun Mar 18 22:55:07 2018 (r331152) +++ head/usr.bin/calendar/calendars/calendar.freebsd Mon Mar 19 00:25:10 2018 (r331153) @@ -251,7 +251,7 @@ 06/30 Guido van Rooij born in Best, Noord-Brabant, the Netherlands, 1965 06/30 Second quarter status reports are due on 07/15 07/01 Matthew Dillon born in San Francisco, California, United States, 1966 -07/01 Mateusz Guzik born in Nowy Targ, Poland, 1986 +07/01 Mateusz Guzik born in DoÅ‚ki Górne, Poland, 1986 07/02 Mark Christopher Ovens born in Preston, Lancashire, United Kingdom, 1958 07/02 Vasil Venelinov Dimov born in Shumen, Bulgaria, 1982 07/04 Motoyuki Konno born in Musashino, Tokyo, Japan, 1969 From owner-svn-src-head@freebsd.org Mon Mar 19 01:05:09 2018 Return-Path: Delivered-To: svn-src-head@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 B654AF63C19; Mon, 19 Mar 2018 01:05:09 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 553547097C; Mon, 19 Mar 2018 01:05:08 +0000 (UTC) (envelope-from des@des.no) Received: from desk.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id 59FC6DF72; Mon, 19 Mar 2018 01:05:02 +0000 (UTC) Received: by desk.des.no (Postfix, from userid 1001) id 2B60760D6C; Mon, 19 Mar 2018 01:05:02 +0000 (UTC) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331049 - in head/sys: conf crypto/chacha20 modules modules/chacha20 References: <201803160711.w2G7Bs4Z021500@repo.freebsd.org> Date: Mon, 19 Mar 2018 02:05:02 +0100 In-Reply-To: <201803160711.w2G7Bs4Z021500@repo.freebsd.org> (Conrad Meyer's message of "Fri, 16 Mar 2018 07:11:54 +0000 (UTC)") Message-ID: <86woy87u4h.fsf@desk.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 01:05:09 -0000 Conrad Meyer writes: > Log: > Garbage collect unused chacha20 code This is wrong. You should have asked me before committing. Please revert and contact me off-list. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@freebsd.org Mon Mar 19 01:24:16 2018 Return-Path: Delivered-To: svn-src-head@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 2781AF64CF3; Mon, 19 Mar 2018 01:24:16 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f46.google.com (mail-it0-f46.google.com [209.85.214.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA5A971371; Mon, 19 Mar 2018 01:24:15 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f46.google.com with SMTP id e195-v6so8348483ita.5; Sun, 18 Mar 2018 18:24:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=cQtlQ+pNXSCyD9cTYW2gjud+zlJPLHmqK/a2dlgZsL0=; b=VZyknKFC5zmNfAgwf6Nb45hvsXYVpDmIgrgzZLCgz7JgMZS0Zm3vWvqKP0yrkBUX1v mBb3S9uV33LKnpcnFkotvTWDB3ZuFfULVg2WWN32t46X1yrkaWaqgmgT8LzGbbfucAaX pw6W0zysOV5/QR2ZMSNbsr+lpTLYjTUSEG52j3yfW2GEAVFpei7oXhB6X/mEZR72csV1 3fD2atn1SyNbhJHdG5tDG3Vtua2aX0Atxys4L2uevRdWsleBgVtUQ4LKHCFuOlM0O5ex TnodIcGtmHcsTnAgFWnzHwRMxTy9X6sJol0QVJIP39Chu5XyFLCIplRzkcje2pRHGO// 6JZA== X-Gm-Message-State: AElRT7HmIIDSqlldAHwj9XHD14F/0t2FG5MpNjLSX3s83X2Lz4qv+HOd Wv+YrWrl3sSrTVg9gu7Y0S/T4zEI X-Google-Smtp-Source: AG47ELv5Ywlug8Dqmk6UbtGoWLbBukDJI0tx26nptXK/EQfkJF8Jz+QFLHblL7tDGAmQjitch9X/ng== X-Received: by 2002:a24:aa06:: with SMTP id b6-v6mr10196179itf.148.1521422649369; Sun, 18 Mar 2018 18:24:09 -0700 (PDT) Received: from mail-it0-f53.google.com (mail-it0-f53.google.com. [209.85.214.53]) by smtp.gmail.com with ESMTPSA id 202sm7381091iti.19.2018.03.18.18.24.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Mar 2018 18:24:09 -0700 (PDT) Received: by mail-it0-f53.google.com with SMTP id y20-v6so8257925itc.5; Sun, 18 Mar 2018 18:24:09 -0700 (PDT) X-Received: by 2002:a24:82c1:: with SMTP id t184-v6mr10616860itd.61.1521422649096; Sun, 18 Mar 2018 18:24:09 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.153.132 with HTTP; Sun, 18 Mar 2018 18:24:08 -0700 (PDT) In-Reply-To: <86woy87u4h.fsf@desk.des.no> References: <201803160711.w2G7Bs4Z021500@repo.freebsd.org> <86woy87u4h.fsf@desk.des.no> From: Conrad Meyer Date: Sun, 18 Mar 2018 18:24:08 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331049 - in head/sys: conf crypto/chacha20 modules modules/chacha20 To: =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 01:24:16 -0000 On Sun, Mar 18, 2018 at 6:05 PM, Dag-Erling Sm=C3=B8rgrav wrot= e: > Conrad Meyer writes: >> Log: >> Garbage collect unused chacha20 code > > This is wrong. Please elaborate a little bit on why you think so. Conrad From owner-svn-src-head@freebsd.org Mon Mar 19 01:57:32 2018 Return-Path: Delivered-To: svn-src-head@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 4791EF66AC9; Mon, 19 Mar 2018 01:57:32 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id D067A72324; Mon, 19 Mar 2018 01:57:31 +0000 (UTC) (envelope-from des@des.no) Received: from desk.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id CDFECDFC7; Mon, 19 Mar 2018 01:57:30 +0000 (UTC) Received: by desk.des.no (Postfix, from userid 1001) id B3AE360D79; Mon, 19 Mar 2018 01:57:30 +0000 (UTC) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Conrad Meyer Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331049 - in head/sys: conf crypto/chacha20 modules modules/chacha20 References: <201803160711.w2G7Bs4Z021500@repo.freebsd.org> <86woy87u4h.fsf@desk.des.no> Date: Mon, 19 Mar 2018 02:57:30 +0100 In-Reply-To: (Conrad Meyer's message of "Sun, 18 Mar 2018 18:24:08 -0700") Message-ID: <86o9jk7rp1.fsf@desk.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 01:57:32 -0000 Conrad Meyer writes: > Dag-Erling Sm=C3=B8rgrav writes: > > This is wrong. > Please elaborate a little bit on why you think so. Answered off-list. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@freebsd.org Mon Mar 19 05:49:27 2018 Return-Path: Delivered-To: svn-src-head@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 E6A5EF5306F; Mon, 19 Mar 2018 05:49:26 +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 933907BF7F; Mon, 19 Mar 2018 05:49:26 +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 8A085293D; Mon, 19 Mar 2018 05:49:26 +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 w2J5nQiM065931; Mon, 19 Mar 2018 05:49:26 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J5nQe8065930; Mon, 19 Mar 2018 05:49:26 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201803190549.w2J5nQe8065930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 19 Mar 2018 05:49:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331180 - head/usr.sbin/rpcbind X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/usr.sbin/rpcbind X-SVN-Commit-Revision: 331180 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 05:49:27 -0000 Author: delphij Date: Mon Mar 19 05:49:26 2018 New Revision: 331180 URL: https://svnweb.freebsd.org/changeset/base/331180 Log: Plug a possible memory leak. MFC after: 2 weeks Modified: head/usr.sbin/rpcbind/rpcbind.c Modified: head/usr.sbin/rpcbind/rpcbind.c ============================================================================== --- head/usr.sbin/rpcbind/rpcbind.c Mon Mar 19 04:16:37 2018 (r331179) +++ head/usr.sbin/rpcbind/rpcbind.c Mon Mar 19 05:49:26 2018 (r331180) @@ -565,6 +565,8 @@ init_transport(struct netconfig *nconf) pml->pml_map.pm_port = PMAPPORT; if (strcmp(nconf->nc_proto, NC_TCP) == 0) { if (tcptrans[0]) { + free(pml); + pml = NULL; syslog(LOG_ERR, "cannot have more than one TCP transport"); goto error; From owner-svn-src-head@freebsd.org Mon Mar 19 10:50:28 2018 Return-Path: Delivered-To: svn-src-head@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 ECC48F64F81; Mon, 19 Mar 2018 10:50:27 +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 91E4F69478; Mon, 19 Mar 2018 10:50:27 +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 867A65AE7; Mon, 19 Mar 2018 10:50:27 +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 w2JAoRe8018396; Mon, 19 Mar 2018 10:50:27 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JAoR1I018395; Mon, 19 Mar 2018 10:50:27 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201803191050.w2JAoR1I018395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 19 Mar 2018 10:50:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331203 - head/sbin/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sbin/ipfw X-SVN-Commit-Revision: 331203 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 10:50:28 -0000 Author: ae Date: Mon Mar 19 10:50:27 2018 New Revision: 331203 URL: https://svnweb.freebsd.org/changeset/base/331203 Log: Remove note that `fwd tablearg` is supported only by IPv4. IPv6 is supported too. MFC after: 1 week Modified: head/sbin/ipfw/ipfw.8 Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Mon Mar 19 09:54:16 2018 (r331202) +++ head/sbin/ipfw/ipfw.8 Mon Mar 19 10:50:27 2018 (r331203) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 12, 2018 +.Dd March 19, 2018 .Dt IPFW 8 .Os .Sh NAME @@ -825,7 +825,7 @@ The search terminates. Change the next-hop on matching packets to .Ar ipaddr , which can be an IP address or a host name. -For IPv4, the next hop can also be supplied by the last table +The next hop can also be supplied by the last table looked up for the packet by using the .Cm tablearg keyword instead of an explicit address. From owner-svn-src-head@freebsd.org Mon Mar 19 13:51:34 2018 Return-Path: Delivered-To: svn-src-head@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 5D8BDF4E56A; Mon, 19 Mar 2018 13:51:34 +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 1024770328; Mon, 19 Mar 2018 13:51: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 0B03F7757; Mon, 19 Mar 2018 13:51: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 w2JDpXmZ010982; Mon, 19 Mar 2018 13:51:33 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JDpXWq010981; Mon, 19 Mar 2018 13:51:33 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803191351.w2JDpXWq010981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Mar 2018 13:51:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331204 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 331204 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 13:51:34 -0000 Author: hselasky Date: Mon Mar 19 13:51:33 2018 New Revision: 331204 URL: https://svnweb.freebsd.org/changeset/base/331204 Log: Remove redundant integer cast in ibcore. The "ref_count" field already has integer type. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_fmr_pool.c Modified: head/sys/ofed/drivers/infiniband/core/ib_fmr_pool.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_fmr_pool.c Mon Mar 19 10:50:27 2018 (r331203) +++ head/sys/ofed/drivers/infiniband/core/ib_fmr_pool.c Mon Mar 19 13:51:33 2018 (r331204) @@ -155,7 +155,7 @@ static void ib_fmr_batch_release(struct ib_fmr_pool *p #ifdef DEBUG if (fmr->ref_count !=0) { pr_warn(PFX "Unmapping FMR %p with ref count %d\n", - fmr, (int)fmr->ref_count); + fmr, fmr->ref_count); } #endif } From owner-svn-src-head@freebsd.org Mon Mar 19 15:07:16 2018 Return-Path: Delivered-To: svn-src-head@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 247E5F535E6; Mon, 19 Mar 2018 15:07:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 C6E967370F; Mon, 19 Mar 2018 15:07:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1E411023C; Mon, 19 Mar 2018 15:07:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JF7FCh047484; Mon, 19 Mar 2018 15:07:15 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JF7Fle047483; Mon, 19 Mar 2018 15:07:15 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803191507.w2JF7Fle047483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Mar 2018 15:07:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331207 - head/stand/defaults X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/stand/defaults X-SVN-Commit-Revision: 331207 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 15:07:16 -0000 Author: emaste Date: Mon Mar 19 15:07:15 2018 New Revision: 331207 URL: https://svnweb.freebsd.org/changeset/base/331207 Log: loader.conf: remove obsolete non-x86 beastie menu statement As of r330005 the same loader.conf defaults are used on all platforms. Sponsored by: The FreeBSD Foundation Modified: head/stand/defaults/loader.conf.5 Modified: head/stand/defaults/loader.conf.5 ============================================================================== --- head/stand/defaults/loader.conf.5 Mon Mar 19 14:28:58 2018 (r331206) +++ head/stand/defaults/loader.conf.5 Mon Mar 19 15:07:15 2018 (r331207) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd March 7, 2018 +.Dd March 19, 2018 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -249,7 +249,6 @@ be displayed. If set to .Dq YES , the beastie boot menu will be skipped. -The beastie boot menu is always skipped if running non-x86 hardware. .It Va loader_logo Pq Dq Li orbbw Selects a desired logo in the beastie boot menu. Possible values are: From owner-svn-src-head@freebsd.org Mon Mar 19 15:11:11 2018 Return-Path: Delivered-To: svn-src-head@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 5CB66F539AD; Mon, 19 Mar 2018 15:11:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 0FCEE73A41; Mon, 19 Mar 2018 15:11:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AC0710266; Mon, 19 Mar 2018 15:11:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JFBAtv047732; Mon, 19 Mar 2018 15:11:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JFBAZM047729; Mon, 19 Mar 2018 15:11:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803191511.w2JFBAZM047729@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Mar 2018 15:11:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331208 - in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Commit-Revision: 331208 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 15:11:11 -0000 Author: emaste Date: Mon Mar 19 15:11:10 2018 New Revision: 331208 URL: https://svnweb.freebsd.org/changeset/base/331208 Log: linux*_sysvec.c: rationalize whitespace and comments There's a fair amount of duplication between MD linuxulator files. Make indentation and comments consistent between the three versions of linux_sysvec.c to reduce diffs when comparing them. Sponsored by: Turing Robotic Industries Inc. Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Mon Mar 19 15:07:15 2018 (r331207) +++ head/sys/amd64/linux/linux_sysvec.c Mon Mar 19 15:11:10 2018 (r331208) @@ -126,6 +126,7 @@ static void linux_vdso_install(void *param); static void linux_vdso_deinstall(void *param); static void linux_set_syscall_retval(struct thread *td, int error); static int linux_fetch_syscall_args(struct thread *td); +static int exec_linux_imgact_try(struct image_params *iparams); static void linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); static int linux_vsyscall(struct thread *td); @@ -669,8 +670,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse * be able to modify the interpreter path. We only do this if a Linux * binary is doing the exec, so we do not create an EXEC module for it. */ -static int exec_linux_imgact_try(struct image_params *iparams); - static int exec_linux_imgact_try(struct image_params *imgp) { @@ -685,15 +684,14 @@ exec_linux_imgact_try(struct image_params *imgp) */ if (((const short *)head)[0] == SHELLMAGIC) { /* - * Run our normal shell image activator. If it succeeds - * attempt to use the alternate path for the interpreter. - * If an alternate path is found, use our stringspace - * to store it. + * Run our normal shell image activator. If it succeeds then + * attempt to use the alternate path for the interpreter. If + * an alternate path is found, use our stringspace to store it. */ if ((error = exec_shell_imgact(imgp)) == 0) { linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), - imgp->interpreter_name, UIO_SYSSPACE, - &rpath, 0, AT_FDCWD); + imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, + AT_FDCWD); if (rpath != NULL) imgp->args->fname_buf = imgp->interpreter_name = rpath; Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Mon Mar 19 15:07:15 2018 (r331207) +++ head/sys/amd64/linux32/linux32_sysvec.c Mon Mar 19 15:11:10 2018 (r331208) @@ -124,6 +124,7 @@ static int elf_linux_fixup(register_t **stack_base, struct image_params *iparams); static register_t *linux_copyout_strings(struct image_params *imgp); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); +static int exec_linux_imgact_try(struct image_params *iparams); static void exec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack); static void linux32_fixlimit(struct rlimit *rl, int which); @@ -722,8 +723,6 @@ linux32_fetch_syscall_args(struct thread *td) * be able to modify the interpreter path. We only do this if a Linux * binary is doing the exec, so we do not create an EXEC module for it. */ -static int exec_linux_imgact_try(struct image_params *iparams); - static int exec_linux_imgact_try(struct image_params *imgp) { @@ -732,16 +731,16 @@ exec_linux_imgact_try(struct image_params *imgp) int error = -1; /* - * The interpreter for shell scripts run from a Linux binary needs - * to be located in /compat/linux if possible in order to recursively - * maintain Linux path emulation. - */ + * The interpreter for shell scripts run from a Linux binary needs + * to be located in /compat/linux if possible in order to recursively + * maintain Linux path emulation. + */ if (((const short *)head)[0] == SHELLMAGIC) { /* - * Run our normal shell image activator. If it succeeds attempt - * to use the alternate path for the interpreter. If an - * alternate * path is found, use our stringspace to store it. - */ + * Run our normal shell image activator. If it succeeds then + * attempt to use the alternate path for the interpreter. If + * an alternate path is found, use our stringspace to store it. + */ if ((error = exec_shell_imgact(imgp)) == 0) { linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Mon Mar 19 15:07:15 2018 (r331207) +++ head/sys/i386/linux/linux_sysvec.c Mon Mar 19 15:11:10 2018 (r331208) @@ -112,6 +112,7 @@ static int linux_fixup(register_t **stack_base, static int elf_linux_fixup(register_t **stack_base, struct image_params *iparams); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); +static int exec_linux_imgact_try(struct image_params *iparams); static void exec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack); static register_t *linux_copyout_strings(struct image_params *imgp); @@ -819,35 +820,34 @@ linux_fetch_syscall_args(struct thread *td) * be able to modify the interpreter path. We only do this if a Linux * binary is doing the exec, so we do not create an EXEC module for it. */ -static int exec_linux_imgact_try(struct image_params *iparams); - static int exec_linux_imgact_try(struct image_params *imgp) { - const char *head = (const char *)imgp->image_header; - char *rpath; - int error = -1; + const char *head = (const char *)imgp->image_header; + char *rpath; + int error = -1; - /* - * The interpreter for shell scripts run from a Linux binary needs - * to be located in /compat/linux if possible in order to recursively - * maintain Linux path emulation. - */ - if (((const short *)head)[0] == SHELLMAGIC) { - /* - * Run our normal shell image activator. If it succeeds attempt - * to use the alternate path for the interpreter. If an alternate - * path is found, use our stringspace to store it. - */ - if ((error = exec_shell_imgact(imgp)) == 0) { - linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), - imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, AT_FDCWD); - if (rpath != NULL) - imgp->args->fname_buf = - imgp->interpreter_name = rpath; - } - } - return (error); + /* + * The interpreter for shell scripts run from a Linux binary needs + * to be located in /compat/linux if possible in order to recursively + * maintain Linux path emulation. + */ + if (((const short *)head)[0] == SHELLMAGIC) { + /* + * Run our normal shell image activator. If it succeeds then + * attempt to use the alternate path for the interpreter. If + * an alternate path is found, use our stringspace to store it. + */ + if ((error = exec_shell_imgact(imgp)) == 0) { + linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), + imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, + AT_FDCWD); + if (rpath != NULL) + imgp->args->fname_buf = + imgp->interpreter_name = rpath; + } + } + return (error); } /* From owner-svn-src-head@freebsd.org Mon Mar 19 15:27:54 2018 Return-Path: Delivered-To: svn-src-head@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 55AECF54EDA; Mon, 19 Mar 2018 15:27:54 +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 0B43F74E95; Mon, 19 Mar 2018 15:27:54 +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 01AB010537; Mon, 19 Mar 2018 15:27:54 +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 w2JFRrbR058669; Mon, 19 Mar 2018 15:27:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JFRr7B058668; Mon, 19 Mar 2018 15:27:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803191527.w2JFRr7B058668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Mar 2018 15:27:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331209 - head X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 331209 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 15:27:54 -0000 Author: kevans Date: Mon Mar 19 15:27:53 2018 New Revision: 331209 URL: https://svnweb.freebsd.org/changeset/base/331209 Log: Add note to UPDATING about UEFI changes requiring loader(8) update These problems have only been observed with boards using U-Boot (e.g. ARM) where virtual addresses are already set in the memory map by the firmware and the firmware is expecting a call to SetVirtualAddressMap to be made. I refrain from mentioning this in the note because this could also be the case on some not-yet-tested firmware on amd64 and it's not a bad recommendation for the general case. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Mar 19 15:11:10 2018 (r331208) +++ head/UPDATING Mon Mar 19 15:27:53 2018 (r331209) @@ -51,6 +51,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20180319: + For UEFI systems: the UEFI loader(8), loader.efi, should be updated in + conjunction with installing a new kernel after r330868. The kernel, + after this revision, will be more lenient when mapping addresses for + UEFI Runtime Services and this may result in a kernel panic without the + corresponding loader(8) update. + 20180212: FreeBSD boot loader enhanced with Lua scripting. It's purely opt-in for now by building WITH_LOADER_LUA and WITHOUT_FORTH in /etc/src.conf. From owner-svn-src-head@freebsd.org Mon Mar 19 15:35:27 2018 Return-Path: Delivered-To: svn-src-head@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 4B298F557B9; Mon, 19 Mar 2018 15:35:27 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 EFE12754A6; Mon, 19 Mar 2018 15:35:26 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E588B106C3; Mon, 19 Mar 2018 15:35:26 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JFZQNd063333; Mon, 19 Mar 2018 15:35:26 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JFZQqU063332; Mon, 19 Mar 2018 15:35:26 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201803191535.w2JFZQqU063332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 19 Mar 2018 15:35:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331210 - head/sys/dts X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dts X-SVN-Commit-Revision: 331210 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 15:35:27 -0000 Author: manu Date: Mon Mar 19 15:35:26 2018 New Revision: 331210 URL: https://svnweb.freebsd.org/changeset/base/331210 Log: sys/dts: Remove arm64 from subdir as it no longer exists. r325987 removed the arm64 directory, remove it from SUBDIR too. Modified: head/sys/dts/Makefile Modified: head/sys/dts/Makefile ============================================================================== --- head/sys/dts/Makefile Mon Mar 19 15:27:53 2018 (r331209) +++ head/sys/dts/Makefile Mon Mar 19 15:35:26 2018 (r331210) @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR=arm arm64 mips powerpc +SUBDIR=arm mips powerpc .include From owner-svn-src-head@freebsd.org Mon Mar 19 15:43:04 2018 Return-Path: Delivered-To: svn-src-head@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 73C17F56020; Mon, 19 Mar 2018 15:43:04 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A73575BF6; Mon, 19 Mar 2018 15:43:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 9F28110A8BE; Mon, 19 Mar 2018 11:42:57 -0400 (EDT) From: John Baldwin To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331057 - head/sys/compat/linux Date: Fri, 16 Mar 2018 14:08:28 -0700 Message-ID: <1806390.PUHUxB7aSs@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201803161451.w2GEpl3T053141@repo.freebsd.org> References: <201803161451.w2GEpl3T053141@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 19 Mar 2018 11:42:57 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 15:43:04 -0000 On Friday, March 16, 2018 02:51:47 PM Ed Maste wrote: > Author: emaste > Date: Fri Mar 16 14:51:47 2018 > New Revision: 331057 > URL: https://svnweb.freebsd.org/changeset/base/331057 > > Log: > linux_errno.c: add newer errno values > > Also introduce a static assert to ensure the list is kept up to date. > > Sponsored by: Turing Robotic Industries Inc. Could you move the table to a header perhaps so it can also be shared with lib/libsysdecode/errno.c (which has another copy of this table)? -- John Baldwin From owner-svn-src-head@freebsd.org Mon Mar 19 15:48:32 2018 Return-Path: Delivered-To: svn-src-head@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 0BA1AF565ED; Mon, 19 Mar 2018 15:48:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 B3B7075F1A; Mon, 19 Mar 2018 15:48:31 +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 AA57810849; Mon, 19 Mar 2018 15:48:31 +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 w2JFmVkl068677; Mon, 19 Mar 2018 15:48:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JFmVGB068675; Mon, 19 Mar 2018 15:48:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803191548.w2JFmVGB068675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Mar 2018 15:48:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331211 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331211 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 15:48:32 -0000 Author: kevans Date: Mon Mar 19 15:48:31 2018 New Revision: 331211 URL: https://svnweb.freebsd.org/changeset/base/331211 Log: lualoader: Setup default color scheme if we're using colors The console may have been set for different colors before lualoader kicks in; notably, a black-on-white color scheme is not necessarily what we're expecting. While here, make color.default() a composition of color.escape() instead of rewriting the escape sequence to make it more obvious what it's achieving: a white-on-black color scheme with no attributes set. Reported by: emaste, whose eyes may rest easily Modified: head/stand/lua/color.lua head/stand/lua/loader.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Mon Mar 19 15:35:26 2018 (r331210) +++ head/stand/lua/color.lua Mon Mar 19 15:48:31 2018 (r331211) @@ -89,7 +89,7 @@ function color.default() if color.disabled then return "" end - return core.KEYSTR_CSI .. "0;37;40m" + return color.escape(color.WHITE, color.BLACK, color.DEFAULT) end function color.highlight(str) Modified: head/stand/lua/loader.lua ============================================================================== --- head/stand/lua/loader.lua Mon Mar 19 15:35:26 2018 (r331210) +++ head/stand/lua/loader.lua Mon Mar 19 15:48:31 2018 (r331211) @@ -34,6 +34,7 @@ -- Other modules will also need some of the functions it defines to safely -- execute loader commands. require("cli") +local color = require("color") local core = require("core") local config = require("config") local menu @@ -49,6 +50,11 @@ if result ~= nil then end config.load() +-- Our console may have been setup for a different color scheme before we get +-- here, so make sure we set the default. +if color.isEnabled() then + printc(color.default()) +end password.check() -- menu might be disabled if menu ~= nil then From owner-svn-src-head@freebsd.org Mon Mar 19 16:16:13 2018 Return-Path: Delivered-To: svn-src-head@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 22D38F5850B; Mon, 19 Mar 2018 16:16:13 +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 CA2DA775AE; Mon, 19 Mar 2018 16:16:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0DD110CE3; Mon, 19 Mar 2018 16:16:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JGGCE5083462; Mon, 19 Mar 2018 16:16:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JGGCid083460; Mon, 19 Mar 2018 16:16:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803191616.w2JGGCid083460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Mar 2018 16:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331212 - in head: etc/mtree stand/defaults X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: etc/mtree stand/defaults X-SVN-Commit-Revision: 331212 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 16:16:13 -0000 Author: kevans Date: Mon Mar 19 16:16:12 2018 New Revision: 331212 URL: https://svnweb.freebsd.org/changeset/base/331212 Log: Move /boot/overlays to /boot/dtb/overlays The former is fairly vague; these are FDT overlays to be applied to the running system, so /boot/dtb is a sensible location to put it without cluttering up /boot/dtb even further if desired. Modified: head/etc/mtree/BSD.root.dist head/stand/defaults/loader.conf Modified: head/etc/mtree/BSD.root.dist ============================================================================== --- head/etc/mtree/BSD.root.dist Mon Mar 19 15:48:31 2018 (r331211) +++ head/etc/mtree/BSD.root.dist Mon Mar 19 16:16:12 2018 (r331212) @@ -11,6 +11,8 @@ defaults .. dtb + overlays tags=package=runtime + .. .. firmware .. @@ -19,8 +21,6 @@ kernel .. modules - .. - overlays tags=package=runtime .. zfs .. Modified: head/stand/defaults/loader.conf ============================================================================== --- head/stand/defaults/loader.conf Mon Mar 19 15:48:31 2018 (r331211) +++ head/stand/defaults/loader.conf Mon Mar 19 16:16:12 2018 (r331212) @@ -80,7 +80,7 @@ bootenv_autolist="YES" # Auto populate the list of ZF #comconsole_speed="9600" # Set the current serial console speed #console="vidconsole" # A comma separated list of console(s) #currdev="disk1s1a" # Set the current device -module_path="/boot/modules;/boot/dtb;/boot/overlays" # Set the module search path +module_path="/boot/modules;/boot/dtb;/boot/dtb/overlays" # Set the module search path #prompt="\\${interpret}" # Set the command prompt #root_disk_unit="0" # Force the root disk unit number #rootdev="disk1s1a" # Set the root filesystem From owner-svn-src-head@freebsd.org Mon Mar 19 16:17:11 2018 Return-Path: Delivered-To: svn-src-head@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 C2D8EF58658; Mon, 19 Mar 2018 16:17:11 +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 1F5F377747; Mon, 19 Mar 2018 16:17:11 +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 1A3D510CE5; Mon, 19 Mar 2018 16:17:11 +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 w2JGHAMo083540; Mon, 19 Mar 2018 16:17:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JGHAkW083539; Mon, 19 Mar 2018 16:17:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803191617.w2JGHAkW083539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Mar 2018 16:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331213 - head/stand/defaults X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/defaults X-SVN-Commit-Revision: 331213 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 16:17:11 -0000 Author: kevans Date: Mon Mar 19 16:17:10 2018 New Revision: 331213 URL: https://svnweb.freebsd.org/changeset/base/331213 Log: Amend missed reference to /boot/overlays, moved to /boot/dtb/overlays Modified: head/stand/defaults/loader.conf.5 Modified: head/stand/defaults/loader.conf.5 ============================================================================== --- head/stand/defaults/loader.conf.5 Mon Mar 19 16:16:12 2018 (r331212) +++ head/stand/defaults/loader.conf.5 Mon Mar 19 16:17:10 2018 (r331213) @@ -284,7 +284,7 @@ that have no default value: .Bl -tag -width bootfile -offset indent .It Va fdt_overlays Specifies a comma-delimited list of FDT overlays to apply. -.Pa /boot/overlays +.Pa /boot/dtb/overlays is created by default for overlays to be placed in. .It Va kernels_autodetect If set to From owner-svn-src-head@freebsd.org Mon Mar 19 16:37:49 2018 Return-Path: Delivered-To: svn-src-head@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 13D84F59DE8; Mon, 19 Mar 2018 16:37:49 +0000 (UTC) (envelope-from lstewart@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 B2E4078566; Mon, 19 Mar 2018 16:37:48 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 A94B610FDC; Mon, 19 Mar 2018 16:37:48 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JGbmEO093563; Mon, 19 Mar 2018 16:37:48 GMT (envelope-from lstewart@FreeBSD.org) Received: (from lstewart@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JGbmON093556; Mon, 19 Mar 2018 16:37:48 GMT (envelope-from lstewart@FreeBSD.org) Message-Id: <201803191637.w2JGbmON093556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lstewart set sender to lstewart@FreeBSD.org using -f From: Lawrence Stewart Date: Mon, 19 Mar 2018 16:37:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331214 - in head: share/man/man4 sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: lstewart X-SVN-Commit-Paths: in head: share/man/man4 sys/netinet/cc X-SVN-Commit-Revision: 331214 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 16:37:49 -0000 Author: lstewart Date: Mon Mar 19 16:37:47 2018 New Revision: 331214 URL: https://svnweb.freebsd.org/changeset/base/331214 Log: Add support for the experimental Internet-Draft "TCP Alternative Backoff with ECN (ABE)" proposal to the New Reno congestion control algorithm module. ABE reduces the amount of congestion window reduction in response to ECN-signalled congestion relative to the loss-inferred congestion response. More details about ABE can be found in the Internet-Draft: https://tools.ietf.org/html/draft-ietf-tcpm-alternativebackoff-ecn The implementation introduces four new sysctls: - net.inet.tcp.cc.abe defaults to 0 (disabled) and can be set to non-zero to enable ABE for ECN-enabled TCP connections. - net.inet.tcp.cc.newreno.beta and net.inet.tcp.cc.newreno.beta_ecn set the multiplicative window decrease factor, specified as a percentage, applied to the congestion window in response to a loss-based or ECN-based congestion signal respectively. They default to the values specified in the draft i.e. beta=50 and beta_ecn=80. - net.inet.tcp.cc.abe_frlossreduce defaults to 0 (disabled) and can be set to non-zero to enable the use of standard beta (50% by default) when repairing loss during an ECN-signalled congestion recovery episode. It enables a more conservative congestion response and is provided for the purposes of experimentation as a result of some discussion at IETF 100 in Singapore. The values of beta and beta_ecn can also be set per-connection by way of the TCP_CCALGOOPT TCP-level socket option and the new CC_NEWRENO_BETA or CC_NEWRENO_BETA_ECN CC algo sub-options. Submitted by: Tom Jones Tested by: Tom Jones , Grenville Armitage Relnotes: Yes Differential Revision: https://reviews.freebsd.org/D11616 Added: head/sys/netinet/cc/cc_newreno.h (contents, props changed) Modified: head/share/man/man4/cc_newreno.4 head/share/man/man4/mod_cc.4 head/sys/netinet/cc/cc.c head/sys/netinet/cc/cc.h head/sys/netinet/cc/cc_newreno.c Modified: head/share/man/man4/cc_newreno.4 ============================================================================== --- head/share/man/man4/cc_newreno.4 Mon Mar 19 16:17:10 2018 (r331213) +++ head/share/man/man4/cc_newreno.4 Mon Mar 19 16:37:47 2018 (r331214) @@ -30,17 +30,69 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2011 +.Dd March 19, 2018 .Dt CC_NEWRENO 4 .Os .Sh NAME .Nm cc_newreno .Nd NewReno Congestion Control Algorithm +.Sh SYNOPSIS +.In netinet/cc/cc_newreno.h .Sh DESCRIPTION The NewReno congestion control algorithm is the default for TCP. Details about the algorithm can be found in RFC5681. +.Sh Socket Options +The +.Nm +module supports a number of socket options under TCP_CCALGOOPT (refer to +.Xr tcp 4 +and +.Xr moc_cc 9 for details) +which can +be set with +.Xr setsockopt 2 +and tested with +.Xr getsockopt 2 . +The +.Nm +socket options use this structure defined in +: +.Bd -literal +struct cc_newreno_opts { + int name; + uint32_t val; +} +.Ed +.Bl -tag -width ".Va CC_NEWRENO_BETA_ECN" +.It Va CC_NEWRENO_BETA +Multiplicative window decrease factor, specified as a percentage, applied to +the congestion window in response to a congestion signal per: cwnd = (cwnd * +CC_NEWRENO_BETA) / 100. +Default is 50. +.It Va CC_NEWRENO_BETA_ECN +Multiplicative window decrease factor, specified as a percentage, applied to +the congestion window in response to an ECN congestion signal when +.Va net.inet.tcp.cc.abe=1 +per: cwnd = (cwnd * CC_NEWRENO_BETA_ECN) / 100. +Default is 80. .Sh MIB Variables -There are currently no tunable MIB variables. +The algorithm exposes these variables in the +.Va net.inet.tcp.cc.newreno +branch of the +.Xr sysctl 3 +MIB: +.Bl -tag -width ".Va beta_ecn" +.It Va beta +Multiplicative window decrease factor, specified as a percentage, applied to +the congestion window in response to a congestion signal per: cwnd = (cwnd * +beta) / 100. +Default is 50. +.It Va beta_ecn +Multiplicative window decrease factor, specified as a percentage, applied to +the congestion window in response to an ECN congestion signal when +.Va net.inet.tcp.cc.abe=1 +per: cwnd = (cwnd * beta_ecn) / 100. +Default is 80. .Sh SEE ALSO .Xr cc_chd 4 , .Xr cc_cubic 4 , @@ -50,6 +102,24 @@ There are currently no tunable MIB variables. .Xr mod_cc 4 , .Xr tcp 4 , .Xr mod_cc 9 +.Rs +.%A "Mark Allman" +.%A "Vern Paxson" +.%A "Ethan Blanton" +.%T "TCP Congestion Control" +.%O "RFC 5681" +.Re +.Rs +.%A "Naeem Khademi" +.%A "Michael Welzl" +.%A "Grenville Armitage" +.%A "Gorry Fairhurst" +.%T "TCP Alternative Backoff with ECN (ABE)" +.%R "internet draft" +.%D "February 2018" +.%N "draft-ietf-tcpm-alternativebackoff-ecn" +.%O "work in progress" +.Re .Sh ACKNOWLEDGEMENTS Development and testing of this software were made possible in part by grants from the FreeBSD Foundation and Cisco University Research Program Fund at @@ -77,6 +147,9 @@ congestion control module was written by .An Lawrence Stewart Aq Mt lstewart@FreeBSD.org and .An David Hayes Aq Mt david.hayes@ieee.org . +.Pp +Support for TCP ABE was added by +.An Tom Jones Aq Mt tj@enoti.me . .Pp This manual page was written by .An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . Modified: head/share/man/man4/mod_cc.4 ============================================================================== --- head/share/man/man4/mod_cc.4 Mon Mar 19 16:17:10 2018 (r331213) +++ head/share/man/man4/mod_cc.4 Mon Mar 19 16:37:47 2018 (r331214) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 21, 2016 +.Dd March 19, 2018 .Dt MOD_CC 4 .Os .Sh NAME @@ -73,7 +73,7 @@ The framework exposes the following variables in the branch of the .Xr sysctl 3 MIB: -.Bl -tag -width ".Va available" +.Bl -tag -width ".Va abe_frlossreduce" .It Va available Read-only list of currently available congestion control algorithms by name. .It Va algorithm @@ -83,6 +83,15 @@ When attempting to change the default algorithm, this one of the names listed by the .Va net.inet.tcp.cc.available MIB variable. +.It Va abe +Enable support for draft-ietf-tcpm-alternativebackoff-ecn, +which alters the window decrease factor applied to the congestion window in +response to an ECN congestion signal. +Refer to individual congestion control man pages to determine if they implement +support for ABE and for configuration details. +.It Va abe_frlossreduce +If non-zero, apply standard beta instead of ABE-beta during ECN-signalled +congestion recovery episodes if loss also needs to be repaired. .El .Sh SEE ALSO .Xr cc_cdg 4 , Modified: head/sys/netinet/cc/cc.c ============================================================================== --- head/sys/netinet/cc/cc.c Mon Mar 19 16:17:10 2018 (r331213) +++ head/sys/netinet/cc/cc.c Mon Mar 19 16:37:47 2018 (r331214) @@ -327,3 +327,14 @@ SYSCTL_PROC(_net_inet_tcp_cc, OID_AUTO, algorithm, SYSCTL_PROC(_net_inet_tcp_cc, OID_AUTO, available, CTLTYPE_STRING|CTLFLAG_RD, NULL, 0, cc_list_available, "A", "List available congestion control algorithms"); + +VNET_DEFINE(int, cc_do_abe) = 0; +SYSCTL_INT(_net_inet_tcp_cc, OID_AUTO, abe, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(cc_do_abe), 0, + "Enable draft-ietf-tcpm-alternativebackoff-ecn (TCP Alternative Backoff with ECN)"); + +VNET_DEFINE(int, cc_abe_frlossreduce) = 0; +SYSCTL_INT(_net_inet_tcp_cc, OID_AUTO, abe_frlossreduce, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(cc_abe_frlossreduce), 0, + "Apply standard beta instead of ABE-beta during ECN-signalled congestion " + "recovery episodes if loss also needs to be repaired"); Modified: head/sys/netinet/cc/cc.h ============================================================================== --- head/sys/netinet/cc/cc.h Mon Mar 19 16:17:10 2018 (r331213) +++ head/sys/netinet/cc/cc.h Mon Mar 19 16:37:47 2018 (r331214) @@ -64,6 +64,12 @@ extern struct cc_algo newreno_cc_algo; VNET_DECLARE(struct cc_algo *, default_cc_ptr); #define V_default_cc_ptr VNET(default_cc_ptr) +VNET_DECLARE(int, cc_do_abe); +#define V_cc_do_abe VNET(cc_do_abe) + +VNET_DECLARE(int, cc_abe_frlossreduce); +#define V_cc_abe_frlossreduce VNET(cc_abe_frlossreduce) + /* Define the new net.inet.tcp.cc sysctl tree. */ SYSCTL_DECL(_net_inet_tcp_cc); Modified: head/sys/netinet/cc/cc_newreno.c ============================================================================== --- head/sys/netinet/cc/cc_newreno.c Mon Mar 19 16:17:10 2018 (r331213) +++ head/sys/netinet/cc/cc_newreno.c Mon Mar 19 16:37:47 2018 (r331214) @@ -3,7 +3,7 @@ * * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995 * The Regents of the University of California. - * Copyright (c) 2007-2008,2010 + * Copyright (c) 2007-2008,2010,2014 * Swinburne University of Technology, Melbourne, Australia. * Copyright (c) 2009-2010 Lawrence Stewart * Copyright (c) 2010 The FreeBSD Foundation @@ -48,6 +48,11 @@ * University Research Program Fund at Community Foundation Silicon Valley. * More details are available at: * http://caia.swin.edu.au/urp/newtcp/ + * + * Dec 2014 garmitage@swin.edu.au + * Borrowed code fragments from cc_cdg.c to add modifiable beta + * via sysctls. + * */ #include @@ -69,20 +74,54 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +static MALLOC_DEFINE(M_NEWRENO, "newreno data", + "newreno beta values"); + +#define CAST_PTR_INT(X) (*((int*)(X))) + +static int newreno_cb_init(struct cc_var *ccv); static void newreno_ack_received(struct cc_var *ccv, uint16_t type); static void newreno_after_idle(struct cc_var *ccv); static void newreno_cong_signal(struct cc_var *ccv, uint32_t type); static void newreno_post_recovery(struct cc_var *ccv); +static int newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf); +static VNET_DEFINE(uint32_t, newreno_beta) = 50; +static VNET_DEFINE(uint32_t, newreno_beta_ecn) = 80; +#define V_newreno_beta VNET(newreno_beta) +#define V_newreno_beta_ecn VNET(newreno_beta_ecn) + struct cc_algo newreno_cc_algo = { .name = "newreno", + .cb_init = newreno_cb_init, .ack_received = newreno_ack_received, .after_idle = newreno_after_idle, .cong_signal = newreno_cong_signal, .post_recovery = newreno_post_recovery, + .ctl_output = newreno_ctl_output, }; +struct newreno { + uint32_t beta; + uint32_t beta_ecn; +}; + +int +newreno_cb_init(struct cc_var *ccv) +{ + struct newreno *nreno; + + nreno = malloc(sizeof(struct newreno), M_NEWRENO, M_NOWAIT|M_ZERO); + if (nreno != NULL) { + nreno->beta = V_newreno_beta; + nreno->beta_ecn = V_newreno_beta_ecn; + } + + return (0); +} + static void newreno_ack_received(struct cc_var *ccv, uint16_t type) { @@ -184,27 +223,48 @@ newreno_after_idle(struct cc_var *ccv) static void newreno_cong_signal(struct cc_var *ccv, uint32_t type) { - u_int win; + struct newreno *nreno; + uint32_t cwin, factor; + u_int mss; + factor = V_newreno_beta; + nreno = ccv->cc_data; + if (nreno != NULL) { + if (V_cc_do_abe) + factor = (type == CC_ECN ? nreno->beta_ecn: nreno->beta); + else + factor = nreno->beta; + } + + cwin = CCV(ccv, snd_cwnd); + mss = CCV(ccv, t_maxseg); + /* Catch algos which mistakenly leak private signal types. */ KASSERT((type & CC_SIGPRIVMASK) == 0, ("%s: congestion signal type 0x%08x is private\n", __func__, type)); - win = max(CCV(ccv, snd_cwnd) / 2 / CCV(ccv, t_maxseg), 2) * - CCV(ccv, t_maxseg); + cwin = max(((uint64_t)cwin * (uint64_t)factor) / (100ULL * (uint64_t)mss), + 2) * mss; switch (type) { case CC_NDUPACK: if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { + if (IN_CONGRECOVERY(CCV(ccv, t_flags) && + V_cc_do_abe && V_cc_abe_frlossreduce)) { + CCV(ccv, snd_ssthresh) = + ((uint64_t)CCV(ccv, snd_ssthresh) * + (uint64_t)nreno->beta) / + (100ULL * (uint64_t)nreno->beta_ecn); + } if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) - CCV(ccv, snd_ssthresh) = win; + CCV(ccv, snd_ssthresh) = cwin; ENTER_RECOVERY(CCV(ccv, t_flags)); } break; case CC_ECN: if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - CCV(ccv, snd_ssthresh) = win; - CCV(ccv, snd_cwnd) = win; + CCV(ccv, snd_ssthresh) = cwin; + CCV(ccv, snd_cwnd) = cwin; ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } break; @@ -242,5 +302,75 @@ newreno_post_recovery(struct cc_var *ccv) } } +int +newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf) +{ + struct newreno *nreno; + struct cc_newreno_opts *opt; + + if (sopt->sopt_valsize != sizeof(struct cc_newreno_opts)) + return (EMSGSIZE); + + nreno = ccv->cc_data; + opt = buf; + + switch (sopt->sopt_dir) { + case SOPT_SET: + switch (opt->name) { + case CC_NEWRENO_BETA: + nreno->beta = opt->val; + break; + case CC_NEWRENO_BETA_ECN: + if (!V_cc_do_abe) + return (EACCES); + nreno->beta_ecn = opt->val; + break; + default: + return (ENOPROTOOPT); + } + case SOPT_GET: + switch (opt->name) { + case CC_NEWRENO_BETA: + opt->val = nreno->beta; + break; + case CC_NEWRENO_BETA_ECN: + opt->val = nreno->beta_ecn; + break; + default: + return (ENOPROTOOPT); + } + default: + return (EINVAL); + } + + return (0); +} + +static int +newreno_beta_handler(SYSCTL_HANDLER_ARGS) +{ + if (req->newptr != NULL ) { + if (arg1 == &VNET_NAME(newreno_beta_ecn) && !V_cc_do_abe) + return (EACCES); + if (CAST_PTR_INT(req->newptr) <= 0 || CAST_PTR_INT(req->newptr) > 100) + return (EINVAL); + } + + return (sysctl_handle_int(oidp, arg1, arg2, req)); +} + +SYSCTL_DECL(_net_inet_tcp_cc_newreno); +SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, newreno, CTLFLAG_RW, NULL, + "New Reno related settings"); + +SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta, + CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW, + &VNET_NAME(newreno_beta), 3, &newreno_beta_handler, "IU", + "New Reno beta, specified as number between 1 and 100"); + +SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta_ecn, + CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW, + &VNET_NAME(newreno_beta_ecn), 3, &newreno_beta_handler, "IU", + "New Reno beta ecn, specified as number between 1 and 100"); DECLARE_CC_MODULE(newreno, &newreno_cc_algo); Added: head/sys/netinet/cc/cc_newreno.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netinet/cc/cc_newreno.h Mon Mar 19 16:37:47 2018 (r331214) @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Tom Jones + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _CC_NEWRENO_H +#define _CC_NEWRENO_H + +#define CCALGONAME_NEWRENO "newreno" + +struct cc_newreno_opts { + int name; + uint32_t val; +}; + +#define CC_NEWRENO_BETA 1 +#define CC_NEWRENO_BETA_ECN 2 + +#endif /* _CC_NEWRENO_H */ From owner-svn-src-head@freebsd.org Mon Mar 19 17:14:56 2018 Return-Path: Delivered-To: svn-src-head@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 AE596F5CC32; Mon, 19 Mar 2018 17:14:56 +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 621F47A322; Mon, 19 Mar 2018 17:14:56 +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 5D1E211623; Mon, 19 Mar 2018 17:14:56 +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 w2JHEuuH013450; Mon, 19 Mar 2018 17:14:56 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JHEuXY013449; Mon, 19 Mar 2018 17:14:56 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803191714.w2JHEuXY013449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 19 Mar 2018 17:14:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331215 - head/sys/x86/include X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/x86/include X-SVN-Commit-Revision: 331215 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 17:14:56 -0000 Author: jhb Date: Mon Mar 19 17:14:56 2018 New Revision: 331215 URL: https://svnweb.freebsd.org/changeset/base/331215 Log: Fix a typo. Reviewed by: kib Modified: head/sys/x86/include/ucontext.h Modified: head/sys/x86/include/ucontext.h ============================================================================== --- head/sys/x86/include/ucontext.h Mon Mar 19 16:37:47 2018 (r331214) +++ head/sys/x86/include/ucontext.h Mon Mar 19 17:14:56 2018 (r331215) @@ -96,7 +96,7 @@ typedef struct __mcontext { #ifdef __amd64__ /* - * mc_trapno bits. Shall be in sync with TF_XXX. + * mc_flags bits. Shall be in sync with TF_XXX. */ #define _MC_HASSEGS 0x1 #define _MC_HASBASES 0x2 From owner-svn-src-head@freebsd.org Mon Mar 19 17:25:58 2018 Return-Path: Delivered-To: svn-src-head@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 39C8DF5D8D3; Mon, 19 Mar 2018 17:25:58 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC4B77AA5C; Mon, 19 Mar 2018 17:25:57 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 751AF10A87D; Mon, 19 Mar 2018 13:25:57 -0400 (EDT) From: John Baldwin To: Mark Johnston Cc: Mariusz Zaborski , Mark Linimon , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r325739 - in head: lib/libcasper/services lib/libcasper/services/cap_syslog share/mk Date: Mon, 19 Mar 2018 09:47:04 -0700 Message-ID: <5637307.jbg60LYNR5@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <20180318170738.GB35894@raichu> References: <201711120834.vAC8YQUq006611@repo.freebsd.org> <20180318142039.GA81224@x-wing> <20180318170738.GB35894@raichu> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 19 Mar 2018 13:25:57 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 17:25:58 -0000 On Sunday, March 18, 2018 01:07:38 PM Mark Johnston wrote: > On Sun, Mar 18, 2018 at 03:20:39PM +0100, Mariusz Zaborski wrote: > > On Mon, Mar 05, 2018 at 11:19:16AM -0600, Mark Linimon wrote: > > > On Mon, Mar 05, 2018 at 11:13:58AM -0500, Mark Johnston wrote: > > > > The growing divergence with stable/11 makes it rather painful to > > > > maintain a port, depending on libcasper, that aims to work on both 11 > > > > and head. > > > > > > Even an MFC won't help you, in the medium-term. > > > > > > e.g. via https://www.freebsd.org/security/#sup, even if the MFC made it > > > into 11.2, you would still have several months of supporting the old > > > one. (The FreeBSD package builds are based on the oldest supported > > > point release from a branch.) The current estimate for 11.2 is late June. > > > > > > mcl > > > > Hi, > > > > Sorry for delay I just get back. > > > > Yes I can integrate all my changes in libcasper and I guess libcapsicum. > > I'm did do a lot of integrations to stable so I have one question - > > if I understand correctly all changes which change API/ABI but are > > pointed as SHLIB_MAJOR I can safety integrate. > > > > Mark what else can I do? > > Sorry, I don't quite follow. I don't think SHLIB_MAJOR bumps can be > MFCed: what happens if an SA is later released for the library in > question? We have MFC'd them in the past I believe and rolled the shlib into the misc/compatXX package (so that one might need misc/compat11 to run older 11.x binaries even on an 11.x host). We haven't done that nearly as often since adding symbol versioning though. I don't know if we ever had to deal with merging an SA to an old library version though. -- John Baldwin From owner-svn-src-head@freebsd.org Mon Mar 19 17:25:59 2018 Return-Path: Delivered-To: svn-src-head@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 8F6C8F5D8DB; Mon, 19 Mar 2018 17:25:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 434B97AA60; Mon, 19 Mar 2018 17:25:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id DE50E10A8BA; Mon, 19 Mar 2018 13:25:58 -0400 (EDT) From: John Baldwin To: Kyle Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331209 - head Date: Mon, 19 Mar 2018 09:20:40 -0700 Message-ID: <4168709.idJmbTaMPK@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201803191527.w2JFRr7B058668@repo.freebsd.org> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 19 Mar 2018 13:25:59 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 17:25:59 -0000 On Monday, March 19, 2018 03:27:53 PM Kyle Evans wrote: > Author: kevans > Date: Mon Mar 19 15:27:53 2018 > New Revision: 331209 > URL: https://svnweb.freebsd.org/changeset/base/331209 > > Log: > Add note to UPDATING about UEFI changes requiring loader(8) update > > These problems have only been observed with boards using U-Boot (e.g. ARM) > where virtual addresses are already set in the memory map by the firmware > and the firmware is expecting a call to SetVirtualAddressMap to be made. > I refrain from mentioning this in the note because this could also be the > case on some not-yet-tested firmware on amd64 and it's not a bad > recommendation for the general case. How does this fit with the recommended installation steps of doing 'make installkernel' and rebooting before doing a 'make installworld'? -- John Baldwin From owner-svn-src-head@freebsd.org Mon Mar 19 17:51:20 2018 Return-Path: Delivered-To: svn-src-head@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 13A7EF5F3A3; Mon, 19 Mar 2018 17:51:20 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 80FCB7BF50; Mon, 19 Mar 2018 17:51:19 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf0-f67.google.com with SMTP id g203-v6so12303996lfg.11; Mon, 19 Mar 2018 10:51:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wTwirE59AfknrnSYY3vZlqN81qxXXx5vCkyXIvI7Z4w=; b=b1RZ3L4ZuO0W2GUL5ccfUevqWv109KGXKYXhKo2WHLeBJq2F/rySW32SRZeMoTXX46 ZQwYTHNhTIGGi+d+VT8s9Qe/jmaYkVjNbdHqnsVDlXLUcaUtmmmlhJyOOvEoA1y2vvE3 9a3HVLng1HVdbrgL8gktBB1plnbrE8w1YjoSU5SMtB19k65WfpXBOaoxxCPDrXuZnjND HeL+R/8DQXhnWBlNckDsUKlpNhg8DANO+IhHDi6t2Bm9f99gM+YMMlArOgpojO2TjUSV 5Tx8cog0U/6+GJYRQoPmViH7QXjo9wJdpkCN0EOMZRZ+MeRF8OXujzW60Ywg6dM7mxkV oXwg== X-Gm-Message-State: AElRT7Fawxhv5yGUHBvlKzmrCcxYZzH/7BoD8hRz+p2lIdOhoO6x5x01 CKx0tm5AGJzDxZtZiIAjjomNxZkp X-Google-Smtp-Source: AG47ELv5hZeOLvB5eaI8ij0nins30fbPp0G+xPJinbJGw4C1GXt7nLuP1+/fs9OhLIkhHwlM+0hFfw== X-Received: by 10.46.44.5 with SMTP id s5mr2280818ljs.111.1521481865657; Mon, 19 Mar 2018 10:51:05 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id k12-v6sm122655lfe.93.2018.03.19.10.51.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Mar 2018 10:51:04 -0700 (PDT) Subject: Re: svn commit: r331209 - head To: John Baldwin , Kyle Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <4168709.idJmbTaMPK@ralph.baldwin.cx> From: Andriy Gapon Message-ID: <2d94ac2c-491b-391b-d5ff-5545b6d83a82@FreeBSD.org> Date: Mon, 19 Mar 2018 19:51:03 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <4168709.idJmbTaMPK@ralph.baldwin.cx> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 17:51:20 -0000 On 19/03/2018 18:20, John Baldwin wrote: > On Monday, March 19, 2018 03:27:53 PM Kyle Evans wrote: >> Author: kevans >> Date: Mon Mar 19 15:27:53 2018 >> New Revision: 331209 >> URL: https://svnweb.freebsd.org/changeset/base/331209 >> >> Log: >> Add note to UPDATING about UEFI changes requiring loader(8) update >> >> These problems have only been observed with boards using U-Boot (e.g. ARM) >> where virtual addresses are already set in the memory map by the firmware >> and the firmware is expecting a call to SetVirtualAddressMap to be made. >> I refrain from mentioning this in the note because this could also be the >> case on some not-yet-tested firmware on amd64 and it's not a bad >> recommendation for the general case. > > How does this fit with the recommended installation steps of doing > 'make installkernel' and rebooting before doing a 'make installworld'? Installation of /boot/loader along with likes of cat and cut has always puzzled me very much. -- Andriy Gapon From owner-svn-src-head@freebsd.org Mon Mar 19 17:59:55 2018 Return-Path: Delivered-To: svn-src-head@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 59D5BF5FC95 for ; Mon, 19 Mar 2018 17:59:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22c.google.com (mail-it0-x22c.google.com [IPv6:2607:f8b0:4001:c0b::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E18E97C530 for ; Mon, 19 Mar 2018 17:59:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22c.google.com with SMTP id w3-v6so11578483itc.4 for ; Mon, 19 Mar 2018 10:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=vTKuyXrQsNjZKnnxlR3nZ0L27yI1yLzghFZpobI/HVA=; b=KPJIg3z422y4uuv9NoXqO0Fkwo9HkB0b8R73ojcYhU299yMui8XxPY3BcnR/gO+Psl zMl4Sai41lCBOk+dw5yhLoCr4cToZy3FtB9QLbobGgGX4JJguci/741EPWMefIQB+UBk +BuZKDgYuDvvQQlKobQ2YWMMa+XFQ3ud2Ea/WksEPHWBVphtRuLQ8txqnTsOol8tR5ma lXQOZuAK2K19k6u4I0no3/KgaRo3T//MaAfJ+yVWvaJwSPQTgbWBc+G2GM0uSecoBcS0 THL991EBP8KPEXoxzYNgWw+MV3u3JULVQjvsKTZtbCs8nHIX1pZzWlqityfH5M8YU+1Z zsMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=vTKuyXrQsNjZKnnxlR3nZ0L27yI1yLzghFZpobI/HVA=; b=GrWNAlTAXNi4TvfvW7do57NDLWdIqoMvszyCbtyFeISVHIOR0pmXxdaHgNhD7rKDpw B/jvb6XoOOLQG/hXgznfN3eamVmCA85m48gY88UpXVjb9OQJHY90BOUUeDVnMrWgxWt6 0abWbuQWYWjPWfVavXo3GzYnD7eb2ouK884ibJIR6oYIyrizemADjWQQ5qWHjiI+uZKh DWsCG3lPiTBMnL0QsQ+kcgrApspjmM65KgPySMRZjiLc3Mv8Dn+74vCXdKbNjnPmTNlX FpifhqtCGrfnSG9rJv4ebK6IwYIL2lK9oN0bIKCTod5VweTXSoD3RfzLk5G9R4dT5UxZ c8sQ== X-Gm-Message-State: AElRT7Gb6eqlEAvh9v0rYo+ij+sRi4Tug0Q7dbpV7i4vy13wRqxqvIs+ nxq6HAdTFFLxsEgbm0LKTas23kkL5V2DENNJc5KKEw== X-Google-Smtp-Source: AG47ELsLZBQef5ze+00087SE6iL3dqnlYSSfAUEkVXzYE0XZY5Cu5v11JuAOb4J3Px2+K7AtBWpRKEspdp2DDmPBksI= X-Received: by 2002:a24:441:: with SMTP id 62-v6mr12817109itb.57.1521482393815; Mon, 19 Mar 2018 10:59:53 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Mon, 19 Mar 2018 10:59:52 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <2d94ac2c-491b-391b-d5ff-5545b6d83a82@FreeBSD.org> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <4168709.idJmbTaMPK@ralph.baldwin.cx> <2d94ac2c-491b-391b-d5ff-5545b6d83a82@FreeBSD.org> From: Warner Losh Date: Mon, 19 Mar 2018 11:59:52 -0600 X-Google-Sender-Auth: R72HoLI5DnAgs07tTd96dApSyG8 Message-ID: Subject: Re: svn commit: r331209 - head To: Andriy Gapon Cc: John Baldwin , Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 17:59:55 -0000 On Mon, Mar 19, 2018 at 11:51 AM, Andriy Gapon wrote: > On 19/03/2018 18:20, John Baldwin wrote: > > On Monday, March 19, 2018 03:27:53 PM Kyle Evans wrote: > >> Author: kevans > >> Date: Mon Mar 19 15:27:53 2018 > >> New Revision: 331209 > >> URL: https://svnweb.freebsd.org/changeset/base/331209 > >> > >> Log: > >> Add note to UPDATING about UEFI changes requiring loader(8) update > >> > >> These problems have only been observed with boards using U-Boot (e.g. > ARM) > >> where virtual addresses are already set in the memory map by the > firmware > >> and the firmware is expecting a call to SetVirtualAddressMap to be > made. > >> I refrain from mentioning this in the note because this could also be > the > >> case on some not-yet-tested firmware on amd64 and it's not a bad > >> recommendation for the general case. > > > > How does this fit with the recommended installation steps of doing > > 'make installkernel' and rebooting before doing a 'make installworld'? > > Installation of /boot/loader along with likes of cat and cut has always > puzzled > me very much. > Historical reason. We've always installed /boot/loader with installworld. We also install the other boot loaders, but don't deploy them (so there's a new /boot/boot, but it isn't installed into /). To get around this issue, though, is trivial: make installkenrel cd stand make install reboot make installworld in this weird case. Warner From owner-svn-src-head@freebsd.org Mon Mar 19 18:09:59 2018 Return-Path: Delivered-To: svn-src-head@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 5EA72F60952; Mon, 19 Mar 2018 18:09:59 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE1527CE95; Mon, 19 Mar 2018 18:09:58 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w2JI9tjo013234; Mon, 19 Mar 2018 11:09:55 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w2JI9tOP013233; Mon, 19 Mar 2018 11:09:55 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201803191809.w2JI9tOP013233@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r331209 - head In-Reply-To: To: Warner Losh Date: Mon, 19 Mar 2018 11:09:55 -0700 (PDT) CC: Andriy Gapon , John Baldwin , Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 18:09:59 -0000 > On Mon, Mar 19, 2018 at 11:51 AM, Andriy Gapon wrote: > > > On 19/03/2018 18:20, John Baldwin wrote: > > > On Monday, March 19, 2018 03:27:53 PM Kyle Evans wrote: > > >> Author: kevans > > >> Date: Mon Mar 19 15:27:53 2018 > > >> New Revision: 331209 > > >> URL: https://svnweb.freebsd.org/changeset/base/331209 > > >> > > >> Log: > > >> Add note to UPDATING about UEFI changes requiring loader(8) update > > >> > > >> These problems have only been observed with boards using U-Boot (e.g. > > ARM) > > >> where virtual addresses are already set in the memory map by the > > firmware > > >> and the firmware is expecting a call to SetVirtualAddressMap to be > > made. > > >> I refrain from mentioning this in the note because this could also be > > the > > >> case on some not-yet-tested firmware on amd64 and it's not a bad > > >> recommendation for the general case. > > > > > > How does this fit with the recommended installation steps of doing > > > 'make installkernel' and rebooting before doing a 'make installworld'? > > > > Installation of /boot/loader along with likes of cat and cut has always > > puzzled > > me very much. > > > > Historical reason. We've always installed /boot/loader with installworld. > We also install the other boot loaders, but don't deploy them (so there's a > new /boot/boot, but it isn't installed into /). More complete historical information. The "boot" code use to live in hidden places in the MBR, and the {disk,bsd}label, so installing it into the file system had 0 effect, as the actuall in use running code was hidden and had to be replaced using either fdisk or {disk,bsd}label. When "loader" was added this should of probably changed with preseverations of old code and ways to get back to it incase things went a foul, and ways to update it in a more controlled manner than installworld. And more approprate timing of installing it (should it now go with installkernel?). > To get around this issue, though, is trivial: > > make installkenrel > cd stand > make install > reboot > make installworld > > in this weird case. > > Warner -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Mon Mar 19 18:26:00 2018 Return-Path: Delivered-To: svn-src-head@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 B2B9EF61CA8 for ; Mon, 19 Mar 2018 18:26:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3762E7DB66 for ; Mon, 19 Mar 2018 18:26:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x230.google.com with SMTP id 19-v6so7238431itw.3 for ; Mon, 19 Mar 2018 11:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=ieunJ1wyLSGt1NLXMOsIy6Jvh84YG3K8V7Uc7z2bRYI=; b=CKJ2RGporXUC2tWkbdDo/zRAIq5gXMtBJIbbccqO8ib2la7iPKNxipFGV3lFfU1wK/ J2mQ4uQiMrBTuCvVrni00jTl7OhKGxSuBFyGXLBO446Jm/Pc0iX52cRytvYgFUSwUDtQ UnjYtol1MakM3SP/w2q1xkNUlE1DSZCrFAgIfYQDM2adN3SAk3r+v55hcJHGv6MeaDqe 8qfuqMWQy4RmSZGM4v6nWfj4J8FRqPDwYRB9H0cuE00wzlX01OaxEvb8GSeKa+9QKiRf Z8AUZs/P4BceAsDVELuBZkHZIALP+JLdW8sX+tYFRz2IWaMdvrs1iHZ42aWkuOQZxnck 2O8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=ieunJ1wyLSGt1NLXMOsIy6Jvh84YG3K8V7Uc7z2bRYI=; b=qvkDMmDjjvYCUlpbvyWDLSCyU7Ehf9AjmqfT8s0/UAZ7cTY4b76ftGyH/U1EtCOWAK +sC4BgZ2ruW7RzsVwB5TbCmjOmHSx4Oi5XyAp2agNN8741g7ysIpc0NYATa1+fWb9YUR HwyawURTPaqEe/hnAxOSRkP8Ws9pL8VsZ69ZcaNFmlSbuBHKAEgVr99aQOQou70HmV5t 1YgLxG2re28SwPZSZkUs3IhtB3Jpslw/cl6MBJsfi5D62M+lvmxg5XlWXGs87BvDSU5T 0jcE5GIHiWAnJ1D7r/fQ2h8Cnn6NOLvE4iP/kcps8g9xyg/uhmj24R5nYynfS3ElkadJ 6Jsg== X-Gm-Message-State: AElRT7E0JzkcKAGcgO3PhMtYNsOdDv9z8cXcuA9wMnp4fZtoIcScBHiT 7MmtObA7ekfoRpje629REd04kenJbSEsb95aTZuV6w== X-Google-Smtp-Source: AG47ELu2qg80ItqzI+WE5k9Qvqru/En6tZstqq3zn2JJ0687DNEHvnQaQ/sofh9ZigzbkhsZpKwIhA5AjTr6gVnTQhI= X-Received: by 2002:a24:441:: with SMTP id 62-v6mr12916018itb.57.1521483959377; Mon, 19 Mar 2018 11:25:59 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Mon, 19 Mar 2018 11:25:58 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <201803191809.w2JI9tOP013233@pdx.rh.CN85.dnsmgr.net> References: <201803191809.w2JI9tOP013233@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Mon, 19 Mar 2018 12:25:58 -0600 X-Google-Sender-Auth: FKNtna_5BI6Dh0ZAiaqsIkgamw8 Message-ID: Subject: Re: svn commit: r331209 - head To: "Rodney W. Grimes" Cc: Andriy Gapon , John Baldwin , Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 18:26:01 -0000 On Mon, Mar 19, 2018 at 12:09 PM, Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > On Mon, Mar 19, 2018 at 11:51 AM, Andriy Gapon wrote: > > > > > On 19/03/2018 18:20, John Baldwin wrote: > > > > On Monday, March 19, 2018 03:27:53 PM Kyle Evans wrote: > > > >> Author: kevans > > > >> Date: Mon Mar 19 15:27:53 2018 > > > >> New Revision: 331209 > > > >> URL: https://svnweb.freebsd.org/changeset/base/331209 > > > >> > > > >> Log: > > > >> Add note to UPDATING about UEFI changes requiring loader(8) update > > > >> > > > >> These problems have only been observed with boards using U-Boot > (e.g. > > > ARM) > > > >> where virtual addresses are already set in the memory map by the > > > firmware > > > >> and the firmware is expecting a call to SetVirtualAddressMap to be > > > made. > > > >> I refrain from mentioning this in the note because this could > also be > > > the > > > >> case on some not-yet-tested firmware on amd64 and it's not a bad > > > >> recommendation for the general case. > > > > > > > > How does this fit with the recommended installation steps of doing > > > > 'make installkernel' and rebooting before doing a 'make > installworld'? > > > > > > Installation of /boot/loader along with likes of cat and cut has always > > > puzzled > > > me very much. > > > > > > > Historical reason. We've always installed /boot/loader with installworld. > > We also install the other boot loaders, but don't deploy them (so > there's a > > new /boot/boot, but it isn't installed into /). > > More complete historical information. The "boot" code use to live in > hidden places in the MBR, and the {disk,bsd}label, so installing it > into the file system had 0 effect, as the actuall in use running > code was hidden and had to be replaced using either fdisk or > {disk,bsd}label. > Right. That's still the case, but these bits are considered 'static' and uninteresting to update. > When "loader" was added this should of probably changed with > preseverations of old code and ways to get back to it incase > things went a foul, and ways to update it in a more controlled > manner than installworld. And more approprate timing of > installing it (should it now go with installkernel?). No. Where it is fine. The arm64 thing is actually fixed in the kernel so we don't need to cope with it. Warner > > To get around this issue, though, is trivial: > > > > make installkenrel > > cd stand > > make install > > reboot > > make installworld > > > > in this weird case. > > > > Warner > > -- > Rod Grimes > rgrimes@freebsd.org > From owner-svn-src-head@freebsd.org Mon Mar 19 18:59:16 2018 Return-Path: Delivered-To: svn-src-head@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 84698F63FFB; Mon, 19 Mar 2018 18:59:16 +0000 (UTC) (envelope-from br@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 2D38F7F24F; Mon, 19 Mar 2018 18:59:16 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 213C41262C; Mon, 19 Mar 2018 18:59:16 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JIxFMW063688; Mon, 19 Mar 2018 18:59:15 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JIxF9s063687; Mon, 19 Mar 2018 18:59:15 GMT (envelope-from br@FreeBSD.org) Message-Id: <201803191859.w2JIxF9s063687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 19 Mar 2018 18:59:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331220 - in head/contrib/processor-trace: . include libipt libipt/include X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/contrib/processor-trace: . include libipt libipt/include X-SVN-Commit-Revision: 331220 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 18:59:16 -0000 Author: br Date: Mon Mar 19 18:59:15 2018 New Revision: 331220 URL: https://svnweb.freebsd.org/changeset/base/331220 Log: Import Intel Processor Trace decoder library from vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26 Sponsored by: DARPA, AFRL Added: head/contrib/processor-trace/ head/contrib/processor-trace/include/ - copied from r331219, vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/include/ head/contrib/processor-trace/libipt/ - copied from r331219, vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/ head/contrib/processor-trace/libipt/include/intel-pt.h - copied unchanged from r331219, vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/include/intel-pt.h.in Copied: head/contrib/processor-trace/libipt/include/intel-pt.h (from r331219, vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/include/intel-pt.h.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/processor-trace/libipt/include/intel-pt.h Mon Mar 19 18:59:15 2018 (r331220, copy of r331219, vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26/libipt/include/intel-pt.h.in) @@ -0,0 +1,2463 @@ +/* + * Copyright (c) 2013-2018, Intel Corporation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Intel Corporation nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef INTEL_PT_H +#define INTEL_PT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Intel(R) Processor Trace (Intel PT) decoder library. + * + * This file is logically structured into the following sections: + * + * - Version + * - Errors + * - Configuration + * - Packet encoder / decoder + * - Query decoder + * - Traced image + * - Instruction flow decoder + * - Block decoder + */ + + + +struct pt_encoder; +struct pt_packet_decoder; +struct pt_query_decoder; +struct pt_insn_decoder; +struct pt_block_decoder; + + + +/* A macro to mark functions as exported. */ +#ifndef pt_export +# if defined(__GNUC__) +# define pt_export __attribute__((visibility("default"))) +# elif defined(_MSC_VER) +# define pt_export __declspec(dllimport) +# else +# error "unknown compiler" +# endif +#endif + + + +/* Version. */ + + +/** The header version. */ +#define LIBIPT_VERSION_MAJOR ${PT_VERSION_MAJOR} +#define LIBIPT_VERSION_MINOR ${PT_VERSION_MINOR} + +#define LIBIPT_VERSION ((LIBIPT_VERSION_MAJOR << 8) + LIBIPT_VERSION_MINOR) + + +/** The library version. */ +struct pt_version { + /** Major version number. */ + uint8_t major; + + /** Minor version number. */ + uint8_t minor; + + /** Reserved bits. */ + uint16_t reserved; + + /** Build number. */ + uint32_t build; + + /** Version extension. */ + const char *ext; +}; + + +/** Return the library version. */ +extern pt_export struct pt_version pt_library_version(void); + + + +/* Errors. */ + + + +/** Error codes. */ +enum pt_error_code { + /* No error. Everything is OK. */ + pte_ok, + + /* Internal decoder error. */ + pte_internal, + + /* Invalid argument. */ + pte_invalid, + + /* Decoder out of sync. */ + pte_nosync, + + /* Unknown opcode. */ + pte_bad_opc, + + /* Unknown payload. */ + pte_bad_packet, + + /* Unexpected packet context. */ + pte_bad_context, + + /* Decoder reached end of trace stream. */ + pte_eos, + + /* No packet matching the query to be found. */ + pte_bad_query, + + /* Decoder out of memory. */ + pte_nomem, + + /* Bad configuration. */ + pte_bad_config, + + /* There is no IP. */ + pte_noip, + + /* The IP has been suppressed. */ + pte_ip_suppressed, + + /* There is no memory mapped at the requested address. */ + pte_nomap, + + /* An instruction could not be decoded. */ + pte_bad_insn, + + /* No wall-clock time is available. */ + pte_no_time, + + /* No core:bus ratio available. */ + pte_no_cbr, + + /* Bad traced image. */ + pte_bad_image, + + /* A locking error. */ + pte_bad_lock, + + /* The requested feature is not supported. */ + pte_not_supported, + + /* The return address stack is empty. */ + pte_retstack_empty, + + /* A compressed return is not indicated correctly by a taken branch. */ + pte_bad_retcomp, + + /* The current decoder state does not match the state in the trace. */ + pte_bad_status_update, + + /* The trace did not contain an expected enabled event. */ + pte_no_enable, + + /* An event was ignored. */ + pte_event_ignored, + + /* Something overflowed. */ + pte_overflow, + + /* A file handling error. */ + pte_bad_file, + + /* Unknown cpu. */ + pte_bad_cpu +}; + + +/** Decode a function return value into an pt_error_code. */ +static inline enum pt_error_code pt_errcode(int status) +{ + return (status >= 0) ? pte_ok : (enum pt_error_code) -status; +} + +/** Return a human readable error string. */ +extern pt_export const char *pt_errstr(enum pt_error_code); + + + +/* Configuration. */ + + + +/** A cpu vendor. */ +enum pt_cpu_vendor { + pcv_unknown, + pcv_intel +}; + +/** A cpu identifier. */ +struct pt_cpu { + /** The cpu vendor. */ + enum pt_cpu_vendor vendor; + + /** The cpu family. */ + uint16_t family; + + /** The cpu model. */ + uint8_t model; + + /** The stepping. */ + uint8_t stepping; +}; + +/** A collection of Intel PT errata. */ +struct pt_errata { + /** BDM70: Intel(R) Processor Trace PSB+ Packets May Contain + * Unexpected Packets. + * + * Same as: SKD024, SKL021, KBL021. + * + * Some Intel Processor Trace packets should be issued only between + * TIP.PGE and TIP.PGD packets. Due to this erratum, when a TIP.PGE + * packet is generated it may be preceded by a PSB+ that incorrectly + * includes FUP and MODE.Exec packets. + */ + uint32_t bdm70:1; + + /** BDM64: An Incorrect LBR or Intel(R) Processor Trace Packet May Be + * Recorded Following a Transactional Abort. + * + * Use of Intel(R) Transactional Synchronization Extensions (Intel(R) + * TSX) may result in a transactional abort. If an abort occurs + * immediately following a branch instruction, an incorrect branch + * target may be logged in an LBR (Last Branch Record) or in an Intel(R) + * Processor Trace (Intel(R) PT) packet before the LBR or Intel PT + * packet produced by the abort. + */ + uint32_t bdm64:1; + + /** SKD007: Intel(R) PT Buffer Overflow May Result in Incorrect Packets. + * + * Same as: SKL049, KBL041. + * + * Under complex micro-architectural conditions, an Intel PT (Processor + * Trace) OVF (Overflow) packet may be issued after the first byte of a + * multi-byte CYC (Cycle Count) packet, instead of any remaining bytes + * of the CYC. + */ + uint32_t skd007:1; + + /** SKD022: VM Entry That Clears TraceEn May Generate a FUP. + * + * Same as: SKL024, KBL023. + * + * If VM entry clears Intel(R) PT (Intel Processor Trace) + * IA32_RTIT_CTL.TraceEn (MSR 570H, bit 0) while PacketEn is 1 then a + * FUP (Flow Update Packet) will precede the TIP.PGD (Target IP Packet, + * Packet Generation Disable). VM entry can clear TraceEn if the + * VM-entry MSR-load area includes an entry for the IA32_RTIT_CTL MSR. + */ + uint32_t skd022:1; + + /** SKD010: Intel(R) PT FUP May be Dropped After OVF. + * + * Same as: SKD014, SKL033, KBL030. + * + * Some Intel PT (Intel Processor Trace) OVF (Overflow) packets may not + * be followed by a FUP (Flow Update Packet) or TIP.PGE (Target IP + * Packet, Packet Generation Enable). + */ + uint32_t skd010:1; + + /** SKL014: Intel(R) PT TIP.PGD May Not Have Target IP Payload. + * + * Same as: KBL014. + * + * When Intel PT (Intel Processor Trace) is enabled and a direct + * unconditional branch clears IA32_RTIT_STATUS.FilterEn (MSR 571H, bit + * 0), due to this erratum, the resulting TIP.PGD (Target IP Packet, + * Packet Generation Disable) may not have an IP payload with the target + * IP. + */ + uint32_t skl014:1; + + /** APL12: Intel(R) PT OVF May Be Followed By An Unexpected FUP Packet. + * + * Certain Intel PT (Processor Trace) packets including FUPs (Flow + * Update Packets), should be issued only between TIP.PGE (Target IP + * Packet - Packet Generaton Enable) and TIP.PGD (Target IP Packet - + * Packet Generation Disable) packets. When outside a TIP.PGE/TIP.PGD + * pair, as a result of IA32_RTIT_STATUS.FilterEn[0] (MSR 571H) being + * cleared, an OVF (Overflow) packet may be unexpectedly followed by a + * FUP. + */ + uint32_t apl12:1; + + /** APL11: Intel(R) PT OVF Pakcet May Be Followed by TIP.PGD Packet + * + * If Intel PT (Processor Trace) encounters an internal buffer overflow + * and generates an OVF (Overflow) packet just as IA32_RTIT_CTL (MSR + * 570H) bit 0 (TraceEn) is cleared, or during a far transfer that + * causes IA32_RTIT_STATUS.ContextEn[1] (MSR 571H) to be cleared, the + * OVF may be followed by a TIP.PGD (Target Instruction Pointer - Packet + * Generation Disable) packet. + */ + uint32_t apl11:1; + + /* Reserve a few bytes for the future. */ + uint32_t reserved[15]; +}; + +/** A collection of decoder-specific configuration flags. */ +struct pt_conf_flags { + /** The decoder variant. */ + union { + /** Flags for the block decoder. */ + struct { + /** End a block after a call instruction. */ + uint32_t end_on_call:1; + + /** Enable tick events for timing updates. */ + uint32_t enable_tick_events:1; + + /** End a block after a jump instruction. */ + uint32_t end_on_jump:1; + } block; + + /** Flags for the instruction flow decoder. */ + struct { + /** Enable tick events for timing updates. */ + uint32_t enable_tick_events:1; + } insn; + + /* Reserve a few bytes for future extensions. */ + uint32_t reserved[4]; + } variant; +}; + +/** The address filter configuration. */ +struct pt_conf_addr_filter { + /** The address filter configuration. + * + * This corresponds to the respective fields in IA32_RTIT_CTL MSR. + */ + union { + uint64_t addr_cfg; + + struct { + uint32_t addr0_cfg:4; + uint32_t addr1_cfg:4; + uint32_t addr2_cfg:4; + uint32_t addr3_cfg:4; + } ctl; + } config; + + /** The address ranges configuration. + * + * This corresponds to the IA32_RTIT_ADDRn_A/B MSRs. + */ + uint64_t addr0_a; + uint64_t addr0_b; + uint64_t addr1_a; + uint64_t addr1_b; + uint64_t addr2_a; + uint64_t addr2_b; + uint64_t addr3_a; + uint64_t addr3_b; + + /* Reserve some space. */ + uint64_t reserved[8]; +}; + +/** An unknown packet. */ +struct pt_packet_unknown; + +/** An Intel PT decoder configuration. + */ +struct pt_config { + /** The size of the config structure in bytes. */ + size_t size; + + /** The trace buffer begin address. */ + uint8_t *begin; + + /** The trace buffer end address. */ + uint8_t *end; + + /** An optional callback for handling unknown packets. + * + * If \@callback is not NULL, it is called for any unknown opcode. + */ + struct { + /** The callback function. + * + * It shall decode the packet at \@pos into \@unknown. + * It shall return the number of bytes read upon success. + * It shall return a negative pt_error_code otherwise. + * The below context is passed as \@context. + */ + int (*callback)(struct pt_packet_unknown *unknown, + const struct pt_config *config, + const uint8_t *pos, void *context); + + /** The user-defined context for this configuration. */ + void *context; + } decode; + + /** The cpu on which Intel PT has been recorded. */ + struct pt_cpu cpu; + + /** The errata to apply when encoding or decoding Intel PT. */ + struct pt_errata errata; + + /* The CTC frequency. + * + * This is only required if MTC packets have been enabled in + * IA32_RTIT_CTRL.MTCEn. + */ + uint32_t cpuid_0x15_eax, cpuid_0x15_ebx; + + /* The MTC frequency as defined in IA32_RTIT_CTL.MTCFreq. + * + * This is only required if MTC packets have been enabled in + * IA32_RTIT_CTRL.MTCEn. + */ + uint8_t mtc_freq; + + /* The nominal frequency as defined in MSR_PLATFORM_INFO[15:8]. + * + * This is only required if CYC packets have been enabled in + * IA32_RTIT_CTRL.CYCEn. + * + * If zero, timing calibration will only be able to use MTC and CYC + * packets. + * + * If not zero, timing calibration will also be able to use CBR + * packets. + */ + uint8_t nom_freq; + + /** A collection of decoder-specific flags. */ + struct pt_conf_flags flags; + + /** The address filter configuration. */ + struct pt_conf_addr_filter addr_filter; +}; + + +/** Zero-initialize an Intel PT configuration. */ +static inline void pt_config_init(struct pt_config *config) +{ + memset(config, 0, sizeof(*config)); + + config->size = sizeof(*config); +} + +/** Determine errata for a given cpu. + * + * Updates \@errata based on \@cpu. + * + * Returns 0 on success, a negative error code otherwise. + * Returns -pte_invalid if \@errata or \@cpu is NULL. + * Returns -pte_bad_cpu if \@cpu is not known. + */ +extern pt_export int pt_cpu_errata(struct pt_errata *errata, + const struct pt_cpu *cpu); + + + +/* Packet encoder / decoder. */ + + + +/** Intel PT packet types. */ +enum pt_packet_type { + /* An invalid packet. */ + ppt_invalid, + + /* A packet decodable by the optional decoder callback. */ + ppt_unknown, + + /* Actual packets supported by this library. */ + ppt_pad, + ppt_psb, + ppt_psbend, + ppt_fup, + ppt_tip, + ppt_tip_pge, + ppt_tip_pgd, + ppt_tnt_8, + ppt_tnt_64, + ppt_mode, + ppt_pip, + ppt_vmcs, + ppt_cbr, + ppt_tsc, + ppt_tma, + ppt_mtc, + ppt_cyc, + ppt_stop, + ppt_ovf, + ppt_mnt, + ppt_exstop, + ppt_mwait, + ppt_pwre, + ppt_pwrx, + ppt_ptw +}; + +/** The IP compression. */ +enum pt_ip_compression { + /* The bits encode the payload size and the encoding scheme. + * + * No payload. The IP has been suppressed. + */ + pt_ipc_suppressed = 0x0, + + /* Payload: 16 bits. Update last IP. */ + pt_ipc_update_16 = 0x01, + + /* Payload: 32 bits. Update last IP. */ + pt_ipc_update_32 = 0x02, + + /* Payload: 48 bits. Sign extend to full address. */ + pt_ipc_sext_48 = 0x03, + + /* Payload: 48 bits. Update last IP. */ + pt_ipc_update_48 = 0x04, + + /* Payload: 64 bits. Full address. */ + pt_ipc_full = 0x06 +}; + +/** An execution mode. */ +enum pt_exec_mode { + ptem_unknown, + ptem_16bit, + ptem_32bit, + ptem_64bit +}; + +/** Mode packet leaves. */ +enum pt_mode_leaf { + pt_mol_exec = 0x00, + pt_mol_tsx = 0x20 +}; + +/** A TNT-8 or TNT-64 packet. */ +struct pt_packet_tnt { + /** TNT payload bit size. */ + uint8_t bit_size; + + /** TNT payload excluding stop bit. */ + uint64_t payload; +}; + +/** A packet with IP payload. */ +struct pt_packet_ip { + /** IP compression. */ + enum pt_ip_compression ipc; + + /** Zero-extended payload ip. */ + uint64_t ip; +}; + +/** A mode.exec packet. */ +struct pt_packet_mode_exec { + /** The mode.exec csl bit. */ + uint32_t csl:1; + + /** The mode.exec csd bit. */ + uint32_t csd:1; +}; + +static inline enum pt_exec_mode +pt_get_exec_mode(const struct pt_packet_mode_exec *packet) +{ + if (packet->csl) + return packet->csd ? ptem_unknown : ptem_64bit; + else + return packet->csd ? ptem_32bit : ptem_16bit; +} + +static inline struct pt_packet_mode_exec +pt_set_exec_mode(enum pt_exec_mode mode) +{ + struct pt_packet_mode_exec packet; + + switch (mode) { + default: + packet.csl = 1; + packet.csd = 1; + break; + + case ptem_64bit: + packet.csl = 1; + packet.csd = 0; + break; + + case ptem_32bit: + packet.csl = 0; + packet.csd = 1; + break; + + case ptem_16bit: + packet.csl = 0; + packet.csd = 0; + break; + } + + return packet; +} + +/** A mode.tsx packet. */ +struct pt_packet_mode_tsx { + /** The mode.tsx intx bit. */ + uint32_t intx:1; + + /** The mode.tsx abrt bit. */ + uint32_t abrt:1; +}; + +/** A mode packet. */ +struct pt_packet_mode { + /** Mode leaf. */ + enum pt_mode_leaf leaf; + + /** Mode bits. */ + union { + /** Packet: mode.exec. */ + struct pt_packet_mode_exec exec; + + /** Packet: mode.tsx. */ + struct pt_packet_mode_tsx tsx; + } bits; +}; + +/** A PIP packet. */ +struct pt_packet_pip { + /** The CR3 value. */ + uint64_t cr3; + + /** The non-root bit. */ + uint32_t nr:1; +}; + +/** A TSC packet. */ +struct pt_packet_tsc { + /** The TSC value. */ + uint64_t tsc; +}; + +/** A CBR packet. */ +struct pt_packet_cbr { + /** The core/bus cycle ratio. */ + uint8_t ratio; +}; + +/** A TMA packet. */ +struct pt_packet_tma { + /** The crystal clock tick counter value. */ + uint16_t ctc; + + /** The fast counter value. */ + uint16_t fc; +}; + +/** A MTC packet. */ +struct pt_packet_mtc { + /** The crystal clock tick counter value. */ + uint8_t ctc; +}; + +/** A CYC packet. */ +struct pt_packet_cyc { + /** The cycle counter value. */ + uint64_t value; +}; + +/** A VMCS packet. */ +struct pt_packet_vmcs { + /* The VMCS Base Address (i.e. the shifted payload). */ + uint64_t base; +}; + +/** A MNT packet. */ +struct pt_packet_mnt { + /** The raw payload. */ + uint64_t payload; +}; + +/** A EXSTOP packet. */ +struct pt_packet_exstop { + /** A flag specifying the binding of the packet: + * + * set: binds to the next FUP. + * clear: standalone. + */ + uint32_t ip:1; +}; + +/** A MWAIT packet. */ +struct pt_packet_mwait { + /** The MWAIT hints (EAX). */ + uint32_t hints; + + /** The MWAIT extensions (ECX). */ + uint32_t ext; +}; + +/** A PWRE packet. */ +struct pt_packet_pwre { + /** The resolved thread C-state. */ + uint8_t state; + + /** The resolved thread sub C-state. */ + uint8_t sub_state; + + /** A flag indicating whether the C-state entry was initiated by h/w. */ + uint32_t hw:1; +}; + +/** A PWRX packet. */ +struct pt_packet_pwrx { + /** The core C-state at the time of the wake. */ + uint8_t last; + + /** The deepest core C-state achieved during sleep. */ + uint8_t deepest; + + /** The wake reason: + * + * - due to external interrupt received. + */ + uint32_t interrupt:1; + + /** - due to store to monitored address. */ + uint32_t store:1; + + /** - due to h/w autonomous condition such as HDC. */ + uint32_t autonomous:1; +}; + +/** A PTW packet. */ +struct pt_packet_ptw { + /** The raw payload. */ + uint64_t payload; + + /** The payload size as encoded in the packet. */ + uint8_t plc; + + /** A flag saying whether a FUP is following PTW that provides + * the IP of the corresponding PTWRITE instruction. + */ + uint32_t ip:1; +}; + +static inline int pt_ptw_size(uint8_t plc) +{ + switch (plc) { + case 0: + return 4; + + case 1: + return 8; + + case 2: + case 3: + return -pte_bad_packet; + } + + return -pte_internal; +} + +/** An unknown packet decodable by the optional decoder callback. */ +struct pt_packet_unknown { + /** Pointer to the raw packet bytes. */ + const uint8_t *packet; + + /** Optional pointer to a user-defined structure. */ + void *priv; +}; + +/** An Intel PT packet. */ +struct pt_packet { + /** The type of the packet. + * + * This also determines the \@payload field. + */ + enum pt_packet_type type; + + /** The size of the packet including opcode and payload. */ + uint8_t size; + + /** Packet specific data. */ + union { + /** Packets: pad, ovf, psb, psbend, stop - no payload. */ + + /** Packet: tnt-8, tnt-64. */ + struct pt_packet_tnt tnt; + + /** Packet: tip, fup, tip.pge, tip.pgd. */ + struct pt_packet_ip ip; + + /** Packet: mode. */ + struct pt_packet_mode mode; + + /** Packet: pip. */ + struct pt_packet_pip pip; + + /** Packet: tsc. */ + struct pt_packet_tsc tsc; + + /** Packet: cbr. */ + struct pt_packet_cbr cbr; + + /** Packet: tma. */ + struct pt_packet_tma tma; + + /** Packet: mtc. */ + struct pt_packet_mtc mtc; + + /** Packet: cyc. */ + struct pt_packet_cyc cyc; + + /** Packet: vmcs. */ + struct pt_packet_vmcs vmcs; + + /** Packet: mnt. */ + struct pt_packet_mnt mnt; + + /** Packet: exstop. */ + struct pt_packet_exstop exstop; + + /** Packet: mwait. */ + struct pt_packet_mwait mwait; + + /** Packet: pwre. */ + struct pt_packet_pwre pwre; + + /** Packet: pwrx. */ + struct pt_packet_pwrx pwrx; + + /** Packet: ptw. */ + struct pt_packet_ptw ptw; + + /** Packet: unknown. */ + struct pt_packet_unknown unknown; + } payload; +}; + + + +/* Packet encoder. */ + + + +/** Allocate an Intel PT packet encoder. + * + * The encoder will work on the buffer defined in \@config, it shall contain + * raw trace data and remain valid for the lifetime of the encoder. + * + * The encoder starts at the beginning of the trace buffer. + */ +extern pt_export struct pt_encoder * +pt_alloc_encoder(const struct pt_config *config); + +/** Free an Intel PT packet encoder. + * + * The \@encoder must not be used after a successful return. + */ +extern pt_export void pt_free_encoder(struct pt_encoder *encoder); + +/** Hard set synchronization point of an Intel PT packet encoder. + * + * Synchronize \@encoder to \@offset within the trace buffer. + * + * Returns zero on success, a negative error code otherwise. + * + * Returns -pte_eos if the given offset is behind the end of the trace buffer. + * Returns -pte_invalid if \@encoder is NULL. + */ +extern pt_export int pt_enc_sync_set(struct pt_encoder *encoder, + uint64_t offset); + +/** Get the current packet encoder position. + * + * Fills the current \@encoder position into \@offset. + * + * This is useful for reporting errors. + * + * Returns zero on success, a negative error code otherwise. + * + * Returns -pte_invalid if \@encoder or \@offset is NULL. + */ +extern pt_export int pt_enc_get_offset(const struct pt_encoder *encoder, + uint64_t *offset); + +/* Return a pointer to \@encoder's configuration. + * + * Returns a non-null pointer on success, NULL if \@encoder is NULL. + */ +extern pt_export const struct pt_config * +pt_enc_get_config(const struct pt_encoder *encoder); + +/** Encode an Intel PT packet. + * + * Writes \@packet at \@encoder's current position in the Intel PT buffer and + * advances the \@encoder beyond the written packet. + * + * The \@packet.size field is ignored. + * + * In case of errors, the \@encoder is not advanced and nothing is written + * into the Intel PT buffer. + * + * Returns the number of bytes written on success, a negative error code + * otherwise. + * + * Returns -pte_bad_opc if \@packet.type is not known. + * Returns -pte_bad_packet if \@packet's payload is invalid. + * Returns -pte_eos if \@encoder reached the end of the Intel PT buffer. + * Returns -pte_invalid if \@encoder or \@packet is NULL. + */ +extern pt_export int pt_enc_next(struct pt_encoder *encoder, + const struct pt_packet *packet); + + + +/* Packet decoder. */ + + + +/** Allocate an Intel PT packet decoder. + * + * The decoder will work on the buffer defined in \@config, it shall contain + * raw trace data and remain valid for the lifetime of the decoder. + * + * The decoder needs to be synchronized before it can be used. + */ +extern pt_export struct pt_packet_decoder * +pt_pkt_alloc_decoder(const struct pt_config *config); + +/** Free an Intel PT packet decoder. + * + * The \@decoder must not be used after a successful return. + */ +extern pt_export void pt_pkt_free_decoder(struct pt_packet_decoder *decoder); + +/** Synchronize an Intel PT packet decoder. + * + * Search for the next synchronization point in forward or backward direction. + * + * If \@decoder has not been synchronized, yet, the search is started at the + * beginning of the trace buffer in case of forward synchronization and at the + * end of the trace buffer in case of backward synchronization. + * + * Returns zero or a positive value on success, a negative error code otherwise. + * + * Returns -pte_eos if no further synchronization point is found. + * Returns -pte_invalid if \@decoder is NULL. + */ +extern pt_export int pt_pkt_sync_forward(struct pt_packet_decoder *decoder); +extern pt_export int pt_pkt_sync_backward(struct pt_packet_decoder *decoder); + +/** Hard set synchronization point of an Intel PT decoder. + * + * Synchronize \@decoder to \@offset within the trace buffer. + * + * Returns zero on success, a negative error code otherwise. + * + * Returns -pte_eos if the given offset is behind the end of the trace buffer. + * Returns -pte_invalid if \@decoder is NULL. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Mar 19 19:09:16 2018 Return-Path: Delivered-To: svn-src-head@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 4CC37F64A4D; Mon, 19 Mar 2018 19:09:16 +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 02AA77F92D; Mon, 19 Mar 2018 19:09:16 +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 ED863127A6; Mon, 19 Mar 2018 19:09:15 +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 w2JJ9FIa068749; Mon, 19 Mar 2018 19:09:15 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JJ9F1D068748; Mon, 19 Mar 2018 19:09:15 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803191909.w2JJ9F1D068748@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 19 Mar 2018 19:09:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331221 - head/tests/sys/aio X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/tests/sys/aio X-SVN-Commit-Revision: 331221 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 19:09:16 -0000 Author: jhb Date: Mon Mar 19 19:09:15 2018 New Revision: 331221 URL: https://svnweb.freebsd.org/changeset/base/331221 Log: Revert r318180 and re-enable AIO tests on md(4) by default. The 'physio' fast-path used by AIO requests on md(4) devices, is not gated on the unsafe_aio knob. Prior to r327755, some AIO requests could fail the fast-path and fall back to the slow-path (requests for devices not supporting unmapped I/O and requests which failed with EFAULT during the fast-path). However, those cases now return a suitable error rather than using the slow-path. PR: 217261 Reviewed by: asomers Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D14742 Modified: head/tests/sys/aio/aio_test.c Modified: head/tests/sys/aio/aio_test.c ============================================================================== --- head/tests/sys/aio/aio_test.c Mon Mar 19 18:59:15 2018 (r331220) +++ head/tests/sys/aio/aio_test.c Mon Mar 19 19:09:15 2018 (r331221) @@ -667,7 +667,6 @@ aio_md_test(completion comp, struct sigevent *sev) char buf[80]; ATF_REQUIRE_KERNEL_MODULE("aio"); - ATF_REQUIRE_UNSAFE_AIO(); mdctl_fd = open("/dev/" MDCTL_NAME, O_RDWR, 0); ATF_REQUIRE_MSG(mdctl_fd != -1, From owner-svn-src-head@freebsd.org Mon Mar 19 19:32:06 2018 Return-Path: Delivered-To: svn-src-head@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 17146F665DE; Mon, 19 Mar 2018 19:32: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 BEB3480B7A; Mon, 19 Mar 2018 19:32: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 B9CB412C0B; Mon, 19 Mar 2018 19:32:05 +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 w2JJW5VU081065; Mon, 19 Mar 2018 19:32:05 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JJW5L5081064; Mon, 19 Mar 2018 19:32:05 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803191932.w2JJW5L5081064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 19 Mar 2018 19:32:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331222 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 331222 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 19:32:06 -0000 Author: markj Date: Mon Mar 19 19:32:05 2018 New Revision: 331222 URL: https://svnweb.freebsd.org/changeset/base/331222 Log: Given hidden visibility to symbols referenced by the DOF section. MFC after: 1 week Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Mon Mar 19 19:09:15 2018 (r331221) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Mon Mar 19 19:32:05 2018 (r331222) @@ -22,6 +22,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2017-2018 Mark Johnston */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -265,7 +266,7 @@ prepare_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, sym->st_value = 0; sym->st_size = 0; sym->st_info = ELF32_ST_INFO(STB_GLOBAL, STT_FUNC); - sym->st_other = 0; + sym->st_other = ELF32_ST_VISIBILITY(STV_HIDDEN); sym->st_shndx = SHN_UNDEF; rel++; @@ -449,7 +450,7 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, sym->st_value = 0; sym->st_size = 0; sym->st_info = GELF_ST_INFO(STB_GLOBAL, STT_FUNC); - sym->st_other = 0; + sym->st_other = ELF64_ST_VISIBILITY(STV_HIDDEN); sym->st_shndx = SHN_UNDEF; rel++; From owner-svn-src-head@freebsd.org Mon Mar 19 20:19:01 2018 Return-Path: Delivered-To: svn-src-head@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 5BE4EF69C96; Mon, 19 Mar 2018 20:19:01 +0000 (UTC) (envelope-from ken@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 1062783212; Mon, 19 Mar 2018 20:19:01 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 0AD921321E; Mon, 19 Mar 2018 20:19:01 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JKJ0eI003744; Mon, 19 Mar 2018 20:19:00 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JKJ0Td003743; Mon, 19 Mar 2018 20:19:00 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201803192019.w2JKJ0Td003743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Mon, 19 Mar 2018 20:19:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331223 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 331223 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 20:19:01 -0000 Author: ken Date: Mon Mar 19 20:19:00 2018 New Revision: 331223 URL: https://svnweb.freebsd.org/changeset/base/331223 Log: cam_periph_acquire() now returns an errno. The ch(4) driver was missed in change 328918, which changed cam_periph_acquire() to return an errno instead of cam_status. As a result, ch(4) failed to attach. Sponsored by: Spectra Logic Modified: head/sys/cam/scsi/scsi_ch.c Modified: head/sys/cam/scsi/scsi_ch.c ============================================================================== --- head/sys/cam/scsi/scsi_ch.c Mon Mar 19 19:32:05 2018 (r331222) +++ head/sys/cam/scsi/scsi_ch.c Mon Mar 19 20:19:00 2018 (r331223) @@ -419,7 +419,7 @@ chregister(struct cam_periph *periph, void *arg) * instance for it. We'll release this reference once the devfs * instance has been freed. */ - if (cam_periph_acquire(periph) != CAM_REQ_CMP) { + if (cam_periph_acquire(periph) != 0) { xpt_print(periph->path, "%s: lost periph during " "registration!\n", __func__); cam_periph_lock(periph); @@ -467,7 +467,7 @@ chopen(struct cdev *dev, int flags, int fmt, struct th int error; periph = (struct cam_periph *)dev->si_drv1; - if (cam_periph_acquire(periph) != CAM_REQ_CMP) + if (cam_periph_acquire(periph) != 0) return (ENXIO); softc = (struct ch_softc *)periph->softc; From owner-svn-src-head@freebsd.org Mon Mar 19 20:55:07 2018 Return-Path: Delivered-To: svn-src-head@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 7C047F423ED; Mon, 19 Mar 2018 20:55:07 +0000 (UTC) (envelope-from erj@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 2F89184EDC; Mon, 19 Mar 2018 20:55:07 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 28B9313847; Mon, 19 Mar 2018 20:55:07 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JKt7CH024203; Mon, 19 Mar 2018 20:55:07 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JKt5a3024188; Mon, 19 Mar 2018 20:55:05 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201803192055.w2JKt5a3024188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Mon, 19 Mar 2018 20:55:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331224 - head/sys/dev/ixgbe X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/ixgbe X-SVN-Commit-Revision: 331224 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 20:55:08 -0000 Author: erj Date: Mon Mar 19 20:55:05 2018 New Revision: 331224 URL: https://svnweb.freebsd.org/changeset/base/331224 Log: ixgbe(4): Update shared code, add support for X552 1G, fix bug This patch will: - Update ixgbe shared code - Add support for Intel(R) Ethernet Connection X552 1000BASE-T - Add error handling for link state check preventing VF from stopping traffic after changing PF's MTU value Submitted by: Krzysztof Galazka Reviewed by: Intel Networking Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D13885 Modified: head/sys/dev/ixgbe/if_ix.c head/sys/dev/ixgbe/if_ixv.c head/sys/dev/ixgbe/ixgbe_82598.c head/sys/dev/ixgbe/ixgbe_82599.c head/sys/dev/ixgbe/ixgbe_api.c head/sys/dev/ixgbe/ixgbe_common.c head/sys/dev/ixgbe/ixgbe_common.h head/sys/dev/ixgbe/ixgbe_dcb.c head/sys/dev/ixgbe/ixgbe_dcb_82598.c head/sys/dev/ixgbe/ixgbe_dcb_82599.c head/sys/dev/ixgbe/ixgbe_phy.c head/sys/dev/ixgbe/ixgbe_type.h head/sys/dev/ixgbe/ixgbe_vf.c head/sys/dev/ixgbe/ixgbe_x540.c head/sys/dev/ixgbe/ixgbe_x550.c Modified: head/sys/dev/ixgbe/if_ix.c ============================================================================== --- head/sys/dev/ixgbe/if_ix.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/if_ix.c Mon Mar 19 20:55:05 2018 (r331224) @@ -47,7 +47,7 @@ /************************************************************************ * Driver version ************************************************************************/ -char ixgbe_driver_version[] = "4.0.0-k"; +char ixgbe_driver_version[] = "4.0.1-k"; /************************************************************************ @@ -92,6 +92,7 @@ static pci_vendor_info_t ixgbe_vendor_info_array[] = PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550EM_X_KR, "Intel(R) PRO/10GbE PCI-Express Network Driver"), PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550EM_X_KX4, "Intel(R) PRO/10GbE PCI-Express Network Driver"), PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550EM_X_10G_T, "Intel(R) PRO/10GbE PCI-Express Network Driver"), + PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550EM_X_1G_T, "Intel(R) PRO/10GbE PCI-Express Network Driver"), PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550EM_X_SFP, "Intel(R) PRO/10GbE PCI-Express Network Driver"), PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550EM_A_KR, "Intel(R) PRO/10GbE PCI-Express Network Driver"), PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550EM_A_KR_L, "Intel(R) PRO/10GbE PCI-Express Network Driver"), Modified: head/sys/dev/ixgbe/if_ixv.c ============================================================================== --- head/sys/dev/ixgbe/if_ixv.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/if_ixv.c Mon Mar 19 20:55:05 2018 (r331224) @@ -45,7 +45,7 @@ /************************************************************************ * Driver version ************************************************************************/ -char ixv_driver_version[] = "2.0.0-k"; +char ixv_driver_version[] = "2.0.1-k"; /************************************************************************ * PCI Device ID Table @@ -616,6 +616,7 @@ ixv_if_init(if_ctx_t ctx) /* Reset VF and renegotiate mailbox API version */ hw->mac.ops.reset_hw(hw); + hw->mac.ops.start_hw(hw); error = ixv_negotiate_api(adapter); if (error) { device_printf(dev, @@ -909,10 +910,18 @@ ixv_if_update_admin_status(if_ctx_t ctx) { struct adapter *adapter = iflib_get_softc(ctx); device_t dev = iflib_get_dev(ctx); + s32 status; adapter->hw.mac.get_link_status = TRUE; - ixgbe_check_link(&adapter->hw, &adapter->link_speed, &adapter->link_up, - FALSE); + + status = ixgbe_check_link(&adapter->hw, &adapter->link_speed, + &adapter->link_up, FALSE); + + if (status != IXGBE_SUCCESS && adapter->hw.adapter_stopped == FALSE) { + /* Mailbox's Clear To Send status is lost or timeout occurred. + * We need reinitialization. */ + iflib_get_ifp(ctx)->if_init(ctx); + } if (adapter->link_up) { if (adapter->link_active == FALSE) { Modified: head/sys/dev/ixgbe/ixgbe_82598.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_82598.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_82598.c Mon Mar 19 20:55:05 2018 (r331224) @@ -550,6 +550,7 @@ out: /** * ixgbe_start_mac_link_82598 - Configures MAC link settings * @hw: pointer to hardware structure + * @autoneg_wait_to_complete: TRUE when waiting for completion is needed * * Configures link settings based on values in the ixgbe_hw struct. * Restarts the link. Performs autonegotiation if needed. @@ -1207,7 +1208,7 @@ s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u * ixgbe_read_i2c_sff8472_82598 - Reads 8 bit word over I2C interface. * @hw: pointer to hardware structure * @byte_offset: byte offset at address 0xA2 - * @eeprom_data: value read + * @sff8472_data: value read * * Performs 8 byte read operation to SFP module's SFF-8472 data over I2C **/ Modified: head/sys/dev/ixgbe/ixgbe_82599.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_82599.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_82599.c Mon Mar 19 20:55:05 2018 (r331224) @@ -270,7 +270,7 @@ s32 prot_autoc_read_82599(struct ixgbe_hw *hw, bool *l /** * prot_autoc_write_82599 - Hides MAC differences needed for AUTOC write * @hw: pointer to hardware structure - * @reg_val: value to write to AUTOC + * @autoc: value to write to AUTOC * @locked: bool to indicate whether the SW/FW lock was already taken by * previous proc_autoc_read_82599. * @@ -1373,6 +1373,7 @@ s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *h s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl, bool cloud_mode) { + UNREFERENCED_1PARAMETER(cloud_mode); DEBUGFUNC("ixgbe_init_fdir_perfect_82599"); /* @@ -1461,7 +1462,8 @@ do { \ /** * ixgbe_atr_compute_sig_hash_82599 - Compute the signature hash - * @stream: input bitstream to compute the hash on + * @input: input bitstream to compute the hash on + * @common: compressed common input dword * * This function is almost identical to the function above but contains * several optimizations such as unwinding all of the loops, letting the @@ -1600,7 +1602,7 @@ do { \ /** * ixgbe_atr_compute_perfect_hash_82599 - Compute the perfect filter hash - * @atr_input: input bitstream to compute the hash on + * @input: input bitstream to compute the hash on * @input_mask: mask for the input bitstream * * This function serves two main purposes. First it applies the input_mask @@ -1701,6 +1703,7 @@ s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *h u32 fdirm = IXGBE_FDIRM_DIPv6; u32 fdirtcpm; u32 fdirip6m; + UNREFERENCED_1PARAMETER(cloud_mode); DEBUGFUNC("ixgbe_fdir_set_atr_input_mask_82599"); /* @@ -1877,6 +1880,7 @@ s32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe u32 addr_low, addr_high; u32 cloud_type = 0; s32 err; + UNREFERENCED_1PARAMETER(cloud_mode); DEBUGFUNC("ixgbe_fdir_write_perfect_filter_82599"); if (!cloud_mode) { @@ -2001,6 +2005,7 @@ s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe * @input_mask: mask for the input bitstream * @soft_id: software index for the filters * @queue: queue index to direct traffic to + * @cloud_mode: unused * * Note that the caller to this function must lock before calling, since the * hardware writes must be protected from one another. @@ -2011,6 +2016,7 @@ s32 ixgbe_fdir_add_perfect_filter_82599(struct ixgbe_h u16 soft_id, u8 queue, bool cloud_mode) { s32 err = IXGBE_ERR_CONFIG; + UNREFERENCED_1PARAMETER(cloud_mode); DEBUGFUNC("ixgbe_fdir_add_perfect_filter_82599"); @@ -2520,6 +2526,7 @@ reset_pipeline_out: * ixgbe_read_i2c_byte_82599 - Reads 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to read + * @dev_addr: address to read from * @data: value read * * Performs byte read operation to SFP module's EEPROM over I2C interface at @@ -2577,6 +2584,7 @@ release_i2c_access: * ixgbe_write_i2c_byte_82599 - Writes 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to write + * @dev_addr: address to read from * @data: value to write * * Performs byte write operation to SFP module's EEPROM over I2C interface at Modified: head/sys/dev/ixgbe/ixgbe_api.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_api.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_api.c Mon Mar 19 20:55:05 2018 (r331224) @@ -521,6 +521,7 @@ s32 ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw * ixgbe_read_phy_reg - Read PHY register * @hw: pointer to hardware structure * @reg_addr: 32 bit address of PHY register to read + * @device_type: type of device you want to communicate with * @phy_data: Pointer to read data from PHY register * * Reads a value from a specified PHY register @@ -539,6 +540,7 @@ s32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_ad * ixgbe_write_phy_reg - Write PHY register * @hw: pointer to hardware structure * @reg_addr: 32 bit PHY register to write + * @device_type: type of device you want to communicate with * @phy_data: Data to write to the PHY register * * Writes a value to specified PHY register @@ -582,6 +584,8 @@ s32 ixgbe_setup_internal_phy(struct ixgbe_hw *hw) /** * ixgbe_check_phy_link - Determine link and speed status * @hw: pointer to hardware structure + * @speed: link speed + * @link_up: TRUE when link is up * * Reads a PHY register to determine if link is up and the current speed for * the PHY. @@ -597,6 +601,7 @@ s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_li * ixgbe_setup_phy_link_speed - Set auto advertise * @hw: pointer to hardware structure * @speed: new link speed + * @autoneg_wait_to_complete: TRUE when waiting for completion is needed * * Sets the auto advertised capabilities **/ @@ -622,6 +627,9 @@ s32 ixgbe_set_phy_power(struct ixgbe_hw *hw, bool on) /** * ixgbe_check_link - Get link and speed status * @hw: pointer to hardware structure + * @speed: pointer to link speed + * @link_up: TRUE when link is up + * @link_up_wait_to_complete: bool used to wait for link up or not * * Reads the links register to determine if link is up and the current speed **/ @@ -675,6 +683,7 @@ void ixgbe_flap_tx_laser(struct ixgbe_hw *hw) * ixgbe_setup_link - Set link speed * @hw: pointer to hardware structure * @speed: new link speed + * @autoneg_wait_to_complete: TRUE when waiting for completion is needed * * Configures link settings. Restarts the link. * Performs autonegotiation if needed. @@ -691,6 +700,7 @@ s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_s * ixgbe_setup_mac_link - Set link speed * @hw: pointer to hardware structure * @speed: new link speed + * @autoneg_wait_to_complete: TRUE when waiting for completion is needed * * Configures link settings. Restarts the link. * Performs autonegotiation if needed. @@ -706,6 +716,8 @@ s32 ixgbe_setup_mac_link(struct ixgbe_hw *hw, ixgbe_li /** * ixgbe_get_link_capabilities - Returns link capabilities * @hw: pointer to hardware structure + * @speed: link speed capabilities + * @autoneg: TRUE when autoneg or autotry is enabled * * Determines the link capabilities of the current configuration. **/ @@ -758,6 +770,7 @@ s32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 ind /** * ixgbe_blink_led_stop - Stop blinking LEDs * @hw: pointer to hardware structure + * @index: led number to stop * * Stop blinking LED based on index. **/ @@ -1000,6 +1013,7 @@ s32 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 * @mc_addr_list: the list of new multicast addresses * @mc_addr_count: number of addresses * @func: iterator function to walk the multicast address list + * @clear: flag, when set clears the table beforehand * * The given list replaces any existing list. Clears the MC addrs from receive * address registers and the multicast table. Uses unused receive address @@ -1190,7 +1204,7 @@ s32 ixgbe_setup_eee(struct ixgbe_hw *hw, bool enable_e /** * ixgbe_set_source_address_pruning - Enable/Disable source address pruning * @hw: pointer to hardware structure - * @enbale: enable or disable source address pruning + * @enable: enable or disable source address pruning * @pool: Rx pool - Rx pool to toggle source address pruning **/ void ixgbe_set_source_address_pruning(struct ixgbe_hw *hw, bool enable, Modified: head/sys/dev/ixgbe/ixgbe_common.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_common.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_common.c Mon Mar 19 20:55:05 2018 (r331224) @@ -2099,6 +2099,7 @@ static void ixgbe_shift_out_eeprom_bits(struct ixgbe_h /** * ixgbe_shift_in_eeprom_bits - Shift data bits in from the EEPROM * @hw: pointer to hardware structure + * @count: number of bits to shift **/ static u16 ixgbe_shift_in_eeprom_bits(struct ixgbe_hw *hw, u16 count) { @@ -2157,7 +2158,7 @@ static void ixgbe_raise_eeprom_clk(struct ixgbe_hw *hw /** * ixgbe_lower_eeprom_clk - Lowers the EEPROM's clock input. * @hw: pointer to hardware structure - * @eecd: EECD's current value + * @eec: EEC's current value **/ static void ixgbe_lower_eeprom_clk(struct ixgbe_hw *hw, u32 *eec) { @@ -2537,6 +2538,7 @@ s32 ixgbe_init_rx_addrs_generic(struct ixgbe_hw *hw) * ixgbe_add_uc_addr - Adds a secondary unicast address. * @hw: pointer to hardware structure * @addr: new address + * @vmdq: VMDq "set" or "pool" index * * Adds it to unused receive address register or goes into promiscuous mode. **/ @@ -2681,7 +2683,7 @@ static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *m /** * ixgbe_set_mta - Set bit-vector in multicast table * @hw: pointer to hardware structure - * @hash_value: Multicast address hash value + * @mc_addr: Multicast address * * Sets the bit-vector in the multicast table. **/ @@ -3385,6 +3387,7 @@ s32 ixgbe_disable_sec_rx_path_generic(struct ixgbe_hw /** * prot_autoc_read_generic - Hides MAC differences needed for AUTOC read * @hw: pointer to hardware structure + * @locked: bool to indicate whether the SW/FW lock was taken * @reg_val: Value we read from AUTOC * * The default case requires no protection so just to the register read. @@ -3911,7 +3914,10 @@ s32 ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw) * ixgbe_find_vlvf_slot - find the vlanid or the first empty slot * @hw: pointer to hardware structure * @vlan: VLAN id to write to VLAN filter + * @vlvf_bypass: TRUE to find vlanid only, FALSE returns first empty slot if + * vlanid not found * + * * return the VLVF index where this VLAN id should be placed * **/ @@ -4253,9 +4259,8 @@ s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, case IXGBE_LINKS_SPEED_10_X550EM_A: *speed = IXGBE_LINK_SPEED_UNKNOWN; if (hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T || - hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) { + hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) *speed = IXGBE_LINK_SPEED_10_FULL; - } break; default: *speed = IXGBE_LINK_SPEED_UNKNOWN; @@ -4583,10 +4588,11 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 length, u32 timeout, bool return_data) { u32 hdr_size = sizeof(struct ixgbe_hic_hdr); - u16 dword_len; + struct ixgbe_hic_hdr *resp = (struct ixgbe_hic_hdr *)buffer; u16 buf_len; s32 status; u32 bi; + u32 dword_len; DEBUGFUNC("ixgbe_host_interface_command"); @@ -4616,8 +4622,23 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, IXGBE_LE32_TO_CPUS(&buffer[bi]); } - /* If there is any thing in data position pull it in */ - buf_len = ((struct ixgbe_hic_hdr *)buffer)->buf_len; + /* + * If there is any thing in data position pull it in + * Read Flash command requires reading buffer length from + * two byes instead of one byte + */ + if (resp->cmd == 0x30) { + for (; bi < dword_len + 2; bi++) { + buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, + bi); + IXGBE_LE32_TO_CPUS(&buffer[bi]); + } + buf_len = (((u16)(resp->cmd_or_resp.ret_status) << 3) + & 0xF00) | resp->buf_len; + hdr_size += (2 << 2); + } else { + buf_len = resp->buf_len; + } if (!buf_len) goto rel_out; @@ -4649,6 +4670,8 @@ rel_out: * @min: driver version minor number * @build: driver version build number * @sub: driver version sub build number + * @len: unused + * @driver_ver: unused * * Sends driver version number to firmware through the manageability * block. On success return IXGBE_SUCCESS @@ -4675,10 +4698,10 @@ s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, fw_cmd.ver_build = build; fw_cmd.ver_sub = sub; fw_cmd.hdr.checksum = 0; - fw_cmd.hdr.checksum = ixgbe_calculate_checksum((u8 *)&fw_cmd, - (FW_CEM_HDR_LEN + fw_cmd.hdr.buf_len)); fw_cmd.pad = 0; fw_cmd.pad2 = 0; + fw_cmd.hdr.checksum = ixgbe_calculate_checksum((u8 *)&fw_cmd, + (FW_CEM_HDR_LEN + fw_cmd.hdr.buf_len)); for (i = 0; i <= FW_CEM_MAX_RETRIES; i++) { ret_val = ixgbe_host_interface_command(hw, (u32 *)&fw_cmd, @@ -5067,8 +5090,119 @@ s32 ixgbe_bypass_rd_eep_generic(struct ixgbe_hw *hw, u return IXGBE_SUCCESS; } +/** + * ixgbe_get_orom_version - Return option ROM from EEPROM + * + * @hw: pointer to hardware structure + * @nvm_ver: pointer to output structure + * + * if valid option ROM version, nvm_ver->or_valid set to TRUE + * else nvm_ver->or_valid is FALSE. + **/ +void ixgbe_get_orom_version(struct ixgbe_hw *hw, + struct ixgbe_nvm_version *nvm_ver) +{ + u16 offset, eeprom_cfg_blkh, eeprom_cfg_blkl; + nvm_ver->or_valid = FALSE; + /* Option Rom may or may not be present. Start with pointer */ + hw->eeprom.ops.read(hw, NVM_OROM_OFFSET, &offset); + + /* make sure offset is valid */ + if ((offset == 0x0) || (offset == NVM_INVALID_PTR)) + return; + + hw->eeprom.ops.read(hw, offset + NVM_OROM_BLK_HI, &eeprom_cfg_blkh); + hw->eeprom.ops.read(hw, offset + NVM_OROM_BLK_LOW, &eeprom_cfg_blkl); + + /* option rom exists and is valid */ + if ((eeprom_cfg_blkl | eeprom_cfg_blkh) == 0x0 || + eeprom_cfg_blkl == NVM_VER_INVALID || + eeprom_cfg_blkh == NVM_VER_INVALID) + return; + + nvm_ver->or_valid = TRUE; + nvm_ver->or_major = eeprom_cfg_blkl >> NVM_OROM_SHIFT; + nvm_ver->or_build = (eeprom_cfg_blkl << NVM_OROM_SHIFT) | + (eeprom_cfg_blkh >> NVM_OROM_SHIFT); + nvm_ver->or_patch = eeprom_cfg_blkh & NVM_OROM_PATCH_MASK; +} + /** + * ixgbe_get_oem_prod_version - Return OEM Product version + * + * @hw: pointer to hardware structure + * @nvm_ver: pointer to output structure + * + * if valid OEM product version, nvm_ver->oem_valid set to TRUE + * else nvm_ver->oem_valid is FALSE. + **/ +void ixgbe_get_oem_prod_version(struct ixgbe_hw *hw, + struct ixgbe_nvm_version *nvm_ver) +{ + u16 rel_num, prod_ver, mod_len, cap, offset; + + nvm_ver->oem_valid = FALSE; + hw->eeprom.ops.read(hw, NVM_OEM_PROD_VER_PTR, &offset); + + /* Return is offset to OEM Product Version block is invalid */ + if (offset == 0x0 && offset == NVM_INVALID_PTR) + return; + + /* Read product version block */ + hw->eeprom.ops.read(hw, offset, &mod_len); + hw->eeprom.ops.read(hw, offset + NVM_OEM_PROD_VER_CAP_OFF, &cap); + + /* Return if OEM product version block is invalid */ + if (mod_len != NVM_OEM_PROD_VER_MOD_LEN || + (cap & NVM_OEM_PROD_VER_CAP_MASK) != 0x0) + return; + + hw->eeprom.ops.read(hw, offset + NVM_OEM_PROD_VER_OFF_L, &prod_ver); + hw->eeprom.ops.read(hw, offset + NVM_OEM_PROD_VER_OFF_H, &rel_num); + + /* Return if version is invalid */ + if ((rel_num | prod_ver) == 0x0 || + rel_num == NVM_VER_INVALID || prod_ver == NVM_VER_INVALID) + return; + + nvm_ver->oem_major = prod_ver >> NVM_VER_SHIFT; + nvm_ver->oem_minor = prod_ver & NVM_VER_MASK; + nvm_ver->oem_release = rel_num; + nvm_ver->oem_valid = TRUE; +} + +/** + * ixgbe_get_etk_id - Return Etrack ID from EEPROM + * + * @hw: pointer to hardware structure + * @nvm_ver: pointer to output structure + * + * word read errors will return 0xFFFF + **/ +void ixgbe_get_etk_id(struct ixgbe_hw *hw, struct ixgbe_nvm_version *nvm_ver) +{ + u16 etk_id_l, etk_id_h; + + if (hw->eeprom.ops.read(hw, NVM_ETK_OFF_LOW, &etk_id_l)) + etk_id_l = NVM_VER_INVALID; + if (hw->eeprom.ops.read(hw, NVM_ETK_OFF_HI, &etk_id_h)) + etk_id_h = NVM_VER_INVALID; + + /* The word order for the version format is determined by high order + * word bit 15. + */ + if ((etk_id_h & NVM_ETK_VALID) == 0) { + nvm_ver->etk_id = etk_id_h; + nvm_ver->etk_id |= (etk_id_l << NVM_ETK_SHIFT); + } else { + nvm_ver->etk_id = etk_id_l; + nvm_ver->etk_id |= (etk_id_h << NVM_ETK_SHIFT); + } +} + + +/** * ixgbe_dcb_get_rtrup2tc_generic - read rtrup2tc reg * @hw: pointer to hardware structure * @map: pointer to u8 arr for returning map @@ -5138,8 +5272,8 @@ bool ixgbe_mng_present(struct ixgbe_hw *hw) return FALSE; fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM_BY_MAC(hw)); - fwsm &= IXGBE_FWSM_MODE_MASK; - return fwsm == IXGBE_FWSM_FW_MODE_PT; + + return !!(fwsm & IXGBE_FWSM_FW_MODE_PT); } /** Modified: head/sys/dev/ixgbe/ixgbe_common.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe_common.h Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_common.h Mon Mar 19 20:55:05 2018 (r331224) @@ -180,6 +180,12 @@ extern void ixgbe_stop_mac_link_on_d3_82599(struct ixg bool ixgbe_mng_present(struct ixgbe_hw *hw); bool ixgbe_mng_enabled(struct ixgbe_hw *hw); + +void ixgbe_get_etk_id(struct ixgbe_hw *hw, struct ixgbe_nvm_version *nvm_ver); +void ixgbe_get_oem_prod_version(struct ixgbe_hw *hw, + struct ixgbe_nvm_version *nvm_ver); +void ixgbe_get_orom_version(struct ixgbe_hw *hw, + struct ixgbe_nvm_version *nvm_ver); void ixgbe_disable_rx_generic(struct ixgbe_hw *hw); void ixgbe_enable_rx_generic(struct ixgbe_hw *hw); s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, Modified: head/sys/dev/ixgbe/ixgbe_dcb.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_dcb.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_dcb.c Mon Mar 19 20:55:05 2018 (r331224) @@ -45,6 +45,10 @@ * are the smallest unit programmable into the underlying * hardware. The IEEE 802.1Qaz specification do not use bandwidth * groups so this is much simplified from the CEE case. + * @bw: bandwidth index by traffic class + * @refill: refill credits index by traffic class + * @max: max credits by traffic class + * @max_frame_size: maximum frame size */ s32 ixgbe_dcb_calculate_tc_credits(u8 *bw, u16 *refill, u16 *max, int max_frame_size) @@ -79,8 +83,10 @@ s32 ixgbe_dcb_calculate_tc_credits(u8 *bw, u16 *refill /** * ixgbe_dcb_calculate_tc_credits_cee - Calculates traffic class credits - * @ixgbe_dcb_config: Struct containing DCB settings. - * @direction: Configuring either Tx or Rx. + * @hw: pointer to hardware structure + * @dcb_config: Struct containing DCB settings + * @max_frame_size: Maximum frame size + * @direction: Configuring either Tx or Rx * * This function calculates the credits allocated to each traffic class. * It should be called only after the rules are checked by Modified: head/sys/dev/ixgbe/ixgbe_dcb_82598.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_dcb_82598.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_dcb_82598.c Mon Mar 19 20:55:05 2018 (r331224) @@ -112,7 +112,9 @@ s32 ixgbe_dcb_get_pfc_stats_82598(struct ixgbe_hw *hw, /** * ixgbe_dcb_config_rx_arbiter_82598 - Config Rx data arbiter * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @tsa: transmission selection algorithm indexed by traffic class * * Configure Rx Data Arbiter and credits for each traffic class. */ @@ -167,7 +169,10 @@ s32 ixgbe_dcb_config_rx_arbiter_82598(struct ixgbe_hw /** * ixgbe_dcb_config_tx_desc_arbiter_82598 - Config Tx Desc. arbiter * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @bwg_id: bandwidth grouping indexed by traffic class + * @tsa: transmission selection algorithm indexed by traffic class * * Configure Tx Descriptor Arbiter and credits for each traffic class. */ @@ -211,7 +216,10 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_82598(struct ixgb /** * ixgbe_dcb_config_tx_data_arbiter_82598 - Config Tx data arbiter * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @bwg_id: bandwidth grouping indexed by traffic class + * @tsa: transmission selection algorithm indexed by traffic class * * Configure Tx Data Arbiter and credits for each traffic class. */ @@ -256,7 +264,7 @@ s32 ixgbe_dcb_config_tx_data_arbiter_82598(struct ixgb /** * ixgbe_dcb_config_pfc_82598 - Config priority flow control * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @pfc_en: enabled pfc bitmask * * Configure Priority Flow Control for each traffic class. */ @@ -340,7 +348,11 @@ s32 ixgbe_dcb_config_tc_stats_82598(struct ixgbe_hw *h /** * ixgbe_dcb_hw_config_82598 - Config and enable DCB * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @link_speed: unused + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @bwg_id: bandwidth grouping indexed by traffic class + * @tsa: transmission selection algorithm indexed by traffic class * * Configure dcb settings and enable dcb mode. */ Modified: head/sys/dev/ixgbe/ixgbe_dcb_82599.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_dcb_82599.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_dcb_82599.c Mon Mar 19 20:55:05 2018 (r331224) @@ -111,7 +111,11 @@ s32 ixgbe_dcb_get_pfc_stats_82599(struct ixgbe_hw *hw, /** * ixgbe_dcb_config_rx_arbiter_82599 - Config Rx Data arbiter * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @bwg_id: bandwidth grouping indexed by traffic class + * @tsa: transmission selection algorithm indexed by traffic class + * @map: priority to tc assignments indexed by priority * * Configure Rx Packet Arbiter and credits for each traffic class. */ @@ -170,7 +174,10 @@ s32 ixgbe_dcb_config_rx_arbiter_82599(struct ixgbe_hw /** * ixgbe_dcb_config_tx_desc_arbiter_82599 - Config Tx Desc. arbiter * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @bwg_id: bandwidth grouping indexed by traffic class + * @tsa: transmission selection algorithm indexed by traffic class * * Configure Tx Descriptor Arbiter and credits for each traffic class. */ @@ -215,7 +222,11 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_82599(struct ixgb /** * ixgbe_dcb_config_tx_data_arbiter_82599 - Config Tx Data arbiter * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @bwg_id: bandwidth grouping indexed by traffic class + * @tsa: transmission selection algorithm indexed by traffic class + * @map: priority to tc assignments indexed by priority * * Configure Tx Packet Arbiter and credits for each traffic class. */ @@ -363,6 +374,7 @@ s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw, u8 /** * ixgbe_dcb_config_tc_stats_82599 - Config traffic class statistics * @hw: pointer to hardware structure + * @dcb_config: pointer to ixgbe_dcb_config structure * * Configure queue statistics registers, all queues belonging to same traffic * class uses a single set of queue statistics counters. @@ -573,7 +585,12 @@ s32 ixgbe_dcb_config_82599(struct ixgbe_hw *hw, /** * ixgbe_dcb_hw_config_82599 - Configure and enable DCB * @hw: pointer to hardware structure - * @dcb_config: pointer to ixgbe_dcb_config structure + * @link_speed: unused + * @refill: refill credits index by traffic class + * @max: max credits index by traffic class + * @bwg_id: bandwidth grouping indexed by traffic class + * @tsa: transmission selection algorithm indexed by traffic class + * @map: priority to tc assignments indexed by priority * * Configure dcb settings and enable dcb mode. */ Modified: head/sys/dev/ixgbe/ixgbe_phy.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_phy.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_phy.c Mon Mar 19 20:55:05 2018 (r331224) @@ -88,8 +88,8 @@ static s32 ixgbe_in_i2c_byte_ack(struct ixgbe_hw *hw, /** * ixgbe_ones_comp_byte_add - Perform one's complement addition - * @add1 - addend 1 - * @add2 - addend 2 + * @add1: addend 1 + * @add2: addend 2 * * Returns one's complement 8-bit sum. */ @@ -400,6 +400,7 @@ s32 ixgbe_check_reset_blocked(struct ixgbe_hw *hw) /** * ixgbe_validate_phy_addr - Determines phy address is valid * @hw: pointer to hardware structure + * @phy_addr: PHY address * **/ bool ixgbe_validate_phy_addr(struct ixgbe_hw *hw, u32 phy_addr) @@ -577,6 +578,7 @@ out: * the SWFW lock * @hw: pointer to hardware structure * @reg_addr: 32 bit address of PHY register to read + * @device_type: 5 bit device type * @phy_data: Pointer to read data from PHY register **/ s32 ixgbe_read_phy_reg_mdi(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type, @@ -658,6 +660,7 @@ s32 ixgbe_read_phy_reg_mdi(struct ixgbe_hw *hw, u32 re * using the SWFW lock - this function is needed in most cases * @hw: pointer to hardware structure * @reg_addr: 32 bit address of PHY register to read + * @device_type: 5 bit device type * @phy_data: Pointer to read data from PHY register **/ s32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr, @@ -874,6 +877,7 @@ s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw) * ixgbe_setup_phy_link_speed_generic - Sets the auto advertised capabilities * @hw: pointer to hardware structure * @speed: new link speed + * @autoneg_wait_to_complete: unused **/ s32 ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw, ixgbe_link_speed speed, @@ -979,6 +983,8 @@ s32 ixgbe_get_copper_link_capabilities_generic(struct /** * ixgbe_check_phy_link_tnx - Determine link and speed status * @hw: pointer to hardware structure + * @speed: current link speed + * @link_up: TRUE is link is up, FALSE otherwise * * Reads the VS1 register to determine if link is up and the current speed for * the PHY. @@ -1934,7 +1940,7 @@ s32 ixgbe_read_i2c_eeprom_generic(struct ixgbe_hw *hw, * ixgbe_read_i2c_sff8472_generic - Reads 8 bit word over I2C interface * @hw: pointer to hardware structure * @byte_offset: byte offset at address 0xA2 - * @eeprom_data: value read + * @sff8472_data: value read * * Performs byte read operation to SFP module's SFF-8472 data over I2C **/ @@ -1983,6 +1989,7 @@ static bool ixgbe_is_sfp_probe(struct ixgbe_hw *hw, u8 * ixgbe_read_i2c_byte_generic_int - Reads 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to read + * @dev_addr: address to read from * @data: value read * @lock: TRUE if to take and release semaphore * @@ -2074,6 +2081,7 @@ fail: * ixgbe_read_i2c_byte_generic - Reads 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to read + * @dev_addr: address to read from * @data: value read * * Performs byte read operation to SFP module's EEPROM over I2C interface at @@ -2090,6 +2098,7 @@ s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u * ixgbe_read_i2c_byte_generic_unlocked - Reads 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to read + * @dev_addr: address to read from * @data: value read * * Performs byte read operation to SFP module's EEPROM over I2C interface at @@ -2106,6 +2115,7 @@ s32 ixgbe_read_i2c_byte_generic_unlocked(struct ixgbe_ * ixgbe_write_i2c_byte_generic_int - Writes 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to write + * @dev_addr: address to write to * @data: value to write * @lock: TRUE if to take and release semaphore * @@ -2177,6 +2187,7 @@ fail: * ixgbe_write_i2c_byte_generic - Writes 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to write + * @dev_addr: address to write to * @data: value to write * * Performs byte write operation to SFP module's EEPROM over I2C interface at @@ -2193,6 +2204,7 @@ s32 ixgbe_write_i2c_byte_generic(struct ixgbe_hw *hw, * ixgbe_write_i2c_byte_generic_unlocked - Writes 8 bit word over I2C * @hw: pointer to hardware structure * @byte_offset: byte offset to write + * @dev_addr: address to write to * @data: value to write * * Performs byte write operation to SFP module's EEPROM over I2C interface at @@ -2575,6 +2587,7 @@ static bool ixgbe_get_i2c_data(struct ixgbe_hw *hw, u3 { u32 data_oe_bit = IXGBE_I2C_DATA_OE_N_EN_BY_MAC(hw); bool data; + UNREFERENCED_1PARAMETER(hw); DEBUGFUNC("ixgbe_get_i2c_data"); Modified: head/sys/dev/ixgbe/ixgbe_type.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe_type.h Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_type.h Mon Mar 19 20:55:05 2018 (r331224) @@ -274,7 +274,6 @@ #define IXGBE_I2C_BB_EN_X550 0x00000100 #define IXGBE_I2C_BB_EN_X550EM_x IXGBE_I2C_BB_EN_X550 #define IXGBE_I2C_BB_EN_X550EM_a IXGBE_I2C_BB_EN_X550 - #define IXGBE_I2C_BB_EN_BY_MAC(_hw) IXGBE_BY_MAC((_hw), I2C_BB_EN) #define IXGBE_I2C_CLK_OE_N_EN 0 @@ -286,6 +285,47 @@ #define IXGBE_I2C_CLOCK_STRETCHING_TIMEOUT 500 + +#define NVM_OROM_OFFSET 0x17 +#define NVM_OROM_BLK_LOW 0x83 +#define NVM_OROM_BLK_HI 0x84 +#define NVM_OROM_PATCH_MASK 0xFF +#define NVM_OROM_SHIFT 8 + +#define NVM_VER_MASK 0x00FF /* version mask */ +#define NVM_VER_SHIFT 8 /* version bit shift */ +#define NVM_OEM_PROD_VER_PTR 0x1B /* OEM Product version block pointer */ +#define NVM_OEM_PROD_VER_CAP_OFF 0x1 /* OEM Product version format offset */ +#define NVM_OEM_PROD_VER_OFF_L 0x2 /* OEM Product version offset low */ +#define NVM_OEM_PROD_VER_OFF_H 0x3 /* OEM Product version offset high */ +#define NVM_OEM_PROD_VER_CAP_MASK 0xF /* OEM Product version cap mask */ +#define NVM_OEM_PROD_VER_MOD_LEN 0x3 /* OEM Product version module length */ +#define NVM_ETK_OFF_LOW 0x2D /* version low order word */ +#define NVM_ETK_OFF_HI 0x2E /* version high order word */ +#define NVM_ETK_SHIFT 16 /* high version word shift */ +#define NVM_VER_INVALID 0xFFFF +#define NVM_ETK_VALID 0x8000 +#define NVM_INVALID_PTR 0xFFFF +#define NVM_VER_SIZE 32 /* version sting size */ + +struct ixgbe_nvm_version { + u32 etk_id; + u8 nvm_major; + u16 nvm_minor; + u8 nvm_id; + + bool oem_valid; + u8 oem_major; + u8 oem_minor; + u16 oem_release; + + bool or_valid; + u8 or_major; + u16 or_build; + u8 or_patch; + +}; + /* Interrupt Registers */ #define IXGBE_EICR 0x00800 #define IXGBE_EICS 0x00808 @@ -553,7 +593,6 @@ #define IXGBE_VXLANCTRL_VXLAN_UDPPORT_MASK 0x0000ffff /* VXLAN port */ #define IXGBE_VXLANCTRL_GENEVE_UDPPORT_MASK 0xffff0000 /* GENEVE port */ #define IXGBE_VXLANCTRL_ALL_UDPPORT_MASK 0xffffffff /* GENEVE/VXLAN */ - #define IXGBE_VXLANCTRL_GENEVE_UDPPORT_SHIFT 16 #define IXGBE_FHFT(_n) (0x09000 + ((_n) * 0x100)) /* Flex host filter table */ @@ -563,7 +602,6 @@ /* Four Flexible Filters are supported */ #define IXGBE_FLEXIBLE_FILTER_COUNT_MAX 4 - /* Six Flexible Filters are supported */ #define IXGBE_FLEXIBLE_FILTER_COUNT_MAX_6 6 /* Eight Flexible Filters are supported */ @@ -711,8 +749,6 @@ struct ixgbe_dmac_config { #define IXGBE_EEE_RX_LPI_STATUS 0x40000000 /* RX Link in LPI status */ #define IXGBE_EEE_TX_LPI_STATUS 0x80000000 /* TX Link in LPI status */ - - /* Security Control Registers */ #define IXGBE_SECTXCTRL 0x08800 #define IXGBE_SECTXSTAT 0x08804 @@ -850,7 +886,6 @@ struct ixgbe_dmac_config { #define IXGBE_RTTBCNRTT 0x05150 #define IXGBE_RTTBCNRD 0x0498C - /* FCoE DMA Context Registers */ /* FCoE Direct DMA Context */ #define IXGBE_FCDDC(_i, _j) (0x20000 + ((_i) * 0x4) + ((_j) * 0x10)) @@ -4274,7 +4309,6 @@ struct ixgbe_bypass_eeprom { #define BYPASS_LOG_EVENT_SHIFT 28 #define BYPASS_LOG_CLEAR_SHIFT 24 /* bit offset */ - #define IXGBE_FUSES0_GROUP(_i) (0x11158 + ((_i) * 4)) #define IXGBE_FUSES0_300MHZ (1 << 5) Modified: head/sys/dev/ixgbe/ixgbe_vf.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_vf.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_vf.c Mon Mar 19 20:55:05 2018 (r331224) @@ -376,6 +376,7 @@ s32 ixgbe_set_rar_vf(struct ixgbe_hw *hw, u32 index, u * @mc_addr_list: array of multicast addresses to program * @mc_addr_count: number of multicast addresses to program * @next: caller supplied function to return next address in list + * @clear: unused * * Updates the Multicast Table Array. **/ @@ -509,8 +510,9 @@ u32 ixgbe_get_num_of_rx_queues_vf(struct ixgbe_hw *hw) } /** - * ixgbe_get_mac_addr_vf - Read device MAC address - * @hw: pointer to the HW structure + * ixgbe_get_mac_addr_vf - Read device MAC address + * @hw: pointer to the HW structure + * @mac_addr: the MAC address **/ s32 ixgbe_get_mac_addr_vf(struct ixgbe_hw *hw, u8 *mac_addr) { @@ -556,7 +558,6 @@ s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 in * ixgbe_setup_mac_link_vf - Setup MAC link settings * @hw: pointer to hardware structure * @speed: new link speed - * @autoneg: TRUE if autonegotiation enabled * @autoneg_wait_to_complete: TRUE when waiting for completion is needed * * Set the link speed in the AUTOC register and restarts link. Modified: head/sys/dev/ixgbe/ixgbe_x540.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_x540.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_x540.c Mon Mar 19 20:55:05 2018 (r331224) @@ -785,6 +785,9 @@ s32 ixgbe_acquire_swfw_sync_X540(struct ixgbe_hw *hw, swmask |= swi2c_mask; fwmask |= swi2c_mask << 2; + if (hw->mac.type >= ixgbe_mac_X550) + timeout = 1000; + for (i = 0; i < timeout; i++) { /* SW NVM semaphore bit is used for access to all * SW_FW_SYNC bits (not just NVM) Modified: head/sys/dev/ixgbe/ixgbe_x550.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_x550.c Mon Mar 19 20:19:00 2018 (r331223) +++ head/sys/dev/ixgbe/ixgbe_x550.c Mon Mar 19 20:55:05 2018 (r331224) @@ -337,98 +337,6 @@ static void ixgbe_setup_mux_ctl(struct ixgbe_hw *hw) } /** - * ixgbe_read_phy_reg_mdi_22 - Read from a clause 22 PHY register without lock - * @hw: pointer to hardware structure - * @reg_addr: 32 bit address of PHY register to read - * @dev_type: always unused - * @phy_data: Pointer to read data from PHY register - */ -static s32 ixgbe_read_phy_reg_mdi_22(struct ixgbe_hw *hw, u32 reg_addr, - u32 dev_type, u16 *phy_data) -{ - u32 i, data, command; - UNREFERENCED_1PARAMETER(dev_type); - - /* Setup and write the read command */ - command = (reg_addr << IXGBE_MSCA_DEV_TYPE_SHIFT) | - (hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) | - IXGBE_MSCA_OLD_PROTOCOL | IXGBE_MSCA_READ_AUTOINC | - IXGBE_MSCA_MDI_COMMAND; - - IXGBE_WRITE_REG(hw, IXGBE_MSCA, command); - - /* Check every 10 usec to see if the access completed. - * The MDI Command bit will clear when the operation is - * complete - */ - for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) { - usec_delay(10); - - command = IXGBE_READ_REG(hw, IXGBE_MSCA); - if (!(command & IXGBE_MSCA_MDI_COMMAND)) - break; - } - - if (command & IXGBE_MSCA_MDI_COMMAND) { - ERROR_REPORT1(IXGBE_ERROR_POLLING, - "PHY read command did not complete.\n"); - return IXGBE_ERR_PHY; - } - - /* Read operation is complete. Get the data from MSRWD */ - data = IXGBE_READ_REG(hw, IXGBE_MSRWD); - data >>= IXGBE_MSRWD_READ_DATA_SHIFT; - *phy_data = (u16)data; - - return IXGBE_SUCCESS; -} - -/** - * ixgbe_write_phy_reg_mdi_22 - Write to a clause 22 PHY register without lock - * @hw: pointer to hardware structure - * @reg_addr: 32 bit PHY register to write - * @dev_type: always unused - * @phy_data: Data to write to the PHY register - */ -static s32 ixgbe_write_phy_reg_mdi_22(struct ixgbe_hw *hw, u32 reg_addr, - u32 dev_type, u16 phy_data) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Mar 19 21:13:26 2018 Return-Path: Delivered-To: svn-src-head@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 89567F46B48; Mon, 19 Mar 2018 21:13:26 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 3C57585EAB; Mon, 19 Mar 2018 21:13:26 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3732313B5A; Mon, 19 Mar 2018 21:13:26 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JLDPr0033956; Mon, 19 Mar 2018 21:13:25 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JLDP85033955; Mon, 19 Mar 2018 21:13:25 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803192113.w2JLDP85033955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Mon, 19 Mar 2018 21:13:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331225 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 331225 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 21:13:26 -0000 Author: kp Date: Mon Mar 19 21:13:25 2018 New Revision: 331225 URL: https://svnweb.freebsd.org/changeset/base/331225 Log: pf: Fix memory leak in DIOCRADDTABLES If a user attempts to add two tables with the same name the duplicate table will not be added, but we forgot to free the duplicate table, leaking memory. Ensure we free the duplicate table in the error path. Reported by: Coverity CID: 1382111 MFC after: 3 weeks Modified: head/sys/netpfil/pf/pf_table.c Modified: head/sys/netpfil/pf/pf_table.c ============================================================================== --- head/sys/netpfil/pf/pf_table.c Mon Mar 19 20:55:05 2018 (r331224) +++ head/sys/netpfil/pf/pf_table.c Mon Mar 19 21:13:25 2018 (r331225) @@ -1131,8 +1131,10 @@ pfr_add_tables(struct pfr_table *tbl, int size, int *n if (p == NULL) senderr(ENOMEM); SLIST_FOREACH(q, &addq, pfrkt_workq) { - if (!pfr_ktable_compare(p, q)) + if (!pfr_ktable_compare(p, q)) { + pfr_destroy_ktable(p, 0); goto _skip; + } } SLIST_INSERT_HEAD(&addq, p, pfrkt_workq); xadd++; From owner-svn-src-head@freebsd.org Mon Mar 19 21:26:33 2018 Return-Path: Delivered-To: svn-src-head@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 A8373F4AA54; Mon, 19 Mar 2018 21:26:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 56ABD866FB; Mon, 19 Mar 2018 21:26:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5193113CD4; Mon, 19 Mar 2018 21:26:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JLQX0T039362; Mon, 19 Mar 2018 21:26:33 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JLQW0N039356; Mon, 19 Mar 2018 21:26:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803192126.w2JLQW0N039356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Mar 2018 21:26:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331226 - in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Commit-Revision: 331226 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 21:26:33 -0000 Author: emaste Date: Mon Mar 19 21:26:32 2018 New Revision: 331226 URL: https://svnweb.freebsd.org/changeset/base/331226 Log: Rename linuxulator functions with linux_ prefix It's preferable to have a consistent prefix. This also reduces differences between the three linux*_sysvec.c files. Sponsored by: Turing Robotic Industries Inc. Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux.h head/sys/amd64/linux32/linux32_sysvec.c head/sys/i386/linux/linux.h head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Mon Mar 19 21:13:25 2018 (r331225) +++ head/sys/amd64/linux/linux_sysvec.c Mon Mar 19 21:26:32 2018 (r331226) @@ -119,14 +119,14 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); static register_t * linux_copyout_strings(struct image_params *imgp); -static int elf_linux_fixup(register_t **stack_base, +static int linux_elf_fixup(register_t **stack_base, struct image_params *iparams); static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); static void linux_vdso_install(void *param); static void linux_vdso_deinstall(void *param); static void linux_set_syscall_retval(struct thread *td, int error); static int linux_fetch_syscall_args(struct thread *td); -static int exec_linux_imgact_try(struct image_params *iparams); +static int linux_exec_imgact_try(struct image_params *iparams); static void linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); static int linux_vsyscall(struct thread *td); @@ -180,7 +180,7 @@ LINUX_VDSO_SYM_CHAR(linux_platform); * MPSAFE */ static int -translate_traps(int signal, int trap_code) +linux_translate_traps(int signal, int trap_code) { if (signal != SIGBUS) @@ -245,7 +245,7 @@ linux_set_syscall_retval(struct thread *td, int error) } static int -elf_linux_fixup(register_t **stack_base, struct image_params *imgp) +linux_fixup_elf(register_t **stack_base, struct image_params *imgp) { Elf_Auxargs *args; Elf_Addr *base; @@ -258,7 +258,7 @@ elf_linux_fixup(register_t **stack_base, struct image_ arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; KASSERT(curthread->td_proc == imgp->proc, - ("unsafe elf_linux_fixup(), should be curproc")); + ("unsafe linux_fixup_elf(), should be curproc")); base = (Elf64_Addr *)*stack_base; args = (Elf64_Auxargs *)imgp->auxargs; pos = base + (imgp->args->argc + imgp->args->envc + 2); @@ -671,7 +671,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse * binary is doing the exec, so we do not create an EXEC module for it. */ static int -exec_linux_imgact_try(struct image_params *imgp) +linux_exec_imgact_try(struct image_params *imgp) { const char *head = (const char *)imgp->image_header; char *rpath; @@ -753,14 +753,14 @@ struct sysentvec elf_linux_sysvec = { .sv_mask = 0, .sv_errsize = ELAST + 1, .sv_errtbl = bsd_to_linux_errno_generic, - .sv_transtrap = translate_traps, - .sv_fixup = elf_linux_fixup, + .sv_transtrap = linux_translate_traps, + .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_rt_sendsig, .sv_sigcode = &_binary_linux_locore_o_start, .sv_szsigcode = &linux_szsigcode, .sv_name = "Linux ELF64", .sv_coredump = elf64_coredump, - .sv_imgact_try = exec_linux_imgact_try, + .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Mon Mar 19 21:13:25 2018 (r331225) +++ head/sys/amd64/linux32/linux.h Mon Mar 19 21:26:32 2018 (r331226) @@ -116,7 +116,7 @@ typedef struct { */ #define LINUX_AT_COUNT 20 /* Count of used aux entry types. * Keep this synchronized with - * elf_linux_fixup() code. + * linux_fixup_elf() code. */ struct l___sysctl_args { Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Mon Mar 19 21:13:25 2018 (r331225) +++ head/sys/amd64/linux32/linux32_sysvec.c Mon Mar 19 21:26:32 2018 (r331226) @@ -120,12 +120,12 @@ extern struct sysent linux32_sysent[LINUX32_SYS_MAXSYS SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); -static int elf_linux_fixup(register_t **stack_base, +static int linux_fixup_elf(register_t **stack_base, struct image_params *iparams); static register_t *linux_copyout_strings(struct image_params *imgp); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); -static int exec_linux_imgact_try(struct image_params *iparams); -static void exec_linux_setregs(struct thread *td, +static int linux_exec_imgact_try(struct image_params *iparams); +static void linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); static void linux32_fixlimit(struct rlimit *rl, int which); static bool linux32_trans_osrel(const Elf_Note *note, int32_t *osrel); @@ -190,7 +190,7 @@ LINUX_VDSO_SYM_CHAR(linux_platform); * MPSAFE */ static int -translate_traps(int signal, int trap_code) +linux_translate_traps(int signal, int trap_code) { if (signal != SIGBUS) return signal; @@ -206,7 +206,7 @@ translate_traps(int signal, int trap_code) } static int -elf_linux_fixup(register_t **stack_base, struct image_params *imgp) +linux_fixup_elf(register_t **stack_base, struct image_params *imgp) { Elf32_Auxargs *args; Elf32_Addr *base; @@ -217,7 +217,7 @@ elf_linux_fixup(register_t **stack_base, struct image_ arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; KASSERT(curthread->td_proc == imgp->proc, - ("unsafe elf_linux_fixup(), should be curproc")); + ("unsafe linux_fixup_elf(), should be curproc")); base = (Elf32_Addr *)*stack_base; args = (Elf32_Auxargs *)imgp->auxargs; pos = base + (imgp->args->argc + imgp->args->envc + 2); @@ -724,7 +724,7 @@ linux32_fetch_syscall_args(struct thread *td) * binary is doing the exec, so we do not create an EXEC module for it. */ static int -exec_linux_imgact_try(struct image_params *imgp) +linux_exec_imgact_try(struct image_params *imgp) { const char *head = (const char *)imgp->image_header; char *rpath; @@ -758,7 +758,7 @@ exec_linux_imgact_try(struct image_params *imgp) * XXX copied from ia32_signal.c. */ static void -exec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack) +linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct trapframe *regs = td->td_frame; struct pcb *pcb = td->td_pcb; @@ -953,14 +953,14 @@ struct sysentvec elf_linux_sysvec = { .sv_mask = 0, .sv_errsize = ELAST + 1, .sv_errtbl = bsd_to_linux_errno_generic, - .sv_transtrap = translate_traps, - .sv_fixup = elf_linux_fixup, + .sv_transtrap = linux_translate_traps, + .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_sendsig, .sv_sigcode = &_binary_linux32_locore_o_start, .sv_szsigcode = &linux_szsigcode, .sv_name = "Linux ELF32", .sv_coredump = elf32_coredump, - .sv_imgact_try = exec_linux_imgact_try, + .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, @@ -969,7 +969,7 @@ struct sysentvec elf_linux_sysvec = { .sv_psstrings = LINUX32_PS_STRINGS, .sv_stackprot = VM_PROT_ALL, .sv_copyout_strings = linux_copyout_strings, - .sv_setregs = exec_linux_setregs, + .sv_setregs = linux_exec_setregs, .sv_fixlimit = linux32_fixlimit, .sv_maxssiz = &linux32_maxssiz, .sv_flags = SV_ABI_LINUX | SV_ILP32 | SV_IA32 | SV_SHP, Modified: head/sys/i386/linux/linux.h ============================================================================== --- head/sys/i386/linux/linux.h Mon Mar 19 21:13:25 2018 (r331225) +++ head/sys/i386/linux/linux.h Mon Mar 19 21:26:32 2018 (r331226) @@ -110,7 +110,7 @@ typedef struct { */ #define LINUX_AT_COUNT 20 /* Count of used aux entry types. * Keep this synchronized with - * elf_linux_fixup() code. + * linux_fixup_elf() code. */ struct l___sysctl_args { Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Mon Mar 19 21:13:25 2018 (r331225) +++ head/sys/i386/linux/linux_sysvec.c Mon Mar 19 21:26:32 2018 (r331226) @@ -109,11 +109,11 @@ SET_DECLARE(linux_ioctl_handler_set, struct linux_ioct static int linux_fixup(register_t **stack_base, struct image_params *iparams); -static int elf_linux_fixup(register_t **stack_base, +static int linux_fixup_elf(register_t **stack_base, struct image_params *iparams); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); -static int exec_linux_imgact_try(struct image_params *iparams); -static void exec_linux_setregs(struct thread *td, +static int linux_exec_imgact_try(struct image_params *iparams); +static void linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); static register_t *linux_copyout_strings(struct image_params *imgp); static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); @@ -177,7 +177,7 @@ LINUX_VDSO_SYM_INTPTR(linux_vsyscall); * MPSAFE */ static int -translate_traps(int signal, int trap_code) +linux_translate_traps(int signal, int trap_code) { if (signal != SIGBUS) return (signal); @@ -209,7 +209,7 @@ linux_fixup(register_t **stack_base, struct image_para } static int -elf_linux_fixup(register_t **stack_base, struct image_params *imgp) +linux_fixup_elf(register_t **stack_base, struct image_params *imgp) { struct proc *p; Elf32_Auxargs *args; @@ -219,7 +219,7 @@ elf_linux_fixup(register_t **stack_base, struct image_ int issetugid; KASSERT(curthread->td_proc == imgp->proc, - ("unsafe elf_linux_fixup(), should be curproc")); + ("unsafe linux_fixup_elf(), should be curproc")); p = imgp->proc; issetugid = imgp->proc->p_flag & P_SUGID ? 1 : 0; @@ -821,7 +821,7 @@ linux_fetch_syscall_args(struct thread *td) * binary is doing the exec, so we do not create an EXEC module for it. */ static int -exec_linux_imgact_try(struct image_params *imgp) +linux_exec_imgact_try(struct image_params *imgp) { const char *head = (const char *)imgp->image_header; char *rpath; @@ -856,7 +856,7 @@ exec_linux_imgact_try(struct image_params *imgp) * override the exec_setregs default(s) here. */ static void -exec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack) +linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct pcb *pcb = td->td_pcb; @@ -894,14 +894,14 @@ struct sysentvec linux_sysvec = { .sv_mask = 0, .sv_errsize = ELAST + 1, .sv_errtbl = bsd_to_linux_errno_generic, - .sv_transtrap = translate_traps, + .sv_transtrap = linux_translate_traps, .sv_fixup = linux_fixup, .sv_sendsig = linux_sendsig, .sv_sigcode = &_binary_linux_locore_o_start, .sv_szsigcode = &linux_szsigcode, .sv_name = "Linux a.out", .sv_coredump = NULL, - .sv_imgact_try = exec_linux_imgact_try, + .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, @@ -910,7 +910,7 @@ struct sysentvec linux_sysvec = { .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_ALL, .sv_copyout_strings = exec_copyout_strings, - .sv_setregs = exec_linux_setregs, + .sv_setregs = linux_exec_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, .sv_flags = SV_ABI_LINUX | SV_AOUT | SV_IA32 | SV_ILP32, @@ -931,14 +931,14 @@ struct sysentvec elf_linux_sysvec = { .sv_mask = 0, .sv_errsize = ELAST + 1, .sv_errtbl = bsd_to_linux_errno_generic, - .sv_transtrap = translate_traps, - .sv_fixup = elf_linux_fixup, + .sv_transtrap = linux_translate_traps, + .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_sendsig, .sv_sigcode = &_binary_linux_locore_o_start, .sv_szsigcode = &linux_szsigcode, .sv_name = "Linux ELF", .sv_coredump = elf32_coredump, - .sv_imgact_try = exec_linux_imgact_try, + .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, @@ -947,7 +947,7 @@ struct sysentvec elf_linux_sysvec = { .sv_psstrings = LINUX_PS_STRINGS, .sv_stackprot = VM_PROT_ALL, .sv_copyout_strings = linux_copyout_strings, - .sv_setregs = exec_linux_setregs, + .sv_setregs = linux_exec_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, .sv_flags = SV_ABI_LINUX | SV_IA32 | SV_ILP32 | SV_SHP, From owner-svn-src-head@freebsd.org Mon Mar 19 21:32:44 2018 Return-Path: Delivered-To: svn-src-head@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 28817F4B2D7; Mon, 19 Mar 2018 21:32:44 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x234.google.com (mail-it0-x234.google.com [IPv6:2607:f8b0:4001:c0b::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B1F2186D83; Mon, 19 Mar 2018 21:32:43 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x234.google.com with SMTP id y20-v6so12092726itc.5; Mon, 19 Mar 2018 14:32:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=GWqjTlj7+CLLF7JZ8BVMglGqb9HMOR5aOazEYobe66E=; b=AJu9wen5nJzjq0EIIDQOd8sqQrU+ni+cQLtXm/Zc5jUnO+egDTeio5M1UfrxwN2I+O rndznF083dX0OsshRuaw55LKrsYn7dliWy6BV05tTOW23XyDU/DRHlMAX29JW83GTu5i bYSOXrvt8dszkrGBwKVHgmUeuWmX7Obg+OEdeYLk35AYcNuZ7Zv9qMY3GS0GheeISuRr CmqGQVVOt5MWmLqchJdNTUJT3jcPAewCtgq9i+E+BbmSzwssvLrWyZ1GJCxhkIi3N69D wSJmTvdb1uxG0iIccBn3zCsynbL64ezEvOJbDLCQl9RUY2E2qomIfeff1IWWs80ZgT9K WlYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=GWqjTlj7+CLLF7JZ8BVMglGqb9HMOR5aOazEYobe66E=; b=K+c+uhch9vZ8ApKqE/6D4Dc9wIWGfKlHYbW1RXXvgkOiL4CEAuisGRVjWXr/5XOk7Y 8GBksA/o01YdRJTjkSt5DGWVKUdkhdq1IoieN+0MTiHPN0jP0tC4SEsmDo5ZSMSCAab7 CuMTQgK0Sj/jzduC6H5i95tul1NB39lhD8gDknRSVTxyW44E//mc/EZVq8w3qUBzbl22 4LswSQWQUu+ncl7847PPvdvqKpXyDTBOv2YCmjGXe4XtUwhkCFVUE9GUVW0wfN716BcA PZSUBj3FJ8VDIHq8Qav824bT7/SDhSdyrnm5wWtZc1CaZgPQvJ3gpXs6206jI9Qm5Wi6 VlIQ== X-Gm-Message-State: AElRT7EILdmgRu+xHmqraaTn0di+y6OWOn3zqav4c+R886YRREaL++ii O7cHEpIIcKUwUXxFYX0T5aw/W5bv88KG6vb2ogWcOQ== X-Google-Smtp-Source: AG47ELv3pIujZ2RglMkpphkGFCAcYbFYj/nnBLWc8TLjgny9sfRhjISbpuC6obonZBcBK3JQmniNxv1Vuif7Z+T2Ers= X-Received: by 2002:a24:7c6:: with SMTP id f189-v6mr334724itf.114.1521495162730; Mon, 19 Mar 2018 14:32:42 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.163.13 with HTTP; Mon, 19 Mar 2018 14:32:22 -0700 (PDT) In-Reply-To: <1806390.PUHUxB7aSs@ralph.baldwin.cx> References: <201803161451.w2GEpl3T053141@repo.freebsd.org> <1806390.PUHUxB7aSs@ralph.baldwin.cx> From: Ed Maste Date: Mon, 19 Mar 2018 17:32:22 -0400 X-Google-Sender-Auth: KAvOUy35hpxRfThy7yor2V2eQrU Message-ID: Subject: Re: svn commit: r331057 - head/sys/compat/linux To: John Baldwin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 21:32:44 -0000 On 16 March 2018 at 17:08, John Baldwin wrote: > On Friday, March 16, 2018 02:51:47 PM Ed Maste wrote: >> Author: emaste >> Date: Fri Mar 16 14:51:47 2018 >> New Revision: 331057 >> URL: https://svnweb.freebsd.org/changeset/base/331057 >> >> Log: >> linux_errno.c: add newer errno values > > Could you move the table to a header perhaps so it can also be shared > with lib/libsysdecode/errno.c (which has another copy of this table)? I found that copy shortly after I made this change (and then updated it to match). We could just add linux_errno.c to libsysdecode though? From owner-svn-src-head@freebsd.org Mon Mar 19 22:43:28 2018 Return-Path: Delivered-To: svn-src-head@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 9E3C7F50575; Mon, 19 Mar 2018 22:43:28 +0000 (UTC) (envelope-from mjoras@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 4DB9A69FDE; Mon, 19 Mar 2018 22:43:28 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 47B4D1491D; Mon, 19 Mar 2018 22:43:28 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JMhSaU079313; Mon, 19 Mar 2018 22:43:28 GMT (envelope-from mjoras@FreeBSD.org) Received: (from mjoras@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JMhS6N079312; Mon, 19 Mar 2018 22:43:28 GMT (envelope-from mjoras@FreeBSD.org) Message-Id: <201803192243.w2JMhS6N079312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjoras set sender to mjoras@FreeBSD.org using -f From: Matt Joras Date: Mon, 19 Mar 2018 22:43:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331227 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjoras X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331227 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 22:43:28 -0000 Author: mjoras Date: Mon Mar 19 22:43:27 2018 New Revision: 331227 URL: https://svnweb.freebsd.org/changeset/base/331227 Log: Fix initialization of eventhandler mutex. mtx_init does not do a copy of the name string it is passed. The eventhandler code incorrectly passed the parameter string directly to mtx_init instead of using the copy it makes. This was an existing problem with the code that I dutifully copied over in my changes in r325621. Reported by: Anton Rang Reviewed by: rstone, markj Approved by: rstone (mentor) MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14764 Modified: head/sys/kern/subr_eventhandler.c Modified: head/sys/kern/subr_eventhandler.c ============================================================================== --- head/sys/kern/subr_eventhandler.c Mon Mar 19 21:26:32 2018 (r331226) +++ head/sys/kern/subr_eventhandler.c Mon Mar 19 22:43:27 2018 (r331227) @@ -90,9 +90,10 @@ eventhandler_find_or_create_list(const char *name) CTR2(KTR_EVH, "%s: creating list \"%s\"", __func__, name); list = new_list; TAILQ_INIT(&list->el_entries); - mtx_init(&list->el_lock, name, "eventhandler list", MTX_DEF); list->el_name = (char *)(list + 1); strcpy(list->el_name, name); + mtx_init(&list->el_lock, list->el_name, "eventhandler list", + MTX_DEF); TAILQ_INSERT_HEAD(&eventhandler_lists, list, el_link); } } From owner-svn-src-head@freebsd.org Mon Mar 19 23:21:46 2018 Return-Path: Delivered-To: svn-src-head@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 77626F53398; Mon, 19 Mar 2018 23:21:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 2C96C6BC5A; Mon, 19 Mar 2018 23:21:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 275E014F21; Mon, 19 Mar 2018 23:21:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JNLkY2097548; Mon, 19 Mar 2018 23:21:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JNLj7h097538; Mon, 19 Mar 2018 23:21:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803192321.w2JNLj7h097538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 19 Mar 2018 23:21:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331228 - in head/sys/dev/mpr: . mpi X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/dev/mpr: . mpi X-SVN-Commit-Revision: 331228 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 23:21:46 -0000 Author: mav Date: Mon Mar 19 23:21:45 2018 New Revision: 331228 URL: https://svnweb.freebsd.org/changeset/base/331228 Log: Update mpr(4) driver from v15 to v18 from Broadcom site. Version 16 is just a number bump, since we already had those changes. Version 17 introduces new AdapterType value, that allows new user-space tools from Broadcom to differentiate adapter generations 3 and 3.5. Version 18 updates headers and adds SAS_DEVICE_DISCOVERY_ERROR reporting. MFC after: 2 weeks Modified: head/sys/dev/mpr/mpi/mpi2.h head/sys/dev/mpr/mpi/mpi2_cnfg.h head/sys/dev/mpr/mpi/mpi2_history.txt head/sys/dev/mpr/mpi/mpi2_ioc.h head/sys/dev/mpr/mpr_ioctl.h head/sys/dev/mpr/mpr_sas.c head/sys/dev/mpr/mpr_sas_lsi.c head/sys/dev/mpr/mpr_user.c head/sys/dev/mpr/mprvar.h Modified: head/sys/dev/mpr/mpi/mpi2.h ============================================================================== --- head/sys/dev/mpr/mpi/mpi2.h Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpi/mpi2.h Mon Mar 19 23:21:45 2018 (r331228) @@ -44,7 +44,7 @@ * scatter/gather formats. * Creation Date: June 21, 2006 * - * mpi2.h Version: 02.00.46 + * mpi2.h Version: 02.00.48 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -151,6 +151,8 @@ * 04-10-16 02.00.44 Bumped MPI2_HEADER_VERSION_UNIT. * 07-06-16 02.00.45 Bumped MPI2_HEADER_VERSION_UNIT. * 09-02-16 02.00.46 Bumped MPI2_HEADER_VERSION_UNIT. + * 11-23-16 02.00.47 Bumped MPI2_HEADER_VERSION_UNIT. + * 02-03-17 02.00.48 Bumped MPI2_HEADER_VERSION_UNIT. * -------------------------------------------------------------------------- */ @@ -194,7 +196,7 @@ /* Unit and Dev versioning for this MPI header set */ -#define MPI2_HEADER_VERSION_UNIT (0x2E) +#define MPI2_HEADER_VERSION_UNIT (0x30) #define MPI2_HEADER_VERSION_DEV (0x00) #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) Modified: head/sys/dev/mpr/mpi/mpi2_cnfg.h ============================================================================== --- head/sys/dev/mpr/mpi/mpi2_cnfg.h Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpi/mpi2_cnfg.h Mon Mar 19 23:21:45 2018 (r331228) @@ -42,7 +42,7 @@ * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - * mpi2_cnfg.h Version: 02.00.39 + * mpi2_cnfg.h Version: 02.00.40 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -255,6 +255,10 @@ * 09-01-16 02.00.39 Added MPI26_CONFIG_PAGE_ENCLOSURE_0 and related defines. * Added MPI26_ENCLOS_PGAD_FORM_GET_NEXT_HANDLE and * MPI26_ENCLOS_PGAD_FORM_HANDLE page address formats. + * 02-02-17 02.00.40 Added MPI2_MANPAGE7_SLOT_UNKNOWN. + * Added ChassisSlot field to SAS Enclosure Page 0. + * Added ChassisSlot Valid bit (bit 5) to the Flags field + * in SAS Enclosure Page 0. * -------------------------------------------------------------------------- */ @@ -853,6 +857,9 @@ typedef struct _MPI2_MANPAGE7_CONNECTOR_INFO #define MPI2_MANPAGE7_LOCATION_NOT_PRESENT (0x20) #define MPI2_MANPAGE7_LOCATION_NOT_CONNECTED (0x80) +/* defines for the Slot field */ +#define MPI2_MANPAGE7_SLOT_UNKNOWN (0xFFFF) + /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to * one and check the value returned for NumPhys at runtime. @@ -3092,11 +3099,11 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0 U16 EnclosureHandle; /* 0x16 */ U16 NumSlots; /* 0x18 */ U16 StartSlot; /* 0x1A */ - U8 Reserved2; /* 0x1C */ + U8 ChassisSlot; /* 0x1C */ U8 EnclosureLevel; /* 0x1D */ U16 SEPDevHandle; /* 0x1E */ - U32 Reserved3; /* 0x20 */ - U32 Reserved4; /* 0x24 */ + U32 Reserved2; /* 0x20 */ + U32 Reserved3; /* 0x24 */ } MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0, MPI2_POINTER PTR_MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0, Mpi2SasEnclosurePage0_t, MPI2_POINTER pMpi2SasEnclosurePage0_t, @@ -3107,6 +3114,7 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0 #define MPI2_SASENCLOSURE0_PAGEVERSION (0x04) /* values for SAS Enclosure Page 0 Flags field */ +#define MPI2_SAS_ENCLS0_FLAGS_CHASSIS_SLOT_VALID (0x0020) #define MPI2_SAS_ENCLS0_FLAGS_ENCL_LEVEL_VALID (0x0010) #define MPI2_SAS_ENCLS0_FLAGS_MNG_MASK (0x000F) #define MPI2_SAS_ENCLS0_FLAGS_MNG_UNKNOWN (0x0000) @@ -3119,6 +3127,7 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0 #define MPI26_ENCLOSURE0_PAGEVERSION (0x04) /* Values for Enclosure Page 0 Flags field */ +#define MPI26_ENCLS0_FLAGS_CHASSIS_SLOT_VALID (0x0020) #define MPI26_ENCLS0_FLAGS_ENCL_LEVEL_VALID (0x0010) #define MPI26_ENCLS0_FLAGS_MNG_MASK (0x000F) #define MPI26_ENCLS0_FLAGS_MNG_UNKNOWN (0x0000) Modified: head/sys/dev/mpr/mpi/mpi2_history.txt ============================================================================== --- head/sys/dev/mpr/mpi/mpi2_history.txt Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpi/mpi2_history.txt Mon Mar 19 23:21:45 2018 (r331228) @@ -41,16 +41,16 @@ All rights reserved. --------------------------------------- - Header Set Release Version: 02.00.46 - Header Set Release Date: 09-07-16 + Header Set Release Version: 02.00.48 + Header Set Release Date: 02-03-17 --------------------------------------- Filename Current version Prior version ---------- --------------- ------------- - mpi2.h 02.00.46 02.00.45 - mpi2_cnfg.h 02.00.39 02.00.38 + mpi2.h 02.00.48 02.00.47 + mpi2_cnfg.h 02.00.40 02.00.39 mpi2_init.h 02.00.21 02.00.21 - mpi2_ioc.h 02.00.30 02.00.29 + mpi2_ioc.h 02.00.32 02.00.31 mpi2_raid.h 02.00.11 02.00.11 mpi2_sas.h 02.00.10 02.00.10 mpi2_targ.h 02.00.09 02.00.09 @@ -59,7 +59,7 @@ mpi2_ra.h 02.00.01 02.00.01 mpi2_hbd.h 02.00.04 02.00.04 mpi2_pci.h 02.00.02 02.00.02 - mpi2_history.txt 02.00.43 02.00.43 + mpi2_history.txt 02.00.45 02.00.44 * Date Version Description @@ -161,6 +161,8 @@ mpi2.h * 04-10-16 02.00.44 Bumped MPI2_HEADER_VERSION_UNIT. * 07-06-16 02.00.45 Bumped MPI2_HEADER_VERSION_UNIT. * 09-02-16 02.00.46 Bumped MPI2_HEADER_VERSION_UNIT. + * 11-23-16 02.00.47 Bumped MPI2_HEADER_VERSION_UNIT. + * 02-03-17 02.00.48 Bumped MPI2_HEADER_VERSION_UNIT. * -------------------------------------------------------------------------- mpi2_cnfg.h @@ -363,8 +365,12 @@ mpi2_cnfg.h * phy data. * Added InitStatus to PCIe IO Unit Page 1 header. * 09-01-16 02.00.39 Added MPI26_CONFIG_PAGE_ENCLOSURE_0 and related defines. - * Added MPI26_ENCLOS_PGAD_FORM_GET_NEXT_HANDLE and - * MPI26_ENCLOS_PGAD_FORM_HANDLE page address formats. + * Added MPI26_ENCLOS_PGAD_FORM_GET_NEXT_HANDLE and + * MPI26_ENCLOS_PGAD_FORM_HANDLE page address formats. + * 02-02-17 02.00.40 Added MPI2_MANPAGE7_SLOT_UNKNOWN. + * Added ChassisSlot field to SAS Enclosure Page 0. + * Added ChassisSlot Valid bit (bit 5) to the Flags field + * in SAS Enclosure Page 0. * -------------------------------------------------------------------------- mpi2_init.h @@ -551,10 +557,15 @@ mpi2_ioc.h * Request Message. * Added new values for the RegionType field in the Layout * Data sections of the FLASH Layout Extended Image Data. - * Added new defines for the ReasonCode field of + * Added new defines for the ReasonCode field of * Active Cable Exception Event. - * Added MPI2_EVENT_ENCL_DEVICE_STATUS_CHANGE and - * MPI26_EVENT_DATA_ENCL_DEV_STATUS_CHANGE. + * Added MPI2_EVENT_ENCL_DEVICE_STATUS_CHANGE and + * MPI26_EVENT_DATA_ENCL_DEV_STATUS_CHANGE. + * 11-23-16 02.00.31 Added MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR and + * MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR. + * 02-02-17 02.00.32 Added MPI2_FW_DOWNLOAD_ITYPE_CBB_BACKUP. + * Added MPI25_EVENT_DATA_ACTIVE_CABLE_EXCEPT and related + * defines for the ReasonCode field. * -------------------------------------------------------------------------- mpi2_raid.h @@ -676,20 +687,35 @@ mpi2_pci.h mpi2_history.txt Parts list history -Filename 02.00.46 02.00.45 02.00.44 02.00.43 02.00.42 ----------- -------- -------- -------- -------- -------- -mpi2.h 02.00.46 02.00.45 02.00.44 02.00.43 02.00.42 -mpi2_cnfg.h 02.00.39 02.00.38 02.00.37 02.00.36 02.00.35 -mpi2_init.h 02.00.21 02.00.21 02.00.21 02.00.21 02.00.20 -mpi2_ioc.h 02.00.30 02.00.29 02.00.28 02.00.28 02.00.27 -mpi2_raid.h 02.00.11 02.00.11 02.00.11 02.00.11 02.00.11 -mpi2_sas.h 02.00.10 02.00.10 02.00.10 02.00.10 02.00.10 -mpi2_targ.h 02.00.09 02.00.09 02.00.09 02.00.09 02.00.09 -mpi2_tool.h 02.00.14 02.00.13 02.00.13 02.00.13 02.00.13 -mpi2_type.h 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 -mpi2_ra.h 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 -mpi2_hbd.h 02.00.04 02.00.04 02.00.04 02.00.04 02.00.03 -mpi2_pci.h 02.00.02 02.00.02 02.00.01 02.00.01 02.00.00 +Filename 02.00.48 +---------- -------- +mpi2.h 02.00.48 +mpi2_cnfg.h 02.00.40 +mpi2_init.h 02.00.21 +mpi2_ioc.h 02.00.32 +mpi2_raid.h 02.00.11 +mpi2_sas.h 02.00.10 +mpi2_targ.h 02.00.09 +mpi2_tool.h 02.00.14 +mpi2_type.h 02.00.01 +mpi2_ra.h 02.00.01 +mpi2_hbd.h 02.00.04 +mpi2_pci.h 02.00.02 + +Filename 02.00.47 02.00.46 02.00.45 02.00.44 02.00.43 02.00.42 +---------- -------- -------- -------- -------- -------- -------- +mpi2.h 02.00.47 02.00.46 02.00.45 02.00.44 02.00.43 02.00.42 +mpi2_cnfg.h 02.00.39 02.00.39 02.00.38 02.00.37 02.00.36 02.00.35 +mpi2_init.h 02.00.21 02.00.21 02.00.21 02.00.21 02.00.21 02.00.20 +mpi2_ioc.h 02.00.31 02.00.30 02.00.29 02.00.28 02.00.28 02.00.27 +mpi2_raid.h 02.00.11 02.00.11 02.00.11 02.00.11 02.00.11 02.00.11 +mpi2_sas.h 02.00.10 02.00.10 02.00.10 02.00.10 02.00.10 02.00.10 +mpi2_targ.h 02.00.09 02.00.09 02.00.09 02.00.09 02.00.09 02.00.09 +mpi2_tool.h 02.00.14 02.00.14 02.00.13 02.00.13 02.00.13 02.00.13 +mpi2_type.h 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 +mpi2_ra.h 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 +mpi2_hbd.h 02.00.04 02.00.04 02.00.04 02.00.04 02.00.04 02.00.03 +mpi2_pci.h 02.00.02 02.00.02 02.00.02 02.00.01 02.00.01 02.00.00 Filename 02.00.41 02.00.40 02.00.39 02.00.38 02.00.37 02.00.36 ---------- -------- -------- -------- -------- -------- -------- Modified: head/sys/dev/mpr/mpi/mpi2_ioc.h ============================================================================== --- head/sys/dev/mpr/mpi/mpi2_ioc.h Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpi/mpi2_ioc.h Mon Mar 19 23:21:45 2018 (r331228) @@ -42,7 +42,7 @@ * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages * Creation Date: October 11, 2006 * - * mpi2_ioc.h Version: 02.00.30 + * mpi2_ioc.h Version: 02.00.32 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -200,6 +200,11 @@ * Active Cable Exception Event. * Added MPI2_EVENT_ENCL_DEVICE_STATUS_CHANGE and * MPI26_EVENT_DATA_ENCL_DEV_STATUS_CHANGE. + * 11-23-16 02.00.31 Added MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR and + * MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR. + * 02-02-17 02.00.32 Added MPI2_FW_DOWNLOAD_ITYPE_CBB_BACKUP. + * Added MPI25_EVENT_DATA_ACTIVE_CABLE_EXCEPT and related + * defines for the ReasonCode field. * -------------------------------------------------------------------------- */ @@ -610,6 +615,7 @@ typedef struct _MPI2_EVENT_NOTIFICATION_REPLY #define MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST (0x0032) /* MPI v2.6 and later */ #define MPI2_EVENT_PCIE_LINK_COUNTER (0x0033) /* MPI v2.6 and later */ #define MPI2_EVENT_ACTIVE_CABLE_EXCEPTION (0x0034) /* MPI v2.6 and later */ +#define MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR (0x0035) /* MPI v2.5 and later */ #define MPI2_EVENT_MIN_PRODUCT_SPECIFIC (0x006E) #define MPI2_EVENT_MAX_PRODUCT_SPECIFIC (0x007F) @@ -715,12 +721,21 @@ typedef struct _MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT U8 ReasonCode; /* 0x04 */ U8 ReceptacleID; /* 0x05 */ U16 Reserved1; /* 0x06 */ -} MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT, +} MPI25_EVENT_DATA_ACTIVE_CABLE_EXCEPT, + MPI2_POINTER PTR_MPI25_EVENT_DATA_ACTIVE_CABLE_EXCEPT, + Mpi25EventDataActiveCableExcept_t, + MPI2_POINTER pMpi25EventDataActiveCableExcept_t, + MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT, MPI2_POINTER PTR_MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT, Mpi26EventDataActiveCableExcept_t, MPI2_POINTER pMpi26EventDataActiveCableExcept_t; -/* defines for ReasonCode field */ +/* MPI2.5 defines for the ReasonCode field */ +#define MPI25_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER (0x00) +#define MPI25_EVENT_ACTIVE_CABLE_PRESENT (0x01) +#define MPI25_EVENT_ACTIVE_CABLE_DEGRADED (0x02) + +/* MPI2.6 defines for the ReasonCode field */ #define MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER (0x00) #define MPI26_EVENT_ACTIVE_CABLE_PRESENT (0x01) #define MPI26_EVENT_ACTIVE_CABLE_DEGRADED (0x02) @@ -1168,6 +1183,24 @@ typedef struct _MPI2_EVENT_DATA_SAS_QUIESCE #define MPI2_EVENT_SAS_QUIESCE_RC_COMPLETED (0x02) +typedef struct _MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR +{ + U16 DevHandle; /* 0x00 */ + U8 ReasonCode; /* 0x02 */ + U8 PhysicalPort; /* 0x03 */ + U32 Reserved1[2]; /* 0x04 */ + U64 SASAddress; /* 0x0C */ + U32 Reserved2[2]; /* 0x14 */ +} MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR, + MPI2_POINTER PTR_MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR, + Mpi25EventDataSasDeviceDiscoveryError_t, + MPI2_POINTER pMpi25EventDataSasDeviceDiscoveryError_t; + +/* SAS Device Discovery Error Event data ReasonCode values */ +#define MPI25_EVENT_SAS_DISC_ERR_SMP_FAILED (0x01) +#define MPI25_EVENT_SAS_DISC_ERR_SMP_TIMEOUT (0x02) + + /* Host Based Discovery Phy Event data */ typedef struct _MPI2_EVENT_HBD_PHY_SAS @@ -1493,6 +1526,7 @@ typedef struct _MPI2_FW_DOWNLOAD_REQUEST #define MPI2_FW_DOWNLOAD_ITYPE_COMPLETE (0x0A) #define MPI2_FW_DOWNLOAD_ITYPE_COMMON_BOOT_BLOCK (0x0B) #define MPI2_FW_DOWNLOAD_ITYPE_PUBLIC_KEY (0x0C) /* MPI v2.5 and newer */ +#define MPI2_FW_DOWNLOAD_ITYPE_CBB_BACKUP (0x0D) #define MPI2_FW_DOWNLOAD_ITYPE_SBR (0x0E) #define MPI2_FW_DOWNLOAD_ITYPE_SBR_BACKUP (0x0F) #define MPI2_FW_DOWNLOAD_ITYPE_HIIM (0x10) Modified: head/sys/dev/mpr/mpr_ioctl.h ============================================================================== --- head/sys/dev/mpr/mpr_ioctl.h Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpr_ioctl.h Mon Mar 19 23:21:45 2018 (r331228) @@ -149,6 +149,7 @@ typedef struct mpr_pci_bits * */ #define MPRIOCTL_ADAPTER_TYPE_SAS3 6 +#define MPRIOCTL_ADAPTER_TYPE_SAS35 7 typedef struct mpr_adapter_data { uint32_t StructureLength; @@ -202,7 +203,7 @@ typedef struct mpr_pass_thru /* * Event queue defines */ -#define MPR_EVENT_QUEUE_SIZE (50) /* Max Events stored in driver */ +#define MPR_EVENT_QUEUE_SIZE (200) /* Max Events stored in driver */ #define MPR_MAX_EVENT_DATA_LENGTH (48) /* Size of each event in Dwords */ typedef struct mpr_event_query Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpr_sas.c Mon Mar 19 23:21:45 2018 (r331228) @@ -708,6 +708,7 @@ mprsas_register_events(struct mpr_softc *sc) setbit(events, MPI2_EVENT_IR_PHYSICAL_DISK); setbit(events, MPI2_EVENT_IR_OPERATION_STATUS); setbit(events, MPI2_EVENT_TEMP_THRESHOLD); + setbit(events, MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR); if (sc->facts->MsgVersion >= MPI2_VERSION_02_06) { setbit(events, MPI2_EVENT_ACTIVE_CABLE_EXCEPTION); if (sc->mpr_flags & MPR_FLAGS_GEN35_IOC) { Modified: head/sys/dev/mpr/mpr_sas_lsi.c ============================================================================== --- head/sys/dev/mpr/mpr_sas_lsi.c Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpr_sas_lsi.c Mon Mar 19 23:21:45 2018 (r331228) @@ -681,6 +681,41 @@ skip_fp_send: } break; } + case MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR: + { + pMpi25EventDataSasDeviceDiscoveryError_t discovery_error_data; + uint64_t sas_address; + + discovery_error_data = + (pMpi25EventDataSasDeviceDiscoveryError_t) + fw_event->event_data; + + sas_address = discovery_error_data->SASAddress.High; + sas_address = (sas_address << 32) | + discovery_error_data->SASAddress.Low; + + switch(discovery_error_data->ReasonCode) { + case MPI25_EVENT_SAS_DISC_ERR_SMP_FAILED: + { + mpr_printf(sc, "SMP command failed during discovery " + "for expander with SAS Address %jx and " + "handle 0x%x.\n", sas_address, + discovery_error_data->DevHandle); + break; + } + case MPI25_EVENT_SAS_DISC_ERR_SMP_TIMEOUT: + { + mpr_printf(sc, "SMP command timed out during " + "discovery for expander with SAS Address %jx and " + "handle 0x%x.\n", sas_address, + discovery_error_data->DevHandle); + break; + } + default: + break; + } + break; + } case MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST: { MPI26_EVENT_DATA_PCIE_TOPOLOGY_CHANGE_LIST *data; Modified: head/sys/dev/mpr/mpr_user.c ============================================================================== --- head/sys/dev/mpr/mpr_user.c Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mpr_user.c Mon Mar 19 23:21:45 2018 (r331228) @@ -1189,7 +1189,10 @@ mpr_user_get_adapter_data(struct mpr_softc *sc, mpr_ad /* * General device info. */ - data->AdapterType = MPRIOCTL_ADAPTER_TYPE_SAS3; + if (sc->mpr_flags & MPR_FLAGS_GEN35_IOC) + data->AdapterType = MPRIOCTL_ADAPTER_TYPE_SAS35; + else + data->AdapterType = MPRIOCTL_ADAPTER_TYPE_SAS3; data->PCIDeviceHwId = pci_get_device(sc->mpr_dev); data->PCIDeviceHwRev = pci_read_config(sc->mpr_dev, PCIR_REVID, 1); data->SubSystemId = pci_get_subdevice(sc->mpr_dev); Modified: head/sys/dev/mpr/mprvar.h ============================================================================== --- head/sys/dev/mpr/mprvar.h Mon Mar 19 22:43:27 2018 (r331227) +++ head/sys/dev/mpr/mprvar.h Mon Mar 19 23:21:45 2018 (r331228) @@ -33,7 +33,7 @@ #ifndef _MPRVAR_H #define _MPRVAR_H -#define MPR_DRIVER_VERSION "15.03.00.00-fbsd" +#define MPR_DRIVER_VERSION "18.03.00.00-fbsd" #define MPR_DB_MAX_WAIT 2500 From owner-svn-src-head@freebsd.org Mon Mar 19 23:53:06 2018 Return-Path: Delivered-To: svn-src-head@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 DB068F55337; Mon, 19 Mar 2018 23:53:06 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f175.google.com (mail-io0-f175.google.com [209.85.223.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 75AE96CE48; Mon, 19 Mar 2018 23:53:05 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f175.google.com with SMTP id m83so122462ioi.8; Mon, 19 Mar 2018 16:53:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=wGwQHXxcGE4+HoAtz+2nq9c6LcKsfj0dAqotas0GGSo=; b=jhutZ9ttU3tYL93b7qFthsKOhXTIErG7zmGDMvX0bxrEETnyJHt5VF2nvZajMbCai9 5VKasEI7k0oKNvULdrbGYrBJDf6WLqE1zjHkp+9kCKvv2tb3tCH1UN0/+pcvgX80+omr P1aPIvI3E/QsUnyY8u96oqMpIfedaBxSNc2y8PU4utV5MZyFXox4RaDFFwjI9WKQOWmD fhOrEpyUDt7pbNJAICkXWr19Yc+P73Ooxv2pV/g5kmNIObxPQ38vNeyN+t25RMiVWd7+ e7CN5lowpNAeOzg/GIW5VvgER2wf5CM/QmL4fHRNY449L5raICrMRfCQwpSLtb/+Cry+ Q0SA== X-Gm-Message-State: AElRT7HgZf7XoDw2wGX+q/mCTZPC4jY7WgsdzIvi2yhqLg/IQoGGZDC7 qNVb9Ssl25G3f5BVoxWhh96chFd+ X-Google-Smtp-Source: AG47ELuxUQAfIfIffPvKw/ERN/KqIDMIk9xRuGnHD5gZIcONTJe5OiY9qoP8YK7eXOo3Rb01J+dJ8Q== X-Received: by 10.107.136.202 with SMTP id s71mr14389413ioi.45.1521503237188; Mon, 19 Mar 2018 16:47:17 -0700 (PDT) Received: from mail-it0-f50.google.com (mail-it0-f50.google.com. [209.85.214.50]) by smtp.gmail.com with ESMTPSA id h131-v6sm193219itc.12.2018.03.19.16.47.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Mar 2018 16:47:16 -0700 (PDT) Received: by mail-it0-f50.google.com with SMTP id v194-v6so128810itb.0; Mon, 19 Mar 2018 16:47:16 -0700 (PDT) X-Received: by 2002:a24:b145:: with SMTP id c5-v6mr686634itj.135.1521503236335; Mon, 19 Mar 2018 16:47:16 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.153.132 with HTTP; Mon, 19 Mar 2018 16:47:15 -0700 (PDT) In-Reply-To: <201803192243.w2JMhS6N079312@repo.freebsd.org> References: <201803192243.w2JMhS6N079312@repo.freebsd.org> From: Conrad Meyer Date: Mon, 19 Mar 2018 16:47:15 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331227 - head/sys/kern To: Matt Joras Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 23:53:07 -0000 On Mon, Mar 19, 2018 at 3:43 PM, Matt Joras wrote: > Author: mjoras > Date: Mon Mar 19 22:43:27 2018 > New Revision: 331227 > URL: https://svnweb.freebsd.org/changeset/base/331227 > > Log: > Fix initialization of eventhandler mutex. > > mtx_init does not do a copy of the name string it is passed. The > eventhandler code incorrectly passed the parameter string directly to > mtx_init instead of using the copy it makes. This was an existing > problem with the code that I dutifully copied over in my changes in r325621. For those without context: The problem here is that the name string comes from rodata of whatever module *registers* an eventhandler listener, but isn't tied to the lifetime of that module. So for example, filemon.ko or hwpmc.ko. If those modules are subsequently unloaded, the kernel eventhandler lock lo_names continue to point to the (now stale) module memory, resulting in kernel page fault crashes if/when those names are eventually dereferenced (we hit it with "sysctl kern.proc.all" after one of those modules was unloaded). Best, Conrad From owner-svn-src-head@freebsd.org Tue Mar 20 00:03:52 2018 Return-Path: Delivered-To: svn-src-head@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 992E9F56127; Tue, 20 Mar 2018 00:03:52 +0000 (UTC) (envelope-from gonzo@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 3C2F26D545; Tue, 20 Mar 2018 00:03:52 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 339391557D; Tue, 20 Mar 2018 00:03:52 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2K03q54019054; Tue, 20 Mar 2018 00:03:52 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K03oxD019032; Tue, 20 Mar 2018 00:03:50 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201803200003.w2K03oxD019032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 20 Mar 2018 00:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331229 - in head/sys: arm/amlogic/aml8726 arm/annapurna/alpine arm/broadcom/bcm2835 arm/freescale arm/freescale/vybrid arm/mv arm/samsung/exynos arm/ti/am335x dev/fdt dev/ofw dev/ow de... X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in head/sys: arm/amlogic/aml8726 arm/annapurna/alpine arm/broadcom/bcm2835 arm/freescale arm/freescale/vybrid arm/mv arm/samsung/exynos arm/ti/am335x dev/fdt dev/ofw dev/ow dev/vnic powerpc/cpufreq po... X-SVN-Commit-Revision: 331229 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 00:03:52 -0000 Author: gonzo Date: Tue Mar 20 00:03:49 2018 New Revision: 331229 URL: https://svnweb.freebsd.org/changeset/base/331229 Log: [ofw] fix errneous checks for OF_finddevice(9) return value OF_finddevices returns ((phandle_t)-1) in case of failure. Some code in existing drivers checked return value to be equal to 0 or less/equal to 0 which is also wrong because phandle_t is unsigned type. Most of these checks were for negative cases that were never triggered so trhere was no impact on functionality. Reviewed by: nwhitehorn MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D14645 Modified: head/sys/arm/amlogic/aml8726/aml8726_clkmsr.c head/sys/arm/amlogic/aml8726/aml8726_mp.c head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c head/sys/arm/annapurna/alpine/alpine_machdep.c head/sys/arm/broadcom/bcm2835/bcm2835_fb.c head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c head/sys/arm/freescale/fsl_ocotp.c head/sys/arm/freescale/vybrid/vf_machdep.c head/sys/arm/mv/mv_common.c head/sys/arm/samsung/exynos/chrome_ec.c head/sys/arm/samsung/exynos/exynos5_ehci.c head/sys/arm/ti/am335x/am335x_lcd.c head/sys/arm/ti/am335x/am335x_lcd_syscons.c head/sys/dev/fdt/fdt_common.c head/sys/dev/ofw/ofw_subr.c head/sys/dev/ofw/openfirmio.c head/sys/dev/ow/owc_gpiobus.c head/sys/dev/vnic/thunder_bgx_fdt.c head/sys/powerpc/cpufreq/mpc85xx_jog.c head/sys/powerpc/pseries/platform_chrp.c Modified: head/sys/arm/amlogic/aml8726/aml8726_clkmsr.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_clkmsr.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/amlogic/aml8726/aml8726_clkmsr.c Tue Mar 20 00:03:49 2018 (r331229) @@ -255,14 +255,14 @@ aml8726_clkmsr_bus_frequency() * Try to access the clkmsr node directly i.e. through /aliases/. */ - if ((node = OF_finddevice("clkmsr")) != 0) + if ((node = OF_finddevice("clkmsr")) != -1) if (fdt_is_compatible_strict(node, "amlogic,aml8726-clkmsr")) goto moveon; /* * Find the node the long way. */ - if ((node = OF_finddevice("/soc")) == 0) + if ((node = OF_finddevice("/soc")) == -1) return (0); if ((node = fdt_find_compatible(node, Modified: head/sys/arm/amlogic/aml8726/aml8726_mp.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_mp.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/amlogic/aml8726/aml8726_mp.c Tue Mar 20 00:03:49 2018 (r331229) @@ -178,7 +178,7 @@ find_node_for_device(const char *device, const char ** * Try to access the node directly i.e. through /aliases/. */ - if ((node = OF_finddevice(device)) != 0) + if ((node = OF_finddevice(device)) != -1) for (i = 0; compatible[i]; i++) if (fdt_is_compatible_strict(node, compatible[i])) return node; @@ -188,7 +188,7 @@ find_node_for_device(const char *device, const char ** */ for (i = 0; compatible[i]; i++) { - if ((node = OF_finddevice("/soc")) == 0) + if ((node = OF_finddevice("/soc")) == -1) return (0); if ((node = fdt_find_compatible(node, compatible[i], 1)) != 0) Modified: head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c Tue Mar 20 00:03:49 2018 (r331229) @@ -117,7 +117,7 @@ aml8726_usb_phy_mode(const char *dwcotg_path, uint32_t phandle_t node; ssize_t len; - if ((node = OF_finddevice(dwcotg_path)) == 0) + if ((node = OF_finddevice(dwcotg_path)) == -1) return (ENXIO); if (fdt_is_compatible_strict(node, "synopsys,designware-hs-otg2") == 0) Modified: head/sys/arm/annapurna/alpine/alpine_machdep.c ============================================================================== --- head/sys/arm/annapurna/alpine/alpine_machdep.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/annapurna/alpine/alpine_machdep.c Tue Mar 20 00:03:49 2018 (r331229) @@ -71,7 +71,7 @@ alpine_get_devmap_base(bus_addr_t *pa, bus_addr_t *siz { phandle_t node; - if ((node = OF_finddevice("/")) == 0) + if ((node = OF_finddevice("/")) == -1) return (ENXIO); if ((node = fdt_find_compatible(node, "simple-bus", 1)) == 0) Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Tue Mar 20 00:03:49 2018 (r331229) @@ -452,7 +452,7 @@ bcmfb_configure(int flags) * finally go with defaults if everything else has failed. */ chosen = OF_finddevice("/chosen"); - if (chosen != 0 && + if (chosen != -1 && OF_getprop(chosen, "bootargs", &bootargs, sizeof(bootargs)) > 0) { p = bootargs; while ((v = strsep(&p, " ")) != NULL) { @@ -472,7 +472,7 @@ bcmfb_configure(int flags) } root = OF_finddevice("/"); - if ((root != 0) && + if ((root != -1) && (display = fdt_find_compatible(root, "broadcom,bcm2835-fb", 1))) { if (sc->width == 0) { if ((OF_getencprop(display, "broadcom,width", Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Tue Mar 20 00:03:49 2018 (r331229) @@ -223,7 +223,7 @@ bcm_fb_attach(device_t dev) /* Newer firmware versions needs an inverted color palette. */ sc->fbswap = 0; chosen = OF_finddevice("/chosen"); - if (chosen != 0 && + if (chosen != -1 && OF_getprop(chosen, "bootargs", &bootargs, sizeof(bootargs)) > 0) { p = bootargs; while ((v = strsep(&p, " ")) != NULL) { Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Tue Mar 20 00:03:49 2018 (r331229) @@ -81,7 +81,7 @@ bcm2835_late_init(platform_t plat) int len; system = OF_finddevice("/system"); - if (system != 0) { + if (system != -1) { len = OF_getencprop(system, "linux,serial", cells, sizeof(cells)); if (len > 0) Modified: head/sys/arm/freescale/fsl_ocotp.c ============================================================================== --- head/sys/arm/freescale/fsl_ocotp.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/freescale/fsl_ocotp.c Tue Mar 20 00:03:49 2018 (r331229) @@ -72,7 +72,7 @@ fsl_ocotp_devmap(void) phandle_t child, root; u_long base, size; - if ((root = OF_finddevice("/")) == 0) + if ((root = OF_finddevice("/")) == -1) goto fatal; if ((child = fdt_depth_search_compatible(root, "fsl,imx6q-ocotp", 0)) == 0) goto fatal; Modified: head/sys/arm/freescale/vybrid/vf_machdep.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_machdep.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/freescale/vybrid/vf_machdep.c Tue Mar 20 00:03:49 2018 (r331229) @@ -68,7 +68,7 @@ vf_cpu_reset(platform_t plat) goto end; src = OF_finddevice("src"); - if ((src != 0) && (OF_getencprop(src, "reg", &paddr, sizeof(paddr))) > 0) { + if ((src != -1) && (OF_getencprop(src, "reg", &paddr, sizeof(paddr))) > 0) { if (bus_space_map(fdtbus_bs_tag, paddr, 0x10, 0, &vaddr) == 0) { bus_space_write_4(fdtbus_bs_tag, vaddr, 0x00, SW_RST); } Modified: head/sys/arm/mv/mv_common.c ============================================================================== --- head/sys/arm/mv/mv_common.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/mv/mv_common.c Tue Mar 20 00:03:49 2018 (r331229) @@ -2367,7 +2367,7 @@ win_cpu_from_dt(void) if (ofw_bus_node_is_compatible(node, "mrvl,cesa-sram")) goto moveon; - if ((node = OF_finddevice("/")) == 0) + if ((node = OF_finddevice("/")) == -1) return (ENXIO); if ((node = fdt_find_compatible(node, "mrvl,cesa-sram", 0)) == 0) @@ -2551,7 +2551,7 @@ fdt_fixup_busfreq(phandle_t root) /* * Fix bus speed in cpu node */ - if ((sb = OF_finddevice("cpu")) != 0) + if ((sb = OF_finddevice("cpu")) != -1) if (fdt_is_compatible_strict(sb, "ARM,88VS584")) OF_setprop(sb, "bus-frequency", (void *)&freq, sizeof(freq)); Modified: head/sys/arm/samsung/exynos/chrome_ec.c ============================================================================== --- head/sys/arm/samsung/exynos/chrome_ec.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/samsung/exynos/chrome_ec.c Tue Mar 20 00:03:49 2018 (r331229) @@ -225,7 +225,7 @@ configure_i2c_arbitrator(struct ec_softc *sc) /* TODO: look for compatible entry instead of hard-coded path */ arbitrator = OF_finddevice("/i2c-arbitrator"); - if (arbitrator > 0 && + if (arbitrator != -1 && OF_hasprop(arbitrator, "freebsd,our-gpio") && OF_hasprop(arbitrator, "freebsd,ec-gpio")) { sc->have_arbitrator = 1; Modified: head/sys/arm/samsung/exynos/exynos5_ehci.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_ehci.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/samsung/exynos/exynos5_ehci.c Tue Mar 20 00:03:49 2018 (r331229) @@ -240,7 +240,7 @@ phy_init(struct exynos_ehci_softc *esc) reg &= ~(HOST_CTRL_RESET_LINK); bus_space_write_4(esc->host_bst, esc->host_bsh, 0x0, reg); - if ((hub = OF_finddevice("/hsichub")) != 0) { + if ((hub = OF_finddevice("/hsichub")) != -1) { reset_hsic_hub(esc, hub); } Modified: head/sys/arm/ti/am335x/am335x_lcd.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_lcd.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/ti/am335x/am335x_lcd.c Tue Mar 20 00:03:49 2018 (r331229) @@ -961,7 +961,7 @@ am335x_lcd_attach(device_t dev) am335x_read_hdmi_property(dev); root = OF_finddevice("/"); - if (root == 0) { + if (root == -1) { device_printf(dev, "failed to get FDT root node\n"); return (ENXIO); } Modified: head/sys/arm/ti/am335x/am335x_lcd_syscons.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_lcd_syscons.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/arm/ti/am335x/am335x_lcd_syscons.c Tue Mar 20 00:03:49 2018 (r331229) @@ -382,7 +382,7 @@ am335x_syscons_configure(int flags) * to fetch data from FDT and go with defaults if failed */ root = OF_finddevice("/"); - if ((root != 0) && + if ((root != -1) && (display = am335x_syscons_find_panel_node(root))) { if ((OF_getencprop(display, "panel_width", &cell, sizeof(cell))) > 0) Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/dev/fdt/fdt_common.c Tue Mar 20 00:03:49 2018 (r331229) @@ -215,13 +215,13 @@ fdt_immr_addr(vm_offset_t immr_va) /* * Try to access the SOC node directly i.e. through /aliases/. */ - if ((node = OF_finddevice("soc")) != 0) + if ((node = OF_finddevice("soc")) != -1) if (fdt_is_compatible(node, "simple-bus")) goto moveon; /* * Find the node the long way. */ - if ((node = OF_finddevice("/")) == 0) + if ((node = OF_finddevice("/")) == -1) return (ENXIO); if ((node = fdt_find_compatible(node, "simple-bus", 0)) == 0) Modified: head/sys/dev/ofw/ofw_subr.c ============================================================================== --- head/sys/dev/ofw/ofw_subr.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/dev/ofw/ofw_subr.c Tue Mar 20 00:03:49 2018 (r331229) @@ -232,7 +232,7 @@ ofw_parse_bootargs(void) int err; chosen = OF_finddevice("/chosen"); - if (chosen <= 0) + if (chosen == -1) return (chosen); if ((err = OF_getprop(chosen, "bootargs", buf, sizeof(buf))) != -1) { Modified: head/sys/dev/ofw/openfirmio.c ============================================================================== --- head/sys/dev/ofw/openfirmio.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/dev/ofw/openfirmio.c Tue Mar 20 00:03:49 2018 (r331229) @@ -247,7 +247,7 @@ openfirm_ioctl(struct cdev *dev, u_long cmd, caddr_t d if (error) break; node = OF_finddevice(name); - if (node == 0 || node == -1) { + if (node == -1) { error = ENOENT; break; } Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/dev/ow/owc_gpiobus.c Tue Mar 20 00:03:49 2018 (r331229) @@ -85,7 +85,7 @@ owc_gpiobus_identify(driver_t *driver, device_t bus) * bus overwrites the description. */ root = OF_finddevice("/"); - if (root == 0) + if (root == -1) return; for (w1 = OF_child(root); w1 != 0; w1 = OF_peer(w1)) { if (!fdt_is_compatible_strict(w1, "w1-gpio")) Modified: head/sys/dev/vnic/thunder_bgx_fdt.c ============================================================================== --- head/sys/dev/vnic/thunder_bgx_fdt.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/dev/vnic/thunder_bgx_fdt.c Tue Mar 20 00:03:49 2018 (r331229) @@ -336,7 +336,7 @@ bgx_fdt_find_node(struct bgx *bgx) snprintf(bgx_sel, len + 1, "/"BGX_NODE_NAME"%d", bgx->bgx_id); /* First try the root node */ node = OF_finddevice(bgx_sel); - if ((int)node > 0) { + if (node != -1) { /* Found relevant node */ goto out; } Modified: head/sys/powerpc/cpufreq/mpc85xx_jog.c ============================================================================== --- head/sys/powerpc/cpufreq/mpc85xx_jog.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/powerpc/cpufreq/mpc85xx_jog.c Tue Mar 20 00:03:49 2018 (r331229) @@ -129,7 +129,7 @@ mpc85xx_jog_devcompat() int i; node = OF_finddevice("/soc"); - if (node <= 0) + if (node == -1) return (NULL); for (i = 0; jog_compat[i].ocd_str != NULL; i++) Modified: head/sys/powerpc/pseries/platform_chrp.c ============================================================================== --- head/sys/powerpc/pseries/platform_chrp.c Mon Mar 19 23:21:45 2018 (r331228) +++ head/sys/powerpc/pseries/platform_chrp.c Tue Mar 20 00:03:49 2018 (r331229) @@ -291,7 +291,7 @@ chrp_timebase_freq(platform_t plat, struct cpuref *cpu char buf[8]; cpus = OF_finddevice("/cpus"); - if (cpus <= 0) + if (cpus == -1) panic("CPU tree not found on Open Firmware\n"); for (cpunode = OF_child(cpus); cpunode != 0; cpunode = OF_peer(cpunode)) { From owner-svn-src-head@freebsd.org Tue Mar 20 00:16:25 2018 Return-Path: Delivered-To: svn-src-head@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 88862F56E2B; Tue, 20 Mar 2018 00:16:25 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 334576DBD9; Tue, 20 Mar 2018 00:16:25 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C8A41571B; Tue, 20 Mar 2018 00:16:25 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2K0GPjq023916; Tue, 20 Mar 2018 00:16:25 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K0GPYH023915; Tue, 20 Mar 2018 00:16:25 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803200016.w2K0GPYH023915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 20 Mar 2018 00:16:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331230 - head/contrib/blacklist/bin X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/contrib/blacklist/bin X-SVN-Commit-Revision: 331230 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 00:16:25 -0000 Author: cem Date: Tue Mar 20 00:16:24 2018 New Revision: 331230 URL: https://svnweb.freebsd.org/changeset/base/331230 Log: blacklist: Fix minor memory leak in configuration parsing error case Ordinarily, the continue clause of the for-loop would free 'line.' In this case we instead return early, missing the free. Add an explicit free to avoid the leak. Reported by: Coverity Sponsored by: Dell EMC Isilon Modified: head/contrib/blacklist/bin/conf.c Modified: head/contrib/blacklist/bin/conf.c ============================================================================== --- head/contrib/blacklist/bin/conf.c Tue Mar 20 00:03:49 2018 (r331229) +++ head/contrib/blacklist/bin/conf.c Tue Mar 20 00:16:24 2018 (r331230) @@ -1119,6 +1119,7 @@ conf_parse(const char *f) confset_free(&lc); confset_free(&rc); fclose(fp); + free(line); return; } } From owner-svn-src-head@freebsd.org Tue Mar 20 01:07:23 2018 Return-Path: Delivered-To: svn-src-head@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 4B01BF5A9BA; Tue, 20 Mar 2018 01:07:23 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 F20F5704D2; Tue, 20 Mar 2018 01:07:22 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E886415EA4; Tue, 20 Mar 2018 01:07:22 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2K17Mqj050900; Tue, 20 Mar 2018 01:07:22 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K17MUw050899; Tue, 20 Mar 2018 01:07:22 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201803200107.w2K17MUw050899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 20 Mar 2018 01:07:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331231 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 331231 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 01:07:23 -0000 Author: jhibbits Date: Tue Mar 20 01:07:22 2018 New Revision: 331231 URL: https://svnweb.freebsd.org/changeset/base/331231 Log: Fix powerpc Book-E build post-331018/331048. pagedaemon_wakeup() was moved from vm_pageout.h to vm_pagequeue.h. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue Mar 20 00:16:24 2018 (r331230) +++ head/sys/powerpc/booke/pmap.c Tue Mar 20 01:07:22 2018 (r331231) @@ -107,6 +107,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include From owner-svn-src-head@freebsd.org Tue Mar 20 01:08:02 2018 Return-Path: Delivered-To: svn-src-head@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 AD18EF5AA48 for ; Tue, 20 Mar 2018 01:08:02 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yb0-x241.google.com (mail-yb0-x241.google.com [IPv6:2607:f8b0:4002:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3CECD7063C for ; Tue, 20 Mar 2018 01:08:02 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yb0-x241.google.com with SMTP id 7-v6so752956ybc.5 for ; Mon, 19 Mar 2018 18:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=OZvxCp8/K+G84r+mA9DYtkduiNZeL/fdb3DC4fA6PtU=; b=UdAHiTSmNAn6Ppbh55VVD7fDTygSEnn1Jc6o1bCtbBFtnaqTFOYlUTxt41gKBMWjJN vFPVnWewYSOE9Nu7bdNGiQovP7SZE8liw0RqeC4nuCqV5D3BTQ8exzmgybfIDOzUL7qJ 1LDS4t6T2fJBziG5iwAkgZExetCgwNBtVscqzZTSMRl4fc7Ua40HWJzpRVcvOme9hdK/ SQ/yL+fKsoiYcjWl9FLa+0bhHfq9ZN8eUiLtmYf0FlULauCHkZE9kn/gbDAK29QhxptK MkQZypd15AZLwB+a01Eywjl/7NwNv1NUbU0c6WQC1iIMZzkU2+mupoxagL0PfjEfkqRP Oriw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=OZvxCp8/K+G84r+mA9DYtkduiNZeL/fdb3DC4fA6PtU=; b=Ojz8zo1l7hjdXzjDGy/Z0TH9ZTPKeh5HJ5L4m++q/YkGGdWKuUXLKFAMJW3GwDfyq8 ld4sZN7N39eP/uR6/DKcINr9QIJoUHldrJdw7byyUMZzHmi9IK8I3FyMrh5czlV/9Oer U7G1nfARIFlgqmRvMiJyCga3qxs6Cid7VJZNvA2EyIO7UR/l65Z5SCaKFC7vzoddbGbc Wq5dzjdJZET7wMdV4SPiHB2+ms2P0p43KVd+IObQChrJzgV81RT3KB6LTnzBdux4SNNO mrkmYSkG28raHI/z1i3q/vste8rKQ4w48D7R5/eMrJb2Rrmk2GB3kjTawsBua563HDz2 sfcg== X-Gm-Message-State: AElRT7EAEL6t+zHhFLwJBs/Knv1EPIg/c1pL6yYerW/yTPVNXhoOXmdD zgYT54NdYRnyh5dximB6t/+vlTVdsNy5efkbhdmLyA== X-Google-Smtp-Source: AG47ELvuLN6Hx3v+gcM6vmA+UOOL/l3YujHH8yK0cjd9QreEHOoNu5gD4IkKqTKi0dOIdpwq1VKwD1QzkTUPUVOWfrI= X-Received: by 2002:a25:b941:: with SMTP id s1-v6mr8167624ybm.371.1521508081548; Mon, 19 Mar 2018 18:08:01 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:61c5:0:0:0:0:0 with HTTP; Mon, 19 Mar 2018 18:08:01 -0700 (PDT) In-Reply-To: <201803191616.w2JGGCid083460@repo.freebsd.org> References: <201803191616.w2JGGCid083460@repo.freebsd.org> From: Oliver Pinter Date: Tue, 20 Mar 2018 02:08:01 +0100 Message-ID: Subject: Re: svn commit: r331212 - in head: etc/mtree stand/defaults To: Kyle Evans Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 01:08:02 -0000 On Monday, March 19, 2018, Kyle Evans wrote: > Author: kevans > Date: Mon Mar 19 16:16:12 2018 > New Revision: 331212 > URL: https://svnweb.freebsd.org/changeset/base/331212 > > Log: > Move /boot/overlays to /boot/dtb/overlays > > Hi! Do you plan to add the old files to ObsoleteFiles.inc? > The former is fairly vague; these are FDT overlays to be applied to the > running system, so /boot/dtb is a sensible location to put it without > cluttering up /boot/dtb even further if desired. > > Modified: > head/etc/mtree/BSD.root.dist > head/stand/defaults/loader.conf > > Modified: head/etc/mtree/BSD.root.dist > ============================================================ > ================== > --- head/etc/mtree/BSD.root.dist Mon Mar 19 15:48:31 2018 > (r331211) > +++ head/etc/mtree/BSD.root.dist Mon Mar 19 16:16:12 2018 > (r331212) > @@ -11,6 +11,8 @@ > defaults > .. > dtb > + overlays tags=package=runtime > + .. > .. > firmware > .. > @@ -19,8 +21,6 @@ > kernel > .. > modules > - .. > - overlays tags=package=runtime > .. > zfs > .. > > Modified: head/stand/defaults/loader.conf > ============================================================ > ================== > --- head/stand/defaults/loader.conf Mon Mar 19 15:48:31 2018 > (r331211) > +++ head/stand/defaults/loader.conf Mon Mar 19 16:16:12 2018 > (r331212) > @@ -80,7 +80,7 @@ bootenv_autolist="YES" # Auto populate > the list of ZF > #comconsole_speed="9600" # Set the current serial console speed > #console="vidconsole" # A comma separated list of console(s) > #currdev="disk1s1a" # Set the current device > -module_path="/boot/modules;/boot/dtb;/boot/overlays" # Set the module > search path > +module_path="/boot/modules;/boot/dtb;/boot/dtb/overlays" # Set the > module search path > #prompt="\\${interpret}" # Set the command prompt > #root_disk_unit="0" # Force the root disk unit number > #rootdev="disk1s1a" # Set the root filesystem > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Tue Mar 20 01:12:35 2018 Return-Path: Delivered-To: svn-src-head@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 DCCEFF5B4B8 for ; Tue, 20 Mar 2018 01:12:34 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yb0-x231.google.com (mail-yb0-x231.google.com [IPv6:2607:f8b0:4002:c09::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 680DD70D48 for ; Tue, 20 Mar 2018 01:12:34 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yb0-x231.google.com with SMTP id t127-v6so755983yba.12 for ; Mon, 19 Mar 2018 18:12:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=q5UyKkzZUCZ9UNXLLuEh+YFCbRxjXt0wZiuyt1mLyUs=; b=VDKJ4qYamKX+jKJ7UGxuWr/68Zsb23LLNrBULnsCC1mkeDKg9t8CNwobg0oB5mo0/W unPYRYdte9qLX99rbV66dN6+BOSoohA/lDpA2SG14l5ZOGVNCQ4iDSYUgQn2UavEmojb VhR3CITd49k5cnjwPCjke4agjf2BozzFcl6Sn/7HIim5QXl44I8Orvxhlgxlk57tFXms GQaJ3/BRXOUZwoB/a+BX1aTcSlJslSprPboyFUoapoMS2z88nNLu3io6yFDQ1iNUTvyP /u8yThei81g6U9DALFSps6AB0fO3zspX5ULXHF2mHJf76a3rpj4Pel/UmS6LDbmSk8sJ d/8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=q5UyKkzZUCZ9UNXLLuEh+YFCbRxjXt0wZiuyt1mLyUs=; b=sx0B+0iGi20eJSgttDtx+dQdBcgkKg03UCL4cCDZUCUHPJBmMVkxNvvmfUohB9okFt pOOnodiX0dMWwSXzKHiRNMfbwS+GuBXFvizaeKQdGbfHCOM+BBMDqkBYMvXgVLbaI4c0 mFd3mLR3kt+kCFuqyL0w7k4wy2V9OvsRvekFdpSPkisudT2HhOSn0f773YAIs3/AdxFv O+N2EEEmscn1B+DDU08BjYEk07do1ow0saX4g4vFkzf3QOiY+zshxWXvHnYrpXAiWn2h 3HYaKJ9vZvsnltM6CHUd+3ccsR4R4ziaOqZz9FROHSOLkAfro/nPdTc1k5+D+oJgZadS u4sw== X-Gm-Message-State: AElRT7Hy5SRClBV11905fTcbfSUSWuV7nxN5wPeLdGrqJ2B7yEdWd/8L I+nnpQ3rdSY9MlximjqyIqxIHWhG6K/hOs6KBkbhaA== X-Google-Smtp-Source: AG47ELudQ+LWlLLMYJr76MbkcJJk+tUky+xWlD7VljGwy7VwkgU+kH9HpgW3HQ1M8XWyvINAuJwkgIUnPbkbBsk2Ihg= X-Received: by 2002:a25:b10c:: with SMTP id g12-v6mr3706242ybj.331.1521508353967; Mon, 19 Mar 2018 18:12:33 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:61c5:0:0:0:0:0 with HTTP; Mon, 19 Mar 2018 18:12:33 -0700 (PDT) In-Reply-To: References: <201706030242.v532gni4072040@repo.freebsd.org> From: Oliver Pinter Date: Tue, 20 Mar 2018 02:12:33 +0100 Message-ID: Subject: Re: svn commit: r319510 - head/contrib/xz/src/liblzma/check To: Eitan Adler Cc: Ed Maste , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 01:12:35 -0000 On Sunday, March 18, 2018, Eitan Adler wrote: > On 2 June 2017 at 19:42, Ed Maste wrote: > > Author: emaste > > Date: Sat Jun 3 02:42:49 2017 > > New Revision: 319510 > > URL: https://svnweb.freebsd.org/changeset/base/319510 > > > > Log: > > xz: set noexec stack flag on FreeBSD > > Heya. Is this one safe to MFC ? I think go for it. > > > > -- > Eitan Adler > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Tue Mar 20 01:33:04 2018 Return-Path: Delivered-To: svn-src-head@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 A9834F5DAC2; Tue, 20 Mar 2018 01:33:04 +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 5B18B720FF; Tue, 20 Mar 2018 01:33:04 +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 5602C163D1; Tue, 20 Mar 2018 01:33:04 +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 w2K1X49K065623; Tue, 20 Mar 2018 01:33:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K1X4gX065622; Tue, 20 Mar 2018 01:33:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803200133.w2K1X4gX065622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Mar 2018 01:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331232 - head X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 331232 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 01:33:04 -0000 Author: kevans Date: Tue Mar 20 01:33:04 2018 New Revision: 331232 URL: https://svnweb.freebsd.org/changeset/base/331232 Log: Add /boot/overlays to ObsoleteFiles It has been replaced by /boot/dtb/overlays. We haven't yet populated it with any of our own overlays, so no further damage from here. Reported by: Oliver Pinter Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Mar 20 01:07:22 2018 (r331231) +++ head/ObsoleteFiles.inc Tue Mar 20 01:33:04 2018 (r331232) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20180319: remove /boot/overlays, replaced by /boot/dtb/overlays +OLD_DIRS+=boot/overlays # 20180311: remove sys/sys/i386/include/pcaudioio.h .if ${TARGET_ARCH} == "i386" OLD_FILES+=usr/include/machine/pcaudioio.h From owner-svn-src-head@freebsd.org Tue Mar 20 02:01:31 2018 Return-Path: Delivered-To: svn-src-head@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 F00FBF60C75; Tue, 20 Mar 2018 02:01:30 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 9EB5C73857; Tue, 20 Mar 2018 02:01:30 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99989168E2; Tue, 20 Mar 2018 02:01:30 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2K21UPD079590; Tue, 20 Mar 2018 02:01:30 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K21UgY079589; Tue, 20 Mar 2018 02:01:30 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201803200201.w2K21UgY079589@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 20 Mar 2018 02:01:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331233 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331233 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 02:01:31 -0000 Author: jhibbits Date: Tue Mar 20 02:01:30 2018 New Revision: 331233 URL: https://svnweb.freebsd.org/changeset/base/331233 Log: Cast through uintptr_t to narrow the buf domain pointer on 32-bit archs arg2 is an intmax_t, which on 32-bit architectures is 64 bits, wider than a pointer. When &bdomain[i] is added to arg2 it widens from uintptr_t to intmax_t, then gcc whines when it gets cast to a pointer. Casting through uintptr_t silences this warning. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Mar 20 01:33:04 2018 (r331232) +++ head/sys/kern/vfs_bio.c Tue Mar 20 02:01:30 2018 (r331233) @@ -435,7 +435,7 @@ sysctl_bufdomain_int(SYSCTL_HANDLER_ARGS) return (error); *(int *)arg1 = value; for (i = 0; i < buf_domains; i++) - *(int *)(((uintptr_t)&bdomain[i]) + arg2) = + *(int *)(uintptr_t)(((uintptr_t)&bdomain[i]) + arg2) = value / buf_domains; return (error); @@ -454,7 +454,7 @@ sysctl_bufdomain_long(SYSCTL_HANDLER_ARGS) return (error); *(long *)arg1 = value; for (i = 0; i < buf_domains; i++) - *(long *)(((uintptr_t)&bdomain[i]) + arg2) = + *(long *)(uintptr_t)(((uintptr_t)&bdomain[i]) + arg2) = value / buf_domains; return (error); From owner-svn-src-head@freebsd.org Tue Mar 20 02:50:12 2018 Return-Path: Delivered-To: svn-src-head@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 80AC8F669CF; Tue, 20 Mar 2018 02:50:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 36EC4771F3; Tue, 20 Mar 2018 02:50:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17F24170EB; Tue, 20 Mar 2018 02:50:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2K2oBZa002045; Tue, 20 Mar 2018 02:50:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K2oBFT002044; Tue, 20 Mar 2018 02:50:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803200250.w2K2oBFT002044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Mar 2018 02:50:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331234 - head/sys/i386/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/i386/linux X-SVN-Commit-Revision: 331234 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 02:50:12 -0000 Author: emaste Date: Tue Mar 20 02:50:11 2018 New Revision: 331234 URL: https://svnweb.freebsd.org/changeset/base/331234 Log: Rationalize license text on Linuxolator files i386 linux.h missed in r330239. Approved by: sos MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/i386/linux/linux.h Modified: head/sys/i386/linux/linux.h ============================================================================== --- head/sys/i386/linux/linux.h Tue Mar 20 02:01:30 2018 (r331233) +++ head/sys/i386/linux/linux.h Tue Mar 20 02:50:11 2018 (r331234) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 1994-1996 Søren Schmidt * All rights reserved. @@ -8,25 +8,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * 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$ */ From owner-svn-src-head@freebsd.org Tue Mar 20 02:56:13 2018 Return-Path: Delivered-To: svn-src-head@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 E4428F67673; Tue, 20 Mar 2018 02:56:12 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7BC7577DA2; Tue, 20 Mar 2018 02:56:12 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x231.google.com with SMTP id 19-v6so498340itw.3; Mon, 19 Mar 2018 19:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=kE9Y8l0O6Cy1cjTi84sRL876Md47m9LKhlfOROHgAOs=; b=o2S5+JKvhNjLsYy/oyljCFzXwtVRNnVa4xz9lDAoolHXaO8/W8aXeFGJ/yaAJ83ayn L7MXUl3iU+9lKmNb1SwOWBaai5Rf654O8Xwo/Bdvv9NJ9IGzzQhiXPqdm3rmn2thPN5Y 1iQXGGMjrP+RY4slipBXKTHD6D76TETK48I+OvjTaIL1Lt24jMcepw7eWAOSS1cMszyT uwYMd7l+WuNzqHZXLNT6rYml/+FMP3akaprEVdbVOAhaFSLAjxcLjKJ5h0SA+j+h7Rq8 ++U6gkLvmjbxsQCqET0W2jvVjdhA/tjrnxHW5wQ5x9EhiezWtgzW5ul+H4zgT8v52a/w LGjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=kE9Y8l0O6Cy1cjTi84sRL876Md47m9LKhlfOROHgAOs=; b=Pf8xUDRXc2jN6ZuvM1oy5429J9FfACVNMiQxl0cSXDHYQP97vRgZFpYLG4zvkMjhPs Hb17PzFrzh1ZpHNhwyhHi7t2AivpJzmnPJOMnOIRIcUCq5FbA5cC5Zz4Rc09RKPSV1GE 7XNeBhxqO11CrTAgH/T0PBC7h6gZuZFh8wrDjOfsl174OPCvBeopDOXKOSsnjQMak5Lr BmHMoYTwGzfz0Og5Wf/UEmHpqCLCzHEmQF4yfNrw4TUh6alB6DXb/y9CDca/tCj09x6E uCQfMa1BECTRFITGBVCkMEivxkDclgp0z5w0jVeiYbLpHQPk4S0qN13qJiJsiEq3DZfj +VVg== X-Gm-Message-State: AElRT7HSHcHHHEaqJGTIOS8CyyFkE9lebU+YXwrihAmnhPkGAfO7L4Zo GFCjMptCL3Xo1Q5py7ZvQZaoJKx6kA2VY3H40VLfR/7V X-Google-Smtp-Source: AG47ELsHXhzCZ9OOBkGAJW6+AWWI8v5gr0WI9ihnI/5alidSmGNfvFwLkJ6cCR5qnuoGr1YFA2BWZNOsSaH1ea4BHw4= X-Received: by 2002:a24:d241:: with SMTP id z62-v6mr1010694itf.49.1521514571899; Mon, 19 Mar 2018 19:56:11 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.163.13 with HTTP; Mon, 19 Mar 2018 19:55:51 -0700 (PDT) In-Reply-To: References: <201706030242.v532gni4072040@repo.freebsd.org> From: Ed Maste Date: Mon, 19 Mar 2018 22:55:51 -0400 X-Google-Sender-Auth: uckUeVPvROa8taK8Zr0Sj_YKqq4 Message-ID: Subject: Re: svn commit: r319510 - head/contrib/xz/src/liblzma/check To: Eitan Adler Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 02:56:13 -0000 On 18 March 2018 at 18:25, Eitan Adler wrote: > On 2 June 2017 at 19:42, Ed Maste wrote: >> Author: emaste >> Date: Sat Jun 3 02:42:49 2017 >> New Revision: 319510 >> URL: https://svnweb.freebsd.org/changeset/base/319510 >> >> Log: >> xz: set noexec stack flag on FreeBSD > > Heya. Is this one safe to MFC ? Done in r331235 From owner-svn-src-head@freebsd.org Tue Mar 20 03:36:52 2018 Return-Path: Delivered-To: svn-src-head@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 333F0F0E; Tue, 20 Mar 2018 03:36:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 C9B827A78A; Tue, 20 Mar 2018 03:36:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4B5717A4C; Tue, 20 Mar 2018 03:36:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2K3apUH028354; Tue, 20 Mar 2018 03:36:51 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K3ap6k028353; Tue, 20 Mar 2018 03:36:51 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803200336.w2K3ap6k028353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 03:36:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331236 - head X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 331236 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 03:36:52 -0000 Author: imp Date: Tue Mar 20 03:36:51 2018 New Revision: 331236 URL: https://svnweb.freebsd.org/changeset/base/331236 Log: Note: this isn't a general thing. It only affects u-boot-based arm64 systems. Make sure the note says that specific case only. Also, provide a recipe to do it. Sponsored by: Netflix Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Mar 20 02:54:32 2018 (r331235) +++ head/UPDATING Tue Mar 20 03:36:51 2018 (r331236) @@ -52,11 +52,22 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** 20180319: - For UEFI systems: the UEFI loader(8), loader.efi, should be updated in - conjunction with installing a new kernel after r330868. The kernel, - after this revision, will be more lenient when mapping addresses for - UEFI Runtime Services and this may result in a kernel panic without the - corresponding loader(8) update. + For u-boot based arm64 UEFI systems: the UEFI loader(8), loader.efi, + should be updated in conjunction with installing a new kernel after + r330868. The kernel, after this revision, will be more lenient when + mapping addresses for UEFI Runtime Services and this may result in a + kernel panic without the corresponding loader(8) update. If you have a + recent kernel, you can do a installkernel / installworld and then reboot + as there's no recent syscall changes. If you have an older kernel and/or + a 11.x system, the following sequence is safe: + % make buildworld + % make buildkernel + % sudo make installkernel + % cd stand + % sudo make install + % sudo reboot + ... + % sudo make installworld 20180212: FreeBSD boot loader enhanced with Lua scripting. It's purely opt-in for From owner-svn-src-head@freebsd.org Tue Mar 20 03:37:05 2018 Return-Path: Delivered-To: svn-src-head@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 3BB80F96; Tue, 20 Mar 2018 03:37:05 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 E579E7A887; Tue, 20 Mar 2018 03:37:04 +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 C659B17A4F; Tue, 20 Mar 2018 03:37:04 +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 w2K3b4HA028425; Tue, 20 Mar 2018 03:37:04 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K3b4l6028424; Tue, 20 Mar 2018 03:37:04 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803200337.w2K3b4l6028424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 03:37:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331237 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 331237 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 03:37:05 -0000 Author: imp Date: Tue Mar 20 03:37:04 2018 New Revision: 331237 URL: https://svnweb.freebsd.org/changeset/base/331237 Log: Remove some redundant MPSAFE flags. This was pointed out in a code review I'm having trouble finding right now, but go ahead and eliminate these. Sponsored by: Netfix Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:36:51 2018 (r331236) +++ head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:04 2018 (r331237) @@ -626,25 +626,20 @@ ndasysctlinit(void *context, int pending) } SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "unmapped_io", CTLFLAG_RD | CTLFLAG_MPSAFE, - &softc->unmappedio, 0, "Unmapped I/O leaf"); + OID_AUTO, "unmapped_io", CTLFLAG_RD, + &softc->unmappedio, 0, "Unmapped I/O leaf"); SYSCTL_ADD_QUAD(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "deletes", CTLFLAG_RD | CTLFLAG_MPSAFE, - &softc->deletes, "Number of BIO_DELETE requests"); + OID_AUTO, "deletes", CTLFLAG_RD, + &softc->deletes, "Number of BIO_DELETE requests"); SYSCTL_ADD_QUAD(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "dsm_req", CTLFLAG_RD | CTLFLAG_MPSAFE, - &softc->dsm_req, "Number of DSM requests sent to SIM"); + OID_AUTO, "dsm_req", CTLFLAG_RD, + &softc->dsm_req, "Number of DSM requests sent to SIM"); - SYSCTL_ADD_INT(&softc->sysctl_ctx, - SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, - "rotating", - CTLFLAG_RD | CTLFLAG_MPSAFE, - &nda_rotating_media, - 0, - "Rotating media"); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "rotating", CTLFLAG_RD, &nda_rotating_media, 1, + "Rotating media"); #ifdef CAM_IO_STATS softc->sysctl_stats_tree = SYSCTL_ADD_NODE(&softc->sysctl_stats_ctx, @@ -657,17 +652,17 @@ ndasysctlinit(void *context, int pending) } SYSCTL_ADD_INT(&softc->sysctl_stats_ctx, SYSCTL_CHILDREN(softc->sysctl_stats_tree), - OID_AUTO, "timeouts", CTLFLAG_RD | CTLFLAG_MPSAFE, + OID_AUTO, "timeouts", CTLFLAG_RD, &softc->timeouts, 0, "Device timeouts reported by the SIM"); SYSCTL_ADD_INT(&softc->sysctl_stats_ctx, SYSCTL_CHILDREN(softc->sysctl_stats_tree), - OID_AUTO, "errors", CTLFLAG_RD | CTLFLAG_MPSAFE, + OID_AUTO, "errors", CTLFLAG_RD, &softc->errors, 0, "Transport errors reported by the SIM."); SYSCTL_ADD_INT(&softc->sysctl_stats_ctx, SYSCTL_CHILDREN(softc->sysctl_stats_tree), - OID_AUTO, "pack_invalidations", CTLFLAG_RD | CTLFLAG_MPSAFE, + OID_AUTO, "pack_invalidations", CTLFLAG_RD, &softc->invalidations, 0, "Device pack invalidations."); #endif From owner-svn-src-head@freebsd.org Tue Mar 20 03:37:12 2018 Return-Path: Delivered-To: svn-src-head@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 DD637FDD; Tue, 20 Mar 2018 03:37:11 +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 5D8DC7A8FE; Tue, 20 Mar 2018 03:37:10 +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 E528017A50; Tue, 20 Mar 2018 03:37:09 +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 w2K3b9FX028483; Tue, 20 Mar 2018 03:37:09 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K3b9fL028482; Tue, 20 Mar 2018 03:37:09 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803200337.w2K3b9fL028482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 03:37:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331238 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 331238 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 03:37:12 -0000 Author: imp Date: Tue Mar 20 03:37:09 2018 New Revision: 331238 URL: https://svnweb.freebsd.org/changeset/base/331238 Log: Make kern.cam.nda.num_trim tunable to limit the number of BIO_DELETE requests that we'll collapse into one DSM_TRIM. By default it is a 256, which is the max that will fit into a 4k page. Sponsored by: Netflix Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:04 2018 (r331237) +++ head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:09 2018 (r331238) @@ -167,19 +167,22 @@ static void ndasuspend(void *arg); #define NDA_MAX_TRIM_ENTRIES 256 /* Number of DSM trims to use, max 256 */ #endif +static SYSCTL_NODE(_kern_cam, OID_AUTO, nda, CTLFLAG_RD, 0, + "CAM Direct Access Disk driver"); + //static int nda_retry_count = NDA_DEFAULT_RETRY; static int nda_send_ordered = NDA_DEFAULT_SEND_ORDERED; static int nda_default_timeout = NDA_DEFAULT_TIMEOUT; static int nda_max_trim_entries = NDA_MAX_TRIM_ENTRIES; +SYSCTL_INT(_kern_cam_nda, OID_AUTO, max_trim, CTLFLAG_RDTUN, + &nda_max_trim_entries, NDA_MAX_TRIM_ENTRIES, + "Maximum number of BIO_DELETE to send down as a DSM TRIM."); /* * All NVMe media is non-rotational, so all nvme device instances * share this to implement the sysctl. */ static int nda_rotating_media = 0; - -static SYSCTL_NODE(_kern_cam, OID_AUTO, nda, CTLFLAG_RD, 0, - "CAM Direct Access Disk driver"); static struct periph_driver ndadriver = { From owner-svn-src-head@freebsd.org Tue Mar 20 03:37:16 2018 Return-Path: Delivered-To: svn-src-head@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 8E7BDF42043; Tue, 20 Mar 2018 03:37:16 +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 5DAA87A9AB; Tue, 20 Mar 2018 03:37:15 +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 ECE5B17A53; Tue, 20 Mar 2018 03:37:14 +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 w2K3bEUX028539; Tue, 20 Mar 2018 03:37:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K3bE9N028537; Tue, 20 Mar 2018 03:37:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803200337.w2K3bE9N028537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 03:37:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331239 - in head/sys: cam/nvme dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: cam/nvme dev/nvme X-SVN-Commit-Revision: 331239 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 03:37:17 -0000 Author: imp Date: Tue Mar 20 03:37:14 2018 New Revision: 331239 URL: https://svnweb.freebsd.org/changeset/base/331239 Log: Starting LBA is a 64bit number, so use htole64 instead of htole32. The latter casts the LBA to a 32-bit number before assigning it to the 64 bit structure entity. This works fine on the first 2TB of TRIMs, but terrible beyond that due to trucation. Also, add an assert to make sure we don't end too many DSM TRIM entries in one request. Sponsored by: Netflix Modified: head/sys/cam/nvme/nvme_da.c head/sys/dev/nvme/nvme.h Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:09 2018 (r331238) +++ head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:14 2018 (r331239) @@ -164,7 +164,7 @@ static void ndasuspend(void *arg); #define NDA_DEFAULT_RETRY 4 #endif #ifndef NDA_MAX_TRIM_ENTRIES -#define NDA_MAX_TRIM_ENTRIES 256 /* Number of DSM trims to use, max 256 */ +#define NDA_MAX_TRIM_ENTRIES (NVME_MAX_DSM_TRIM / sizeof(struct nvme_dsm_range))/* Number of DSM trims to use, max 256 */ #endif static SYSCTL_NODE(_kern_cam, OID_AUTO, nda, CTLFLAG_RD, 0, @@ -218,6 +218,8 @@ static void nda_nvme_trim(struct nda_softc *softc, struct ccb_nvmeio *nvmeio, void *payload, uint32_t num_ranges) { + KASSERT(num_ranges * sizeof(struct nvme_dsm_range) < NVME_MAX_DSM_TRIM); + cam_fill_nvmeio(nvmeio, 0, /* retries */ ndadone, /* cbfcnp */ @@ -957,7 +959,7 @@ ndastart(struct cam_periph *periph, union ccb *start_c dsm_range->length = htole32(bp1->bio_bcount / softc->disk->d_sectorsize); dsm_range->starting_lba = - htole32(bp1->bio_offset / softc->disk->d_sectorsize); + htole64(bp1->bio_offset / softc->disk->d_sectorsize); dsm_range++; if (dsm_range >= dsm_end) break; Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Tue Mar 20 03:37:09 2018 (r331238) +++ head/sys/dev/nvme/nvme.h Tue Mar 20 03:37:14 2018 (r331239) @@ -478,7 +478,6 @@ struct nvme_completion { _Static_assert(sizeof(struct nvme_completion) == 4 * 4, "bad size for nvme_completion"); struct nvme_dsm_range { - uint32_t attributes; uint32_t length; uint64_t starting_lba; From owner-svn-src-head@freebsd.org Tue Mar 20 05:23:51 2018 Return-Path: Delivered-To: svn-src-head@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 EE600F53233; Tue, 20 Mar 2018 05:23:50 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F7927FBD6; Tue, 20 Mar 2018 05:23:49 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from freyja.zeit4.iv.bundesimmobilien.de ([87.138.105.249]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MSY2q-1f8A5q48xQ-00Rcha; Tue, 20 Mar 2018 06:18:31 +0100 Date: Tue, 20 Mar 2018 06:18:25 +0100 From: "O. Hartmann" To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331238 - head/sys/cam/nvme Message-ID: <20180320061825.3c11090f@freyja.zeit4.iv.bundesimmobilien.de> In-Reply-To: <201803200337.w2K3b9fL028482@repo.freebsd.org> References: <201803200337.w2K3b9fL028482@repo.freebsd.org> Organization: Walstatt MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:GWKDJkKVpzJIcdPLq/JjaMgZz5065GatdNDkIF5WwiRr5MBWe3k fBuQENYz0t5pRzonxU+aeDJTFPcV68WBEQutO3U0h2oP5BdLOWaInoP2uH/dAszb5q95yOo tlK+hJFGVI1ujldIAmNMpt9JGRYivaD91M8grxNCC+x/o3pmFevaN46vAJFD6VrNgXbf/k2 NUO1e3zV+lBHwRRGohe4g== X-UI-Out-Filterresults: notjunk:1;V01:K0:2wyxAliJBVI=:B8Rwu//6UnifPzytMBwaWT pQMhV6DoYsWwGT7v62LwFTlECztdSv7e6uW38XfvCCTG6VgqsN97lKneDIs32wEtGcW8tR4BT t5kEWePQnj0yuf1hZ3EBrHWMCS0FQ5mPpK0Rw5VKOflSfQkU5mRgHWQu+CVU1Ter6NS9eZk3+ lHfzGDRKwIp5Dpiazz5c8Kb4BuOjT81hr5tto1BTMiOx9jBf2I4XZCQx9YIB9JFeqSHqz/mAK Fo8ZsU/AgQLYrn/qhssAzUNJJn6JHN+mhcp6zt43po7i6IIwryg3ba8d4s7tgf+SR/jnE/wSL LJAndCIHpPwPW4Rchq/c4V/9e4kAkwIC1EAR9vpm87jr4jDv61uzEMstgNL6cbQfwx2qWIfa5 GYTXaMge+gK4/7fb0EpMn/6QXEBIjiAFVo/i5dCKVXogZqbqwWaQvdSN4gJVB4k5hnMNxscPh MWNx5QRL9vaWhg3oUNMb+ZePJ3CzpGZmFtKxr2+nxTBhwJxM3u/8TYWUr6PcxLKvUxtzSo5Gl Gko9E7eSqLi039obgSZa2A9zjlD45Y9Lh69bzWXlrN4Xv4W6N0ulOz6ak4vHxqIzb9XvtOHMg 6biHhQw90/V0iXg8vG3NR0hGRRDtn9uX12xgz2/ChGbRtW8Ok9idO1R9gdnf06mIuEbYHaYRg z+bLf7o9ZWnLY+0eHj9K02En3geRvYFL5L7oA3jncM8HcyzPfM4f8aA95anw0ZYT8ZqjjXfNh Btu6HuqT/XnKdDbXdt7iXIceXPdtkOeM1c0HuRN3uX6tM7mZ3eh9iztAmrTIrYSs2Hg1gO/cd 5wS9JyL4/gmoE4dHcEJlnJF6Cg/kwcnYRY0fbbinfcFEg+wnkE= X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 05:23:51 -0000 On Tue, 20 Mar 2018 03:37:09 +0000 (UTC) Warner Losh wrote: > Author: imp > Date: Tue Mar 20 03:37:09 2018 > New Revision: 331238 > URL: https://svnweb.freebsd.org/changeset/base/331238 > > Log: > Make kern.cam.nda.num_trim tunable to limit the number of BIO_DELETE > requests that we'll collapse into one DSM_TRIM. By default it is a > 256, which is the max that will fit into a 4k page. > > Sponsored by: Netflix > > Modified: > head/sys/cam/nvme/nvme_da.c > > Modified: head/sys/cam/nvme/nvme_da.c > ============================================================================== > --- head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:04 2018 > (r331237) +++ head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:09 > 2018 (r331238) @@ -167,19 +167,22 @@ static void > ndasuspend(void *arg); #define NDA_MAX_TRIM_ENTRIES 256 /* Number of > DSM trims to use, max 256 */ #endif > > +static SYSCTL_NODE(_kern_cam, OID_AUTO, nda, CTLFLAG_RD, 0, > + "CAM Direct Access Disk driver"); > + > //static int nda_retry_count = NDA_DEFAULT_RETRY; > static int nda_send_ordered = NDA_DEFAULT_SEND_ORDERED; > static int nda_default_timeout = NDA_DEFAULT_TIMEOUT; > static int nda_max_trim_entries = NDA_MAX_TRIM_ENTRIES; > +SYSCTL_INT(_kern_cam_nda, OID_AUTO, max_trim, CTLFLAG_RDTUN, > + &nda_max_trim_entries, NDA_MAX_TRIM_ENTRIES, > + "Maximum number of BIO_DELETE to send down as a DSM TRIM."); > > /* > * All NVMe media is non-rotational, so all nvme device instances > * share this to implement the sysctl. > */ > static int nda_rotating_media = 0; > - > -static SYSCTL_NODE(_kern_cam, OID_AUTO, nda, CTLFLAG_RD, 0, > - "CAM Direct Access Disk driver"); > > static struct periph_driver ndadriver = > { > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" Buildkernel on CURRENT fails with the error shown below sinde this commit: [...] --- nvme_da.o --- /usr/src/sys/cam/nvme/nvme_da.c:221:72: error: too few arguments provided to function-like macro invocation KASSERT(num_ranges * sizeof(struct nvme_dsm_range) < NVME_MAX_DSM_TRIM); ^ /usr/src/sys/sys/systm.h:99:9: note: macro 'KASSERT' defined here #define KASSERT(exp,msg) do { \ ^ /usr/src/sys/cam/nvme/nvme_da.c:221:2: error: use of undeclared identifier 'KASSERT' KASSERT(num_ranges * sizeof(struct nvme_dsm_range) < NVME_MAX_DSM_TRIM); ^ 2 errors generated. *** [nvme_da.o] Error code 1 From owner-svn-src-head@freebsd.org Tue Mar 20 05:58:53 2018 Return-Path: Delivered-To: svn-src-head@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 3DA1AF55330 for ; Tue, 20 Mar 2018 05:58:53 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-it0-x22a.google.com (mail-it0-x22a.google.com [IPv6:2607:f8b0:4001:c0b::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C7DAC80E98 for ; Tue, 20 Mar 2018 05:58:52 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-it0-x22a.google.com with SMTP id y20-v6so868593itc.5 for ; Mon, 19 Mar 2018 22:58:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jroberson-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=IHZtAcWWWKFsuEI4vvZFyIlkhMM9m3BLA4TCB4R0s5g=; b=B9KZ61oXAfE5l8Kq6zc6NQ6N1ri7a0e6xDyhWdNkuVmQSbmyZFU2Nez26WphOjlClC yayZI0YoijYFznaM8kh24v4NkWFgO0CXgcu97wMnhEypX607xT/WaKWz0deyN8O3P4Qb o0fmupEKKGoeSWVVcZXbUTRGxfUk7UBLsmKIyEVcvjf6jyLNTXn23ZOvInnBaG6/cgEw GiXeS+SYhn5w0al1H+Pz/auHTQJClE9TR6VdGxy2fcI6bQ/ul1DvjjLxOae7WHpIRi67 Xt9ABsimWkUK011jebsm2Sfzb2eZBR1t83p3UItKY6OYjSz41UbHwS86I+eHuQm/mvMd gZKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=IHZtAcWWWKFsuEI4vvZFyIlkhMM9m3BLA4TCB4R0s5g=; b=Q3oVAhOU9wrvVHJg8pMkJYC0qteHyryyoxWwIBL27/1owEVtbxEaPn4+hppTv0n3l2 SRO7NXmg13vr6uJbNVwTzpg/Vtx/yNjQP7EBMUVuN8GoDbDUWSxRIqjkTE5jjm5xJpqT cNp+pUjnneE6iHoeAHKOhmqcBDYA+oa6oEsujKiTdU6CbgXC1PXXkvyzRTbDY6EevyA+ WG9B0xDHApevi2tYa5l4TDbP5EOgOdRIz9MWjCUaN+McHYzox0aXf9hon/SwMcph+CZx +o+Yv2bgWaq+VbGaorJ+NT7dX+q6Gg/3YUMCl65qntrp3TDpt6A8f+3bfY9Wm9yhiFVz aFng== X-Gm-Message-State: AElRT7FLVv8eJDY94MxOz7YY4kTHwq0nTW+ianVlTozXfIOVxNlvIg1I f83hPeGdbC1t1AY7YFp9NR2tmg== X-Google-Smtp-Source: AG47ELv3sbN1xBm0m2hCUoijgIApQ+BXl4rNy/ezRg7qALtajzcboefyswJwgPQAY5TKbnTdSGXl3A== X-Received: by 2002:a24:d8f:: with SMTP id 137-v6mr1548227itx.30.1521525532141; Mon, 19 Mar 2018 22:58:52 -0700 (PDT) Received: from rrcs-66-91-135-210.west.biz.rr.com (rrcs-66-91-135-210.west.biz.rr.com. [66.91.135.210]) by smtp.gmail.com with ESMTPSA id y3-v6sm527872itg.3.2018.03.19.22.58.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Mar 2018 22:58:51 -0700 (PDT) Date: Mon, 19 Mar 2018 19:57:57 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Justin Hibbits cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331233 - head/sys/kern In-Reply-To: <201803200201.w2K21UgY079589@repo.freebsd.org> Message-ID: References: <201803200201.w2K21UgY079589@repo.freebsd.org> User-Agent: Alpine 2.21 (BSF 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 05:58:53 -0000 Thanks for fixing my bug. Sorry I didn't build universe for this one. Thanks, Jeff On Tue, 20 Mar 2018, Justin Hibbits wrote: > Author: jhibbits > Date: Tue Mar 20 02:01:30 2018 > New Revision: 331233 > URL: https://svnweb.freebsd.org/changeset/base/331233 > > Log: > Cast through uintptr_t to narrow the buf domain pointer on 32-bit archs > > arg2 is an intmax_t, which on 32-bit architectures is 64 bits, wider than a > pointer. When &bdomain[i] is added to arg2 it widens from uintptr_t to > intmax_t, then gcc whines when it gets cast to a pointer. Casting through > uintptr_t silences this warning. > > Modified: > head/sys/kern/vfs_bio.c > > Modified: head/sys/kern/vfs_bio.c > ============================================================================== > --- head/sys/kern/vfs_bio.c Tue Mar 20 01:33:04 2018 (r331232) > +++ head/sys/kern/vfs_bio.c Tue Mar 20 02:01:30 2018 (r331233) > @@ -435,7 +435,7 @@ sysctl_bufdomain_int(SYSCTL_HANDLER_ARGS) > return (error); > *(int *)arg1 = value; > for (i = 0; i < buf_domains; i++) > - *(int *)(((uintptr_t)&bdomain[i]) + arg2) = > + *(int *)(uintptr_t)(((uintptr_t)&bdomain[i]) + arg2) = > value / buf_domains; > > return (error); > @@ -454,7 +454,7 @@ sysctl_bufdomain_long(SYSCTL_HANDLER_ARGS) > return (error); > *(long *)arg1 = value; > for (i = 0; i < buf_domains; i++) > - *(long *)(((uintptr_t)&bdomain[i]) + arg2) = > + *(long *)(uintptr_t)(((uintptr_t)&bdomain[i]) + arg2) = > value / buf_domains; > > return (error); > From owner-svn-src-head@freebsd.org Tue Mar 20 08:50:30 2018 Return-Path: Delivered-To: svn-src-head@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 EA3C1F5EE8C; Tue, 20 Mar 2018 08:50:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 6A9C587C73; Tue, 20 Mar 2018 08:50:28 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id D30E4D705F5; Tue, 20 Mar 2018 19:19:01 +1100 (AEDT) Date: Tue, 20 Mar 2018 19:19:01 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Maste cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331226 - in head/sys: amd64/linux amd64/linux32 i386/linux In-Reply-To: <201803192126.w2JLQW0N039356@repo.freebsd.org> Message-ID: <20180320183744.S950@besplex.bde.org> References: <201803192126.w2JLQW0N039356@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=cb1CRZbu697s9Y3qxmIA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 08:50:30 -0000 On Mon, 19 Mar 2018, Ed Maste wrote: > Log: > Rename linuxulator functions with linux_ prefix > > It's preferable to have a consistent prefix. This also reduces > differences between the three linux*_sysvec.c files. It is preferable to have a well-chosen (short...) prefix. The linux emulator mostly uses l_ for internal names. That is a bit too short for external names. > Modified: head/sys/amd64/linux/linux_sysvec.c > ============================================================================== > --- head/sys/amd64/linux/linux_sysvec.c Mon Mar 19 21:13:25 2018 (r331225) > +++ head/sys/amd64/linux/linux_sysvec.c Mon Mar 19 21:26:32 2018 (r331226) > @@ -119,14 +119,14 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL > SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); > > static register_t * linux_copyout_strings(struct image_params *imgp); > -static int elf_linux_fixup(register_t **stack_base, > +static int linux_elf_fixup(register_t **stack_base, > struct image_params *iparams); 'elf_' is an example of a well-chosen prefix. I don't like the style of putting the verb last in names, but it goes well with putting prefixes first. Here the verb placement style is random -- the verb is last in ...handler_set and ...elf_fixup, but not last in ...copyout_strings. > @@ -180,7 +180,7 @@ LINUX_VDSO_SYM_CHAR(linux_platform); > * MPSAFE > */ > static int > -translate_traps(int signal, int trap_code) > +linux_translate_traps(int signal, int trap_code) Names without any prefix are likely to have had the verb first, and now in the middle. > @@ -245,7 +245,7 @@ linux_set_syscall_retval(struct thread *td, int error) > } > > static int > -elf_linux_fixup(register_t **stack_base, struct image_params *imgp) > +linux_fixup_elf(register_t **stack_base, struct image_params *imgp) > { > Elf_Auxargs *args; > Elf_Addr *base; The elf_ prefix was first, but is now last (after the verb, unlike elsewhere for linux_elf_*. > Modified: head/sys/amd64/linux32/linux32_sysvec.c > ... > static void linux32_fixlimit(struct rlimit *rl, int which); The random verb order is especially confsing for 'fix' and 'fixup'. 'fixup' is a noun, but is sometimes abused as a verb and adverb instead of the correct verb and adverb 'fix up'. When it is placed at the end, e.g., for limit_fixup(), it is unclear if it is a noun or a verb. The noun form would mean a function returning a fixup and the verb form would mean a function fixing up something. Using 'fix' instead of fix as a verb at the end is even worse since 'fix' really is both a noun and a verb. The normal order in fixlimit makes it clear that it is used as a verb. Bruce From owner-svn-src-head@freebsd.org Tue Mar 20 12:55:27 2018 Return-Path: Delivered-To: svn-src-head@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 66489F4AE90; Tue, 20 Mar 2018 12:55:27 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4CEB71708; Tue, 20 Mar 2018 12:55:26 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f45.google.com with SMTP id j68-v6so2339862lfg.13; Tue, 20 Mar 2018 05:55:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=m4B3+zECkMeHeUVOZyhTVThpX4XEZhggAOA1pZYRTn0=; b=Tdo4pKegDgEvyuqqTXc7TsQVI+0R1rzz8HVIHWP8XZQenKmjWX8y9hYSeoLAUxOB2M gpt5Deyplul1bK3L8mEfJd5L4giVPY/YajZCCCAqdoMicPL01HZTxDipBMl/FpoFDphi nCsGx8cZbvOO9wnp0r0XQxlRdtr379Eu/5GrD+mZQZUkfVWbcd93LwaFYw3AYTJKHuhJ lUba5xf/hkPO0+4VaCDvNl6h5LFUTEIZPZhXVUMJoQZX1s/NuMRi/pDUrD4tt8nUcxd7 LGcW5079cuK0rN+J7vCXgtZOBZawQX4Qd1QnRcc+Mptl9t6NPk3lz8HWj/7HNEnz3hMN /aZA== X-Gm-Message-State: AElRT7EcFY4TNJA4D6wxu9NS9ayre5S7gJKM77uz71DFAqSf0ZMQkqig JdG0inacv9ygibw+aZMBFHLkeA0L X-Google-Smtp-Source: AG47ELvvAng7fSMqaYWCMNHvEVkfwkd7ufL7F32rpk4nhMZpDNIJMeAy6vKkK8yIeX3cvMyAyZACCg== X-Received: by 10.46.135.74 with SMTP id q10mr10378331ljj.73.1521550511425; Tue, 20 Mar 2018 05:55:11 -0700 (PDT) Received: from mail-lf0-f52.google.com (mail-lf0-f52.google.com. [209.85.215.52]) by smtp.gmail.com with ESMTPSA id o21-v6sm428084lfi.3.2018.03.20.05.55.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Mar 2018 05:55:11 -0700 (PDT) Received: by mail-lf0-f52.google.com with SMTP id z143-v6so2363460lff.3; Tue, 20 Mar 2018 05:55:11 -0700 (PDT) X-Received: by 2002:a19:114f:: with SMTP id g76-v6mr6548076lfi.108.1521550511114; Tue, 20 Mar 2018 05:55:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Tue, 20 Mar 2018 05:54:50 -0700 (PDT) In-Reply-To: References: <201803191616.w2JGGCid083460@repo.freebsd.org> From: Kyle Evans Date: Tue, 20 Mar 2018 07:54:50 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331212 - in head: etc/mtree stand/defaults To: Oliver Pinter Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 12:55:27 -0000 On Mon, Mar 19, 2018 at 8:08 PM, Oliver Pinter wrote: > > > On Monday, March 19, 2018, Kyle Evans wrote: >> >> Author: kevans >> Date: Mon Mar 19 16:16:12 2018 >> New Revision: 331212 >> URL: https://svnweb.freebsd.org/changeset/base/331212 >> >> Log: >> Move /boot/overlays to /boot/dtb/overlays >> > > Hi! > > Do you plan to add the old files to ObsoleteFiles.inc? > Hi, Done in r331232. Thanks! Kyle Evans From owner-svn-src-head@freebsd.org Tue Mar 20 13:14:11 2018 Return-Path: Delivered-To: svn-src-head@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 90490F4C90B; Tue, 20 Mar 2018 13:14:11 +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 42FEF72467; Tue, 20 Mar 2018 13:14:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B08C1D518; Tue, 20 Mar 2018 13:14:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KDEB6f019199; Tue, 20 Mar 2018 13:14:11 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KDEBtc019198; Tue, 20 Mar 2018 13:14:11 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803201314.w2KDEBtc019198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 13:14:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331240 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 331240 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 13:14:11 -0000 Author: imp Date: Tue Mar 20 13:14:10 2018 New Revision: 331240 URL: https://svnweb.freebsd.org/changeset/base/331240 Log: Kill assert I shouldn't have committed Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Tue Mar 20 03:37:14 2018 (r331239) +++ head/sys/cam/nvme/nvme_da.c Tue Mar 20 13:14:10 2018 (r331240) @@ -218,8 +218,6 @@ static void nda_nvme_trim(struct nda_softc *softc, struct ccb_nvmeio *nvmeio, void *payload, uint32_t num_ranges) { - KASSERT(num_ranges * sizeof(struct nvme_dsm_range) < NVME_MAX_DSM_TRIM); - cam_fill_nvmeio(nvmeio, 0, /* retries */ ndadone, /* cbfcnp */ From owner-svn-src-head@freebsd.org Tue Mar 20 13:35:20 2018 Return-Path: Delivered-To: svn-src-head@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 C75DAF4E1A3; Tue, 20 Mar 2018 13:35:20 +0000 (UTC) (envelope-from andrew@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 77C4973055; Tue, 20 Mar 2018 13:35:20 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 729511D823; Tue, 20 Mar 2018 13:35:20 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KDZKii029316; Tue, 20 Mar 2018 13:35:20 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KDZKs1029315; Tue, 20 Mar 2018 13:35:20 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201803201335.w2KDZKs1029315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 20 Mar 2018 13:35:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331241 - head/sys/dev/efidev X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/efidev X-SVN-Commit-Revision: 331241 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 13:35:21 -0000 Author: andrew Date: Tue Mar 20 13:35:20 2018 New Revision: 331241 URL: https://svnweb.freebsd.org/changeset/base/331241 Log: Check if the gettime runtime service is valid. The U-Boot efi runtime service expects us to set the address map before calling any runtime services. It will then remap a few functions to their runtime version. One of these is the gettime function. If we call into this without having set a runtime map we get a page fault. Add a check to see if this is valid in efi_init() so we don't try to use the possibly invalid pointer. Reviewed by: imp, kevans (both previous version) X-MFC-With: r330868 Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14759 Modified: head/sys/dev/efidev/efirt.c Modified: head/sys/dev/efidev/efirt.c ============================================================================== --- head/sys/dev/efidev/efirt.c Tue Mar 20 13:14:10 2018 (r331240) +++ head/sys/dev/efidev/efirt.c Tue Mar 20 13:35:20 2018 (r331241) @@ -99,6 +99,25 @@ efi_status_to_errno(efi_status status) static struct mtx efi_lock; +static bool +efi_is_in_map(struct efi_md *map, int ndesc, int descsz, vm_offset_t addr) +{ + struct efi_md *p; + int i; + + for (i = 0, p = map; i < ndesc; i++, p = efi_next_descriptor(p, + descsz)) { + if ((p->md_attr & EFI_MD_ATTR_RT) == 0) + continue; + + if (addr >= (uintptr_t)p->md_virt && + addr < (uintptr_t)p->md_virt + p->md_pages * PAGE_SIZE) + return (true); + } + + return (false); +} + static int efi_init(void) { @@ -160,6 +179,24 @@ efi_init(void) if (efi_runtime == NULL) { if (bootverbose) printf("EFI runtime services table is not present\n"); + efi_destroy_1t1_map(); + return (ENXIO); + } + + /* + * Some UEFI implementations have multiple implementations of the + * RS->GetTime function. They switch from one we can only use early + * in the boot process to one valid as a RunTime service only when we + * call RS->SetVirtualAddressMap. As this is not always the case, e.g. + * with an old loader.efi, check if the RS->GetTime function is within + * the EFI map, and fail to attach if not. + */ + if (!efi_is_in_map(map, efihdr->memory_size / efihdr->descriptor_size, + efihdr->descriptor_size, (vm_offset_t)efi_runtime->rt_gettime)) { + if (bootverbose) + printf( + "EFI runtime services table has an invalid pointer\n"); + efi_runtime = NULL; efi_destroy_1t1_map(); return (ENXIO); } From owner-svn-src-head@freebsd.org Tue Mar 20 13:39:42 2018 Return-Path: Delivered-To: svn-src-head@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 72051F4E654; Tue, 20 Mar 2018 13:39:42 +0000 (UTC) (envelope-from andrew@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 1862873622; Tue, 20 Mar 2018 13:39:42 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 041DC1D828; Tue, 20 Mar 2018 13:39:42 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KDdfpB029567; Tue, 20 Mar 2018 13:39:41 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KDdfbe029566; Tue, 20 Mar 2018 13:39:41 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201803201339.w2KDdfbe029566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 20 Mar 2018 13:39:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331242 - head X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 331242 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 13:39:42 -0000 Author: andrew Date: Tue Mar 20 13:39:41 2018 New Revision: 331242 URL: https://svnweb.freebsd.org/changeset/base/331242 Log: Remove the entry about loader.efi needing to be updated before the kernel. The kernel now handles the situation it's warning against as of r331241. Sponsored by: DARPA, AFRL Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Mar 20 13:35:20 2018 (r331241) +++ head/UPDATING Tue Mar 20 13:39:41 2018 (r331242) @@ -51,24 +51,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** -20180319: - For u-boot based arm64 UEFI systems: the UEFI loader(8), loader.efi, - should be updated in conjunction with installing a new kernel after - r330868. The kernel, after this revision, will be more lenient when - mapping addresses for UEFI Runtime Services and this may result in a - kernel panic without the corresponding loader(8) update. If you have a - recent kernel, you can do a installkernel / installworld and then reboot - as there's no recent syscall changes. If you have an older kernel and/or - a 11.x system, the following sequence is safe: - % make buildworld - % make buildkernel - % sudo make installkernel - % cd stand - % sudo make install - % sudo reboot - ... - % sudo make installworld - 20180212: FreeBSD boot loader enhanced with Lua scripting. It's purely opt-in for now by building WITH_LOADER_LUA and WITHOUT_FORTH in /etc/src.conf. From owner-svn-src-head@freebsd.org Tue Mar 20 15:29:12 2018 Return-Path: Delivered-To: svn-src-head@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 2AE88F56026 for ; Tue, 20 Mar 2018 15:29:12 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACFC277B8F for ; Tue, 20 Mar 2018 15:29:11 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 473cd9f9-2c53-11e8-b951-f99fef315fd9 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id 473cd9f9-2c53-11e8-b951-f99fef315fd9; Tue, 20 Mar 2018 15:28:03 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w2KFT2wT040201; Tue, 20 Mar 2018 09:29:02 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1521559742.99081.110.camel@freebsd.org> Subject: Re: svn commit: r331226 - in head/sys: amd64/linux amd64/linux32 i386/linux From: Ian Lepore To: Bruce Evans , Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Tue, 20 Mar 2018 09:29:02 -0600 In-Reply-To: <20180320183744.S950@besplex.bde.org> References: <201803192126.w2JLQW0N039356@repo.freebsd.org> <20180320183744.S950@besplex.bde.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 15:29:12 -0000 On Tue, 2018-03-20 at 19:19 +1100, Bruce Evans wrote: > The random verb order is especially confsing for 'fix' and 'fixup'. > 'fixup' is a noun, but is sometimes abused as a verb and adverb instead > of the correct verb and adverb 'fix up'.  When it is placed at the > end, e.g., for limit_fixup(), it is unclear if it is a noun or a verb. > The noun form would mean a function returning a fixup and the verb > form would mean a function fixing up something.  Using 'fix' instead > of fix as a verb at the end is even worse since 'fix' really is both > a noun and a verb.  The normal order in fixlimit makes it clear that > it is used as a verb. This stuff all becomes easier if you remember one simple rule:     In English, there is no noun which cannot be verbed. -- Ian From owner-svn-src-head@freebsd.org Tue Mar 20 15:44:19 2018 Return-Path: Delivered-To: svn-src-head@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 B20C9F57160; Tue, 20 Mar 2018 15:44:18 +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 6256F789B2; Tue, 20 Mar 2018 15:44:18 +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 5CF641EBFD; Tue, 20 Mar 2018 15:44:18 +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 w2KFiIpu094026; Tue, 20 Mar 2018 15:44:18 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KFiHht094018; Tue, 20 Mar 2018 15:44:17 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803201544.w2KFiHht094018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 20 Mar 2018 15:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331244 - in head: contrib/llvm/projects/libunwind/include contrib/llvm/projects/libunwind/src share/mk X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: contrib/llvm/projects/libunwind/include contrib/llvm/projects/libunwind/src share/mk X-SVN-Commit-Revision: 331244 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 15:44:19 -0000 Author: jhb Date: Tue Mar 20 15:44:17 2018 New Revision: 331244 URL: https://svnweb.freebsd.org/changeset/base/331244 Log: Add support for MIPS to LLVM's libunwind. This is originally based on a patch from David Chisnall for soft-float N64 but has since been updated to support O32, N32, and hard-float ABIs. The soft-float O32, N32, and N64 support has been committed upstream. The hard-float changes are still in review upstream. Enable LLVM_LIBUNWIND on mips when building with a suitable (C+11-capable) toolchain. This has been tested with external GCC for all ABIs and O32 and N64 with clang. Reviewed by: emaste Obtained from: CheriBSD (original N64 patch) Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D14701 Modified: head/contrib/llvm/projects/libunwind/include/__libunwind_config.h head/contrib/llvm/projects/libunwind/include/libunwind.h head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp head/contrib/llvm/projects/libunwind/src/DwarfInstructions.hpp head/contrib/llvm/projects/libunwind/src/Registers.hpp head/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S head/contrib/llvm/projects/libunwind/src/config.h head/contrib/llvm/projects/libunwind/src/libunwind.cpp head/share/mk/src.opts.mk Modified: head/contrib/llvm/projects/libunwind/include/__libunwind_config.h ============================================================================== --- head/contrib/llvm/projects/libunwind/include/__libunwind_config.h Tue Mar 20 15:04:19 2018 (r331243) +++ head/contrib/llvm/projects/libunwind/include/__libunwind_config.h Tue Mar 20 15:44:17 2018 (r331244) @@ -53,6 +53,38 @@ # define _LIBUNWIND_CONTEXT_SIZE 64 # define _LIBUNWIND_CURSOR_SIZE 76 # define _LIBUNWIND_MAX_REGISTER 96 +# elif defined(__mips__) +# if defined(_ABIO32) && _MIPS_SIM == _ABIO32 +# define _LIBUNWIND_TARGET_MIPS_O32 1 +# if defined(__mips_hard_float) +# define _LIBUNWIND_CONTEXT_SIZE 50 +# define _LIBUNWIND_CURSOR_SIZE 61 +# else +# define _LIBUNWIND_CONTEXT_SIZE 18 +# define _LIBUNWIND_CURSOR_SIZE 29 +# endif +# elif defined(_ABIN32) && _MIPS_SIM == _ABIN32 +# define _LIBUNWIND_TARGET_MIPS_NEWABI 1 +# if defined(__mips_hard_float) +# define _LIBUNWIND_CONTEXT_SIZE 67 +# define _LIBUNWIND_CURSOR_SIZE 78 +# else +# define _LIBUNWIND_CONTEXT_SIZE 35 +# define _LIBUNWIND_CURSOR_SIZE 46 +# endif +# elif defined(_ABI64) && _MIPS_SIM == _ABI64 +# define _LIBUNWIND_TARGET_MIPS_NEWABI 1 +# if defined(__mips_hard_float) +# define _LIBUNWIND_CONTEXT_SIZE 67 +# define _LIBUNWIND_CURSOR_SIZE 79 +# else +# define _LIBUNWIND_CONTEXT_SIZE 35 +# define _LIBUNWIND_CURSOR_SIZE 47 +# endif +# else +# error "Unsupported MIPS ABI and/or environment" +# endif +# define _LIBUNWIND_MAX_REGISTER 66 # else # error "Unsupported architecture." # endif @@ -63,6 +95,8 @@ # define _LIBUNWIND_TARGET_AARCH64 1 # define _LIBUNWIND_TARGET_ARM 1 # define _LIBUNWIND_TARGET_OR1K 1 +# define _LIBUNWIND_TARGET_MIPS_O32 1 +# define _LIBUNWIND_TARGET_MIPS_NEWABI 1 # define _LIBUNWIND_CONTEXT_SIZE 128 # define _LIBUNWIND_CURSOR_SIZE 140 # define _LIBUNWIND_MAX_REGISTER 120 Modified: head/contrib/llvm/projects/libunwind/include/libunwind.h ============================================================================== --- head/contrib/llvm/projects/libunwind/include/libunwind.h Tue Mar 20 15:04:19 2018 (r331243) +++ head/contrib/llvm/projects/libunwind/include/libunwind.h Tue Mar 20 15:44:17 2018 (r331244) @@ -604,4 +604,74 @@ enum { UNW_RISCV_D31 = 95, }; +// MIPS registers +enum { + UNW_MIPS_R0 = 0, + UNW_MIPS_R1 = 1, + UNW_MIPS_R2 = 2, + UNW_MIPS_R3 = 3, + UNW_MIPS_R4 = 4, + UNW_MIPS_R5 = 5, + UNW_MIPS_R6 = 6, + UNW_MIPS_R7 = 7, + UNW_MIPS_R8 = 8, + UNW_MIPS_R9 = 9, + UNW_MIPS_R10 = 10, + UNW_MIPS_R11 = 11, + UNW_MIPS_R12 = 12, + UNW_MIPS_R13 = 13, + UNW_MIPS_R14 = 14, + UNW_MIPS_R15 = 15, + UNW_MIPS_R16 = 16, + UNW_MIPS_R17 = 17, + UNW_MIPS_R18 = 18, + UNW_MIPS_R19 = 19, + UNW_MIPS_R20 = 20, + UNW_MIPS_R21 = 21, + UNW_MIPS_R22 = 22, + UNW_MIPS_R23 = 23, + UNW_MIPS_R24 = 24, + UNW_MIPS_R25 = 25, + UNW_MIPS_R26 = 26, + UNW_MIPS_R27 = 27, + UNW_MIPS_R28 = 28, + UNW_MIPS_R29 = 29, + UNW_MIPS_R30 = 30, + UNW_MIPS_R31 = 31, + UNW_MIPS_F0 = 32, + UNW_MIPS_F1 = 33, + UNW_MIPS_F2 = 34, + UNW_MIPS_F3 = 35, + UNW_MIPS_F4 = 36, + UNW_MIPS_F5 = 37, + UNW_MIPS_F6 = 38, + UNW_MIPS_F7 = 39, + UNW_MIPS_F8 = 40, + UNW_MIPS_F9 = 41, + UNW_MIPS_F10 = 42, + UNW_MIPS_F11 = 43, + UNW_MIPS_F12 = 44, + UNW_MIPS_F13 = 45, + UNW_MIPS_F14 = 46, + UNW_MIPS_F15 = 47, + UNW_MIPS_F16 = 48, + UNW_MIPS_F17 = 49, + UNW_MIPS_F18 = 50, + UNW_MIPS_F19 = 51, + UNW_MIPS_F20 = 52, + UNW_MIPS_F21 = 53, + UNW_MIPS_F22 = 54, + UNW_MIPS_F23 = 55, + UNW_MIPS_F24 = 56, + UNW_MIPS_F25 = 57, + UNW_MIPS_F26 = 58, + UNW_MIPS_F27 = 59, + UNW_MIPS_F28 = 60, + UNW_MIPS_F29 = 61, + UNW_MIPS_F30 = 62, + UNW_MIPS_F31 = 63, + UNW_MIPS_HI = 64, + UNW_MIPS_LO = 65, +}; + #endif Modified: head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp Tue Mar 20 15:04:19 2018 (r331243) +++ head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp Tue Mar 20 15:44:17 2018 (r331244) @@ -148,6 +148,7 @@ class __attribute__((visibility("hidden"))) LocalAddre return val; } uintptr_t getP(pint_t addr); + uint64_t getRegister(pint_t addr); static uint64_t getULEB128(pint_t &addr, pint_t end); static int64_t getSLEB128(pint_t &addr, pint_t end); @@ -169,6 +170,14 @@ inline uintptr_t LocalAddressSpace::getP(pint_t addr) #endif } +inline uint64_t LocalAddressSpace::getRegister(pint_t addr) { +#if defined(__LP64__) || defined(__mips64) + return get64(addr); +#else + return get32(addr); +#endif +} + /// Read a ULEB128 into a 64-bit word. inline uint64_t LocalAddressSpace::getULEB128(pint_t &addr, pint_t end) { const uint8_t *p = (uint8_t *)addr; @@ -496,6 +505,7 @@ class OtherAddressSpace { (public) uint32_t get32(pint_t addr); uint64_t get64(pint_t addr); pint_t getP(pint_t addr); + uint64_t getRegister(pint_t addr); uint64_t getULEB128(pint_t &addr, pint_t end); int64_t getSLEB128(pint_t &addr, pint_t end); pint_t getEncodedP(pint_t &addr, pint_t end, uint8_t encoding, @@ -529,6 +539,11 @@ template uint64_t OtherAddressSpace

::g template typename P::uint_t OtherAddressSpace

::getP(pint_t addr) { return P::getP(*(uint64_t *)localCopy(addr)); +} + +template +typename P::uint_t OtherAddressSpace

::getRegister(pint_t addr) { + return P::getRegister(*(uint64_t *)localCopy(addr)); } template Modified: head/contrib/llvm/projects/libunwind/src/DwarfInstructions.hpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/DwarfInstructions.hpp Tue Mar 20 15:04:19 2018 (r331243) +++ head/contrib/llvm/projects/libunwind/src/DwarfInstructions.hpp Tue Mar 20 15:44:17 2018 (r331244) @@ -83,10 +83,10 @@ typename A::pint_t DwarfInstructions::getSavedRe const RegisterLocation &savedReg) { switch (savedReg.location) { case CFI_Parser::kRegisterInCFA: - return addressSpace.getP(cfa + (pint_t)savedReg.value); + return addressSpace.getRegister(cfa + (pint_t)savedReg.value); case CFI_Parser::kRegisterAtExpression: - return addressSpace.getP( + return addressSpace.getRegister( evaluateExpression((pint_t)savedReg.value, addressSpace, registers, cfa)); Modified: head/contrib/llvm/projects/libunwind/src/Registers.hpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/Registers.hpp Tue Mar 20 15:04:19 2018 (r331243) +++ head/contrib/llvm/projects/libunwind/src/Registers.hpp Tue Mar 20 15:44:17 2018 (r331244) @@ -2168,6 +2168,612 @@ inline void Registers_riscv::setVectorRegister(int, v1 _LIBUNWIND_ABORT("no riscv vector register support yet"); } #endif // _LIBUNWIND_TARGET_RISCV + +#if defined(_LIBUNWIND_TARGET_MIPS_O32) +/// Registers_mips_o32 holds the register state of a thread in a 32-bit MIPS +/// process. +class _LIBUNWIND_HIDDEN Registers_mips_o32 { +public: + Registers_mips_o32(); + Registers_mips_o32(const void *registers); + + bool validRegister(int num) const; + uint32_t getRegister(int num) const; + void setRegister(int num, uint32_t value); + bool validFloatRegister(int num) const; + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); + bool validVectorRegister(int num) const; + v128 getVectorRegister(int num) const; + void setVectorRegister(int num, v128 value); + const char *getRegisterName(int num); + void jumpto(); + static int lastDwarfRegNum() { return 65; } + + uint32_t getSP() const { return _registers.__r[29]; } + void setSP(uint32_t value) { _registers.__r[29] = value; } + uint32_t getIP() const { return _registers.__pc; } + void setIP(uint32_t value) { _registers.__pc = value; } + +private: + struct mips_o32_thread_state_t { + uint32_t __r[32]; + uint32_t __pc; + uint32_t __hi; + uint32_t __lo; + }; + + mips_o32_thread_state_t _registers; +#ifdef __mips_hard_float + /// O32 with 32-bit floating point registers only uses half of this + /// space. However, using the same layout for 32-bit vs 64-bit + /// floating point registers results in a single context size for + /// O32 with hard float. + uint32_t _padding; + double _floats[32]; +#endif +}; + +inline Registers_mips_o32::Registers_mips_o32(const void *registers) { + static_assert((check_fit::does_fit), + "mips_o32 registers do not fit into unw_context_t"); + memcpy(&_registers, static_cast(registers), + sizeof(_registers)); +} + +inline Registers_mips_o32::Registers_mips_o32() { + memset(&_registers, 0, sizeof(_registers)); +} + +inline bool Registers_mips_o32::validRegister(int regNum) const { + if (regNum == UNW_REG_IP) + return true; + if (regNum == UNW_REG_SP) + return true; + if (regNum < 0) + return false; + if (regNum <= UNW_MIPS_R31) + return true; + if (regNum == UNW_MIPS_HI) + return true; + if (regNum == UNW_MIPS_LO) + return true; +#if defined(__mips_hard_float) && __mips_fpr == 32 + if (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31) + return true; +#endif + // FIXME: DSP accumulator registers, MSA registers + return false; +} + +inline uint32_t Registers_mips_o32::getRegister(int regNum) const { + if (regNum >= UNW_MIPS_R0 && regNum <= UNW_MIPS_R31) + return _registers.__r[regNum - UNW_MIPS_R0]; +#if defined(__mips_hard_float) && __mips_fpr == 32 + if (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31) { + uint32_t *p; + + if (regNum % 2 == 0) + p = (uint32_t *)&_floats[regNum - UNW_MIPS_F0]; + else + p = (uint32_t *)&_floats[(regNum - 1) - UNW_MIPS_F0] + 1; + return *p; + } +#endif + + switch (regNum) { + case UNW_REG_IP: + return _registers.__pc; + case UNW_REG_SP: + return _registers.__r[29]; + case UNW_MIPS_HI: + return _registers.__hi; + case UNW_MIPS_LO: + return _registers.__lo; + } + _LIBUNWIND_ABORT("unsupported mips_o32 register"); +} + +inline void Registers_mips_o32::setRegister(int regNum, uint32_t value) { + if (regNum >= UNW_MIPS_R0 && regNum <= UNW_MIPS_R31) { + _registers.__r[regNum - UNW_MIPS_R0] = value; + return; + } +#if defined(__mips_hard_float) && __mips_fpr == 32 + if (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31) { + uint32_t *p; + + if (regNum % 2 == 0) + p = (uint32_t *)&_floats[regNum - UNW_MIPS_F0]; + else + p = (uint32_t *)&_floats[(regNum - 1) - UNW_MIPS_F0] + 1; + *p = value; + return; + } +#endif + + switch (regNum) { + case UNW_REG_IP: + _registers.__pc = value; + return; + case UNW_REG_SP: + _registers.__r[29] = value; + return; + case UNW_MIPS_HI: + _registers.__hi = value; + return; + case UNW_MIPS_LO: + _registers.__lo = value; + return; + } + _LIBUNWIND_ABORT("unsupported mips_o32 register"); +} + +inline bool Registers_mips_o32::validFloatRegister(int regNum) const { +#if defined(__mips_hard_float) && __mips_fpr == 64 + if (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31) + return true; +#endif + return false; +} + +inline double Registers_mips_o32::getFloatRegister(int regNum) const { +#if defined(__mips_hard_float) && __mips_fpr == 64 + assert(validFloatRegister(regNum)); + return _floats[regNum - UNW_MIPS_F0]; +#else + _LIBUNWIND_ABORT("mips_o32 float support not implemented"); +#endif +} + +inline void Registers_mips_o32::setFloatRegister(int regNum, + double value) { +#if defined(__mips_hard_float) && __mips_fpr == 64 + assert(validFloatRegister(regNum)); + _floats[regNum - UNW_MIPS_F0] = value; +#else + _LIBUNWIND_ABORT("mips_o32 float support not implemented"); +#endif +} + +inline bool Registers_mips_o32::validVectorRegister(int /* regNum */) const { + return false; +} + +inline v128 Registers_mips_o32::getVectorRegister(int /* regNum */) const { + _LIBUNWIND_ABORT("mips_o32 vector support not implemented"); +} + +inline void Registers_mips_o32::setVectorRegister(int /* regNum */, v128 /* value */) { + _LIBUNWIND_ABORT("mips_o32 vector support not implemented"); +} + +inline const char *Registers_mips_o32::getRegisterName(int regNum) { + switch (regNum) { + case UNW_MIPS_R0: + return "$0"; + case UNW_MIPS_R1: + return "$1"; + case UNW_MIPS_R2: + return "$2"; + case UNW_MIPS_R3: + return "$3"; + case UNW_MIPS_R4: + return "$4"; + case UNW_MIPS_R5: + return "$5"; + case UNW_MIPS_R6: + return "$6"; + case UNW_MIPS_R7: + return "$7"; + case UNW_MIPS_R8: + return "$8"; + case UNW_MIPS_R9: + return "$9"; + case UNW_MIPS_R10: + return "$10"; + case UNW_MIPS_R11: + return "$11"; + case UNW_MIPS_R12: + return "$12"; + case UNW_MIPS_R13: + return "$13"; + case UNW_MIPS_R14: + return "$14"; + case UNW_MIPS_R15: + return "$15"; + case UNW_MIPS_R16: + return "$16"; + case UNW_MIPS_R17: + return "$17"; + case UNW_MIPS_R18: + return "$18"; + case UNW_MIPS_R19: + return "$19"; + case UNW_MIPS_R20: + return "$20"; + case UNW_MIPS_R21: + return "$21"; + case UNW_MIPS_R22: + return "$22"; + case UNW_MIPS_R23: + return "$23"; + case UNW_MIPS_R24: + return "$24"; + case UNW_MIPS_R25: + return "$25"; + case UNW_MIPS_R26: + return "$26"; + case UNW_MIPS_R27: + return "$27"; + case UNW_MIPS_R28: + return "$28"; + case UNW_MIPS_R29: + return "$29"; + case UNW_MIPS_R30: + return "$30"; + case UNW_MIPS_R31: + return "$31"; + case UNW_MIPS_F0: + return "$f0"; + case UNW_MIPS_F1: + return "$f1"; + case UNW_MIPS_F2: + return "$f2"; + case UNW_MIPS_F3: + return "$f3"; + case UNW_MIPS_F4: + return "$f4"; + case UNW_MIPS_F5: + return "$f5"; + case UNW_MIPS_F6: + return "$f6"; + case UNW_MIPS_F7: + return "$f7"; + case UNW_MIPS_F8: + return "$f8"; + case UNW_MIPS_F9: + return "$f9"; + case UNW_MIPS_F10: + return "$f10"; + case UNW_MIPS_F11: + return "$f11"; + case UNW_MIPS_F12: + return "$f12"; + case UNW_MIPS_F13: + return "$f13"; + case UNW_MIPS_F14: + return "$f14"; + case UNW_MIPS_F15: + return "$f15"; + case UNW_MIPS_F16: + return "$f16"; + case UNW_MIPS_F17: + return "$f17"; + case UNW_MIPS_F18: + return "$f18"; + case UNW_MIPS_F19: + return "$f19"; + case UNW_MIPS_F20: + return "$f20"; + case UNW_MIPS_F21: + return "$f21"; + case UNW_MIPS_F22: + return "$f22"; + case UNW_MIPS_F23: + return "$f23"; + case UNW_MIPS_F24: + return "$f24"; + case UNW_MIPS_F25: + return "$f25"; + case UNW_MIPS_F26: + return "$f26"; + case UNW_MIPS_F27: + return "$f27"; + case UNW_MIPS_F28: + return "$f28"; + case UNW_MIPS_F29: + return "$f29"; + case UNW_MIPS_F30: + return "$f30"; + case UNW_MIPS_F31: + return "$f31"; + case UNW_MIPS_HI: + return "$hi"; + case UNW_MIPS_LO: + return "$lo"; + default: + return "unknown register"; + } +} +#endif // _LIBUNWIND_TARGET_MIPS_O32 + +#if defined(_LIBUNWIND_TARGET_MIPS_NEWABI) +/// Registers_mips_newabi holds the register state of a thread in a +/// MIPS process using NEWABI (the N32 or N64 ABIs). +class _LIBUNWIND_HIDDEN Registers_mips_newabi { +public: + Registers_mips_newabi(); + Registers_mips_newabi(const void *registers); + + bool validRegister(int num) const; + uint64_t getRegister(int num) const; + void setRegister(int num, uint64_t value); + bool validFloatRegister(int num) const; + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); + bool validVectorRegister(int num) const; + v128 getVectorRegister(int num) const; + void setVectorRegister(int num, v128 value); + const char *getRegisterName(int num); + void jumpto(); + static int lastDwarfRegNum() { return 65; } + + uint64_t getSP() const { return _registers.__r[29]; } + void setSP(uint64_t value) { _registers.__r[29] = value; } + uint64_t getIP() const { return _registers.__pc; } + void setIP(uint64_t value) { _registers.__pc = value; } + +private: + struct mips_newabi_thread_state_t { + uint64_t __r[32]; + uint64_t __pc; + uint64_t __hi; + uint64_t __lo; + }; + + mips_newabi_thread_state_t _registers; +#ifdef __mips_hard_float + double _floats[32]; +#endif +}; + +inline Registers_mips_newabi::Registers_mips_newabi(const void *registers) { + static_assert((check_fit::does_fit), + "mips_newabi registers do not fit into unw_context_t"); + memcpy(&_registers, static_cast(registers), + sizeof(_registers)); +} + +inline Registers_mips_newabi::Registers_mips_newabi() { + memset(&_registers, 0, sizeof(_registers)); +} + +inline bool Registers_mips_newabi::validRegister(int regNum) const { + if (regNum == UNW_REG_IP) + return true; + if (regNum == UNW_REG_SP) + return true; + if (regNum < 0) + return false; + if (regNum <= UNW_MIPS_R31) + return true; + if (regNum == UNW_MIPS_HI) + return true; + if (regNum == UNW_MIPS_LO) + return true; + // FIXME: Hard float, DSP accumulator registers, MSA registers + return false; +} + +inline uint64_t Registers_mips_newabi::getRegister(int regNum) const { + if (regNum >= UNW_MIPS_R0 && regNum <= UNW_MIPS_R31) + return _registers.__r[regNum - UNW_MIPS_R0]; + + switch (regNum) { + case UNW_REG_IP: + return _registers.__pc; + case UNW_REG_SP: + return _registers.__r[29]; + case UNW_MIPS_HI: + return _registers.__hi; + case UNW_MIPS_LO: + return _registers.__lo; + } + _LIBUNWIND_ABORT("unsupported mips_newabi register"); +} + +inline void Registers_mips_newabi::setRegister(int regNum, uint64_t value) { + if (regNum >= UNW_MIPS_R0 && regNum <= UNW_MIPS_R31) { + _registers.__r[regNum - UNW_MIPS_R0] = value; + return; + } + + switch (regNum) { + case UNW_REG_IP: + _registers.__pc = value; + return; + case UNW_REG_SP: + _registers.__r[29] = value; + return; + case UNW_MIPS_HI: + _registers.__hi = value; + return; + case UNW_MIPS_LO: + _registers.__lo = value; + return; + } + _LIBUNWIND_ABORT("unsupported mips_newabi register"); +} + +inline bool Registers_mips_newabi::validFloatRegister(int regNum) const { +#ifdef __mips_hard_float + if (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31) + return true; +#endif + return false; +} + +inline double Registers_mips_newabi::getFloatRegister(int regNum) const { +#ifdef __mips_hard_float + assert(validFloatRegister(regNum)); + return _floats[regNum - UNW_MIPS_F0]; +#else + _LIBUNWIND_ABORT("mips_newabi float support not implemented"); +#endif +} + +inline void Registers_mips_newabi::setFloatRegister(int regNum, + double value) { +#ifdef __mips_hard_float + assert(validFloatRegister(regNum)); + _floats[regNum - UNW_MIPS_F0] = value; +#else + _LIBUNWIND_ABORT("mips_newabi float support not implemented"); +#endif +} + +inline bool Registers_mips_newabi::validVectorRegister(int /* regNum */) const { + return false; +} + +inline v128 Registers_mips_newabi::getVectorRegister(int /* regNum */) const { + _LIBUNWIND_ABORT("mips_newabi vector support not implemented"); +} + +inline void Registers_mips_newabi::setVectorRegister(int /* regNum */, v128 /* value */) { + _LIBUNWIND_ABORT("mips_newabi vector support not implemented"); +} + +inline const char *Registers_mips_newabi::getRegisterName(int regNum) { + switch (regNum) { + case UNW_MIPS_R0: + return "$0"; + case UNW_MIPS_R1: + return "$1"; + case UNW_MIPS_R2: + return "$2"; + case UNW_MIPS_R3: + return "$3"; + case UNW_MIPS_R4: + return "$4"; + case UNW_MIPS_R5: + return "$5"; + case UNW_MIPS_R6: + return "$6"; + case UNW_MIPS_R7: + return "$7"; + case UNW_MIPS_R8: + return "$8"; + case UNW_MIPS_R9: + return "$9"; + case UNW_MIPS_R10: + return "$10"; + case UNW_MIPS_R11: + return "$11"; + case UNW_MIPS_R12: + return "$12"; + case UNW_MIPS_R13: + return "$13"; + case UNW_MIPS_R14: + return "$14"; + case UNW_MIPS_R15: + return "$15"; + case UNW_MIPS_R16: + return "$16"; + case UNW_MIPS_R17: + return "$17"; + case UNW_MIPS_R18: + return "$18"; + case UNW_MIPS_R19: + return "$19"; + case UNW_MIPS_R20: + return "$20"; + case UNW_MIPS_R21: + return "$21"; + case UNW_MIPS_R22: + return "$22"; + case UNW_MIPS_R23: + return "$23"; + case UNW_MIPS_R24: + return "$24"; + case UNW_MIPS_R25: + return "$25"; + case UNW_MIPS_R26: + return "$26"; + case UNW_MIPS_R27: + return "$27"; + case UNW_MIPS_R28: + return "$28"; + case UNW_MIPS_R29: + return "$29"; + case UNW_MIPS_R30: + return "$30"; + case UNW_MIPS_R31: + return "$31"; + case UNW_MIPS_F0: + return "$f0"; + case UNW_MIPS_F1: + return "$f1"; + case UNW_MIPS_F2: + return "$f2"; + case UNW_MIPS_F3: + return "$f3"; + case UNW_MIPS_F4: + return "$f4"; + case UNW_MIPS_F5: + return "$f5"; + case UNW_MIPS_F6: + return "$f6"; + case UNW_MIPS_F7: + return "$f7"; + case UNW_MIPS_F8: + return "$f8"; + case UNW_MIPS_F9: + return "$f9"; + case UNW_MIPS_F10: + return "$f10"; + case UNW_MIPS_F11: + return "$f11"; + case UNW_MIPS_F12: + return "$f12"; + case UNW_MIPS_F13: + return "$f13"; + case UNW_MIPS_F14: + return "$f14"; + case UNW_MIPS_F15: + return "$f15"; + case UNW_MIPS_F16: + return "$f16"; + case UNW_MIPS_F17: + return "$f17"; + case UNW_MIPS_F18: + return "$f18"; + case UNW_MIPS_F19: + return "$f19"; + case UNW_MIPS_F20: + return "$f20"; + case UNW_MIPS_F21: + return "$f21"; + case UNW_MIPS_F22: + return "$f22"; + case UNW_MIPS_F23: + return "$f23"; + case UNW_MIPS_F24: + return "$f24"; + case UNW_MIPS_F25: + return "$f25"; + case UNW_MIPS_F26: + return "$f26"; + case UNW_MIPS_F27: + return "$f27"; + case UNW_MIPS_F28: + return "$f28"; + case UNW_MIPS_F29: + return "$f29"; + case UNW_MIPS_F30: + return "$f30"; + case UNW_MIPS_F31: + return "$f31"; + case UNW_MIPS_HI: + return "$hi"; + case UNW_MIPS_LO: + return "$lo"; + default: + return "unknown register"; + } +} +#endif // _LIBUNWIND_TARGET_MIPS_NEWABI } // namespace libunwind #endif // __REGISTERS_HPP__ Modified: head/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp Tue Mar 20 15:04:19 2018 (r331243) +++ head/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp Tue Mar 20 15:44:17 2018 (r331244) @@ -508,6 +508,18 @@ class UnwindCursor : public AbstractUnwindCursor{ (pri } #endif +#if defined(_LIBUNWIND_TARGET_MIPS_O32) + int stepWithCompactEncoding(Registers_mips_o32 &) { + return UNW_EINVAL; + } +#endif + +#if defined(_LIBUNWIND_TARGET_MIPS_NEWABI) + int stepWithCompactEncoding(Registers_mips_newabi &) { + return UNW_EINVAL; + } +#endif + bool compactSaysUseDwarf(uint32_t *offset=NULL) const { R dummy; return compactSaysUseDwarf(dummy, offset); @@ -551,6 +563,18 @@ class UnwindCursor : public AbstractUnwindCursor{ (pri return false; } #endif + +#if defined(_LIBUNWIND_TARGET_MIPS_O32) + bool compactSaysUseDwarf(Registers_mips_o32 &, uint32_t *) const { + return true; + } +#endif + +#if defined(_LIBUNWIND_TARGET_MIPS_NEWABI) + bool compactSaysUseDwarf(Registers_mips_newabi &, uint32_t *) const { + return true; + } +#endif #endif // _LIBUNWIND_SUPPORT_COMPACT_UNWIND #if _LIBUNWIND_SUPPORT_DWARF_UNWIND @@ -591,6 +615,18 @@ class UnwindCursor : public AbstractUnwindCursor{ (pri #if defined (_LIBUNWIND_TARGET_RISCV) compact_unwind_encoding_t dwarfEncoding(Registers_riscv &) const { + return 0; + } +#endif + +#if defined (_LIBUNWIND_TARGET_MIPS_O32) + compact_unwind_encoding_t dwarfEncoding(Registers_mips_o32 &) const { + return 0; + } +#endif + +#if defined (_LIBUNWIND_TARGET_MIPS_NEWABI) + compact_unwind_encoding_t dwarfEncoding(Registers_mips_newabi &) const { return 0; } #endif Modified: head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S ============================================================================== --- head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Tue Mar 20 15:04:19 2018 (r331243) +++ head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Tue Mar 20 15:44:17 2018 (r331244) @@ -526,6 +526,205 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Regis ret // jump to ra +#elif defined(__mips__) && defined(_ABIO32) && _MIPS_SIM == _ABIO32 + +// +// void libunwind::Registers_mips_o32::jumpto() +// +// On entry: +// thread state pointer is in a0 ($4) +// +DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind18Registers_mips_o326jumptoEv) + .set push + .set noat + .set noreorder + .set nomacro +#ifdef __mips_hard_float +#if __mips_fpr == 32 + ldc1 $f0, (4 * 36 + 8 * 0)($4) + ldc1 $f2, (4 * 36 + 8 * 2)($4) + ldc1 $f4, (4 * 36 + 8 * 4)($4) + ldc1 $f6, (4 * 36 + 8 * 6)($4) + ldc1 $f8, (4 * 36 + 8 * 8)($4) + ldc1 $f10, (4 * 36 + 8 * 10)($4) + ldc1 $f12, (4 * 36 + 8 * 12)($4) + ldc1 $f14, (4 * 36 + 8 * 14)($4) + ldc1 $f16, (4 * 36 + 8 * 16)($4) + ldc1 $f18, (4 * 36 + 8 * 18)($4) + ldc1 $f20, (4 * 36 + 8 * 20)($4) + ldc1 $f22, (4 * 36 + 8 * 22)($4) + ldc1 $f24, (4 * 36 + 8 * 24)($4) + ldc1 $f26, (4 * 36 + 8 * 26)($4) + ldc1 $f28, (4 * 36 + 8 * 28)($4) + ldc1 $f30, (4 * 36 + 8 * 30)($4) +#else + ldc1 $f0, (4 * 36 + 8 * 0)($4) + ldc1 $f1, (4 * 36 + 8 * 1)($4) + ldc1 $f2, (4 * 36 + 8 * 2)($4) + ldc1 $f3, (4 * 36 + 8 * 3)($4) + ldc1 $f4, (4 * 36 + 8 * 4)($4) + ldc1 $f5, (4 * 36 + 8 * 5)($4) + ldc1 $f6, (4 * 36 + 8 * 6)($4) + ldc1 $f7, (4 * 36 + 8 * 7)($4) + ldc1 $f8, (4 * 36 + 8 * 8)($4) + ldc1 $f9, (4 * 36 + 8 * 9)($4) + ldc1 $f10, (4 * 36 + 8 * 10)($4) + ldc1 $f11, (4 * 36 + 8 * 11)($4) + ldc1 $f12, (4 * 36 + 8 * 12)($4) + ldc1 $f13, (4 * 36 + 8 * 13)($4) + ldc1 $f14, (4 * 36 + 8 * 14)($4) + ldc1 $f15, (4 * 36 + 8 * 15)($4) + ldc1 $f16, (4 * 36 + 8 * 16)($4) + ldc1 $f17, (4 * 36 + 8 * 17)($4) + ldc1 $f18, (4 * 36 + 8 * 18)($4) + ldc1 $f19, (4 * 36 + 8 * 19)($4) + ldc1 $f20, (4 * 36 + 8 * 20)($4) + ldc1 $f21, (4 * 36 + 8 * 21)($4) + ldc1 $f22, (4 * 36 + 8 * 22)($4) + ldc1 $f23, (4 * 36 + 8 * 23)($4) + ldc1 $f24, (4 * 36 + 8 * 24)($4) + ldc1 $f25, (4 * 36 + 8 * 25)($4) + ldc1 $f26, (4 * 36 + 8 * 26)($4) + ldc1 $f27, (4 * 36 + 8 * 27)($4) + ldc1 $f28, (4 * 36 + 8 * 28)($4) + ldc1 $f29, (4 * 36 + 8 * 29)($4) + ldc1 $f30, (4 * 36 + 8 * 30)($4) + ldc1 $f31, (4 * 36 + 8 * 31)($4) +#endif +#endif + // restore hi and lo + lw $8, (4 * 33)($4) + mthi $8 + lw $8, (4 * 34)($4) + mtlo $8 + // r0 is zero + lw $1, (4 * 1)($4) + lw $2, (4 * 2)($4) + lw $3, (4 * 3)($4) + // skip a0 for now + lw $5, (4 * 5)($4) + lw $6, (4 * 6)($4) + lw $7, (4 * 7)($4) + lw $8, (4 * 8)($4) + lw $9, (4 * 9)($4) + lw $10, (4 * 10)($4) + lw $11, (4 * 11)($4) + lw $12, (4 * 12)($4) + lw $13, (4 * 13)($4) + lw $14, (4 * 14)($4) + lw $15, (4 * 15)($4) + lw $16, (4 * 16)($4) + lw $17, (4 * 17)($4) + lw $18, (4 * 18)($4) + lw $19, (4 * 19)($4) + lw $20, (4 * 20)($4) + lw $21, (4 * 21)($4) + lw $22, (4 * 22)($4) + lw $23, (4 * 23)($4) + lw $24, (4 * 24)($4) + lw $25, (4 * 25)($4) + lw $26, (4 * 26)($4) + lw $27, (4 * 27)($4) + lw $28, (4 * 28)($4) + lw $29, (4 * 29)($4) + lw $30, (4 * 30)($4) + // load new pc into ra + lw $31, (4 * 32)($4) + // jump to ra, load a0 in the delay slot + jr $31 + lw $4, (4 * 4)($4) + .set pop + +#elif defined(__mips64) + +// +// void libunwind::Registers_mips_newabi::jumpto() +// +// On entry: +// thread state pointer is in a0 ($4) +// +DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind21Registers_mips_newabi6jumptoEv) + .set push + .set noat + .set noreorder + .set nomacro +#ifdef __mips_hard_float + ldc1 $f0, (8 * 35)($4) + ldc1 $f1, (8 * 36)($4) + ldc1 $f2, (8 * 37)($4) + ldc1 $f3, (8 * 38)($4) + ldc1 $f4, (8 * 39)($4) + ldc1 $f5, (8 * 40)($4) + ldc1 $f6, (8 * 41)($4) + ldc1 $f7, (8 * 42)($4) + ldc1 $f8, (8 * 43)($4) + ldc1 $f9, (8 * 44)($4) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Mar 20 15:51:06 2018 Return-Path: Delivered-To: svn-src-head@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 D7ECFF57960; Tue, 20 Mar 2018 15:51: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 82DCE78F95; Tue, 20 Mar 2018 15:51: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 7DCDE1EC2E; Tue, 20 Mar 2018 15:51:05 +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 w2KFp5xI098666; Tue, 20 Mar 2018 15:51:05 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KFp5AD098664; Tue, 20 Mar 2018 15:51:05 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803201551.w2KFp5AD098664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 20 Mar 2018 15:51:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331245 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 331245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 15:51:06 -0000 Author: markj Date: Tue Mar 20 15:51:05 2018 New Revision: 331245 URL: https://svnweb.freebsd.org/changeset/base/331245 Log: Drop KTR_CONTENTION. It is incomplete, has not been adopted in the other locking primitives, and we have other means of measuring lock contention (lock_profiling, lockstat, KTR_LOCK). Drop it to slightly de-clutter the mutex code and free up a precious KTR class index. Reviewed by: jhb, mjg MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14771 Modified: head/sys/kern/kern_mutex.c head/sys/sys/ktr_class.h Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Tue Mar 20 15:44:17 2018 (r331244) +++ head/sys/kern/kern_mutex.c Tue Mar 20 15:51:05 2018 (r331245) @@ -473,9 +473,6 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v) struct turnstile *ts; uintptr_t tid; struct thread *owner; -#ifdef KTR - int cont_logged = 0; -#endif #ifdef LOCK_PROFILING int contested = 0; uint64_t waittime = 0; @@ -629,17 +626,6 @@ retry_turnstile: */ mtx_assert(m, MA_NOTOWNED); -#ifdef KTR - if (!cont_logged) { - CTR6(KTR_CONTENTION, - "contention: %p at %s:%d wants %s, taken by %s:%d", - (void *)tid, file, line, m->lock_object.lo_name, - WITNESS_FILE(&m->lock_object), - WITNESS_LINE(&m->lock_object)); - cont_logged = 1; - } -#endif - /* * Block on the turnstile. */ @@ -657,13 +643,6 @@ retry_turnstile: #endif v = MTX_READ_VALUE(m); } -#ifdef KTR - if (cont_logged) { - CTR4(KTR_CONTENTION, - "contention end: %s acquired by %p at %s:%d", - m->lock_object.lo_name, (void *)tid, file, line); - } -#endif #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING) if (__predict_true(!doing_lockprof)) return; Modified: head/sys/sys/ktr_class.h ============================================================================== --- head/sys/sys/ktr_class.h Tue Mar 20 15:44:17 2018 (r331244) +++ head/sys/sys/ktr_class.h Tue Mar 20 15:51:05 2018 (r331245) @@ -65,7 +65,7 @@ #define KTR_VM 0x00100000 /* The virtual memory system */ #define KTR_INET 0x00200000 /* IPv4 stack */ #define KTR_RUNQ 0x00400000 /* Run queue */ -#define KTR_CONTENTION 0x00800000 /* Lock contention */ +#define KTR_SPARE5 0x00800000 #define KTR_UMA 0x01000000 /* UMA slab allocator */ #define KTR_CALLOUT 0x02000000 /* Callouts and timeouts */ #define KTR_GEOM 0x04000000 /* GEOM I/O events */ From owner-svn-src-head@freebsd.org Tue Mar 20 16:17:55 2018 Return-Path: Delivered-To: svn-src-head@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 D9509F59AFC; Tue, 20 Mar 2018 16:17:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 892A77A271; Tue, 20 Mar 2018 16:17:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82DEB1F096; Tue, 20 Mar 2018 16:17:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KGHtqC009351; Tue, 20 Mar 2018 16:17:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KGHtCi009350; Tue, 20 Mar 2018 16:17:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803201617.w2KGHtCi009350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 20 Mar 2018 16:17:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331247 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331247 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 16:17:56 -0000 Author: kib Date: Tue Mar 20 16:17:55 2018 New Revision: 331247 URL: https://svnweb.freebsd.org/changeset/base/331247 Log: Check for wrap-around in vm_phys_alloc_seg_contig(). It is possible to provide insane values for size in contigmalloc(9) request, which usually not reaches the phys allocator due to failing KVA allocation. But with the forthcoming 4/4 i386, where 32bit architecture has almost 4G KVA, contigmalloc(1G) is not unreasonable outright and KVA might be available sometimes. Then, the calculation of pa_end could wrap around, depending on the physical address, and the checks in vm_phys_alloc_seg_contig() would pass while the iteration in the loop after the 'done' label goes out of the vm_page_array bounds. Fix it by detecting the wrap. Reported and tested by: pho Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D14767 Modified: head/sys/vm/vm_phys.c Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Tue Mar 20 15:57:52 2018 (r331246) +++ head/sys/vm/vm_phys.c Tue Mar 20 16:17:55 2018 (r331247) @@ -1189,6 +1189,8 @@ vm_phys_alloc_seg_contig(struct vm_phys_seg *seg, u_lo */ pa = VM_PAGE_TO_PHYS(m_ret); pa_end = pa + size; + if (pa_end < pa) + continue; for (;;) { pa += 1 << (PAGE_SHIFT + VM_NFREEORDER - 1); From owner-svn-src-head@freebsd.org Tue Mar 20 16:41:50 2018 Return-Path: Delivered-To: svn-src-head@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 C4BDCF5B470; Tue, 20 Mar 2018 16:41:49 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x22f.google.com (mail-io0-x22f.google.com [IPv6:2607:f8b0:4001:c06::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 55F187B26B; Tue, 20 Mar 2018 16:41:49 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x22f.google.com with SMTP id e7so3136581iof.2; Tue, 20 Mar 2018 09:41:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=XNRX24Lr2qNiBKv0vWgq5fOvq9amWmfEWIeFf1/YL5U=; b=usLEvQ5RdDvg+yyBJzV8KsUikG/kNNCPjqQmvzaoM5bf849OhGaohJinWBqxquk/uh 7j+5eJNTaQorNeeq0RFwMWNGgnlt7ta8sS34EDh0ntjEn5jegSse9DG4/sAuo3XlN6MW vlUC6u8UHX3WvVkkMybD0smJ8uvPjYzV+qzBqzPBu9K0+EpjTEgo355ybTntIx7aHNuj 2HmihtmbjAQ3A2T/D1xsUucYBIOT2CI1DUCGrlBeDwig17ypZIlBU83dYUeQv6U9/whl INECy5ACFFZ9J2Za+Y0oIHVtRwFzrDstFAoCfshCDe/GSFLotxWg0Hdp+s1WGGhQKgFe tdwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=XNRX24Lr2qNiBKv0vWgq5fOvq9amWmfEWIeFf1/YL5U=; b=LxP1m1t7HZJ0dxoq4lpXbMEuS8MaBuzLSwmFAViCiaJVKKRIYgyM9NytpGLcX7LqYa fGeWOU9DACzcQIXOSlQEP8iulxflYGpn1Ww2L1B2QD1BZ8KHoD4RRXmTxMKLjjdlx9Fk otIjqjgHR6okbRPIx1DH0f+bTf3l8L+MaaUFbTW4g8LVHXdOi7R0L/AJPSo7lC0FRQ43 mQzoebF8d4ejTZ9dvMVCg1lHYdjQNlwt3zWCg4nE44rmh0Rhn32azrtfEoG/yMU/cs9m T8U98LR8XOd0PLDM2kh1PKIbR4zETNvAjj/SavgwFjsBC3iO4ytfGtGXrY+D6oS3wMPW GQeA== X-Gm-Message-State: AElRT7FpS0Kt6T45258ayikBXb1JKN4OBe3pHGZ+lPjeraTF/G+xi4Nx XRFPv/tOlHogo8WA6S2WpbpZOXftG08QNUg8qQo= X-Google-Smtp-Source: AG47ELtPBEBhLHPPu7H3uCp8lXvZK9+L0SDdNMY7B2sb7H5wSf5we02yZSVH5fS5pdNSkMMDICWnPfITt2hzNUwgCBM= X-Received: by 10.107.134.85 with SMTP id i82mr16444659iod.210.1521564107514; Tue, 20 Mar 2018 09:41:47 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.163.13 with HTTP; Tue, 20 Mar 2018 09:41:27 -0700 (PDT) In-Reply-To: <20180320183744.S950@besplex.bde.org> References: <201803192126.w2JLQW0N039356@repo.freebsd.org> <20180320183744.S950@besplex.bde.org> From: Ed Maste Date: Tue, 20 Mar 2018 12:41:27 -0400 X-Google-Sender-Auth: uFP1w7WQxSuxF4KDkQWOWAp3MEg Message-ID: Subject: Re: svn commit: r331226 - in head/sys: amd64/linux amd64/linux32 i386/linux To: Bruce Evans Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 16:41:50 -0000 On 20 March 2018 at 04:19, Bruce Evans wrote: > > It is preferable to have a well-chosen (short...) prefix. The linux > emulator mostly uses l_ for internal names. That is a bit too short > for external names. l_ is too short. The only reasonable alternative is probably lnx_ but saving two characters seems does not seem worth it. > 'elf_' is an example of a well-chosen prefix. Not for Linux-specific things. There are currently three copies of these functions, and I'm going to move them so they can be shared by the Linuxulator on all appropriate archs. > I don't like the style of putting the verb last in names, but it goes well > with putting prefixes first. Here the verb placement style is random -- > the verb is last in ...handler_set and ...elf_fixup, but not last in > ...copyout_strings. These names are consistent with the sysentvec names. sv_copyout_strings = linux_strings_copyout seems confusing for no real benefit. > Names without any prefix are likely to have had the verb first, and now > in the middle. It should probably not be plural either. This could be linux_trap_translate instead. From owner-svn-src-head@freebsd.org Tue Mar 20 16:44:31 2018 Return-Path: Delivered-To: svn-src-head@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 B14C0F5B796; Tue, 20 Mar 2018 16:44:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5DB847B60B; Tue, 20 Mar 2018 16:44:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 1ACC810A7DB; Tue, 20 Mar 2018 12:44:30 -0400 (EDT) From: John Baldwin To: Ed Maste Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331057 - head/sys/compat/linux Date: Tue, 20 Mar 2018 08:54:39 -0700 Message-ID: <2422935.GGHXCazita@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: <201803161451.w2GEpl3T053141@repo.freebsd.org> <1806390.PUHUxB7aSs@ralph.baldwin.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Tue, 20 Mar 2018 12:44:30 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 16:44:31 -0000 On Monday, March 19, 2018 05:32:22 PM Ed Maste wrote: > On 16 March 2018 at 17:08, John Baldwin wrote: > > On Friday, March 16, 2018 02:51:47 PM Ed Maste wrote: > >> Author: emaste > >> Date: Fri Mar 16 14:51:47 2018 > >> New Revision: 331057 > >> URL: https://svnweb.freebsd.org/changeset/base/331057 > >> > >> Log: > >> linux_errno.c: add newer errno values > > > > Could you move the table to a header perhaps so it can also be shared > > with lib/libsysdecode/errno.c (which has another copy of this table)? > > I found that copy shortly after I made this change (and then updated > it to match). We could just add linux_errno.c to libsysdecode though? Probably. I'd like to avoid exporting the symbol if possible. Currently that is done by marking it static in errno.c, but if I compile in linux_errno.c as-is it would be a global symbol (and would need to be exported to errno.c at least). -- John Baldwin From owner-svn-src-head@freebsd.org Tue Mar 20 17:05:25 2018 Return-Path: Delivered-To: svn-src-head@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 E2FF8F5D013; Tue, 20 Mar 2018 17:05:24 +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 969657C762; Tue, 20 Mar 2018 17:05:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 915E41F8B9; Tue, 20 Mar 2018 17:05:24 +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 w2KH5OxN034408; Tue, 20 Mar 2018 17:05:24 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KH5OT8034404; Tue, 20 Mar 2018 17:05:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803201705.w2KH5OT8034404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 20 Mar 2018 17:05:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331248 - head/sys/netipsec X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/netipsec X-SVN-Commit-Revision: 331248 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 17:05:25 -0000 Author: jhb Date: Tue Mar 20 17:05:23 2018 New Revision: 331248 URL: https://svnweb.freebsd.org/changeset/base/331248 Log: Set the proper vnet in IPsec callback functions. When using hardware crypto engines, the callback functions used to handle an IPsec packet after it has been encrypted or decrypted can be invoked asynchronously from a worker thread that is not associated with a vnet. Extend 'struct xform_data' to include a vnet pointer and save the current vnet in this new member when queueing crypto requests in IPsec. In the IPsec callback routines, use the new member to set the current vnet while processing the modified packet. This fixes a panic when using hardware offload such as ccr(4) with IPsec after VIMAGE was enabled in GENERIC. Reported by: Sony Arpita Das and Harsh Jain @ Chelsio Reviewed by: bz MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D14763 Modified: head/sys/netipsec/xform.h head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c head/sys/netipsec/xform_ipcomp.c Modified: head/sys/netipsec/xform.h ============================================================================== --- head/sys/netipsec/xform.h Tue Mar 20 16:17:55 2018 (r331247) +++ head/sys/netipsec/xform.h Tue Mar 20 17:05:23 2018 (r331248) @@ -76,6 +76,7 @@ struct xform_data { int protoff; /* current protocol offset */ int skip; /* data offset */ uint8_t nxt; /* next protocol, e.g. IPV4 */ + struct vnet *vnet; }; #define XF_IP4 1 /* unused */ Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Tue Mar 20 16:17:55 2018 (r331247) +++ head/sys/netipsec/xform_ah.c Tue Mar 20 17:05:23 2018 (r331248) @@ -667,6 +667,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski xd->protoff = protoff; xd->skip = skip; xd->cryptoid = cryptoid; + xd->vnet = curvnet; return (crypto_dispatch(crp)); bad: m_freem(m); @@ -693,6 +694,7 @@ ah_input_cb(struct cryptop *crp) m = (struct mbuf *) crp->crp_buf; xd = (struct xform_data *) crp->crp_opaque; + CURVNET_SET(xd->vnet); sav = xd->sav; skip = xd->skip; nxt = xd->nxt; @@ -710,6 +712,7 @@ ah_input_cb(struct cryptop *crp) if (ipsec_updateid(sav, &crp->crp_sid, &cryptoid) != 0) crypto_freesession(cryptoid); xd->cryptoid = crp->crp_sid; + CURVNET_RESTORE(); return (crypto_dispatch(crp)); } AHSTAT_INC(ahs_noxform); @@ -805,8 +808,10 @@ ah_input_cb(struct cryptop *crp) panic("%s: Unexpected address family: %d saidx=%p", __func__, saidx->dst.sa.sa_family, saidx); } + CURVNET_RESTORE(); return error; bad: + CURVNET_RESTORE(); if (sav) key_freesav(&sav); if (m != NULL) @@ -1040,6 +1045,7 @@ ah_output(struct mbuf *m, struct secpolicy *sp, struct xd->skip = skip; xd->idx = idx; xd->cryptoid = cryptoid; + xd->vnet = curvnet; return crypto_dispatch(crp); bad: @@ -1067,6 +1073,7 @@ ah_output_cb(struct cryptop *crp) m = (struct mbuf *) crp->crp_buf; xd = (struct xform_data *) crp->crp_opaque; + CURVNET_SET(xd->vnet); sp = xd->sp; sav = xd->sav; skip = xd->skip; @@ -1081,6 +1088,7 @@ ah_output_cb(struct cryptop *crp) if (ipsec_updateid(sav, &crp->crp_sid, &cryptoid) != 0) crypto_freesession(cryptoid); xd->cryptoid = crp->crp_sid; + CURVNET_RESTORE(); return (crypto_dispatch(crp)); } AHSTAT_INC(ahs_noxform); @@ -1122,8 +1130,10 @@ ah_output_cb(struct cryptop *crp) /* NB: m is reclaimed by ipsec_process_done. */ error = ipsec_process_done(m, sp, sav, idx); + CURVNET_RESTORE(); return (error); bad: + CURVNET_RESTORE(); free(xd, M_XDATA); crypto_freereq(crp); key_freesav(&sav); Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Tue Mar 20 16:17:55 2018 (r331247) +++ head/sys/netipsec/xform_esp.c Tue Mar 20 17:05:23 2018 (r331248) @@ -397,6 +397,7 @@ esp_input(struct mbuf *m, struct secasvar *sav, int sk xd->protoff = protoff; xd->skip = skip; xd->cryptoid = cryptoid; + xd->vnet = curvnet; /* Decryption descriptor */ IPSEC_ASSERT(crde != NULL, ("null esp crypto descriptor")); @@ -455,6 +456,7 @@ esp_input_cb(struct cryptop *crp) m = (struct mbuf *) crp->crp_buf; xd = (struct xform_data *) crp->crp_opaque; + CURVNET_SET(xd->vnet); sav = xd->sav; skip = xd->skip; protoff = xd->protoff; @@ -469,6 +471,7 @@ esp_input_cb(struct cryptop *crp) if (ipsec_updateid(sav, &crp->crp_sid, &cryptoid) != 0) crypto_freesession(cryptoid); xd->cryptoid = crp->crp_sid; + CURVNET_RESTORE(); return (crypto_dispatch(crp)); } ESPSTAT_INC(esps_noxform); @@ -603,8 +606,10 @@ esp_input_cb(struct cryptop *crp) panic("%s: Unexpected address family: %d saidx=%p", __func__, saidx->dst.sa.sa_family, saidx); } + CURVNET_RESTORE(); return error; bad: + CURVNET_RESTORE(); if (sav != NULL) key_freesav(&sav); if (m != NULL) @@ -837,6 +842,7 @@ esp_output(struct mbuf *m, struct secpolicy *sp, struc xd->sav = sav; xd->idx = idx; xd->cryptoid = cryptoid; + xd->vnet = curvnet; /* Crypto operation descriptor. */ crp->crp_ilen = m->m_pkthdr.len; /* Total input length. */ @@ -882,6 +888,7 @@ esp_output_cb(struct cryptop *crp) int error; xd = (struct xform_data *) crp->crp_opaque; + CURVNET_SET(xd->vnet); m = (struct mbuf *) crp->crp_buf; sp = xd->sp; sav = xd->sav; @@ -895,6 +902,7 @@ esp_output_cb(struct cryptop *crp) if (ipsec_updateid(sav, &crp->crp_sid, &cryptoid) != 0) crypto_freesession(cryptoid); xd->cryptoid = crp->crp_sid; + CURVNET_RESTORE(); return (crypto_dispatch(crp)); } ESPSTAT_INC(esps_noxform); @@ -940,8 +948,10 @@ esp_output_cb(struct cryptop *crp) /* NB: m is reclaimed by ipsec_process_done. */ error = ipsec_process_done(m, sp, sav, idx); + CURVNET_RESTORE(); return (error); bad: + CURVNET_RESTORE(); free(xd, M_XDATA); crypto_freereq(crp); key_freesav(&sav); Modified: head/sys/netipsec/xform_ipcomp.c ============================================================================== --- head/sys/netipsec/xform_ipcomp.c Tue Mar 20 16:17:55 2018 (r331247) +++ head/sys/netipsec/xform_ipcomp.c Tue Mar 20 17:05:23 2018 (r331248) @@ -255,6 +255,7 @@ ipcomp_input(struct mbuf *m, struct secasvar *sav, int xd->sav = sav; xd->protoff = protoff; xd->skip = skip; + xd->vnet = curvnet; SECASVAR_LOCK(sav); crp->crp_sid = xd->cryptoid = sav->tdb_cryptoid; @@ -286,6 +287,7 @@ ipcomp_input_cb(struct cryptop *crp) m = (struct mbuf *) crp->crp_buf; xd = (struct xform_data *) crp->crp_opaque; + CURVNET_SET(xd->vnet); sav = xd->sav; skip = xd->skip; protoff = xd->protoff; @@ -302,6 +304,7 @@ ipcomp_input_cb(struct cryptop *crp) if (ipsec_updateid(sav, &crp->crp_sid, &cryptoid) != 0) crypto_freesession(cryptoid); xd->cryptoid = crp->crp_sid; + CURVNET_RESTORE(); return (crypto_dispatch(crp)); } IPCOMPSTAT_INC(ipcomps_noxform); @@ -366,8 +369,10 @@ ipcomp_input_cb(struct cryptop *crp) panic("%s: Unexpected address family: %d saidx=%p", __func__, saidx->dst.sa.sa_family, saidx); } + CURVNET_RESTORE(); return error; bad: + CURVNET_RESTORE(); if (sav != NULL) key_freesav(&sav); if (m != NULL) @@ -493,6 +498,7 @@ ipcomp_output(struct mbuf *m, struct secpolicy *sp, st xd->idx = idx; xd->skip = skip; xd->protoff = protoff; + xd->vnet = curvnet; /* Crypto operation descriptor */ crp->crp_ilen = m->m_pkthdr.len; /* Total input length */ @@ -531,6 +537,7 @@ ipcomp_output_cb(struct cryptop *crp) m = (struct mbuf *) crp->crp_buf; xd = (struct xform_data *) crp->crp_opaque; + CURVNET_SET(xd->vnet); idx = xd->idx; sp = xd->sp; sav = xd->sav; @@ -545,6 +552,7 @@ ipcomp_output_cb(struct cryptop *crp) if (ipsec_updateid(sav, &crp->crp_sid, &cryptoid) != 0) crypto_freesession(cryptoid); xd->cryptoid = crp->crp_sid; + CURVNET_RESTORE(); return (crypto_dispatch(crp)); } IPCOMPSTAT_INC(ipcomps_noxform); @@ -640,10 +648,12 @@ ipcomp_output_cb(struct cryptop *crp) /* NB: m is reclaimed by ipsec_process_done. */ error = ipsec_process_done(m, sp, sav, idx); + CURVNET_RESTORE(); return (error); bad: if (m) m_freem(m); + CURVNET_RESTORE(); free(xd, M_XDATA); crypto_freereq(crp); key_freesav(&sav); From owner-svn-src-head@freebsd.org Tue Mar 20 17:43:51 2018 Return-Path: Delivered-To: svn-src-head@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 7F331F604BD; Tue, 20 Mar 2018 17:43:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 1A9ED7EBC7; Tue, 20 Mar 2018 17:43:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FB5A1FF20; Tue, 20 Mar 2018 17:43:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KHhoP3055662; Tue, 20 Mar 2018 17:43:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KHhoF9055658; Tue, 20 Mar 2018 17:43:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803201743.w2KHhoF9055658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 20 Mar 2018 17:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331252 - in head/sys/amd64: amd64 include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/amd64: amd64 include X-SVN-Commit-Revision: 331252 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 17:43:51 -0000 Author: kib Date: Tue Mar 20 17:43:50 2018 New Revision: 331252 URL: https://svnweb.freebsd.org/changeset/base/331252 Log: Provide KPI for handling of rw/ro kernel text. This is a pure syntax patch to create an interface to enable and later restore write access to the kernel text and other read-only mapped regions. It is in line with e.g. vm_fault_disable_pagefaults() by allowing the nesting. Discussed with: Peter Lei Reviewed by: jtl Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D14768 Modified: head/sys/amd64/amd64/db_interface.c head/sys/amd64/amd64/gdb_machdep.c head/sys/amd64/amd64/machdep.c head/sys/amd64/include/md_var.h Modified: head/sys/amd64/amd64/db_interface.c ============================================================================== --- head/sys/amd64/amd64/db_interface.c Tue Mar 20 17:41:54 2018 (r331251) +++ head/sys/amd64/amd64/db_interface.c Tue Mar 20 17:43:50 2018 (r331252) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -75,19 +76,19 @@ db_write_bytes(vm_offset_t addr, size_t size, char *da jmp_buf jb; void *prev_jb; char *dst; - u_long cr0save; + bool old_wp; int ret; - cr0save = rcr0(); + old_wp = false; prev_jb = kdb_jmpbuf(jb); ret = setjmp(jb); if (ret == 0) { - load_cr0(cr0save & ~CR0_WP); + old_wp = disable_wp(); dst = (char *)addr; while (size-- > 0) *dst++ = *data++; } - load_cr0(cr0save); + restore_wp(old_wp); (void)kdb_jmpbuf(prev_jb); return (ret); } Modified: head/sys/amd64/amd64/gdb_machdep.c ============================================================================== --- head/sys/amd64/amd64/gdb_machdep.c Tue Mar 20 17:41:54 2018 (r331251) +++ head/sys/amd64/amd64/gdb_machdep.c Tue Mar 20 17:43:50 2018 (r331252) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -127,17 +128,14 @@ gdb_cpu_signal(int type, int code) void * gdb_begin_write(void) { - u_long cr0save; - cr0save = rcr0(); - load_cr0(cr0save & ~CR0_WP); - return ((void *)cr0save); + return (disable_wp() ? &gdb_begin_write : NULL); } void gdb_end_write(void *arg) { - load_cr0((u_long)arg); + restore_wp(arg != NULL); } Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Tue Mar 20 17:41:54 2018 (r331251) +++ head/sys/amd64/amd64/machdep.c Tue Mar 20 17:43:50 2018 (r331252) @@ -2597,6 +2597,31 @@ clear_pcb_flags(struct pcb *pcb, const u_int flags) : "cc", "memory"); } +/* + * Enable and restore kernel text write permissions. + * Callers must ensure that disable_wp()/restore_wp() are executed + * without rescheduling on the same core. + */ +bool +disable_wp(void) +{ + u_int cr0; + + cr0 = rcr0(); + if ((cr0 & CR0_WP) == 0) + return (false); + load_cr0(cr0 & ~CR0_WP); + return (true); +} + +void +restore_wp(bool old_wp) +{ + + if (old_wp) + load_cr0(rcr0() | CR0_WP); +} + #ifdef KDB /* Modified: head/sys/amd64/include/md_var.h ============================================================================== --- head/sys/amd64/include/md_var.h Tue Mar 20 17:41:54 2018 (r331251) +++ head/sys/amd64/include/md_var.h Tue Mar 20 17:43:50 2018 (r331252) @@ -53,6 +53,8 @@ void amd64_conf_fast_syscall(void); void amd64_db_resume_dbreg(void); void amd64_lower_shared_page(struct sysentvec *); void amd64_syscall(struct thread *td, int traced); +bool disable_wp(void); +void restore_wp(bool old_wp); void doreti_iret(void) __asm(__STRING(doreti_iret)); void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault)); void ld_ds(void) __asm(__STRING(ld_ds)); From owner-svn-src-head@freebsd.org Tue Mar 20 17:47:30 2018 Return-Path: Delivered-To: svn-src-head@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 77C74F6088A; Tue, 20 Mar 2018 17:47:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 266D57EE1E; Tue, 20 Mar 2018 17:47:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D3ED1FF2A; Tue, 20 Mar 2018 17:47:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KHlTWh055853; Tue, 20 Mar 2018 17:47:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KHlTQl055852; Tue, 20 Mar 2018 17:47:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803201747.w2KHlTQl055852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 20 Mar 2018 17:47:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331253 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 331253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 17:47:30 -0000 Author: kib Date: Tue Mar 20 17:47:29 2018 New Revision: 331253 URL: https://svnweb.freebsd.org/changeset/base/331253 Log: Disable write protection around patching of XSAVE instruction in the context switch code. Some BIOSes give control to the OS with CR0.WP already set, making the kernel text read-only before cpu_startup(). Reported by: Peter Lei Reviewed by: jtl Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D14768 Modified: head/sys/amd64/amd64/fpu.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Tue Mar 20 17:43:50 2018 (r331252) +++ head/sys/amd64/amd64/fpu.c Tue Mar 20 17:47:29 2018 (r331253) @@ -205,6 +205,7 @@ fpuinit_bsp1(void) { u_int cp[4]; uint64_t xsave_mask_user; + bool old_wp; if ((cpu_feature2 & CPUID2_XSAVE) != 0) { use_xsave = 1; @@ -233,8 +234,14 @@ fpuinit_bsp1(void) * Patch the XSAVE instruction in the cpu_switch code * to XSAVEOPT. We assume that XSAVE encoding used * REX byte, and set the bit 4 of the r/m byte. + * + * It seems that some BIOSes give control to the OS + * with CR0.WP already set, making the kernel text + * read-only before cpu_startup(). */ + old_wp = disable_wp(); ctx_switch_xsave[3] |= 0x10; + restore_wp(old_wp); } } From owner-svn-src-head@freebsd.org Tue Mar 20 17:59:01 2018 Return-Path: Delivered-To: svn-src-head@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 B2CA3F61537; Tue, 20 Mar 2018 17:59:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 53BDF7F5DB; Tue, 20 Mar 2018 17:59:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AD41200A4; Tue, 20 Mar 2018 17:59:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KHx0aw061095; Tue, 20 Mar 2018 17:59:00 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KHwpMu061006; Tue, 20 Mar 2018 17:58:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803201758.w2KHwpMu061006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Mar 2018 17:58:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331254 - in head/sys: amd64/acpica amd64/amd64 amd64/ia32 amd64/linux amd64/linux32 amd64/sgx arm/arm arm64/arm64 cddl/dev/dtrace/aarch64 cddl/dev/dtrace/amd64 cddl/dev/dtrace/arm cddl... X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: amd64/acpica amd64/amd64 amd64/ia32 amd64/linux amd64/linux32 amd64/sgx arm/arm arm64/arm64 cddl/dev/dtrace/aarch64 cddl/dev/dtrace/amd64 cddl/dev/dtrace/arm cddl/dev/dtrace/i386 cddl/dev... X-SVN-Commit-Revision: 331254 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 17:59:01 -0000 Author: emaste Date: Tue Mar 20 17:58:51 2018 New Revision: 331254 URL: https://svnweb.freebsd.org/changeset/base/331254 Log: Rename assym.s to assym.inc assym is only to be included by other .s files, and should never actually be assembled by itself. Reviewed by: imp, bdrewery (earlier) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D14180 Modified: head/sys/amd64/acpica/acpi_wakecode.S head/sys/amd64/amd64/apic_vector.S head/sys/amd64/amd64/atpic_vector.S head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/exception.S head/sys/amd64/amd64/locore.S head/sys/amd64/amd64/mpboot.S head/sys/amd64/amd64/sigtramp.S head/sys/amd64/amd64/support.S head/sys/amd64/amd64/xen-locore.S head/sys/amd64/ia32/ia32_exception.S head/sys/amd64/linux/linux_support.s head/sys/amd64/linux32/linux32_support.s head/sys/amd64/sgx/sgx_support.S head/sys/arm/arm/bcopy_page.S head/sys/arm/arm/bcopyinout.S head/sys/arm/arm/copystr.S head/sys/arm/arm/cpu_asm-v6.S head/sys/arm/arm/exception.S head/sys/arm/arm/fusu.S head/sys/arm/arm/hypervisor-stub.S head/sys/arm/arm/in_cksum_arm.S head/sys/arm/arm/locore-v4.S head/sys/arm/arm/locore-v6.S head/sys/arm/arm/support.S head/sys/arm/arm/swtch-v4.S head/sys/arm/arm/swtch-v6.S head/sys/arm/arm/swtch.S head/sys/arm64/arm64/bzero.S head/sys/arm64/arm64/copyinout.S head/sys/arm64/arm64/exception.S head/sys/arm64/arm64/locore.S head/sys/arm64/arm64/support.S head/sys/arm64/arm64/swtch.S head/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S head/sys/cddl/dev/dtrace/amd64/dtrace_asm.S head/sys/cddl/dev/dtrace/arm/dtrace_asm.S head/sys/cddl/dev/dtrace/i386/dtrace_asm.S head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/kern.post.mk head/sys/conf/kmod.mk head/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S head/sys/dev/hyperv/vmbus/i386/vmbus_vector.S head/sys/i386/acpica/acpi_wakecode.S head/sys/i386/i386/apic_vector.s head/sys/i386/i386/atpic_vector.s head/sys/i386/i386/bioscall.s head/sys/i386/i386/exception.s head/sys/i386/i386/locore.s head/sys/i386/i386/mpboot.s head/sys/i386/i386/sigtramp.s head/sys/i386/i386/support.s head/sys/i386/i386/swtch.s head/sys/i386/i386/vm86bios.s head/sys/i386/linux/linux_locore.s head/sys/i386/linux/linux_support.s head/sys/mips/cavium/octeon_cop2.S head/sys/mips/ingenic/jz4780_mpboot.S head/sys/mips/mips/exception.S head/sys/mips/mips/fp.S head/sys/mips/mips/locore.S head/sys/mips/mips/mpboot.S head/sys/mips/mips/octeon_cop2_swtch.S head/sys/mips/mips/support.S head/sys/mips/mips/swtch.S head/sys/mips/nlm/mpreset.S head/sys/modules/dtrace/dtrace/Makefile head/sys/modules/hyperv/vmbus/Makefile head/sys/modules/linux/Makefile head/sys/modules/linux64/Makefile head/sys/modules/sgx/Makefile head/sys/powerpc/aim/locore32.S head/sys/powerpc/aim/locore64.S head/sys/powerpc/booke/locore.S head/sys/powerpc/powerpc/cpu_subr64.S head/sys/powerpc/powerpc/sigcode32.S head/sys/powerpc/powerpc/sigcode64.S head/sys/powerpc/powerpc/swtch32.S head/sys/powerpc/powerpc/swtch64.S head/sys/riscv/riscv/copyinout.S head/sys/riscv/riscv/exception.S head/sys/riscv/riscv/locore.S head/sys/riscv/riscv/support.S head/sys/riscv/riscv/swtch.S head/sys/sparc64/sparc64/exception.S head/sys/sparc64/sparc64/interrupt.S head/sys/sparc64/sparc64/locore.S head/sys/sparc64/sparc64/mp_exception.S head/sys/sparc64/sparc64/mp_locore.S head/sys/sparc64/sparc64/support.S head/sys/sparc64/sparc64/swtch.S Modified: head/sys/amd64/acpica/acpi_wakecode.S ============================================================================== --- head/sys/amd64/acpica/acpi_wakecode.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/acpica/acpi_wakecode.S Tue Mar 20 17:58:51 2018 (r331254) @@ -34,7 +34,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * Resume entry point for real mode. Modified: head/sys/amd64/amd64/apic_vector.S ============================================================================== --- head/sys/amd64/amd64/apic_vector.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/apic_vector.S Tue Mar 20 17:58:51 2018 (r331254) @@ -44,7 +44,7 @@ #include "opt_smp.h" -#include "assym.s" +#include "assym.inc" #include #include Modified: head/sys/amd64/amd64/atpic_vector.S ============================================================================== --- head/sys/amd64/amd64/atpic_vector.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/atpic_vector.S Tue Mar 20 17:58:51 2018 (r331254) @@ -36,7 +36,7 @@ * master and slave interrupt controllers. */ -#include "assym.s" +#include "assym.inc" #include /* Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/cpu_switch.S Tue Mar 20 17:58:51 2018 (r331254) @@ -36,7 +36,7 @@ #include #include -#include "assym.s" +#include "assym.inc" #include "opt_sched.h" /*****************************************************************************/ Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/exception.S Tue Mar 20 17:58:51 2018 (r331254) @@ -42,7 +42,7 @@ #include "opt_compat.h" #include "opt_hwpmc_hooks.h" -#include "assym.s" +#include "assym.inc" #include #include Modified: head/sys/amd64/amd64/locore.S ============================================================================== --- head/sys/amd64/amd64/locore.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/locore.S Tue Mar 20 17:58:51 2018 (r331254) @@ -31,7 +31,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * Compiled KERNBASE location Modified: head/sys/amd64/amd64/mpboot.S ============================================================================== --- head/sys/amd64/amd64/mpboot.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/mpboot.S Tue Mar 20 17:58:51 2018 (r331254) @@ -29,7 +29,7 @@ #include /* miscellaneous asm macros */ #include -#include "assym.s" +#include "assym.inc" .data /* So we can modify it */ Modified: head/sys/amd64/amd64/sigtramp.S ============================================================================== --- head/sys/amd64/amd64/sigtramp.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/sigtramp.S Tue Mar 20 17:58:51 2018 (r331254) @@ -30,7 +30,7 @@ #include -#include "assym.s" +#include "assym.inc" .text /********************************************************************** Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/support.S Tue Mar 20 17:58:51 2018 (r331254) @@ -36,7 +36,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .text Modified: head/sys/amd64/amd64/xen-locore.S ============================================================================== --- head/sys/amd64/amd64/xen-locore.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/amd64/xen-locore.S Tue Mar 20 17:58:51 2018 (r331254) @@ -40,7 +40,7 @@ #define __ASSEMBLY__ #include -#include "assym.s" +#include "assym.inc" .section __xen_guest ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "FreeBSD") Modified: head/sys/amd64/ia32/ia32_exception.S ============================================================================== --- head/sys/amd64/ia32/ia32_exception.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/ia32/ia32_exception.S Tue Mar 20 17:58:51 2018 (r331254) @@ -28,7 +28,7 @@ #include -#include "assym.s" +#include "assym.inc" .text /* Modified: head/sys/amd64/linux/linux_support.s ============================================================================== --- head/sys/amd64/linux/linux_support.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/linux/linux_support.s Tue Mar 20 17:58:51 2018 (r331254) @@ -31,7 +31,7 @@ #include "linux_assym.h" /* system definitions */ #include /* miscellaneous asm macros */ -#include "assym.s" +#include "assym.inc" futex_fault: movq $0,PCB_ONFAULT(%r8) Modified: head/sys/amd64/linux32/linux32_support.s ============================================================================== --- head/sys/amd64/linux32/linux32_support.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/linux32/linux32_support.s Tue Mar 20 17:58:51 2018 (r331254) @@ -31,7 +31,7 @@ #include "linux32_assym.h" /* system definitions */ #include /* miscellaneous asm macros */ -#include "assym.s" +#include "assym.inc" futex_fault: movq $0,PCB_ONFAULT(%r8) Modified: head/sys/amd64/sgx/sgx_support.S ============================================================================== --- head/sys/amd64/sgx/sgx_support.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/amd64/sgx/sgx_support.S Tue Mar 20 17:58:51 2018 (r331254) @@ -34,7 +34,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .text Modified: head/sys/arm/arm/bcopy_page.S ============================================================================== --- head/sys/arm/arm/bcopy_page.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/bcopy_page.S Tue Mar 20 17:58:51 2018 (r331254) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); -#include "assym.s" +#include "assym.inc" #ifndef _ARM_ARCH_5E Modified: head/sys/arm/arm/bcopyinout.S ============================================================================== --- head/sys/arm/arm/bcopyinout.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/bcopyinout.S Tue Mar 20 17:58:51 2018 (r331254) @@ -36,7 +36,7 @@ */ -#include "assym.s" +#include "assym.inc" #include #include Modified: head/sys/arm/arm/copystr.S ============================================================================== --- head/sys/arm/arm/copystr.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/copystr.S Tue Mar 20 17:58:51 2018 (r331254) @@ -38,7 +38,7 @@ * Created : 16/05/95 */ -#include "assym.s" +#include "assym.inc" #include #include __FBSDID("$FreeBSD$"); Modified: head/sys/arm/arm/cpu_asm-v6.S ============================================================================== --- head/sys/arm/arm/cpu_asm-v6.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/cpu_asm-v6.S Tue Mar 20 17:58:51 2018 (r331254) @@ -26,7 +26,7 @@ * * $FreeBSD$ */ -#include "assym.s" +#include "assym.inc" #include #include Modified: head/sys/arm/arm/exception.S ============================================================================== --- head/sys/arm/arm/exception.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/exception.S Tue Mar 20 17:58:51 2018 (r331254) @@ -46,7 +46,7 @@ * */ -#include "assym.s" +#include "assym.inc" #include #include Modified: head/sys/arm/arm/fusu.S ============================================================================== --- head/sys/arm/arm/fusu.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/fusu.S Tue Mar 20 17:58:51 2018 (r331254) @@ -35,7 +35,7 @@ #include #include -#include "assym.s" +#include "assym.inc" __FBSDID("$FreeBSD$"); .syntax unified Modified: head/sys/arm/arm/hypervisor-stub.S ============================================================================== --- head/sys/arm/arm/hypervisor-stub.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/hypervisor-stub.S Tue Mar 20 17:58:51 2018 (r331254) @@ -24,7 +24,7 @@ * SUCH DAMAGE. */ -#include "assym.s" +#include "assym.inc" #include #include #include Modified: head/sys/arm/arm/in_cksum_arm.S ============================================================================== --- head/sys/arm/arm/in_cksum_arm.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/in_cksum_arm.S Tue Mar 20 17:58:51 2018 (r331254) @@ -43,7 +43,7 @@ #include "opt_inet.h" #include -#include "assym.s" +#include "assym.inc" __FBSDID("$FreeBSD$"); .syntax unified Modified: head/sys/arm/arm/locore-v4.S ============================================================================== --- head/sys/arm/arm/locore-v4.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/locore-v4.S Tue Mar 20 17:58:51 2018 (r331254) @@ -33,7 +33,7 @@ * */ -#include "assym.s" +#include "assym.inc" #include #include #include Modified: head/sys/arm/arm/locore-v6.S ============================================================================== --- head/sys/arm/arm/locore-v6.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/locore-v6.S Tue Mar 20 17:58:51 2018 (r331254) @@ -28,7 +28,7 @@ * SUCH DAMAGE. */ -#include "assym.s" +#include "assym.inc" #include #include #include @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); -/* We map 64MB of kernel unless overridden in assym.s by the kernel option. */ +/* We map 64MB of kernel unless overridden in assym.inc by the kernel option. */ #ifndef LOCORE_MAP_MB #define LOCORE_MAP_MB 64 #endif Modified: head/sys/arm/arm/support.S ============================================================================== --- head/sys/arm/arm/support.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/support.S Tue Mar 20 17:58:51 2018 (r331254) @@ -89,7 +89,7 @@ #include __FBSDID("$FreeBSD$"); -#include "assym.s" +#include "assym.inc" .syntax unified Modified: head/sys/arm/arm/swtch-v4.S ============================================================================== --- head/sys/arm/arm/swtch-v4.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/swtch-v4.S Tue Mar 20 17:58:51 2018 (r331254) @@ -78,7 +78,7 @@ * */ -#include "assym.s" +#include "assym.inc" #include "opt_sched.h" #include Modified: head/sys/arm/arm/swtch-v6.S ============================================================================== --- head/sys/arm/arm/swtch-v6.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/swtch-v6.S Tue Mar 20 17:58:51 2018 (r331254) @@ -78,7 +78,7 @@ * */ -#include "assym.s" +#include "assym.inc" #include "opt_sched.h" #include Modified: head/sys/arm/arm/swtch.S ============================================================================== --- head/sys/arm/arm/swtch.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm/arm/swtch.S Tue Mar 20 17:58:51 2018 (r331254) @@ -78,7 +78,7 @@ * */ -#include "assym.s" +#include "assym.inc" #include #include Modified: head/sys/arm64/arm64/bzero.S ============================================================================== --- head/sys/arm64/arm64/bzero.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm64/arm64/bzero.S Tue Mar 20 17:58:51 2018 (r331254) @@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$"); -#include "assym.s" +#include "assym.inc" /* * void bzero(void *p, size_t size) Modified: head/sys/arm64/arm64/copyinout.S ============================================================================== --- head/sys/arm64/arm64/copyinout.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm64/arm64/copyinout.S Tue Mar 20 17:58:51 2018 (r331254) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include -#include "assym.s" +#include "assym.inc" /* * Fault handler for the copy{in,out} functions below. Modified: head/sys/arm64/arm64/exception.S ============================================================================== --- head/sys/arm64/arm64/exception.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm64/arm64/exception.S Tue Mar 20 17:58:51 2018 (r331254) @@ -29,7 +29,7 @@ #include __FBSDID("$FreeBSD$"); -#include "assym.s" +#include "assym.inc" .text Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm64/arm64/locore.S Tue Mar 20 17:58:51 2018 (r331254) @@ -26,7 +26,7 @@ * $FreeBSD$ */ -#include "assym.s" +#include "assym.inc" #include "opt_kstack_pages.h" #include #include Modified: head/sys/arm64/arm64/support.S ============================================================================== --- head/sys/arm64/arm64/support.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm64/arm64/support.S Tue Mar 20 17:58:51 2018 (r331254) @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "assym.s" +#include "assym.inc" /* * One of the fu* or su* functions failed, return -1. Modified: head/sys/arm64/arm64/swtch.S ============================================================================== --- head/sys/arm64/arm64/swtch.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/arm64/arm64/swtch.S Tue Mar 20 17:58:51 2018 (r331254) @@ -29,7 +29,7 @@ * */ -#include "assym.s" +#include "assym.inc" #include "opt_kstack_pages.h" #include "opt_sched.h" Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S Tue Mar 20 17:58:51 2018 (r331254) @@ -35,7 +35,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* void dtrace_membar_producer(void) Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_asm.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_asm.S Tue Mar 20 17:58:51 2018 (r331254) @@ -34,7 +34,7 @@ #include #include -#include "assym.s" +#include "assym.inc" #define INTR_POP \ MEXITCOUNT; \ Modified: head/sys/cddl/dev/dtrace/arm/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/arm/dtrace_asm.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/cddl/dev/dtrace/arm/dtrace_asm.S Tue Mar 20 17:58:51 2018 (r331254) @@ -35,7 +35,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* void dtrace_membar_producer(void) Modified: head/sys/cddl/dev/dtrace/i386/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/i386/dtrace_asm.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/cddl/dev/dtrace/i386/dtrace_asm.S Tue Mar 20 17:58:51 2018 (r331254) @@ -32,7 +32,7 @@ #include #include -#include "assym.s" +#include "assym.inc" ENTRY(dtrace_invop_start) Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Tue Mar 20 17:58:51 2018 (r331254) @@ -28,7 +28,7 @@ * Use is subject to license terms. */ -#include "assym.s" +#include "assym.inc" #define _ASM Modified: head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S Tue Mar 20 17:58:51 2018 (r331254) @@ -37,7 +37,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* void dtrace_membar_producer(void) Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/conf/files.amd64 Tue Mar 20 17:58:51 2018 (r331254) @@ -105,7 +105,7 @@ hptrr_lib.o optional hptrr \ # amd64/acpica/acpi_machdep.c optional acpi acpi_wakecode.o optional acpi \ - dependency "$S/amd64/acpica/acpi_wakecode.S assym.s" \ + dependency "$S/amd64/acpica/acpi_wakecode.S assym.inc" \ compile-with "${NORMAL_S}" \ no-obj no-implicit-rule before-depend \ clean "acpi_wakecode.o" Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/conf/files.i386 Tue Mar 20 17:58:51 2018 (r331254) @@ -443,7 +443,7 @@ dev/isci/scil/scif_sas_task_request_states.c optiona dev/isci/scil/scif_sas_timer.c optional isci i386/acpica/acpi_machdep.c optional acpi acpi_wakecode.o optional acpi \ - dependency "$S/i386/acpica/acpi_wakecode.S assym.s" \ + dependency "$S/i386/acpica/acpi_wakecode.S assym.inc" \ compile-with "${NORMAL_S}" \ no-obj no-implicit-rule before-depend \ clean "acpi_wakecode.o" Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/conf/kern.post.mk Tue Mar 20 17:58:51 2018 (r331254) @@ -155,7 +155,7 @@ ${FULLKERNEL}: ${SYSTEM_DEP} vers.o .endif ${SYSTEM_LD_TAIL} -OBJS_DEPEND_GUESS+= assym.s vnode_if.h ${BEFORE_DEPEND:M*.h} \ +OBJS_DEPEND_GUESS+= assym.inc vnode_if.h ${BEFORE_DEPEND:M*.h} \ ${MFILES:T:S/.m$/.h/} .for mfile in ${MFILES} @@ -184,7 +184,7 @@ hack.pico: Makefile ${CC} ${HACK_EXTRA_FLAGS} -nostdlib hack.c -o hack.pico rm -f hack.c -assym.s: $S/kern/genassym.sh genassym.o +assym.inc: $S/kern/genassym.sh genassym.o NM='${NM}' NMFLAGS='${NMFLAGS}' sh $S/kern/genassym.sh genassym.o > ${.TARGET} genassym.o: $S/$M/$M/genassym.c @@ -212,7 +212,7 @@ _SKIP_DEPEND= 1 .endif kernel-depend: .depend -SRCS= assym.s vnode_if.h ${BEFORE_DEPEND} ${CFILES} \ +SRCS= assym.inc vnode_if.h ${BEFORE_DEPEND} ${CFILES} \ ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \ ${MFILES:T:S/.m$/.h/} DEPENDOBJS+= ${SYSTEM_OBJS} genassym.o Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/conf/kmod.mk Tue Mar 20 17:58:51 2018 (r331254) @@ -454,14 +454,14 @@ acpi_quirks.h: ${SYSDIR}/tools/acpi_quirks2h.awk ${SYS ${AWK} -f ${SYSDIR}/tools/acpi_quirks2h.awk ${SYSDIR}/dev/acpica/acpi_quirks .endif -.if !empty(SRCS:Massym.s) || !empty(DPSRCS:Massym.s) -CLEANFILES+= assym.s genassym.o +.if !empty(SRCS:Massym.inc) || !empty(DPSRCS:Massym.inc) +CLEANFILES+= assym.inc genassym.o DEPENDOBJS+= genassym.o -assym.s: genassym.o +assym.inc: genassym.o .if defined(KERNBUILDDIR) genassym.o: opt_global.h .endif -assym.s: ${SYSDIR}/kern/genassym.sh +assym.inc: ${SYSDIR}/kern/genassym.sh sh ${SYSDIR}/kern/genassym.sh genassym.o > ${.TARGET} genassym.o: ${SYSDIR}/${MACHINE}/${MACHINE}/genassym.c genassym.o: ${SRCS:Mopt_*.h} Modified: head/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S ============================================================================== --- head/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S Tue Mar 20 17:58:51 2018 (r331254) @@ -26,7 +26,7 @@ * $FreeBSD$ */ -#include "assym.s" +#include "assym.inc" #include #include Modified: head/sys/dev/hyperv/vmbus/i386/vmbus_vector.S ============================================================================== --- head/sys/dev/hyperv/vmbus/i386/vmbus_vector.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/dev/hyperv/vmbus/i386/vmbus_vector.S Tue Mar 20 17:58:51 2018 (r331254) @@ -29,7 +29,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * This is the Hyper-V vmbus channel direct callback interrupt. Modified: head/sys/i386/acpica/acpi_wakecode.S ============================================================================== --- head/sys/i386/acpica/acpi_wakecode.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/acpica/acpi_wakecode.S Tue Mar 20 17:58:51 2018 (r331254) @@ -34,7 +34,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * Resume entry point. The BIOS enters here in real mode after POST with Modified: head/sys/i386/i386/apic_vector.s ============================================================================== --- head/sys/i386/i386/apic_vector.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/apic_vector.s Tue Mar 20 17:58:51 2018 (r331254) @@ -42,7 +42,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .text SUPERALIGN_TEXT Modified: head/sys/i386/i386/atpic_vector.s ============================================================================== --- head/sys/i386/i386/atpic_vector.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/atpic_vector.s Tue Mar 20 17:58:51 2018 (r331254) @@ -38,7 +38,7 @@ #include -#include "assym.s" +#include "assym.inc" /* * Macros for interrupt entry, call to handler, and exit. Modified: head/sys/i386/i386/bioscall.s ============================================================================== --- head/sys/i386/i386/bioscall.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/bioscall.s Tue Mar 20 17:58:51 2018 (r331254) @@ -32,7 +32,7 @@ #include -#include "assym.s" +#include "assym.inc" .data ALIGN_DATA Modified: head/sys/i386/i386/exception.s ============================================================================== --- head/sys/i386/i386/exception.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/exception.s Tue Mar 20 17:58:51 2018 (r331254) @@ -42,7 +42,7 @@ #include #include -#include "assym.s" +#include "assym.inc #define SEL_RPL_MASK 0x0003 #define GSEL_KPL 0x0020 /* GSEL(GCODE_SEL, SEL_KPL) */ Modified: head/sys/i386/i386/locore.s ============================================================================== --- head/sys/i386/i386/locore.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/locore.s Tue Mar 20 17:58:51 2018 (r331254) @@ -52,7 +52,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * XXX Modified: head/sys/i386/i386/mpboot.s ============================================================================== --- head/sys/i386/i386/mpboot.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/mpboot.s Tue Mar 20 17:58:51 2018 (r331254) @@ -35,7 +35,7 @@ #include #include -#include "assym.s" +#include "assym.inc" #define R(x) ((x)-KERNBASE) Modified: head/sys/i386/i386/sigtramp.s ============================================================================== --- head/sys/i386/i386/sigtramp.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/sigtramp.s Tue Mar 20 17:58:51 2018 (r331254) @@ -45,7 +45,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * Signal trampoline, copied to top of user stack Modified: head/sys/i386/i386/support.s ============================================================================== --- head/sys/i386/i386/support.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/support.s Tue Mar 20 17:58:51 2018 (r331254) @@ -34,7 +34,7 @@ #include #include -#include "assym.s" +#include "assym.inc" #define IDXSHIFT 10 Modified: head/sys/i386/i386/swtch.s ============================================================================== --- head/sys/i386/i386/swtch.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/swtch.s Tue Mar 20 17:58:51 2018 (r331254) @@ -36,7 +36,7 @@ #include -#include "assym.s" +#include "assym.inc" #if defined(SMP) && defined(SCHED_ULE) #define SETOP xchgl Modified: head/sys/i386/i386/vm86bios.s ============================================================================== --- head/sys/i386/i386/vm86bios.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/i386/vm86bios.s Tue Mar 20 17:58:51 2018 (r331254) @@ -29,7 +29,7 @@ #include /* miscellaneous asm macros */ #include -#include "assym.s" +#include "assym.inc" #define SCR_NEWPTD PCB_ESI /* readability macros */ #define SCR_VMFRAME PCB_EBP /* see vm86.c for explanation */ Modified: head/sys/i386/linux/linux_locore.s ============================================================================== --- head/sys/i386/linux/linux_locore.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/linux/linux_locore.s Tue Mar 20 17:58:51 2018 (r331254) @@ -5,7 +5,7 @@ #include /* system call numbers */ -#include "assym.s" +#include "assym.inc" /* * To avoid excess stack frame the signal trampoline code emulates Modified: head/sys/i386/linux/linux_support.s ============================================================================== --- head/sys/i386/linux/linux_support.s Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/i386/linux/linux_support.s Tue Mar 20 17:58:51 2018 (r331254) @@ -31,7 +31,7 @@ #include "linux_assym.h" /* system definitions */ #include /* miscellaneous asm macros */ -#include "assym.s" +#include "assym.inc" futex_fault_decx: movl PCPU(CURPCB),%ecx Modified: head/sys/mips/cavium/octeon_cop2.S ============================================================================== --- head/sys/mips/cavium/octeon_cop2.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/cavium/octeon_cop2.S Tue Mar 20 17:58:51 2018 (r331254) @@ -29,7 +29,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .set noreorder Modified: head/sys/mips/ingenic/jz4780_mpboot.S ============================================================================== --- head/sys/mips/ingenic/jz4780_mpboot.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/ingenic/jz4780_mpboot.S Tue Mar 20 17:58:51 2018 (r331254) @@ -27,7 +27,7 @@ */ #include -#include "assym.s" +#include "assym.inc" .text .set noat Modified: head/sys/mips/mips/exception.S ============================================================================== --- head/sys/mips/mips/exception.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/mips/exception.S Tue Mar 20 17:58:51 2018 (r331254) @@ -63,7 +63,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .set noreorder # Noreorder is default style! Modified: head/sys/mips/mips/fp.S ============================================================================== --- head/sys/mips/mips/fp.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/mips/fp.S Tue Mar 20 17:58:51 2018 (r331254) @@ -43,7 +43,7 @@ #include #include -#include "assym.s" +#include "assym.inc" #define SEXP_INF 0xff #define DEXP_INF 0x7ff Modified: head/sys/mips/mips/locore.S ============================================================================== --- head/sys/mips/mips/locore.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/mips/locore.S Tue Mar 20 17:58:51 2018 (r331254) @@ -70,7 +70,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .data #ifdef YAMON Modified: head/sys/mips/mips/mpboot.S ============================================================================== --- head/sys/mips/mips/mpboot.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/mips/mpboot.S Tue Mar 20 17:58:51 2018 (r331254) @@ -30,7 +30,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .text .set noat Modified: head/sys/mips/mips/octeon_cop2_swtch.S ============================================================================== --- head/sys/mips/mips/octeon_cop2_swtch.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/mips/octeon_cop2_swtch.S Tue Mar 20 17:58:51 2018 (r331254) @@ -30,7 +30,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .set noreorder Modified: head/sys/mips/mips/support.S ============================================================================== --- head/sys/mips/mips/support.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/mips/support.S Tue Mar 20 17:58:51 2018 (r331254) @@ -94,7 +94,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .set noreorder # Noreorder is default style! Modified: head/sys/mips/mips/swtch.S ============================================================================== --- head/sys/mips/mips/swtch.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/mips/swtch.S Tue Mar 20 17:58:51 2018 (r331254) @@ -64,7 +64,7 @@ #include #include -#include "assym.s" +#include "assym.inc" .set noreorder # Noreorder is default style! Modified: head/sys/mips/nlm/mpreset.S ============================================================================== --- head/sys/mips/nlm/mpreset.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/mips/nlm/mpreset.S Tue Mar 20 17:58:51 2018 (r331254) @@ -38,7 +38,7 @@ #define SYS_REG_KSEG1(node, reg) (0xa0000000 + XLP_DEFAULT_IO_BASE + \ XLP_IO_SYS_OFFSET(node) + XLP_IO_PCI_HDRSZ + (reg) * 4) -#include "assym.s" +#include "assym.inc" .text .set noat Modified: head/sys/modules/dtrace/dtrace/Makefile ============================================================================== --- head/sys/modules/dtrace/dtrace/Makefile Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/modules/dtrace/dtrace/Makefile Tue Mar 20 17:58:51 2018 (r331254) @@ -27,9 +27,9 @@ CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/inte SRCS+= bus_if.h device_if.h vnode_if.h # Needed for dtrace_asm.S -DPSRCS+= assym.s +DPSRCS+= assym.inc -# These are needed for assym.s +# These are needed for assym.inc SRCS+= opt_compat.h opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h #This is needed for dtrace.c @@ -53,7 +53,7 @@ EXPORT_SYMS= dtrace_register \ dtrace_unregister \ dtrace_probe_lookup -dtrace_asm.o: assym.s +dtrace_asm.o: assym.inc .include Modified: head/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- head/sys/modules/hyperv/vmbus/Makefile Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/modules/hyperv/vmbus/Makefile Tue Mar 20 17:58:51 2018 (r331254) @@ -17,13 +17,13 @@ SRCS= hyperv.c \ vmbus_xact.c SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h pci_if.h pcib_if.h vmbus_if.h -# XXX: for assym.s +# XXX: for assym.inc SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h opt_compat.h .if ${MACHINE_CPUARCH} == "i386" SRCS+= opt_apic.h .endif -DPSRCS+= assym.s +DPSRCS= assym.inc vmbus_vector.o: ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ Modified: head/sys/modules/linux/Makefile ============================================================================== --- head/sys/modules/linux/Makefile Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/modules/linux/Makefile Tue Mar 20 17:58:51 2018 (r331254) @@ -19,9 +19,9 @@ SRCS= linux_fork.c linux${SFX}_dummy.c linux_file.c li opt_inet6.h opt_compat.h opt_posix.h opt_usb.h vnode_if.h \ device_if.h bus_if.h \ linux${SFX}_support.s -DPSRCS= assym.s linux${SFX}_genassym.c +DPSRCS= assym.inc linux${SFX}_genassym.c -# XXX: for assym.s +# XXX: for assym.inc SRCS+= opt_kstack_pages.h opt_nfs.h opt_compat.h opt_hwpmc_hooks.h .if ${MACHINE_CPUARCH} == "i386" SRCS+= opt_apic.h @@ -48,7 +48,7 @@ CLEANFILES= linux${SFX}_assym.h linux${SFX}_genassym.o linux${SFX}_assym.h: linux${SFX}_genassym.o sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET} -linux${SFX}_locore.o: linux${SFX}_assym.h assym.s +linux${SFX}_locore.o: linux${SFX}_assym.h assym.inc ${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s \ -pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -nostdinc -nostdlib \ -fno-omit-frame-pointer -fPIC \ @@ -56,7 +56,7 @@ linux${SFX}_locore.o: linux${SFX}_assym.h assym.s -Wl,-soname=${VDSO}.so.1,--eh-frame-hdr,-warn-common \ ${.IMPSRC} -o ${.TARGET} -linux${SFX}_support.o: linux${SFX}_assym.h assym.s +linux${SFX}_support.o: linux${SFX}_assym.h assym.inc ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ ${.IMPSRC} -o ${.TARGET} Modified: head/sys/modules/linux64/Makefile ============================================================================== --- head/sys/modules/linux64/Makefile Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/modules/linux64/Makefile Tue Mar 20 17:58:51 2018 (r331254) @@ -13,9 +13,9 @@ SRCS= linux_fork.c linux_dummy.c linux_file.c linux_ev opt_inet6.h opt_compat.h opt_posix.h opt_usb.h \ vnode_if.h device_if.h bus_if.h \ linux_support.s -DPSRCS= assym.s linux_genassym.c +DPSRCS= assym.inc linux_genassym.c -# XXX: for assym.s +# XXX: for assym.inc SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h .if ${MACHINE_CPUARCH} == "i386" SRCS+= opt_apic.h @@ -40,7 +40,7 @@ ${VDSO}.so: linux_locore.o -S -g --binary-architecture i386:x86-64 linux_locore.o ${.TARGET} strip -N _binary_linux_locore_o_size ${.TARGET} -linux_support.o: assym.s linux_assym.h +linux_support.o: assym.inc linux_assym.h ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ ${.IMPSRC} -o ${.TARGET} Modified: head/sys/modules/sgx/Makefile ============================================================================== --- head/sys/modules/sgx/Makefile Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/modules/sgx/Makefile Tue Mar 20 17:58:51 2018 (r331254) @@ -5,9 +5,9 @@ KMOD= sgx SRCS= sgx.c sgxvar.h sgx_support.S SRCS+= opt_compat.h opt_hwpmc_hooks.h opt_kstack_pages.h -DPSRCS= assym.s +DPSRCS= assym.inc -sgx_support.o: assym.s +sgx_support.o: assym.inc ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ ${.IMPSRC} -o ${.TARGET} Modified: head/sys/powerpc/aim/locore32.S ============================================================================== --- head/sys/powerpc/aim/locore32.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/aim/locore32.S Tue Mar 20 17:58:51 2018 (r331254) @@ -25,7 +25,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "assym.s" +#include "assym.inc" #include Modified: head/sys/powerpc/aim/locore64.S ============================================================================== --- head/sys/powerpc/aim/locore64.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/aim/locore64.S Tue Mar 20 17:58:51 2018 (r331254) @@ -27,7 +27,7 @@ * $FreeBSD$ */ -#include "assym.s" +#include "assym.inc" #include Modified: head/sys/powerpc/booke/locore.S ============================================================================== --- head/sys/powerpc/booke/locore.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/booke/locore.S Tue Mar 20 17:58:51 2018 (r331254) @@ -26,7 +26,7 @@ * $FreeBSD$ */ -#include "assym.s" +#include "assym.inc" #include "opt_hwpmc_hooks.h" Modified: head/sys/powerpc/powerpc/cpu_subr64.S ============================================================================== --- head/sys/powerpc/powerpc/cpu_subr64.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/powerpc/cpu_subr64.S Tue Mar 20 17:58:51 2018 (r331254) @@ -27,7 +27,7 @@ * $FreeBSD$ */ -#include "assym.s" +#include "assym.inc" #include Modified: head/sys/powerpc/powerpc/sigcode32.S ============================================================================== --- head/sys/powerpc/powerpc/sigcode32.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/powerpc/sigcode32.S Tue Mar 20 17:58:51 2018 (r331254) @@ -34,7 +34,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * The following code gets copied to the top of the user stack on process Modified: head/sys/powerpc/powerpc/sigcode64.S ============================================================================== --- head/sys/powerpc/powerpc/sigcode64.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/powerpc/sigcode64.S Tue Mar 20 17:58:51 2018 (r331254) @@ -34,7 +34,7 @@ #include #include -#include "assym.s" +#include "assym.inc" /* * The following code gets copied to the top of the user stack on process Modified: head/sys/powerpc/powerpc/swtch32.S ============================================================================== --- head/sys/powerpc/powerpc/swtch32.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/powerpc/swtch32.S Tue Mar 20 17:58:51 2018 (r331254) @@ -56,7 +56,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "assym.s" +#include "assym.inc" #include "opt_sched.h" #include Modified: head/sys/powerpc/powerpc/swtch64.S ============================================================================== --- head/sys/powerpc/powerpc/swtch64.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/powerpc/powerpc/swtch64.S Tue Mar 20 17:58:51 2018 (r331254) @@ -56,7 +56,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "assym.s" +#include "assym.inc" #include "opt_sched.h" #include Modified: head/sys/riscv/riscv/copyinout.S ============================================================================== --- head/sys/riscv/riscv/copyinout.S Tue Mar 20 17:47:29 2018 (r331253) +++ head/sys/riscv/riscv/copyinout.S Tue Mar 20 17:58:51 2018 (r331254) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Mar 20 18:02:22 2018 Return-Path: Delivered-To: svn-src-head@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 03E2EF61AA3; Tue, 20 Mar 2018 18:02:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 A7A467F930; Tue, 20 Mar 2018 18:02:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2A512011F; Tue, 20 Mar 2018 18:02:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KI2LOT064962; Tue, 20 Mar 2018 18:02:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KI2L5o064961; Tue, 20 Mar 2018 18:02:21 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803201802.w2KI2L5o064961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Mar 2018 18:02:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331255 - head X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 331255 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 18:02:22 -0000 Author: emaste Date: Tue Mar 20 18:02:21 2018 New Revision: 331255 URL: https://svnweb.freebsd.org/changeset/base/331255 Log: Remove stale generated assym.s files after r331254 So that -DNO_CLEAN builds work. This should be reverted after a sufficient transition period (perhaps 3 or 6 months). Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Mar 20 17:58:51 2018 (r331254) +++ head/Makefile.inc1 Tue Mar 20 18:02:21 2018 (r331255) @@ -1394,6 +1394,14 @@ INSTALLKERNEL= ${_kernel} .endif .endfor +_cleankernobj_fast_depend_hack: .PHONY +# 20170202 remove stale generated assym.s after renaming to .inc in r331254 +.if exists(${OBJTOP}/sys/${KERNCONF}/assym.s) + @echo Removing stale generated assym files + @rm -f ${OBJTOP}/sys/${KERNCONF}/assym.* \ + ${OBJTOP}/sys/${KERNCONF}/.depend.assym.* +.endif + ${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY # @@ -1429,6 +1437,8 @@ buildkernel: .MAKE .PHONY @echo ">>> stage 2.1: cleaning up the object tree" @echo "--------------------------------------------------------------" ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} +.else + ${_+_}cd ${.CURDIR}; ${WMAKE} _cleankernobj_fast_depend_hack .endif .if !defined(NO_KERNELOBJ) @echo From owner-svn-src-head@freebsd.org Tue Mar 20 19:28:53 2018 Return-Path: Delivered-To: svn-src-head@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 7614BF67A1D; Tue, 20 Mar 2018 19:28:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 16B98833B7; Tue, 20 Mar 2018 19:28:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0464520EF1; Tue, 20 Mar 2018 19:28:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KJSqTM006655; Tue, 20 Mar 2018 19:28:52 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KJSqe3006654; Tue, 20 Mar 2018 19:28:52 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803201928.w2KJSqe3006654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Mar 2018 19:28:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331256 - head/sys/amd64/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/amd64/linux X-SVN-Commit-Revision: 331256 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 19:28:53 -0000 Author: emaste Date: Tue Mar 20 19:28:52 2018 New Revision: 331256 URL: https://svnweb.freebsd.org/changeset/base/331256 Log: Make linuxulator fn declaration match definition I accidentally swapped 'linux_fixup_elf' to 'linux_elf_fixup' in amd64's declaration (only), while bringing this change over from git and encountering a conflict. Modified: head/sys/amd64/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Tue Mar 20 18:02:21 2018 (r331255) +++ head/sys/amd64/linux/linux_sysvec.c Tue Mar 20 19:28:52 2018 (r331256) @@ -119,7 +119,7 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); static register_t * linux_copyout_strings(struct image_params *imgp); -static int linux_elf_fixup(register_t **stack_base, +static int linux_fixup_elf(register_t **stack_base, struct image_params *iparams); static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); static void linux_vdso_install(void *param); From owner-svn-src-head@freebsd.org Tue Mar 20 20:05:12 2018 Return-Path: Delivered-To: svn-src-head@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 85277F69EB2; Tue, 20 Mar 2018 20:05:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 32A0384760; Tue, 20 Mar 2018 20:05:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A13A214F0; Tue, 20 Mar 2018 20:05:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KK5C9P026173; Tue, 20 Mar 2018 20:05:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KK5CFl026172; Tue, 20 Mar 2018 20:05:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803202005.w2KK5CFl026172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Mar 2018 20:05:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331257 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331257 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 20:05:12 -0000 Author: kevans Date: Tue Mar 20 20:05:11 2018 New Revision: 331257 URL: https://svnweb.freebsd.org/changeset/base/331257 Log: lualoader: Reset attributes and color scheme with color.highlight() Previously, we sent a CSI 0m sequence to reset attributes, which also reset the color scheme if the terminal defaults didn't match what we're expecting. Go all-in and reset the color scheme, too, just in case. Reported by: emaste Modified: head/stand/lua/color.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Tue Mar 20 19:28:52 2018 (r331256) +++ head/stand/lua/color.lua Tue Mar 20 20:05:11 2018 (r331257) @@ -96,7 +96,9 @@ function color.highlight(str) if color.disabled then return str end - return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "0m" + -- We need to reset attributes as well as color scheme here, just in + -- case the terminal defaults don't match what we're expecting. + return core.KEYSTR_CSI .. "1m" .. str .. color.default() end return color From owner-svn-src-head@freebsd.org Tue Mar 20 20:10:55 2018 Return-Path: Delivered-To: svn-src-head@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 485B2F6A50F; Tue, 20 Mar 2018 20:10:55 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id B431584C47; Tue, 20 Mar 2018 20:10:54 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 092233C7A04; Wed, 21 Mar 2018 06:53:33 +1100 (AEDT) Date: Wed, 21 Mar 2018 06:53:32 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Maste cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331226 - in head/sys: amd64/linux amd64/linux32 i386/linux In-Reply-To: Message-ID: <20180321064039.L4104@besplex.bde.org> References: <201803192126.w2JLQW0N039356@repo.freebsd.org> <20180320183744.S950@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VJytp5HX c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=1uFwktCMVjhwZNqsXxYA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 20:10:55 -0000 On Tue, 20 Mar 2018, Ed Maste wrote: > On 20 March 2018 at 04:19, Bruce Evans wrote: >> >> It is preferable to have a well-chosen (short...) prefix. The linux >> emulator mostly uses l_ for internal names. That is a bit too short >> for external names. > > l_ is too short. The only reasonable alternative is probably lnx_ but > saving two characters seems does not seem worth it. lx_ is reasonable. /sys currently has 1321 lines matching lx_ and 0 lines matching '[^A-Za-z_]lx_', but 865 lines matching lnx_ (mostly for qlnxe(4)). Bruce From owner-svn-src-head@freebsd.org Tue Mar 20 20:15:55 2018 Return-Path: Delivered-To: svn-src-head@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 BEC9CF6AC8F; Tue, 20 Mar 2018 20:15:55 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from shxd.cx (mail.shxd.cx [64.201.244.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D49B852C4; Tue, 20 Mar 2018 20:15:55 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from [74.217.198.10] (port=62242 helo=[10.1.4.66]) by shxd.cx with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1eyLTY-000Nnx-3L; Tue, 20 Mar 2018 17:55:08 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r331257 - head/stand/lua From: Devin Teske In-Reply-To: <201803202005.w2KK5CFl026172@repo.freebsd.org> Date: Tue, 20 Mar 2018 13:15:46 -0700 Cc: Devin Teske , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201803202005.w2KK5CFl026172@repo.freebsd.org> To: Kyle Evans X-Mailer: Apple Mail (2.3273) Sender: devin@shxd.cx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 20:15:55 -0000 > On Mar 20, 2018, at 1:05 PM, Kyle Evans wrote: >=20 > Author: kevans > Date: Tue Mar 20 20:05:11 2018 > New Revision: 331257 > URL: https://svnweb.freebsd.org/changeset/base/331257 >=20 > Log: > lualoader: Reset attributes and color scheme with color.highlight() >=20 > Previously, we sent a CSI 0m sequence to reset attributes, which also = reset > the color scheme if the terminal defaults didn't match what we're = expecting. > Go all-in and reset the color scheme, too, just in case. >=20 > Reported by: emaste >=20 > Modified: > head/stand/lua/color.lua >=20 > Modified: head/stand/lua/color.lua > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/stand/lua/color.lua Tue Mar 20 19:28:52 2018 = (r331256) > +++ head/stand/lua/color.lua Tue Mar 20 20:05:11 2018 = (r331257) > @@ -96,7 +96,9 @@ function color.highlight(str) > if color.disabled then > return str > end > - return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "0m" > + -- We need to reset attributes as well as color scheme here, = just in > + -- case the terminal defaults don't match what we're expecting. > + return core.KEYSTR_CSI .. "1m" .. str .. color.default() > end >=20 > return color >=20 You should CSI 22m to terminate CSI 1m The corresponding terminators for common effects: CSI 1m ... CSI 22m CSI 2m ... CSI 22m CSI 4m ... CSI 24m CSI 5m ... CSI 25m CSI 7m ... CSI 27m CSI 8m ... CSI 28m CSI (30-37)m ... CSI 39m CSI (40-47)m ... CSI 49m --=20 Devin= From owner-svn-src-head@freebsd.org Tue Mar 20 20:20:51 2018 Return-Path: Delivered-To: svn-src-head@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 EF7DFF6B38A; Tue, 20 Mar 2018 20:20:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 9DE6885846; Tue, 20 Mar 2018 20:20:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98BE221688; Tue, 20 Mar 2018 20:20:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KKKo46033744; Tue, 20 Mar 2018 20:20:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KKKo7Y033740; Tue, 20 Mar 2018 20:20:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803202020.w2KKKo7Y033740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 20 Mar 2018 20:20:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331258 - in head/sys: amd64/amd64 amd64/include x86/include x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include x86/include x86/x86 X-SVN-Commit-Revision: 331258 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 20:20:51 -0000 Author: kib Date: Tue Mar 20 20:20:49 2018 New Revision: 331258 URL: https://svnweb.freebsd.org/changeset/base/331258 Log: Move the CR0.WP manipulation KPI to x86. This should allow to avoid some #ifdefs in the common x86/ code. Requested by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/include/md_var.h head/sys/x86/include/x86_var.h head/sys/x86/x86/cpu_machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Tue Mar 20 20:05:11 2018 (r331257) +++ head/sys/amd64/amd64/machdep.c Tue Mar 20 20:20:49 2018 (r331258) @@ -2597,31 +2597,6 @@ clear_pcb_flags(struct pcb *pcb, const u_int flags) : "cc", "memory"); } -/* - * Enable and restore kernel text write permissions. - * Callers must ensure that disable_wp()/restore_wp() are executed - * without rescheduling on the same core. - */ -bool -disable_wp(void) -{ - u_int cr0; - - cr0 = rcr0(); - if ((cr0 & CR0_WP) == 0) - return (false); - load_cr0(cr0 & ~CR0_WP); - return (true); -} - -void -restore_wp(bool old_wp) -{ - - if (old_wp) - load_cr0(rcr0() | CR0_WP); -} - #ifdef KDB /* Modified: head/sys/amd64/include/md_var.h ============================================================================== --- head/sys/amd64/include/md_var.h Tue Mar 20 20:05:11 2018 (r331257) +++ head/sys/amd64/include/md_var.h Tue Mar 20 20:20:49 2018 (r331258) @@ -53,8 +53,6 @@ void amd64_conf_fast_syscall(void); void amd64_db_resume_dbreg(void); void amd64_lower_shared_page(struct sysentvec *); void amd64_syscall(struct thread *td, int traced); -bool disable_wp(void); -void restore_wp(bool old_wp); void doreti_iret(void) __asm(__STRING(doreti_iret)); void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault)); void ld_ds(void) __asm(__STRING(ld_ds)); Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Tue Mar 20 20:05:11 2018 (r331257) +++ head/sys/x86/include/x86_var.h Tue Mar 20 20:20:49 2018 (r331258) @@ -119,6 +119,8 @@ void busdma_swi(void); bool cpu_mwait_usable(void); void cpu_probe_amdc1e(void); void cpu_setregs(void); +bool disable_wp(void); +void restore_wp(bool old_wp); void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); void finishidentcpu(void); Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Tue Mar 20 20:05:11 2018 (r331257) +++ head/sys/x86/x86/cpu_machdep.c Tue Mar 20 20:20:49 2018 (r331258) @@ -621,3 +621,29 @@ hw_ibrs_disable_handler(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_hw, OID_AUTO, ibrs_disable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, hw_ibrs_disable_handler, "I", "Disable Indirect Branch Restricted Speculation"); + +/* + * Enable and restore kernel text write permissions. + * Callers must ensure that disable_wp()/restore_wp() are executed + * without rescheduling on the same core. + */ +bool +disable_wp(void) +{ + u_int cr0; + + cr0 = rcr0(); + if ((cr0 & CR0_WP) == 0) + return (false); + load_cr0(cr0 & ~CR0_WP); + return (true); +} + +void +restore_wp(bool old_wp) +{ + + if (old_wp) + load_cr0(rcr0() | CR0_WP); +} + From owner-svn-src-head@freebsd.org Tue Mar 20 20:26:25 2018 Return-Path: Delivered-To: svn-src-head@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 86F88F6BA4A; Tue, 20 Mar 2018 20:26:25 +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 3C1A585E6B; Tue, 20 Mar 2018 20:26:25 +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 1C65021808; Tue, 20 Mar 2018 20:26:25 +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 w2KKQOGZ036473; Tue, 20 Mar 2018 20:26:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KKQOP2036471; Tue, 20 Mar 2018 20:26:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803202026.w2KKQOP2036471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Mar 2018 20:26:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331259 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331259 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 20:26:25 -0000 Author: kevans Date: Tue Mar 20 20:26:24 2018 New Revision: 331259 URL: https://svnweb.freebsd.org/changeset/base/331259 Log: lualoader: Use less atomic options for resetting colors/attributes Noted by dteske: CSI 1m ... CSI 22m CSI 2m ... CSI 22m CSI 4m ... CSI 24m CSI 5m ... CSI 25m CSI 7m ... CSI 27m CSI 8m ... CSI 28m CSI (30-37)m ... CSI 39m CSI (40-47)m ... CSI 49m - Provide resetf/resetb to match escapef/escapeb - Use CSI 22m to undo a bold This is a more reasonable approach than what was previously taken. Reported by: dteske Modified: head/stand/lua/color.lua head/stand/lua/menu.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Tue Mar 20 20:20:49 2018 (r331258) +++ head/stand/lua/color.lua Tue Mar 20 20:26:24 2018 (r331259) @@ -65,6 +65,13 @@ function color.escapef(color_value) return core.KEYSTR_CSI .. "3" .. color_value .. "m" end +function color.resetf() + if color.disabled then + return '' + end + return core.KEYSTR_CSI .. "39m" +end + function color.escapeb(color_value) if color.disabled then return color_value @@ -72,6 +79,13 @@ function color.escapeb(color_value) return core.KEYSTR_CSI .. "4" .. color_value .. "m" end +function color.resetb() + if color.disabled then + return '' + end + return core.KEYSTR_CSI .. "49m" +end + function color.escape(fg_color, bg_color, attribute) if color.disabled then return "" @@ -98,7 +112,7 @@ function color.highlight(str) end -- We need to reset attributes as well as color scheme here, just in -- case the terminal defaults don't match what we're expecting. - return core.KEYSTR_CSI .. "1m" .. str .. color.default() + return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "22m" end return color Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Tue Mar 20 20:20:49 2018 (r331258) +++ head/stand/lua/menu.lua Tue Mar 20 20:26:24 2018 (r331259) @@ -120,7 +120,7 @@ menu.boot_environments = { name_color = color.escapef(color.BLUE) end bootenv_name = bootenv_name .. name_color .. - choice .. color.default() + choice .. color.resetf() return color.highlight("A").."ctive: " .. bootenv_name .. " (" .. idx .. " of " .. #all_choices .. ")" @@ -306,7 +306,7 @@ menu.welcome = { name_color = color.escapef(color.BLUE) end kernel_name = kernel_name .. name_color .. - choice .. color.default() + choice .. color.resetf() return color.highlight("K") .. "ernel: " .. kernel_name .. " (" .. idx .. " of " .. #all_choices .. ")" From owner-svn-src-head@freebsd.org Tue Mar 20 20:28:49 2018 Return-Path: Delivered-To: svn-src-head@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 26072F6BD1B; Tue, 20 Mar 2018 20:28:49 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8E134860DC; Tue, 20 Mar 2018 20:28:48 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f50.google.com with SMTP id z143-v6so4603591lff.3; Tue, 20 Mar 2018 13:28:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JYWby4RW8scqS1cJmu6Ofvy1RtBeXHP8kaI6yFcUpMI=; b=r8u6WekeHdaT6PxBSg4NhFjdcotdDJ1E8jvMp6ZjWEkSGldmbW5EOpf57fqfe8cwV8 SDwyqiiCCk2yCJqG6+mf+tdA819HDzFaQM7aUMlb1X+E9UvGv82i7xjQtHxeQSktYR4x C289gXVQEF4Bd4FoXrPCPfDujU4nC8v4KuWlIuZGK/kIdejjXcR0jEhbZUztQTJ4Ab0a i784nQk45iGyH/jegNa3xka/KTdl0OJKR1NfvBb8Z80bOC0LkoTiet0igTWktDaOzGOH 59bBFYzGn166nyHz+iyqmwmbfvPhM2R1IC/sysfCabhkvayuBpj2EZ9hn/UcS2iSlucR /MtQ== X-Gm-Message-State: AElRT7GY8/ta513brIFq5ByZJtCIVC/YWMggGUJpcyKZuvu0Q3GrRhiV IIFP2HQauhQjHUDW1eO0UZukIapw X-Google-Smtp-Source: AG47ELuebvO/Ss+4x/NL5/3wcg92fuG74+IpjdWrLlN6Dwa0WG7YqNTJSoJgjaChrk1LG6EzYI42ow== X-Received: by 10.46.137.203 with SMTP id c11mr12210769ljk.61.1521577721134; Tue, 20 Mar 2018 13:28:41 -0700 (PDT) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com. [209.85.215.50]) by smtp.gmail.com with ESMTPSA id b67-v6sm632146lfh.26.2018.03.20.13.28.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Mar 2018 13:28:41 -0700 (PDT) Received: by mail-lf0-f50.google.com with SMTP id e5-v6so4586426lfb.7; Tue, 20 Mar 2018 13:28:41 -0700 (PDT) X-Received: by 2002:a19:c4c8:: with SMTP id u191-v6mr12599716lff.109.1521577720852; Tue, 20 Mar 2018 13:28:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Tue, 20 Mar 2018 13:28:19 -0700 (PDT) In-Reply-To: References: <201803202005.w2KK5CFl026172@repo.freebsd.org> From: Kyle Evans Date: Tue, 20 Mar 2018 15:28:19 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331257 - head/stand/lua To: Devin Teske Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 20:28:49 -0000 On Tue, Mar 20, 2018 at 3:15 PM, Devin Teske wrote: > >> On Mar 20, 2018, at 1:05 PM, Kyle Evans wrote: >> >> Author: kevans >> Date: Tue Mar 20 20:05:11 2018 >> New Revision: 331257 >> URL: https://svnweb.freebsd.org/changeset/base/331257 >> >> Log: >> lualoader: Reset attributes and color scheme with color.highlight() >> >> Previously, we sent a CSI 0m sequence to reset attributes, which also reset >> the color scheme if the terminal defaults didn't match what we're expecting. >> Go all-in and reset the color scheme, too, just in case. >> >> Reported by: emaste >> >> Modified: >> head/stand/lua/color.lua >> >> Modified: head/stand/lua/color.lua >> ============================================================================== >> --- head/stand/lua/color.lua Tue Mar 20 19:28:52 2018 (r331256) >> +++ head/stand/lua/color.lua Tue Mar 20 20:05:11 2018 (r331257) >> @@ -96,7 +96,9 @@ function color.highlight(str) >> if color.disabled then >> return str >> end >> - return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "0m" >> + -- We need to reset attributes as well as color scheme here, just in >> + -- case the terminal defaults don't match what we're expecting. >> + return core.KEYSTR_CSI .. "1m" .. str .. color.default() >> end >> >> return color >> > > You should CSI 22m to terminate CSI 1m > > The corresponding terminators for common effects: > > CSI 1m ... CSI 22m > CSI 2m ... CSI 22m > CSI 4m ... CSI 24m > CSI 5m ... CSI 25m > CSI 7m ... CSI 27m > CSI 8m ... CSI 28m > CSI (30-37)m ... CSI 39m > CSI (40-47)m ... CSI 49m Thanks! Fixed, with this map written in blood, in r331259. =) We had a couple of other instances where we went for the 'reset everything' approach rather than the more polite terminators. From owner-svn-src-head@freebsd.org Tue Mar 20 20:45:48 2018 Return-Path: Delivered-To: svn-src-head@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 749BFF424B3; Tue, 20 Mar 2018 20:45:48 +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 27A3086C4B; Tue, 20 Mar 2018 20:45: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 22AB821B08; Tue, 20 Mar 2018 20:45: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 w2KKjmrX046140; Tue, 20 Mar 2018 20:45:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KKjm0l046139; Tue, 20 Mar 2018 20:45:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803202045.w2KKjm0l046139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 20 Mar 2018 20:45:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331260 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 331260 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 20:45:48 -0000 Author: markj Date: Tue Mar 20 20:45:47 2018 New Revision: 331260 URL: https://svnweb.freebsd.org/changeset/base/331260 Log: Remove a lingering inaccuracy from mlock.2. User wirings of the same address range don't stack. Noted by: Dan Nelson MFC after: 3 days Modified: head/lib/libc/sys/mlock.2 Modified: head/lib/libc/sys/mlock.2 ============================================================================== --- head/lib/libc/sys/mlock.2 Tue Mar 20 20:26:24 2018 (r331259) +++ head/lib/libc/sys/mlock.2 Tue Mar 20 20:45:47 2018 (r331260) @@ -28,7 +28,7 @@ .\" @(#)mlock.2 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd Jan 22, 2018 +.Dd March 20, 2018 .Dt MLOCK 2 .Os .Sh NAME @@ -78,9 +78,7 @@ are removed. Multiple processes may have the same physical pages locked via their own virtual address mappings. A single process may likewise have pages multiply-locked via different virtual -mappings of the same pages or via nested -.Fn mlock -calls on the same address range. +mappings of the same physical pages. Unlocking is performed explicitly by .Fn munlock or implicitly by a call to From owner-svn-src-head@freebsd.org Tue Mar 20 21:00:46 2018 Return-Path: Delivered-To: svn-src-head@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 569EFF4683F; Tue, 20 Mar 2018 21:00:46 +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 02A818758B; Tue, 20 Mar 2018 21:00:46 +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 F1CD521C9B; Tue, 20 Mar 2018 21:00:45 +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 w2KL0jFm052415; Tue, 20 Mar 2018 21:00:45 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KL0jot052414; Tue, 20 Mar 2018 21:00:45 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803202100.w2KL0jot052414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 20 Mar 2018 21:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331261 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 331261 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:00:46 -0000 Author: jhb Date: Tue Mar 20 21:00:45 2018 New Revision: 331261 URL: https://svnweb.freebsd.org/changeset/base/331261 Log: Use instead of in userland. is a kernel-only header. The standard header for userland is . Using the standard header in userland avoids weird build errors when building with external compilers that include their own stdarg.h header. Reviewed by: arichardson, brooks, imp Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D14776 Modified: head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Tue Mar 20 20:45:47 2018 (r331260) +++ head/sys/cam/scsi/scsi_all.h Tue Mar 20 21:00:45 2018 (r331261) @@ -25,7 +25,11 @@ #define _SCSI_SCSI_ALL_H 1 #include +#ifdef _KERNEL #include +#else +#include +#endif #ifdef _KERNEL /* From owner-svn-src-head@freebsd.org Tue Mar 20 21:04:48 2018 Return-Path: Delivered-To: svn-src-head@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 8E51AF4A001; Tue, 20 Mar 2018 21:04:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 41F6687C38; Tue, 20 Mar 2018 21:04:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3868921E1F; Tue, 20 Mar 2018 21:04:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KL4mAe056209; Tue, 20 Mar 2018 21:04:48 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KL4mkm056208; Tue, 20 Mar 2018 21:04:48 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803202104.w2KL4mkm056208@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Mar 2018 21:04:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331263 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 331263 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:04:48 -0000 Author: emaste Date: Tue Mar 20 21:04:47 2018 New Revision: 331263 URL: https://svnweb.freebsd.org/changeset/base/331263 Log: Restore close quote lost in r331254 Modified: head/sys/i386/i386/exception.s Modified: head/sys/i386/i386/exception.s ============================================================================== --- head/sys/i386/i386/exception.s Tue Mar 20 21:02:42 2018 (r331262) +++ head/sys/i386/i386/exception.s Tue Mar 20 21:04:47 2018 (r331263) @@ -42,7 +42,7 @@ #include #include -#include "assym.inc +#include "assym.inc" #define SEL_RPL_MASK 0x0003 #define GSEL_KPL 0x0020 /* GSEL(GCODE_SEL, SEL_KPL) */ From owner-svn-src-head@freebsd.org Tue Mar 20 21:16:27 2018 Return-Path: Delivered-To: svn-src-head@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 0D3A6F4AEBB; Tue, 20 Mar 2018 21:16:27 +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 B00CA684E4; Tue, 20 Mar 2018 21:16:26 +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 A63B421F9A; Tue, 20 Mar 2018 21:16:26 +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 w2KLGQqC061168; Tue, 20 Mar 2018 21:16:26 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KLGQsF061167; Tue, 20 Mar 2018 21:16:26 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803202116.w2KLGQsF061167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 20 Mar 2018 21:16:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331264 - head/sys/cddl/dev/fbt/x86 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/cddl/dev/fbt/x86 X-SVN-Commit-Revision: 331264 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:16:27 -0000 Author: markj Date: Tue Mar 20 21:16:26 2018 New Revision: 331264 URL: https://svnweb.freebsd.org/changeset/base/331264 Log: Make use of the KPI added in r331252. MFC after: 2 weeks Modified: head/sys/cddl/dev/fbt/x86/fbt_isa.c Modified: head/sys/cddl/dev/fbt/x86/fbt_isa.c ============================================================================== --- head/sys/cddl/dev/fbt/x86/fbt_isa.c Tue Mar 20 21:04:47 2018 (r331263) +++ head/sys/cddl/dev/fbt/x86/fbt_isa.c Tue Mar 20 21:16:26 2018 (r331264) @@ -35,6 +35,7 @@ #include #include +#include #include "fbt.h" @@ -145,15 +146,11 @@ fbt_invop(uintptr_t addr, struct trapframe *frame, uin void fbt_patch_tracepoint(fbt_probe_t *fbt, fbt_patchval_t val) { - u_long cr0save; - register_t intr; + bool old_wp; - intr = intr_disable(); - cr0save = rcr0(); - load_cr0(cr0save & ~CR0_WP); + old_wp = disable_wp(); *fbt->fbtp_patchpoint = val; - load_cr0(cr0save); - intr_restore(intr); + restore_wp(old_wp); } int From owner-svn-src-head@freebsd.org Tue Mar 20 21:17:48 2018 Return-Path: Delivered-To: svn-src-head@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 ABBB4F4B0DE; Tue, 20 Mar 2018 21:17:48 +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 5DF866869D; Tue, 20 Mar 2018 21:17:48 +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 58E6121F9B; Tue, 20 Mar 2018 21:17:48 +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 w2KLHmb6061265; Tue, 20 Mar 2018 21:17:48 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KLHmSQ061264; Tue, 20 Mar 2018 21:17:48 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803202117.w2KLHmSQ061264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 21:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331265 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 331265 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:17:48 -0000 Author: imp Date: Tue Mar 20 21:17:48 2018 New Revision: 331265 URL: https://svnweb.freebsd.org/changeset/base/331265 Log: Remove obsolete lint support. Modified: head/sys/sys/_stdarg.h Modified: head/sys/sys/_stdarg.h ============================================================================== --- head/sys/sys/_stdarg.h Tue Mar 20 21:16:26 2018 (r331264) +++ head/sys/sys/_stdarg.h Tue Mar 20 21:17:48 2018 (r331265) @@ -52,18 +52,5 @@ #define va_end(ap) __builtin_va_end(ap) #endif -#if defined(lint) && !defined(va_start) - /* - * Provide a fake implementation for lint's benefit - * This very much assumes that __va_list ends up being a pointer - */ - #define va_start(ap, last) ((void)((ap) = (char *) (&(last)+1))) - #if __ISO_C_VISIBLE >= 1999 - #define va_copy(dst, src) ((dst) = (src)) - #endif - #define va_arg(ap, type) (*((type*)(((ap) += sizeof(type)) - sizeof(type)))) - #define va_end(ap) ((void)0) -#endif - #endif /* ! _SYS__STDARG_H_ */ From owner-svn-src-head@freebsd.org Tue Mar 20 21:18:41 2018 Return-Path: Delivered-To: svn-src-head@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 626B3F4B277; Tue, 20 Mar 2018 21:18:41 +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 13C476882A; Tue, 20 Mar 2018 21:18:41 +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 0EAE221F9C; Tue, 20 Mar 2018 21:18:41 +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 w2KLIeAX061340; Tue, 20 Mar 2018 21:18:40 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KLIe93061339; Tue, 20 Mar 2018 21:18:40 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803202118.w2KLIe93061339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 21:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331266 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 331266 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:18:41 -0000 Author: imp Date: Tue Mar 20 21:18:40 2018 New Revision: 331266 URL: https://svnweb.freebsd.org/changeset/base/331266 Log: Drop support for lint for cdefs.h. Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Tue Mar 20 21:17:48 2018 (r331265) +++ head/sys/sys/cdefs.h Tue Mar 20 21:18:40 2018 (r331266) @@ -591,7 +591,7 @@ * __FBSDID("$FreeBSD$"); */ #ifndef __FBSDID -#if !defined(lint) && !defined(STRIP_FBSDID) +#if !defined(STRIP_FBSDID) #define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) #else #define __FBSDID(s) struct __hack From owner-svn-src-head@freebsd.org Tue Mar 20 21:31:19 2018 Return-Path: Delivered-To: svn-src-head@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 236F1F4C15C; Tue, 20 Mar 2018 21:31:19 +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 C5E2869013; Tue, 20 Mar 2018 21:31:18 +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 C0D862223F; Tue, 20 Mar 2018 21:31:18 +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 w2KLVIQW071169; Tue, 20 Mar 2018 21:31:18 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KLVIag071168; Tue, 20 Mar 2018 21:31:18 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803202131.w2KLVIag071168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 21:31:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331267 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 331267 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:31:19 -0000 Author: imp Date: Tue Mar 20 21:31:18 2018 New Revision: 331267 URL: https://svnweb.freebsd.org/changeset/base/331267 Log: Update to include information about using SPDX-License-Identifier lines. Modified: head/share/man/man9/style.9 Modified: head/share/man/man9/style.9 ============================================================================== --- head/share/man/man9/style.9 Tue Mar 20 21:18:40 2018 (r331266) +++ head/share/man/man9/style.9 Tue Mar 20 21:31:18 2018 (r331267) @@ -65,6 +65,8 @@ The copyright header should be a multi-line comment, w line of the comment having a dash after the star like so: .Bd -literal /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 1984-2025 John Q. Public * All rights reserved. * @@ -82,6 +84,7 @@ license or copyright notice, change the dash to a star comments. Comments starting in columns other than the first are never considered license statements. +Use the appropriate SPDX-License-Identifier line before the copyright. .Pp After any copyright header, there is a blank line, and the .Li $\&FreeBSD$ From owner-svn-src-head@freebsd.org Tue Mar 20 21:36:36 2018 Return-Path: Delivered-To: svn-src-head@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 2A68FF4C9EF; Tue, 20 Mar 2018 21:36:36 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 D1B386950D; Tue, 20 Mar 2018 21:36:35 +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 CCBFF2228F; Tue, 20 Mar 2018 21:36:35 +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 w2KLaZCi071415; Tue, 20 Mar 2018 21:36:35 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KLaZNW071413; Tue, 20 Mar 2018 21:36:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803202136.w2KLaZNW071413@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 20 Mar 2018 21:36:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331268 - head/sys/cddl/dev/fbt/x86 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/cddl/dev/fbt/x86 X-SVN-Commit-Revision: 331268 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:36:36 -0000 Author: markj Date: Tue Mar 20 21:36:35 2018 New Revision: 331268 URL: https://svnweb.freebsd.org/changeset/base/331268 Log: Revert part of r331264: disable interrupts before disabling WP. We might otherwise be preempted, leaving WP disabled while another thread runs on the CPU. Reported by: kib X-MFC with: r331264 Modified: head/sys/cddl/dev/fbt/x86/fbt_isa.c Modified: head/sys/cddl/dev/fbt/x86/fbt_isa.c ============================================================================== --- head/sys/cddl/dev/fbt/x86/fbt_isa.c Tue Mar 20 21:31:18 2018 (r331267) +++ head/sys/cddl/dev/fbt/x86/fbt_isa.c Tue Mar 20 21:36:35 2018 (r331268) @@ -146,11 +146,14 @@ fbt_invop(uintptr_t addr, struct trapframe *frame, uin void fbt_patch_tracepoint(fbt_probe_t *fbt, fbt_patchval_t val) { + register_t intr; bool old_wp; + intr = intr_disable(); old_wp = disable_wp(); *fbt->fbtp_patchpoint = val; restore_wp(old_wp); + intr_restore(intr); } int From owner-svn-src-head@freebsd.org Tue Mar 20 21:37:33 2018 Return-Path: Delivered-To: svn-src-head@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 CAF76F4CBA4; Tue, 20 Mar 2018 21:37:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 7E3D76969C; Tue, 20 Mar 2018 21:37:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7929322290; Tue, 20 Mar 2018 21:37:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KLbXuT071490; Tue, 20 Mar 2018 21:37:33 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KLbXrp071489; Tue, 20 Mar 2018 21:37:33 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803202137.w2KLbXrp071489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 21:37:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331269 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 331269 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 21:37:34 -0000 Author: imp Date: Tue Mar 20 21:37:33 2018 New Revision: 331269 URL: https://svnweb.freebsd.org/changeset/base/331269 Log: Remove reference to lint. We no longer support it, so exceptions for it are no longer relevant. Modified: head/share/man/man9/style.9 Modified: head/share/man/man9/style.9 ============================================================================== --- head/share/man/man9/style.9 Tue Mar 20 21:36:35 2018 (r331268) +++ head/share/man/man9/style.9 Tue Mar 20 21:37:33 2018 (r331269) @@ -107,11 +107,7 @@ Only add .Dq Li "From: " in front of foreign VCS IDs if the file is renamed. .Bd -literal -#if 0 -#ifndef lint -static char sccsid[] = "@(#)style 1.14 (Berkeley) 4/28/95"; -#endif /* not lint */ -#endif +/* From: @(#)style 1.14 (Berkeley) 4/28/95 */ #include __FBSDID("$FreeBSD$"); @@ -234,10 +230,6 @@ This comment should be used only for (subjectively) lo greater than 20 lines, or where a series of nested .Ic #ifdef 's may be confusing to the reader. -Exceptions may be made for cases where code is conditionally not compiled for -the purposes of -.Xr lint 1 , -even though the uncompiled region may be small. The comment should be separated from the .Ic #endif or From owner-svn-src-head@freebsd.org Tue Mar 20 22:00:59 2018 Return-Path: Delivered-To: svn-src-head@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 EE327F4E66F; Tue, 20 Mar 2018 22:00:58 +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 5EE086A348; Tue, 20 Mar 2018 22:00:58 +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 59D07225B4; Tue, 20 Mar 2018 22:00:58 +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 w2KM0wq9083586; Tue, 20 Mar 2018 22:00:58 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KM0wUR083585; Tue, 20 Mar 2018 22:00:58 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201803202200.w2KM0wUR083585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 20 Mar 2018 22:00:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331270 - head/usr.sbin/syslogd X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/usr.sbin/syslogd X-SVN-Commit-Revision: 331270 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 22:00:59 -0000 Author: glebius Date: Tue Mar 20 22:00:58 2018 New Revision: 331270 URL: https://svnweb.freebsd.org/changeset/base/331270 Log: Fix whitespace issues in r330034. No functional changes. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Tue Mar 20 21:37:33 2018 (r331269) +++ head/usr.sbin/syslogd/syslogd.c Tue Mar 20 22:00:58 2018 (r331270) @@ -383,13 +383,13 @@ close_filed(struct filed *f) switch (f->f_type) { case F_FORW: - if (f->f_un.f_forw.f_addr) { - freeaddrinfo(f->f_un.f_forw.f_addr); - f->f_un.f_forw.f_addr = NULL; - } - /*FALLTHROUGH*/ + if (f->f_un.f_forw.f_addr) { + freeaddrinfo(f->f_un.f_forw.f_addr); + f->f_un.f_forw.f_addr = NULL; + } + /* FALLTHROUGH */ - case F_FILE: + case F_FILE: case F_TTY: case F_CONSOLE: f->f_type = F_UNUSED; @@ -1865,7 +1865,7 @@ readconfigfile(FILE *cf, int allow_includes) f = cfline(cline, prog, host); if (f != NULL) addfile(f); - free(f); + free(f); } } @@ -1963,11 +1963,11 @@ init(int signo) f = cfline("*.ERR\t/dev/console", "*", "*"); if (f != NULL) addfile(f); - free(f); + free(f); f = cfline("*.PANIC\t*", "*", "*"); if (f != NULL) addfile(f); - free(f); + free(f); Initialized = 1; return; From owner-svn-src-head@freebsd.org Tue Mar 20 22:01:19 2018 Return-Path: Delivered-To: svn-src-head@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 652F9F4E6D2; Tue, 20 Mar 2018 22:01:19 +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 142286A49F; Tue, 20 Mar 2018 22:01:19 +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 0F2FB226C1; Tue, 20 Mar 2018 22:01:19 +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 w2KM1Io9085332; Tue, 20 Mar 2018 22:01:18 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KM1Isd085328; Tue, 20 Mar 2018 22:01:18 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803202201.w2KM1Isd085328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 22:01:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331271 - in head/sys/dev: cardbus pccard pccbb X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/dev: cardbus pccard pccbb X-SVN-Commit-Revision: 331271 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 22:01:19 -0000 Author: imp Date: Tue Mar 20 22:01:18 2018 New Revision: 331271 URL: https://svnweb.freebsd.org/changeset/base/331271 Log: Push down Giant one layer. In the days of yore, back when Penitums were the new kids on the block and F00F hacks were all the rage, one needed to take out Giant to do anything moderately complicated with the VM, mappings and such. So the pccard / cardbus code held Giant for the entire insertion or removal process. Today, the VM is MP safe. The lock is only needed for dealing with newbus things. Move locking and unlocking Giant to be only around adding and probing devices in pccard and cardbus. Modified: head/sys/dev/cardbus/cardbus.c head/sys/dev/pccard/pccard.c head/sys/dev/pccbb/pccbb.c Modified: head/sys/dev/cardbus/cardbus.c ============================================================================== --- head/sys/dev/cardbus/cardbus.c Tue Mar 20 22:00:58 2018 (r331270) +++ head/sys/dev/cardbus/cardbus.c Tue Mar 20 22:01:18 2018 (r331271) @@ -197,6 +197,7 @@ cardbus_attach_card(device_t cbdev) domain = pcib_get_domain(cbdev); bus = pcib_get_bus(cbdev); slot = 0; + mtx_lock(&Giant); /* For each function, set it up and try to attach a driver to it */ for (func = 0; func <= cardbusfunchigh; func++) { struct cardbus_devinfo *dinfo; @@ -230,6 +231,7 @@ cardbus_attach_card(device_t cbdev) else pci_cfg_save(dinfo->pci.cfg.dev, &dinfo->pci, 1); } + mtx_unlock(&Giant); if (cardattached > 0) return (0); /* POWER_DISABLE_SOCKET(brdev, cbdev); */ Modified: head/sys/dev/pccard/pccard.c ============================================================================== --- head/sys/dev/pccard/pccard.c Tue Mar 20 22:00:58 2018 (r331270) +++ head/sys/dev/pccard/pccard.c Tue Mar 20 22:01:18 2018 (r331271) @@ -236,6 +236,7 @@ pccard_attach_card(device_t dev) DEVPRINTF((dev, "Card has %d functions. pccard_mfc is %d\n", i + 1, pccard_mfc(sc))); + mtx_lock(&Giant); STAILQ_FOREACH(pf, &sc->card.pf_head, pf_list) { if (STAILQ_EMPTY(&pf->cfe_head)) continue; @@ -248,6 +249,7 @@ pccard_attach_card(device_t dev) pf->dev = child; pccard_probe_and_attach_child(dev, child, pf); } + mtx_unlock(&Giant); return (0); } Modified: head/sys/dev/pccbb/pccbb.c ============================================================================== --- head/sys/dev/pccbb/pccbb.c Tue Mar 20 22:00:58 2018 (r331270) +++ head/sys/dev/pccbb/pccbb.c Tue Mar 20 22:01:18 2018 (r331271) @@ -470,14 +470,6 @@ cbb_event_thread(void *arg) sc->flags |= CBB_KTHREAD_RUNNING; while ((sc->flags & CBB_KTHREAD_DONE) == 0) { mtx_unlock(&sc->mtx); - /* - * We take out Giant here because we need it deep, - * down in the bowels of the vm system for mapping the - * memory we need to read the CIS. In addition, since - * we are adding/deleting devices from the dev tree, - * and that code isn't MP safe, we have to hold Giant. - */ - mtx_lock(&Giant); status = cbb_get(sc, CBB_SOCKET_STATE); DPRINTF(("Status is 0x%x\n", status)); if (!CBB_CARD_PRESENT(status)) { @@ -503,7 +495,6 @@ cbb_event_thread(void *arg) not_a_card = 0; /* We know card type */ cbb_insert(sc); } - mtx_unlock(&Giant); /* * First time through we need to tell mountroot that we're From owner-svn-src-head@freebsd.org Tue Mar 20 22:05:21 2018 Return-Path: Delivered-To: svn-src-head@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 AF70EF4ED06; Tue, 20 Mar 2018 22:05:21 +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 606CE6AA59; Tue, 20 Mar 2018 22:05:21 +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 5B2092270F; Tue, 20 Mar 2018 22:05:21 +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 w2KM5LDi086519; Tue, 20 Mar 2018 22:05:21 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KM5LoE086518; Tue, 20 Mar 2018 22:05:21 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201803202205.w2KM5LoE086518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 20 Mar 2018 22:05:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331272 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331272 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 22:05:21 -0000 Author: glebius Date: Tue Mar 20 22:05:21 2018 New Revision: 331272 URL: https://svnweb.freebsd.org/changeset/base/331272 Log: At this point iwmesg isn't initialized yet, so print pointer to lock rather than panic before panicing. Modified: head/sys/kern/kern_lock.c Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Tue Mar 20 22:01:18 2018 (r331271) +++ head/sys/kern/kern_lock.c Tue Mar 20 22:05:21 2018 (r331272) @@ -722,8 +722,8 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struc class = LOCK_CLASS(ilk); class->lc_unlock(ilk); } - panic("%s: recursing on non recursive lockmgr %s @ %s:%d\n", - __func__, iwmesg, file, line); + panic("%s: recursing on non recursive lockmgr %p " + "@ %s:%d\n", __func__, lk, file, line); } lk->lk_recurse++; LOCK_LOG2(lk, "%s: %p recursing", __func__, lk); From owner-svn-src-head@freebsd.org Tue Mar 20 22:07:46 2018 Return-Path: Delivered-To: svn-src-head@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 11615F4EF96; Tue, 20 Mar 2018 22:07:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 B3DC96AC41; Tue, 20 Mar 2018 22:07:45 +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 AA81B22710; Tue, 20 Mar 2018 22:07:45 +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 w2KM7jxY086655; Tue, 20 Mar 2018 22:07:45 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KM7jwt086654; Tue, 20 Mar 2018 22:07:45 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803202207.w2KM7jwt086654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Mar 2018 22:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331273 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 331273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 22:07:46 -0000 Author: imp Date: Tue Mar 20 22:07:45 2018 New Revision: 331273 URL: https://svnweb.freebsd.org/changeset/base/331273 Log: Release the "TUR" reference when clearing the TUR work flag. We mostly do this right, except when there's no BP and we do a TUR by request. In that case, we clear the flag, but don't release the reference, leaking the reference on rare occasion. PR: 226510 Sponsored by: Netflix Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Tue Mar 20 22:05:21 2018 (r331272) +++ head/sys/cam/scsi/scsi_da.c Tue Mar 20 22:07:45 2018 (r331273) @@ -3114,6 +3114,7 @@ more: if (bp == NULL) { if (cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { cam_iosched_clr_work_flags(softc->cam_iosched, DA_WORK_TUR); + da_periph_release_locked(periph, DA_REF_TUR); scsi_test_unit_ready(&start_ccb->csio, /*retries*/ da_retry_count, dadone, @@ -3137,11 +3138,6 @@ more: biofinish(bp, NULL, 0); goto more; } - } - - if (cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { - cam_iosched_clr_work_flags(softc->cam_iosched, DA_WORK_TUR); - da_periph_release_locked(periph, DA_REF_TUR); } if ((bp->bio_flags & BIO_ORDERED) != 0 || From owner-svn-src-head@freebsd.org Tue Mar 20 22:41:27 2018 Return-Path: Delivered-To: svn-src-head@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 485FFF51E20; Tue, 20 Mar 2018 22:41:27 +0000 (UTC) (envelope-from sevan@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 EEA0B6D779; Tue, 20 Mar 2018 22:41:26 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E99B322CE9; Tue, 20 Mar 2018 22:41:26 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KMfQEZ008636; Tue, 20 Mar 2018 22:41:26 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KMfQ4X008634; Tue, 20 Mar 2018 22:41:26 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201803202241.w2KMfQ4X008634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Tue, 20 Mar 2018 22:41:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331274 - in head/share/man: man4 man9 X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: in head/share/man: man4 man9 X-SVN-Commit-Revision: 331274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 22:41:27 -0000 Author: sevan (doc committer) Date: Tue Mar 20 22:41:26 2018 New Revision: 331274 URL: https://svnweb.freebsd.org/changeset/base/331274 Log: Extend the description of ALTQ to call it a system which is a framework in altq(4) to match altq(9). This makes preserving the history section as the author of ALTQ easier in the history section, rather than calling it a framework in the description & a system in the history. Add a history section to altq(4) and extend the history section in altq(9) Approved by: bcr (mentor) MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D14774 Modified: head/share/man/man4/altq.4 head/share/man/man9/altq.9 Modified: head/share/man/man4/altq.4 ============================================================================== --- head/share/man/man4/altq.4 Tue Mar 20 22:07:45 2018 (r331273) +++ head/share/man/man4/altq.4 Tue Mar 20 22:41:26 2018 (r331274) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 28, 2017 +.Dd March 20, 2018 .Dt ALTQ 4 .Os .Sh NAME @@ -45,7 +45,8 @@ .Sh DESCRIPTION The .Nm -framework provides several disciplines for queuing outgoing network packets. +system is a framework which provides several disciplines for queuing outgoing +network packets. This is done by modifications to the interface packet queues. See .Xr altq 9 @@ -59,7 +60,7 @@ utility, so please refer to the .Xr pfctl 8 and the .Xr pf.conf 5 -manpages for a complete description of the +man pages for a complete description of the .Nm capabilities and how to use it. .Ss Kernel Options @@ -195,3 +196,11 @@ pseudo drivers also do support .Xr ipfw 8 , .Xr pfctl 8 , .Xr altq 9 +.Sh HISTORY +The +.Nm +system first appeared in March 1997 and found home in the KAME project +(http://www.kame.net). +It was imported to +.Fx +in 5.3 . Modified: head/share/man/man9/altq.9 ============================================================================== --- head/share/man/man9/altq.9 Tue Mar 20 22:07:45 2018 (r331273) +++ head/share/man/man9/altq.9 Tue Mar 20 22:41:26 2018 (r331274) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 25, 2004 +.Dd March 20, 2018 .Dt ALTQ 9 .Os .\" @@ -595,4 +595,8 @@ is called immediately after .Sh HISTORY The .Nm -system first appeared in March 1997. +system first appeared in March 1997 and found home in the KAME project +(http://www.kame.net). +It was imported to +.Fx +in 5.3 . From owner-svn-src-head@freebsd.org Tue Mar 20 22:57:07 2018 Return-Path: Delivered-To: svn-src-head@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 2303CF532D2; Tue, 20 Mar 2018 22:57:07 +0000 (UTC) (envelope-from melifaro@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 B12156E64B; Tue, 20 Mar 2018 22:57:06 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 A7D4522ED2; Tue, 20 Mar 2018 22:57:06 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KMv6k0014770; Tue, 20 Mar 2018 22:57:06 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KMv6Md014768; Tue, 20 Mar 2018 22:57:06 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201803202257.w2KMv6Md014768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 20 Mar 2018 22:57:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331275 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 331275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 22:57:07 -0000 Author: melifaro Date: Tue Mar 20 22:57:06 2018 New Revision: 331275 URL: https://svnweb.freebsd.org/changeset/base/331275 Log: Use count(9) api for the bpf(4) statistics. Currently each bfp descriptor uses u64 variables to maintain its counters. On interfaces with high packet rate this leads to unnecessary contention and inaccurate reporting. PR: kern/205320 Reported by: elofu17 at hotmail.com MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D14726 Modified: head/sys/net/bpf.c head/sys/net/bpfdesc.h Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Tue Mar 20 22:41:26 2018 (r331274) +++ head/sys/net/bpf.c Tue Mar 20 22:57:06 2018 (r331275) @@ -280,7 +280,7 @@ bpf_append_bytes(struct bpf_d *d, caddr_t buf, u_int o return (bpf_buffer_append_bytes(d, buf, offset, src, len)); case BPF_BUFMODE_ZBUF: - d->bd_zcopy++; + counter_u64_add(d->bd_zcopy, 1); return (bpf_zerocopy_append_bytes(d, buf, offset, src, len)); default: @@ -300,7 +300,7 @@ bpf_append_mbuf(struct bpf_d *d, caddr_t buf, u_int of return (bpf_buffer_append_mbuf(d, buf, offset, src, len)); case BPF_BUFMODE_ZBUF: - d->bd_zcopy++; + counter_u64_add(d->bd_zcopy, 1); return (bpf_zerocopy_append_mbuf(d, buf, offset, src, len)); default: @@ -886,6 +886,15 @@ bpfopen(struct cdev *dev, int flags, int fmt, struct t return (error); } + /* Setup counters */ + d->bd_rcount = counter_u64_alloc(M_WAITOK); + d->bd_dcount = counter_u64_alloc(M_WAITOK); + d->bd_fcount = counter_u64_alloc(M_WAITOK); + d->bd_wcount = counter_u64_alloc(M_WAITOK); + d->bd_wfcount = counter_u64_alloc(M_WAITOK); + d->bd_wdcount = counter_u64_alloc(M_WAITOK); + d->bd_zcopy = counter_u64_alloc(M_WAITOK); + /* * For historical reasons, perform a one-time initialization call to * the buffer routines, even though we're not yet committed to a @@ -1111,22 +1120,22 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag return (error); BPF_PID_REFRESH_CUR(d); - d->bd_wcount++; + counter_u64_add(d->bd_wcount, 1); /* XXX: locking required */ if (d->bd_bif == NULL) { - d->bd_wdcount++; + counter_u64_add(d->bd_wdcount, 1); return (ENXIO); } ifp = d->bd_bif->bif_ifp; if ((ifp->if_flags & IFF_UP) == 0) { - d->bd_wdcount++; + counter_u64_add(d->bd_wdcount, 1); return (ENETDOWN); } if (uio->uio_resid == 0) { - d->bd_wdcount++; + counter_u64_add(d->bd_wdcount, 1); return (0); } @@ -1137,10 +1146,10 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag error = bpf_movein(uio, (int)d->bd_bif->bif_dlt, ifp, &m, &dst, &hlen, d); if (error) { - d->bd_wdcount++; + counter_u64_add(d->bd_wdcount, 1); return (error); } - d->bd_wfcount++; + counter_u64_add(d->bd_wfcount, 1); if (d->bd_hdrcmplt) dst.sa_family = pseudo_AF_HDRCMPLT; @@ -1176,7 +1185,7 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag error = (*ifp->if_output)(ifp, m, &dst, &ro); if (error) - d->bd_wdcount++; + counter_u64_add(d->bd_wdcount, 1); if (mc != NULL) { if (error == 0) @@ -1215,13 +1224,13 @@ reset_d(struct bpf_d *d) } if (bpf_canwritebuf(d)) d->bd_slen = 0; - d->bd_rcount = 0; - d->bd_dcount = 0; - d->bd_fcount = 0; - d->bd_wcount = 0; - d->bd_wfcount = 0; - d->bd_wdcount = 0; - d->bd_zcopy = 0; + counter_u64_zero(d->bd_rcount); + counter_u64_zero(d->bd_dcount); + counter_u64_zero(d->bd_fcount); + counter_u64_zero(d->bd_wcount); + counter_u64_zero(d->bd_wfcount); + counter_u64_zero(d->bd_wdcount); + counter_u64_zero(d->bd_zcopy); } /* @@ -1592,8 +1601,8 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, i struct bpf_stat *bs = (struct bpf_stat *)addr; /* XXXCSJP overflow */ - bs->bs_recv = d->bd_rcount; - bs->bs_drop = d->bd_dcount; + bs->bs_recv = (u_int)counter_u64_fetch(d->bd_rcount); + bs->bs_drop = (u_int)counter_u64_fetch(d->bd_dcount); break; } @@ -2146,8 +2155,7 @@ bpf_tap(struct bpf_if *bp, u_char *pkt, u_int pktlen) * write lock, too */ - /* XXX: Do not protect counter for the sake of performance. */ - ++d->bd_rcount; + counter_u64_add(d->bd_rcount, 1); /* * NB: We dont call BPF_CHECK_DIRECTION() here since there is no * way for the caller to indiciate to us whether this packet @@ -2167,7 +2175,7 @@ bpf_tap(struct bpf_if *bp, u_char *pkt, u_int pktlen) */ BPFD_LOCK(d); - d->bd_fcount++; + counter_u64_add(d->bd_fcount, 1); if (gottime < bpf_ts_quality(d->bd_tstamp)) gottime = bpf_gettime(&bt, d->bd_tstamp, NULL); #ifdef MAC @@ -2214,7 +2222,7 @@ bpf_mtap(struct bpf_if *bp, struct mbuf *m) LIST_FOREACH(d, &bp->bif_dlist, bd_next) { if (BPF_CHECK_DIRECTION(d, m->m_pkthdr.rcvif, bp->bif_ifp)) continue; - ++d->bd_rcount; + counter_u64_add(d->bd_rcount, 1); #ifdef BPF_JITTER bf = bpf_jitter_enable != 0 ? d->bd_bfilter : NULL; /* XXX We cannot handle multiple mbufs. */ @@ -2226,7 +2234,7 @@ bpf_mtap(struct bpf_if *bp, struct mbuf *m) if (slen != 0) { BPFD_LOCK(d); - d->bd_fcount++; + counter_u64_add(d->bd_fcount, 1); if (gottime < bpf_ts_quality(d->bd_tstamp)) gottime = bpf_gettime(&bt, d->bd_tstamp, m); #ifdef MAC @@ -2277,12 +2285,12 @@ bpf_mtap2(struct bpf_if *bp, void *data, u_int dlen, s LIST_FOREACH(d, &bp->bif_dlist, bd_next) { if (BPF_CHECK_DIRECTION(d, m->m_pkthdr.rcvif, bp->bif_ifp)) continue; - ++d->bd_rcount; + counter_u64_add(d->bd_rcount, 1); slen = bpf_filter(d->bd_rfilter, (u_char *)&mb, pktlen, 0); if (slen != 0) { BPFD_LOCK(d); - d->bd_fcount++; + counter_u64_add(d->bd_fcount, 1); if (gottime < bpf_ts_quality(d->bd_tstamp)) gottime = bpf_gettime(&bt, d->bd_tstamp, m); #ifdef MAC @@ -2435,7 +2443,7 @@ catchpacket(struct bpf_d *d, u_char *pkt, u_int pktlen * buffer model. */ bpf_buffull(d); - ++d->bd_dcount; + counter_u64_add(d->bd_dcount, 1); return; } KASSERT(!d->bd_hbuf_in_use, ("hold buffer is in use")); @@ -2535,6 +2543,15 @@ bpf_freed(struct bpf_d *d) if (d->bd_wfilter != NULL) free((caddr_t)d->bd_wfilter, M_BPF); mtx_destroy(&d->bd_lock); + + counter_u64_free(d->bd_rcount); + counter_u64_free(d->bd_dcount); + counter_u64_free(d->bd_fcount); + counter_u64_free(d->bd_wcount); + counter_u64_free(d->bd_wfcount); + counter_u64_free(d->bd_wdcount); + counter_u64_free(d->bd_zcopy); + } /* @@ -2835,12 +2852,12 @@ bpf_zero_counters(void) BPFIF_RLOCK(bp); LIST_FOREACH(bd, &bp->bif_dlist, bd_next) { BPFD_LOCK(bd); - bd->bd_rcount = 0; - bd->bd_dcount = 0; - bd->bd_fcount = 0; - bd->bd_wcount = 0; - bd->bd_wfcount = 0; - bd->bd_zcopy = 0; + counter_u64_zero(bd->bd_rcount); + counter_u64_zero(bd->bd_dcount); + counter_u64_zero(bd->bd_fcount); + counter_u64_zero(bd->bd_wcount); + counter_u64_zero(bd->bd_wfcount); + counter_u64_zero(bd->bd_zcopy); BPFD_UNLOCK(bd); } BPFIF_RUNLOCK(bp); @@ -2865,9 +2882,9 @@ bpfstats_fill_xbpf(struct xbpf_d *d, struct bpf_d *bd) d->bd_direction = bd->bd_direction; d->bd_feedback = bd->bd_feedback; d->bd_async = bd->bd_async; - d->bd_rcount = bd->bd_rcount; - d->bd_dcount = bd->bd_dcount; - d->bd_fcount = bd->bd_fcount; + d->bd_rcount = counter_u64_fetch(bd->bd_rcount); + d->bd_dcount = counter_u64_fetch(bd->bd_dcount); + d->bd_fcount = counter_u64_fetch(bd->bd_fcount); d->bd_sig = bd->bd_sig; d->bd_slen = bd->bd_slen; d->bd_hlen = bd->bd_hlen; @@ -2876,10 +2893,10 @@ bpfstats_fill_xbpf(struct xbpf_d *d, struct bpf_d *bd) strlcpy(d->bd_ifname, bd->bd_bif->bif_ifp->if_xname, IFNAMSIZ); d->bd_locked = bd->bd_locked; - d->bd_wcount = bd->bd_wcount; - d->bd_wdcount = bd->bd_wdcount; - d->bd_wfcount = bd->bd_wfcount; - d->bd_zcopy = bd->bd_zcopy; + d->bd_wcount = counter_u64_fetch(bd->bd_wcount); + d->bd_wdcount = counter_u64_fetch(bd->bd_wdcount); + d->bd_wfcount = counter_u64_fetch(bd->bd_wfcount); + d->bd_zcopy = counter_u64_fetch(bd->bd_zcopy); d->bd_bufmode = bd->bd_bufmode; } Modified: head/sys/net/bpfdesc.h ============================================================================== --- head/sys/net/bpfdesc.h Tue Mar 20 22:41:26 2018 (r331274) +++ head/sys/net/bpfdesc.h Tue Mar 20 22:57:06 2018 (r331275) @@ -45,6 +45,7 @@ #include #include #include +#include #include /* @@ -76,8 +77,8 @@ struct bpf_d { struct bpf_insn *bd_rfilter; /* read filter code */ struct bpf_insn *bd_wfilter; /* write filter code */ void *bd_bfilter; /* binary filter code */ - u_int64_t bd_rcount; /* number of packets received */ - u_int64_t bd_dcount; /* number of packets dropped */ + counter_u64_t bd_rcount; /* number of packets received */ + counter_u64_t bd_dcount; /* number of packets dropped */ u_char bd_promisc; /* true if listening promiscuously */ u_char bd_state; /* idle, waiting, or timed out */ @@ -94,14 +95,14 @@ struct bpf_d { struct mtx bd_lock; /* per-descriptor lock */ struct callout bd_callout; /* for BPF timeouts with select */ struct label *bd_label; /* MAC label for descriptor */ - u_int64_t bd_fcount; /* number of packets which matched filter */ + counter_u64_t bd_fcount; /* number of packets which matched filter */ pid_t bd_pid; /* PID which created descriptor */ int bd_locked; /* true if descriptor is locked */ u_int bd_bufmode; /* Current buffer mode. */ - u_int64_t bd_wcount; /* number of packets written */ - u_int64_t bd_wfcount; /* number of packets that matched write filter */ - u_int64_t bd_wdcount; /* number of packets dropped during a write */ - u_int64_t bd_zcopy; /* number of zero copy operations */ + counter_u64_t bd_wcount; /* number of packets written */ + counter_u64_t bd_wfcount; /* number of packets that matched write filter */ + counter_u64_t bd_wdcount; /* number of packets dropped during a write */ + counter_u64_t bd_zcopy; /* number of zero copy operations */ u_char bd_compat32; /* 32-bit stream on LP64 system */ }; From owner-svn-src-head@freebsd.org Tue Mar 20 23:04:16 2018 Return-Path: Delivered-To: svn-src-head@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 77B17F53B8A; Tue, 20 Mar 2018 23:04:16 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from shxd.cx (mail.shxd.cx [64.201.244.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FA036EE12; Tue, 20 Mar 2018 23:04:16 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from [74.217.198.10] (port=62988 helo=[10.1.4.66]) by shxd.cx with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1eyO6Y-000POk-Nl; Tue, 20 Mar 2018 20:43:34 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r331259 - head/stand/lua From: Devin Teske In-Reply-To: <201803202026.w2KKQOP2036471@repo.freebsd.org> Date: Tue, 20 Mar 2018 16:04:13 -0700 Cc: Devin Teske , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <401EA542-5E2B-4342-B098-7C8D78FAD721@freebsd.org> References: <201803202026.w2KKQOP2036471@repo.freebsd.org> To: Kyle Evans X-Mailer: Apple Mail (2.3273) Sender: devin@shxd.cx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 23:04:16 -0000 > On Mar 20, 2018, at 1:26 PM, Kyle Evans wrote: >=20 > Author: kevans > Date: Tue Mar 20 20:26:24 2018 > New Revision: 331259 > URL: https://svnweb.freebsd.org/changeset/base/331259 >=20 > Log: > lualoader: Use less atomic options for resetting colors/attributes >=20 > Noted by dteske: >=20 > CSI 1m ... CSI 22m > CSI 2m ... CSI 22m > CSI 4m ... CSI 24m > CSI 5m ... CSI 25m > CSI 7m ... CSI 27m > CSI 8m ... CSI 28m > CSI (30-37)m ... CSI 39m > CSI (40-47)m ... CSI 49m >=20 > - Provide resetf/resetb to match escapef/escapeb > - Use CSI 22m to undo a bold >=20 > This is a more reasonable approach than what was previously taken. >=20 > Reported by: dteske >=20 > Modified: > head/stand/lua/color.lua > head/stand/lua/menu.lua >=20 > Modified: head/stand/lua/color.lua > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/stand/lua/color.lua Tue Mar 20 20:20:49 2018 = (r331258) > +++ head/stand/lua/color.lua Tue Mar 20 20:26:24 2018 = (r331259) > @@ -65,6 +65,13 @@ function color.escapef(color_value) > return core.KEYSTR_CSI .. "3" .. color_value .. "m" > end >=20 > +function color.resetf() > + if color.disabled then > + return '' > + end > + return core.KEYSTR_CSI .. "39m" > +end > + > function color.escapeb(color_value) > if color.disabled then > return color_value > @@ -72,6 +79,13 @@ function color.escapeb(color_value) > return core.KEYSTR_CSI .. "4" .. color_value .. "m" > end >=20 > +function color.resetb() > + if color.disabled then > + return '' > + end > + return core.KEYSTR_CSI .. "49m" > +end > + > function color.escape(fg_color, bg_color, attribute) > if color.disabled then > return "" > @@ -98,7 +112,7 @@ function color.highlight(str) > end > -- We need to reset attributes as well as color scheme here, = just in > -- case the terminal defaults don't match what we're expecting. > - return core.KEYSTR_CSI .. "1m" .. str .. color.default() > + return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. = "22m" > end >=20 > return color >=20 > Modified: head/stand/lua/menu.lua > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/stand/lua/menu.lua Tue Mar 20 20:20:49 2018 = (r331258) > +++ head/stand/lua/menu.lua Tue Mar 20 20:26:24 2018 = (r331259) > @@ -120,7 +120,7 @@ menu.boot_environments =3D { > name_color =3D = color.escapef(color.BLUE) > end > bootenv_name =3D bootenv_name .. = name_color .. > - choice .. color.default() > + choice .. color.resetf() > return color.highlight("A").."ctive: " = .. > bootenv_name .. " (" .. idx .. " of = " .. > #all_choices .. ")" > @@ -306,7 +306,7 @@ menu.welcome =3D { > name_color =3D = color.escapef(color.BLUE) > end > kernel_name =3D kernel_name .. = name_color .. > - choice .. color.default() > + choice .. color.resetf() > return color.highlight("K") .. "ernel: " = .. > kernel_name .. " (" .. idx .. " of " = .. > #all_choices .. ")" >=20 Minor nit ... While resetf is unlikely to be mistaken for anything other than "reset = foreground", ... "resetb" could easily be mistaken for "reset bold". I would like to suggest, in tradition, that resetf/resetb be renamed to = resetfg/resetbg You know... should you want to add a "resetb" later that actually resets = bold (e.g., if you have to use CSI 22m in more than one place). --=20 Devin= From owner-svn-src-head@freebsd.org Tue Mar 20 23:08:04 2018 Return-Path: Delivered-To: svn-src-head@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 DEDC0F53F63; Tue, 20 Mar 2018 23:08:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 957CA6F04A; Tue, 20 Mar 2018 23:08:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C1332306C; Tue, 20 Mar 2018 23:08:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KN84Ac019829; Tue, 20 Mar 2018 23:08:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KN84MN019828; Tue, 20 Mar 2018 23:08:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803202308.w2KN84MN019828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Mar 2018 23:08:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331277 - head X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 331277 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 23:08:05 -0000 Author: emaste Date: Tue Mar 20 23:08:04 2018 New Revision: 331277 URL: https://svnweb.freebsd.org/changeset/base/331277 Log: Correct comment date in r331255 Reported by: jhb Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Mar 20 22:57:14 2018 (r331276) +++ head/Makefile.inc1 Tue Mar 20 23:08:04 2018 (r331277) @@ -1395,7 +1395,7 @@ INSTALLKERNEL= ${_kernel} .endfor _cleankernobj_fast_depend_hack: .PHONY -# 20170202 remove stale generated assym.s after renaming to .inc in r331254 +# 20180320 remove stale generated assym.s after renaming to .inc in r331254 .if exists(${OBJTOP}/sys/${KERNCONF}/assym.s) @echo Removing stale generated assym files @rm -f ${OBJTOP}/sys/${KERNCONF}/assym.* \ From owner-svn-src-head@freebsd.org Tue Mar 20 23:08:43 2018 Return-Path: Delivered-To: svn-src-head@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 47D25F54015; Tue, 20 Mar 2018 23:08:43 +0000 (UTC) (envelope-from jamie@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 EEEA16F198; Tue, 20 Mar 2018 23:08:42 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E9AEA2306D; Tue, 20 Mar 2018 23:08:42 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KN8g1Y019891; Tue, 20 Mar 2018 23:08:42 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KN8gYe019890; Tue, 20 Mar 2018 23:08:42 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201803202308.w2KN8gYe019890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Tue, 20 Mar 2018 23:08:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331278 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jamie X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331278 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 23:08:43 -0000 Author: jamie Date: Tue Mar 20 23:08:42 2018 New Revision: 331278 URL: https://svnweb.freebsd.org/changeset/base/331278 Log: Represent boolean jail options as an array of structures containing the flag and both the regular and "no" names, instead of two different string arrays whose indices need to match the flag's bit position. This makes them similar to the say "jailsys" options are represented. Loop through either kind of option array with a structure pointer rather then an integer index. Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Tue Mar 20 23:08:04 2018 (r331277) +++ head/sys/kern/kern_jail.c Tue Mar 20 23:08:42 2018 (r331278) @@ -115,6 +115,17 @@ struct prison prison0 = { }; MTX_SYSINIT(prison0, &prison0.pr_mtx, "jail mutex", MTX_DEF); +struct bool_flags { + const char *name; + const char *noname; + unsigned flag; +}; +struct jailsys_flags { + const char *name; + unsigned disable; + unsigned new; +}; + /* allprison, allprison_racct and lastprid are protected by allprison_lock. */ struct sx allprison_lock; SX_SYSINIT(allprison_lock, &allprison_lock, "allprison"); @@ -145,86 +156,55 @@ static void prison_racct_detach(struct prison *pr); * as we cannot figure out the size of a sparse array, or an array without a * terminating entry. */ -static char *pr_flag_names[] = { - [0] = "persist", +static struct bool_flags pr_flag_bool[] = { + {"persist", "nopersist", PR_PERSIST}, #ifdef INET - [7] = "ip4.saddrsel", + {"ip4.saddrsel", "ip4.nosaddrsel", PR_IP4_SADDRSEL}, #endif #ifdef INET6 - [8] = "ip6.saddrsel", + {"ip6.saddrsel", "ip6.nosaddrsel", PR_IP6_SADDRSEL}, #endif }; -const size_t pr_flag_names_size = sizeof(pr_flag_names); +const size_t pr_flag_bool_size = sizeof(pr_flag_bool); -static char *pr_flag_nonames[] = { - [0] = "nopersist", -#ifdef INET - [7] = "ip4.nosaddrsel", -#endif -#ifdef INET6 - [8] = "ip6.nosaddrsel", -#endif -}; -const size_t pr_flag_nonames_size = sizeof(pr_flag_nonames); - -struct jailsys_flags { - const char *name; - unsigned disable; - unsigned new; -} pr_flag_jailsys[] = { - { "host", 0, PR_HOST }, +static struct jailsys_flags pr_flag_jailsys[] = { + {"host", 0, PR_HOST}, #ifdef VIMAGE - { "vnet", 0, PR_VNET }, + {"vnet", 0, PR_VNET}, #endif #ifdef INET - { "ip4", PR_IP4_USER, PR_IP4_USER }, + {"ip4", PR_IP4_USER, PR_IP4_USER}, #endif #ifdef INET6 - { "ip6", PR_IP6_USER, PR_IP6_USER }, + {"ip6", PR_IP6_USER, PR_IP6_USER}, #endif }; const size_t pr_flag_jailsys_size = sizeof(pr_flag_jailsys); -static char *pr_allow_names[] = { - "allow.set_hostname", - "allow.sysvipc", - "allow.raw_sockets", - "allow.chflags", - "allow.mount", - "allow.quotas", - "allow.socket_af", - "allow.mount.devfs", - "allow.mount.nullfs", - "allow.mount.zfs", - "allow.mount.procfs", - "allow.mount.tmpfs", - "allow.mount.fdescfs", - "allow.mount.linprocfs", - "allow.mount.linsysfs", - "allow.reserved_ports", +static struct bool_flags pr_flag_allow[] = { + {"allow.set_hostname", "allow.noset_hostname", PR_ALLOW_SET_HOSTNAME}, + {"allow.sysvipc", "allow.nosysvipc", PR_ALLOW_SYSVIPC}, + {"allow.raw_sockets", "allow.noraw_sockets", PR_ALLOW_RAW_SOCKETS}, + {"allow.chflags", "allow.nochflags", PR_ALLOW_CHFLAGS}, + {"allow.mount", "allow.nomount", PR_ALLOW_MOUNT}, + {"allow.quotas", "allow.noquotas", PR_ALLOW_QUOTAS}, + {"allow.socket_af", "allow.nosocket_af", PR_ALLOW_SOCKET_AF}, + {"allow.mount.devfs", "allow.mount.nodevfs", PR_ALLOW_MOUNT_DEVFS}, + {"allow.mount.nullfs", "allow.mount.nonullfs", PR_ALLOW_MOUNT_NULLFS}, + {"allow.mount.zfs", "allow.mount.nozfs", PR_ALLOW_MOUNT_ZFS}, + {"allow.mount.procfs", "allow.mount.noprocfs", PR_ALLOW_MOUNT_PROCFS}, + {"allow.mount.tmpfs", "allow.mount.notmpfs", PR_ALLOW_MOUNT_TMPFS}, + {"allow.mount.fdescfs", "allow.mount.nofdescfs", + PR_ALLOW_MOUNT_FDESCFS}, + {"allow.mount.linprocfs", "allow.mount.nolinprocfs", + PR_ALLOW_MOUNT_LINPROCFS}, + {"allow.mount.linsysfs", "allow.mount.nolinsysfs", + PR_ALLOW_MOUNT_LINSYSFS}, + {"allow.reserved_ports", "allow.noreserved_ports", + PR_ALLOW_RESERVED_PORTS}, }; -const size_t pr_allow_names_size = sizeof(pr_allow_names); +const size_t pr_flag_allow_size = sizeof(pr_flag_allow); -static char *pr_allow_nonames[] = { - "allow.noset_hostname", - "allow.nosysvipc", - "allow.noraw_sockets", - "allow.nochflags", - "allow.nomount", - "allow.noquotas", - "allow.nosocket_af", - "allow.mount.nodevfs", - "allow.mount.nonullfs", - "allow.mount.nozfs", - "allow.mount.noprocfs", - "allow.mount.notmpfs", - "allow.mount.nofdescfs", - "allow.mount.nolinprocfs", - "allow.mount.nolinsysfs", - "allow.noreserved_ports", -}; -const size_t pr_allow_nonames_size = sizeof(pr_allow_nonames); - #define JAIL_DEFAULT_ALLOW (PR_ALLOW_SET_HOSTNAME | PR_ALLOW_RESERVED_PORTS) #define JAIL_DEFAULT_ENFORCE_STATFS 2 #define JAIL_DEFAULT_DEVFS_RSNUM 0 @@ -305,7 +285,7 @@ sys_jail(struct thread *td, struct jail_args *uap) int kern_jail(struct thread *td, struct jail *j) { - struct iovec optiov[2 * (4 + nitems(pr_allow_names) + struct iovec optiov[2 * (4 + nitems(pr_flag_allow) #ifdef INET + 1 #endif @@ -315,6 +295,7 @@ kern_jail(struct thread *td, struct jail *j) )]; struct uio opt; char *u_path, *u_hostname, *u_name; + struct bool_flags *bf; #ifdef INET uint32_t ip4s; struct in_addr *u_ip4; @@ -323,7 +304,7 @@ kern_jail(struct thread *td, struct jail *j) struct in6_addr *u_ip6; #endif size_t tmplen; - int error, enforce_statfs, fi; + int error, enforce_statfs; bzero(&optiov, sizeof(optiov)); opt.uio_iov = optiov; @@ -336,10 +317,12 @@ kern_jail(struct thread *td, struct jail *j) /* Set permissions for top-level jails from sysctls. */ if (!jailed(td->td_ucred)) { - for (fi = 0; fi < nitems(pr_allow_names); fi++) { - optiov[opt.uio_iovcnt].iov_base = - (jail_default_allow & (1 << fi)) - ? pr_allow_names[fi] : pr_allow_nonames[fi]; + for (bf = pr_flag_allow; + bf < pr_flag_allow + nitems(pr_flag_allow); + bf++) { + optiov[opt.uio_iovcnt].iov_base = __DECONST(char *, + (jail_default_allow & bf->flag) + ? bf->name : bf->noname); optiov[opt.uio_iovcnt].iov_len = strlen(optiov[opt.uio_iovcnt].iov_base) + 1; opt.uio_iovcnt += 2; @@ -498,6 +481,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, i struct vnode *root; char *domain, *errmsg, *host, *name, *namelc, *p, *path, *uuid; char *g_path, *osrelstr; + struct bool_flags *bf; + struct jailsys_flags *jsf; #if defined(INET) || defined(INET6) struct prison *tppr; void *op; @@ -507,7 +492,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, i int born, created, cuflags, descend, enforce; int error, errmsg_len, errmsg_pos; int gotchildmax, gotenforce, gothid, gotrsnum, gotslevel; - int fi, jid, jsys, len, level; + int jid, jsys, len, level; int childmax, osreldt, rsnum, slevel; int fullpath_disabled; #if defined(INET) || defined(INET6) @@ -605,30 +590,31 @@ kern_jail_set(struct thread *td, struct uio *optuio, i gotrsnum = 1; pr_flags = ch_flags = 0; - for (fi = 0; fi < nitems(pr_flag_names); fi++) { - if (pr_flag_names[fi] == NULL) - continue; - vfs_flagopt(opts, pr_flag_names[fi], &pr_flags, 1 << fi); - vfs_flagopt(opts, pr_flag_nonames[fi], &ch_flags, 1 << fi); + for (bf = pr_flag_bool; + bf < pr_flag_bool + nitems(pr_flag_bool); + bf++) { + vfs_flagopt(opts, bf->name, &pr_flags, bf->flag); + vfs_flagopt(opts, bf->noname, &ch_flags, bf->flag); } ch_flags |= pr_flags; - for (fi = 0; fi < nitems(pr_flag_jailsys); fi++) { - error = vfs_copyopt(opts, pr_flag_jailsys[fi].name, &jsys, - sizeof(jsys)); + for (jsf = pr_flag_jailsys; + jsf < pr_flag_jailsys + nitems(pr_flag_jailsys); + jsf++) { + error = vfs_copyopt(opts, jsf->name, &jsys, sizeof(jsys)); if (error == ENOENT) continue; if (error != 0) goto done_free; switch (jsys) { case JAIL_SYS_DISABLE: - if (!pr_flag_jailsys[fi].disable) { + if (!jsf->disable) { error = EINVAL; goto done_free; } - pr_flags |= pr_flag_jailsys[fi].disable; + pr_flags |= jsf->disable; break; case JAIL_SYS_NEW: - pr_flags |= pr_flag_jailsys[fi].new; + pr_flags |= jsf->new; break; case JAIL_SYS_INHERIT: break; @@ -636,8 +622,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, i error = EINVAL; goto done_free; } - ch_flags |= - pr_flag_jailsys[fi].new | pr_flag_jailsys[fi].disable; + ch_flags |= jsf->new | jsf->disable; } if ((flags & (JAIL_CREATE | JAIL_UPDATE | JAIL_ATTACH)) == JAIL_CREATE && !(pr_flags & PR_PERSIST)) { @@ -668,9 +653,11 @@ kern_jail_set(struct thread *td, struct uio *optuio, i #endif pr_allow = ch_allow = 0; - for (fi = 0; fi < nitems(pr_allow_names); fi++) { - vfs_flagopt(opts, pr_allow_names[fi], &pr_allow, 1 << fi); - vfs_flagopt(opts, pr_allow_nonames[fi], &ch_allow, 1 << fi); + for (bf = pr_flag_allow; + bf < pr_flag_allow + nitems(pr_flag_allow); + bf++) { + vfs_flagopt(opts, bf->name, &pr_allow, bf->flag); + vfs_flagopt(opts, bf->noname, &ch_allow, bf->flag); } ch_allow |= pr_allow; @@ -1940,11 +1927,14 @@ sys_jail_get(struct thread *td, struct jail_get_args * int kern_jail_get(struct thread *td, struct uio *optuio, int flags) { + struct bool_flags *bf; + struct jailsys_flags *jsf; struct prison *pr, *mypr; struct vfsopt *opt; struct vfsoptlist *opts; char *errmsg, *name; - int error, errmsg_len, errmsg_pos, fi, i, jid, len, locked, pos; + int error, errmsg_len, errmsg_pos, i, jid, len, locked, pos; + unsigned f; if (flags & ~JAIL_GET_MASK) return (EINVAL); @@ -2101,39 +2091,38 @@ kern_jail_get(struct thread *td, struct uio *optuio, i sizeof(pr->pr_devfs_rsnum)); if (error != 0 && error != ENOENT) goto done_deref; - for (fi = 0; fi < nitems(pr_flag_names); fi++) { - if (pr_flag_names[fi] == NULL) - continue; - i = (pr->pr_flags & (1 << fi)) ? 1 : 0; - error = vfs_setopt(opts, pr_flag_names[fi], &i, sizeof(i)); + for (bf = pr_flag_bool; + bf < pr_flag_bool + nitems(pr_flag_bool); + bf++) { + i = (pr->pr_flags & bf->flag) ? 1 : 0; + error = vfs_setopt(opts, bf->name, &i, sizeof(i)); if (error != 0 && error != ENOENT) goto done_deref; i = !i; - error = vfs_setopt(opts, pr_flag_nonames[fi], &i, sizeof(i)); + error = vfs_setopt(opts, bf->noname, &i, sizeof(i)); if (error != 0 && error != ENOENT) goto done_deref; } - for (fi = 0; fi < nitems(pr_flag_jailsys); fi++) { - i = pr->pr_flags & - (pr_flag_jailsys[fi].disable | pr_flag_jailsys[fi].new); - i = pr_flag_jailsys[fi].disable && - (i == pr_flag_jailsys[fi].disable) ? JAIL_SYS_DISABLE - : (i == pr_flag_jailsys[fi].new) ? JAIL_SYS_NEW + for (jsf = pr_flag_jailsys; + jsf < pr_flag_jailsys + nitems(pr_flag_jailsys); + jsf++) { + f = pr->pr_flags & (jsf->disable | jsf->new); + i = (f != 0 && f == jsf->disable) ? JAIL_SYS_DISABLE + : (f == jsf->new) ? JAIL_SYS_NEW : JAIL_SYS_INHERIT; - error = - vfs_setopt(opts, pr_flag_jailsys[fi].name, &i, sizeof(i)); + error = vfs_setopt(opts, jsf->name, &i, sizeof(i)); if (error != 0 && error != ENOENT) goto done_deref; } - for (fi = 0; fi < nitems(pr_allow_names); fi++) { - if (pr_allow_names[fi] == NULL) - continue; - i = (pr->pr_allow & (1 << fi)) ? 1 : 0; - error = vfs_setopt(opts, pr_allow_names[fi], &i, sizeof(i)); + for (bf = pr_flag_allow; + bf < pr_flag_allow + nitems(pr_flag_allow); + bf++) { + i = (pr->pr_allow & bf->flag) ? 1 : 0; + error = vfs_setopt(opts, bf->name, &i, sizeof(i)); if (error != 0 && error != ENOENT) goto done_deref; i = !i; - error = vfs_setopt(opts, pr_allow_nonames[fi], &i, sizeof(i)); + error = vfs_setopt(opts, bf->noname, &i, sizeof(i)); if (error != 0 && error != ENOENT) goto done_deref; } @@ -4007,11 +3996,12 @@ prison_racct_detach(struct prison *pr) static void db_show_prison(struct prison *pr) { - int fi; + struct bool_flags *bf; + struct jailsys_flags *jsf; #if defined(INET) || defined(INET6) int ii; #endif - unsigned jsf; + unsigned f; #ifdef INET char ip4buf[INET_ADDRSTRLEN]; #endif @@ -4039,22 +4029,24 @@ db_show_prison(struct prison *pr) db_printf(" child = %p\n", LIST_FIRST(&pr->pr_children)); db_printf(" sibling = %p\n", LIST_NEXT(pr, pr_sibling)); db_printf(" flags = 0x%x", pr->pr_flags); - for (fi = 0; fi < nitems(pr_flag_names); fi++) - if (pr_flag_names[fi] != NULL && (pr->pr_flags & (1 << fi))) - db_printf(" %s", pr_flag_names[fi]); - for (fi = 0; fi < nitems(pr_flag_jailsys); fi++) { - jsf = pr->pr_flags & - (pr_flag_jailsys[fi].disable | pr_flag_jailsys[fi].new); - db_printf(" %-16s= %s\n", pr_flag_jailsys[fi].name, - pr_flag_jailsys[fi].disable && - (jsf == pr_flag_jailsys[fi].disable) ? "disable" - : (jsf == pr_flag_jailsys[fi].new) ? "new" + for (bf = pr_flag_bool; bf < pr_flag_bool + nitems(pr_flag_bool); bf++) + if (pr->pr_flags & bf->flag) + db_printf(" %s", bf->name); + for (jsf = pr_flag_jailsys; + jsf < pr_flag_jailsys + nitems(pr_flag_jailsys); + jsf++) { + f = pr->pr_flags & (jsf->disable | jsf->new); + db_printf(" %-16s= %s\n", jsf->name, + (f != 0 && f == jsf->disable) ? "disable" + : (f == jsf->new) ? "new" : "inherit"); } db_printf(" allow = 0x%x", pr->pr_allow); - for (fi = 0; fi < nitems(pr_allow_names); fi++) - if (pr_allow_names[fi] != NULL && (pr->pr_allow & (1 << fi))) - db_printf(" %s", pr_allow_names[fi]); + for (bf = pr_flag_allow; + bf < pr_flag_allow + nitems(pr_flag_allow); + bf++) + if (pr->pr_allow & bf->flag) + db_printf(" %s", bf->name); db_printf("\n"); db_printf(" enforce_statfs = %d\n", pr->pr_enforce_statfs); db_printf(" host.hostname = %s\n", pr->pr_hostname); From owner-svn-src-head@freebsd.org Wed Mar 21 00:29:57 2018 Return-Path: Delivered-To: svn-src-head@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 5B4A7F59AAA for ; Wed, 21 Mar 2018 00:29:57 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yw0-x243.google.com (mail-yw0-x243.google.com [IPv6:2607:f8b0:4002:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BF1B671E42 for ; Wed, 21 Mar 2018 00:29:56 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yw0-x243.google.com with SMTP id x17so1163204ywj.1 for ; Tue, 20 Mar 2018 17:29:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=naWPISMBntOCF1Gz9MHvS/z7ckjgwHEYm2ih96sWrbU=; b=k+HcYVWHjUG84CXKFifTMq9/uMoYBHaM/NOi05VPJAzhy+s7v4eT2zqate6PoaabbE oy+8lrvFYQeZmmg+0C5fmxc3S3SJVh2u20n14IQrhqaNHpspO2EuvroDTxG4ZZ1tNMP6 U9xuk12CR0hgRk2AOU1LstQh/IW++C4ih0XOtdewkngFKvYA1RfkjvnanoIYucmCbY2+ 5J7wTmdhwxh8e9gYdLuv/8SrStiFG9HWyW26ee0h9lmvKaqQtD4658H+tzJ3hXpo/yhc L2CPwuxRu390o+WRqIe/p+hNyCxn4DPu1cSKVSN9j5+qJJyBcl+ESZPEciPX8CDvDO9I 4GVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=naWPISMBntOCF1Gz9MHvS/z7ckjgwHEYm2ih96sWrbU=; b=YYfVbFSy9/jKgX7T+rp+cAU2PBEQgr5DQJFi9kxl2F02qFW9gxxSgve4a/+Ky4k23L tSz989SE9rPwLMqNeed5WvoGLMgYHf6Jd1Q84P0P3ndQSs7hW/hO4P6YSZavDboH3XGy FpviJIXh1ThNdWmNZmrZZaNDNhlcJrUKKZ5SqngOjq19+GIq7jhDaU6q9yJQcvQfQ6Fc 42x9L3tVZuSW+k+s6QUPWsDH2D1atCLCAo1ZTpmpvEPVTNBmNGqt72Pu2dNH+9YkLTKI qutsOPskSLPUDoY3XN/4H3zdsy5yo96CkHgt+fXoo7xiDvJrpaoH13fN6Zwc5qoW1csl Gyvg== X-Gm-Message-State: AElRT7HeabzAkK3ZOrlPmTA+qg38YMEg4vUC+Ozw912vnPg5Mrd9rMyP M7OQoqBxsKb2PwYipDGj0usCNM92eZ0MNAEBnTDZeQ== X-Google-Smtp-Source: AG47ELvU8+6+ipOqV50KxQzHJ1wqzQGwCSl8aY7YDyYlsyFaK97q34wHgcqrS/TAeFwLWtu6BX+i5VU7zumvJQ8FYuE= X-Received: by 10.13.204.146 with SMTP id o140mr10950229ywd.265.1521592195937; Tue, 20 Mar 2018 17:29:55 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:61c5:0:0:0:0:0 with HTTP; Tue, 20 Mar 2018 17:29:55 -0700 (PDT) In-Reply-To: <201803201743.w2KHhoF9055658@repo.freebsd.org> References: <201803201743.w2KHhoF9055658@repo.freebsd.org> From: Oliver Pinter Date: Wed, 21 Mar 2018 01:29:55 +0100 Message-ID: Subject: Re: svn commit: r331252 - in head/sys/amd64: amd64 include To: Konstantin Belousov Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 00:29:57 -0000 On Tuesday, March 20, 2018, Konstantin Belousov wrote: > Author: kib > Date: Tue Mar 20 17:43:50 2018 > New Revision: 331252 > URL: https://svnweb.freebsd.org/changeset/base/331252 > > Log: > Provide KPI for handling of rw/ro kernel text. > > This is a pure syntax patch to create an interface to enable and later > restore write access to the kernel text and other read-only mapped > regions. It is in line with e.g. vm_fault_disable_pagefaults() by > allowing the nesting. > > Discussed with: Peter Lei > Reviewed by: jtl > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D14768 > > Modified: > head/sys/amd64/amd64/db_interface.c > head/sys/amd64/amd64/gdb_machdep.c > head/sys/amd64/amd64/machdep.c > head/sys/amd64/include/md_var.h > > Modified: head/sys/amd64/amd64/db_interface.c > ============================================================ > ================== > --- head/sys/amd64/amd64/db_interface.c Tue Mar 20 17:41:54 2018 > (r331251) > +++ head/sys/amd64/amd64/db_interface.c Tue Mar 20 17:43:50 2018 > (r331252) > @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); > #include > > #include > +#include > #include > > #include > @@ -75,19 +76,19 @@ db_write_bytes(vm_offset_t addr, size_t size, char *da > jmp_buf jb; > void *prev_jb; > char *dst; > - u_long cr0save; > + bool old_wp; > int ret; > > - cr0save = rcr0(); > + old_wp = false; This line should be old_wp = (rcr0() & CR0_WP) ? true : false; to preserve the old behavior in ret != 0 case. > prev_jb = kdb_jmpbuf(jb); > ret = setjmp(jb); > if (ret == 0) { > - load_cr0(cr0save & ~CR0_WP); > + old_wp = disable_wp(); > dst = (char *)addr; > while (size-- > 0) > *dst++ = *data++; > } > - load_cr0(cr0save); > + restore_wp(old_wp); > (void)kdb_jmpbuf(prev_jb); > return (ret); > } > > Modified: head/sys/amd64/amd64/gdb_machdep.c > ============================================================ > ================== > --- head/sys/amd64/amd64/gdb_machdep.c Tue Mar 20 17:41:54 2018 > (r331251) > +++ head/sys/amd64/amd64/gdb_machdep.c Tue Mar 20 17:43:50 2018 > (r331252) > @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -127,17 +128,14 @@ gdb_cpu_signal(int type, int code) > void * > gdb_begin_write(void) > { > - u_long cr0save; > > - cr0save = rcr0(); > - load_cr0(cr0save & ~CR0_WP); > - return ((void *)cr0save); > + return (disable_wp() ? &gdb_begin_write : NULL); > } > > void > gdb_end_write(void *arg) > { > > - load_cr0((u_long)arg); > + restore_wp(arg != NULL); > } > > > Modified: head/sys/amd64/amd64/machdep.c > ============================================================ > ================== > --- head/sys/amd64/amd64/machdep.c Tue Mar 20 17:41:54 2018 > (r331251) > +++ head/sys/amd64/amd64/machdep.c Tue Mar 20 17:43:50 2018 > (r331252) > @@ -2597,6 +2597,31 @@ clear_pcb_flags(struct pcb *pcb, const u_int flags) > : "cc", "memory"); > } > > +/* > + * Enable and restore kernel text write permissions. > + * Callers must ensure that disable_wp()/restore_wp() are executed > + * without rescheduling on the same core. > + */ > +bool > +disable_wp(void) > +{ > + u_int cr0; > + > + cr0 = rcr0(); > + if ((cr0 & CR0_WP) == 0) > + return (false); > + load_cr0(cr0 & ~CR0_WP); > + return (true); > +} > + > +void > +restore_wp(bool old_wp) > +{ > + > + if (old_wp) > + load_cr0(rcr0() | CR0_WP); > +} > + > #ifdef KDB > > /* > > Modified: head/sys/amd64/include/md_var.h > ============================================================ > ================== > --- head/sys/amd64/include/md_var.h Tue Mar 20 17:41:54 2018 > (r331251) > +++ head/sys/amd64/include/md_var.h Tue Mar 20 17:43:50 2018 > (r331252) > @@ -53,6 +53,8 @@ void amd64_conf_fast_syscall(void); > void amd64_db_resume_dbreg(void); > void amd64_lower_shared_page(struct sysentvec *); > void amd64_syscall(struct thread *td, int traced); > +bool disable_wp(void); > +void restore_wp(bool old_wp); > void doreti_iret(void) __asm(__STRING(doreti_iret)); > void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault)); > void ld_ds(void) __asm(__STRING(ld_ds)); > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Wed Mar 21 00:57:25 2018 Return-Path: Delivered-To: svn-src-head@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 C4A34F5BC27; Wed, 21 Mar 2018 00:57:25 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14613731D7; Wed, 21 Mar 2018 00:57:24 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w2L0vMDk019009; Tue, 20 Mar 2018 17:57:22 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w2L0vM2m019008; Tue, 20 Mar 2018 17:57:22 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201803210057.w2L0vM2m019008@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r331269 - head/share/man/man9 In-Reply-To: <201803202137.w2KLbXrp071489@repo.freebsd.org> To: Warner Losh Date: Tue, 20 Mar 2018 17:57:22 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 00:57:25 -0000 > Author: imp > Date: Tue Mar 20 21:37:33 2018 > New Revision: 331269 > URL: https://svnweb.freebsd.org/changeset/base/331269 > > Log: > Remove reference to lint. We no longer support it, so exceptions for > it are no longer relevant. I still believe this is putting the cart before the horse: /usr/src # find . -print0 | xargs -0 grep "ifndef lint" | wc 1228 2459 48568 > Modified: > head/share/man/man9/style.9 > > Modified: head/share/man/man9/style.9 > ============================================================================== > --- head/share/man/man9/style.9 Tue Mar 20 21:36:35 2018 (r331268) > +++ head/share/man/man9/style.9 Tue Mar 20 21:37:33 2018 (r331269) > @@ -107,11 +107,7 @@ Only add > .Dq Li "From: " > in front of foreign VCS IDs if the file is renamed. > .Bd -literal > -#if 0 > -#ifndef lint > -static char sccsid[] = "@(#)style 1.14 (Berkeley) 4/28/95"; > -#endif /* not lint */ > -#endif > +/* From: @(#)style 1.14 (Berkeley) 4/28/95 */ > > #include > __FBSDID("$FreeBSD$"); > @@ -234,10 +230,6 @@ This comment should be used only for (subjectively) lo > greater than 20 lines, or where a series of nested > .Ic #ifdef 's > may be confusing to the reader. > -Exceptions may be made for cases where code is conditionally not compiled for > -the purposes of > -.Xr lint 1 , > -even though the uncompiled region may be small. > The comment should be separated from the > .Ic #endif > or > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Mar 21 01:15:47 2018 Return-Path: Delivered-To: svn-src-head@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 957D6F5D070; Wed, 21 Mar 2018 01:15:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 410D973CC7; Wed, 21 Mar 2018 01:15:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 369BD243E7; Wed, 21 Mar 2018 01:15:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2L1FloX084716; Wed, 21 Mar 2018 01:15:47 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L1Fjt9084698; Wed, 21 Mar 2018 01:15:45 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803210115.w2L1Fjt9084698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 01:15:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss X-SVN-Commit-Revision: 331279 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 01:15:48 -0000 Author: cem Date: Wed Mar 21 01:15:45 2018 New Revision: 331279 URL: https://svnweb.freebsd.org/changeset/base/331279 Log: Implement getrandom(2) and getentropy(3) The general idea here is to provide userspace programs with well-defined sources of entropy, in a fashion that doesn't require opening a new file descriptor (ulimits) or accessing paths (/dev/urandom may be restricted by chroot or capsicum). getrandom(2) is the more general API, and comes from the Linux world. Since our urandom and random devices are identical, the GRND_RANDOM flag is ignored. getentropy(3) is added as a compatibility shim for the OpenBSD API. truss(1) support is included. Tests for both system calls are provided. Coverage is believed to be at least as comprehensive as LTP getrandom(2) test coverage. Additionally, instructions for running the LTP tests directly against FreeBSD are provided in the "Test Plan" section of the Differential revision linked below. (They pass, of course.) PR: 194204 Reported by: David CARLIER Discussed with: cperciva, delphij, jhb, markj Relnotes: maybe Differential Revision: https://reviews.freebsd.org/D14500 Added: head/lib/libc/gen/getentropy.3 (contents, props changed) head/lib/libc/gen/getentropy.c (contents, props changed) head/lib/libc/sys/getrandom.2 (contents, props changed) head/lib/libc/tests/gen/getentropy_test.c (contents, props changed) head/sys/kern/sys_getrandom.c (contents, props changed) head/tests/sys/kern/sys_getrandom.c (contents, props changed) Modified: head/include/unistd.h head/lib/libc/gen/Makefile.inc head/lib/libc/gen/Symbol.map head/lib/libc/sys/Makefile.inc head/lib/libc/sys/Symbol.map head/lib/libc/tests/gen/Makefile head/sys/compat/freebsd32/syscalls.master head/sys/conf/files head/sys/kern/syscalls.master head/sys/sys/random.h head/tests/sys/kern/Makefile head/usr.bin/truss/syscalls.c Modified: head/include/unistd.h ============================================================================== --- head/include/unistd.h Tue Mar 20 23:08:42 2018 (r331278) +++ head/include/unistd.h Wed Mar 21 01:15:45 2018 (r331279) @@ -506,6 +506,7 @@ int execvP(const char *, const char *, char * const * int feature_present(const char *); char *fflagstostr(u_long); int getdomainname(char *, int); +int getentropy(void *, size_t); int getgrouplist(const char *, gid_t, gid_t *, int *); int getloginclass(char *, size_t); mode_t getmode(const void *, mode_t); Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Tue Mar 20 23:08:42 2018 (r331278) +++ head/lib/libc/gen/Makefile.inc Wed Mar 21 01:15:45 2018 (r331279) @@ -57,6 +57,7 @@ SRCS+= __getosreldate.c \ getcap.c \ getcwd.c \ getdomainname.c \ + getentropy.c \ getgrent.c \ getgrouplist.c \ gethostname.c \ @@ -220,6 +221,7 @@ MAN+= alarm.3 \ getcwd.3 \ getdiskbyname.3 \ getdomainname.3 \ + getentropy.3 \ getfsent.3 \ getgrent.3 \ getgrouplist.3 \ Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Tue Mar 20 23:08:42 2018 (r331278) +++ head/lib/libc/gen/Symbol.map Wed Mar 21 01:15:45 2018 (r331279) @@ -408,6 +408,7 @@ FBSD_1.5 { fts_set; fts_set_clientptr; ftw; + getentropy; getmntinfo; glob; globfree; Added: head/lib/libc/gen/getentropy.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/gen/getentropy.3 Wed Mar 21 01:15:45 2018 (r331279) @@ -0,0 +1,86 @@ +.\" $OpenBSD: getentropy.2,v 1.8 2015/01/31 00:20:12 schwarze Exp $ +.\" +.\" Copyright (c) 2018 Conrad Meyer +.\" Copyright (c) 2014 Theo de Raadt +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" $FreeBSD$ +.\" +.Dd February 24, 2018 +.Dt GETENTROPY 3 +.Os +.Sh NAME +.Nm getentropy +.Nd get entropy +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In unistd.h +.Ft int +.Fn getentropy "void *buf" "size_t buflen" +.Sh DESCRIPTION +.Fn getentropy +fills a buffer with high-quality random data. +.Pp +The maximum +.Fa buflen +permitted is 256 bytes. +.Pp +If it does not produce an error, +.Fn getentropy +always provides the requested number of bytes of random data. +.Pp +Similar to reading from +.Pa /dev/urandom +just after boot, +.Fn getentropy +may block until the system has collected enough entropy to seed the CSPRNG. +.Sh IMPLEMENTATION NOTES +The +.Fn getentropy +function is implemented using +.Xr getrandom 2 . +.Sh RETURN VALUES +.Rv -std +.Sh ERRORS +.Fn getentropy +will succeed unless: +.Bl -tag -width Er +.It Bq Er EFAULT +The +.Fa buf +parameter points to an +invalid address. +.It Bq Er EIO +Too many bytes requested, or some other fatal error occurred. +.El +.Sh SEE ALSO +.Xr arc4random 3 , +.Xr getrandom 2 , +.Xr random 4 +.Sh STANDARDS +.Fn getentropy +is non-standard. +It is present on +.Ox +and Linux. +.Sh HISTORY +The +.Fn getentropy +function appeared in +.Ox 5.6 . +The +.Fx +libc compatibility shim first appeared in +.Fx 12.0 . Added: head/lib/libc/gen/getentropy.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/gen/getentropy.c Wed Mar 21 01:15:45 2018 (r331279) @@ -0,0 +1,70 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Conrad Meyer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include + +#include "libc_private.h" + +int +getentropy(void *buf, size_t buflen) +{ + ssize_t rd; + + if (buflen > 256) { + errno = EIO; + return (-1); + } + + while (buflen > 0) { + rd = getrandom(buf, buflen, 0); + if (rd == -1) { + if (errno == EINTR) + continue; + else if (errno == ENOSYS) + abort(); + else + return (-1); + } + + /* This cannot happen. */ + if (rd == 0) + abort(); + + buf = (char *)buf + rd; + buflen -= rd; + } + + return (0); +} Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Tue Mar 20 23:08:42 2018 (r331278) +++ head/lib/libc/sys/Makefile.inc Wed Mar 21 01:15:45 2018 (r331279) @@ -197,6 +197,7 @@ MAN+= abort2.2 \ getpgrp.2 \ getpid.2 \ getpriority.2 \ + getrandom.2 \ getrlimit.2 \ getrusage.2 \ getsid.2 \ Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Tue Mar 20 23:08:42 2018 (r331278) +++ head/lib/libc/sys/Symbol.map Wed Mar 21 01:15:45 2018 (r331279) @@ -392,6 +392,7 @@ FBSD_1.5 { getdents; getdirentries; getfsstat; + getrandom; kevent; lstat; mknod; @@ -627,6 +628,8 @@ FBSDprivate_1.0 { __sys_getppid; _getpriority; __sys_getpriority; + _getrandom; + __sys_getrandom; _getresgid; __sys_getresgid; _getresuid; Added: head/lib/libc/sys/getrandom.2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/sys/getrandom.2 Wed Mar 21 01:15:45 2018 (r331279) @@ -0,0 +1,121 @@ +.\" Copyright (c) 2018 Conrad Meyer +.\" 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 AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd February 24, 2018 +.Dt GETRANDOM 2 +.Os +.Sh NAME +.Nm getrandom +.Nd get random data +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/random.h +.Ft ssize_t +.Fn getrandom "void *buf" "size_t buflen" "unsigned int flags" +.Sh DESCRIPTION +.Fn getrandom +fills +.Fa buf +with up to +.Fa buflen +bytes of random data. +.Pp +The +.Fa flags +argument may include zero or more of the following: +.Bl -tag -width _GRND_NONBLOCK_ +.It Ql GRND_NONBLOCK +Return +.Er EAGAIN +instead of blocking, if the +.Xr random 4 +device has not yet been seeded. +By default, +.Fn getrandom +will block until the device is seeded. +.It Ql GRND_RANDOM +This flag does nothing on +.Fx . +.Pa /dev/random +and +.Pa /dev/urandom +are identical. +.El +.Pp +If the +.Xr random 4 +device has been seeded, reads of up to 256 bytes will always return as many +bytes as requested and will not be interrupted by signals. +.Pp +.Sh RETURN VALUES +Upon successful completion, the number of bytes which were actually read is +returned. +For requests larger than 256 bytes, this can be fewer bytes than were +requested. +Otherwise, -1 is returned and the global variable +.Va errno +is set to indicate the error. +.Sh ERRORS +The +.Fn getrandom +operation returns the following errors: +.Bl -tag -width Er +.It Bq Er EAGAIN +The +.Ql GRND_NONBLOCK +flag was set and the +.Xr random 4 +device was not yet seeded. +.It Bq Er EFAULT +The +.Fa buf +parameter points to an invalid address. +.It Bq Er EINTR +The sleep was interrupted by a signal. +.It Bq Er EINVAL +An invalid +.Fa flags +was specified. +.It Bq Er EINVAL +The requested +.Fa buflen +was larger than +.Dv IOSIZE_MAX . +.El +.Sh SEE ALSO +.Xr arc4random 3 , +.Xr getentropy 3 , +.Xr random 4 +.Sh STANDARDS +.Fn getentropy +is non-standard. +It is present in Linux. +.Sh HISTORY +The +.Fn getrandom +system call first appeared in +.Fx 12.0 . Modified: head/lib/libc/tests/gen/Makefile ============================================================================== --- head/lib/libc/tests/gen/Makefile Tue Mar 20 23:08:42 2018 (r331278) +++ head/lib/libc/tests/gen/Makefile Wed Mar 21 01:15:45 2018 (r331279) @@ -10,6 +10,7 @@ ATF_TESTS_C+= fmtmsg_test ATF_TESTS_C+= fnmatch2_test ATF_TESTS_C+= fpclassify2_test ATF_TESTS_C+= ftw_test +ATF_TESTS_C+= getentropy_test ATF_TESTS_C+= getmntinfo_test ATF_TESTS_C+= glob2_test ATF_TESTS_C+= makecontext_test @@ -61,6 +62,8 @@ NETBSD_ATF_TESTS_C+= vis_test .include "../Makefile.netbsd-tests" +CFLAGS.getentropy_test+= -I${SRCTOP}/include +LIBADD.getentropy_test+= c LIBADD.humanize_number_test+= util LIBADD.fpclassify_test+=m Added: head/lib/libc/tests/gen/getentropy_test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/tests/gen/getentropy_test.c Wed Mar 21 01:15:45 2018 (r331279) @@ -0,0 +1,84 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Conrad Meyer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +ATF_TC_WITHOUT_HEAD(getentropy_count); +ATF_TC_BODY(getentropy_count, tc) +{ + char buf[2]; + int ret; + + /* getentropy(2) does not modify buf past the requested length */ + buf[1] = 0x7C; + ret = getentropy(buf, 1); + ATF_REQUIRE_EQ(ret, 0); + ATF_REQUIRE_EQ(buf[1], 0x7C); +} + +ATF_TC_WITHOUT_HEAD(getentropy_fault); +ATF_TC_BODY(getentropy_fault, tc) +{ + int ret; + + ret = getentropy(NULL, 1); + ATF_REQUIRE_EQ(ret, -1); + ATF_REQUIRE_EQ(errno, EFAULT); +} + +ATF_TC_WITHOUT_HEAD(getentropy_sizes); +ATF_TC_BODY(getentropy_sizes, tc) +{ + char buf[512]; + + ATF_REQUIRE_EQ(getentropy(buf, sizeof(buf)), -1); + ATF_REQUIRE_EQ(errno, EIO); + ATF_REQUIRE_EQ(getentropy(buf, 257), -1); + ATF_REQUIRE_EQ(errno, EIO); + + /* Smaller sizes always succeed: */ + ATF_REQUIRE_EQ(getentropy(buf, 256), 0); + ATF_REQUIRE_EQ(getentropy(buf, 128), 0); + ATF_REQUIRE_EQ(getentropy(buf, 0), 0); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, getentropy_count); + ATF_TP_ADD_TC(tp, getentropy_fault); + ATF_TP_ADD_TC(tp, getentropy_sizes); + return (atf_no_error()); +} Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Tue Mar 20 23:08:42 2018 (r331278) +++ head/sys/compat/freebsd32/syscalls.master Wed Mar 21 01:15:45 2018 (r331279) @@ -1116,5 +1116,7 @@ cpuwhich_t which, uint32_t id1, uint32_t id2, \ size_t domainsetsize, domainset_t *mask, \ int policy); } +563 AUE_NULL NOPROTO { int getrandom(void *buf, size_t buflen, \ + unsigned int flags); } ; vim: syntax=off Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Mar 20 23:08:42 2018 (r331278) +++ head/sys/conf/files Wed Mar 21 01:15:45 2018 (r331279) @@ -3895,6 +3895,7 @@ kern/subr_vmem.c standard kern/subr_witness.c optional witness kern/sys_capability.c standard kern/sys_generic.c standard +kern/sys_getrandom.c standard kern/sys_pipe.c standard kern/sys_procdesc.c standard kern/sys_process.c standard Added: head/sys/kern/sys_getrandom.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kern/sys_getrandom.c Wed Mar 21 01:15:45 2018 (r331279) @@ -0,0 +1,97 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Conrad Meyer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_compat.h" + +#include +#include +#include +#include +#include +#include +#include + +#define GRND_VALIDFLAGS (GRND_NONBLOCK | GRND_RANDOM) + +/* + * random_read_uio(9) returns EWOULDBLOCK if a nonblocking request would block, + * but the Linux API name is EAGAIN. On FreeBSD, they have the same numeric + * value for now. + */ +CTASSERT(EWOULDBLOCK == EAGAIN); + +static int +kern_getrandom(struct thread *td, void *user_buf, size_t buflen, + unsigned int flags) +{ + struct uio auio; + struct iovec aiov; + int error; + + if ((flags & ~GRND_VALIDFLAGS) != 0) + return (EINVAL); + if (buflen > IOSIZE_MAX) + return (EINVAL); + + if (buflen == 0) { + td->td_retval[0] = 0; + return (0); + } + + aiov.iov_base = user_buf; + aiov.iov_len = buflen; + auio.uio_iov = &aiov; + auio.uio_iovcnt = 1; + auio.uio_offset = 0; + auio.uio_resid = buflen; + auio.uio_segflg = UIO_USERSPACE; + auio.uio_rw = UIO_READ; + auio.uio_td = td; + + error = read_random_uio(&auio, (flags & GRND_NONBLOCK) != 0); + if (error == 0) + td->td_retval[0] = buflen - auio.uio_resid; + return (error); +} + +#ifndef _SYS_SYSPROTO_H_ +struct getrandom_args { + void *buf; + size_t buflen; + unsigned int flags; +}; +#endif + +int +sys_getrandom(struct thread *td, struct getrandom_args *uap) +{ + return (kern_getrandom(td, uap->buf, uap->buflen, uap->flags)); +} Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Tue Mar 20 23:08:42 2018 (r331278) +++ head/sys/kern/syscalls.master Wed Mar 21 01:15:45 2018 (r331279) @@ -1021,6 +1021,8 @@ cpuwhich_t which, id_t id, \ size_t domainsetsize, domainset_t *mask, \ int policy); } +563 AUE_NULL STD { int getrandom(void *buf, size_t buflen, \ + unsigned int flags); } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Modified: head/sys/sys/random.h ============================================================================== --- head/sys/sys/random.h Tue Mar 20 23:08:42 2018 (r331278) +++ head/sys/sys/random.h Wed Mar 21 01:15:45 2018 (r331279) @@ -31,10 +31,10 @@ #ifndef _SYS_RANDOM_H_ #define _SYS_RANDOM_H_ -#ifdef _KERNEL - #include +#ifdef _KERNEL + #if !defined(KLD_MODULE) #if defined(RANDOM_LOADABLE) && defined(RANDOM_YARROW) #error "Cannot define both RANDOM_LOADABLE and RANDOM_YARROW" @@ -126,5 +126,9 @@ void random_harvest_deregister_source(enum random_entr #endif /* defined(RANDOM_ENABLE_UMA) */ #endif /* _KERNEL */ + +#define GRND_NONBLOCK 0x1 +#define GRND_RANDOM 0x2 +ssize_t getrandom(void *buf, size_t buflen, unsigned int flags); #endif /* _SYS_RANDOM_H_ */ Modified: head/tests/sys/kern/Makefile ============================================================================== --- head/tests/sys/kern/Makefile Tue Mar 20 23:08:42 2018 (r331278) +++ head/tests/sys/kern/Makefile Wed Mar 21 01:15:45 2018 (r331279) @@ -11,6 +11,7 @@ ATF_TESTS_C+= ptrace_test TEST_METADATA.ptrace_test+= timeout="15" ATF_TESTS_C+= reaper PLAIN_TESTS_C+= subr_unit_test +ATF_TESTS_C+= sys_getrandom ATF_TESTS_C+= unix_seqpacket_test ATF_TESTS_C+= unix_passfd_test TEST_METADATA.unix_seqpacket_test+= timeout="15" @@ -21,6 +22,10 @@ ATF_TESTS_SH+= coredump_phnum_test BINDIR= ${TESTSDIR} PROGS+= coredump_phnum_helper +CFLAGS.sys_getrandom+= -I${SRCTOP}/sys/contrib/zstd/lib +LIBADD.sys_getrandom+= zstd +LIBADD.sys_getrandom+= c +LIBADD.sys_getrandom+= pthread LIBADD.ptrace_test+= pthread LIBADD.unix_seqpacket_test+= pthread Added: head/tests/sys/kern/sys_getrandom.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/kern/sys_getrandom.c Wed Mar 21 01:15:45 2018 (r331279) @@ -0,0 +1,130 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Conrad Meyer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +#include + +const static unsigned valid_flags[] = { 0, GRND_NONBLOCK, GRND_RANDOM, + GRND_NONBLOCK | GRND_RANDOM }; + +ATF_TC_WITHOUT_HEAD(getrandom_randomness); +ATF_TC_BODY(getrandom_randomness, tc) +{ + char randomb[4096], compressed[5000]; + ssize_t ret; + size_t i, j, c; + unsigned mode; + + for (i = 0; i < nitems(valid_flags); i++) { + mode = valid_flags[i]; + + /* Get new random data, filling randomb. */ + + memset(randomb, 0, sizeof(randomb)); + + for (j = 0; j < sizeof(randomb);) { + ret = getrandom(&randomb[j], sizeof(randomb) - j, mode); + if (ret < 0 && (mode & GRND_NONBLOCK) != 0 && + errno == EAGAIN) + continue; + + ATF_REQUIRE_MSG(ret >= 0, "other error: %d", errno); + ATF_REQUIRE_MSG(ret > 0, "bogus zero return"); + + j += (size_t)ret; + } + + /* Perform compressibility test */ + c = ZSTD_compress(compressed, sizeof(compressed), randomb, + sizeof(randomb), ZSTD_maxCLevel()); + ATF_REQUIRE_MSG(!ZSTD_isError(c), "zstd compress: %s", + ZSTD_getErrorName(c)); + + /* + * If the output is very compressible, it's probably not random + */ + ATF_REQUIRE_MSG(c > (sizeof(randomb) * 4 / 5), + "purportedly random data was compressible: %zu/%zu or %f%%", + c, sizeof(randomb), (double)c / (double)sizeof(randomb)); + } +} + +ATF_TC_WITHOUT_HEAD(getrandom_fault); +ATF_TC_BODY(getrandom_fault, tc) +{ + ssize_t ret; + + ret = getrandom(NULL, 1, 0); + ATF_REQUIRE_EQ(ret, -1); + ATF_REQUIRE_EQ(errno, EFAULT); +} + +ATF_TC_WITHOUT_HEAD(getrandom_count); +ATF_TC_BODY(getrandom_count, tc) +{ + char buf[4096], reference[4096]; + ssize_t ret; + + /* getrandom(2) does not modify buf past the requested length */ + _Static_assert(sizeof(reference) == sizeof(buf), "must match"); + memset(reference, 0x7C, sizeof(reference)); + + memset(buf, 0x7C, sizeof(buf)); + ret = getrandom(buf, 1, 0); + ATF_REQUIRE_EQ(ret, 1); + ATF_REQUIRE_EQ(memcmp(&buf[1], reference, sizeof(reference) - 1), 0); + + memset(buf, 0x7C, sizeof(buf)); + ATF_REQUIRE_EQ(getrandom(buf, 15, 0), 15); + ATF_REQUIRE_EQ(memcmp(&buf[15], reference, sizeof(reference) - 15), 0); + + memset(buf, 0x7C, sizeof(buf)); + ATF_REQUIRE_EQ(getrandom(buf, 255, 0), 255); + ATF_REQUIRE_EQ(memcmp(&buf[255], reference, sizeof(reference) - 255), 0); + + memset(buf, 0x7C, sizeof(buf)); + ATF_REQUIRE_EQ(getrandom(buf, 4095, 0), 4095); + ATF_REQUIRE_EQ(memcmp(&buf[4095], reference, sizeof(reference) - 4095), 0); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, getrandom_count); + ATF_TP_ADD_TC(tp, getrandom_fault); + ATF_TP_ADD_TC(tp, getrandom_randomness); + return (atf_no_error()); +} Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Tue Mar 20 23:08:42 2018 (r331278) +++ head/usr.bin/truss/syscalls.c Wed Mar 21 01:15:45 2018 (r331279) @@ -259,6 +259,8 @@ static struct syscall decoded_syscalls[] = { .args = { { Int, 0 } } }, { .name = "getpriority", .ret_type = 1, .nargs = 2, .args = { { Priowhich, 0 }, { Int, 1 } } }, + { .name = "getrandom", .ret_type = 1, .nargs = 3, + .args = { { BinString | OUT, 0 }, { Sizet, 1 }, { UInt, 2 } } }, { .name = "getrlimit", .ret_type = 1, .nargs = 2, .args = { { Resource, 0 }, { Rlimit | OUT, 1 } } }, { .name = "getrusage", .ret_type = 1, .nargs = 2, From owner-svn-src-head@freebsd.org Wed Mar 21 01:17:03 2018 Return-Path: Delivered-To: svn-src-head@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 225CFF5D1C3; Wed, 21 Mar 2018 01:17:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 C7B9573E96; Wed, 21 Mar 2018 01:17:02 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C29E724406; Wed, 21 Mar 2018 01:17:02 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2L1H2ws084824; Wed, 21 Mar 2018 01:17:02 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L1H1C7084812; Wed, 21 Mar 2018 01:17:01 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803210117.w2L1H1C7084812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 01:17:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331280 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: compat/freebsd32 kern sys X-SVN-Commit-Revision: 331280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 01:17:03 -0000 Author: cem Date: Wed Mar 21 01:17:01 2018 New Revision: 331280 URL: https://svnweb.freebsd.org/changeset/base/331280 Log: Regenerate sysent files after r331279. Modified: head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Wed Mar 21 01:17:01 2018 (r331280) @@ -468,4 +468,5 @@ #define FREEBSD32_SYS_freebsd32_kevent 560 #define FREEBSD32_SYS_freebsd32_cpuset_getdomain 561 #define FREEBSD32_SYS_freebsd32_cpuset_setdomain 562 -#define FREEBSD32_SYS_MAXSYSCALL 563 +#define FREEBSD32_SYS_getrandom 563 +#define FREEBSD32_SYS_MAXSYSCALL 564 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Wed Mar 21 01:17:01 2018 (r331280) @@ -595,4 +595,5 @@ const char *freebsd32_syscallnames[] = { "freebsd32_kevent", /* 560 = freebsd32_kevent */ "freebsd32_cpuset_getdomain", /* 561 = freebsd32_cpuset_getdomain */ "freebsd32_cpuset_setdomain", /* 562 = freebsd32_cpuset_setdomain */ + "getrandom", /* 563 = getrandom */ }; Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Wed Mar 21 01:17:01 2018 (r331280) @@ -644,4 +644,5 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_kevent_args), (sy_call_t *)freebsd32_kevent, AUE_KEVENT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 560 = freebsd32_kevent */ { AS(freebsd32_cpuset_getdomain_args), (sy_call_t *)freebsd32_cpuset_getdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 561 = freebsd32_cpuset_getdomain */ { AS(freebsd32_cpuset_setdomain_args), (sy_call_t *)freebsd32_cpuset_setdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 562 = freebsd32_cpuset_setdomain */ + { AS(getrandom_args), (sy_call_t *)sys_getrandom, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 563 = getrandom */ }; Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Mar 21 01:17:01 2018 (r331280) @@ -3274,6 +3274,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 7; break; } + /* getrandom */ + case 563: { + struct getrandom_args *p = params; + uarg[0] = (intptr_t) p->buf; /* void * */ + uarg[1] = p->buflen; /* size_t */ + uarg[2] = p->flags; /* unsigned int */ + *n_args = 3; + break; + } default: *n_args = 0; break; @@ -8800,6 +8809,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* getrandom */ + case 563: + switch(ndx) { + case 0: + p = "userland void *"; + break; + case 1: + p = "size_t"; + break; + case 2: + p = "unsigned int"; + break; + default: + break; + }; + break; default: break; }; @@ -10648,6 +10673,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char * break; /* freebsd32_cpuset_setdomain */ case 562: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* getrandom */ + case 563: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/kern/init_sysent.c Wed Mar 21 01:17:01 2018 (r331280) @@ -614,4 +614,5 @@ struct sysent sysent[] = { { AS(kevent_args), (sy_call_t *)sys_kevent, AUE_KEVENT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 560 = kevent */ { AS(cpuset_getdomain_args), (sy_call_t *)sys_cpuset_getdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 561 = cpuset_getdomain */ { AS(cpuset_setdomain_args), (sy_call_t *)sys_cpuset_setdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 562 = cpuset_setdomain */ + { AS(getrandom_args), (sy_call_t *)sys_getrandom, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 563 = getrandom */ }; Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/kern/syscalls.c Wed Mar 21 01:17:01 2018 (r331280) @@ -569,4 +569,5 @@ const char *syscallnames[] = { "kevent", /* 560 = kevent */ "cpuset_getdomain", /* 561 = cpuset_getdomain */ "cpuset_setdomain", /* 562 = cpuset_setdomain */ + "getrandom", /* 563 = getrandom */ }; Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/kern/systrace_args.c Wed Mar 21 01:17:01 2018 (r331280) @@ -3282,6 +3282,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 6; break; } + /* getrandom */ + case 563: { + struct getrandom_args *p = params; + uarg[0] = (intptr_t) p->buf; /* void * */ + uarg[1] = p->buflen; /* size_t */ + uarg[2] = p->flags; /* unsigned int */ + *n_args = 3; + break; + } default: *n_args = 0; break; @@ -8752,6 +8761,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* getrandom */ + case 563: + switch(ndx) { + case 0: + p = "userland void *"; + break; + case 1: + p = "size_t"; + break; + case 2: + p = "unsigned int"; + break; + default: + break; + }; + break; default: break; }; @@ -10635,6 +10660,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char * break; /* cpuset_setdomain */ case 562: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* getrandom */ + case 563: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/sys/syscall.h Wed Mar 21 01:17:01 2018 (r331280) @@ -478,4 +478,5 @@ #define SYS_kevent 560 #define SYS_cpuset_getdomain 561 #define SYS_cpuset_setdomain 562 -#define SYS_MAXSYSCALL 563 +#define SYS_getrandom 563 +#define SYS_MAXSYSCALL 564 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/sys/syscall.mk Wed Mar 21 01:17:01 2018 (r331280) @@ -405,4 +405,5 @@ MIASM = \ mknodat.o \ kevent.o \ cpuset_getdomain.o \ - cpuset_setdomain.o + cpuset_setdomain.o \ + getrandom.o Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Wed Mar 21 01:15:45 2018 (r331279) +++ head/sys/sys/sysproto.h Wed Mar 21 01:17:01 2018 (r331280) @@ -1768,6 +1768,11 @@ struct cpuset_setdomain_args { char mask_l_[PADL_(domainset_t *)]; domainset_t * mask; char mask_r_[PADR_(domainset_t *)]; char policy_l_[PADL_(int)]; int policy; char policy_r_[PADR_(int)]; }; +struct getrandom_args { + char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)]; + char buflen_l_[PADL_(size_t)]; size_t buflen; char buflen_r_[PADR_(size_t)]; + char flags_l_[PADL_(unsigned int)]; unsigned int flags; char flags_r_[PADR_(unsigned int)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_sys_exit(struct thread *, struct sys_exit_args *); int sys_fork(struct thread *, struct fork_args *); @@ -2148,6 +2153,7 @@ int sys_mknodat(struct thread *, struct mknodat_args * int sys_kevent(struct thread *, struct kevent_args *); int sys_cpuset_getdomain(struct thread *, struct cpuset_getdomain_args *); int sys_cpuset_setdomain(struct thread *, struct cpuset_setdomain_args *); +int sys_getrandom(struct thread *, struct getrandom_args *); #ifdef COMPAT_43 @@ -3040,6 +3046,7 @@ int freebsd11_mknodat(struct thread *, struct freebsd1 #define SYS_AUE_kevent AUE_KEVENT #define SYS_AUE_cpuset_getdomain AUE_NULL #define SYS_AUE_cpuset_setdomain AUE_NULL +#define SYS_AUE_getrandom AUE_NULL #undef PAD_ #undef PADL_ From owner-svn-src-head@freebsd.org Wed Mar 21 01:40:55 2018 Return-Path: Delivered-To: svn-src-head@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 A3C0BF5EB6F for ; Wed, 21 Mar 2018 01:40:55 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E89274F3B for ; Wed, 21 Mar 2018 01:40:55 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: bf2f9271-2ca8-11e8-b951-f99fef315fd9 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id bf2f9271-2ca8-11e8-b951-f99fef315fd9; Wed, 21 Mar 2018 01:39:51 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w2L1epIj041495; Tue, 20 Mar 2018 19:40:51 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1521596451.54965.39.camel@freebsd.org> Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss From: Ian Lepore To: Conrad Meyer , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Tue, 20 Mar 2018 19:40:51 -0600 In-Reply-To: <201803210115.w2L1Fjt9084698@repo.freebsd.org> References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 01:40:55 -0000 On Wed, 2018-03-21 at 01:15 +0000, Conrad Meyer wrote: > Author: cem > Date: Wed Mar 21 01:15:45 2018 > New Revision: 331279 > URL: https://svnweb.freebsd.org/changeset/base/331279 > > Log: >   Implement getrandom(2) and getentropy(3) >    >   The general idea here is to provide userspace programs with well- > defined >   sources of entropy, in a fashion that doesn't require opening a new > file >   descriptor (ulimits) or accessing paths (/dev/urandom may be > restricted >   by chroot or capsicum). >    >   getrandom(2) is the more general API, and comes from the Linux > world. >   Since our urandom and random devices are identical, the GRND_RANDOM > flag >   is ignored. >    >   getentropy(3) is added as a compatibility shim for the OpenBSD API. >    >   truss(1) support is included. >    >   Tests for both system calls are provided.  Coverage is believed to > be at >   least as comprehensive as LTP getrandom(2) test > coverage.  Additionally, >   instructions for running the LTP tests directly against FreeBSD are > provided >   in the "Test Plan" section of the Differential revision linked > below.  (They >   pass, of course.) >    >   PR: 194204 >   Reported by: David CARLIER hardenedbsd.org> >   Discussed with: cperciva, delphij, jhb, markj >   Relnotes: maybe >   Differential Revision: https://reviews.freebsd.org/D14500 > A good followup to this might be to switch libc's arc4random seeding to getrandom(), instead of using a sysctl in a loop. -- Ian From owner-svn-src-head@freebsd.org Wed Mar 21 01:47:18 2018 Return-Path: Delivered-To: svn-src-head@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 92B24F5F202 for ; Wed, 21 Mar 2018 01:47:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x234.google.com (mail-it0-x234.google.com [IPv6:2607:f8b0:4001:c0b::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 28090752CA for ; Wed, 21 Mar 2018 01:47:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x234.google.com with SMTP id b136-v6so4906975iti.3 for ; Tue, 20 Mar 2018 18:47:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=idDyOhCQ7P43LV3Jz2315nb5fh2fNRMNSAN0D7sg8Vw=; b=h0q6iYawrO4VNxPgw/t57IoHpp+/2//GncFR87kocYf83JIedd+F/eyaMdgA6RXUea 7T4PnS0HyWIvi7MIYTkTUTpqp1MF1oTzX7vYbMlVisusIQK91qjG9Nl2luxfz7Ey3bR4 OSzJtI9bs1t1Uvs/ElcITfc//UYQ3GVAMoEh3Kbu5kM+SyWn+i5XK1UFaK/LQgSJLd4H jVcv0T9A8RevaKMqSZHRiaGm24BvWb02fNy0XXbPe2c0PuqvUatR1Ac3WFBhE0YV+DnF ct3kUWAwvJF/7lGv7/zXPHUupu41o4N7SvWCt9GxAmJwIB5xHZvWIQ33LXZ1u8rXvbuZ DbuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=idDyOhCQ7P43LV3Jz2315nb5fh2fNRMNSAN0D7sg8Vw=; b=OwRRZeiXt4TIS4wKkTitMKLdYpj5BN4Y40yI/bJOeoRNeuCkFmRRDQFBlQwN54Dffr HERXBUyS4qV7cjNvp3lB09XGMOO6EsBwgDJR5aeAinfvM1aXhs3J3Zl8JJM8u26/iDW1 iXIvdu3vnQ11CQAiYD9zsCKEyEscFNWhv3/9YqhhYJbmZsi8y6CJgsAic1WFhNpiSSP4 ELExblk//d9PqGEjJULDkGLKJir5drVbPYSKJI3F9LiVshos+0tugsNqD6JedYRw7W8b KgobyLN7AtdfWOnJ9OoWcQsVjSomhORIRSzFurQFDUa+HH/d5IsHJdxDDemYxiPCMRS/ xJvw== X-Gm-Message-State: AElRT7Fx9kf6dZ10CIIPAg7HzLF5RDRNz5LdW/LeAedPJmFJ83ZIsUiU Ee2gc+P5EL6RZIzT6AejpOLMUkKWj8h2mGbQMkIxAA== X-Google-Smtp-Source: AG47ELtiK3GzNETt/93zcRGgBP6NO+ta7fFABIm096L/ChwOJ+hd9S4KG9HuXLJFJ4+0fclE7S8VSLX+z9PKovqR7cU= X-Received: by 2002:a24:fa83:: with SMTP id v125-v6mr2233138ith.36.1521596837284; Tue, 20 Mar 2018 18:47:17 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Tue, 20 Mar 2018 18:47:15 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:b173:8715:8433:2600] Received: by 10.79.203.196 with HTTP; Tue, 20 Mar 2018 18:47:15 -0700 (PDT) In-Reply-To: <201803210057.w2L0vM2m019008@pdx.rh.CN85.dnsmgr.net> References: <201803202137.w2KLbXrp071489@repo.freebsd.org> <201803210057.w2L0vM2m019008@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Tue, 20 Mar 2018 19:47:15 -0600 X-Google-Sender-Auth: PDtuU3Z4C26CcGRaVH6Cu9usJx0 Message-ID: Subject: Re: svn commit: r331269 - head/share/man/man9 To: "Rodney W. Grimes" Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 01:47:18 -0000 On Mar 20, 2018 6:57 PM, "Rodney W. Grimes" wrote: > Author: imp > Date: Tue Mar 20 21:37:33 2018 > New Revision: 331269 > URL: https://svnweb.freebsd.org/changeset/base/331269 > > Log: > Remove reference to lint. We no longer support it, so exceptions for > it are no longer relevant. I still believe this is putting the cart before the horse: /usr/src # find . -print0 | xargs -0 grep "ifndef lint" | wc 1228 2459 48568 Perhaps yes, perhaps no. They are slowly being eliminated and no new lint code. It's time. Warner > Modified: > head/share/man/man9/style.9 > > Modified: head/share/man/man9/style.9 > ============================================================ ================== > --- head/share/man/man9/style.9 Tue Mar 20 21:36:35 2018 (r331268) > +++ head/share/man/man9/style.9 Tue Mar 20 21:37:33 2018 (r331269) > @@ -107,11 +107,7 @@ Only add > .Dq Li "From: " > in front of foreign VCS IDs if the file is renamed. > .Bd -literal > -#if 0 > -#ifndef lint > -static char sccsid[] = "@(#)style 1.14 (Berkeley) 4/28/95"; > -#endif /* not lint */ > -#endif > +/* From: @(#)style 1.14 (Berkeley) 4/28/95 */ > > #include > __FBSDID("$FreeBSD$"); > @@ -234,10 +230,6 @@ This comment should be used only for (subjectively) lo > greater than 20 lines, or where a series of nested > .Ic #ifdef 's > may be confusing to the reader. > -Exceptions may be made for cases where code is conditionally not compiled for > -the purposes of > -.Xr lint 1 , > -even though the uncompiled region may be small. > The comment should be separated from the > .Ic #endif > or > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Mar 21 01:51:46 2018 Return-Path: Delivered-To: svn-src-head@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 34FC9F5F816; Wed, 21 Mar 2018 01:51:46 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9872A755D4; Wed, 21 Mar 2018 01:51:44 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w2L1peHt019278; Tue, 20 Mar 2018 18:51:40 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w2L1pelA019277; Tue, 20 Mar 2018 18:51:40 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201803210151.w2L1pelA019277@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r331269 - head/share/man/man9 In-Reply-To: To: Warner Losh Date: Tue, 20 Mar 2018 18:51:40 -0700 (PDT) CC: "Rodney W. Grimes" , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 01:51:46 -0000 > > On Mar 20, 2018 6:57 PM, "Rodney W. Grimes" > > wrote: > > > > > Author: imp > > > Date: Tue Mar 20 21:37:33 2018 > > > New Revision: 331269 > > > URL: https://svnweb.freebsd.org/changeset/base/331269 > > > > > > Log: > > > Remove reference to lint. We no longer support it, so exceptions for > > > it are no longer relevant. > > > > I still believe this is putting the cart before the horse: > > /usr/src # find . -print0 | xargs -0 grep "ifndef lint" | wc > > 1228 2459 48568 > > > > Perhaps yes, perhaps no. They are slowly being eliminated and no new lint > code. It's time. You will find that there is much of this in contrib, so it will not be so easy to eliminate. And again, your email client is not quoting properly, I have re-quoted it. > Warner > > > Modified: > > head/share/man/man9/style.9 > > > > Modified: head/share/man/man9/style.9 > > ============================================================ > ================== > > --- head/share/man/man9/style.9 Tue Mar 20 21:36:35 2018 > (r331268) > > +++ head/share/man/man9/style.9 Tue Mar 20 21:37:33 2018 > (r331269) > > @@ -107,11 +107,7 @@ Only add > > .Dq Li "From: " > > in front of foreign VCS IDs if the file is renamed. > > .Bd -literal > > -#if 0 > > -#ifndef lint > > -static char sccsid[] = "@(#)style 1.14 (Berkeley) 4/28/95"; > > -#endif /* not lint */ > > -#endif > > +/* From: @(#)style 1.14 (Berkeley) 4/28/95 */ > > > > #include > > __FBSDID("$FreeBSD$"); > > @@ -234,10 +230,6 @@ This comment should be used only for (subjectively) > lo > > greater than 20 lines, or where a series of nested > > .Ic #ifdef 's > > may be confusing to the reader. > > -Exceptions may be made for cases where code is conditionally not > compiled for > > -the purposes of > > -.Xr lint 1 , > > -even though the uncompiled region may be small. > > The comment should be separated from the > > .Ic #endif > > or > > > > > > -- > Rod Grimes > rgrimes@freebsd.org -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Mar 21 03:07:17 2018 Return-Path: Delivered-To: svn-src-head@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 A29FAF64229; Wed, 21 Mar 2018 03:07:17 +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 57DB977F82; Wed, 21 Mar 2018 03:07:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C4EF254FE; Wed, 21 Mar 2018 03:07:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2L37HmW041097; Wed, 21 Mar 2018 03:07:17 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L37Gnp041093; Wed, 21 Mar 2018 03:07:16 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803210307.w2L37Gnp041093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 03:07:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331281 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331281 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 03:07:17 -0000 Author: kevans Date: Wed Mar 21 03:07:16 2018 New Revision: 331281 URL: https://svnweb.freebsd.org/changeset/base/331281 Log: lualoader: Add primitive hook module, use it to untangle bogus reference See: comments in the hook module about intended usage, as well as the introduced use for config.reloaded. Use the newly introduced hook module to define a "config.reloaded" hook. This is currently used to register core's clearKernelCache as a reload hook to avoid a circular dependency and fix this functionality- it didn't actually work out, and it isn't immediately obvious how it slipped into src. Other hook types will be introduced into the core lualoader as useful hook points are identified. Added: head/stand/lua/hook.lua (contents, props changed) Modified: head/stand/lua/Makefile head/stand/lua/config.lua head/stand/lua/core.lua Modified: head/stand/lua/Makefile ============================================================================== --- head/stand/lua/Makefile Wed Mar 21 01:17:01 2018 (r331280) +++ head/stand/lua/Makefile Wed Mar 21 03:07:16 2018 (r331281) @@ -8,6 +8,7 @@ FILES= cli.lua \ config.lua \ core.lua \ drawer.lua \ + hook.lua \ loader.lua \ menu.lua \ password.lua \ Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Wed Mar 21 01:17:01 2018 (r331280) +++ head/stand/lua/config.lua Wed Mar 21 03:07:16 2018 (r331281) @@ -29,6 +29,8 @@ -- $FreeBSD$ -- +local hook = require("hook") + local config = {} local modules = {} local carousel_choices = {} @@ -503,7 +505,7 @@ function config.reload(file) modules = {} config.restoreEnv() config.load(file) - core.configReloaded() + hook.runAll("config.reloaded") end function config.loadelf() @@ -523,4 +525,5 @@ function config.loadelf() end end +hook.registerType("config.reloaded") return config Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Wed Mar 21 01:17:01 2018 (r331280) +++ head/stand/lua/core.lua Wed Mar 21 03:07:16 2018 (r331281) @@ -30,6 +30,7 @@ -- local config = require("config") +local hook = require("hook") local core = {} @@ -138,7 +139,7 @@ function core.setSafeMode(safe_mode) core.sm = safe_mode end -function core.configReloaded() +function core.clearCachedKernels() -- Clear the kernel cache on config changes, autodetect might have -- changed or if we've switched boot environments then we could have -- a new kernel set. @@ -364,4 +365,6 @@ end if core.isSystem386() and core.getACPIPresent(false) then core.setACPI(true) end + +hook.register("config.reloaded", core.clearCachedKernels) return core Added: head/stand/lua/hook.lua ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/lua/hook.lua Wed Mar 21 03:07:16 2018 (r331281) @@ -0,0 +1,84 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2018 Kyle Evans +-- 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$ +-- + +local hook = {} + +local registered_hooks = {} + +-- Module exports +-- Register a hook type; these are the names that hooks may be registered for. +-- It is expected that modules will register all of their hook types upon +-- initial load. Other modules may then, at any time, register a hook for these +-- types. +-- +-- Naming convention: hook types should be sensible named, preferably prefixed +-- with the name of the module that registered them. They would also ideally +-- describe an action that may or may not match a function name. +-- e.g. config.reloaded which takes place after config has been reloaded, +-- possibly from a different source. +function hook.registerType(hooktype) + registered_hooks[hooktype] = {} +end + +function hook.register(hooktype, hookfunc) + local selected_hooks = registered_hooks[hooktype] + if selected_hooks == nil then + print("Tried registering a hook for an unknown hook type: " .. + hooktype) + return + end + selected_hooks[#selected_hooks + 1] = hookfunc + registered_hooks[hooktype] = selected_hooks +end + +-- Takes a hooktype and runs all functions associated with that specific hook +-- type in the order that they were registered in. This ordering should likely +-- not be relied upon. +function hook.runAll(hooktype) + local selected_hooks = registered_hooks[hooktype] + if selected_hooks == nil then + -- This message, and the print() above, should only be seen by + -- developers. Hook type registration should have happened at + -- module load, so if this hasn't happened then we have messed + -- up the order in which we've loaded modules and we need to + -- catch that as soon as possible. + print("Tried to run hooks for an unknown hook type: " .. + hooktype) + return 0 + end + if #selected_hooks > 0 then + for _, func in ipairs(selected_hooks) do + func() + end + end + return #selected_hooks +end + +return hook From owner-svn-src-head@freebsd.org Wed Mar 21 03:16:15 2018 Return-Path: Delivered-To: svn-src-head@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 0E29FF64BDA; Wed, 21 Mar 2018 03:16:15 +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 AF5BF7858F; Wed, 21 Mar 2018 03:16:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A9FB925684; Wed, 21 Mar 2018 03:16:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2L3GENe045919; Wed, 21 Mar 2018 03:16:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L3GEYF045918; Wed, 21 Mar 2018 03:16:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803210316.w2L3GEYF045918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 03:16:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331282 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331282 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 03:16:15 -0000 Author: kevans Date: Wed Mar 21 03:16:14 2018 New Revision: 331282 URL: https://svnweb.freebsd.org/changeset/base/331282 Log: core.lua(8): Update to reflect recently added function clearCachedKernels Modified: head/stand/lua/core.lua.8 Modified: head/stand/lua/core.lua.8 ============================================================================== --- head/stand/lua/core.lua.8 Wed Mar 21 03:07:16 2018 (r331281) +++ head/stand/lua/core.lua.8 Wed Mar 21 03:16:14 2018 (r331282) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 2, 2018 +.Dd March 21, 2018 .Dt CORE.LUA 8 .Os .Sh NAME @@ -138,6 +138,16 @@ and If .Fa safeMode is omitted, toggle the current safe mode setting. +.It Fn core.clearCachedKernels +Clears out the cache of kernels to be displayed on the boot menu. +This function is registered as a +.Ev config.reloaded +hook. +It is used to invalidate the kernel list whenever it may have changed, either +due to a boot environment change or a potential change in either +.Ic kernel +or +.Ic kernels . .It Fn core.kernelList Returns a table of kernels to display on the boot menu. This will combine From owner-svn-src-head@freebsd.org Wed Mar 21 03:43:41 2018 Return-Path: Delivered-To: svn-src-head@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 E5FB1F669A6; Wed, 21 Mar 2018 03:43:40 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 8EF987959B; Wed, 21 Mar 2018 03:43:40 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89EDF25B1D; Wed, 21 Mar 2018 03:43:40 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2L3heRn060590; Wed, 21 Mar 2018 03:43:40 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L3heB7060589; Wed, 21 Mar 2018 03:43:40 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803210343.w2L3heB7060589@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 03:43:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331283 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331283 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 03:43:41 -0000 Author: cem Date: Wed Mar 21 03:43:40 2018 New Revision: 331283 URL: https://svnweb.freebsd.org/changeset/base/331283 Log: Add missed sys/limits.h include Apparently header pollution on x86 hid its absense. Sorry, other arch users. Fix the missed header introduced in r331279. Reported by: tinderbox Modified: head/sys/kern/sys_getrandom.c Modified: head/sys/kern/sys_getrandom.c ============================================================================== --- head/sys/kern/sys_getrandom.c Wed Mar 21 03:16:14 2018 (r331282) +++ head/sys/kern/sys_getrandom.c Wed Mar 21 03:43:40 2018 (r331283) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include From owner-svn-src-head@freebsd.org Wed Mar 21 04:44:20 2018 Return-Path: Delivered-To: svn-src-head@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 4931CF6A6B9; Wed, 21 Mar 2018 04:44:20 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 E11257B5D4; Wed, 21 Mar 2018 04:44:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CDE452641D; Wed, 21 Mar 2018 04:44:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2L4iJwd090558; Wed, 21 Mar 2018 04:44:19 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L4iJaJ090557; Wed, 21 Mar 2018 04:44:19 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803210444.w2L4iJaJ090557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 04:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331284 - head/tests/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/tests/sys/kern X-SVN-Commit-Revision: 331284 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 04:44:20 -0000 Author: cem Date: Wed Mar 21 04:44:19 2018 New Revision: 331284 URL: https://svnweb.freebsd.org/changeset/base/331284 Log: Appease GCC 4.2 It mistakenly believes the 'static' keyword must come first. Fix PPC, Sparc64, and maybe MIPS world. Fallout from r331279. Reported by: tinderbox (results come slowly) Modified: head/tests/sys/kern/sys_getrandom.c Modified: head/tests/sys/kern/sys_getrandom.c ============================================================================== --- head/tests/sys/kern/sys_getrandom.c Wed Mar 21 03:43:40 2018 (r331283) +++ head/tests/sys/kern/sys_getrandom.c Wed Mar 21 04:44:19 2018 (r331284) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #include -const static unsigned valid_flags[] = { 0, GRND_NONBLOCK, GRND_RANDOM, +static const unsigned valid_flags[] = { 0, GRND_NONBLOCK, GRND_RANDOM, GRND_NONBLOCK | GRND_RANDOM }; ATF_TC_WITHOUT_HEAD(getrandom_randomness); From owner-svn-src-head@freebsd.org Wed Mar 21 05:40:47 2018 Return-Path: Delivered-To: svn-src-head@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 418A4F4A568; Wed, 21 Mar 2018 05:40:47 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 93E0B7CF83; Wed, 21 Mar 2018 05:40:46 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 115F04284A7; Wed, 21 Mar 2018 16:40:38 +1100 (AEDT) Date: Wed, 21 Mar 2018 16:40:38 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331269 - head/share/man/man9 In-Reply-To: <201803202137.w2KLbXrp071489@repo.freebsd.org> Message-ID: <20180321160918.T1241@besplex.bde.org> References: <201803202137.w2KLbXrp071489@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=0GwoL8mGeRctihYA72gA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 05:40:47 -0000 On Tue, 20 Mar 2018, Warner Losh wrote: > Log: > Remove reference to lint. We no longer support it, so exceptions for > it are no longer relevant. > ... > Modified: head/share/man/man9/style.9 > ============================================================================== > --- head/share/man/man9/style.9 Tue Mar 20 21:36:35 2018 (r331268) > +++ head/share/man/man9/style.9 Tue Mar 20 21:37:33 2018 (r331269) > @@ -107,11 +107,7 @@ Only add > .Dq Li "From: " > in front of foreign VCS IDs if the file is renamed. > .Bd -literal > -#if 0 > -#ifndef lint > -static char sccsid[] = "@(#)style 1.14 (Berkeley) 4/28/95"; > -#endif /* not lint */ > -#endif > +/* From: @(#)style 1.14 (Berkeley) 4/28/95 */ This breaks the example for non-lint things in it. The description still gives the rule for adding '#if 0 ... #endif'. The example is technically partly correct, though not what is intended. The original file named 'style' doesn't have "static char sccsid[] ...". It had the sccsid in a comment, and still has it there, in the same position in the file. The char array was added to give an example of using '#if 0 ... #endif'. This change adds another copy of the comment, edited this time. This gives an example of adding "From: ". The rule says to add "From: " only if the file name changed (it should say to add it iff the file path changed and/or the current VCS doesn't have the file's history back to the version with the sccsid). This is not quite right, since the comment is duplicated, once without the editing suggested by the rule, and once with it but with the larger editing of moving the example. There is a similar self-reference problem for the FreeBSD id. $FreeBSD$ occurs twice, once in a comment and once just after the above. Duplicating it is a style bug, but there is no rule saying this so the meta-rule that style(9) gives rules by example says the opposite. Bruce From owner-svn-src-head@freebsd.org Wed Mar 21 09:07:02 2018 Return-Path: Delivered-To: svn-src-head@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 0F1B7F56161; Wed, 21 Mar 2018 09:07:02 +0000 (UTC) (envelope-from eadler@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 B070084753; Wed, 21 Mar 2018 09:07:01 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 AAC4C28B31; Wed, 21 Mar 2018 09:07:01 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2L971Vb021772; Wed, 21 Mar 2018 09:07:01 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L971P4021771; Wed, 21 Mar 2018 09:07:01 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803210907.w2L971P4021771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Wed, 21 Mar 2018 09:07:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331285 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 331285 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 09:07:02 -0000 Author: eadler Date: Wed Mar 21 09:07:01 2018 New Revision: 331285 URL: https://svnweb.freebsd.org/changeset/base/331285 Log: [bsd-family-tree] Announce NetBSD 7.1.2 MFC After: 3 days Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Wed Mar 21 04:44:19 2018 (r331284) +++ head/share/misc/bsd-family-tree Wed Mar 21 09:07:01 2018 (r331285) @@ -365,6 +365,8 @@ FreeBSD 5.2 | | | | | | | | | | | | | | NetBSD 7.1.1 | DragonFly 5.0.2 | | | | | | | + | | | | NetBSD 7.1.2 | | + | | | | | | | | | | | v | | | v | | | | | | | | | @@ -736,6 +738,7 @@ DragonFly 5.0.0 2017-10-16 [DFB] DragonFly 5.0.1 2017-11-06 [DFB] DragonFly 5.0.2 2017-12-04 [DFB] NetBSD 7.1.1 2017-12-22 [NBD] +NetBSD 7.1.2 2018-03-15 [NBD] Bibliography ------------------------ From owner-svn-src-head@freebsd.org Wed Mar 21 10:26:40 2018 Return-Path: Delivered-To: svn-src-head@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 D9A27F5B2A9; Wed, 21 Mar 2018 10:26:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 87CFA87F47; Wed, 21 Mar 2018 10:26:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7EA992975B; Wed, 21 Mar 2018 10:26:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LAQd21061715; Wed, 21 Mar 2018 10:26:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LAQdLJ061713; Wed, 21 Mar 2018 10:26:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803211026.w2LAQdLJ061713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Mar 2018 10:26:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331290 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 331290 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 10:26:40 -0000 Author: kib Date: Wed Mar 21 10:26:39 2018 New Revision: 331290 URL: https://svnweb.freebsd.org/changeset/base/331290 Log: Move sysinit and sysuninit linker sets in the data (writeable) section. Both sets are sorted in place, and with the introduction of read-only permissions on the amd64 kernel text, the sorting override depended on CR0.WP turned off. Make it correct by moving the sets into writeable part of the KVA, also fixing boot on machines where hand-off from BIOS to OS occurs with CR0.WP set. Based on submission by: Peter Lei MFC after: 1 week Modified: head/sys/sys/kernel.h head/sys/sys/linker_set.h Modified: head/sys/sys/kernel.h ============================================================================== --- head/sys/sys/kernel.h Wed Mar 21 09:57:29 2018 (r331289) +++ head/sys/sys/kernel.h Wed Mar 21 10:26:39 2018 (r331290) @@ -259,7 +259,7 @@ sysinit_tslog_shim(const void * data) sysinit_tslog_shim, \ &uniquifier ## _sys_init_tslog \ }; \ - DATA_SET(sysinit_set,uniquifier ## _sys_init) + DATA_WSET(sysinit_set,uniquifier ## _sys_init) #else #define C_SYSINIT(uniquifier, subsystem, order, func, ident) \ static struct sysinit uniquifier ## _sys_init = { \ @@ -268,7 +268,7 @@ sysinit_tslog_shim(const void * data) func, \ (ident) \ }; \ - DATA_SET(sysinit_set,uniquifier ## _sys_init) + DATA_WSET(sysinit_set,uniquifier ## _sys_init) #endif #define SYSINIT(uniquifier, subsystem, order, func, ident) \ @@ -285,7 +285,7 @@ sysinit_tslog_shim(const void * data) func, \ (ident) \ }; \ - DATA_SET(sysuninit_set,uniquifier ## _sys_uninit) + DATA_WSET(sysuninit_set,uniquifier ## _sys_uninit) #define SYSUNINIT(uniquifier, subsystem, order, func, ident) \ C_SYSUNINIT(uniquifier, subsystem, order, \ Modified: head/sys/sys/linker_set.h ============================================================================== --- head/sys/sys/linker_set.h Wed Mar 21 09:57:29 2018 (r331289) +++ head/sys/sys/linker_set.h Wed Mar 21 10:26:39 2018 (r331290) @@ -56,12 +56,13 @@ * Private macros, not to be used outside this header file. */ #ifdef __GNUCLIKE___SECTION -#define __MAKE_SET(set, sym) \ +#define __MAKE_SET_QV(set, sym, qv) \ __GLOBL(__CONCAT(__start_set_,set)); \ __GLOBL(__CONCAT(__stop_set_,set)); \ - static void const * __MAKE_SET_CONST \ + static void const * qv \ __set_##set##_sym_##sym __section("set_" #set) \ __used = &(sym) +#define __MAKE_SET(set, sym) __MAKE_SET_QV(set, sym, __MAKE_SET_CONST) #else /* !__GNUCLIKE___SECTION */ #error this file needs to be ported to your compiler #endif /* __GNUCLIKE___SECTION */ @@ -71,6 +72,7 @@ */ #define TEXT_SET(set, sym) __MAKE_SET(set, sym) #define DATA_SET(set, sym) __MAKE_SET(set, sym) +#define DATA_WSET(set, sym) __MAKE_SET_QV(set, sym, ) #define BSS_SET(set, sym) __MAKE_SET(set, sym) #define ABS_SET(set, sym) __MAKE_SET(set, sym) #define SET_ENTRY(set, sym) __MAKE_SET(set, sym) From owner-svn-src-head@freebsd.org Wed Mar 21 10:33:36 2018 Return-Path: Delivered-To: svn-src-head@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 A1FD0F5BACE; Wed, 21 Mar 2018 10:33:36 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE7C16856E; Wed, 21 Mar 2018 10:33:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w2LAXP8p085828 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 21 Mar 2018 12:33:28 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w2LAXP8p085828 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w2LAXPbH085827; Wed, 21 Mar 2018 12:33:25 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 21 Mar 2018 12:33:25 +0200 From: Konstantin Belousov To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss Message-ID: <20180321103325.GJ76926@kib.kiev.ua> References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201803210115.w2L1Fjt9084698@repo.freebsd.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 10:33:36 -0000 On Wed, Mar 21, 2018 at 01:15:45AM +0000, Conrad Meyer wrote: > +int > +getentropy(void *buf, size_t buflen) > +{ > + ssize_t rd; > + > + if (buflen > 256) { > + errno = EIO; > + return (-1); > + } > + > + while (buflen > 0) { > + rd = getrandom(buf, buflen, 0); > + if (rd == -1) { > + if (errno == EINTR) > + continue; > + else if (errno == ENOSYS) > + abort(); Libraries must not abort the application. Esp. libc. > + else > + return (-1); > + } > + > + /* This cannot happen. */ > + if (rd == 0) > + abort(); > + > + buf = (char *)buf + rd; > + buflen -= rd; > + } > + > + return (0); > +} > @@ -627,6 +628,8 @@ FBSDprivate_1.0 { > __sys_getppid; > _getpriority; > __sys_getpriority; > + _getrandom; > + __sys_getrandom; > _getresgid; > __sys_getresgid; > _getresuid; Is there any use planned for _getrandom and for __sys_ ? If not, we do not add private symbols for newer syscalls in recent times. From owner-svn-src-head@freebsd.org Wed Mar 21 12:56:00 2018 Return-Path: Delivered-To: svn-src-head@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 BCEB2F65BD3; Wed, 21 Mar 2018 12:56:00 +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 672A36DE71; Wed, 21 Mar 2018 12:56:00 +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 574BC2AF8A; Wed, 21 Mar 2018 12:56:00 +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 w2LCu08O036124; Wed, 21 Mar 2018 12:56:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LCu0x5036123; Wed, 21 Mar 2018 12:56:00 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803211256.w2LCu0x5036123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Mar 2018 12:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331291 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 331291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 12:56:00 -0000 Author: imp Date: Wed Mar 21 12:55:59 2018 New Revision: 331291 URL: https://svnweb.freebsd.org/changeset/base/331291 Log: Revert r331273: "Release the "TUR" reference when clearing the TUR work flag. We mostly" It exposes other issues, so revert to the pervious state of known issues. Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Wed Mar 21 10:26:39 2018 (r331290) +++ head/sys/cam/scsi/scsi_da.c Wed Mar 21 12:55:59 2018 (r331291) @@ -3114,7 +3114,6 @@ more: if (bp == NULL) { if (cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { cam_iosched_clr_work_flags(softc->cam_iosched, DA_WORK_TUR); - da_periph_release_locked(periph, DA_REF_TUR); scsi_test_unit_ready(&start_ccb->csio, /*retries*/ da_retry_count, dadone, @@ -3138,6 +3137,11 @@ more: biofinish(bp, NULL, 0); goto more; } + } + + if (cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { + cam_iosched_clr_work_flags(softc->cam_iosched, DA_WORK_TUR); + da_periph_release_locked(periph, DA_REF_TUR); } if ((bp->bio_flags & BIO_ORDERED) != 0 || From owner-svn-src-head@freebsd.org Wed Mar 21 14:24:42 2018 Return-Path: Delivered-To: svn-src-head@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 C2D2CF6BC46 for ; Wed, 21 Mar 2018 14:24:42 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic313-33.consmr.mail.gq1.yahoo.com (sonic313-33.consmr.mail.gq1.yahoo.com [98.137.65.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4189871B84 for ; Wed, 21 Mar 2018 14:24:41 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1521642280; bh=MEc+TpRAnxj6q+MJD+5NNr+8DGh4JST9MIWmu5D5ZH0=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=D9Ug2hkcEZzGDdVrgjGkW9Cu7ElY6VRq8Bsls8vUQPShZT0kuBBzfzxguY65Bv7qkU3ntM8RtIfZMocCBXPCdpdAF4p11rWYSx4j9vJ3/QJ4iAnmtmtEQCPZbeAnrHGFQYjwYxvdgTPE2zSe9GbkDdVQRLDMUA5dK0DCXhnFX1IkBrXpnP4gUa1Rh0bQqYOj/jcoLE/VSdhiJuQjNg5r9TuD54h4FHfYH2K5BBiTAZnOHZEg5XpXTqEKOLlUlpMEoYlIj8rIXR1qYZuH+QZ1DRVGjCf22miKCeCg2CVLvFQBQrR4ImUgFEY0vev88csE8pplqreFhyRgJ7lHVr6dqg== X-YMail-OSG: Kj7p6gwVM1kkHyHqRajc95A7ClWYEQO29Wxr.WBVM5gvxdT43CbG6E8TzkFfhBg XDn9lZ1aA.uYI8jUvk4RunenaeyYRoyBCC95YK8QjAetR1rheOBQmYxn_NRgRb6JqjAsBWubJBIo J9RnItIxowGf19HmQlxYYSUlcO1LJ8GFokzeCGFIF3JFwfy2EXS4YdkuGxFONB9lguxtHW5JKXHs 5nynZrRXcvutQ6exI1z8klSCcPa2LsWkCQJd43S2U.o.jOuzd7jTEtiMqcErtMoJNaJPUYg5fTKn DLMZiuhEZT7BZZHkUaE7LyclEJ0voQPsZmxZ3KEipoJ3CitaWWe5cX0f8y_Fr8nvPhKe8aHjWJDG ONw_hb8MnZadXK4ZEC4E368tD7StX405nI3f2PQK7aZR.MIVuAo3Gj2ZtAaxsHIinhTk4wdgoYKQ CFaO_FO4id85ZW51cmBe05eDdMVbG6vXuSsvn.SjX6lLzZGcUKnqKcB._zFnoHOZpRSQl.Qrb_Hp U_422N8MnPg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.gq1.yahoo.com with HTTP; Wed, 21 Mar 2018 14:24:40 +0000 Received: from 181.52.72.201 (EHLO [192.168.0.4]) ([181.52.72.201]) by smtp405.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID f4b106b0b1d5412ccabdd5406b065f37; Wed, 21 Mar 2018 14:14:30 +0000 (UTC) Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss To: Ian Lepore , Conrad Meyer , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <1521596451.54965.39.camel@freebsd.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <10290d09-dc33-dae5-aeb8-2e8affb69f29@FreeBSD.org> Date: Wed, 21 Mar 2018 09:14:29 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1521596451.54965.39.camel@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:24:43 -0000 On 20/03/2018 20:40, Ian Lepore wrote: > On Wed, 2018-03-21 at 01:15 +0000, Conrad Meyer wrote: >> Author: cem >> Date: Wed Mar 21 01:15:45 2018 >> New Revision: 331279 >> URL: https://svnweb.freebsd.org/changeset/base/331279 >> >> Log: >>   Implement getrandom(2) and getentropy(3) >> >>   The general idea here is to provide userspace programs with well- >> defined >>   sources of entropy, in a fashion that doesn't require opening a new >> file >>   descriptor (ulimits) or accessing paths (/dev/urandom may be >> restricted >>   by chroot or capsicum). >> >>   getrandom(2) is the more general API, and comes from the Linux >> world. >>   Since our urandom and random devices are identical, the GRND_RANDOM >> flag >>   is ignored. >> >>   getentropy(3) is added as a compatibility shim for the OpenBSD API. >> >>   truss(1) support is included. >> >>   Tests for both system calls are provided.  Coverage is believed to >> be at >>   least as comprehensive as LTP getrandom(2) test >> coverage.  Additionally, >>   instructions for running the LTP tests directly against FreeBSD are >> provided >>   in the "Test Plan" section of the Differential revision linked >> below.  (They >>   pass, of course.) >> >>   PR: 194204 >>   Reported by: David CARLIER > hardenedbsd.org> >>   Discussed with: cperciva, delphij, jhb, markj >>   Relnotes: maybe >>   Differential Revision: https://reviews.freebsd.org/D14500 >> > A good followup to this might be to switch libc's arc4random seeding to > getrandom(), instead of using a sysctl in a loop. That appears to be the main use of getentropy() in OpenBSD. We should now obviate linux_getrandom() as well. Cheers, Pedro. From owner-svn-src-head@freebsd.org Wed Mar 21 14:36:17 2018 Return-Path: Delivered-To: svn-src-head@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 4C98AB43; Wed, 21 Mar 2018 14:36:17 +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 EA55F72413; Wed, 21 Mar 2018 14:36:16 +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 E12162BF14; Wed, 21 Mar 2018 14:36:16 +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 w2LEaGaQ086797; Wed, 21 Mar 2018 14:36:16 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LEaGwf086796; Wed, 21 Mar 2018 14:36:16 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201803211436.w2LEaGwf086796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 21 Mar 2018 14:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331292 - head/release/arm64 X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/arm64 X-SVN-Commit-Revision: 331292 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:36:17 -0000 Author: gjb Date: Wed Mar 21 14:36:16 2018 New Revision: 331292 URL: https://svnweb.freebsd.org/changeset/base/331292 Log: Following ports commit r465175, avoid fetch(1) to obtain overlays and DTB files for the RPI3. Submitted by: manu Sponsored by: The FreeBSD Foundation Modified: head/release/arm64/RPI3.conf Modified: head/release/arm64/RPI3.conf ============================================================================== --- head/release/arm64/RPI3.conf Wed Mar 21 12:55:59 2018 (r331291) +++ head/release/arm64/RPI3.conf Wed Mar 21 14:36:16 2018 (r331292) @@ -3,18 +3,19 @@ # $FreeBSD$ # -DTB_REPO="https://github.com/raspberrypi/firmware/blob/master/boot" +DTB_DIR="/usr/local/share/rpi-firmware" DTB="bcm2710-rpi-3-b.dtb" EMBEDDED_TARGET_ARCH="aarch64" EMBEDDED_TARGET="arm64" EMBEDDEDBUILD=1 -EMBEDDEDPORTS="sysutils/u-boot-rpi3 security/ca_root_nss" +EMBEDDEDPORTS="sysutils/u-boot-rpi3 sysutils/rpi-firmware" FAT_SIZE="50m -b 1m" FAT_TYPE="16" IMAGE_SIZE="2560M" KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" NODOC=1 +OL_DIR="${DTB_DIR}/overlays" OVERLAYS="mmc.dtbo pi3-disable-bt.dtbo" PART_SCHEME="MBR" export BOARDNAME="RPI3" @@ -33,11 +34,11 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/${_UF} \ ${FATMOUNT}/${_UF} done - chroot ${CHROOTDIR} fetch -o "${FATMOUNT}/${DTB}" "${DTB_REPO}/${DTB}?raw=true" + chroot ${CHROOTDIR} cp -p ${DTB_DIR}/${DTB} ${FATMOUNT}/${DTB} chroot ${CHROOTDIR} mkdir -p ${FATMOUNT}/overlays for _OL in ${OVERLAYS}; do - chroot ${CHROOTDIR} fetch -o "${FATMOUNT}/overlays/${_OL}"\ - "${DTB_REPO}/overlays/${_OL}?raw=true" + chroot ${CHROOTDIR} cp -p ${OL_DIR}/${_OL} \ + ${FATMOUNT}/overlays/${_OL} done BOOTFILES="$(chroot ${CHROOTDIR} \ From owner-svn-src-head@freebsd.org Wed Mar 21 14:37:06 2018 Return-Path: Delivered-To: svn-src-head@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 D7A9FC44; Wed, 21 Mar 2018 14:37:05 +0000 (UTC) (envelope-from br@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 8966572580; Wed, 21 Mar 2018 14:37:05 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8462E2BF15; Wed, 21 Mar 2018 14:37:05 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LEb5Wm086872; Wed, 21 Mar 2018 14:37:05 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LEb5m9086867; Wed, 21 Mar 2018 14:37:05 GMT (envelope-from br@FreeBSD.org) Message-Id: <201803211437.w2LEb5m9086867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 21 Mar 2018 14:37:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331293 - in head: etc/mtree lib lib/libipt share/mk X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head: etc/mtree lib lib/libipt share/mk X-SVN-Commit-Revision: 331293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:37:06 -0000 Author: br Date: Wed Mar 21 14:37:04 2018 New Revision: 331293 URL: https://svnweb.freebsd.org/changeset/base/331293 Log: Add new shared library -- libipt. libipt is the Intel Processor Trace (Intel PT) packets decoder. - Include libipt to amd64 build. - Install libipt headers to /usr/include/libipt/ Sponsored by: DARPA, AFRL Added: head/lib/libipt/ head/lib/libipt/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.include.dist head/lib/Makefile head/share/mk/bsd.libnames.mk head/share/mk/src.libnames.mk Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Wed Mar 21 14:36:16 2018 (r331292) +++ head/etc/mtree/BSD.include.dist Wed Mar 21 14:37:04 2018 (r331293) @@ -257,6 +257,8 @@ .. lib80211 .. + libipt + .. libmilter .. libxo Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Wed Mar 21 14:36:16 2018 (r331292) +++ head/lib/Makefile Wed Mar 21 14:37:04 2018 (r331293) @@ -176,6 +176,7 @@ _libvgl= libvgl .endif .if ${MACHINE_CPUARCH} == "amd64" +SUBDIR.${MK_PMC}+= libipt SUBDIR.${MK_BHYVE}+= libvmmapi .endif Added: head/lib/libipt/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libipt/Makefile Wed Mar 21 14:37:04 2018 (r331293) @@ -0,0 +1,77 @@ +# $FreeBSD$ + +PACKAGE=lib${LIB} +SHLIBDIR?= /lib + +.include + +PTSRC= ${SRCTOP}/contrib/processor-trace + +.PATH: ${PTSRC}/libipt/src \ + ${PTSRC}/libipt/src/posix \ + ${PTSRC}/libipt/internal/include \ + ${PTSRC}/libipt/include \ + ${PTSRC}/include + +LIB= ipt +SHLIB_MAJOR=0 + +SRCS= \ + init.c \ + pt_asid.c \ + pt_block_cache.c \ + pt_block_decoder.c \ + pt_config.c \ + pt_cpu.c \ + pt_cpuid.c \ + pt_decoder_function.c \ + pt_encoder.c \ + pt_error.c \ + pt_event_queue.c \ + pt_ild.c \ + pt_image_section_cache.c \ + pt_image.c \ + pt_insn_decoder.c \ + pt_insn.c \ + pt_last_ip.c \ + pt_packet_decoder.c \ + pt_packet.c \ + pt_query_decoder.c \ + pt_retstack.c \ + pt_section_file.c \ + pt_section_posix.c \ + pt_section.c \ + pt_sync.c \ + pt_time.c \ + pt_tnt_cache.c \ + pt_version.c + +CFLAGS+= \ + -I${PTSRC}/libipt/internal/include/posix \ + -I${PTSRC}/libipt/internal/include \ + -I${PTSRC}/libipt/include \ + -I${PTSRC}/include \ + -I${.CURDIR} + +CFLAGS+= \ + -DPT_VERSION_BUILD=0 \ + -DPT_VERSION_EXT=\"\" \ + -DPT_VERSION_MAJOR=1 \ + -DPT_VERSION_MINOR=6 + +INCS= \ + intel-pt.h \ + pt_cpu.h \ + pt_last_ip.h \ + pt_time.h \ + pt_compiler.h + +INCSDIR=${INCLUDEDIR}/libipt + +LIBADD= + +WARNS?= 1 + +HAS_TESTS= + +.include Modified: head/share/mk/bsd.libnames.mk ============================================================================== --- head/share/mk/bsd.libnames.mk Wed Mar 21 14:36:16 2018 (r331292) +++ head/share/mk/bsd.libnames.mk Wed Mar 21 14:37:04 2018 (r331293) @@ -88,6 +88,7 @@ LIBIBUMAD?= ${LIBDESTDIR}${LIBDIR_BASE}/libibumad.a LIBIBVERBS?= ${LIBDESTDIR}${LIBDIR_BASE}/libibverbs.a LIBIFCONFIG?= ${LIBDESTDIR}${LIBDIR_BASE}/libifconfig.a LIBIPSEC?= ${LIBDESTDIR}${LIBDIR_BASE}/libipsec.a +LIBIPT?= ${LIBDESTDIR}${LIBDIR_BASE}/libipt.a LIBJAIL?= ${LIBDESTDIR}${LIBDIR_BASE}/libjail.a LIBKADM5CLNT?= ${LIBDESTDIR}${LIBDIR_BASE}/libkadm5clnt.a LIBKADM5SRV?= ${LIBDESTDIR}${LIBDIR_BASE}/libkadm5srv.a Modified: head/share/mk/src.libnames.mk ============================================================================== --- head/share/mk/src.libnames.mk Wed Mar 21 14:36:16 2018 (r331292) +++ head/share/mk/src.libnames.mk Wed Mar 21 14:37:04 2018 (r331293) @@ -111,6 +111,7 @@ _LIBRARIES= \ heimsqlite \ hx509 \ ipsec \ + ipt \ jail \ kadm5clnt \ kadm5srv \ From owner-svn-src-head@freebsd.org Wed Mar 21 14:46:55 2018 Return-Path: Delivered-To: svn-src-head@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 69F00F46899; Wed, 21 Mar 2018 14:46:55 +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 19E7D72C4A; Wed, 21 Mar 2018 14:46:55 +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 0CBC72C0A3; Wed, 21 Mar 2018 14:46:55 +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 w2LEksga091774; Wed, 21 Mar 2018 14:46:54 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LEkst9091771; Wed, 21 Mar 2018 14:46:54 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803211446.w2LEkst9091771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Mar 2018 14:46:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331294 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:46:55 -0000 Author: imp Date: Wed Mar 21 14:46:54 2018 New Revision: 331294 URL: https://svnweb.freebsd.org/changeset/base/331294 Log: Remove Giant from init creation and vfs_mountroot. Sponsored by: Netflix Discussed with: kib@, mckusick@ Differential Review: https://reviews.freebsd.org/D14712 Modified: head/sys/kern/init_main.c head/sys/kern/kern_shutdown.c head/sys/kern/vfs_mountroot.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Wed Mar 21 14:37:04 2018 (r331293) +++ head/sys/kern/init_main.c Wed Mar 21 14:46:54 2018 (r331294) @@ -703,10 +703,6 @@ start_init(void *dummy) struct thread *td; struct proc *p; - mtx_lock(&Giant); - - GIANT_REQUIRED; - TSENTER(); /* Here so we don't overlap with mi_startup. */ td = curthread; @@ -801,7 +797,6 @@ start_init(void *dummy) * to user mode as init! */ if ((error = sys_execve(td, &args)) == EJUSTRETURN) { - mtx_unlock(&Giant); TSEXIT(); return; } Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Wed Mar 21 14:37:04 2018 (r331293) +++ head/sys/kern/kern_shutdown.c Wed Mar 21 14:46:54 2018 (r331294) @@ -268,13 +268,10 @@ sys_reboot(struct thread *td, struct reboot_args *uap) if (error == 0) error = priv_check(td, PRIV_REBOOT); if (error == 0) { - if (uap->opt & RB_REROOT) { + if (uap->opt & RB_REROOT) error = kern_reroot(); - } else { - mtx_lock(&Giant); + else kern_reboot(uap->opt); - mtx_unlock(&Giant); - } } return (error); } Modified: head/sys/kern/vfs_mountroot.c ============================================================================== --- head/sys/kern/vfs_mountroot.c Wed Mar 21 14:37:04 2018 (r331293) +++ head/sys/kern/vfs_mountroot.c Wed Mar 21 14:46:54 2018 (r331294) @@ -579,9 +579,7 @@ parse_dir_md(char **conf) if (root_mount_mddev != -1) { mdio->md_unit = root_mount_mddev; - DROP_GIANT(); error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio); - PICKUP_GIANT(); /* Ignore errors. We don't care. */ root_mount_mddev = -1; } @@ -590,9 +588,7 @@ parse_dir_md(char **conf) mdio->md_options = MD_AUTOUNIT | MD_READONLY; mdio->md_mediasize = sb.st_size; mdio->md_unit = 0; - DROP_GIANT(); error = kern_ioctl(td, fd, MDIOCATTACH, (void *)mdio); - PICKUP_GIANT(); if (error) goto out; @@ -601,9 +597,7 @@ parse_dir_md(char **conf) mdio->md_file = NULL; mdio->md_options = 0; mdio->md_mediasize = 0; - DROP_GIANT(); error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio); - PICKUP_GIANT(); /* Ignore errors. We don't care. */ error = ERANGE; goto out; @@ -960,9 +954,7 @@ vfs_mountroot_wait(void) curfail = 0; while (1) { - DROP_GIANT(); g_waitidle(); - PICKUP_GIANT(); mtx_lock(&root_holds_mtx); if (LIST_EMPTY(&root_holds)) { mtx_unlock(&root_holds_mtx); @@ -1004,9 +996,7 @@ vfs_mountroot_wait_if_neccessary(const char *fs, const * Note that we must wait for GEOM to finish reconfiguring itself, * eg for geom_part(4) to finish tasting. */ - DROP_GIANT(); g_waitidle(); - PICKUP_GIANT(); if (parse_mount_dev_present(dev)) return (0); @@ -1038,6 +1028,8 @@ vfs_mountroot(void) time_t timebase; int error; + mtx_assert(&Giant, MA_NOTOWNED); + TSENTER(); td = curthread; From owner-svn-src-head@freebsd.org Wed Mar 21 14:47:02 2018 Return-Path: Delivered-To: svn-src-head@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 18BBDF468D7; Wed, 21 Mar 2018 14:47:02 +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 AC27C72CF6; Wed, 21 Mar 2018 14:47:01 +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 CD0322C0A4; Wed, 21 Mar 2018 14:46:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LEkxDL091828; Wed, 21 Mar 2018 14:46:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LEkxSb091827; Wed, 21 Mar 2018 14:46:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803211446.w2LEkxSb091827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Mar 2018 14:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331295 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:47:02 -0000 Author: imp Date: Wed Mar 21 14:46:59 2018 New Revision: 331295 URL: https://svnweb.freebsd.org/changeset/base/331295 Log: bufshutdown is no longer called with Giant held, so there's no need to drop or pickup Giant anymore. Remove that code and adjust comments. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Mar 21 14:46:54 2018 (r331294) +++ head/sys/kern/vfs_bio.c Wed Mar 21 14:46:59 2018 (r331295) @@ -1376,25 +1376,20 @@ bufshutdown(int show_busybufs) #ifdef PREEMPTION /* - * Drop Giant and spin for a while to allow - * interrupt threads to run. + * Spin for a while to allow interrupt threads to run. */ - DROP_GIANT(); DELAY(50000 * iter); - PICKUP_GIANT(); #else /* - * Drop Giant and context switch several times to - * allow interrupt threads to run. + * Context switch several times to allow interrupt + * threads to run. */ - DROP_GIANT(); for (subiter = 0; subiter < 50 * iter; subiter++) { thread_lock(curthread); mi_switch(SW_VOL, NULL); thread_unlock(curthread); DELAY(1000); } - PICKUP_GIANT(); #endif } printf("\n"); From owner-svn-src-head@freebsd.org Wed Mar 21 14:47:04 2018 Return-Path: Delivered-To: svn-src-head@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 60BA7F468F1; Wed, 21 Mar 2018 14:47:04 +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 126DA72D32; Wed, 21 Mar 2018 14:47:04 +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 0BDC62C0A5; Wed, 21 Mar 2018 14:47:04 +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 w2LEl3VN091883; Wed, 21 Mar 2018 14:47:03 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LEl3vg091882; Wed, 21 Mar 2018 14:47:03 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803211447.w2LEl3vg091882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Mar 2018 14:47:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331296 - head/sys/sparc64/sbus X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/sparc64/sbus X-SVN-Commit-Revision: 331296 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:47:04 -0000 Author: imp Date: Wed Mar 21 14:47:03 2018 New Revision: 331296 URL: https://svnweb.freebsd.org/changeset/base/331296 Log: These interrupts call shutdown_nice() which should be called Giant unlocked. Rather than dropping it in the interrupt handler, mark these handlers as MPSAFE. Modified: head/sys/sparc64/sbus/sbus.c Modified: head/sys/sparc64/sbus/sbus.c ============================================================================== --- head/sys/sparc64/sbus/sbus.c Wed Mar 21 14:46:59 2018 (r331295) +++ head/sys/sparc64/sbus/sbus.c Wed Mar 21 14:47:03 2018 (r331296) @@ -411,7 +411,7 @@ sbus_attach(device_t dev) INTIGN(vec = rman_get_start(sc->sc_ot_ires)) != sc->sc_ign || INTVEC(SYSIO_READ8(sc, SBR_THERM_INT_MAP)) != vec || intr_vectors[vec].iv_ic != &sbus_ic || - bus_setup_intr(dev, sc->sc_ot_ires, INTR_TYPE_MISC | INTR_BRIDGE, + bus_setup_intr(dev, sc->sc_ot_ires, INTR_TYPE_MISC | INTR_BRIDGE | INTR_MPSAFE, NULL, sbus_overtemp, sc, &sc->sc_ot_ihand) != 0) panic("%s: failed to set up temperature interrupt", __func__); i = 3; @@ -421,7 +421,7 @@ sbus_attach(device_t dev) INTIGN(vec = rman_get_start(sc->sc_pf_ires)) != sc->sc_ign || INTVEC(SYSIO_READ8(sc, SBR_POWER_INT_MAP)) != vec || intr_vectors[vec].iv_ic != &sbus_ic || - bus_setup_intr(dev, sc->sc_pf_ires, INTR_TYPE_MISC | INTR_BRIDGE, + bus_setup_intr(dev, sc->sc_pf_ires, INTR_TYPE_MISC | INTR_BRIDGE | INTR_MPSAFE, NULL, sbus_pwrfail, sc, &sc->sc_pf_ihand) != 0) panic("%s: failed to set up power fail interrupt", __func__); From owner-svn-src-head@freebsd.org Wed Mar 21 14:47:10 2018 Return-Path: Delivered-To: svn-src-head@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 902A3F4692C; Wed, 21 Mar 2018 14:47:10 +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 3AEE172E16; Wed, 21 Mar 2018 14:47:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B9502C0A6; Wed, 21 Mar 2018 14:47:08 +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 w2LEl8I8091937; Wed, 21 Mar 2018 14:47:08 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LEl8l4091936; Wed, 21 Mar 2018 14:47:08 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803211447.w2LEl8l4091936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Mar 2018 14:47:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331297 - head/sys/arm/at91 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/arm/at91 X-SVN-Commit-Revision: 331297 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:47:10 -0000 Author: imp Date: Wed Mar 21 14:47:08 2018 New Revision: 331297 URL: https://svnweb.freebsd.org/changeset/base/331297 Log: This is MPSAFE on this platform, so don't take Giant out while running the callback. Modified: head/sys/arm/at91/at91_rst.c Modified: head/sys/arm/at91/at91_rst.c ============================================================================== --- head/sys/arm/at91/at91_rst.c Wed Mar 21 14:47:03 2018 (r331296) +++ head/sys/arm/at91/at91_rst.c Wed Mar 21 14:47:08 2018 (r331297) @@ -124,7 +124,7 @@ at91_rst_attach(device_t dev) at91_rst_sc = sc = device_get_softc(dev); sc->sc_dev = dev; - callout_init(&sc->tick_ch, 0); + callout_init(&sc->tick_ch, 1); rid = 0; sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, From owner-svn-src-head@freebsd.org Wed Mar 21 14:47:18 2018 Return-Path: Delivered-To: svn-src-head@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 780A5F46988; Wed, 21 Mar 2018 14:47:18 +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 0858C72F3A; Wed, 21 Mar 2018 14:47:18 +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 F3FCA2C0A8; Wed, 21 Mar 2018 14:47:17 +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 w2LElHdl092042; Wed, 21 Mar 2018 14:47:17 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LElHqY092041; Wed, 21 Mar 2018 14:47:17 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803211447.w2LElHqY092041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Mar 2018 14:47:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331299 - head/sys/sparc64/pci X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/sparc64/pci X-SVN-Commit-Revision: 331299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:47:18 -0000 Author: imp Date: Wed Mar 21 14:47:17 2018 New Revision: 331299 URL: https://svnweb.freebsd.org/changeset/base/331299 Log: Mark psycho interrupts as MPSAFE. It's safe to do so now that we don't need Giant to call shutdown_nice(). Modified: head/sys/sparc64/pci/psycho.c Modified: head/sys/sparc64/pci/psycho.c ============================================================================== --- head/sys/sparc64/pci/psycho.c Wed Mar 21 14:47:12 2018 (r331298) +++ head/sys/sparc64/pci/psycho.c Wed Mar 21 14:47:17 2018 (r331299) @@ -664,7 +664,7 @@ psycho_set_intr(struct psycho_softc *sc, u_int index, INTVEC(PSYCHO_READ8(sc, intrmap)) != vec || intr_vectors[vec].iv_ic != &psycho_ic || bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index], - INTR_TYPE_MISC | INTR_BRIDGE, filt, intr, sc, + INTR_TYPE_MISC | INTR_BRIDGE | INTR_MPSAFE, filt, intr, sc, &sc->sc_ihand[index]) != 0) panic("%s: failed to set up interrupt %d", __func__, index); } From owner-svn-src-head@freebsd.org Wed Mar 21 14:47:17 2018 Return-Path: Delivered-To: svn-src-head@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 9F8A8F46980; Wed, 21 Mar 2018 14:47:17 +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 067A372E90; Wed, 21 Mar 2018 14:47:13 +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 42E9C2C0A7; Wed, 21 Mar 2018 14:47:13 +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 w2LElDIB091989; Wed, 21 Mar 2018 14:47:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LElDcK091988; Wed, 21 Mar 2018 14:47:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803211447.w2LElDcK091988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Mar 2018 14:47:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331298 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 331298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 14:47:17 -0000 Author: imp Date: Wed Mar 21 14:47:12 2018 New Revision: 331298 URL: https://svnweb.freebsd.org/changeset/base/331298 Log: Unlock giant when calling shutdown_nice() Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Wed Mar 21 14:47:08 2018 (r331297) +++ head/sys/dev/syscons/syscons.c Wed Mar 21 14:47:12 2018 (r331298) @@ -3858,22 +3858,28 @@ next_code: case RBT: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) + if (enable_reboot && !(flags & SCGETC_CN)) { + mtx_unlock(&Giant); shutdown_nice(0); + } #endif break; case HALT: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) + if (enable_reboot && !(flags & SCGETC_CN)) { + mtx_unlock(&Giant); shutdown_nice(RB_HALT); + } #endif break; case PDWN: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) + if (enable_reboot && !(flags & SCGETC_CN)) { + mtx_unlock(&Giant); shutdown_nice(RB_HALT|RB_POWEROFF); + } #endif break; From owner-svn-src-head@freebsd.org Wed Mar 21 15:03:24 2018 Return-Path: Delivered-To: svn-src-head@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 C9BB6F4AEF4; Wed, 21 Mar 2018 15:03:24 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com [209.85.214.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 660A073EAE; Wed, 21 Mar 2018 15:03:24 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f45.google.com with SMTP id b136-v6so7270242iti.3; Wed, 21 Mar 2018 08:03:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=sf5gqIOw/cFJO/zO8WIY/nChpEWzJiSlQ1PWwP0HQRc=; b=Vg8hQ/1FrrvGwW+TWvF3WAFC6nOqKX6aALr0PiRDIeVAX/fdBzRI04cm0njp49OYjH +cMY7L0Xib0//XHux+efXE7R67S4abF1MAdnNaRs5vX2ohEgPMxwQT+bB0exGXxGr5o9 /vlM+Oe9md0p1HmekDzegbeTfrB5d3RPeOMlAffjMXZSXvEGfoVYLCXV8EzS39lHR80z 1LnVrYx70A34kOiCsFR+zywc836Wicaa1YRRaZRN2LPUUEWoe6uAzzARd7QOwpjjQOwN 7aZ1aysxmZinavkt5rpo5x1BN8oHU4gQ4RCVUXltbdzBP0l0+Z4tU40KvJvOabg1iNP2 soVw== X-Gm-Message-State: AElRT7EP1hxxpfqIuKxeS5t3RDLLue0/sxaCa1ie6BYN7cdGuS698wHW ivNpbNMQODg3d3CDYImrtLq1zsG1 X-Google-Smtp-Source: AG47ELu/bW2NDPol7vyRPGoOWQSszTU9E9sn60C0/JZ8bOOkFEguUW2VFbtYMSAuYwEC5BGs5ylbew== X-Received: by 2002:a24:2c8:: with SMTP id 191-v6mr4566968itu.108.1521644597462; Wed, 21 Mar 2018 08:03:17 -0700 (PDT) Received: from mail-it0-f41.google.com (mail-it0-f41.google.com. [209.85.214.41]) by smtp.gmail.com with ESMTPSA id b34-v6sm2389989itd.12.2018.03.21.08.03.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 08:03:17 -0700 (PDT) Received: by mail-it0-f41.google.com with SMTP id p67-v6so2221905itc.2; Wed, 21 Mar 2018 08:03:16 -0700 (PDT) X-Received: by 2002:a24:e14e:: with SMTP id n75-v6mr3473776ith.58.1521644596835; Wed, 21 Mar 2018 08:03:16 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.153.132 with HTTP; Wed, 21 Mar 2018 08:03:16 -0700 (PDT) In-Reply-To: <20180321103325.GJ76926@kib.kiev.ua> References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> From: Conrad Meyer Date: Wed, 21 Mar 2018 08:03:16 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:03:25 -0000 On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov wrote: > On Wed, Mar 21, 2018 at 01:15:45AM +0000, Conrad Meyer wrote: >> +int >> +getentropy(void *buf, size_t buflen) >> +{ >> + ssize_t rd; >> + >> + if (buflen > 256) { >> + errno = EIO; >> + return (-1); >> + } >> + >> + while (buflen > 0) { >> + rd = getrandom(buf, buflen, 0); >> + if (rd == -1) { >> + if (errno == EINTR) >> + continue; >> + else if (errno == ENOSYS) >> + abort(); > Libraries must not abort the application. > Esp. libc. What do you propose instead? while (1); ? I don't see that as obviously better. >> ... >> @@ -627,6 +628,8 @@ FBSDprivate_1.0 { >> __sys_getppid; >> _getpriority; >> __sys_getpriority; >> + _getrandom; >> + __sys_getrandom; >> _getresgid; >> __sys_getresgid; >> _getresuid; > > Is there any use planned for _getrandom and for __sys_ ? If not, > we do not add private symbols for newer syscalls in recent times. Nope, just following the pattern. They can be removed if they are not needed. Best, Conrad From owner-svn-src-head@freebsd.org Wed Mar 21 15:09:50 2018 Return-Path: Delivered-To: svn-src-head@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 2065AF4B992; Wed, 21 Mar 2018 15:09:50 +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 7E08A74665; Wed, 21 Mar 2018 15:09:49 +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 EF9B52C3A4; Wed, 21 Mar 2018 15:09:48 +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 w2LF9mlZ002704; Wed, 21 Mar 2018 15:09:48 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LF9m8I002701; Wed, 21 Mar 2018 15:09:48 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803211509.w2LF9m8I002701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 15:09:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331304 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331304 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:09:50 -0000 Author: kevans Date: Wed Mar 21 15:09:47 2018 New Revision: 331304 URL: https://svnweb.freebsd.org/changeset/base/331304 Log: lualoader: Clear up some possible naming confusion In the original lualoader project, 'escapef' and 'escapeb' were chosen for 'escape fg' and 'escape bg'. We've carried on this naming convention, and as our use of attributes grow the likeliness of 'escapeb'/'resetb' being confused upon glance for 'escape bold'/'reset bold' increases. Fix this by renaming these four functions to {escape,reset}{fg,bg} rather than {escape,reset}{f,b} for clarity. Reported by: dteske Modified: head/stand/lua/color.lua head/stand/lua/menu.lua head/stand/lua/screen.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Wed Mar 21 15:09:41 2018 (r331303) +++ head/stand/lua/color.lua Wed Mar 21 15:09:47 2018 (r331304) @@ -58,28 +58,28 @@ end color.disabled = not color.isEnabled() -function color.escapef(color_value) +function color.escapefg(color_value) if color.disabled then return color_value end return core.KEYSTR_CSI .. "3" .. color_value .. "m" end -function color.resetf() +function color.resetfg() if color.disabled then return '' end return core.KEYSTR_CSI .. "39m" end -function color.escapeb(color_value) +function color.escapebg(color_value) if color.disabled then return color_value end return core.KEYSTR_CSI .. "4" .. color_value .. "m" end -function color.resetb() +function color.resetbg() if color.disabled then return '' end Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Wed Mar 21 15:09:41 2018 (r331303) +++ head/stand/lua/menu.lua Wed Mar 21 15:09:47 2018 (r331304) @@ -46,11 +46,11 @@ local return_menu_entry = { local function OnOff(str, value) if value then - return str .. color.escapef(color.GREEN) .. "On" .. - color.escapef(color.WHITE) + return str .. color.escapefg(color.GREEN) .. "On" .. + color.escapefg(color.WHITE) else - return str .. color.escapef(color.RED) .. "off" .. - color.escapef(color.WHITE) + return str .. color.escapefg(color.RED) .. "off" .. + color.escapefg(color.WHITE) end end @@ -115,12 +115,12 @@ menu.boot_environments = { local bootenv_name = "" local name_color if is_default then - name_color = color.escapef(color.GREEN) + name_color = color.escapefg(color.GREEN) else - name_color = color.escapef(color.BLUE) + name_color = color.escapefg(color.BLUE) end bootenv_name = bootenv_name .. name_color .. - choice .. color.resetf() + choice .. color.resetfg() return color.highlight("A").."ctive: " .. bootenv_name .. " (" .. idx .. " of " .. #all_choices .. ")" @@ -300,13 +300,13 @@ menu.welcome = { local kernel_name = "" local name_color if is_default then - name_color = color.escapef(color.GREEN) + name_color = color.escapefg(color.GREEN) kernel_name = "default/" else - name_color = color.escapef(color.BLUE) + name_color = color.escapefg(color.BLUE) end kernel_name = kernel_name .. name_color .. - choice .. color.resetf() + choice .. color.resetfg() return color.highlight("K") .. "ernel: " .. kernel_name .. " (" .. idx .. " of " .. #all_choices .. ")" Modified: head/stand/lua/screen.lua ============================================================================== --- head/stand/lua/screen.lua Wed Mar 21 15:09:41 2018 (r331303) +++ head/stand/lua/screen.lua Wed Mar 21 15:09:47 2018 (r331304) @@ -56,14 +56,14 @@ function screen.setforeground(color_value) if color.disabled then return color_value end - printc(color.escapef(color_value)) + printc(color.escapefg(color_value)) end function screen.setbackground(color_value) if color.disabled then return color_value end - printc(color.escapeb(color_value)) + printc(color.escapebg(color_value)) end function screen.defcolor() From owner-svn-src-head@freebsd.org Wed Mar 21 15:12:35 2018 Return-Path: Delivered-To: svn-src-head@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 40FEAF4BF5D; Wed, 21 Mar 2018 15:12:35 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A477F74B7A; Wed, 21 Mar 2018 15:12:34 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f45.google.com with SMTP id z143-v6so8402389lff.3; Wed, 21 Mar 2018 08:12:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=TVc41fw9FwamqmjlYZ8ICQCLB2Mo6hg4lKRhJgpxTgg=; b=TQ98IvoN35nVpOKqm3n3dVgBT5BdDMRfwKDAcae/oizObbaqTnUcOqJFkkhrlrSNEZ fwIP/KlzDF+p7QK+noQEW1hlSYAq8lccawBGuoZ/3gvQkLI8svuaN0gJ+pmBOs8ZjIe8 58eExXQNtRCg2vRV/7XbNE2+2re0KXLmM+OKYfdvzjCMz70OtL3QW7pddqH/sD010xE0 5ezWv8+Cqd8F5J/egpHkA9SSprGrwKOhzCFJgyyjd+GXbdJ6MDkG8H2eRXkvlNOA/Z+0 Wd+EWWLFAKOLQ5jMrgpS0wKPMd5ZQTGF9jtnKDmBIAcpZlUYoxSnmwVimayxP6Xv9+TR 8dQQ== X-Gm-Message-State: AElRT7G6tI596/U4IfFwn1FqmCe5pFjxugJubTo981NloPD2fg7ozgFb 84xq+yYdlosONTTHWf09iKgkzaOC X-Google-Smtp-Source: AG47ELvQe5Rolo+4vJPKf1yetzLnrgZQoFC+o1OKrRNTfxnS2rPFAeh/07AgyDsR6SMAo7dfydlNHw== X-Received: by 2002:a19:4acc:: with SMTP id x195-v6mr14756270lfa.46.1521645146488; Wed, 21 Mar 2018 08:12:26 -0700 (PDT) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com. [209.85.215.53]) by smtp.gmail.com with ESMTPSA id j25sm338249lji.94.2018.03.21.08.12.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 08:12:26 -0700 (PDT) Received: by mail-lf0-f53.google.com with SMTP id a22-v6so8388533lfg.9; Wed, 21 Mar 2018 08:12:26 -0700 (PDT) X-Received: by 10.46.87.72 with SMTP id r8mr14273870ljd.93.1521645146155; Wed, 21 Mar 2018 08:12:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Wed, 21 Mar 2018 08:12:05 -0700 (PDT) In-Reply-To: <401EA542-5E2B-4342-B098-7C8D78FAD721@freebsd.org> References: <201803202026.w2KKQOP2036471@repo.freebsd.org> <401EA542-5E2B-4342-B098-7C8D78FAD721@freebsd.org> From: Kyle Evans Date: Wed, 21 Mar 2018 10:12:05 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331259 - head/stand/lua To: Devin Teske Cc: Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:12:35 -0000 On Tue, Mar 20, 2018 at 6:04 PM, Devin Teske wrote: > > Minor nit ... > > While resetf is unlikely to be mistaken for anything other than "reset foreground", ... > > "resetb" could easily be mistaken for "reset bold". > > I would like to suggest, in tradition, that resetf/resetb be renamed to resetfg/resetbg > > You know... should you want to add a "resetb" later that actually resets bold (e.g., if you have to use CSI 22m in more than one place). > -- > Devin This set of functions has been renamed in r331304. The choice of 'f' and 'b' always kind of bothered me, but not enough to actually fix it until someone else complained about it. =) From owner-svn-src-head@freebsd.org Wed Mar 21 15:17:55 2018 Return-Path: Delivered-To: svn-src-head@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 910E5F4C6C3; Wed, 21 Mar 2018 15:17:55 +0000 (UTC) (envelope-from andrew@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 4447875108; Wed, 21 Mar 2018 15:17:55 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24FB92C55A; Wed, 21 Mar 2018 15:17:55 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LFHs4A007716; Wed, 21 Mar 2018 15:17:54 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LFHsHf007714; Wed, 21 Mar 2018 15:17:54 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201803211517.w2LFHsHf007714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 21 Mar 2018 15:17:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331306 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 331306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:17:55 -0000 Author: andrew Date: Wed Mar 21 15:17:54 2018 New Revision: 331306 URL: https://svnweb.freebsd.org/changeset/base/331306 Log: Use a table to find the endpoint configuration On the Allwinner SoCs we need to set a custom endpoint configuration. To allow for this use a table to store the configuration so the attachment can override it. Reviewed by: hselasky Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14783 Modified: head/sys/dev/usb/controller/musb_otg.c head/sys/dev/usb/controller/musb_otg.h Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Wed Mar 21 15:13:47 2018 (r331305) +++ head/sys/dev/usb/controller/musb_otg.c Wed Mar 21 15:17:54 2018 (r331306) @@ -149,6 +149,27 @@ static const struct usb_hw_ep_profile musbotg_ep_profi } }; +static const struct musb_otg_ep_cfg musbotg_ep_default[] = { + { + .ep_end = 1, + .ep_fifosz_shift = 12, + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_4096 | MUSB2_MASK_FIFODB, + }, + { + .ep_end = 7, + .ep_fifosz_shift = 9, + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512 | MUSB2_MASK_FIFODB, + }, + { + .ep_end = 15, + .ep_fifosz_shift = 7, + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_128, + }, + { + .ep_end = -1, + }, +}; + static int musbotg_channel_alloc(struct musbotg_softc *sc, struct musbotg_td *td, uint8_t is_tx) { @@ -3059,7 +3080,9 @@ musbotg_clear_stall(struct usb_device *udev, struct us usb_error_t musbotg_init(struct musbotg_softc *sc) { + const struct musb_otg_ep_cfg *cfg; struct usb_hw_ep_profile *pf; + int i; uint16_t offset; uint8_t nrx; uint8_t ntx; @@ -3075,6 +3098,10 @@ musbotg_init(struct musbotg_softc *sc) sc->sc_bus.usbrev = USB_REV_2_0; sc->sc_bus.methods = &musbotg_bus_methods; + /* Set a default endpoint configuration */ + if (sc->sc_ep_cfg == NULL) + sc->sc_ep_cfg = musbotg_ep_default; + USB_BUS_LOCK(&sc->sc_bus); /* turn on clocks */ @@ -3193,20 +3220,15 @@ musbotg_init(struct musbotg_softc *sc) if (dynfifo) { if (frx && (temp <= nrx)) { - if (temp == 1) { - frx = 12; /* 4K */ - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, - MUSB2_VAL_FIFOSZ_4096 | - MUSB2_MASK_FIFODB); - } else if (temp < 8) { - frx = 10; /* 1K */ - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, - MUSB2_VAL_FIFOSZ_512 | - MUSB2_MASK_FIFODB); - } else { - frx = 7; /* 128 bytes */ - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, - MUSB2_VAL_FIFOSZ_128); + for (i = 0; sc->sc_ep_cfg[i].ep_end >= 0; i++) { + cfg = &sc->sc_ep_cfg[i]; + if (temp <= cfg->ep_end) { + frx = cfg->ep_fifosz_shift; + MUSB2_WRITE_1(sc, + MUSB2_REG_RXFIFOSZ, + cfg->ep_fifosz_reg); + break; + } } MUSB2_WRITE_2(sc, MUSB2_REG_RXFIFOADD, @@ -3215,20 +3237,15 @@ musbotg_init(struct musbotg_softc *sc) offset += (1 << frx); } if (ftx && (temp <= ntx)) { - if (temp == 1) { - ftx = 12; /* 4K */ - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, - MUSB2_VAL_FIFOSZ_4096 | - MUSB2_MASK_FIFODB); - } else if (temp < 8) { - ftx = 10; /* 1K */ - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, - MUSB2_VAL_FIFOSZ_512 | - MUSB2_MASK_FIFODB); - } else { - ftx = 7; /* 128 bytes */ - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, - MUSB2_VAL_FIFOSZ_128); + for (i = 0; sc->sc_ep_cfg[i].ep_end >= 0; i++) { + cfg = &sc->sc_ep_cfg[i]; + if (temp <= cfg->ep_end) { + ftx = cfg->ep_fifosz_shift; + MUSB2_WRITE_1(sc, + MUSB2_REG_TXFIFOSZ, + cfg->ep_fifosz_reg); + break; + } } MUSB2_WRITE_2(sc, MUSB2_REG_TXFIFOADD, Modified: head/sys/dev/usb/controller/musb_otg.h ============================================================================== --- head/sys/dev/usb/controller/musb_otg.h Wed Mar 21 15:13:47 2018 (r331305) +++ head/sys/dev/usb/controller/musb_otg.h Wed Mar 21 15:17:54 2018 (r331306) @@ -387,6 +387,12 @@ struct musbotg_flags { uint8_t d_pulled_up:1; }; +struct musb_otg_ep_cfg { + int ep_end; + int ep_fifosz_shift; + uint8_t ep_fifosz_reg; +}; + struct musbotg_softc { struct usb_bus sc_bus; union musbotg_hub_temp sc_hub_temp; @@ -423,6 +429,7 @@ struct musbotg_softc { uint8_t sc_id; uint8_t sc_mode; void *sc_platform_data; + const struct musb_otg_ep_cfg *sc_ep_cfg; }; /* prototypes */ From owner-svn-src-head@freebsd.org Wed Mar 21 15:23:47 2018 Return-Path: Delivered-To: svn-src-head@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 54040F4D11D; Wed, 21 Mar 2018 15:23:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81AD9757E8; Wed, 21 Mar 2018 15:23:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w2LFNZf7051025 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 21 Mar 2018 17:23:38 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w2LFNZf7051025 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w2LFNZd9051024; Wed, 21 Mar 2018 17:23:35 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 21 Mar 2018 17:23:35 +0200 From: Konstantin Belousov To: Conrad Meyer Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss Message-ID: <20180321152335.GL76926@kib.kiev.ua> References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:23:47 -0000 On Wed, Mar 21, 2018 at 08:03:16AM -0700, Conrad Meyer wrote: > On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov > wrote: > > On Wed, Mar 21, 2018 at 01:15:45AM +0000, Conrad Meyer wrote: > >> +int > >> +getentropy(void *buf, size_t buflen) > >> +{ > >> + ssize_t rd; > >> + > >> + if (buflen > 256) { > >> + errno = EIO; > >> + return (-1); > >> + } > >> + > >> + while (buflen > 0) { > >> + rd = getrandom(buf, buflen, 0); > >> + if (rd == -1) { > >> + if (errno == EINTR) > >> + continue; > >> + else if (errno == ENOSYS) > >> + abort(); > > Libraries must not abort the application. > > Esp. libc. > > What do you propose instead? while (1); ? I don't see that as > obviously better. Return the error to caller, as all, well most, correct library functions do. From owner-svn-src-head@freebsd.org Wed Mar 21 15:24:47 2018 Return-Path: Delivered-To: svn-src-head@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 EDD9DF4D2E2; Wed, 21 Mar 2018 15:24:46 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464A9759FC; Wed, 21 Mar 2018 15:24:46 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f47.google.com with SMTP id z143-v6so8466217lff.3; Wed, 21 Mar 2018 08:24:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ciJEVQPkr6Hpt1isNVMD2qVCaO8d4lkuR+9OjgaAZkU=; b=D68eeQBGR91RKq/yvNq3BHciw48Lo3XquyhE0BDMPqetvl9ds5CU9awAJWTelFQIYs zXrNJGgFuU5+mkrGU8hMuk3SaQJctsQA4HEYjyDfMlews+GRFES/zUkc/mfgO/mmo58O ScQaSujUhgwuE5zWTer1KqrzQC0YlqXQ4Qxa/qXyNXoTcOHouRJQzgZbX9gaqEWZrM9z vGfYzUCuJIuak7sGSMYlCA8FR7TS0g/UV3kD7L0GvGAx5d7tRe5qiBtugVTBQ1sdQYsx We9WJOPIU7ImwXZN4Z2MeWezRD0l9+7aErcPe0qQlP5WBptSIzXTLAB8NwxhL/v4Nw7u u15Q== X-Gm-Message-State: AElRT7H1DkjOCkUIia0n8Aqlyf6EV6tY8eTkdlAkPdFKMlkzVEwov2tv sIOTAfbP1HpuO3Lp9R49wXx8bpmC X-Google-Smtp-Source: AG47ELsMETvoBcSbaxa3by1lU2ldudeKr0qxuX7006Cxtuof0mhdpfZlwBJgqzJgSWeJe69kDOiT0Q== X-Received: by 2002:a19:590c:: with SMTP id n12-v6mr14759131lfb.10.1521645878495; Wed, 21 Mar 2018 08:24:38 -0700 (PDT) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com. [209.85.215.47]) by smtp.gmail.com with ESMTPSA id p1sm932659lje.56.2018.03.21.08.24.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 08:24:38 -0700 (PDT) Received: by mail-lf0-f47.google.com with SMTP id e5-v6so8464727lfb.7; Wed, 21 Mar 2018 08:24:38 -0700 (PDT) X-Received: by 10.46.155.204 with SMTP id w12mr13690980ljj.76.1521645878198; Wed, 21 Mar 2018 08:24:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Wed, 21 Mar 2018 08:24:17 -0700 (PDT) In-Reply-To: <201803211517.w2LFHsHf007714@repo.freebsd.org> References: <201803211517.w2LFHsHf007714@repo.freebsd.org> From: Kyle Evans Date: Wed, 21 Mar 2018 10:24:17 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331306 - head/sys/dev/usb/controller To: Andrew Turner , Hans Petter Selasky Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:24:47 -0000 On Wed, Mar 21, 2018 at 10:17 AM, Andrew Turner wrote: > Author: andrew > Date: Wed Mar 21 15:17:54 2018 > New Revision: 331306 > URL: https://svnweb.freebsd.org/changeset/base/331306 > > Log: > Use a table to find the endpoint configuration > > On the Allwinner SoCs we need to set a custom endpoint configuration. To > allow for this use a table to store the configuration so the attachment > can override it. > > Reviewed by: hselasky > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D14783 > > Modified: > head/sys/dev/usb/controller/musb_otg.c > head/sys/dev/usb/controller/musb_otg.h > > Modified: head/sys/dev/usb/controller/musb_otg.c > ============================================================================== > --- head/sys/dev/usb/controller/musb_otg.c Wed Mar 21 15:13:47 2018 (r331305) > +++ head/sys/dev/usb/controller/musb_otg.c Wed Mar 21 15:17:54 2018 (r331306) > @@ -149,6 +149,27 @@ static const struct usb_hw_ep_profile musbotg_ep_profi > } > }; > > +static const struct musb_otg_ep_cfg musbotg_ep_default[] = { > + { > + .ep_end = 1, > + .ep_fifosz_shift = 12, > + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_4096 | MUSB2_MASK_FIFODB, > + }, > + { > + .ep_end = 7, > + .ep_fifosz_shift = 9, > + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512 | MUSB2_MASK_FIFODB, > + }, I'm afraid I'm not familiar with this- why did .ep_fifosz_shift for this case drop to 9? frx = 10 in the temp < 8 case in the removals of the following hunks. Mostly curious because the others seemed to stay the same. > [..snip..] > @@ -3193,20 +3220,15 @@ musbotg_init(struct musbotg_softc *sc) > > if (dynfifo) { > if (frx && (temp <= nrx)) { > - if (temp == 1) { > - frx = 12; /* 4K */ > - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, > - MUSB2_VAL_FIFOSZ_4096 | > - MUSB2_MASK_FIFODB); > - } else if (temp < 8) { > - frx = 10; /* 1K */ > - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, > - MUSB2_VAL_FIFOSZ_512 | > - MUSB2_MASK_FIFODB); > - } else { > - frx = 7; /* 128 bytes */ > - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, > - MUSB2_VAL_FIFOSZ_128); > + for (i = 0; sc->sc_ep_cfg[i].ep_end >= 0; i++) { > + cfg = &sc->sc_ep_cfg[i]; > + if (temp <= cfg->ep_end) { > + frx = cfg->ep_fifosz_shift; > + MUSB2_WRITE_1(sc, > + MUSB2_REG_RXFIFOSZ, > + cfg->ep_fifosz_reg); > + break; > + } > } > > MUSB2_WRITE_2(sc, MUSB2_REG_RXFIFOADD, > @@ -3215,20 +3237,15 @@ musbotg_init(struct musbotg_softc *sc) > offset += (1 << frx); > } > if (ftx && (temp <= ntx)) { > - if (temp == 1) { > - ftx = 12; /* 4K */ > - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, > - MUSB2_VAL_FIFOSZ_4096 | > - MUSB2_MASK_FIFODB); > - } else if (temp < 8) { > - ftx = 10; /* 1K */ > - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, > - MUSB2_VAL_FIFOSZ_512 | > - MUSB2_MASK_FIFODB); > - } else { > - ftx = 7; /* 128 bytes */ > - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, > - MUSB2_VAL_FIFOSZ_128); > + for (i = 0; sc->sc_ep_cfg[i].ep_end >= 0; i++) { > + cfg = &sc->sc_ep_cfg[i]; > + if (temp <= cfg->ep_end) { > + ftx = cfg->ep_fifosz_shift; > + MUSB2_WRITE_1(sc, > + MUSB2_REG_TXFIFOSZ, > + cfg->ep_fifosz_reg); > + break; > + } > } > > MUSB2_WRITE_2(sc, MUSB2_REG_TXFIFOADD, > > Modified: head/sys/dev/usb/controller/musb_otg.h > ============================================================================== > --- head/sys/dev/usb/controller/musb_otg.h Wed Mar 21 15:13:47 2018 (r331305) > +++ head/sys/dev/usb/controller/musb_otg.h Wed Mar 21 15:17:54 2018 (r331306) > @@ -387,6 +387,12 @@ struct musbotg_flags { > uint8_t d_pulled_up:1; > }; > > +struct musb_otg_ep_cfg { > + int ep_end; > + int ep_fifosz_shift; > + uint8_t ep_fifosz_reg; > +}; > + > struct musbotg_softc { > struct usb_bus sc_bus; > union musbotg_hub_temp sc_hub_temp; > @@ -423,6 +429,7 @@ struct musbotg_softc { > uint8_t sc_id; > uint8_t sc_mode; > void *sc_platform_data; > + const struct musb_otg_ep_cfg *sc_ep_cfg; > }; > > /* prototypes */ > From owner-svn-src-head@freebsd.org Wed Mar 21 15:37:22 2018 Return-Path: Delivered-To: svn-src-head@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 D8E4DF4E289; Wed, 21 Mar 2018 15:37:21 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f182.google.com (mail-io0-f182.google.com [209.85.223.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74E3A76444; Wed, 21 Mar 2018 15:37:21 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f182.google.com with SMTP id d5so7157950iob.9; Wed, 21 Mar 2018 08:37:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=Falil5Fyc0DxNhqTH4s+RmZXJ/mxtZ6SH5aY1Vj23Vk=; b=BmeoGgvcFovYc1PU//0Ne467ZfTHdk3HNHuvmzv+upPD99fCLQkWcS7tTTSNhc4cwb lh6frUkbvAgH32h9Y32EEqBpbAKRtWsBPVSWOUhKN60rDeqKIXVNIzA1K1pYU2Y+N/5M aeFkocXvs1jkBgxgNIWdfM5xo8mtVrdjTqmJosOyM6ACZGOtMLZhK1A2YOtSbGy/pA1i 5y0Pxld9fGvlHdqbGVwY+rwGHqk0ZRMkQqYAn2+UbZRxvwUqaNgHEEHYvWwxYPYnIFir fnZBs/qY+w9dQo3xnkU4XTfrqBzQ9b60+4qSTO2K37eAQbvKUSsv6E53OGVJbyh6+H8V XbBA== X-Gm-Message-State: AElRT7FifQmKMA6f8XKHtN07eFdvunkORJRh5vOp83f5SruPLXlFDXyR FkeG7xVo1/E+h7B4JfprwisCtCMa X-Google-Smtp-Source: AG47ELucg8jz2Ma1aVAvWeQJq04FujqInQvAjynXj01KaPkMBKJhNK0FoC5uZ2xEovoRz9fnBVhhbQ== X-Received: by 10.107.47.198 with SMTP id v67mr11793528iov.281.1521646634718; Wed, 21 Mar 2018 08:37:14 -0700 (PDT) Received: from mail-it0-f41.google.com (mail-it0-f41.google.com. [209.85.214.41]) by smtp.gmail.com with ESMTPSA id a129-v6sm3220106itd.34.2018.03.21.08.37.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 08:37:14 -0700 (PDT) Received: by mail-it0-f41.google.com with SMTP id p67-v6so2363037itc.2; Wed, 21 Mar 2018 08:37:14 -0700 (PDT) X-Received: by 2002:a24:c101:: with SMTP id e1-v6mr4744079itg.46.1521646634148; Wed, 21 Mar 2018 08:37:14 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.153.132 with HTTP; Wed, 21 Mar 2018 08:37:13 -0700 (PDT) In-Reply-To: <20180321152335.GL76926@kib.kiev.ua> References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> <20180321152335.GL76926@kib.kiev.ua> From: Conrad Meyer Date: Wed, 21 Mar 2018 08:37:13 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Xin LI Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:37:22 -0000 On Wed, Mar 21, 2018 at 8:23 AM, Konstantin Belousov wrote: > On Wed, Mar 21, 2018 at 08:03:16AM -0700, Conrad Meyer wrote: >> On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov >> > Libraries must not abort the application. >> > Esp. libc. >> >> What do you propose instead? while (1); ? I don't see that as >> obviously better. > > Return the error to caller, as all, well most, correct library functions > do. The abort() in case of ENOSYS was proposed by delphij@. It is intended for users that getentropy() not fail. Another possible fallback is to use the kern.arandom sysctl. Would this be amenable to you? Thanks, Conrad From owner-svn-src-head@freebsd.org Wed Mar 21 15:37:57 2018 Return-Path: Delivered-To: svn-src-head@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 680EFF4E357; Wed, 21 Mar 2018 15:37:57 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2FF3765ED; Wed, 21 Mar 2018 15:37:56 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 9AC5C26061A; Wed, 21 Mar 2018 16:37:55 +0100 (CET) Subject: Re: svn commit: r331306 - head/sys/dev/usb/controller To: Kyle Evans , Andrew Turner Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803211517.w2LFHsHf007714@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Wed, 21 Mar 2018 16:37:49 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:37:57 -0000 On 03/21/18 16:24, Kyle Evans wrote: >> + { >> + .ep_end = 7, >> + .ep_fifosz_shift = 9, >> + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512 | MUSB2_MASK_FIFODB, >> + }, > I'm afraid I'm not familiar with this- why did .ep_fifosz_shift for > this case drop to 9? frx = 10 in the temp < 8 case in the removals of > the following hunks. Mostly curious because the others seemed to stay > the same. > Hi Andrew, It might be an idea to keep the fifosz_shift at 10, else high-speed BULK traffic won't be double buffered, and this might affect performance. --HPS From owner-svn-src-head@freebsd.org Wed Mar 21 15:42:29 2018 Return-Path: Delivered-To: svn-src-head@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 41FBCF4EAAB for ; Wed, 21 Mar 2018 15:42:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22f.google.com (mail-io0-x22f.google.com [IPv6:2607:f8b0:4001:c06::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB50876CC1 for ; Wed, 21 Mar 2018 15:42:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22f.google.com with SMTP id l3so7189657iog.0 for ; Wed, 21 Mar 2018 08:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=3MGT8ORScPruzAB3x/7OuTxH78rpZNwc7Q8SjOD65E8=; b=ARx+664c8dBNMYFb5+25CrRz0N4zEjTvKJHA6VCEx/fjuyXp5LVcETJ4VzkaXNRu8q 8xelmbcjAG6K6rnQy4OLElia4iUXXG7h7ZQrQvRKXUP2ctBgbsnHPD7NeBhCzGmoDVSI 2zUEW6Bj7WzEvtw2y+61FPv3xP91ItcM1KAno3FZK2X4S+9cqHzpcT36Jf5j8jwAv5sE 5vngD5kCFtfF2xruCpVFcJZ27uklL/fMt3VpgUF9pMVdjA+VJbq/MZZ3AaJgqgZWsHPR ssri2ASYiHy2xAmuI79krH90ItAWaNx0smPovtdx7+4ZzO5uKiOknYnGRHSCh1PVmHQC Ne+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=3MGT8ORScPruzAB3x/7OuTxH78rpZNwc7Q8SjOD65E8=; b=fC+Cn7752SnuYvlB/0+ge+wlONxBtPGWyvyyYg/LyrupjE3vGxsv586loJfpPNrNBQ eoCl9swamw6YCwm2/h6PUPkhpAWyXU9GlPTLLWS4IyUeexuf1lfJdrmbvz6AD8pKsjln dU2OR6NojaAMjvc2U/rtBbXI+0YkSSCClfDIVbmcF6p6d5JpKwvFdA59oBLZ9kZFjGhh CRlbO1lyEWIdkyEoIKvmJOnbvppqHmQ+TVYvEdc+pe99F0VassB7zkgoJqnKyQBDGrrE Rt2PT7Mayq+SEJgQVt5Bjfl82doUHb41qOfbnWaRYH08uwFLcK2uMwWF4Sd+g6/3FEav 4u7w== X-Gm-Message-State: AElRT7H265ilCvYJO2Yolsiy3A2VddJ0sgTfaqJ2fM0s3eEOj0tzhZf2 feulYYFX4ALt4Wfa7BQ4E9LhbEXnjGXXjYbWA+gcMg== X-Google-Smtp-Source: AG47ELvglvGJA6p3wLJCGU+rihZu+CglY58Ts/tKxUHAc5zNIToYAgMydURhS953KgEtHvS/WBpPmSd0ELp533V1EVU= X-Received: by 10.107.12.230 with SMTP id 99mr20841542iom.117.1521646947972; Wed, 21 Mar 2018 08:42:27 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Wed, 21 Mar 2018 08:42:26 -0700 (PDT) X-Originating-IP: [50.227.106.226] In-Reply-To: References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> <20180321152335.GL76926@kib.kiev.ua> From: Warner Losh Date: Wed, 21 Mar 2018 09:42:26 -0600 X-Google-Sender-Auth: FxfTQR2H_fgxt1I1lKuiVTZdDGQ Message-ID: Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss To: "Conrad E. Meyer" Cc: Konstantin Belousov , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Xin LI Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:42:29 -0000 On Wed, Mar 21, 2018 at 9:37 AM, Conrad Meyer wrote: > On Wed, Mar 21, 2018 at 8:23 AM, Konstantin Belousov > wrote: > > On Wed, Mar 21, 2018 at 08:03:16AM -0700, Conrad Meyer wrote: > >> On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov > >> > Libraries must not abort the application. > >> > Esp. libc. > >> > >> What do you propose instead? while (1); ? I don't see that as > >> obviously better. > > > > Return the error to caller, as all, well most, correct library functions > > do. > > The abort() in case of ENOSYS was proposed by delphij@. It is > intended for users that getentropy() not fail. Another possible > fallback is to use the kern.arandom sysctl. Would this be amenable to > you? > You should get a SIGSYS unless you've setup signal handlers for ENOSYS anyway, right? Warner From owner-svn-src-head@freebsd.org Wed Mar 21 15:54:47 2018 Return-Path: Delivered-To: svn-src-head@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 7A8EFF4F953; Wed, 21 Mar 2018 15:54:47 +0000 (UTC) (envelope-from jtl@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 2217277737; Wed, 21 Mar 2018 15:54:47 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 122982CB85; Wed, 21 Mar 2018 15:54:47 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LFsk30027709; Wed, 21 Mar 2018 15:54:46 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LFskv7027707; Wed, 21 Mar 2018 15:54:46 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201803211554.w2LFskv7027707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Wed, 21 Mar 2018 15:54:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331309 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 331309 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:54:47 -0000 Author: jtl Date: Wed Mar 21 15:54:46 2018 New Revision: 331309 URL: https://svnweb.freebsd.org/changeset/base/331309 Log: If the INP lock is uncontested, avoid taking a reference and jumping through the lock-switching hoops. A few of the INP lookup operations that lock INPs after the lookup do so using this mechanism (to maintain lock ordering): 1. Lock lookup structure. 2. Find INP. 3. Acquire reference on INP. 4. Drop lock on lookup structure. 5. Acquire INP lock. 6. Drop reference on INP. This change provides a slightly shorter path for cases where the INP lock is uncontested: 1. Lock lookup structure. 2. Find INP. 3. Try to acquire the INP lock. 4. If successful, drop lock on lookup structure. Of course, if the INP lock is contested, the functions will need to revert to the previous way of switching locks safely. This saves a few atomic operations when the INP lock is uncontested. Discussed with: gallatin, rrs, rwatson MFC after: 2 weeks Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D12911 Modified: head/sys/netinet/in_pcb.c head/sys/netinet6/in6_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Wed Mar 21 15:43:57 2018 (r331308) +++ head/sys/netinet/in_pcb.c Wed Mar 21 15:54:46 2018 (r331309) @@ -1632,6 +1632,7 @@ in_pcblookup_group(struct inpcbinfo *pcbinfo, struct i struct inpcbhead *head; struct inpcb *inp, *tmpinp; u_short fport = fport_arg, lport = lport_arg; + bool locked; /* * First look for an exact match. @@ -1818,18 +1819,32 @@ in_pcblookup_group(struct inpcbinfo *pcbinfo, struct i return (NULL); found: - in_pcbref(inp); - INP_GROUP_UNLOCK(pcbgroup); - if (lookupflags & INPLOOKUP_WLOCKPCB) { - INP_WLOCK(inp); - if (in_pcbrele_wlocked(inp)) - return (NULL); - } else if (lookupflags & INPLOOKUP_RLOCKPCB) { - INP_RLOCK(inp); - if (in_pcbrele_rlocked(inp)) - return (NULL); - } else + if (lookupflags & INPLOOKUP_WLOCKPCB) + locked = TRY_INP_WLOCK(inp); + else if (lookupflags & INPLOOKUP_RLOCKPCB) + locked = TRY_INP_RLOCK(inp); + else panic("%s: locking bug", __func__); + if (!locked) + in_pcbref(inp); + INP_GROUP_UNLOCK(pcbgroup); + if (!locked) { + if (lookupflags & INPLOOKUP_WLOCKPCB) { + INP_WLOCK(inp); + if (in_pcbrele_wlocked(inp)) + return (NULL); + } else { + INP_RLOCK(inp); + if (in_pcbrele_rlocked(inp)) + return (NULL); + } + } +#ifdef INVARIANTS + if (lookupflags & INPLOOKUP_WLOCKPCB) + INP_WLOCK_ASSERT(inp); + else + INP_RLOCK_ASSERT(inp); +#endif return (inp); } #endif /* PCBGROUP */ @@ -1968,23 +1983,38 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in struct ifnet *ifp) { struct inpcb *inp; + bool locked; INP_HASH_RLOCK(pcbinfo); inp = in_pcblookup_hash_locked(pcbinfo, faddr, fport, laddr, lport, (lookupflags & ~(INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)), ifp); if (inp != NULL) { - in_pcbref(inp); - INP_HASH_RUNLOCK(pcbinfo); - if (lookupflags & INPLOOKUP_WLOCKPCB) { - INP_WLOCK(inp); - if (in_pcbrele_wlocked(inp)) - return (NULL); - } else if (lookupflags & INPLOOKUP_RLOCKPCB) { - INP_RLOCK(inp); - if (in_pcbrele_rlocked(inp)) - return (NULL); - } else + if (lookupflags & INPLOOKUP_WLOCKPCB) + locked = INP_TRY_WLOCK(inp); + else if (lookupflags & INPLOOKUP_RLOCKPCB) + locked = INP_TRY_RLOCK(inp); + else panic("%s: locking bug", __func__); + if (!locked) + in_pcbref(inp); + INP_HASH_RUNLOCK(pcbinfo); + if (!locked) { + if (lookupflags & INPLOOKUP_WLOCKPCB) { + INP_WLOCK(inp); + if (in_pcbrele_wlocked(inp)) + return (NULL); + } else { + INP_RLOCK(inp); + if (in_pcbrele_rlocked(inp)) + return (NULL); + } + } +#ifdef INVARIANTS + if (lookupflags & INPLOOKUP_WLOCKPCB) + INP_WLOCK_ASSERT(inp); + else + INP_RLOCK_ASSERT(inp); +#endif } else INP_HASH_RUNLOCK(pcbinfo); return (inp); Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Wed Mar 21 15:43:57 2018 (r331308) +++ head/sys/netinet6/in6_pcb.c Wed Mar 21 15:54:46 2018 (r331309) @@ -868,6 +868,7 @@ in6_pcblookup_group(struct inpcbinfo *pcbinfo, struct struct inpcbhead *head; struct inpcb *inp, *tmpinp; u_short fport = fport_arg, lport = lport_arg; + bool locked; /* * First look for an exact match. @@ -1026,18 +1027,32 @@ in6_pcblookup_group(struct inpcbinfo *pcbinfo, struct return (NULL); found: - in_pcbref(inp); - INP_GROUP_UNLOCK(pcbgroup); - if (lookupflags & INPLOOKUP_WLOCKPCB) { - INP_WLOCK(inp); - if (in_pcbrele_wlocked(inp)) - return (NULL); - } else if (lookupflags & INPLOOKUP_RLOCKPCB) { - INP_RLOCK(inp); - if (in_pcbrele_rlocked(inp)) - return (NULL); - } else + if (lookupflags & INPLOOKUP_WLOCKPCB) + locked = INP_TRY_WLOCK(inp); + else if (lookupflags & INPLOOKUP_RLOCKPCB) + locked = INP_TRY_RLOCK(inp); + else panic("%s: locking buf", __func__); + if (!locked) + in_pcbref(inp); + INP_GROUP_UNLOCK(pcbgroup); + if (!locked) { + if (lookupflags & INPLOOKUP_WLOCKPCB) { + INP_WLOCK(inp); + if (in_pcbrele_wlocked(inp)) + return (NULL); + } else { + INP_RLOCK(inp); + if (in_pcbrele_rlocked(inp)) + return (NULL); + } + } +#ifdef INVARIANTS + if (lookupflags & INPLOOKUP_WLOCKPCB) + INP_WLOCK_ASSERT(inp); + else + INP_RLOCK_ASSERT(inp); +#endif return (inp); } #endif /* PCBGROUP */ @@ -1163,23 +1178,38 @@ in6_pcblookup_hash(struct inpcbinfo *pcbinfo, struct i struct ifnet *ifp) { struct inpcb *inp; + bool locked; INP_HASH_RLOCK(pcbinfo); inp = in6_pcblookup_hash_locked(pcbinfo, faddr, fport, laddr, lport, (lookupflags & ~(INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)), ifp); if (inp != NULL) { - in_pcbref(inp); - INP_HASH_RUNLOCK(pcbinfo); - if (lookupflags & INPLOOKUP_WLOCKPCB) { - INP_WLOCK(inp); - if (in_pcbrele_wlocked(inp)) - return (NULL); - } else if (lookupflags & INPLOOKUP_RLOCKPCB) { - INP_RLOCK(inp); - if (in_pcbrele_rlocked(inp)) - return (NULL); - } else + if (lookupflags & INPLOOKUP_WLOCKPCB) + locked = INP_TRY_WLOCK(inp); + else if (lookupflags & INPLOOKUP_RLOCKPCB) + locked = INP_TRY_RLOCK(inp); + else panic("%s: locking bug", __func__); + if (!locked) + in_pcbref(inp); + INP_HASH_RUNLOCK(pcbinfo); + if (!locked) { + if (lookupflags & INPLOOKUP_WLOCKPCB) { + INP_WLOCK(inp); + if (in_pcbrele_wlocked(inp)) + return (NULL); + } else { + INP_RLOCK(inp); + if (in_pcbrele_rlocked(inp)) + return (NULL); + } + } +#ifdef INVARIANTS + if (lookupflags & INPLOOKUP_WLOCKPCB) + INP_WLOCK_ASSERT(inp); + else + INP_RLOCK_ASSERT(inp); +#endif } else INP_HASH_RUNLOCK(pcbinfo); return (inp); From owner-svn-src-head@freebsd.org Wed Mar 21 15:57:37 2018 Return-Path: Delivered-To: svn-src-head@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 40E8BF4FCEA; Wed, 21 Mar 2018 15:57:37 +0000 (UTC) (envelope-from shurd@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 E83DF779FF; Wed, 21 Mar 2018 15:57:36 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 DE6A52CBAB; Wed, 21 Mar 2018 15:57:36 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LFvatw027867; Wed, 21 Mar 2018 15:57:36 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LFvaHB027864; Wed, 21 Mar 2018 15:57:36 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201803211557.w2LFvaHB027864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Wed, 21 Mar 2018 15:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331310 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 331310 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 15:57:37 -0000 Author: shurd Date: Wed Mar 21 15:57:36 2018 New Revision: 331310 URL: https://svnweb.freebsd.org/changeset/base/331310 Log: Update copyright per Matthew Macy "Under my tutelage Nicole did 85% of the work. At the time it seemed simplest for a number of reasons to put my copyright on it. I now consider that to have been a mistake." Submitted by: Matthew Macy Reviewed by: shurd Approved by: shurd Differential Revision: https://reviews.freebsd.org/D14766 Modified: head/sys/dev/e1000/em_txrx.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h Modified: head/sys/dev/e1000/em_txrx.c ============================================================================== --- head/sys/dev/e1000/em_txrx.c Wed Mar 21 15:54:46 2018 (r331309) +++ head/sys/dev/e1000/em_txrx.c Wed Mar 21 15:57:36 2018 (r331310) @@ -1,5 +1,6 @@ /*- - * Copyright (c) 2016-2017 Matthew Macy + * Copyright (c) 2016 Nicole Graziano + * Copyright (c) 2017 Matthew Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Wed Mar 21 15:54:46 2018 (r331309) +++ head/sys/dev/e1000/if_em.c Wed Mar 21 15:57:36 2018 (r331310) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2016 Matthew Macy + * Copyright (c) 2016 Nicole Graziano * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/e1000/if_em.h ============================================================================== --- head/sys/dev/e1000/if_em.h Wed Mar 21 15:54:46 2018 (r331309) +++ head/sys/dev/e1000/if_em.h Wed Mar 21 15:57:36 2018 (r331310) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2016 Matthew Macy + * Copyright (c) 2016 Nicole Graziano * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-head@freebsd.org Wed Mar 21 16:05:04 2018 Return-Path: Delivered-To: svn-src-head@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 3E56FF50647; Wed, 21 Mar 2018 16:05:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90B09780E0; Wed, 21 Mar 2018 16:05:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w2LG4pOd060067 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 21 Mar 2018 18:04:54 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w2LG4pOd060067 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w2LG4ppA060066; Wed, 21 Mar 2018 18:04:51 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 21 Mar 2018 18:04:51 +0200 From: Konstantin Belousov To: Warner Losh Cc: "Conrad E. Meyer" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Xin LI Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss Message-ID: <20180321160451.GM76926@kib.kiev.ua> References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> <20180321152335.GL76926@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 16:05:04 -0000 On Wed, Mar 21, 2018 at 09:42:26AM -0600, Warner Losh wrote: > On Wed, Mar 21, 2018 at 9:37 AM, Conrad Meyer wrote: > > > On Wed, Mar 21, 2018 at 8:23 AM, Konstantin Belousov > > wrote: > > > On Wed, Mar 21, 2018 at 08:03:16AM -0700, Conrad Meyer wrote: > > >> On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov > > >> > Libraries must not abort the application. > > >> > Esp. libc. > > >> > > >> What do you propose instead? while (1); ? I don't see that as > > >> obviously better. > > > > > > Return the error to caller, as all, well most, correct library functions > > > do. > > > > The abort() in case of ENOSYS was proposed by delphij@. It is > > intended for users that getentropy() not fail. Another possible > > fallback is to use the kern.arandom sysctl. Would this be amenable to > > you? > > > > You should get a SIGSYS unless you've setup signal handlers for ENOSYS > anyway, right? The signal handler is under control of the application which uses libc. The library can be only passive there. So passing ENOSYS silently to the caller, or trying to use kern.arandom on ENOSYS are both fine. Abort() is not, IMO. From owner-svn-src-head@freebsd.org Wed Mar 21 16:12:08 2018 Return-Path: Delivered-To: svn-src-head@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 85630F50EAE; Wed, 21 Mar 2018 16:12:08 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 371427858B; Wed, 21 Mar 2018 16:12:08 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31A792CEC5; Wed, 21 Mar 2018 16:12:08 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LGC8A0035761; Wed, 21 Mar 2018 16:12:08 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LGC8EB035760; Wed, 21 Mar 2018 16:12:08 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803211612.w2LGC8EB035760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 16:12:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331311 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 331311 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 16:12:08 -0000 Author: cem Date: Wed Mar 21 16:12:07 2018 New Revision: 331311 URL: https://svnweb.freebsd.org/changeset/base/331311 Log: cryptosoft(4): Zero plain hash contexts, too An OCF-naive user program could use these primitives to implement HMAC, for example. This would make the freed context sensitive data. Probably other bzeros in this file should be explicit_bzeros as well. Future work. Reviewed by: jhb, markj Differential Revision: https://reviews.freebsd.org/D14662 (minor part of a larger work) Modified: head/sys/opencrypto/cryptosoft.c Modified: head/sys/opencrypto/cryptosoft.c ============================================================================== --- head/sys/opencrypto/cryptosoft.c Wed Mar 21 15:57:36 2018 (r331310) +++ head/sys/opencrypto/cryptosoft.c Wed Mar 21 16:12:07 2018 (r331311) @@ -1053,8 +1053,10 @@ swcr_freesession_locked(device_t dev, u_int64_t tid) case CRYPTO_SHA1: axf = swd->sw_axf; - if (swd->sw_ictx) + if (swd->sw_ictx) { + explicit_bzero(swd->sw_ictx, axf->ctxsize); free(swd->sw_ictx, M_CRYPTO_DATA); + } break; case CRYPTO_DEFLATE_COMP: From owner-svn-src-head@freebsd.org Wed Mar 21 16:18:15 2018 Return-Path: Delivered-To: svn-src-head@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 A89AFF51531; Wed, 21 Mar 2018 16:18:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 5687778ADD; Wed, 21 Mar 2018 16:18:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 514BE2CEE9; Wed, 21 Mar 2018 16:18:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LGIFPD038522; Wed, 21 Mar 2018 16:18:15 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LGIE6h038516; Wed, 21 Mar 2018 16:18:14 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803211618.w2LGIE6h038516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 16:18:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331312 - in head: sys/conf sys/contrib/libb2 sys/crypto/blake2 sys/modules sys/modules/blake2 sys/modules/crypto sys/opencrypto tests/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: sys/conf sys/contrib/libb2 sys/crypto/blake2 sys/modules sys/modules/blake2 sys/modules/crypto sys/opencrypto tests/sys/opencrypto X-SVN-Commit-Revision: 331312 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 16:18:16 -0000 Author: cem Date: Wed Mar 21 16:18:14 2018 New Revision: 331312 URL: https://svnweb.freebsd.org/changeset/base/331312 Log: Import Blake2 algorithms (blake2b, blake2s) from libb2 The upstream repository is on github BLAKE2/libb2. Files landed in sys/contrib/libb2 are the unmodified upstream files, except for one difference: secure_zero_memory's contents have been replaced with explicit_bzero() only because the previous implementation broke powerpc link. Preferential use of explicit_bzero() is in progress upstream, so it is anticipated we will be able to drop this diff in the future. sys/crypto/blake2 contains the source files needed to port libb2 to our build system, a wrapped (limited) variant of the algorithm to match the API of our auth_transform softcrypto abstraction, incorporation into the Open Crypto Framework (OCF) cryptosoft(4) driver, as well as an x86 SSE/AVX accelerated OCF driver, blake2(4). Optimized variants of blake2 are compiled for a number of x86 machines (anything from SSE2 to AVX + XOP). On those machines, FPU context will need to be explicitly saved before using blake2(4)-provided algorithms directly. Use via cryptodev / OCF saves FPU state automatically, and use via the auth_transform softcrypto abstraction does not use FPU. The intent of the OCF driver is mostly to enable testing in userspace via /dev/crypto. ATF tests are added with published KAT test vectors to validate correctness. Reviewed by: jhb, markj Obtained from: github BLAKE2/libb2 Differential Revision: https://reviews.freebsd.org/D14662 Added: head/sys/contrib/libb2/ head/sys/contrib/libb2/blake2-config.h (contents, props changed) head/sys/contrib/libb2/blake2-dispatch.c (contents, props changed) head/sys/contrib/libb2/blake2-impl.h (contents, props changed) head/sys/contrib/libb2/blake2.h (contents, props changed) head/sys/contrib/libb2/blake2b-load-sse2.h (contents, props changed) head/sys/contrib/libb2/blake2b-load-sse41.h (contents, props changed) head/sys/contrib/libb2/blake2b-ref.c (contents, props changed) head/sys/contrib/libb2/blake2b-round.h (contents, props changed) head/sys/contrib/libb2/blake2b.c (contents, props changed) head/sys/contrib/libb2/blake2bp.c (contents, props changed) head/sys/contrib/libb2/blake2s-load-sse2.h (contents, props changed) head/sys/contrib/libb2/blake2s-load-sse41.h (contents, props changed) head/sys/contrib/libb2/blake2s-load-xop.h (contents, props changed) head/sys/contrib/libb2/blake2s-ref.c (contents, props changed) head/sys/contrib/libb2/blake2s-round.h (contents, props changed) head/sys/contrib/libb2/blake2s.c (contents, props changed) head/sys/contrib/libb2/blake2sp.c (contents, props changed) head/sys/crypto/blake2/ head/sys/crypto/blake2/blake2-sw.c (contents, props changed) head/sys/crypto/blake2/blake2_cryptodev.c (contents, props changed) head/sys/crypto/blake2/blake2_kfreebsd.h (contents, props changed) head/sys/crypto/blake2/blake2b-avx.c (contents, props changed) head/sys/crypto/blake2/blake2b-sse2.c (contents, props changed) head/sys/crypto/blake2/blake2b-sse41.c (contents, props changed) head/sys/crypto/blake2/blake2b-ssse3.c (contents, props changed) head/sys/crypto/blake2/blake2b-xop.c (contents, props changed) head/sys/crypto/blake2/blake2s-avx.c (contents, props changed) head/sys/crypto/blake2/blake2s-sse2.c (contents, props changed) head/sys/crypto/blake2/blake2s-sse41.c (contents, props changed) head/sys/crypto/blake2/blake2s-ssse3.c (contents, props changed) head/sys/crypto/blake2/blake2s-xop.c (contents, props changed) head/sys/crypto/blake2/config.h (contents, props changed) head/sys/crypto/blake2/stddef.h (contents, props changed) head/sys/crypto/blake2/stdint.h (contents, props changed) head/sys/crypto/blake2/stdio.h (contents, props changed) head/sys/crypto/blake2/stdlib.h (contents, props changed) head/sys/crypto/blake2/string.h (contents, props changed) head/sys/modules/blake2/ head/sys/modules/blake2/Makefile (contents, props changed) head/tests/sys/opencrypto/blake2-kat.h (contents, props changed) head/tests/sys/opencrypto/blake2_test.c (contents, props changed) Modified: head/sys/conf/files head/sys/modules/Makefile head/sys/modules/crypto/Makefile head/sys/opencrypto/cryptodev.c head/sys/opencrypto/cryptodev.h head/sys/opencrypto/cryptosoft.c head/sys/opencrypto/xform_auth.h head/tests/sys/opencrypto/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Mar 21 16:12:07 2018 (r331311) +++ head/sys/conf/files Wed Mar 21 16:18:14 2018 (r331312) @@ -648,6 +648,13 @@ contrib/zstd/lib/compress/zstd_ldm.c standard compile contrib/zstd/lib/compress/zstd_opt.c standard compile-with ${ZSTD_C} contrib/zstd/lib/decompress/zstd_decompress.c standard compile-with ${ZSTD_C} contrib/zstd/lib/decompress/huf_decompress.c standard compile-with ${ZSTD_C} +# Blake 2 +contrib/libb2/blake2b-ref.c optional crypto | ipsec | ipsec_support \ + compile-with "${NORMAL_C} -I$S/crypto/blake2 ${NO_WCAST_QUAL} -DSUFFIX=_ref" +contrib/libb2/blake2s-ref.c optional crypto | ipsec | ipsec_support \ + compile-with "${NORMAL_C} -I$S/crypto/blake2 ${NO_WCAST_QUAL} -DSUFFIX=_ref" +crypto/blake2/blake2-sw.c optional crypto | ipsec | ipsec_support \ + compile-with "${NORMAL_C} -I$S/crypto/blake2 ${NO_WCAST_QUAL}" crypto/blowfish/bf_ecb.c optional ipsec | ipsec_support crypto/blowfish/bf_skey.c optional crypto | ipsec | ipsec_support crypto/camellia/camellia.c optional crypto | ipsec | ipsec_support Added: head/sys/contrib/libb2/blake2-config.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/libb2/blake2-config.h Wed Mar 21 16:18:14 2018 (r331312) @@ -0,0 +1,71 @@ +/* + BLAKE2 reference source code package - optimized C implementations + + Written in 2012 by Samuel Neves + + To the extent possible under law, the author(s) have dedicated all copyright + and related and neighboring rights to this software to the public domain + worldwide. This software is distributed without any warranty. + + You should have received a copy of the CC0 Public Domain Dedication along with + this software. If not, see . +*/ +#pragma once +#ifndef __BLAKE2_CONFIG_H__ +#define __BLAKE2_CONFIG_H__ + +#if defined(__SSE2__) +#define HAVE_SSE2 +#endif + +#if defined(__SSSE3__) +#define HAVE_SSSE3 +#endif + +#if defined(__SSE4_1__) +#define HAVE_SSE4_1 +#endif + +#if defined(__AVX__) +#define HAVE_AVX +#endif + +#if defined(__XOP__) +#define HAVE_XOP +#endif + + +#ifdef HAVE_AVX2 +#ifndef HAVE_AVX +#define HAVE_AVX +#endif +#endif + +#ifdef HAVE_XOP +#ifndef HAVE_AVX +#define HAVE_AVX +#endif +#endif + +#ifdef HAVE_AVX +#ifndef HAVE_SSE4_1 +#define HAVE_SSE4_1 +#endif +#endif + +#ifdef HAVE_SSE41 +#ifndef HAVE_SSSE3 +#define HAVE_SSSE3 +#endif +#endif + +#ifdef HAVE_SSSE3 +#define HAVE_SSE2 +#endif + +#if !defined(HAVE_SSE2) +#error "This code requires at least SSE2." +#endif + +#endif + Added: head/sys/contrib/libb2/blake2-dispatch.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/libb2/blake2-dispatch.c Wed Mar 21 16:18:14 2018 (r331312) @@ -0,0 +1,577 @@ +/* + BLAKE2 reference source code package - optimized C implementations + + Written in 2012 by Samuel Neves + + To the extent possible under law, the author(s) have dedicated all copyright + and related and neighboring rights to this software to the public domain + worldwide. This software is distributed without any warranty. + + You should have received a copy of the CC0 Public Domain Dedication along with + this software. If not, see . +*/ +#include +#if defined(WIN32) +#include +#endif +#include "blake2.h" + +#if defined(__x86_64__) || defined(__i386__) || defined(_M_IX86) || defined(_M_X64) +#define HAVE_X86 +#endif + +typedef enum +{ + NONE = 0, +#if defined(HAVE_X86) + SSE2 = 1, + SSSE3 = 2, + SSE41 = 3, + AVX = 4, + XOP = 5, + /* AVX2 = 6, */ +#endif +} cpu_feature_t; + +static const char feature_names[][8] = +{ + "none", +#if defined(HAVE_X86) + "sse2", + "ssse3", + "sse41", + "avx", + "xop", + /* "avx2" */ +#endif +}; + +#if defined(HAVE_X86) + +#if defined(__GNUC__) +static inline void cpuid( uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx ) +{ + __asm__ __volatile__( +#if defined(__i386__) /* This is needed for -fPIC to work on i386 */ + "movl %%ebx, %%esi\n\t" +#endif + "cpuid\n\t" +#if defined(__i386__) + "xchgl %%ebx, %%esi\n\t" + : "=a"( *eax ), "=S"( *ebx ), "=c"( *ecx ), "=d"( *edx ) : "a"( *eax ) ); +#else + : "=a"( *eax ), "=b"( *ebx ), "=c"( *ecx ), "=d"( *edx ) : "a"( *eax ) ); +#endif +} + +static inline uint64_t xgetbv(uint32_t xcr) +{ + uint32_t a, d; + __asm__ __volatile__( + "xgetbv" + : "=a"(a),"=d"(d) + : "c"(xcr) + ); + return ((uint64_t)d << 32) | a; +} + +#elif defined(_MSC_VER) +#include +static inline void cpuid( uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx ) +{ + int regs[4]; + __cpuid( regs, *eax ); + *eax = regs[0]; + *ebx = regs[1]; + *ecx = regs[2]; + *edx = regs[3]; +} +#else +#error "Don't know how to call cpuid on this compiler!" +#endif + +#endif /* HAVE_X86 */ + +static inline cpu_feature_t get_cpu_features( void ) +{ +#if defined(HAVE_X86) + static volatile int initialized = 0; + static cpu_feature_t feature = NONE; // Safe default + uint32_t eax, ecx, edx, ebx; + + if( initialized ) + return feature; + + eax = 1; + cpuid( &eax, &ebx, &ecx, &edx ); + + if( 1 & ( edx >> 26 ) ) + feature = SSE2; + + if( 1 & ( ecx >> 9 ) ) + feature = SSSE3; + + if( 1 & ( ecx >> 19 ) ) + feature = SSE41; + +#if defined(WIN32) /* Work around the fact that Windows <7 does NOT support AVX... */ + if( IsProcessorFeaturePresent(17) ) /* Some environments don't know about PF_XSAVE_ENABLED */ +#endif + { + /* check for AVX and OSXSAVE bits */ + if( 1 & ( ecx >> 28 ) & (ecx >> 27) ) { +#if !defined(WIN32) /* Already checked for this in WIN32 */ + if( (xgetbv(0) & 6) == 6 ) /* XCR0 */ +#endif + feature = AVX; + } + + + eax = 0x80000001; + cpuid( &eax, &ebx, &ecx, &edx ); + + if( 1 & ( ecx >> 11 ) ) + feature = XOP; + } + + /* For future architectures */ + /* + eax = 7; ecx = 0; + cpuid(&eax, &ebx, &ecx, &edx); + + if(1&(ebx >> 5)) + feature = AVX2; + */ + /* fprintf( stderr, "Using %s engine\n", feature_names[feature] ); */ + initialized = 1; + return feature; +#else + return NONE; +#endif +} + + + +#if defined(__cplusplus) +extern "C" { +#endif + int blake2b_init_ref( blake2b_state *S, size_t outlen ); + int blake2b_init_key_ref( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2b_init_param_ref( blake2b_state *S, const blake2b_param *P ); + int blake2b_update_ref( blake2b_state *S, const uint8_t *in, size_t inlen ); + int blake2b_final_ref( blake2b_state *S, uint8_t *out, size_t outlen ); + int blake2b_ref( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + +#if defined(HAVE_X86) + + int blake2b_init_sse2( blake2b_state *S, size_t outlen ); + int blake2b_init_key_sse2( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2b_init_param_sse2( blake2b_state *S, const blake2b_param *P ); + int blake2b_update_sse2( blake2b_state *S, const uint8_t *in, size_t inlen ); + int blake2b_final_sse2( blake2b_state *S, uint8_t *out, size_t outlen ); + int blake2b_sse2( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2b_init_ssse3( blake2b_state *S, size_t outlen ); + int blake2b_init_key_ssse3( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2b_init_param_ssse3( blake2b_state *S, const blake2b_param *P ); + int blake2b_update_ssse3( blake2b_state *S, const uint8_t *in, size_t inlen ); + int blake2b_final_ssse3( blake2b_state *S, uint8_t *out, size_t outlen ); + int blake2b_ssse3( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2b_init_sse41( blake2b_state *S, size_t outlen ); + int blake2b_init_key_sse41( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2b_init_param_sse41( blake2b_state *S, const blake2b_param *P ); + int blake2b_update_sse41( blake2b_state *S, const uint8_t *in, size_t inlen ); + int blake2b_final_sse41( blake2b_state *S, uint8_t *out, size_t outlen ); + int blake2b_sse41( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2b_init_avx( blake2b_state *S, size_t outlen ); + int blake2b_init_key_avx( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2b_init_param_avx( blake2b_state *S, const blake2b_param *P ); + int blake2b_update_avx( blake2b_state *S, const uint8_t *in, size_t inlen ); + int blake2b_final_avx( blake2b_state *S, uint8_t *out, size_t outlen ); + int blake2b_avx( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2b_init_xop( blake2b_state *S, size_t outlen ); + int blake2b_init_key_xop( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2b_init_param_xop( blake2b_state *S, const blake2b_param *P ); + int blake2b_update_xop( blake2b_state *S, const uint8_t *in, size_t inlen ); + int blake2b_final_xop( blake2b_state *S, uint8_t *out, size_t outlen ); + int blake2b_xop( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + +#endif /* HAVE_X86 */ + + int blake2s_init_ref( blake2s_state *S, size_t outlen ); + int blake2s_init_key_ref( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2s_init_param_ref( blake2s_state *S, const blake2s_param *P ); + int blake2s_update_ref( blake2s_state *S, const uint8_t *in, size_t inlen ); + int blake2s_final_ref( blake2s_state *S, uint8_t *out, size_t outlen ); + int blake2s_ref( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + +#if defined(HAVE_X86) + + int blake2s_init_sse2( blake2s_state *S, size_t outlen ); + int blake2s_init_key_sse2( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2s_init_param_sse2( blake2s_state *S, const blake2s_param *P ); + int blake2s_update_sse2( blake2s_state *S, const uint8_t *in, size_t inlen ); + int blake2s_final_sse2( blake2s_state *S, uint8_t *out, size_t outlen ); + int blake2s_sse2( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2s_init_ssse3( blake2s_state *S, size_t outlen ); + int blake2s_init_key_ssse3( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2s_init_param_ssse3( blake2s_state *S, const blake2s_param *P ); + int blake2s_update_ssse3( blake2s_state *S, const uint8_t *in, size_t inlen ); + int blake2s_final_ssse3( blake2s_state *S, uint8_t *out, size_t outlen ); + int blake2s_ssse3( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2s_init_sse41( blake2s_state *S, size_t outlen ); + int blake2s_init_key_sse41( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2s_init_param_sse41( blake2s_state *S, const blake2s_param *P ); + int blake2s_update_sse41( blake2s_state *S, const uint8_t *in, size_t inlen ); + int blake2s_final_sse41( blake2s_state *S, uint8_t *out, size_t outlen ); + int blake2s_sse41( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2s_init_avx( blake2s_state *S, size_t outlen ); + int blake2s_init_key_avx( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2s_init_param_avx( blake2s_state *S, const blake2s_param *P ); + int blake2s_update_avx( blake2s_state *S, const uint8_t *in, size_t inlen ); + int blake2s_final_avx( blake2s_state *S, uint8_t *out, size_t outlen ); + int blake2s_avx( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2s_init_xop( blake2s_state *S, size_t outlen ); + int blake2s_init_key_xop( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2s_init_param_xop( blake2s_state *S, const blake2s_param *P ); + int blake2s_update_xop( blake2s_state *S, const uint8_t *in, size_t inlen ); + int blake2s_final_xop( blake2s_state *S, uint8_t *out, size_t outlen ); + int blake2s_xop( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + +#endif /* HAVE_X86 */ + +#if defined(__cplusplus) +} +#endif + +typedef int ( *blake2b_init_fn )( blake2b_state *, size_t ); +typedef int ( *blake2b_init_key_fn )( blake2b_state *, size_t, const void *, size_t ); +typedef int ( *blake2b_init_param_fn )( blake2b_state *, const blake2b_param * ); +typedef int ( *blake2b_update_fn )( blake2b_state *, const uint8_t *, size_t ); +typedef int ( *blake2b_final_fn )( blake2b_state *, uint8_t *, size_t ); +typedef int ( *blake2b_fn )( uint8_t *, const void *, const void *, size_t, size_t, size_t ); + +typedef int ( *blake2s_init_fn )( blake2s_state *, size_t ); +typedef int ( *blake2s_init_key_fn )( blake2s_state *, size_t, const void *, size_t ); +typedef int ( *blake2s_init_param_fn )( blake2s_state *, const blake2s_param * ); +typedef int ( *blake2s_update_fn )( blake2s_state *, const uint8_t *, size_t ); +typedef int ( *blake2s_final_fn )( blake2s_state *, uint8_t *, size_t ); +typedef int ( *blake2s_fn )( uint8_t *, const void *, const void *, size_t, size_t, size_t ); + +static const blake2b_init_fn blake2b_init_table[] = +{ + blake2b_init_ref, +#if defined(HAVE_X86) + blake2b_init_sse2, + blake2b_init_ssse3, + blake2b_init_sse41, + blake2b_init_avx, + blake2b_init_xop +#endif +}; + +static const blake2b_init_key_fn blake2b_init_key_table[] = +{ + blake2b_init_key_ref, +#if defined(HAVE_X86) + blake2b_init_key_sse2, + blake2b_init_key_ssse3, + blake2b_init_key_sse41, + blake2b_init_key_avx, + blake2b_init_key_xop +#endif +}; + +static const blake2b_init_param_fn blake2b_init_param_table[] = +{ + blake2b_init_param_ref, +#if defined(HAVE_X86) + blake2b_init_param_sse2, + blake2b_init_param_ssse3, + blake2b_init_param_sse41, + blake2b_init_param_avx, + blake2b_init_param_xop +#endif +}; + +static const blake2b_update_fn blake2b_update_table[] = +{ + blake2b_update_ref, +#if defined(HAVE_X86) + blake2b_update_sse2, + blake2b_update_ssse3, + blake2b_update_sse41, + blake2b_update_avx, + blake2b_update_xop +#endif +}; + +static const blake2b_final_fn blake2b_final_table[] = +{ + blake2b_final_ref, +#if defined(HAVE_X86) + blake2b_final_sse2, + blake2b_final_ssse3, + blake2b_final_sse41, + blake2b_final_avx, + blake2b_final_xop +#endif +}; + +static const blake2b_fn blake2b_table[] = +{ + blake2b_ref, +#if defined(HAVE_X86) + blake2b_sse2, + blake2b_ssse3, + blake2b_sse41, + blake2b_avx, + blake2b_xop +#endif +}; + +static const blake2s_init_fn blake2s_init_table[] = +{ + blake2s_init_ref, +#if defined(HAVE_X86) + blake2s_init_sse2, + blake2s_init_ssse3, + blake2s_init_sse41, + blake2s_init_avx, + blake2s_init_xop +#endif +}; + +static const blake2s_init_key_fn blake2s_init_key_table[] = +{ + blake2s_init_key_ref, +#if defined(HAVE_X86) + blake2s_init_key_sse2, + blake2s_init_key_ssse3, + blake2s_init_key_sse41, + blake2s_init_key_avx, + blake2s_init_key_xop +#endif +}; + +static const blake2s_init_param_fn blake2s_init_param_table[] = +{ + blake2s_init_param_ref, +#if defined(HAVE_X86) + blake2s_init_param_sse2, + blake2s_init_param_ssse3, + blake2s_init_param_sse41, + blake2s_init_param_avx, + blake2s_init_param_xop +#endif +}; + +static const blake2s_update_fn blake2s_update_table[] = +{ + blake2s_update_ref, +#if defined(HAVE_X86) + blake2s_update_sse2, + blake2s_update_ssse3, + blake2s_update_sse41, + blake2s_update_avx, + blake2s_update_xop +#endif +}; + +static const blake2s_final_fn blake2s_final_table[] = +{ + blake2s_final_ref, +#if defined(HAVE_X86) + blake2s_final_sse2, + blake2s_final_ssse3, + blake2s_final_sse41, + blake2s_final_avx, + blake2s_final_xop +#endif +}; + +static const blake2s_fn blake2s_table[] = +{ + blake2s_ref, +#if defined(HAVE_X86) + blake2s_sse2, + blake2s_ssse3, + blake2s_sse41, + blake2s_avx, + blake2s_xop +#endif +}; + +#if defined(__cplusplus) +extern "C" { +#endif + int blake2b_init_dispatch( blake2b_state *S, size_t outlen ); + int blake2b_init_key_dispatch( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2b_init_param_dispatch( blake2b_state *S, const blake2b_param *P ); + int blake2b_update_dispatch( blake2b_state *S, const uint8_t *in, size_t inlen ); + int blake2b_final_dispatch( blake2b_state *S, uint8_t *out, size_t outlen ); + int blake2b_dispatch( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + int blake2s_init_dispatch( blake2s_state *S, size_t outlen ); + int blake2s_init_key_dispatch( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + int blake2s_init_param_dispatch( blake2s_state *S, const blake2s_param *P ); + int blake2s_update_dispatch( blake2s_state *S, const uint8_t *in, size_t inlen ); + int blake2s_final_dispatch( blake2s_state *S, uint8_t *out, size_t outlen ); + int blake2s_dispatch( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); +#if defined(__cplusplus) +} +#endif + +static blake2b_init_fn blake2b_init_ptr = blake2b_init_dispatch; +static blake2b_init_key_fn blake2b_init_key_ptr = blake2b_init_key_dispatch; +static blake2b_init_param_fn blake2b_init_param_ptr = blake2b_init_param_dispatch; +static blake2b_update_fn blake2b_update_ptr = blake2b_update_dispatch; +static blake2b_final_fn blake2b_final_ptr = blake2b_final_dispatch; +static blake2b_fn blake2b_ptr = blake2b_dispatch; + +static blake2s_init_fn blake2s_init_ptr = blake2s_init_dispatch; +static blake2s_init_key_fn blake2s_init_key_ptr = blake2s_init_key_dispatch; +static blake2s_init_param_fn blake2s_init_param_ptr = blake2s_init_param_dispatch; +static blake2s_update_fn blake2s_update_ptr = blake2s_update_dispatch; +static blake2s_final_fn blake2s_final_ptr = blake2s_final_dispatch; +static blake2s_fn blake2s_ptr = blake2s_dispatch; + +int blake2b_init_dispatch( blake2b_state *S, size_t outlen ) +{ + blake2b_init_ptr = blake2b_init_table[get_cpu_features()]; + return blake2b_init_ptr( S, outlen ); +} + +int blake2b_init_key_dispatch( blake2b_state *S, size_t outlen, const void *key, size_t keylen ) +{ + blake2b_init_key_ptr = blake2b_init_key_table[get_cpu_features()]; + return blake2b_init_key_ptr( S, outlen, key, keylen ); +} + +int blake2b_init_param_dispatch( blake2b_state *S, const blake2b_param *P ) +{ + blake2b_init_param_ptr = blake2b_init_param_table[get_cpu_features()]; + return blake2b_init_param_ptr( S, P ); +} + +int blake2b_update_dispatch( blake2b_state *S, const uint8_t *in, size_t inlen ) +{ + blake2b_update_ptr = blake2b_update_table[get_cpu_features()]; + return blake2b_update_ptr( S, in, inlen ); +} + +int blake2b_final_dispatch( blake2b_state *S, uint8_t *out, size_t outlen ) +{ + blake2b_final_ptr = blake2b_final_table[get_cpu_features()]; + return blake2b_final_ptr( S, out, outlen ); +} + +int blake2b_dispatch( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ) +{ + blake2b_ptr = blake2b_table[get_cpu_features()]; + return blake2b_ptr( out, in, key, outlen, inlen, keylen ); +} + +BLAKE2_API int blake2b_init( blake2b_state *S, size_t outlen ) +{ + return blake2b_init_ptr( S, outlen ); +} + +BLAKE2_API int blake2b_init_key( blake2b_state *S, size_t outlen, const void *key, size_t keylen ) +{ + return blake2b_init_key_ptr( S, outlen, key, keylen ); +} + +BLAKE2_API int blake2b_init_param( blake2b_state *S, const blake2b_param *P ) +{ + return blake2b_init_param_ptr( S, P ); +} + +BLAKE2_API int blake2b_update( blake2b_state *S, const uint8_t *in, size_t inlen ) +{ + return blake2b_update_ptr( S, in, inlen ); +} + +BLAKE2_API int blake2b_final( blake2b_state *S, uint8_t *out, size_t outlen ) +{ + return blake2b_final_ptr( S, out, outlen ); +} + +BLAKE2_API int blake2b( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ) +{ + return blake2b_ptr( out, in, key, outlen, inlen, keylen ); +} + +int blake2s_init_dispatch( blake2s_state *S, size_t outlen ) +{ + blake2s_init_ptr = blake2s_init_table[get_cpu_features()]; + return blake2s_init_ptr( S, outlen ); +} + +int blake2s_init_key_dispatch( blake2s_state *S, size_t outlen, const void *key, size_t keylen ) +{ + blake2s_init_key_ptr = blake2s_init_key_table[get_cpu_features()]; + return blake2s_init_key_ptr( S, outlen, key, keylen ); +} + +int blake2s_init_param_dispatch( blake2s_state *S, const blake2s_param *P ) +{ + blake2s_init_param_ptr = blake2s_init_param_table[get_cpu_features()]; + return blake2s_init_param_ptr( S, P ); +} + +int blake2s_update_dispatch( blake2s_state *S, const uint8_t *in, size_t inlen ) +{ + blake2s_update_ptr = blake2s_update_table[get_cpu_features()]; + return blake2s_update_ptr( S, in, inlen ); +} + +int blake2s_final_dispatch( blake2s_state *S, uint8_t *out, size_t outlen ) +{ + blake2s_final_ptr = blake2s_final_table[get_cpu_features()]; + return blake2s_final_ptr( S, out, outlen ); +} + +int blake2s_dispatch( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ) +{ + blake2s_ptr = blake2s_table[get_cpu_features()]; + return blake2s_ptr( out, in, key, outlen, inlen, keylen ); +} + +BLAKE2_API int blake2s_init( blake2s_state *S, size_t outlen ) +{ + return blake2s_init_ptr( S, outlen ); +} + +BLAKE2_API int blake2s_init_key( blake2s_state *S, size_t outlen, const void *key, size_t keylen ) +{ + return blake2s_init_key_ptr( S, outlen, key, keylen ); +} + +BLAKE2_API int blake2s_init_param( blake2s_state *S, const blake2s_param *P ) +{ + return blake2s_init_param_ptr( S, P ); +} + +BLAKE2_API int blake2s_update( blake2s_state *S, const uint8_t *in, size_t inlen ) +{ + return blake2s_update_ptr( S, in, inlen ); +} + +BLAKE2_API int blake2s_final( blake2s_state *S, uint8_t *out, size_t outlen ) +{ + return blake2s_final_ptr( S, out, outlen ); +} + +BLAKE2_API int blake2s( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ) +{ + return blake2s_ptr( out, in, key, outlen, inlen, keylen ); +} + Added: head/sys/contrib/libb2/blake2-impl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/libb2/blake2-impl.h Wed Mar 21 16:18:14 2018 (r331312) @@ -0,0 +1,143 @@ +/* + BLAKE2 reference source code package - optimized C implementations + + Written in 2012 by Samuel Neves + + To the extent possible under law, the author(s) have dedicated all copyright + and related and neighboring rights to this software to the public domain + worldwide. This software is distributed without any warranty. + + You should have received a copy of the CC0 Public Domain Dedication along with + this software. If not, see . +*/ +#pragma once +#ifndef __BLAKE2_IMPL_H__ +#define __BLAKE2_IMPL_H__ + +#include +#include +#include +#include "config.h" + +#define BLAKE2_IMPL_CAT(x,y) x ## y +#define BLAKE2_IMPL_EVAL(x,y) BLAKE2_IMPL_CAT(x,y) +#define BLAKE2_IMPL_NAME(fun) BLAKE2_IMPL_EVAL(fun, SUFFIX) + +static inline uint32_t load32( const void *src ) +{ +#if defined(NATIVE_LITTLE_ENDIAN) && !defined(HAVE_ALIGNED_ACCESS_REQUIRED) + return *( uint32_t * )( src ); +#else + const uint8_t *p = ( uint8_t * )src; + uint32_t w = *p++; + w |= ( uint32_t )( *p++ ) << 8; + w |= ( uint32_t )( *p++ ) << 16; + w |= ( uint32_t )( *p++ ) << 24; + return w; +#endif +} + +static inline uint64_t load64( const void *src ) +{ +#if defined(NATIVE_LITTLE_ENDIAN) && !defined(HAVE_ALIGNED_ACCESS_REQUIRED) + return *( uint64_t * )( src ); +#else + const uint8_t *p = ( uint8_t * )src; + uint64_t w = *p++; + w |= ( uint64_t )( *p++ ) << 8; + w |= ( uint64_t )( *p++ ) << 16; + w |= ( uint64_t )( *p++ ) << 24; + w |= ( uint64_t )( *p++ ) << 32; + w |= ( uint64_t )( *p++ ) << 40; + w |= ( uint64_t )( *p++ ) << 48; + w |= ( uint64_t )( *p++ ) << 56; + return w; +#endif +} + +static inline void store32( void *dst, uint32_t w ) +{ +#if defined(NATIVE_LITTLE_ENDIAN) && !defined(HAVE_ALIGNED_ACCESS_REQUIRED) + *( uint32_t * )( dst ) = w; +#else + uint8_t *p = ( uint8_t * )dst; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; +#endif +} + +static inline void store64( void *dst, uint64_t w ) +{ +#if defined(NATIVE_LITTLE_ENDIAN) && !defined(HAVE_ALIGNED_ACCESS_REQUIRED) + *( uint64_t * )( dst ) = w; +#else + uint8_t *p = ( uint8_t * )dst; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; +#endif +} + +static inline uint64_t load48( const void *src ) +{ + const uint8_t *p = ( const uint8_t * )src; + uint64_t w = *p++; + w |= ( uint64_t )( *p++ ) << 8; + w |= ( uint64_t )( *p++ ) << 16; + w |= ( uint64_t )( *p++ ) << 24; + w |= ( uint64_t )( *p++ ) << 32; + w |= ( uint64_t )( *p++ ) << 40; + return w; +} + +static inline void store48( void *dst, uint64_t w ) +{ + uint8_t *p = ( uint8_t * )dst; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; w >>= 8; + *p++ = ( uint8_t )w; +} + +static inline uint32_t rotl32( const uint32_t w, const unsigned c ) +{ + return ( w << c ) | ( w >> ( 32 - c ) ); +} + +static inline uint64_t rotl64( const uint64_t w, const unsigned c ) +{ + return ( w << c ) | ( w >> ( 64 - c ) ); +} + +static inline uint32_t rotr32( const uint32_t w, const unsigned c ) +{ + return ( w >> c ) | ( w << ( 32 - c ) ); +} + +static inline uint64_t rotr64( const uint64_t w, const unsigned c ) +{ + return ( w >> c ) | ( w << ( 64 - c ) ); +} + +/* prevents compiler optimizing out memset() */ +static inline void secure_zero_memory(void *v, size_t n) +{ +#ifdef __FreeBSD__ + explicit_bzero(v, n); +#else + static void *(*const volatile memset_v)(void *, int, size_t) = &memset; + memset_v(v, 0, n); +#endif +} + +#endif + Added: head/sys/contrib/libb2/blake2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/libb2/blake2.h Wed Mar 21 16:18:14 2018 (r331312) @@ -0,0 +1,182 @@ +/* + BLAKE2 reference source code package - optimized C implementations + + Written in 2012 by Samuel Neves + + To the extent possible under law, the author(s) have dedicated all copyright + and related and neighboring rights to this software to the public domain + worldwide. This software is distributed without any warranty. + + You should have received a copy of the CC0 Public Domain Dedication along with + this software. If not, see . +*/ +#pragma once +#ifndef __BLAKE2_H__ +#define __BLAKE2_H__ + +#include +#include + +#if defined(_WIN32) || defined(__CYGWIN__) + #define BLAKE2_DLL_IMPORT __declspec(dllimport) + #define BLAKE2_DLL_EXPORT __declspec(dllexport) + #define BLAKE2_DLL_PRIVATE +#elif __GNUC__ >= 4 + #define BLAKE2_DLL_IMPORT __attribute__ ((visibility ("default"))) + #define BLAKE2_DLL_EXPORT __attribute__ ((visibility ("default"))) + #define BLAKE2_DLL_PRIVATE __attribute__ ((visibility ("hidden"))) +#else + #define BLAKE2_DLL_IMPORT + #define BLAKE2_DLL_EXPORT + #define BLAKE2_DLL_PRIVATE +#endif + +#if defined(BLAKE2_DLL) + #if defined(BLAKE2_DLL_EXPORTS) // defined if we are building the DLL + #define BLAKE2_API BLAKE2_DLL_EXPORT + #else + #define BLAKE2_API BLAKE2_DLL_IMPORT + #endif + #define BLAKE2_PRIVATE BLAKE2_DLL_PRIVATE // must only be used by hidden logic +#else + #define BLAKE2_API + #define BLAKE2_PRIVATE +#endif + +#if defined(__cplusplus) +extern "C" { +#elif defined(_MSC_VER) && !defined(inline) +#define inline __inline +#endif + + enum blake2s_constant + { + BLAKE2S_BLOCKBYTES = 64, + BLAKE2S_OUTBYTES = 32, + BLAKE2S_KEYBYTES = 32, + BLAKE2S_SALTBYTES = 8, + BLAKE2S_PERSONALBYTES = 8 + }; + + enum blake2b_constant + { + BLAKE2B_BLOCKBYTES = 128, + BLAKE2B_OUTBYTES = 64, + BLAKE2B_KEYBYTES = 64, + BLAKE2B_SALTBYTES = 16, + BLAKE2B_PERSONALBYTES = 16 + }; + +#pragma pack(push, 1) + typedef struct __blake2s_param + { + uint8_t digest_length; // 1 + uint8_t key_length; // 2 + uint8_t fanout; // 3 + uint8_t depth; // 4 + uint32_t leaf_length; // 8 + uint8_t node_offset[6];// 14 + uint8_t node_depth; // 15 + uint8_t inner_length; // 16 + // uint8_t reserved[0]; + uint8_t salt[BLAKE2S_SALTBYTES]; // 24 + uint8_t personal[BLAKE2S_PERSONALBYTES]; // 32 + } blake2s_param; + + typedef struct __blake2s_state + { + uint32_t h[8]; + uint32_t t[2]; + uint32_t f[2]; + uint8_t buf[2 * BLAKE2S_BLOCKBYTES]; + uint32_t buflen; + uint8_t outlen; + uint8_t last_node; + } blake2s_state; + + typedef struct __blake2b_param + { + uint8_t digest_length; // 1 + uint8_t key_length; // 2 + uint8_t fanout; // 3 + uint8_t depth; // 4 + uint32_t leaf_length; // 8 + uint64_t node_offset; // 16 + uint8_t node_depth; // 17 + uint8_t inner_length; // 18 + uint8_t reserved[14]; // 32 + uint8_t salt[BLAKE2B_SALTBYTES]; // 48 + uint8_t personal[BLAKE2B_PERSONALBYTES]; // 64 + } blake2b_param; + + typedef struct __blake2b_state + { + uint64_t h[8]; + uint64_t t[2]; + uint64_t f[2]; + uint8_t buf[2 * BLAKE2B_BLOCKBYTES]; + uint32_t buflen; + uint8_t outlen; + uint8_t last_node; + } blake2b_state; + + typedef struct __blake2sp_state + { + blake2s_state S[8][1]; + blake2s_state R[1]; + uint8_t buf[8 * BLAKE2S_BLOCKBYTES]; + uint32_t buflen; + uint8_t outlen; + } blake2sp_state; + + typedef struct __blake2bp_state + { + blake2b_state S[4][1]; + blake2b_state R[1]; + uint8_t buf[4 * BLAKE2B_BLOCKBYTES]; + uint32_t buflen; + uint8_t outlen; + } blake2bp_state; +#pragma pack(pop) + + // Streaming API + BLAKE2_API int blake2s_init( blake2s_state *S, size_t outlen ); + BLAKE2_API int blake2s_init_key( blake2s_state *S, size_t outlen, const void *key, size_t keylen ); + BLAKE2_API int blake2s_init_param( blake2s_state *S, const blake2s_param *P ); + BLAKE2_API int blake2s_update( blake2s_state *S, const uint8_t *in, size_t inlen ); + BLAKE2_API int blake2s_final( blake2s_state *S, uint8_t *out, size_t outlen ); + + BLAKE2_API int blake2b_init( blake2b_state *S, size_t outlen ); + BLAKE2_API int blake2b_init_key( blake2b_state *S, size_t outlen, const void *key, size_t keylen ); + BLAKE2_API int blake2b_init_param( blake2b_state *S, const blake2b_param *P ); + BLAKE2_API int blake2b_update( blake2b_state *S, const uint8_t *in, size_t inlen ); + BLAKE2_API int blake2b_final( blake2b_state *S, uint8_t *out, size_t outlen ); + + BLAKE2_API int blake2sp_init( blake2sp_state *S, size_t outlen ); + BLAKE2_API int blake2sp_init_key( blake2sp_state *S, size_t outlen, const void *key, size_t keylen ); + BLAKE2_API int blake2sp_update( blake2sp_state *S, const uint8_t *in, size_t inlen ); + BLAKE2_API int blake2sp_final( blake2sp_state *S, uint8_t *out, size_t outlen ); + + BLAKE2_API int blake2bp_init( blake2bp_state *S, size_t outlen ); + BLAKE2_API int blake2bp_init_key( blake2bp_state *S, size_t outlen, const void *key, size_t keylen ); + BLAKE2_API int blake2bp_update( blake2bp_state *S, const uint8_t *in, size_t inlen ); + BLAKE2_API int blake2bp_final( blake2bp_state *S, uint8_t *out, size_t outlen ); + + // Simple API + BLAKE2_API int blake2s( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + BLAKE2_API int blake2b( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + BLAKE2_API int blake2sp( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + BLAKE2_API int blake2bp( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ); + + static inline int blake2( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen ) + { + return blake2b( out, in, key, outlen, inlen, keylen ); + } + +#if defined(__cplusplus) +} +#endif + +#endif *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Mar 21 16:46:14 2018 Return-Path: Delivered-To: svn-src-head@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 DC98AF5377D; Wed, 21 Mar 2018 16:46:14 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 7CF987A0C3; Wed, 21 Mar 2018 16:46:14 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from [IPv6:2001:630:212:2a8:c475:595a:854e:1122] (unknown [IPv6:2001:630:212:2a8:c475:595a:854e:1122]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 9B0644EB9F; Wed, 21 Mar 2018 16:45:35 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: svn commit: r331306 - head/sys/dev/usb/controller From: Andrew Turner In-Reply-To: Date: Wed, 21 Mar 2018 16:45:34 +0000 Cc: Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <898DF1A6-F1D2-474C-92B5-12F65DC71A40@fubar.geek.nz> References: <201803211517.w2LFHsHf007714@repo.freebsd.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.3445.5.20) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 16:46:15 -0000 > On 21 Mar 2018, at 15:37, Hans Petter Selasky wrote: >=20 > On 03/21/18 16:24, Kyle Evans wrote: >>> + { >>> + .ep_end =3D 7, >>> + .ep_fifosz_shift =3D 9, >>> + .ep_fifosz_reg =3D MUSB2_VAL_FIFOSZ_512 | = MUSB2_MASK_FIFODB, >>> + }, >> I'm afraid I'm not familiar with this- why did .ep_fifosz_shift for >> this case drop to 9? frx =3D 10 in the temp < 8 case in the removals = of >> the following hunks. Mostly curious because the others seemed to stay >> the same. >=20 > Hi Andrew, >=20 > It might be an idea to keep the fifosz_shift at 10, else high-speed = BULK traffic won't be double buffered, and this might affect = performance. Should the endpoint 1 size also be fixed? The register has it at 4k, but = it wasn=E2=80=99t an 8k buffer. Andrew From owner-svn-src-head@freebsd.org Wed Mar 21 17:22:42 2018 Return-Path: Delivered-To: svn-src-head@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 D39D1F56020; Wed, 21 Mar 2018 17:22:42 +0000 (UTC) (envelope-from csjp@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 8580E7BE1E; Wed, 21 Mar 2018 17:22:42 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 8067C2D9BA; Wed, 21 Mar 2018 17:22:42 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LHMgdQ074370; Wed, 21 Mar 2018 17:22:42 GMT (envelope-from csjp@FreeBSD.org) Received: (from csjp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LHMgCZ074369; Wed, 21 Mar 2018 17:22:42 GMT (envelope-from csjp@FreeBSD.org) Message-Id: <201803211722.w2LHMgCZ074369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: csjp set sender to csjp@FreeBSD.org using -f From: "Christian S.J. Peron" Date: Wed, 21 Mar 2018 17:22:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331313 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: csjp X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 331313 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 17:22:43 -0000 Author: csjp Date: Wed Mar 21 17:22:42 2018 New Revision: 331313 URL: https://svnweb.freebsd.org/changeset/base/331313 Log: Document the limitations associated with using the audit syscalls from jailed process. These might get implemented in jails in the future, but for now they are not supported. Discussed on: freebsd-security@ Reviewed by: brueffer@ MFC after: 2 weeks Modified: head/share/man/man4/audit.4 Modified: head/share/man/man4/audit.4 ============================================================================== --- head/share/man/man4/audit.4 Wed Mar 21 16:18:14 2018 (r331312) +++ head/share/man/man4/audit.4 Wed Mar 21 17:22:42 2018 (r331313) @@ -138,3 +138,11 @@ incomplete argument information. Mandatory Access Control (MAC) labels, as provided by the .Xr mac 4 facility, are not audited as part of records involving MAC decisions. +.Pp +Currently the +.Nm +syscalls are not supported for jailed processes. +However, if a process has +.Nm +session state associated with it, audit records will still be produced and a zonename token +containing the jail's ID or name will be present in the audit records. From owner-svn-src-head@freebsd.org Wed Mar 21 17:31:42 2018 Return-Path: Delivered-To: svn-src-head@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 0C23FF56A61; Wed, 21 Mar 2018 17:31:42 +0000 (UTC) (envelope-from delphij@gmail.com) Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8E0187C5E7; Wed, 21 Mar 2018 17:31:41 +0000 (UTC) (envelope-from delphij@gmail.com) Received: by mail-io0-x244.google.com with SMTP id v13so7586883iob.6; Wed, 21 Mar 2018 10:31:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GLmxFYI560FWvzUg0kb0meObKjL4olL5Zy88+ZMYD8Q=; b=ReQXEGoccz7wfX+W/UyKJNuf7x+uzBMV+EpCsq+kxL+Bh1CFtfBZQGp+hoNu7SBnIM dwpEHQo2Hi9FKxF6D81Ye5EVZX+0j1AHbAhdghDXCWjfkyFtgFn25cRVlEXZdveWu3pF cyUPjUGyX7lcfks0fARPjjkM6143NOS+tJPQNuwByqzMPyllSPtBUSdtGm/X9Dx9Vzu3 Kvi5w4Imb9iti+QQ/Pl4X58DYQDp7VOV9xnt6s5ycd5biK3Lu2CaaStgTIeXWWSkhnk9 Q2VRxPZe8yVYMWfYuefcZm8pNcPineVPoqCfcgIw0p0EB9L8ItskLVn651mU5HwJSGeh F/6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GLmxFYI560FWvzUg0kb0meObKjL4olL5Zy88+ZMYD8Q=; b=mK85Lly02m4CJTXmw9OBlPzi32VX49ydlSaDcWbcePVfuiL3bitnuVFVcFxO775C5H nrlHUrx4lU8wDIA5B0wPoUzVuLYM8eJDDRmUDtr9p6rKEDnh+PCKQXRDsB5JapPAm8V6 1FvX0cc7xY2QJmkgZgyA7pHa7d6mceUWVKIbF9nnpUpOFh2MhAzrt79Rr0zP5ac/zjgw X10RJI3xVhakPV4dnQkIuYIDl7SCJuHoWMhbDMLXZGP41McLkT3k/n/jcdbVor0Ci+FW WbaEOGT4CkD5wzbP5YHb1F5C1maQZ1uRDuyAhJ4OFeObBDRJn3AR/aJEtOcVhcbXp6MM pxJA== X-Gm-Message-State: AElRT7Fga5mqoyk276iMKp/4esvbBPAmuzVv/hqqdDB9ghZJHu0HCJ6K moPpCYgtQ+3xYjbaW7UHDUiYtcdPcUOMPujmPe/ykKtr X-Google-Smtp-Source: AG47ELvaSQkL65a7wq0sm5htsKOf7yMlibXoE29pdDwkS8eLPHRZuC2Z8RRBOnU4XuHkE7XEPZfo+UCI4pnz2nQDtjA= X-Received: by 10.107.242.7 with SMTP id q7mr21481066ioh.297.1521653500357; Wed, 21 Mar 2018 10:31:40 -0700 (PDT) MIME-Version: 1.0 References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> <20180321152335.GL76926@kib.kiev.ua> In-Reply-To: From: Xin LI Date: Wed, 21 Mar 2018 17:31:29 +0000 Message-ID: Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss To: Conrad Meyer Cc: Konstantin Belousov , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Xin Li Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 17:31:42 -0000 On Wed, Mar 21, 2018 at 8:37 AM Conrad Meyer wrote: > On Wed, Mar 21, 2018 at 8:23 AM, Konstantin Belousov > wrote: > > On Wed, Mar 21, 2018 at 08:03:16AM -0700, Conrad Meyer wrote: > >> On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov > >> > Libraries must not abort the application. > >> > Esp. libc. > >> > >> What do you propose instead? while (1); ? I don't see that as > >> obviously better. > > > > Return the error to caller, as all, well most, correct library function= s > > do. > > The abort() in case of ENOSYS was proposed by delphij@. It is > intended for users that getentropy() not fail. Another possible > fallback is to use the kern.arandom sysctl. Would this be amenable to > you? > =E2=80=8BMy proposal was: "Note that ENOSYS should be handled by fallback w= ith kern.arandom or an explicit abort() should be done.=E2=80=8B". It seems that a more graceful way of doing this should be something like: if (sysctl({MIB: KERN, ARND}, 2, buf, &buflen_copy, NULL, 0) =3D=3D -1 || buflen_copy !=3D buflen) { /* * The sysctl cannot fail. If it does fail on some FreeBSD * derivative or after some future change, just abort so that * the problem will be found and fixed. abort is not normally * suitable for a library but makes sense here. */ abort(); } Like it was done in srandomdev(). From owner-svn-src-head@freebsd.org Wed Mar 21 17:53:26 2018 Return-Path: Delivered-To: svn-src-head@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 AE774F5860A; Wed, 21 Mar 2018 17:53:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id C61567D739; Wed, 21 Mar 2018 17:53:25 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id B777642C9D5; Thu, 22 Mar 2018 04:53:23 +1100 (AEDT) Date: Thu, 22 Mar 2018 04:53:22 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons In-Reply-To: <201803211447.w2LElDcK091988@repo.freebsd.org> Message-ID: <20180322024846.S4293@besplex.bde.org> References: <201803211447.w2LElDcK091988@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=dk6ZlAi4zWyv9OyJo4MA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 17:53:27 -0000 On Wed, 21 Mar 2018, Warner Losh wrote: > Log: > Unlock giant when calling shutdown_nice() This breaks the driver. Giant is syscons' driver lock, and also the interrupt handler lock for at least the atkbd keyboard driver, so vt sometimes holds the lock for. vt has to sprinkle lots of Giant locking and unlocking where the corresponding locking is automatic for syscons, but this seems to be nonsense in its event handler. vt has to acquire Giant when calling the keyboard driver, but event handling is a call from the keyboard driver, usually from the interrupt handler with a suitable lock held. For atkbd, the suitable lock is Giant -- see atkbd_intr(). (All keyboard drivers that use the kbd(4) for the top level use Giant looking since toe top level specifies D_NEEDGIANT in its cdevsw. I think that is all keyboard drivers.) So where vt_kbdevent() sprinkles Giant, that has no effect since Giant is held by the caller. So vt_kbdevent() calls vt_processkey() with Giant held despite it not acquiring Giant explicitly; vt_processkey() calls vt_machine_kbdevent() and that calls various shutdown functions, all with Giant held. > Modified: head/sys/dev/syscons/syscons.c > ============================================================================== > --- head/sys/dev/syscons/syscons.c Wed Mar 21 14:47:08 2018 (r331297) > +++ head/sys/dev/syscons/syscons.c Wed Mar 21 14:47:12 2018 (r331298) > @@ -3858,22 +3858,28 @@ next_code: > > case RBT: > #ifndef SC_DISABLE_REBOOT > - if (enable_reboot && !(flags & SCGETC_CN)) > + if (enable_reboot && !(flags & SCGETC_CN)) { > + mtx_unlock(&Giant); > shutdown_nice(0); > + } > #endif > break; > > case HALT: > #ifndef SC_DISABLE_REBOOT > - if (enable_reboot && !(flags & SCGETC_CN)) > + if (enable_reboot && !(flags & SCGETC_CN)) { > + mtx_unlock(&Giant); > shutdown_nice(RB_HALT); > + } > #endif > break; > > case PDWN: > #ifndef SC_DISABLE_REBOOT > - if (enable_reboot && !(flags & SCGETC_CN)) > + if (enable_reboot && !(flags & SCGETC_CN)) { > + mtx_unlock(&Giant); > shutdown_nice(RB_HALT|RB_POWEROFF); > + } > #endif > break; The new bugs should cause assertion failures. shutdown_nice() just signals init and returns. Giant is not re-acquired, so assertions should fail when the caller drops the lock. So the shutdown should be a nasty panic. Transiently dropping the lock is probably not fatal depending on what the caller does. On x86 with atkbd, nested interrupts are prevented by masking the in the ATPIC or APIC -- Giant is not really the driver lock, but just a lock for interfacing between related screen and keyboard drivers. Serial console drivers with fast interrupt handlers have much more broken locking for ddb special keys. It is invalid to either drop locks or call the "any" function from a fast interrupt handler, but buggy serial console drivers calls kbd_alt_break(), and that now calls shutdown_nice() and other functions that cannot be called from a fast interrupt handler. ddb keys supply most of the shutdown_nice() functionality for serial consoles, and there are no escape sequence to get this without ddb or maybe another debugger, so these bugs don't affect most users. Handling this correctly requires much the same fix as an unsafe signal handler, and fixes have much the same problems -- not much more than setting a flag is safe, and the flag might never be looked at if the system is in a bad state. However, if a nice shutdown is possible then the sytem must be in a good enough state to poll for flags. For normal signal handlers, there is no problem sending a signal to init or at least with setting a flag and waking up some thread to check the flag. I don't quite understand this commit. It should be valid to send a signal to init() in proc or non-fast ithread context including with Giant held. shutdown_nice() starts with PROC_LOCK(initproc), so it would be a LOR to call it with a spinlock held, and is even more obviously wrong to call it from kbd_alt_break() with interrupts masked and possibly a spinlock held, but Giant is a special sleep lock that causes fewer LORs than most sleep locks. Actual testing shows that doesn't cause a panic, but it also doesn't actually unlock for shutdown_nice(), since the lock is acquired twice and only released once. syscons has much the same extra lock sprinkling for event handling as vt: - intr_event_execute_handlers() acquires Giant and calls atkbdintr() - atkbdintr() calls sckbdevent() - sckbdevent() unnecessarily acquires Giant again - the buggy unlocking drops Giant just once - shutdown_nice() is called with Giant held - the buggy unlocking fails to re-acquire Giant - sckbdevent() releases Giant, leaving it not held - sckbdevent() returns - atkbdintr() returns - intr_event_execute_handlers() releases Giant. This should panic, but it apparently blocks for long enough for init to shut down first. When I trace the last step, I get a panic which might be either from the different timing or just a bug in kdb. Bruce From owner-svn-src-head@freebsd.org Wed Mar 21 18:02:56 2018 Return-Path: Delivered-To: svn-src-head@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 AD39CF59085; Wed, 21 Mar 2018 18:02:56 +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 625977DED4; Wed, 21 Mar 2018 18:02:56 +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 5C08B2E008; Wed, 21 Mar 2018 18:02:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LI2uWX094466; Wed, 21 Mar 2018 18:02:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LI2uu3094465; Wed, 21 Mar 2018 18:02:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803211802.w2LI2uu3094465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 18:02:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331314 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331314 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 18:02:56 -0000 Author: kevans Date: Wed Mar 21 18:02:56 2018 New Revision: 331314 URL: https://svnweb.freebsd.org/changeset/base/331314 Log: lualoader: Use printc when we expect ANSI escape sequences Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Wed Mar 21 17:22:42 2018 (r331313) +++ head/stand/lua/drawer.lua Wed Mar 21 18:02:56 2018 (r331314) @@ -313,7 +313,7 @@ function drawer.drawmenu(menudef) entry_num = entry_num + 1 screen.setcursor(x, y + effective_line_num) - print(entry_num .. ". " .. menuEntryName(menudef, e)) + printc(entry_num .. ". " .. menuEntryName(menudef, e)) -- fill the alias table alias_table[tostring(entry_num)] = e @@ -324,7 +324,7 @@ function drawer.drawmenu(menudef) end else screen.setcursor(x, y + effective_line_num) - print(menuEntryName(menudef, e)) + printc(menuEntryName(menudef, e)) end ::continue:: end From owner-svn-src-head@freebsd.org Wed Mar 21 18:09:32 2018 Return-Path: Delivered-To: svn-src-head@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 1D29AF596F5; Wed, 21 Mar 2018 18:09:32 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com [209.85.214.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AFF537E22A; Wed, 21 Mar 2018 18:09:31 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f45.google.com with SMTP id k135-v6so8019796ite.2; Wed, 21 Mar 2018 11:09:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=649Cx6Ioe4VLdAi4UILCwFSKxOmS0S7mcjiyBWcoYOM=; b=AyQoEuSYMlsdNkR6TwHmN6YrK/NCtdIMdHIwvhvP0pF4KlmMJcwHhxj+q458nQma5O gvzrI7q7i0zW6M0GaY6mhBwI5byiun4TCphUGXHoHvzAedVFtdX+wry0CA+0k+q1O8L7 9RifgCIkIakNMkmzZPi6SkARNN6pd+dfL5gwAeWz13Ci03iaSk48j5wUk9aA5RCpyF24 ilylOpkMAuVwB2G9BlGEtAhYg0bGCYO45UbibojWBTYRm85oS8TiDaR8N4YS4ebvhPnH hco7IcydJuq3W1jFWJi5UqK3/yW04aWS119kr11zo8c7WrUZTYJ8F9EKEgfH6a0HW4fz 6m8Q== X-Gm-Message-State: AElRT7GBTTfWiC4zMw42c3o4tpfQK98e9fxct5Zxv7vINuSgu50VycTW XXP7pomEa6NtxfKeaxyR4SRCtRLV X-Google-Smtp-Source: AIpwx49o8NP+fTQfRrUJKfZSToidChZUFzn590uV7lEj1TszCzz9X8kHP2yRlnH8+IjeyNo+9A+DtQ== X-Received: by 2002:a24:496a:: with SMTP id z103-v6mr3228402ita.133.1521655770012; Wed, 21 Mar 2018 11:09:30 -0700 (PDT) Received: from mail-it0-f48.google.com (mail-it0-f48.google.com. [209.85.214.48]) by smtp.gmail.com with ESMTPSA id m191-v6sm2060464itg.42.2018.03.21.11.09.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 11:09:29 -0700 (PDT) Received: by mail-it0-f48.google.com with SMTP id v194-v6so7868569itb.0; Wed, 21 Mar 2018 11:09:29 -0700 (PDT) X-Received: by 2002:a24:82c1:: with SMTP id t184-v6mr5454758itd.61.1521655769679; Wed, 21 Mar 2018 11:09:29 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.153.132 with HTTP; Wed, 21 Mar 2018 11:09:29 -0700 (PDT) In-Reply-To: References: <201803210115.w2L1Fjt9084698@repo.freebsd.org> <20180321103325.GJ76926@kib.kiev.ua> <20180321152335.GL76926@kib.kiev.ua> From: Conrad Meyer Date: Wed, 21 Mar 2018 11:09:29 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331279 - in head: include lib/libc/gen lib/libc/sys lib/libc/tests/gen sys/compat/freebsd32 sys/conf sys/kern sys/sys tests/sys/kern usr.bin/truss To: Xin LI Cc: Konstantin Belousov , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 18:09:32 -0000 Please see https://reviews.freebsd.org/D14785 . :-) Thanks, Conrad On Wed, Mar 21, 2018 at 10:31 AM, Xin LI wrote: > > > > On Wed, Mar 21, 2018 at 8:37 AM Conrad Meyer wrote: >> >> On Wed, Mar 21, 2018 at 8:23 AM, Konstantin Belousov >> wrote: >> > On Wed, Mar 21, 2018 at 08:03:16AM -0700, Conrad Meyer wrote: >> >> On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov >> >> > Libraries must not abort the application. >> >> > Esp. libc. >> >> >> >> What do you propose instead? while (1); ? I don't see that as >> >> obviously better. >> > >> > Return the error to caller, as all, well most, correct library functions >> > do. >> >> The abort() in case of ENOSYS was proposed by delphij@. It is >> intended for users that getentropy() not fail. Another possible >> fallback is to use the kern.arandom sysctl. Would this be amenable to >> you? > > > My proposal was: "Note that ENOSYS should be handled by fallback with > kern.arandom or an explicit abort() should be done.". > > It seems that a more graceful way of doing this should be something like: > > if (sysctl({MIB: KERN, ARND}, 2, buf, &buflen_copy, NULL, 0) == -1 || > buflen_copy != buflen) { > /* > * The sysctl cannot fail. If it does fail on some FreeBSD > * derivative or after some future change, just abort so that > * the problem will be found and fixed. abort is not normally > * suitable for a library but makes sense here. > */ > abort(); > } > > Like it was done in srandomdev(). From owner-svn-src-head@freebsd.org Wed Mar 21 18:31:22 2018 Return-Path: Delivered-To: svn-src-head@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 6061EF5B080; Wed, 21 Mar 2018 18:31:22 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 9D3ED7F260; Wed, 21 Mar 2018 18:31:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 0683C42CD90; Thu, 22 Mar 2018 05:31:18 +1100 (AEDT) Date: Thu, 22 Mar 2018 05:31:18 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans cc: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons In-Reply-To: <20180322024846.S4293@besplex.bde.org> Message-ID: <20180322050628.U5175@besplex.bde.org> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VJytp5HX c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=_9ZPQwydy-ByBSi8r-QA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 18:31:22 -0000 On Thu, 22 Mar 2018, Bruce Evans wrote: > On Wed, 21 Mar 2018, Warner Losh wrote: > >> Log: >> Unlock giant when calling shutdown_nice() > ... > This breaks the driver. Giant is syscons' driver lock, and also the > interrupt handler lock for at least the atkbd keyboard driver, so vt > sometimes holds the lock for. [That should have been "... lock too".] > ... > Actual testing shows that doesn't cause a panic, but it also doesn't > actually unlock for shutdown_nice(), since the lock is acquired twice > and only released once. syscons has much the same extra lock sprinkling > for event handling as vt: > > - intr_event_execute_handlers() acquires Giant and calls atkbdintr() > - atkbdintr() calls sckbdevent() > - sckbdevent() unnecessarily acquires Giant again > - the buggy unlocking drops Giant just once > - shutdown_nice() is called with Giant held > - the buggy unlocking fails to re-acquire Giant > - sckbdevent() releases Giant, leaving it not held > - sckbdevent() returns > - atkbdintr() returns > - intr_event_execute_handlers() releases Giant. This should panic, but > it apparently blocks for long enough for init to shut down first. > > When I trace the last step, I get a panic which might be either from the > different timing or just a bug in kdb. Testing with a kernel with other bugs fixed shows that the invariants violation really is detected, causing a panic instead of a nice shutdown for Ctrl-Alt-Del, but recursive panics pile up and printf() in -current is too broken to print anything. A better kernel prints: XX ppppppppppppppppppppppppppkernel trap 12 with interrupts disabled XX panic: kernel trap doesn't have ucred XX cpuid = 32 XX time = 1521655530 XX KDB: enter: panic XX panic: kernel trap doesn't have ucred XX cpuid = 32 XX time = 1521655530 XX KDB: enter: panic XX panic: kernel trap doesn't have ucred XX cpuid = 32 XX time = 1521655530 XX KDB: enter: panic XX panic: kernel trap doesn't have ucrepanic: kernel trap doesn't have ucred XX cpuid = 32 XX time = 1521655530 XX KDB: enter: panic where some messages are lost and some are duplicated (there are 8 CPUs). I got control by putting a breakpoint after stop_cpus_hard() in vpanic(). (A breakpoint at panic() crashes, probably for multiple CPUs hitting it, though this is supposed to be fixed in the test version.) The backtrace is then: XX Breakpoint at vpanic+0x4a: popl %ecx XX db> t XX Tracing pid 11 tid 100042 td 0xd6a61360 XX vpanic(c0916c91,d6685ab4,d6685ab4,c098f050,c098f040,...) at vpanic+0x4a/frame 0xd6685a8c XX kassert_panic(c0916c91,c093b956,c0930a24,c09066cf,557) at kassert_panic+0x49/frame 0xd6685aa8 XX witness_unlock(c098f040,8,c09066c6,557) at witness_unlock+0xe7/frame 0xd6685af0 XX __mtx_unlock_flags(c098f050,0,c09066c6,557) at __mtx_unlock_flags+0x65/frame 0xd6685b14 XX intr_event_execute_handlers(c8f466b0) at intr_event_execute_handlers+0xed/frame 0xd6685b40 XX ithread_execute_handlers(c8f466b0,0,80202,d6a61360,c8f466b0,...) at ithread_execute_handlers+0x21/frame 0xd6685b54 XX ithread_loop(d6cda250,d6685ba8,0,d6cda250,c06a2c56,...) at ithread_loop+0x5f/frame 0xd6685b74 XX fork_exit(c06a2c56,d6cda250,d6685ba8) at fork_exit+0x83/frame 0xd6685b94 XX fork_trampoline() at fork_trampoline+0x8 The stack trace is messed up are mis-decoded despite attempts to avoid this (use i386, don't use clang, and turn off auto-inlining...). panic() is not shown, and args passed in registers are not shown. There are just enough args to find the panic message. It is as expected: XX db> x/s 0xd6685ab4 XX 0xd6685ab4: V\271\223\300$\012\223\300\317f\220\300W\005 XX db> x/s 0xc0916c91 XX __func__.16466+0x1c41: lock (%s) %s not locked @ %s:%d Bruce From owner-svn-src-head@freebsd.org Wed Mar 21 20:28:04 2018 Return-Path: Delivered-To: svn-src-head@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 A4F33F6460C; Wed, 21 Mar 2018 20:28:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2392F863A1; Wed, 21 Mar 2018 20:28:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w2LKRqEf020067 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 21 Mar 2018 22:27:55 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w2LKRqEf020067 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w2LKRqBW020066; Wed, 21 Mar 2018 22:27:52 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 21 Mar 2018 22:27:52 +0200 From: Konstantin Belousov To: Bruce Evans Cc: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons Message-ID: <20180321202752.GO76926@kib.kiev.ua> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180322024846.S4293@besplex.bde.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 20:28:04 -0000 On Thu, Mar 22, 2018 at 04:53:22AM +1100, Bruce Evans wrote: > Serial console drivers with fast interrupt handlers have much more > broken locking for ddb special keys. It is invalid to either drop locks > or call the "any" function from a fast interrupt handler, but buggy > serial console drivers calls kbd_alt_break(), and that now calls > shutdown_nice() and other functions that cannot be called from a fast > interrupt handler. ddb keys supply most of the shutdown_nice() > functionality for serial consoles, and there are no escape sequence to > get this without ddb or maybe another debugger, so these bugs don't > affect most users. > > Handling this correctly requires much the same fix as an unsafe signal > handler, and fixes have much the same problems -- not much more than > setting a flag is safe, and the flag might never be looked at if the > system is in a bad state. However, if a nice shutdown is possible then > the sytem must be in a good enough state to poll for flags. Are you saying that fast interrupt handlers call shutdown_nice() ? This is the quite serious bug on its own. To fix it, shutdown_nice() should use a fast taskqueue to schedule the task which would lock the process and send the signal. From owner-svn-src-head@freebsd.org Wed Mar 21 20:36:58 2018 Return-Path: Delivered-To: svn-src-head@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 BEDAEF6504A; Wed, 21 Mar 2018 20:36:58 +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 70E2286A5D; Wed, 21 Mar 2018 20:36:58 +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 6775D2F7AF; Wed, 21 Mar 2018 20:36:58 +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 w2LKawnm074471; Wed, 21 Mar 2018 20:36:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LKavpe074466; Wed, 21 Mar 2018 20:36:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803212036.w2LKavpe074466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 20:36:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331321 - in head/stand: efi/boot1 efi/loader lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: efi/boot1 efi/loader lua X-SVN-Commit-Revision: 331321 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 20:36:59 -0000 Author: kevans Date: Wed Mar 21 20:36:57 2018 New Revision: 331321 URL: https://svnweb.freebsd.org/changeset/base/331321 Log: UEFI: Ditch console mode setting, choose optimal GOP mode later in boot boot1 is too early to be deciding a good resolution. Console modes don't map cleanly/predictably to actual screen resolutions, and GOP does not reflect the actual screen resolution after a console mode change. Rip it out. Add an efi-autoresizecons command to loader to choose an optimal screen resolution based on the current environment. We'll explicitly execute this later, preferably before we draw anything of value but after we load config and pick up any tunables we may need to decide where we're going. This method also allows us to actually pass the correct framebuffer information on to the kernel. UGA autoresizing is not implemented because it doesn't have the kind of mode enumeration that GOP does. If an interested person with relevant hardware could get in contact, we can take a look at implementing UGA autoresize. This effectively "fixes" the breakage caused by r327058, but doesn't actually set the resolution correctly until the interpreter calls efi-autoresizcons. The lualoader version of this has been included for reference; the forth equivalent will follow. Reviewed by: imp (with some hestitation), manu Differential Revision: https://reviews.freebsd.org/D14788 Modified: head/stand/efi/boot1/boot1.c head/stand/efi/loader/framebuffer.c head/stand/lua/core.lua head/stand/lua/loader.lua Modified: head/stand/efi/boot1/boot1.c ============================================================================== --- head/stand/efi/boot1/boot1.c Wed Mar 21 20:13:24 2018 (r331320) +++ head/stand/efi/boot1/boot1.c Wed Mar 21 20:36:57 2018 (r331321) @@ -391,7 +391,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) EFI_STATUS status; EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl = NULL; SIMPLE_TEXT_OUTPUT_INTERFACE *conout = NULL; - UINTN i, max_dim, best_mode, cols, rows, hsize, nhandles; + UINTN i, hsize, nhandles; CHAR16 *text; UINT16 boot_current; size_t sz; @@ -410,22 +410,11 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) (void)ConsoleControl->SetMode(ConsoleControl, EfiConsoleControlScreenText); /* - * Reset the console and find the best text mode. + * Reset the console enable the cursor. Later we'll choose a better + * console size through GOP/UGA. */ conout = ST->ConOut; conout->Reset(conout, TRUE); - max_dim = best_mode = 0; - for (i = 0; i < conout->Mode->MaxMode; i++) { - status = conout->QueryMode(conout, i, &cols, &rows); - if (EFI_ERROR(status)) - continue; - if (cols * rows > max_dim) { - max_dim = cols * rows; - best_mode = i; - } - } - if (max_dim > 0) - conout->SetMode(conout, best_mode); conout->EnableCursor(conout, TRUE); conout->ClearScreen(conout); Modified: head/stand/efi/loader/framebuffer.c ============================================================================== --- head/stand/efi/loader/framebuffer.c Wed Mar 21 20:13:24 2018 (r331320) +++ head/stand/efi/loader/framebuffer.c Wed Mar 21 20:36:57 2018 (r331321) @@ -462,6 +462,72 @@ print_efifb(int mode, struct efi_fb *efifb, int verbos } } +static int +gop_autoresize(EFI_GRAPHICS_OUTPUT *gop) +{ + struct efi_fb efifb; + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info; + EFI_STATUS status; + UINTN infosz; + UINT32 best_mode, currdim, maxdim, mode; + + best_mode = maxdim = 0; + for (mode = 0; mode < gop->Mode->MaxMode; mode++) { + status = gop->QueryMode(gop, mode, &infosz, &info); + if (EFI_ERROR(status)) + continue; + efifb_from_gop(&efifb, gop->Mode, info); + currdim = info->HorizontalResolution * info->VerticalResolution; + /* XXX TODO: Allow tunable or something for max resolution */ + if (currdim > maxdim) { + maxdim = currdim; + best_mode = mode; + } + } + + status = gop->SetMode(gop, best_mode); + if (EFI_ERROR(status)) { + snprintf(command_errbuf, sizeof(command_errbuf), + "gop_autoresize: Unable to set mode to %u (error=%lu)", + mode, EFI_ERROR_CODE(status)); + return (CMD_ERROR); + } + return (CMD_OK); +} + +static int +uga_autoresize(EFI_UGA_DRAW_PROTOCOL *gop) +{ + + return (CMD_OK); +} + +COMMAND_SET(efi_autoresize, "efi-autoresizecons", "EFI Auto-resize Console", command_autoresize); + +static int +command_autoresize(int argc, char *argv[]) +{ + EFI_GRAPHICS_OUTPUT *gop; + EFI_UGA_DRAW_PROTOCOL *uga; + EFI_STATUS status; + u_int mode; + + gop = NULL; + uga = NULL; + status = BS->LocateProtocol(&gop_guid, NULL, (VOID **)&gop); + if (EFI_ERROR(status) == 0) + return (gop_autoresize(gop)); + + status = BS->LocateProtocol(&uga_guid, NULL, (VOID **)&uga); + if (EFI_ERROR(status) == 0) + return (uga_autoresize(uga)); + + snprintf(command_errbuf, sizeof(command_errbuf), + "%s: Neither Graphics Output Protocol nor Universal Graphics Adapter present", + argv[0]); + return (CMD_ERROR); +} + COMMAND_SET(gop, "gop", "graphics output protocol", command_gop); static int Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Wed Mar 21 20:13:24 2018 (r331320) +++ head/stand/lua/core.lua Wed Mar 21 20:36:57 2018 (r331321) @@ -274,6 +274,12 @@ function core.isSingleUserBoot() return single_user ~= nil and single_user:lower() == "yes" end +function core.isUEFIBoot() + local efiver = loader.getenv("efi-version") + + return efiver ~= nil +end + function core.isZFSBoot() local c = loader.getenv("currdev") Modified: head/stand/lua/loader.lua ============================================================================== --- head/stand/lua/loader.lua Wed Mar 21 20:13:24 2018 (r331320) +++ head/stand/lua/loader.lua Wed Mar 21 20:36:57 2018 (r331321) @@ -50,6 +50,9 @@ if result ~= nil then end config.load() +if core.isUEFIBoot() then + loader.perform("efi-autoresizecons") +end -- Our console may have been setup for a different color scheme before we get -- here, so make sure we set the default. if color.isEnabled() then From owner-svn-src-head@freebsd.org Wed Mar 21 20:59:31 2018 Return-Path: Delivered-To: svn-src-head@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 04E53F6690C; Wed, 21 Mar 2018 20:59:31 +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 9DCE787A43; Wed, 21 Mar 2018 20:59:30 +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 98A502FAAF; Wed, 21 Mar 2018 20:59:30 +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 w2LKxUiH084369; Wed, 21 Mar 2018 20:59:30 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LKxUiO084366; Wed, 21 Mar 2018 20:59:30 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201803212059.w2LKxUiO084366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 21 Mar 2018 20:59:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331322 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 331322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 20:59:31 -0000 Author: glebius Date: Wed Mar 21 20:59:30 2018 New Revision: 331322 URL: https://svnweb.freebsd.org/changeset/base/331322 Log: The net.inet.tcp.nolocaltimewait=1 optimization prevents local TCP connections from entering the TIME_WAIT state. However, it omits sending the ACK for the FIN, which results in RST. This becomes a bigger deal if the sysctl net.inet.tcp.blackhole is 2. In this case RST isn't send, so the other side of the connection (also local) keeps retransmitting FINs. To fix that in tcp_twstart() we will not call tcp_close() immediately. Instead we will allocate a tcptw on stack and proceed to the end of the function all the way to tcp_twrespond(), to generate the correct ACK, then we will drop the last PCB reference. While here, make a few tiny improvements: - use bools for boolean variable - staticize nolocaltimewait - remove pointless acquisiton of socket lock Reported by: jtl Reviewed by: jtl Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D14697 Modified: head/sys/netinet/tcp_timewait.c head/sys/netinet/tcp_usrreq.c Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Wed Mar 21 20:36:57 2018 (r331321) +++ head/sys/netinet/tcp_timewait.c Wed Mar 21 20:59:30 2018 (r331322) @@ -172,7 +172,7 @@ SYSCTL_PROC(_net_inet_tcp, OID_AUTO, maxtcptw, CTLTYPE &maxtcptw, 0, sysctl_maxtcptw, "IU", "Maximum number of compressed TCP TIME_WAIT entries"); -VNET_DEFINE(int, nolocaltimewait) = 0; +static VNET_DEFINE(int, nolocaltimewait) = 0; #define V_nolocaltimewait VNET(nolocaltimewait) SYSCTL_INT(_net_inet_tcp, OID_AUTO, nolocaltimewait, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nolocaltimewait), 0, @@ -225,12 +225,12 @@ tcp_tw_destroy(void) void tcp_twstart(struct tcpcb *tp) { - struct tcptw *tw; + struct tcptw twlocal, *tw; struct inpcb *inp = tp->t_inpcb; - int acknow; struct socket *so; + bool acknow, local; #ifdef INET6 - int isipv6 = inp->inp_inc.inc_flags & INC_ISIPV6; + bool isipv6 = inp->inp_inc.inc_flags & INC_ISIPV6; #endif INP_INFO_RLOCK_ASSERT(&V_tcbinfo); @@ -241,33 +241,29 @@ tcp_twstart(struct tcpcb *tp) "(inp->inp_flags & INP_DROPPED) != 0")); if (V_nolocaltimewait) { - int error = 0; #ifdef INET6 if (isipv6) - error = in6_localaddr(&inp->in6p_faddr); + local = in6_localaddr(&inp->in6p_faddr); #endif #if defined(INET6) && defined(INET) else #endif #ifdef INET - error = in_localip(inp->inp_faddr); + local = in_localip(inp->inp_faddr); #endif - if (error) { - tp = tcp_close(tp); - if (tp != NULL) - INP_WUNLOCK(inp); - return; - } - } + } else + local = false; - /* * For use only by DTrace. We do not reference the state * after this point so modifying it in place is not a problem. */ tcp_state_change(tp, TCPS_TIME_WAIT); - tw = uma_zalloc(V_tcptw_zone, M_NOWAIT); + if (local) + tw = &twlocal; + else + tw = uma_zalloc(V_tcptw_zone, M_NOWAIT); if (tw == NULL) { /* * Reached limit on total number of TIMEWAIT connections @@ -286,11 +282,10 @@ tcp_twstart(struct tcpcb *tp) } } /* - * The tcptw will hold a reference on its inpcb until tcp_twclose - * is called + * For !local case the tcptw will hold a reference on its inpcb + * until tcp_twclose is called. */ tw->tw_inpcb = inp; - in_pcbref(inp); /* Reference from tw */ /* * Recover last window size sent. @@ -337,16 +332,19 @@ tcp_twstart(struct tcpcb *tp) tcp_discardcb(tp); so = inp->inp_socket; soisdisconnected(so); - tw->tw_cred = crhold(so->so_cred); - SOCK_LOCK(so); tw->tw_so_options = so->so_options; - SOCK_UNLOCK(so); + inp->inp_flags |= INP_TIMEWAIT; if (acknow) tcp_twrespond(tw, TH_ACK); - inp->inp_ppcb = tw; - inp->inp_flags |= INP_TIMEWAIT; - TCPSTATES_INC(TCPS_TIME_WAIT); - tcp_tw_2msl_reset(tw, 0); + if (local) + in_pcbdrop(inp); + else { + in_pcbref(inp); /* Reference from tw */ + tw->tw_cred = crhold(so->so_cred); + inp->inp_ppcb = tw; + TCPSTATES_INC(TCPS_TIME_WAIT); + tcp_tw_2msl_reset(tw, 0); + } /* * If the inpcb owns the sole reference to the socket, then we can Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Wed Mar 21 20:36:57 2018 (r331321) +++ head/sys/netinet/tcp_usrreq.c Wed Mar 21 20:59:30 2018 (r331322) @@ -198,15 +198,18 @@ tcp_detach(struct socket *so, struct inpcb *inp) * XXXRW: Would it be cleaner to free the tcptw here? * * Astute question indeed, from twtcp perspective there are - * three cases to consider: + * four cases to consider: * * #1 tcp_detach is called at tcptw creation time by * tcp_twstart, then do not discard the newly created tcptw * and leave inpcb present until timewait ends - * #2 tcp_detach is called at timewait end (or reuse) by + * #2 tcp_detach is called at tcptw creation time by + * tcp_twstart, but connection is local and tw will be + * discarded immediately + * #3 tcp_detach is called at timewait end (or reuse) by * tcp_twclose, then the tcptw has already been discarded * (or reused) and inpcb is freed here - * #3 tcp_detach is called() after timewait ends (or reuse) + * #4 tcp_detach is called() after timewait ends (or reuse) * (e.g. by soclose), then tcptw has already been discarded * (or reused) and inpcb is freed here * From owner-svn-src-head@freebsd.org Wed Mar 21 21:13:27 2018 Return-Path: Delivered-To: svn-src-head@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 AF0C5F67A95; Wed, 21 Mar 2018 21:13:26 +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 769A1687D6; Wed, 21 Mar 2018 21:13:26 +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 712C72FDE5; Wed, 21 Mar 2018 21:13:26 +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 w2LLDQId094357; Wed, 21 Mar 2018 21:13:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LLDQXp094356; Wed, 21 Mar 2018 21:13:26 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803212113.w2LLDQXp094356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 21 Mar 2018 21:13:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331324 - head/lib/libthr/thread X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/libthr/thread X-SVN-Commit-Revision: 331324 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 21:13:27 -0000 Author: jhb Date: Wed Mar 21 21:13:26 2018 New Revision: 331324 URL: https://svnweb.freebsd.org/changeset/base/331324 Log: Ensure thread library is initialized in pthread_testcancel(). Call _thr_check_init() before reading curthread in pthread_testcancel(). If a constructor in a library creates a semaphore via sem_init() and then waits for it via sem_wait(), the program can core dump in _pthread_testcancel() called from sem_wait(). This is because the semaphore implementation lives in libc, so the library's constructors can be run before libthr's constructors. Reported by: arichardson Reviewed by: kib Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D14786 Modified: head/lib/libthr/thread/thr_cancel.c Modified: head/lib/libthr/thread/thr_cancel.c ============================================================================== --- head/lib/libthr/thread/thr_cancel.c Wed Mar 21 21:10:49 2018 (r331323) +++ head/lib/libthr/thread/thr_cancel.c Wed Mar 21 21:13:26 2018 (r331324) @@ -132,8 +132,10 @@ _pthread_setcanceltype(int type, int *oldtype) void _pthread_testcancel(void) { - struct pthread *curthread = _get_curthread(); + struct pthread *curthread; + _thr_check_init(); + curthread = _get_curthread(); testcancel(curthread); } From owner-svn-src-head@freebsd.org Wed Mar 21 21:15:44 2018 Return-Path: Delivered-To: svn-src-head@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 98598F67E15; Wed, 21 Mar 2018 21:15:44 +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 C75B768AA9; Wed, 21 Mar 2018 21:15: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 A4F452FDEA; Wed, 21 Mar 2018 21:15: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 w2LLFh0d094488; Wed, 21 Mar 2018 21:15:43 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LLFhDl094487; Wed, 21 Mar 2018 21:15:43 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803212115.w2LLFhDl094487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 21 Mar 2018 21:15:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331325 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331325 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 21:15:45 -0000 Author: markj Date: Wed Mar 21 21:15:43 2018 New Revision: 331325 URL: https://svnweb.freebsd.org/changeset/base/331325 Log: Elide the object lock in the common case in vfs_vmio_unwire(). The object lock was only needed when attempting to free B_DIRECT buffer pages, and for testing for invalid pages (and freeing them if so). Handle the latter by instead moving invalid pages near the head of the inactive queue, where they will be reclaimed quickly. Reviewed by: alc, kib, jeff MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D14778 Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Mar 21 21:13:26 2018 (r331324) +++ head/sys/kern/vfs_bio.c Wed Mar 21 21:15:43 2018 (r331325) @@ -2901,7 +2901,8 @@ vfs_vmio_iodone(struct buf *bp) } /* - * Unwire a page held by a buf and place it on the appropriate vm queue. + * Unwire a page held by a buf and either free it or update the page queues to + * reflect its recent use. */ static void vfs_vmio_unwire(struct buf *bp, vm_page_t m) @@ -2910,24 +2911,26 @@ vfs_vmio_unwire(struct buf *bp, vm_page_t m) vm_page_lock(m); if (vm_page_unwire_noq(m)) { - /* - * Determine if the page should be freed before adding - * it to the inactive queue. - */ - if (m->valid == 0) { - freed = !vm_page_busied(m); - if (freed) - vm_page_free(m); - } else if ((bp->b_flags & B_DIRECT) != 0) + if ((bp->b_flags & B_DIRECT) != 0) freed = vm_page_try_to_free(m); else freed = false; if (!freed) { /* - * If the page is unlikely to be reused, let the - * VM know. Otherwise, maintain LRU. + * Use a racy check of the valid bits to determine + * whether we can accelerate reclamation of the page. + * The valid bits will be stable unless the page is + * being mapped or is referenced by multiple buffers, + * and in those cases we expect races to be rare. At + * worst we will either accelerate reclamation of a + * valid page and violate LRU, or unnecessarily defer + * reclamation of an invalid page. + * + * The B_NOREUSE flag marks data that is not expected to + * be reused, so accelerate reclamation in that case + * too. Otherwise, maintain LRU. */ - if ((bp->b_flags & B_NOREUSE) != 0) + if (m->valid == 0 || (bp->b_flags & B_NOREUSE) != 0) vm_page_deactivate_noreuse(m); else if (m->queue == PQ_ACTIVE) vm_page_reference(m); @@ -3014,7 +3017,11 @@ vfs_vmio_truncate(struct buf *bp, int desiredpages) (desiredpages << PAGE_SHIFT), bp->b_npages - desiredpages); } else BUF_CHECK_UNMAPPED(bp); - obj = bp->b_bufobj->bo_object; + + /* + * The object lock is needed only if we will attempt to free pages. + */ + obj = (bp->b_flags & B_DIRECT) != 0 ? bp->b_bufobj->bo_object : NULL; if (obj != NULL) VM_OBJECT_WLOCK(obj); for (i = desiredpages; i < bp->b_npages; i++) { From owner-svn-src-head@freebsd.org Wed Mar 21 21:54:15 2018 Return-Path: Delivered-To: svn-src-head@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 B7D63F6AA45; Wed, 21 Mar 2018 21:54:15 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 452306A956; Wed, 21 Mar 2018 21:54:15 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 0659526061A; Wed, 21 Mar 2018 22:54:12 +0100 (CET) Subject: Re: svn commit: r331306 - head/sys/dev/usb/controller To: Andrew Turner Cc: Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803211517.w2LFHsHf007714@repo.freebsd.org> <898DF1A6-F1D2-474C-92B5-12F65DC71A40@fubar.geek.nz> From: Hans Petter Selasky Message-ID: <00c43a84-893e-cbd8-ff6d-f7a551ae3beb@selasky.org> Date: Wed, 21 Mar 2018 22:54:08 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <898DF1A6-F1D2-474C-92B5-12F65DC71A40@fubar.geek.nz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 21:54:15 -0000 On 03/21/18 17:45, Andrew Turner wrote: > > >> On 21 Mar 2018, at 15:37, Hans Petter Selasky wrote: >> >> On 03/21/18 16:24, Kyle Evans wrote: >>>> + { >>>> + .ep_end = 7, >>>> + .ep_fifosz_shift = 9, >>>> + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512 | MUSB2_MASK_FIFODB, >>>> + }, >>> I'm afraid I'm not familiar with this- why did .ep_fifosz_shift for >>> this case drop to 9? frx = 10 in the temp < 8 case in the removals of >>> the following hunks. Mostly curious because the others seemed to stay >>> the same. >> >> Hi Andrew, >> >> It might be an idea to keep the fifosz_shift at 10, else high-speed BULK traffic won't be double buffered, and this might affect performance. > > Should the endpoint 1 size also be fixed? The register has it at 4k, but it wasn’t an 8k buffer. > No, because High-Speed BULK will only use 512 byte packets, and 4k is reserved for isochronous, which doesn't need double buffering at the moment. --HPS From owner-svn-src-head@freebsd.org Wed Mar 21 22:01:52 2018 Return-Path: Delivered-To: svn-src-head@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 1AF4EF6B402; Wed, 21 Mar 2018 22:01:52 +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 C2B436B1A9; Wed, 21 Mar 2018 22:01:51 +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 A3C56585; Wed, 21 Mar 2018 22:01:51 +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 w2LM1pWp020206; Wed, 21 Mar 2018 22:01:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LM1pvl020202; Wed, 21 Mar 2018 22:01:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803212201.w2LM1pvl020202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 22:01:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331326 - in head/stand: forth i386/loader X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: forth i386/loader X-SVN-Commit-Revision: 331326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 22:01:52 -0000 Author: kevans Date: Wed Mar 21 22:01:51 2018 New Revision: 331326 URL: https://svnweb.freebsd.org/changeset/base/331326 Log: Forth version of EFI autoresizing r331321 delegated autoresizing to an efi-autoresizecons command that currently is expected to be done in forth/lua prior to drawing anything useful. Add the Forth version of the lua addition in r331321, hook efi.4th up to be installed. efiboot? was written by dteske@; anything outside of that may be blamed on me. Modified: head/stand/forth/Makefile head/stand/forth/efi.4th head/stand/forth/loader.rc head/stand/i386/loader/loader.rc Modified: head/stand/forth/Makefile ============================================================================== --- head/stand/forth/Makefile Wed Mar 21 21:15:43 2018 (r331325) +++ head/stand/forth/Makefile Wed Mar 21 22:01:51 2018 (r331326) @@ -18,6 +18,7 @@ FILES+= brand-fbsd.4th FILES+= check-password.4th FILES+= color.4th FILES+= delay.4th +FILES+= efi.4th FILES+= frames.4th FILES+= loader.4th FILES+= logo-beastie.4th Modified: head/stand/forth/efi.4th ============================================================================== --- head/stand/forth/efi.4th Wed Mar 21 21:15:43 2018 (r331325) +++ head/stand/forth/efi.4th Wed Mar 21 22:01:51 2018 (r331326) @@ -26,5 +26,16 @@ only forth definitions -\ Place holder for more functions +: efiboot? ( -- flag ) + s" efi-version" getenv -1 <> dup if + swap drop ( c-addr flag -- flag ) + then +; + +: maybe-efi-resizecons + efiboot? if + efi-autoresizecons + then +; + .( EFI boot environment) cr Modified: head/stand/forth/loader.rc ============================================================================== --- head/stand/forth/loader.rc Wed Mar 21 21:15:43 2018 (r331325) +++ head/stand/forth/loader.rc Wed Mar 21 22:01:51 2018 (r331326) @@ -6,11 +6,14 @@ \ \ Includes additional commands include /boot/loader.4th +include /boot/efi.4th try-include /boot/loader.rc.local \ Reads and processes loader.conf variables \ NOTE: Change to `initialize' if you enable the below boot menu start + +maybe-efi-resizecons \ Tests for password -- executes autoboot first if a password was defined check-password Modified: head/stand/i386/loader/loader.rc ============================================================================== --- head/stand/i386/loader/loader.rc Wed Mar 21 21:15:43 2018 (r331325) +++ head/stand/i386/loader/loader.rc Wed Mar 21 22:01:51 2018 (r331326) @@ -3,10 +3,13 @@ \ \ Includes additional commands include /boot/loader.4th +include /boot/efi.4th try-include /boot/loader.rc.local \ Reads and processes loader.conf variables initialize + +maybe-efi-resizecons \ Tests for password -- executes autoboot first if a password was defined check-password From owner-svn-src-head@freebsd.org Wed Mar 21 23:17:27 2018 Return-Path: Delivered-To: svn-src-head@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 781C0F4CD36; Wed, 21 Mar 2018 23:17:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 2AC0E6E1F8; Wed, 21 Mar 2018 23:17:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25AF7105A; Wed, 21 Mar 2018 23:17:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LNHR1b055896; Wed, 21 Mar 2018 23:17:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNHRub055895; Wed, 21 Mar 2018 23:17:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803212317.w2LNHRub055895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Mar 2018 23:17:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331327 - head/sys/i386/ibcs2 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/i386/ibcs2 X-SVN-Commit-Revision: 331327 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:17:27 -0000 Author: emaste Date: Wed Mar 21 23:17:26 2018 New Revision: 331327 URL: https://svnweb.freebsd.org/changeset/base/331327 Log: Add ) missing from r330297 Sponsored by: The FreeBSD Foundation Modified: head/sys/i386/ibcs2/ibcs2_ipc.c Modified: head/sys/i386/ibcs2/ibcs2_ipc.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_ipc.c Wed Mar 21 22:01:51 2018 (r331326) +++ head/sys/i386/ibcs2/ibcs2_ipc.c Wed Mar 21 23:17:26 2018 (r331327) @@ -282,7 +282,7 @@ cvt_semid2isemid(bp, ibp) struct semid_ds *bp; struct ibcs2_semid_ds *ibp; { - memset(ibp, 0, sizeof(*ibp); + memset(ibp, 0, sizeof(*ibp)); cvt_perm2iperm(&bp->sem_perm, &ibp->sem_perm); ibp->sem_nsems = bp->sem_nsems; ibp->sem_otime = bp->sem_otime; From owner-svn-src-head@freebsd.org Wed Mar 21 23:21:32 2018 Return-Path: Delivered-To: svn-src-head@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 A2992F4D26C; Wed, 21 Mar 2018 23:21:32 +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 541AA6E500; Wed, 21 Mar 2018 23:21:32 +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 4EFFD1192; Wed, 21 Mar 2018 23:21:32 +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 w2LNLW1N059166; Wed, 21 Mar 2018 23:21:32 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNLWa1059145; Wed, 21 Mar 2018 23:21:32 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201803212321.w2LNLWa1059145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 21 Mar 2018 23:21:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331328 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:21:33 -0000 Author: glebius Date: Wed Mar 21 23:21:32 2018 New Revision: 331328 URL: https://svnweb.freebsd.org/changeset/base/331328 Log: Fix sysctl types broken in r329612. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Mar 21 23:17:26 2018 (r331327) +++ head/sys/kern/vfs_bio.c Wed Mar 21 23:21:32 2018 (r331328) @@ -261,17 +261,17 @@ SYSCTL_PROC(_vfs, OID_AUTO, numdirtybuffers, "Number of buffers that are dirty (has unwritten changes) at the moment"); static int lodirtybuffers; SYSCTL_PROC(_vfs, OID_AUTO, lodirtybuffers, - CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &lodirtybuffers, + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &lodirtybuffers, __offsetof(struct bufdomain, bd_lodirtybuffers), sysctl_bufdomain_int, "L", "How many buffers we want to have free before bufdaemon can sleep"); static int hidirtybuffers; SYSCTL_PROC(_vfs, OID_AUTO, hidirtybuffers, - CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &hidirtybuffers, + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &hidirtybuffers, __offsetof(struct bufdomain, bd_hidirtybuffers), sysctl_bufdomain_int, "L", "When the number of dirty buffers is considered severe"); int dirtybufthresh; SYSCTL_PROC(_vfs, OID_AUTO, dirtybufthresh, - CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &dirtybufthresh, + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &dirtybufthresh, __offsetof(struct bufdomain, bd_dirtybufthresh), sysctl_bufdomain_int, "L", "Number of bdwrite to bawrite conversions to clear dirty buffers"); static int numfreebuffers; @@ -279,12 +279,12 @@ SYSCTL_INT(_vfs, OID_AUTO, numfreebuffers, CTLFLAG_RD, "Number of free buffers"); static int lofreebuffers; SYSCTL_PROC(_vfs, OID_AUTO, lofreebuffers, - CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &lofreebuffers, + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &lofreebuffers, __offsetof(struct bufdomain, bd_lofreebuffers), sysctl_bufdomain_int, "L", "Target number of free buffers"); static int hifreebuffers; SYSCTL_PROC(_vfs, OID_AUTO, hifreebuffers, - CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &hifreebuffers, + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &hifreebuffers, __offsetof(struct bufdomain, bd_hifreebuffers), sysctl_bufdomain_int, "L", "Threshold for clean buffer recycling"); static counter_u64_t getnewbufcalls; From owner-svn-src-head@freebsd.org Wed Mar 21 23:26:43 2018 Return-Path: Delivered-To: svn-src-head@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 1E715F4D985; Wed, 21 Mar 2018 23:26:43 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 BABD06EA41; Wed, 21 Mar 2018 23:26:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC97D11D3; Wed, 21 Mar 2018 23:26:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LNQgdC060793; Wed, 21 Mar 2018 23:26:42 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNQg9f060792; Wed, 21 Mar 2018 23:26:42 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803212326.w2LNQg9f060792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Mar 2018 23:26:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331329 - head/sys/i386/ibcs2 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/i386/ibcs2 X-SVN-Commit-Revision: 331329 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:26:43 -0000 Author: emaste Date: Wed Mar 21 23:26:42 2018 New Revision: 331329 URL: https://svnweb.freebsd.org/changeset/base/331329 Log: Fix kernel memory disclosure in ibcs2_getdents ibcs2_getdents() copies a dirent structure to userland. The ibcs2 dirent structure contains a 2 byte pad element. This element is never initialized, but copied to userland none-the-less. Note that ibcs2 has not built on HEAD since r302095. Submitted by: Domagoj Stolfa Reported by: Ilja Van Sprundel MFC after: 3 days Security: Kernel memory disclosure (803) Modified: head/sys/i386/ibcs2/ibcs2_misc.c Modified: head/sys/i386/ibcs2/ibcs2_misc.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_misc.c Wed Mar 21 23:21:32 2018 (r331328) +++ head/sys/i386/ibcs2/ibcs2_misc.c Wed Mar 21 23:26:42 2018 (r331329) @@ -330,6 +330,7 @@ ibcs2_getdents(struct thread *td, struct ibcs2_getdent #define BSD_DIRENT(cp) ((struct dirent *)(cp)) #define IBCS2_RECLEN(reclen) (reclen + sizeof(u_short)) + memset(&idb, 0, sizeof(idb)); error = getvnode(td, uap->fd, cap_rights_init(&rights, CAP_READ), &fp); if (error != 0) return (error); From owner-svn-src-head@freebsd.org Wed Mar 21 23:46:27 2018 Return-Path: Delivered-To: svn-src-head@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 8057FF4F056; Wed, 21 Mar 2018 23:46:27 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 345676F6AE; Wed, 21 Mar 2018 23:46:27 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F2D014F2; Wed, 21 Mar 2018 23:46:27 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LNkRwe071020; Wed, 21 Mar 2018 23:46:27 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNkRhs071019; Wed, 21 Mar 2018 23:46:27 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803212346.w2LNkRhs071019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 23:46:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331331 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 331331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:46:27 -0000 Author: cem Date: Wed Mar 21 23:46:26 2018 New Revision: 331331 URL: https://svnweb.freebsd.org/changeset/base/331331 Log: Apply r228478 (CTASSERT => _Static_assert()) to stand bootstrap.h Reported by: GCC (it doesn't like the unused array) Sponsored by: Dell EMC Isilon Modified: head/stand/common/bootstrap.h Modified: head/stand/common/bootstrap.h ============================================================================== --- head/stand/common/bootstrap.h Wed Mar 21 23:45:48 2018 (r331330) +++ head/stand/common/bootstrap.h Wed Mar 21 23:46:26 2018 (r331331) @@ -330,10 +330,8 @@ void dev_cleanup(void); time_t time(time_t *tloc); -#ifndef CTASSERT /* Allow lint to override */ -#define CTASSERT(x) _CTASSERT(x, __LINE__) -#define _CTASSERT(x, y) __CTASSERT(x, y) -#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1] +#ifndef CTASSERT +#define CTASSERT(x) _Static_assert(x, "compile-time assertion failed") #endif #endif /* !_BOOTSTRAP_H_ */ From owner-svn-src-head@freebsd.org Wed Mar 21 23:50:47 2018 Return-Path: Delivered-To: svn-src-head@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 10837F4F51D; Wed, 21 Mar 2018 23:50:47 +0000 (UTC) (envelope-from jamie@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 B5ECD6FA05; Wed, 21 Mar 2018 23:50:46 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B0EC21503; Wed, 21 Mar 2018 23:50:46 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LNok2Z071226; Wed, 21 Mar 2018 23:50:46 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNokLZ071225; Wed, 21 Mar 2018 23:50:46 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201803212350.w2LNokLZ071225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Wed, 21 Mar 2018 23:50:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331332 - head/lib/libjail X-SVN-Group: head X-SVN-Commit-Author: jamie X-SVN-Commit-Paths: head/lib/libjail X-SVN-Commit-Revision: 331332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:50:47 -0000 Author: jamie Date: Wed Mar 21 23:50:46 2018 New Revision: 331332 URL: https://svnweb.freebsd.org/changeset/base/331332 Log: If a jail parameter isn't found, try loading a related kernel module. Modified: head/lib/libjail/jail.c Modified: head/lib/libjail/jail.c ============================================================================== --- head/lib/libjail/jail.c Wed Mar 21 23:46:26 2018 (r331331) +++ head/lib/libjail/jail.c Wed Mar 21 23:50:46 2018 (r331332) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -59,6 +60,7 @@ __FBSDID("$FreeBSD$"); static int jailparam_import_enum(const char **values, int nvalues, const char *valstr, size_t valsize, int *value); static int jailparam_type(struct jailparam *jp); +static int kldload_param(const char *name); static char *noname(const char *name); static char *nononame(const char *name); @@ -892,6 +894,9 @@ jailparam_type(struct jailparam *jp) "sysctl(0.3.%s): %s", name, strerror(errno)); return (-1); } + if (kldload_param(name) >= 0 && sysctl(mib, 2, mib + 2, &miblen, + desc.s, strlen(desc.s)) >= 0) + goto mib_desc; /* * The parameter probably doesn't exist. But it might be * the "no" counterpart to a boolean. @@ -1028,6 +1033,33 @@ jailparam_type(struct jailparam *jp) jp->jp_valuelen = 0; } return (0); +} + +/* + * Attempt to load a kernel module matching an otherwise nonexistent parameter. + */ +static int +kldload_param(const char *name) +{ + int kl; + + if (strcmp(name, "linux") == 0 || strncmp(name, "linux.", 6) == 0) + kl = kldload("linux"); + else if (strcmp(name, "sysvmsg") == 0 || strcmp(name, "sysvsem") == 0 || + strcmp(name, "sysvshm") == 0) + kl = kldload(name); + else { + errno = ENOENT; + return (-1); + } + if (kl < 0 && errno == EEXIST) { + /* + * In the module is already loaded, then it must not contain + * the parameter. + */ + errno = ENOENT; + } + return kl; } /* From owner-svn-src-head@freebsd.org Wed Mar 21 23:51:14 2018 Return-Path: Delivered-To: svn-src-head@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 DD889F4F5AF; Wed, 21 Mar 2018 23:51:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 932766FB7F; Wed, 21 Mar 2018 23:51:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E2A51618; Wed, 21 Mar 2018 23:51:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LNpEHd074175; Wed, 21 Mar 2018 23:51:14 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNpEOP074174; Wed, 21 Mar 2018 23:51:14 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803212351.w2LNpEOP074174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Mar 2018 23:51:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331333 - head/sys/dev/drm X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/drm X-SVN-Commit-Revision: 331333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:51:15 -0000 Author: emaste Date: Wed Mar 21 23:51:14 2018 New Revision: 331333 URL: https://svnweb.freebsd.org/changeset/base/331333 Log: Fix kernel memory disclosure in drm_infobufs drm_infobufs() has a structure on the stack, fills it out and copies it to userland. There are 2 elements in the struct that are not filled out and left uninitialized. This will leak uninitialized kernel stack data to userland. Submitted by: Domagoj Stolfa Reported by: Ilja Van Sprundel MFC after: 1 day Security: Kernel memory disclosure (798) Modified: head/sys/dev/drm/drm_bufs.c Modified: head/sys/dev/drm/drm_bufs.c ============================================================================== --- head/sys/dev/drm/drm_bufs.c Wed Mar 21 23:50:46 2018 (r331332) +++ head/sys/dev/drm/drm_bufs.c Wed Mar 21 23:51:14 2018 (r331333) @@ -935,6 +935,7 @@ int drm_infobufs(struct drm_device *dev, void *data, s if (dma->bufs[i].buf_count) { struct drm_buf_desc from; + memset(&from, 0, sizeof(from)); from.count = dma->bufs[i].buf_count; from.size = dma->bufs[i].buf_size; from.low_mark = dma->bufs[i].freelist.low_mark; From owner-svn-src-head@freebsd.org Wed Mar 21 23:52:38 2018 Return-Path: Delivered-To: svn-src-head@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 33525F4F8C5; Wed, 21 Mar 2018 23:52:38 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 DA9C76FEFB; Wed, 21 Mar 2018 23:52:37 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5690166D; Wed, 21 Mar 2018 23:52:37 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LNqbAs075737; Wed, 21 Mar 2018 23:52:37 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNqbH4075731; Wed, 21 Mar 2018 23:52:37 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803212352.w2LNqbH4075731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 21 Mar 2018 23:52:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331334 - in head/lib/libc: gen include sys tests/gen X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/lib/libc: gen include sys tests/gen X-SVN-Commit-Revision: 331334 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 23:52:38 -0000 Author: cem Date: Wed Mar 21 23:52:37 2018 New Revision: 331334 URL: https://svnweb.freebsd.org/changeset/base/331334 Log: getentropy(3): Fallback to kern.arandom sysctl on older kernels On older kernels, when userspace program disables SIGSYS, catch ENOSYS and emulate getrandom(2) syscall with the kern.arandom sysctl (via existing arc4_sysctl wrapper). Special care is taken to faithfully emulate EFAULT on NULL pointers, because sysctl(3) as used by kern.arandom ignores NULL oldp. (This was caught by getentropy(3) ATF tests.) Reported by: kib Reviewed by: kib Discussed with: delphij Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14785 Modified: head/lib/libc/gen/arc4random.c head/lib/libc/gen/getentropy.c head/lib/libc/include/libc_private.h head/lib/libc/sys/Symbol.map head/lib/libc/tests/gen/getentropy_test.c Modified: head/lib/libc/gen/arc4random.c ============================================================================== --- head/lib/libc/gen/arc4random.c Wed Mar 21 23:51:14 2018 (r331333) +++ head/lib/libc/gen/arc4random.c Wed Mar 21 23:52:37 2018 (r331334) @@ -111,8 +111,8 @@ arc4_addrandom(u_char *dat, int datlen) rs.j = rs.i; } -static size_t -arc4_sysctl(u_char *buf, size_t size) +size_t +__arc4_sysctl(u_char *buf, size_t size) { int mib[2]; size_t len, done; @@ -143,7 +143,7 @@ arc4_stir(void) arc4_init(); rs_initialized = 1; } - if (arc4_sysctl(rdat, KEYSIZE) != KEYSIZE) { + if (__arc4_sysctl(rdat, KEYSIZE) != KEYSIZE) { /* * The sysctl cannot fail. If it does fail on some FreeBSD * derivative or after some future change, just abort so that Modified: head/lib/libc/gen/getentropy.c ============================================================================== --- head/lib/libc/gen/getentropy.c Wed Mar 21 23:51:14 2018 (r331333) +++ head/lib/libc/gen/getentropy.c Wed Mar 21 23:52:37 2018 (r331334) @@ -37,6 +37,39 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" +/* + * If a newer libc is accidentally installed on an older kernel, provide high + * quality random data anyway. The sysctl interface is not as fast and does + * not block by itself, but is provided by even very old kernels. + */ +static int +getentropy_fallback(void *buf, size_t buflen) +{ + /* + * oldp (buf) == NULL has a special meaning for sysctl that results in + * no EFAULT. For compatibility with the kernel getrandom(2), detect + * this case and return the appropriate error. + */ + if (buf == NULL && buflen > 0) { + errno = EFAULT; + return (-1); + } + if (__arc4_sysctl(buf, buflen) != buflen) { + if (errno == EFAULT) + return (-1); + /* + * This cannot happen. _arc4_sysctl() spins until the random + * device is seeded and then repeatedly reads until the full + * request is satisfied. The only way for this to return a zero + * byte or short read is if sysctl(2) on the kern.arandom MIB + * fails. In this case, exceping the user-provided-a-bogus- + * buffer EFAULT, give up (like for arc4random(3)'s arc4_stir). + */ + abort(); + } + return (0); +} + int getentropy(void *buf, size_t buflen) { @@ -53,7 +86,7 @@ getentropy(void *buf, size_t buflen) if (errno == EINTR) continue; else if (errno == ENOSYS) - abort(); + return (getentropy_fallback(buf, buflen)); else return (-1); } Modified: head/lib/libc/include/libc_private.h ============================================================================== --- head/lib/libc/include/libc_private.h Wed Mar 21 23:51:14 2018 (r331333) +++ head/lib/libc/include/libc_private.h Wed Mar 21 23:52:37 2018 (r331334) @@ -405,6 +405,8 @@ int __sys_futimens(int fd, const struct timespec *tim int __sys_utimensat(int fd, const char *path, const struct timespec *times, int flag) __hidden; +__size_t __arc4_sysctl(unsigned char *, __size_t); + /* execve() with PATH processing to implement posix_spawnp() */ int _execvpe(const char *, char * const *, char * const *); Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Wed Mar 21 23:51:14 2018 (r331333) +++ head/lib/libc/sys/Symbol.map Wed Mar 21 23:52:37 2018 (r331334) @@ -628,8 +628,6 @@ FBSDprivate_1.0 { __sys_getppid; _getpriority; __sys_getpriority; - _getrandom; - __sys_getrandom; _getresgid; __sys_getresgid; _getresuid; Modified: head/lib/libc/tests/gen/getentropy_test.c ============================================================================== --- head/lib/libc/tests/gen/getentropy_test.c Wed Mar 21 23:51:14 2018 (r331333) +++ head/lib/libc/tests/gen/getentropy_test.c Wed Mar 21 23:52:37 2018 (r331334) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -76,6 +77,8 @@ ATF_TC_BODY(getentropy_sizes, tc) ATF_TP_ADD_TCS(tp) { + + signal(SIGSYS, SIG_IGN); ATF_TP_ADD_TC(tp, getentropy_count); ATF_TP_ADD_TC(tp, getentropy_fault); From owner-svn-src-head@freebsd.org Thu Mar 22 00:31:50 2018 Return-Path: Delivered-To: svn-src-head@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 15C5AF529D1 for ; Thu, 22 Mar 2018 00:31:50 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A6C171816 for ; Thu, 22 Mar 2018 00:31:49 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x230.google.com with SMTP id d13-v6so9176055itf.0 for ; Wed, 21 Mar 2018 17:31:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=JbSV3/lRfw5JBEsHaH3glG6/IaMh4f3pjo0VrqFDHRU=; b=qIzeEpujJgrpmSgKKG4XcPwJC95AxMC2aLT0ohIzc3V69URN+yX58FmizJNy4u/ZVq aJHFZqKvr6oy/oNp2LbEUudaxB1ztxfg6lDhchy5OOwLILbMi6mWXOXxQmH1JjimJajO XRidC3SvE29IyeHS5WY6GluEO2KNRAMf8bQe5UWBl+Qv8/C3gzEJOtmEodRPN93Pzig1 AzNEyMM3aInVcXBt8Nu9TwO33ZEFN8daDjbWcpwyrznpWQd58DS4Kzy2ZLP5Z3r1MEXd ds/0KNEU6gwmmgj2DfjfOibxu9dvcO2eHFsxm5uq7sgENceWQmKoAVSkLeF3KiXHSK23 gY0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=JbSV3/lRfw5JBEsHaH3glG6/IaMh4f3pjo0VrqFDHRU=; b=QxS1PiMaMwIdyDCzeHVDRFk8F1n0cDzWOiUUK9qKutSo+LmpoKuy3WgJWwmyOoX5k8 YMbObuICTBnjbVJcEy/UtsjDr8cra6rmvKy5c22/aDAXAZ3MIky1D+vuZcFb57gWt/qz h7Qc/BNGDj1NouPO2RNR1Fgcv0llMz/4lpwONcXw3zG76CbWi3fPflfebJuEuXbO1w9t RFNoz+6LpLX1EQiK10WfOAOH2+IZgyGPTQUSKOr9iY9KWB7hGoeje52Uzuw6/biznlah awySMqi0O3tsYEZ93sHI6Eam7ZljimOn9QreD8mYkQnvPDZaP6CFTwir7JVNSLXS6NbY JOSA== X-Gm-Message-State: AElRT7H/2yjHQOEBBrbgReEGoP2eacdyn0LWORNVDFPlqvhYeHImnz7S bMQzs2sPDA4jIPyyqJI+IY3jSyBSZ3P3kRltN6DfKw== X-Google-Smtp-Source: AG47ELu+ZP4esfZDRRlBqtGvPsDPJmXVjpZALxSuRhxPTyxomdiFycXPAWniwHsE940OCFmTTaE7Cqz8qhyUaiH4LiE= X-Received: by 2002:a24:fa83:: with SMTP id v125-v6mr6779148ith.36.1521678708767; Wed, 21 Mar 2018 17:31:48 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Wed, 21 Mar 2018 17:31:48 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180322024846.S4293@besplex.bde.org> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> From: Warner Losh Date: Wed, 21 Mar 2018 18:31:48 -0600 X-Google-Sender-Auth: ISadeU0shefjGu9BpBZmUy76Rpk Message-ID: Subject: Re: svn commit: r331298 - head/sys/dev/syscons To: Bruce Evans Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 00:31:50 -0000 On Wed, Mar 21, 2018 at 11:53 AM, Bruce Evans wrote: > On Wed, 21 Mar 2018, Warner Losh wrote: > > Log: >> Unlock giant when calling shutdown_nice() >> > > This breaks the driver. Giant is syscons' driver lock, and also the > interrupt handler lock for at least the atkbd keyboard driver, so vt > sometimes holds the lock for. > OK. I got carried away. You're right. The proper fix is to unlock Giant at the top of kern_reboot() instead. This handles the case where we call shutdown_nice() with no init running and have to call kern_reboot directly. Otherwise it's perfectly fine to just call shutdown_nice() with Giant held since we just signal init from there. So I'll revert this change and make that other change instead. > vt has to sprinkle lots of Giant locking and unlocking where the > corresponding locking is automatic for syscons, but this seems to be > nonsense in its event handler. vt has to acquire Giant when calling > the keyboard driver, but event handling is a call from the keyboard > driver, usually from the interrupt handler with a suitable lock held. > For atkbd, the suitable lock is Giant -- see atkbd_intr(). (All keyboard > drivers that use the kbd(4) for the top level use Giant looking since > toe top level specifies D_NEEDGIANT in its cdevsw. I think that is all > keyboard drivers.) So where vt_kbdevent() sprinkles Giant, that has no > effect since Giant is held by the caller. So vt_kbdevent() calls > vt_processkey() with Giant held despite it not acquiring Giant explicitly; > vt_processkey() calls vt_machine_kbdevent() and that calls various > shutdown functions, all with Giant held. True, and covered above. > Modified: head/sys/dev/syscons/syscons.c >> ============================================================ >> ================== >> --- head/sys/dev/syscons/syscons.c Wed Mar 21 14:47:08 2018 >> (r331297) >> +++ head/sys/dev/syscons/syscons.c Wed Mar 21 14:47:12 2018 >> (r331298) >> @@ -3858,22 +3858,28 @@ next_code: >> >> case RBT: >> #ifndef SC_DISABLE_REBOOT >> - if (enable_reboot && !(flags & SCGETC_CN)) >> + if (enable_reboot && !(flags & SCGETC_CN)) { >> + mtx_unlock(&Giant); >> shutdown_nice(0); >> + } >> #endif >> break; >> >> case HALT: >> #ifndef SC_DISABLE_REBOOT >> - if (enable_reboot && !(flags & SCGETC_CN)) >> + if (enable_reboot && !(flags & SCGETC_CN)) { >> + mtx_unlock(&Giant); >> shutdown_nice(RB_HALT); >> + } >> #endif >> break; >> >> case PDWN: >> #ifndef SC_DISABLE_REBOOT >> - if (enable_reboot && !(flags & SCGETC_CN)) >> + if (enable_reboot && !(flags & SCGETC_CN)) { >> + mtx_unlock(&Giant); >> shutdown_nice(RB_HALT|RB_POWEROFF); >> + } >> #endif >> break; >> > > The new bugs should cause assertion failures. shutdown_nice() just > signals init and returns. Giant is not re-acquired, so assertions > should fail when the caller drops the lock. So the shutdown should > be a nasty panic. > I must have been using vt when I tested it, since I didn't see that. > Transiently dropping the lock is probably not fatal depending on what > the caller does. On x86 with atkbd, nested interrupts are prevented > by masking the in the ATPIC or APIC -- Giant is not really the driver > lock, but just a lock for interfacing between related screen and keyboard > drivers. > > Serial console drivers with fast interrupt handlers have much more > broken locking for ddb special keys. It is invalid to either drop locks > or call the "any" function from a fast interrupt handler, but buggy > serial console drivers calls kbd_alt_break(), and that now calls > shutdown_nice() and other functions that cannot be called from a fast > interrupt handler. ddb keys supply most of the shutdown_nice() > functionality for serial consoles, and there are no escape sequence to > get this without ddb or maybe another debugger, so these bugs don't > affect most users. > It's called it before my changes... I'll make a note to look into this. > Handling this correctly requires much the same fix as an unsafe signal > handler, and fixes have much the same problems -- not much more than > setting a flag is safe, and the flag might never be looked at if the > system is in a bad state. However, if a nice shutdown is possible then > the sytem must be in a good enough state to poll for flags. > > For normal signal handlers, there is no problem sending a signal to init > or at least with setting a flag and waking up some thread to check the > flag. > > I don't quite understand this commit. It should be valid to send a > signal to init() in proc or non-fast ithread context including with > Giant held. shutdown_nice() starts with PROC_LOCK(initproc), so it > would be a LOR to call it with a spinlock held, and is even more > obviously wrong to call it from kbd_alt_break() with interrupts masked > and possibly a spinlock held, but Giant is a special sleep lock that > causes fewer LORs than most sleep locks. > Yes, this commit is wrong. > Actual testing shows that doesn't cause a panic, but it also doesn't > actually unlock for shutdown_nice(), since the lock is acquired twice > and only released once. syscons has much the same extra lock sprinkling > for event handling as vt: > > - intr_event_execute_handlers() acquires Giant and calls atkbdintr() > - atkbdintr() calls sckbdevent() > - sckbdevent() unnecessarily acquires Giant again > - the buggy unlocking drops Giant just once > - shutdown_nice() is called with Giant held > - the buggy unlocking fails to re-acquire Giant > - sckbdevent() releases Giant, leaving it not held > - sckbdevent() returns > - atkbdintr() returns > - intr_event_execute_handlers() releases Giant. This should panic, but > it apparently blocks for long enough for init to shut down first. > > When I trace the last step, I get a panic which might be either from the > different timing or just a bug in kdb. Good point. I think the following change is good for everything except calling shutdown_nice() from a fast interrupt handler with noinit running: diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index e5ea9644ad3f..564aecd811be 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -366,6 +366,12 @@ kern_reboot(int howto) { static int once = 0; + /* + * Drop Giant once and for all. + */ + while (mtx_owned(&Giant)) + mtx_unlock(&Giant); + #if defined(SMP) /* * Bind us to the first CPU so that all shutdown code runs there. Some Comments? Warner From owner-svn-src-head@freebsd.org Thu Mar 22 00:36:23 2018 Return-Path: Delivered-To: svn-src-head@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 4F077F52FF8 for ; Thu, 22 Mar 2018 00:36:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22e.google.com (mail-it0-x22e.google.com [IPv6:2607:f8b0:4001:c0b::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C0EAF71BB5 for ; Thu, 22 Mar 2018 00:36:22 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22e.google.com with SMTP id 19-v6so8965252itw.3 for ; Wed, 21 Mar 2018 17:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=2SY+Vn5yh1yjz1ZbKH8Uc8Bkp3mwMKf0hTJXx7GzGXw=; b=Ml6eLWbqgO7G97jhUr1oMSYd3n2pQR/v8vsmPtjOYYzf2EEpBNemZ3uYoF7jfq2CVD sY+H4kO66yzxU/NGu9r2Cdj1f6/SLKT7fdeKjqFN9stTncM/Ma8TcA4G8G1R460KDxY6 DrvmtD8FI/m1kpbFvqpKoT7A6OzkwZiMuSvWTCmYRSwqZD5DFhS3lE7Wu62rBUfS0a6b T8E824AY+NNAyTi11jZOOgbvhXW2QQfYJa1QUq9twVZIiY9574ajU/gZ78oz2sO4dzGZ CljUTHZUP0RpKQiNnt+ahUzyxMtRNzrskwEHeHxTn5IKNZEdxuEYcLle8EzYTJEEEzDS Lu3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=2SY+Vn5yh1yjz1ZbKH8Uc8Bkp3mwMKf0hTJXx7GzGXw=; b=FPxziRFI4bH9yh/9SzB9jiIiyQuMCReIkZFAj4jTkmY4ih8Zt3/RrpT0e2fCN0lgiV 4U2WqkGGy7MGQuMAqzrYeSnPzTl4EGjowo6pn65FwXlyZEB4Ox1IiQelGCsCKn972Zgk aDYMgplXVRVnhNobZv+akXjqiX6Yp/LKfIcHIMLqTRAeltJO7pKTFgksmCxc2iIHEkgP B2Qth4KT0aK47hHC2zlUZCCJk1LphEZdKQND9A7eJF1R4vUbSON722Lg9nS1ZWG7l9cO x69dGIVecMN8pz2xeG58t8DsvpRoDmuZXXhorF/7eO3TnhX4YHx9dMPY0pEFMEkYVTye MbcA== X-Gm-Message-State: AElRT7EQaYk5g5yAIfkCpD6Ie/OwE2A+r87v7HAax416MCpNLEHmeS2o C1kMHs7a3hd4e8++JpSeiGc5e4uElRaGuWfYW1n1Sg== X-Google-Smtp-Source: AG47ELurNmIFsNjPCYDsyuhn2jDGAMvO5c4ZMvDhpM4+FlTfcViKDJ9Q5+INKOGU88kbWrsu5B6aQaSMuCxkNWv57VE= X-Received: by 2002:a24:4286:: with SMTP id i128-v6mr6765606itb.73.1521678982095; Wed, 21 Mar 2018 17:36:22 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Wed, 21 Mar 2018 17:36:21 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180321202752.GO76926@kib.kiev.ua> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> <20180321202752.GO76926@kib.kiev.ua> From: Warner Losh Date: Wed, 21 Mar 2018 18:36:21 -0600 X-Google-Sender-Auth: MBCbBvSxwxZ0VXJ4fIP2YJ5Pgps Message-ID: Subject: Re: svn commit: r331298 - head/sys/dev/syscons To: Konstantin Belousov Cc: Bruce Evans , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 00:36:23 -0000 On Wed, Mar 21, 2018 at 2:27 PM, Konstantin Belousov wrote: > On Thu, Mar 22, 2018 at 04:53:22AM +1100, Bruce Evans wrote: > > Serial console drivers with fast interrupt handlers have much more > > broken locking for ddb special keys. It is invalid to either drop locks > > or call the "any" function from a fast interrupt handler, but buggy > > serial console drivers calls kbd_alt_break(), and that now calls > > shutdown_nice() and other functions that cannot be called from a fast > > interrupt handler. ddb keys supply most of the shutdown_nice() > > functionality for serial consoles, and there are no escape sequence to > > get this without ddb or maybe another debugger, so these bugs don't > > affect most users. > > > > Handling this correctly requires much the same fix as an unsafe signal > > handler, and fixes have much the same problems -- not much more than > > setting a flag is safe, and the flag might never be looked at if the > > system is in a bad state. However, if a nice shutdown is possible then > > the sytem must be in a good enough state to poll for flags. > > Are you saying that fast interrupt handlers call shutdown_nice() ? This > is the quite serious bug on its own. To fix it, shutdown_nice() should > use a fast taskqueue to schedule the task which would lock the process > and send the signal. > Is there some way we know we're in a fast interrupt handler? If so, it should be simple to fix. If not, then there's an API change ahead of us... But bde is right: the system has to be in good enough shape to cope. I wonder if we should put that coping into kdb_reboot() instead. It's only an issue for TILDE ^R, which is a fairly edge case. Warner From owner-svn-src-head@freebsd.org Thu Mar 22 01:00:56 2018 Return-Path: Delivered-To: svn-src-head@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 5841FF54E5A; Thu, 22 Mar 2018 01:00:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 0DFE572EC7; Thu, 22 Mar 2018 01:00:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07F521FE5; Thu, 22 Mar 2018 01:00:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M10tEd006565; Thu, 22 Mar 2018 01:00:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M10tNT006564; Thu, 22 Mar 2018 01:00:55 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803220100.w2M10tNT006564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Mar 2018 01:00:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331339 - head/sys/dev/drm X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/drm X-SVN-Commit-Revision: 331339 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 01:00:56 -0000 Author: emaste Date: Thu Mar 22 01:00:55 2018 New Revision: 331339 URL: https://svnweb.freebsd.org/changeset/base/331339 Log: Correct signedness bug in drm_modeset_ctl drm_modeset_ctl() takes a signed in from userland, does a boundscheck, and then uses it to index into a structure and write to it. The boundscheck only checks upper bound, and never checks for nagative values. If the int coming from userland is negative [after conversion] it will bypass the boundscheck, perform a negative index into an array and write to it, causing memory corruption. Note that this is in the "old" drm driver; this issue does not exist in drm2. Reported by: Ilja Van Sprundel Reviewed by: cem MFC after: 1 day Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/drm/drm_irq.c Modified: head/sys/dev/drm/drm_irq.c ============================================================================== --- head/sys/dev/drm/drm_irq.c Thu Mar 22 00:55:36 2018 (r331338) +++ head/sys/dev/drm/drm_irq.c Thu Mar 22 01:00:55 2018 (r331339) @@ -351,7 +351,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data goto out; crtc = modeset->crtc; - if (crtc >= dev->num_crtcs) { + if (crtc < 0 || crtc >= dev->num_crtcs) { ret = EINVAL; goto out; } From owner-svn-src-head@freebsd.org Thu Mar 22 01:10:19 2018 Return-Path: Delivered-To: svn-src-head@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 49871F55929; Thu, 22 Mar 2018 01:10:19 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC2077364F; Thu, 22 Mar 2018 01:10:18 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x230.google.com with SMTP id w3-v6so9232471itc.4; Wed, 21 Mar 2018 18:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=cGIUlgPPto73nP5cqs3OGJ9Lt5eE6aVH5+cWy+ra+ls=; b=XGzAnVOSskDVtlyIrqkMzncz0nsNYUF3kRLg+7w2c1gfki5Gj99mfddOcexG2SjJMu +t9MgAUc0T4Q32GnIr1snUD89PKsbhkah59+L15+3Pj6aDL71wWNlZTLbWD08oUdukcE PJGkbmCWuuXx6uTyj98IWWnfl/E5XAAd/SXEh+x+UHRNi9JG/w31UiEqwlaum2453lpN aVr3N7fhO5k+P4svxPIcse9YrqoHy/01lSFR4GOYrhzayjpZqu79Gl1T4APk/lHD4iq2 3tg/4U3/dHR5FCt6MONWoweKjKclclKuA9JwlJCj/IOJEIqeZSqZTtmmH4VAuOtn2+E6 kpJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=cGIUlgPPto73nP5cqs3OGJ9Lt5eE6aVH5+cWy+ra+ls=; b=WCWf9Shp2yWBSO5xN9USe6l2I/8aYisuJjLa3Xqy04GKTeh6smybtMwuKNa8e6owGp LnnCG6f7tBceqoaK021UV/ZBFPghsdoAFhETgAH9TN+KWcaZyqt0VHOtzhvKqoUYKo2v B2DNDFRL349O7r2VKeZsp9DAqFQMq1Mbe9FHDCTtO0/CcTncfk8uLBDSG5cX+0jY/hVO gN+I/eaBUiRCgAt7ZwfrRJwTHS+76T8BKHtrvXd6gmNFCudNfx/vDirzTIY+NqXuYUZu lnnTHIhEb0hWpw++QVoQpyZsIA5ZCnHKT0h3CmpcKRNBHxixc6YnRXEfN3m/jwwiKoFf SD5g== X-Gm-Message-State: AElRT7EOWV9l3oTb/TUD6bDehJ9ggum3/NTE58SR6g+KhCyL+2r8poJy T9gJSg5H+bVyBmYe+eLNcLdfipbhpx684ZMqO6epXdun X-Google-Smtp-Source: AIpwx4+jAzuCXPTLMyom441eZtHRPJVfytC1w/uiwo/s6+NcxPVT+LafqrbrJd55/1GJeDFBSprwNzUajkhR4FKnSxc= X-Received: by 2002:a24:d241:: with SMTP id z62-v6mr6518825itf.49.1521681018133; Wed, 21 Mar 2018 18:10:18 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.163.13 with HTTP; Wed, 21 Mar 2018 18:09:57 -0700 (PDT) In-Reply-To: <201803220100.w2M10tNT006564@repo.freebsd.org> References: <201803220100.w2M10tNT006564@repo.freebsd.org> From: Ed Maste Date: Wed, 21 Mar 2018 21:09:57 -0400 X-Google-Sender-Auth: HwA60Gnbtmc6DMmdVip39VC8qgo Message-ID: Subject: Re: svn commit: r331339 - head/sys/dev/drm To: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 01:10:19 -0000 On 21 March 2018 at 21:00, Ed Maste wrote: > Author: emaste > Date: Thu Mar 22 01:00:55 2018 > New Revision: 331339 > URL: https://svnweb.freebsd.org/changeset/base/331339 > > Log: > Correct signedness bug in drm_modeset_ctl > > Reported by: Ilja Van Sprundel Also reported by: anonymous from the shellphish grill team From owner-svn-src-head@freebsd.org Thu Mar 22 02:04:58 2018 Return-Path: Delivered-To: svn-src-head@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 3E266F5AC7A; Thu, 22 Mar 2018 02:04:58 +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 E06D5761D8; Thu, 22 Mar 2018 02:04:57 +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 DB81E2C2B; Thu, 22 Mar 2018 02:04:57 +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 w2M24vfC040773; Thu, 22 Mar 2018 02:04:57 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M24vLm040772; Thu, 22 Mar 2018 02:04:57 GMT (envelope-from np@FreeBSD.org) Message-Id: <201803220204.w2M24vLm040772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 22 Mar 2018 02:04:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331340 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 331340 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 02:04:58 -0000 Author: np Date: Thu Mar 22 02:04:57 2018 New Revision: 331340 URL: https://svnweb.freebsd.org/changeset/base/331340 Log: cxgbe(4): Tunnel congestion drops on a port should be cleared when the stats for that port are cleared. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Mar 22 01:00:55 2018 (r331339) +++ head/sys/dev/cxgbe/t4_main.c Thu Mar 22 02:04:57 2018 (r331340) @@ -9650,7 +9650,7 @@ t4_ioctl(struct cdev *dev, unsigned long cmd, caddr_t rc = read_i2c(sc, (struct t4_i2c_data *)data); break; case CHELSIO_T4_CLEAR_STATS: { - int i, v; + int i, v, bg_map; u_int port_id = *(uint32_t *)data; struct port_info *pi; struct vi_info *vi; @@ -9664,10 +9664,19 @@ t4_ioctl(struct cdev *dev, unsigned long cmd, caddr_t /* MAC stats */ t4_clr_port_stats(sc, pi->tx_chan); pi->tx_parse_error = 0; + pi->tnl_cong_drops = 0; mtx_lock(&sc->reg_lock); for_each_vi(pi, v, vi) { if (vi->flags & VI_INIT_DONE) t4_clr_vi_stats(sc, vi->viid); + } + bg_map = pi->mps_bg_map; + v = 0; /* reuse */ + while (bg_map) { + i = ffs(bg_map) - 1; + t4_write_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v, + 1, A_TP_MIB_TNL_CNG_DROP_0 + i); + bg_map &= ~(1 << i); } mtx_unlock(&sc->reg_lock); From owner-svn-src-head@freebsd.org Thu Mar 22 04:03:16 2018 Return-Path: Delivered-To: svn-src-head@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 99933F64ACC; Thu, 22 Mar 2018 04:03:16 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C1857BDDF; Thu, 22 Mar 2018 04:03:16 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 433941CB3; Thu, 22 Mar 2018 04:03:16 +0000 (UTC) Date: Thu, 22 Mar 2018 04:03:16 +0000 From: Alexey Dokuchaev To: John Baldwin Cc: Kyle Evans , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r331209 - head Message-ID: <20180322040316.GB49350@FreeBSD.org> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <4168709.idJmbTaMPK@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4168709.idJmbTaMPK@ralph.baldwin.cx> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:03:16 -0000 On Mon, Mar 19, 2018 at 09:20:40AM -0700, John Baldwin wrote: > On Monday, March 19, 2018 03:27:53 PM Kyle Evans wrote: > > New Revision: 331209 > > URL: https://svnweb.freebsd.org/changeset/base/331209 > > > > Log: > > Add note to UPDATING about UEFI changes requiring loader(8) update > > ... > > How does this fit with the recommended installation steps of doing > 'make installkernel' and rebooting before doing a 'make installworld'? Rebooting? I vaguely recall recommended procedure was to switch to single user mode prior to `installworld', but personally I've never bothered and installed kernel, [mm -p,] world, mm -Fi, reboot. Am I missing something? ./danfe From owner-svn-src-head@freebsd.org Thu Mar 22 03:30:49 2018 Return-Path: Delivered-To: svn-src-head@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 15CD5F6270D; Thu, 22 Mar 2018 03:30:49 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BB0F7A3D8; Thu, 22 Mar 2018 03:30:48 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id yqw2ePy1CXziTyqw4e6ENq; Wed, 21 Mar 2018 21:30:40 -0600 X-Authority-Analysis: v=2.3 cv=X6B81lbe c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=v2DPQv5-lfwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EMgYP5mRnpT9skovMisA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 75D796FC; Wed, 21 Mar 2018 20:30:38 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w2M3UbWM004639; Wed, 21 Mar 2018 20:30:37 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w2M3Ubdx004626; Wed, 21 Mar 2018 20:30:37 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201803220330.w2M3Ubdx004626@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Kyle Evans cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331326 - in head/stand: forth i386/loader In-Reply-To: Message from Kyle Evans of "Wed, 21 Mar 2018 22:01:51 -0000." <201803212201.w2LM1pvl020202@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 21 Mar 2018 20:30:37 -0700 X-CMAE-Envelope: MS4wfPWLc06PAHgWOy7niO16lX4CkcXfRYzrb+y0+AwkPwYPsJ5IbBq9dihLY+FvubNjb1iMQdXGiB5++JTHNMtGSibA1l0MlW6kVP4bcnwjm4oGTFkfOpYv gFNTL3cj4UkXTehOhTaKMAGfa2g88SfqWyPmE1R4tnJgTAVhr2VJfkVZ/Z+NnxcmFS6XKPgiTXOE9cYkMoUSw+FMkoWvofys06du02M5+5X+8DkVatzIrtlH YCBsgMw0xxToWtLywC85V7pbJb7+S4rFKay728o07MGikJROY3bAwrE9URt5Hj7X X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 03:30:49 -0000 In message <201803212201.w2LM1pvl020202@repo.freebsd.org>, Kyle Evans writes: > Author: kevans > Date: Wed Mar 21 22:01:51 2018 > New Revision: 331326 > URL: https://svnweb.freebsd.org/changeset/base/331326 > > Log: > Forth version of EFI autoresizing > > r331321 delegated autoresizing to an efi-autoresizecons command that > currently is expected to be done in forth/lua prior to drawing anything > useful. > > Add the Forth version of the lua addition in r331321, hook efi.4th up to be > installed. > > efiboot? was written by dteske@; anything outside of that may be blamed on > me. > > Modified: > head/stand/forth/Makefile > head/stand/forth/efi.4th > head/stand/forth/loader.rc > head/stand/i386/loader/loader.rc > > Modified: head/stand/forth/Makefile > ============================================================================= > = > --- head/stand/forth/Makefile Wed Mar 21 21:15:43 2018 (r331325) > +++ head/stand/forth/Makefile Wed Mar 21 22:01:51 2018 (r331326) > @@ -18,6 +18,7 @@ FILES+= brand-fbsd.4th > FILES+= check-password.4th > FILES+= color.4th > FILES+= delay.4th > +FILES+= efi.4th > FILES+= frames.4th > FILES+= loader.4th > FILES+= logo-beastie.4th > > Modified: head/stand/forth/efi.4th > ============================================================================= > = > --- head/stand/forth/efi.4th Wed Mar 21 21:15:43 2018 (r331325) > +++ head/stand/forth/efi.4th Wed Mar 21 22:01:51 2018 (r331326) > @@ -26,5 +26,16 @@ > > only forth definitions > > -\ Place holder for more functions > +: efiboot? ( -- flag ) > + s" efi-version" getenv -1 <> dup if > + swap drop ( c-addr flag -- flag ) > + then > +; > + > +: maybe-efi-resizecons > + efiboot? if > + efi-autoresizecons This statement breaks boot on my BIOS machines. It cannot find efi-autoresizecons, causing a bare kernel without modules to load or kenv variables set. > + then > +; > + > .( EFI boot environment) cr > > Modified: head/stand/forth/loader.rc > ============================================================================= > = > --- head/stand/forth/loader.rc Wed Mar 21 21:15:43 2018 (r33132 > 5) > +++ head/stand/forth/loader.rc Wed Mar 21 22:01:51 2018 (r33132 > 6) > @@ -6,11 +6,14 @@ > \ > \ Includes additional commands > include /boot/loader.4th > +include /boot/efi.4th > try-include /boot/loader.rc.local > > \ Reads and processes loader.conf variables > \ NOTE: Change to `initialize' if you enable the below boot menu > start > + > +maybe-efi-resizecons > > \ Tests for password -- executes autoboot first if a password was defined > check-password > > Modified: head/stand/i386/loader/loader.rc > ============================================================================= > = > --- head/stand/i386/loader/loader.rc Wed Mar 21 21:15:43 2018 (r33132 > 5) > +++ head/stand/i386/loader/loader.rc Wed Mar 21 22:01:51 2018 (r33132 > 6) > @@ -3,10 +3,13 @@ > \ > \ Includes additional commands > include /boot/loader.4th > +include /boot/efi.4th > try-include /boot/loader.rc.local > > \ Reads and processes loader.conf variables > initialize > + > +maybe-efi-resizecons > > \ Tests for password -- executes autoboot first if a password was defined > check-password > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Thu Mar 22 04:19:53 2018 Return-Path: Delivered-To: svn-src-head@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 2540DF65847; Thu, 22 Mar 2018 04:19:53 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A44D7C548; Thu, 22 Mar 2018 04:19:52 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f51.google.com with SMTP id e5-v6so11106394lfb.7; Wed, 21 Mar 2018 21:19:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=VrbzagRbTmBrOP7RVr8DAQNWiOugo2NpZFD52Re84tk=; b=OCZjSqZ8zi/6pq+zOcyugSPA7YeEU3HKGSmAncqzC0+BAG1bd8ATUIQ1lw97/clOU7 leW139w+4SrKP1JpxNpBBDTKY8ftkIRyh8dIEOg1czS+B7b3RP0ioxzanv21JH08TO3S FqoPNzGQMZQje8jzgEAPBUYbvfsR2YPdeolGuVHVMqlGcVGHcW9oQwKOaQ1BXJAvjMdp PEev5GRgZ9+xEtYrCv3Js0HrcYDk6k3sp/MkbEppcm42EgAKHHD7mQ/iyeeA1GR6rfF4 JyUMsZeGwMS9Hr8NnVKWLZ+8yYa/duc18tNciFis/YfA/zvHmlHhOEG6hqkJEGOO2V4y M89A== X-Gm-Message-State: AElRT7F3mbelG00V96+MZi3lQBNap3AvgRkl02ISQ/3jqgNXOJUQjkHg 9u/IF3UKfVmH8CSe4dQHFvP6i7OH X-Google-Smtp-Source: AG47ELueux+Gw1jQJaSwV3WBz4XZR3v1dwLGxzi4+AKx2IVu4YPNXqWksXcPM2mIRNHCeVG5Izm5iQ== X-Received: by 2002:a19:2655:: with SMTP id m82-v6mr9160791lfm.107.1521692384565; Wed, 21 Mar 2018 21:19:44 -0700 (PDT) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com. [209.85.215.46]) by smtp.gmail.com with ESMTPSA id s87-v6sm1412210lfk.69.2018.03.21.21.19.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 21:19:44 -0700 (PDT) Received: by mail-lf0-f46.google.com with SMTP id l4-v6so6762975lfg.12; Wed, 21 Mar 2018 21:19:44 -0700 (PDT) X-Received: by 2002:a19:e9cc:: with SMTP id j73-v6mr13712384lfk.99.1521692384287; Wed, 21 Mar 2018 21:19:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Wed, 21 Mar 2018 21:19:23 -0700 (PDT) In-Reply-To: <201803220330.w2M3Ubdx004626@slippy.cwsent.com> References: <201803212201.w2LM1pvl020202@repo.freebsd.org> <201803220330.w2M3Ubdx004626@slippy.cwsent.com> From: Kyle Evans Date: Wed, 21 Mar 2018 23:19:23 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331326 - in head/stand: forth i386/loader To: Cy Schubert Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:19:53 -0000 On Wed, Mar 21, 2018 at 10:30 PM, Cy Schubert wrote: > In message <201803212201.w2LM1pvl020202@repo.freebsd.org>, Kyle Evans > writes: >> Author: kevans >> Date: Wed Mar 21 22:01:51 2018 >> New Revision: 331326 >> URL: https://svnweb.freebsd.org/changeset/base/331326 >> >> Log: >> Forth version of EFI autoresizing >> >> r331321 delegated autoresizing to an efi-autoresizecons command that >> currently is expected to be done in forth/lua prior to drawing anything >> useful. >> >> Add the Forth version of the lua addition in r331321, hook efi.4th up to be >> installed. >> >> efiboot? was written by dteske@; anything outside of that may be blamed on >> me. >> >> Modified: >> head/stand/forth/Makefile >> head/stand/forth/efi.4th >> head/stand/forth/loader.rc >> head/stand/i386/loader/loader.rc >> >> Modified: head/stand/forth/Makefile >> ============================================================================= >> = >> --- head/stand/forth/Makefile Wed Mar 21 21:15:43 2018 (r331325) >> +++ head/stand/forth/Makefile Wed Mar 21 22:01:51 2018 (r331326) >> @@ -18,6 +18,7 @@ FILES+= brand-fbsd.4th >> FILES+= check-password.4th >> FILES+= color.4th >> FILES+= delay.4th >> +FILES+= efi.4th >> FILES+= frames.4th >> FILES+= loader.4th >> FILES+= logo-beastie.4th >> >> Modified: head/stand/forth/efi.4th >> ============================================================================= >> = >> --- head/stand/forth/efi.4th Wed Mar 21 21:15:43 2018 (r331325) >> +++ head/stand/forth/efi.4th Wed Mar 21 22:01:51 2018 (r331326) >> @@ -26,5 +26,16 @@ >> >> only forth definitions >> >> -\ Place holder for more functions >> +: efiboot? ( -- flag ) >> + s" efi-version" getenv -1 <> dup if >> + swap drop ( c-addr flag -- flag ) >> + then >> +; >> + >> +: maybe-efi-resizecons >> + efiboot? if >> + efi-autoresizecons > > This statement breaks boot on my BIOS machines. It cannot find > efi-autoresizecons, causing a bare kernel without modules to load or > kenv variables set. > Ugh, sorry about that. =( I've converted that to a runtime evaluation in r331341 and (hopefully) properly observed my failure to succeed. On the plus side, today I learned about `boot-conf` to get back to the Forth-intercepted 'boot' behavior to workaround the breakage. =) From owner-svn-src-head@freebsd.org Thu Mar 22 04:34:17 2018 Return-Path: Delivered-To: svn-src-head@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 399A1F66CAA for ; Thu, 22 Mar 2018 04:34:17 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x236.google.com (mail-it0-x236.google.com [IPv6:2607:f8b0:4001:c0b::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C14DA7D255 for ; Thu, 22 Mar 2018 04:34:16 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x236.google.com with SMTP id z143-v6so577372itc.0 for ; Wed, 21 Mar 2018 21:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=9eF7RgMkdKxGqZlwCtPnYdpr7WqdlBGgg6CgxeotDyQ=; b=z3OLzM9bmx4dbWOaILw/72He9rPSmAUJPaNYg371jAc5YwA9N8ZaICIxAKIgDk6b8/ JPVWB9aEFViVKpdIFhs04vM27Kmgg6MBB69SEIS2kBgoBjcU6Z7AzuXHI4gQpTbFucc3 lA6Bbbs4gb6tPrQCcjJmzytYt45tyd9LjhG4bbRxE/kzbIFv4+l17pWh1NrnvC+rhmQ0 KK66KxRV/f8LFjssqhzLHU4ox8nlkPxxX5zBHE3K4LFuhd2YP/7dd3xnn+2hnVy4J3/0 5k3dqA88MwsMliH5kuN3oYMPfM3ZgMLgXZB4cqCFSbXuAOuU/bPaBRvQ5ohHhOmqnFS3 pfTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=9eF7RgMkdKxGqZlwCtPnYdpr7WqdlBGgg6CgxeotDyQ=; b=K0nDCfWR3Biu5iY7CyCd1Jequal1gBXFFOqAxAzrRDob847SyEVOdO+Phjdu6W7CVS Ctki59cw6uZXtpa0CrTJCgG8Szxr8UkEQ2yNyXRXksEWc++7oJxCsuSY3EH9TjqkG8SD O4JS0gZ9P+tj2IJNQCtdED39HEjRZt9FRyJvmF4gUXfRCSRHQE/NVd3s6vhmWKhJb8Mh 8krPKKpUJJ1DiMGN+2m1Mnf/kljWbmaG1k3HK9O2tH4bpFzwoBupduSq8hobyyCfGNsa 8hzKRintdzAtVvZ3ZLk2GWLXEkyqQNcB//YJBDrPbacLRpCKLyDZcbjP3qaO6+J41gyj fg3Q== X-Gm-Message-State: AElRT7HhUHqDYx5Zbjc8fOHQi/yxj/ESIxOXQkSAE0449wud93h2UNxI CKzAQXdXiwAaWOxcSzk/ijZiSTn3FXFqsPYwhbnKSQ== X-Google-Smtp-Source: AG47ELu2bC66OjNIiBsx98caqHTB8M1Y+69b5An/6F+rstyASzUmD14T/l5MTgJ+DOmiLGf9/YZgPpzSon0X2ivMwBY= X-Received: by 2002:a24:fa83:: with SMTP id v125-v6mr7336592ith.36.1521693256066; Wed, 21 Mar 2018 21:34:16 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Wed, 21 Mar 2018 21:34:15 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180322040316.GB49350@FreeBSD.org> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <4168709.idJmbTaMPK@ralph.baldwin.cx> <20180322040316.GB49350@FreeBSD.org> From: Warner Losh Date: Wed, 21 Mar 2018 22:34:15 -0600 X-Google-Sender-Auth: OJEJu3gNKT3xePqzT0DRfZz71qY Message-ID: Subject: Re: svn commit: r331209 - head To: Alexey Dokuchaev Cc: John Baldwin , Kyle Evans , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:34:17 -0000 On Wed, Mar 21, 2018 at 10:03 PM, Alexey Dokuchaev wrote: > On Mon, Mar 19, 2018 at 09:20:40AM -0700, John Baldwin wrote: > > On Monday, March 19, 2018 03:27:53 PM Kyle Evans wrote: > > > New Revision: 331209 > > > URL: https://svnweb.freebsd.org/changeset/base/331209 > > > > > > Log: > > > Add note to UPDATING about UEFI changes requiring loader(8) update > > > ... > > > > How does this fit with the recommended installation steps of doing > > 'make installkernel' and rebooting before doing a 'make installworld'? > > Rebooting? I vaguely recall recommended procedure was to switch to single > user mode prior to `installworld', but personally I've never bothered and > installed kernel, [mm -p,] world, mm -Fi, reboot. Am I missing something? > Old advice was to do the installworld in single user, as that's the safest (and also ensures you have a new kernel and don't install before rebooting). However, we've had enough experience to see that usually an installworld + reboot is sufficient. Warner From owner-svn-src-head@freebsd.org Thu Mar 22 04:39:39 2018 Return-Path: Delivered-To: svn-src-head@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 33B77F674EE; Thu, 22 Mar 2018 04:39:39 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E046C7D687; Thu, 22 Mar 2018 04:39:38 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id BB3EC2992; Thu, 22 Mar 2018 04:39:38 +0000 (UTC) Date: Thu, 22 Mar 2018 04:39:38 +0000 From: Alexey Dokuchaev To: Warner Losh Cc: John Baldwin , Kyle Evans , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Subject: Re: svn commit: r331209 - head Message-ID: <20180322043938.GA8311@FreeBSD.org> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <4168709.idJmbTaMPK@ralph.baldwin.cx> <20180322040316.GB49350@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:39:39 -0000 On Wed, Mar 21, 2018 at 10:34:15PM -0600, Warner Losh wrote: > On Wed, Mar 21, 2018 at 10:03 PM, Alexey Dokuchaev > wrote: > > On Mon, Mar 19, 2018 at 09:20:40AM -0700, John Baldwin wrote: > > > ... > > > How does this fit with the recommended installation steps of doing > > > 'make installkernel' and rebooting before doing a 'make installworld'? > > > > Rebooting? I vaguely recall recommended procedure was to switch to single > > user mode prior to `installworld', but personally I've never bothered and > > installed kernel, [mm -p,] world, mm -Fi, reboot. Am I missing something? > > Old advice was to do the installworld in single user, as that's the safest > (and also ensures you have a new kernel and don't install before rebooting). > However, we've had enough experience to see that usually an installworld + > reboot is sufficient. Right, but John had mentioned extra reboot *between* installkernel and installworld, which I've never heard of before. ./danfe From owner-svn-src-head@freebsd.org Thu Mar 22 04:16:15 2018 Return-Path: Delivered-To: svn-src-head@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 5D7E6F655B6; Thu, 22 Mar 2018 04:16:15 +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 0E8AB7C3B3; Thu, 22 Mar 2018 04:16:15 +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 0952548BE; Thu, 22 Mar 2018 04:16:15 +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 w2M4GEW9006377; Thu, 22 Mar 2018 04:16:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M4GEWH006376; Thu, 22 Mar 2018 04:16:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803220416.w2M4GEWH006376@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Mar 2018 04:16:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331341 - head/stand/forth X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/forth X-SVN-Commit-Revision: 331341 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:16:15 -0000 Author: kevans Date: Thu Mar 22 04:16:14 2018 New Revision: 331341 URL: https://svnweb.freebsd.org/changeset/base/331341 Log: forthloader: Don't break BIOS boots... I thought I tested this scenario, but clearly I failed to. =( BIOS boots won't have efi-autoresizecons, so trying to use it as a forth word fails during include. Use evaluate on "efi-autoresizecons" as a string instead to move any potential errors to runtime- safely after we've already checked that we're booting UEFI. Pointy hat to: me Reported by: cy Modified: head/stand/forth/efi.4th Modified: head/stand/forth/efi.4th ============================================================================== --- head/stand/forth/efi.4th Thu Mar 22 02:04:57 2018 (r331340) +++ head/stand/forth/efi.4th Thu Mar 22 04:16:14 2018 (r331341) @@ -34,7 +34,7 @@ only forth definitions : maybe-efi-resizecons efiboot? if - efi-autoresizecons + s" efi-autoresizecons" evaluate then ; From owner-svn-src-head@freebsd.org Thu Mar 22 04:47:29 2018 Return-Path: Delivered-To: svn-src-head@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 10403F67C20 for ; Thu, 22 Mar 2018 04:47:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x234.google.com (mail-io0-x234.google.com [IPv6:2607:f8b0:4001:c06::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 81C537DECA for ; Thu, 22 Mar 2018 04:47:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x234.google.com with SMTP id v13so9318379iob.6 for ; Wed, 21 Mar 2018 21:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Z3a1PchPwkMULU8w7rskpw+pYwlgQxSea6Ik2tyGvA0=; b=b9/SU114asXYNGbJbZ3ymp4Fh6ww3kFkAp2vBBUch56FtMgkI8GkQRbJka6T647LDF TArkJ8v48BUiyGwW1HQTwcohu4pc2uCoAGIy0DosazmdSAaeaRgk63K0vSdvLxd1/8wd PhIcHUd2aGVucmpDnLC/nbBPOPJu7o3I9DNesXazWnC+QLWNHrGSEi5Bc93nE1e1+2Ac xwEHA5dwJM28jS9zrbnQD4+sRTdyrAR9zhNhudSga9vGK9fEtR0XvsEaGEq9zhWI63un cgP1QamLEwXCdC17Psc/0K+2DePsvH0g+pB0cN/SQwsWQh5JchYKu+z+WHC5Vxv7rawj DM7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Z3a1PchPwkMULU8w7rskpw+pYwlgQxSea6Ik2tyGvA0=; b=hIoPGce1tQvyu7f7zgQzNjExZ8XUO/EzrPMmDQnAENF4AH0q5MB1QKPUNt3V4WRl0K wtV7cCbqqoAPCNvYpXCkQVyrSQn+bzcjgOs/xHRfNBV93VU9sTh8U93SspFIyrqs7z8U XWmVorMrO+kF6McoZRGxeRJsFdumFMtIQJnaPX60bY1/9RCqCI+Un21dDOO1wnzv8BuG oRl1viM1hHHPZliPssjwZyIHinJsxi+w1hT5JJgITN24MdhdnP+tirQI/Mn8o80ccsKV 9VA7PhoeYa5C/NklLW3w8A0tHjf6TYbpoYot7lgmq80h/RXmVEtm4x9UCjSFVtPcTtLL d83w== X-Gm-Message-State: AElRT7FXk8Rie9oaogsVyI8PgjPJjjlZolJ4kfjbysveNArLNCAd/r50 NpFHtbFfaTqD8GyfIBusD0StX270832z76pfdj1Rhw== X-Google-Smtp-Source: AG47ELvs8IGV83BQKkVkUrR7Zpqlmzvd2KC67TPHQ92uMaxzTrsLQbdiZlcEWnpEgvxlRxpInw1WMjKNohF3RTGgnBg= X-Received: by 10.107.12.230 with SMTP id 99mr23334850iom.117.1521694047734; Wed, 21 Mar 2018 21:47:27 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Wed, 21 Mar 2018 21:47:27 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180322043938.GA8311@FreeBSD.org> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <4168709.idJmbTaMPK@ralph.baldwin.cx> <20180322040316.GB49350@FreeBSD.org> <20180322043938.GA8311@FreeBSD.org> From: Warner Losh Date: Wed, 21 Mar 2018 22:47:27 -0600 X-Google-Sender-Auth: pvKHAmlqxfARE5ZouoMT3xuaV3I Message-ID: Subject: Re: svn commit: r331209 - head To: Alexey Dokuchaev Cc: John Baldwin , Kyle Evans , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:47:29 -0000 On Wed, Mar 21, 2018 at 10:39 PM, Alexey Dokuchaev wrote: > On Wed, Mar 21, 2018 at 10:34:15PM -0600, Warner Losh wrote: > > On Wed, Mar 21, 2018 at 10:03 PM, Alexey Dokuchaev > > wrote: > > > On Mon, Mar 19, 2018 at 09:20:40AM -0700, John Baldwin wrote: > > > > ... > > > > How does this fit with the recommended installation steps of doing > > > > 'make installkernel' and rebooting before doing a 'make > installworld'? > > > > > > Rebooting? I vaguely recall recommended procedure was to switch to > single > > > user mode prior to `installworld', but personally I've never bothered > and > > > installed kernel, [mm -p,] world, mm -Fi, reboot. Am I missing > something? > > > > Old advice was to do the installworld in single user, as that's the > safest > > (and also ensures you have a new kernel and don't install before > rebooting). > > However, we've had enough experience to see that usually an installworld > + > > reboot is sufficient. > > Right, but John had mentioned extra reboot *between* installkernel and > installworld, which I've never heard of before. > We've done what we can to make it so you don't brick your system if you don't do that, but the pedantic way is build everything, install a new kernel, reboot single user, install world and bring it up multi-user, though that leaves a copy of the old sh around that doesn't hurt anything. The alternate way is to install kernel, reboot installworld, reboot, but usually people skip the reboot after install kernel. You can usually get away with it, but the ino64 showed that's not always possible (the forward compat code wasn't committed for weeks and even then there's no guarantee that it would). Warner From owner-svn-src-head@freebsd.org Thu Mar 22 05:26:28 2018 Return-Path: Delivered-To: svn-src-head@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 2877AF6A273; Thu, 22 Mar 2018 05:26:28 +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 B3E237FCAF; Thu, 22 Mar 2018 05:26:27 +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 AED7E541E; Thu, 22 Mar 2018 05:26:27 +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 w2M5QRu5041170; Thu, 22 Mar 2018 05:26:27 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M5QRjr041169; Thu, 22 Mar 2018 05:26:27 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201803220526.w2M5QRjr041169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 22 Mar 2018 05:26:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331344 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331344 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 05:26:28 -0000 Author: glebius Date: Thu Mar 22 05:26:27 2018 New Revision: 331344 URL: https://svnweb.freebsd.org/changeset/base/331344 Log: Redo r331328. We need to fix not only type but also format. While here again notice that we are fixing regression from r331106. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Mar 22 05:07:57 2018 (r331343) +++ head/sys/kern/vfs_bio.c Thu Mar 22 05:26:27 2018 (r331344) @@ -262,17 +262,17 @@ SYSCTL_PROC(_vfs, OID_AUTO, numdirtybuffers, static int lodirtybuffers; SYSCTL_PROC(_vfs, OID_AUTO, lodirtybuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &lodirtybuffers, - __offsetof(struct bufdomain, bd_lodirtybuffers), sysctl_bufdomain_int, "L", + __offsetof(struct bufdomain, bd_lodirtybuffers), sysctl_bufdomain_int, "I", "How many buffers we want to have free before bufdaemon can sleep"); static int hidirtybuffers; SYSCTL_PROC(_vfs, OID_AUTO, hidirtybuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &hidirtybuffers, - __offsetof(struct bufdomain, bd_hidirtybuffers), sysctl_bufdomain_int, "L", + __offsetof(struct bufdomain, bd_hidirtybuffers), sysctl_bufdomain_int, "I", "When the number of dirty buffers is considered severe"); int dirtybufthresh; SYSCTL_PROC(_vfs, OID_AUTO, dirtybufthresh, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &dirtybufthresh, - __offsetof(struct bufdomain, bd_dirtybufthresh), sysctl_bufdomain_int, "L", + __offsetof(struct bufdomain, bd_dirtybufthresh), sysctl_bufdomain_int, "I", "Number of bdwrite to bawrite conversions to clear dirty buffers"); static int numfreebuffers; SYSCTL_INT(_vfs, OID_AUTO, numfreebuffers, CTLFLAG_RD, &numfreebuffers, 0, @@ -280,12 +280,12 @@ SYSCTL_INT(_vfs, OID_AUTO, numfreebuffers, CTLFLAG_RD, static int lofreebuffers; SYSCTL_PROC(_vfs, OID_AUTO, lofreebuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &lofreebuffers, - __offsetof(struct bufdomain, bd_lofreebuffers), sysctl_bufdomain_int, "L", + __offsetof(struct bufdomain, bd_lofreebuffers), sysctl_bufdomain_int, "I", "Target number of free buffers"); static int hifreebuffers; SYSCTL_PROC(_vfs, OID_AUTO, hifreebuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &hifreebuffers, - __offsetof(struct bufdomain, bd_hifreebuffers), sysctl_bufdomain_int, "L", + __offsetof(struct bufdomain, bd_hifreebuffers), sysctl_bufdomain_int, "I", "Threshold for clean buffer recycling"); static counter_u64_t getnewbufcalls; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, getnewbufcalls, CTLFLAG_RD, From owner-svn-src-head@freebsd.org Thu Mar 22 04:42:30 2018 Return-Path: Delivered-To: svn-src-head@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 3D8D2F677C4; Thu, 22 Mar 2018 04:42:30 +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 E34397DA1F; Thu, 22 Mar 2018 04:42:29 +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 DE2AA4D96; Thu, 22 Mar 2018 04:42:29 +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 w2M4gTOD021155; Thu, 22 Mar 2018 04:42:29 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M4gTDM021154; Thu, 22 Mar 2018 04:42:29 GMT (envelope-from np@FreeBSD.org) Message-Id: <201803220442.w2M4gTDM021154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 22 Mar 2018 04:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331342 - head/sys/dev/cxgbe/common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/common X-SVN-Commit-Revision: 331342 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:42:30 -0000 Author: np Date: Thu Mar 22 04:42:29 2018 New Revision: 331342 URL: https://svnweb.freebsd.org/changeset/base/331342 Log: cxgbe(4): Do not read MFG diags information from custom boards. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Thu Mar 22 04:16:14 2018 (r331341) +++ head/sys/dev/cxgbe/common/t4_hw.c Thu Mar 22 04:42:29 2018 (r331342) @@ -2960,7 +2960,7 @@ static int get_vpd_keyword_val(const u8 *vpd, const ch * Reads card parameters stored in VPD EEPROM. */ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p, - u32 *buf) + uint16_t device_id, u32 *buf) { int i, ret, addr; int ec, sn, pn, na, md; @@ -3028,12 +3028,16 @@ static int get_vpd_params(struct adapter *adapter, str memcpy(p->na, vpd + na, min(i, MACADDR_LEN)); strstrip((char *)p->na); + if (device_id & 0x80) + return 0; /* Custom card */ + md = get_vpd_keyword_val(vpd, "VF", 1); if (md < 0) { snprintf(p->md, sizeof(p->md), "unknown"); } else { i = vpd[md - VPD_INFO_FLD_HDR_SIZE + 2]; memcpy(p->md, vpd + md, min(i, MD_LEN)); + strstrip((char *)p->md); } return 0; @@ -8053,10 +8057,6 @@ int t4_prep_adapter(struct adapter *adapter, u32 *buf) if (ret < 0) return ret; - ret = get_vpd_params(adapter, &adapter->params.vpd, buf); - if (ret < 0) - return ret; - /* Cards with real ASICs have the chipid in the PCIe device id */ t4_os_pci_read_cfg2(adapter, PCI_DEVICE_ID, &device_id); if (device_id >> 12 == chip_id(adapter)) @@ -8066,6 +8066,10 @@ int t4_prep_adapter(struct adapter *adapter, u32 *buf) adapter->params.fpga = 1; adapter->params.cim_la_size = 2 * CIMLA_SIZE; } + + ret = get_vpd_params(adapter, &adapter->params.vpd, device_id, buf); + if (ret < 0) + return ret; init_cong_ctrl(adapter->params.a_wnd, adapter->params.b_wnd); From owner-svn-src-head@freebsd.org Thu Mar 22 04:51:46 2018 Return-Path: Delivered-To: svn-src-head@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 732F9F680B6; Thu, 22 Mar 2018 04:51:46 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id BC6757E31F; Thu, 22 Mar 2018 04:51:45 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id D4892101B79; Thu, 22 Mar 2018 15:51:42 +1100 (AEDT) Date: Thu, 22 Mar 2018 15:51:42 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Gleb Smirnoff cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331328 - head/sys/kern In-Reply-To: <201803212321.w2LNLWa1059145@repo.freebsd.org> Message-ID: <20180322144902.M1053@besplex.bde.org> References: <201803212321.w2LNLWa1059145@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=B0bGbaIv-eMvG_GntjcA:9 a=U5YPzu8vfC6-BsS1:21 a=QozMUkue6voaUPMz:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 04:51:46 -0000 On Wed, 21 Mar 2018, Gleb Smirnoff wrote: > Log: > Fix sysctl types broken in r329612. This is still broken. > Modified: head/sys/kern/vfs_bio.c > ============================================================================== > --- head/sys/kern/vfs_bio.c Wed Mar 21 23:17:26 2018 (r331327) > +++ head/sys/kern/vfs_bio.c Wed Mar 21 23:21:32 2018 (r331328) > @@ -261,17 +261,17 @@ SYSCTL_PROC(_vfs, OID_AUTO, numdirtybuffers, > "Number of buffers that are dirty (has unwritten changes) at the moment"); > static int lodirtybuffers; > SYSCTL_PROC(_vfs, OID_AUTO, lodirtybuffers, > - CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &lodirtybuffers, > + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &lodirtybuffers, > __offsetof(struct bufdomain, bd_lodirtybuffers), sysctl_bufdomain_int, "L", > "How many buffers we want to have free before bufdaemon can sleep"); Now the format letter "L" is even more inconsistent. The letter at least used to even more important. E.g., old versions of i386 machdep.tsc_freq got most things wrong, but reads appeared to work in most cases since the mismached CTLTYPE_QUAD was ignored by sysctl(8) and the format specifier "IU" was used to print the truncated value correctly. Writes appeared to work in most cases although short writes are documented to fail in all cases: from sysctl(3): [EINVAL] A non-null newp is given and its specified length in newlen is too large or too small. because detection of short writes has been broken for more than 20 years. For machdep.tsc_freq, CTLTYPE_QUAD gave 64-bit writes, but the sysctl_handle_int() in the PROC handler attempted to do a 32-bit and the broken short write detection allowed it to succeed. I think the same brokenness prevents detection of the current bug as a short write error -- CTLTYPE_ULONG gives 64-bit writes on 32-bit arches and sysctl_handle_int() in the PROC handler attempts to do a 32-bit short writes. Lower levels of sysctl know the size from the CTLTYPE but don't check it properly. Most PROC handlers don't check it at all, but hard-code sysctl_handle_int/etc(). This is reasonable since they can hard-code the type in this call just as easily as hard-coding it in the sysctl data (which is another bug, but harder to fix -- the size should be decided at runtime). In practice, there are inconsistencies. I use the following fix for short write detection: XX Index: kern_sysctl.c XX =================================================================== XX RCS file: /home/ncvs/src/sys/kern/kern_sysctl.c,v XX retrieving revision 1.157 XX diff -u -2 -r1.157 kern_sysctl.c XX --- kern_sysctl.c 11 Jun 2004 02:20:37 -0000 1.157 XX +++ kern_sysctl.c 11 Jun 2004 07:58:23 -0000 XX @@ -957,6 +949,13 @@ XX if (!req->newptr) XX return 0; XX - if (req->newlen - req->newidx < l) XX + if (req->newlen - req->newidx != l) { XX + if (req->newlen - req->newidx > l) { XX + printf( XX + "sysctl_new_kernel -- short write: %zu - %zu > %zu\n", XX + req->newlen, req->newidx, l); XX + Debugger("sysctl_new_kernel: short write"); XX + } XX return (EINVAL); XX + } XX bcopy((char *)req->newptr + req->newidx, p, l); XX req->newidx += l; XX @@ -1075,6 +1073,13 @@ XX if (!req->newptr) XX return 0; XX - if (req->newlen - req->newidx < l) XX + if (req->newlen - req->newidx != l) { XX + if (req->newlen - req->newidx > l) { XX + printf( XX + "sysctl_new_user -- short write: %zu - %zu > %zu\n", XX + req->newlen, req->newidx, l); XX + Debugger("sysctl_new_user: short write"); XX + } XX return (EINVAL); XX + } XX error = copyin((char *)req->newptr + req->newidx, p, l); XX req->newidx += l; The debugging code is of course only needed to detect inconsistent sysctl handlers and applications depend on the bug. Not many do. After fixing sysctl handlers, most applications work since they get the size using arcane sysctls like sysctl(8), or by reading the variable and assuming tha it can be written back using the same size. Not many applications probe for the size. They should, so that the sizes of at least scalar vairbales aren't part of an ABI and so can be changed easily. (See old mail for patches that add some probing to the kernel -- the kernel attempts to match the sizes. It truncates the sizes iff the value can be represented in the changed size and in some other cases like counters where truncation was the historical misbehaviour. Unfortunately, this interferes with applications probing the size.) The read size is easy to probe for, and it should be possible to probe for a write size that works, but the bug breaks that and corrupts kernel variables instead. The corruption is largest for the little-endian case. For machdep.tsc_freq, the only serious corruption was for changing a variable near the 4G boundary. E.g., if the variable is initially 0xffffffff, then attempting to change it to 0x100000000 actually changed it to 0, by changing only the low 32 bits. Bruce From owner-svn-src-head@freebsd.org Thu Mar 22 06:03:36 2018 Return-Path: Delivered-To: svn-src-head@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 E4343F6CFB1; Thu, 22 Mar 2018 06:03:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 34CAC81CC7; Thu, 22 Mar 2018 06:03:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id EDC0ED48D99; Thu, 22 Mar 2018 17:03:25 +1100 (AEDT) Date: Thu, 22 Mar 2018 17:03:25 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons In-Reply-To: <20180321202752.GO76926@kib.kiev.ua> Message-ID: <20180322155152.O1053@besplex.bde.org> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> <20180321202752.GO76926@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=SHKZrRbqEoQg_kA9z3AA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 06:03:36 -0000 On Wed, 21 Mar 2018, Konstantin Belousov wrote: > On Thu, Mar 22, 2018 at 04:53:22AM +1100, Bruce Evans wrote: >> Serial console drivers with fast interrupt handlers have much more >> broken locking for ddb special keys. It is invalid to either drop locks >> or call the "any" function from a fast interrupt handler, but buggy >> serial console drivers calls kbd_alt_break(), and that now calls >> shutdown_nice() and other functions that cannot be called from a fast >> interrupt handler. ddb keys supply most of the shutdown_nice() >> functionality for serial consoles, and there are no escape sequence to >> get this without ddb or maybe another debugger, so these bugs don't >> affect most users. >> >> Handling this correctly requires much the same fix as an unsafe signal >> handler, and fixes have much the same problems -- not much more than >> setting a flag is safe, and the flag might never be looked at if the >> system is in a bad state. However, if a nice shutdown is possible then >> the sytem must be in a good enough state to poll for flags. > > Are you saying that fast interrupt handlers call shutdown_nice() ? This > is the quite serious bug on its own. To fix it, shutdown_nice() should > use a fast taskqueue to schedule the task which would lock the process > and send the signal. Yes. See kdb_reboot(). This is called for an escape sequence from kdb_alt_break_internal(). The other calls in kdb_alt_break_internal() don't wander into a function that calls shutdown_nice() and are relatively safe. They have to be not completely safe to work in "any" context. kdb_reboot() is the opposite -- we want it to fail if the context is not nice enough to reboot nicely. BTW, I've often wanted to be able to send more general signals to init using keystrokes, independent of being logged in. Mainly SIGHUP to shut down to single user mode. This has some security problems, especially for the "any" signal to the "any" process. At least syscons defaults to allowing Ctrl-Alt-Del to reboot. I like that and miss it on serial consoles and on some non-FreeBSD OS's (the alt-break sequence to reach kdb_reboot() is not equivalent, since it is only available if much more insecure sequences are also allowed). Shutdown isn't as fundamentally insecure as sending arbitrary signals and most systems allow it without much more than a password for users that have physical access to the system. OTOH, I don't like the syscons key that suspends. This is also allowed by default. I sometimes press it by mistake on a system that can suspend but not resume. Unlike the reboot key, there are no knobs for controlling it. There are 3 static configuration knobs, 2 sysctls and the keymap which must be understood for securing the main reboot key in syscons, and a slightly different set of controls in vt :-(. For suspend, there is only the keymap. Syscons also has a standby key and more shutdown keys, but these are in more obscure parts of keymaps and I've never noticed typing them by mistake. Bruce From owner-svn-src-head@freebsd.org Thu Mar 22 05:07:58 2018 Return-Path: Delivered-To: svn-src-head@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 9B649F690DD; Thu, 22 Mar 2018 05:07:58 +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 49E437F005; Thu, 22 Mar 2018 05:07:58 +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 445F150CE; Thu, 22 Mar 2018 05:07:58 +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 w2M57wNa031309; Thu, 22 Mar 2018 05:07:58 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M57wBa031308; Thu, 22 Mar 2018 05:07:58 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201803220507.w2M57wBa031308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 22 Mar 2018 05:07:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331343 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 331343 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 05:07:58 -0000 Author: glebius Date: Thu Mar 22 05:07:57 2018 New Revision: 331343 URL: https://svnweb.freebsd.org/changeset/base/331343 Log: Fix LINT-NOINET build initializing local to false. This is a dead code, since for NOINET build isipv6 is always true, but this dead code makes it compilable. Reported by: rpokala Modified: head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Thu Mar 22 04:42:29 2018 (r331342) +++ head/sys/netinet/tcp_timewait.c Thu Mar 22 05:07:57 2018 (r331343) @@ -244,12 +244,12 @@ tcp_twstart(struct tcpcb *tp) #ifdef INET6 if (isipv6) local = in6_localaddr(&inp->in6p_faddr); -#endif -#if defined(INET6) && defined(INET) else #endif #ifdef INET local = in_localip(inp->inp_faddr); +#else + local = false; #endif } else local = false; From owner-svn-src-head@freebsd.org Thu Mar 22 06:31:05 2018 Return-Path: Delivered-To: svn-src-head@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 D9704F6E998; Thu, 22 Mar 2018 06:31:05 +0000 (UTC) (envelope-from rpokala@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 802B782F0F; Thu, 22 Mar 2018 06:31:05 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 7B3165F2D; Thu, 22 Mar 2018 06:31:05 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M6V5Sb072840; Thu, 22 Mar 2018 06:31:05 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M6V5GH072839; Thu, 22 Mar 2018 06:31:05 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201803220631.w2M6V5GH072839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Thu, 22 Mar 2018 06:31:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331345 - head/sys/dev/jedec_dimm X-SVN-Group: head X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: head/sys/dev/jedec_dimm X-SVN-Commit-Revision: 331345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 06:31:06 -0000 Author: rpokala Date: Thu Mar 22 06:31:05 2018 New Revision: 331345 URL: https://svnweb.freebsd.org/changeset/base/331345 Log: jedec_dimm: Use correct string length when populating sc->slotid_str Don't limit the copy to the size of the target string *pointer* (always 4 on 32-bit / 8 on 64-bit). Instead, just use strdup(). Reported by: Coverity CID: 1386912 Reviewed by: cem, imp MFC after: 1 week Modified: head/sys/dev/jedec_dimm/jedec_dimm.c Modified: head/sys/dev/jedec_dimm/jedec_dimm.c ============================================================================== --- head/sys/dev/jedec_dimm/jedec_dimm.c Thu Mar 22 05:26:27 2018 (r331344) +++ head/sys/dev/jedec_dimm/jedec_dimm.c Thu Mar 22 06:31:05 2018 (r331345) @@ -341,10 +341,7 @@ jedec_dimm_attach(device_t dev) if (resource_string_value(device_get_name(dev), device_get_unit(dev), "slotid", &slotid_str) == 0) { if (slotid_str != NULL) { - sc->slotid_str = malloc(strlen(slotid_str) + 1, - M_DEVBUF, (M_WAITOK | M_ZERO)); - strlcpy(sc->slotid_str, slotid_str, - sizeof(sc->slotid_str)); + sc->slotid_str = strdup(slotid_str, M_DEVBUF); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "slotid", CTLFLAG_RD | CTLFLAG_MPSAFE, sc->slotid_str, 0, "DIMM Slot Identifier"); From owner-svn-src-head@freebsd.org Thu Mar 22 06:37:53 2018 Return-Path: Delivered-To: svn-src-head@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 39FDB1AB; Thu, 22 Mar 2018 06:37:53 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 97DF9834E1; Thu, 22 Mar 2018 06:37:51 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id ytr5eR12sXziTytr6e6fFh; Thu, 22 Mar 2018 00:37:45 -0600 X-Authority-Analysis: v=2.3 cv=X6B81lbe c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=v2DPQv5-lfwA:10 a=xfDLHkLGAAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=ywg3BWjeHnHILdIq2vMA:9 a=CjuIK1q_8ugA:10 a=IfaqVvZgccqrtc8gcwf2:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id D08F53BB; Wed, 21 Mar 2018 23:37:42 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w2M6bgBW050700; Wed, 21 Mar 2018 23:37:42 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w2M6bgSU050692; Wed, 21 Mar 2018 23:37:42 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201803220637.w2M6bgSU050692@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Kyle Evans cc: Cy Schubert , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331326 - in head/stand: forth i386/loader In-Reply-To: Message from Kyle Evans of "Wed, 21 Mar 2018 23:19:23 -0500." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 21 Mar 2018 23:37:42 -0700 X-CMAE-Envelope: MS4wfMkvO4FIF6SyIM2sy4Slt8KhzwLuwWkM4fQ6reHiJ3rgpVFz1hcSfa5qA+4msuKAhjAwgIDwdK9K3DaO2yB8zwwpskf+pDgnGtN/VvJvWEgCSKIO9dX0 bDkBLCnHn59DAJLLsCGyVXmJfeQ7+X09O6SXqNlZR2ysrP2YHTRe8gVZzdLxt9zlbxrudvegQc6Un+vYxZipBB6qVV5ZCUqqZxtncHRENqIPbtPaw+hdjDUT o15qr/AESs/zImssnErlUiO2Q1BnCwYvDHPkBsuFojrl8Mr3H1KBuL+2QbEPBmTm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 06:37:53 -0000 In message , Kyle Evans writes: > On Wed, Mar 21, 2018 at 10:30 PM, Cy Schubert wro > te: > > In message <201803212201.w2LM1pvl020202@repo.freebsd.org>, Kyle Evans > > writes: > >> Author: kevans > >> Date: Wed Mar 21 22:01:51 2018 > >> New Revision: 331326 > >> URL: https://svnweb.freebsd.org/changeset/base/331326 > >> > >> Log: > >> Forth version of EFI autoresizing > >> > >> r331321 delegated autoresizing to an efi-autoresizecons command that > >> currently is expected to be done in forth/lua prior to drawing anything > >> useful. > >> > >> Add the Forth version of the lua addition in r331321, hook efi.4th up to > be > >> installed. > >> > >> efiboot? was written by dteske@; anything outside of that may be blamed > on > >> me. > >> > >> Modified: > >> head/stand/forth/Makefile > >> head/stand/forth/efi.4th > >> head/stand/forth/loader.rc > >> head/stand/i386/loader/loader.rc > >> > >> Modified: head/stand/forth/Makefile > >> ========================================================================== > === > >> = > >> --- head/stand/forth/Makefile Wed Mar 21 21:15:43 2018 (r331325) > >> +++ head/stand/forth/Makefile Wed Mar 21 22:01:51 2018 (r331326) > >> @@ -18,6 +18,7 @@ FILES+= brand-fbsd.4th > >> FILES+= check-password.4th > >> FILES+= color.4th > >> FILES+= delay.4th > >> +FILES+= efi.4th > >> FILES+= frames.4th > >> FILES+= loader.4th > >> FILES+= logo-beastie.4th > >> > >> Modified: head/stand/forth/efi.4th > >> ========================================================================== > === > >> = > >> --- head/stand/forth/efi.4th Wed Mar 21 21:15:43 2018 (r331325) > >> +++ head/stand/forth/efi.4th Wed Mar 21 22:01:51 2018 (r331326) > >> @@ -26,5 +26,16 @@ > >> > >> only forth definitions > >> > >> -\ Place holder for more functions > >> +: efiboot? ( -- flag ) > >> + s" efi-version" getenv -1 <> dup if > >> + swap drop ( c-addr flag -- flag ) > >> + then > >> +; > >> + > >> +: maybe-efi-resizecons > >> + efiboot? if > >> + efi-autoresizecons > > > > This statement breaks boot on my BIOS machines. It cannot find > > efi-autoresizecons, causing a bare kernel without modules to load or > > kenv variables set. > > > > Ugh, sorry about that. =( I've converted that to a runtime evaluation > in r331341 and (hopefully) properly observed my failure to succeed. No problem. That fixed it. > > On the plus side, today I learned about `boot-conf` to get back to the > Forth-intercepted 'boot' behavior to workaround the breakage. =) Yes. Good point. I'll remember that too. Thanks again. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Thu Mar 22 06:39:20 2018 Return-Path: Delivered-To: svn-src-head@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 22EAA323; Thu, 22 Mar 2018 06:39:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 94B9B8362A; Thu, 22 Mar 2018 06:39:19 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 443E8101576; Thu, 22 Mar 2018 17:39:16 +1100 (AEDT) Date: Thu, 22 Mar 2018 17:39:14 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons In-Reply-To: Message-ID: <20180322170345.J1053@besplex.bde.org> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VJytp5HX c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=ujyv94cRbLZRN1sVS_cA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 06:39:20 -0000 On Wed, 21 Mar 2018, Warner Losh wrote: > On Wed, Mar 21, 2018 at 11:53 AM, Bruce Evans wrote: > >> On Wed, 21 Mar 2018, Warner Losh wrote: >> >> Log: >>> Unlock giant when calling shutdown_nice() >> >> This breaks the driver. Giant is syscons' driver lock, and also the >> interrupt handler lock for at least the atkbd keyboard driver, so vt >> sometimes holds the lock for. > > OK. I got carried away. You're right. The proper fix is to unlock Giant at > the top of kern_reboot() instead. This handles the case where we call > shutdown_nice() with no init running and have to call kern_reboot directly. > Otherwise it's perfectly fine to just call shutdown_nice() with Giant held > since we just signal init from there. So I'll revert this change and make > that other change instead. > ... > Good point. I think the following change is good for everything except > calling shutdown_nice() from a fast interrupt handler with noinit running: > > diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c > index e5ea9644ad3f..564aecd811be 100644 > --- a/sys/kern/kern_shutdown.c > +++ b/sys/kern/kern_shutdown.c > @@ -366,6 +366,12 @@ kern_reboot(int howto) > { > static int once = 0; > > + /* > + * Drop Giant once and for all. > + */ > + while (mtx_owned(&Giant)) > + mtx_unlock(&Giant); > + > #if defined(SMP) > /* > * Bind us to the first CPU so that all shutdown code runs there. > Some > > Comments? Try putting this in vfs_mountroot_parse() and/or the second clause of shutdown_nice() only. The only other calls are from is from sys_reboot() and vpanic(). sys_reboot() is either MPSAFE or not, and it should know when it is safe to drop its Giant lock if at all. vpanic() sets SCHEDULER_STOPPED() to avoid seeing problems with Giant or any other mutex. Bruce From owner-svn-src-head@freebsd.org Thu Mar 22 07:07:59 2018 Return-Path: Delivered-To: svn-src-head@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 DAA5AF46641; Thu, 22 Mar 2018 07:07:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 4D874848C4; Thu, 22 Mar 2018 07:07:58 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 1212B1047AC5; Thu, 22 Mar 2018 17:50:58 +1100 (AEDT) Date: Thu, 22 Mar 2018 17:50:57 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: Konstantin Belousov , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons In-Reply-To: Message-ID: <20180322174025.Q1053@besplex.bde.org> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> <20180321202752.GO76926@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=XDltxdv9FE5UCP5c3OgA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 07:08:00 -0000 On Wed, 21 Mar 2018, Warner Losh wrote: > On Wed, Mar 21, 2018 at 2:27 PM, Konstantin Belousov > wrote: >> ... >> Are you saying that fast interrupt handlers call shutdown_nice() ? This >> is the quite serious bug on its own. To fix it, shutdown_nice() should >> use a fast taskqueue to schedule the task which would lock the process >> and send the signal. > > Is there some way we know we're in a fast interrupt handler? If so, it > should be simple to fix. If not, then there's an API change ahead of us... There is a td_intr_nesting_level flag that might work. (I invented this, but don't like its current use.) > But bde is right: the system has to be in good enough shape to cope. I > wonder if we should put that coping into kdb_reboot() instead. It's only an > issue for TILDE ^R, which is a fairly edge case. shutdown_nice() is also called directly from syscons and vt for the reboot, halt and poweroff keys. This happens in normal interrupt handler context, so there is only a problem when init is not running. Bruce From owner-svn-src-head@freebsd.org Thu Mar 22 08:32:39 2018 Return-Path: Delivered-To: svn-src-head@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 CE08BF4FEE2; Thu, 22 Mar 2018 08:32:39 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 8475D87870; Thu, 22 Mar 2018 08:32:39 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F50771E5; Thu, 22 Mar 2018 08:32:39 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M8WdJV036143; Thu, 22 Mar 2018 08:32:39 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M8WddP036142; Thu, 22 Mar 2018 08:32:39 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201803220832.w2M8WddP036142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 22 Mar 2018 08:32:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331346 - head/sys/modules/blake2 X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/modules/blake2 X-SVN-Commit-Revision: 331346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 08:32:40 -0000 Author: lwhsu (ports committer) Date: Thu Mar 22 08:32:39 2018 New Revision: 331346 URL: https://svnweb.freebsd.org/changeset/base/331346 Log: Fix build. Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D14793 Modified: head/sys/modules/blake2/Makefile Modified: head/sys/modules/blake2/Makefile ============================================================================== --- head/sys/modules/blake2/Makefile Thu Mar 22 06:31:05 2018 (r331345) +++ head/sys/modules/blake2/Makefile Thu Mar 22 08:32:39 2018 (r331346) @@ -80,7 +80,7 @@ SRCS += string.h SRCS += blake2_cryptodev.c -SRCS += opt_param.h cryptodev_if.h +SRCS += opt_param.h cryptodev_if.h bus_if.h device_if.h WARNS ?= 6 From owner-svn-src-head@freebsd.org Thu Mar 22 09:40:10 2018 Return-Path: Delivered-To: svn-src-head@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 D21B4F54CC3; Thu, 22 Mar 2018 09:40:09 +0000 (UTC) (envelope-from jtl@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 873556A8AD; Thu, 22 Mar 2018 09:40:09 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 7DC417B0F; Thu, 22 Mar 2018 09:40:09 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M9e9Mv067729; Thu, 22 Mar 2018 09:40:09 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M9e8T4067719; Thu, 22 Mar 2018 09:40:08 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201803220940.w2M9e8T4067719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Thu, 22 Mar 2018 09:40:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat X-SVN-Commit-Revision: 331347 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 09:40:10 -0000 Author: jtl Date: Thu Mar 22 09:40:08 2018 New Revision: 331347 URL: https://svnweb.freebsd.org/changeset/base/331347 Log: Add the "TCP Blackbox Recorder" which we discussed at the developer summits at BSDCan and BSDCam in 2017. The TCP Blackbox Recorder allows you to capture events on a TCP connection in a ring buffer. It stores metadata with the event. It optionally stores the TCP header associated with an event (if the event is associated with a packet) and also optionally stores information on the sockets. It supports setting a log ID on a TCP connection and using this to correlate multiple connections that share a common log ID. You can log connections in different modes. If you are doing a coordinated test with a particular connection, you may tell the system to put it in mode 4 (continuous dump). Or, if you just want to monitor for errors, you can put it in mode 1 (ring buffer) and dump all the ring buffers associated with the connection ID when we receive an error signal for that connection ID. You can set a default mode that will be applied to a particular ratio of incoming connections. You can also manually set a mode using a socket option. This commit includes only basic probes. rrs@ has added quite an abundance of probes in his TCP development work. He plans to commit those soon. There are user-space programs which we plan to commit as ports. These read the data from the log device and output pcapng files, and then let you analyze the data (and metadata) in the pcapng files. Reviewed by: gnn (previous version) Obtained from: Netflix, Inc. Relnotes: yes Differential Revision: https://reviews.freebsd.org/D11085 Added: head/sys/dev/tcp_log/ head/sys/dev/tcp_log/tcp_log_dev.c (contents, props changed) head/sys/dev/tcp_log/tcp_log_dev.h (contents, props changed) head/sys/netinet/tcp_log_buf.c (contents, props changed) head/sys/netinet/tcp_log_buf.h (contents, props changed) Modified: head/etc/mtree/BSD.include.dist head/include/Makefile head/sys/conf/files head/sys/kern/subr_witness.c head/sys/netinet/tcp.h head/sys/netinet/tcp_input.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h head/usr.bin/netstat/inet.c head/usr.bin/netstat/main.c head/usr.bin/netstat/netstat.1 head/usr.bin/netstat/netstat.h Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Thu Mar 22 08:32:39 2018 (r331346) +++ head/etc/mtree/BSD.include.dist Thu Mar 22 09:40:08 2018 (r331347) @@ -158,6 +158,8 @@ .. speaker .. + tcp_log + .. usb .. vkbd Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Thu Mar 22 08:32:39 2018 (r331346) +++ head/include/Makefile Thu Mar 22 09:40:08 2018 (r331347) @@ -47,7 +47,7 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ dev/hwpmc dev/hyperv \ dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ - dev/speaker dev/vkbd dev/wi \ + dev/speaker dev/tcp_log dev/vkbd dev/wi \ fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ fs/procfs fs/smbfs fs/udf fs/unionfs \ geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Mar 22 08:32:39 2018 (r331346) +++ head/sys/conf/files Thu Mar 22 09:40:08 2018 (r331347) @@ -3161,6 +3161,7 @@ dev/syscons/star/star_saver.c optional star_saver dev/syscons/syscons.c optional sc dev/syscons/sysmouse.c optional sc dev/syscons/warp/warp_saver.c optional warp_saver +dev/tcp_log/tcp_log_dev.c optional inet | inet6 dev/tdfx/tdfx_linux.c optional tdfx_linux tdfx compat_linux dev/tdfx/tdfx_pci.c optional tdfx pci dev/ti/if_ti.c optional ti pci @@ -4309,6 +4310,7 @@ netinet/tcp_debug.c optional tcpdebug netinet/tcp_fastopen.c optional inet tcp_rfc7413 | inet6 tcp_rfc7413 netinet/tcp_hostcache.c optional inet | inet6 netinet/tcp_input.c optional inet | inet6 +netinet/tcp_log_buf.c optional inet | inet6 netinet/tcp_lro.c optional inet | inet6 netinet/tcp_output.c optional inet | inet6 netinet/tcp_offload.c optional tcp_offload inet | tcp_offload inet6 Added: head/sys/dev/tcp_log/tcp_log_dev.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/tcp_log/tcp_log_dev.c Thu Mar 22 09:40:08 2018 (r331347) @@ -0,0 +1,521 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2016-2017 + * Netflix Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifdef TCPLOG_DEBUG_COUNTERS +extern counter_u64_t tcp_log_que_read; +extern counter_u64_t tcp_log_que_freed; +#endif + +static struct cdev *tcp_log_dev; +static struct selinfo tcp_log_sel; + +static struct log_queueh tcp_log_dev_queue_head = STAILQ_HEAD_INITIALIZER(tcp_log_dev_queue_head); +static struct log_infoh tcp_log_dev_reader_head = STAILQ_HEAD_INITIALIZER(tcp_log_dev_reader_head); + +MALLOC_DEFINE(M_TCPLOGDEV, "tcp_log_dev", "TCP log device data structures"); + +static int tcp_log_dev_listeners = 0; + +static struct mtx tcp_log_dev_queue_lock; + +#define TCP_LOG_DEV_QUEUE_LOCK() mtx_lock(&tcp_log_dev_queue_lock) +#define TCP_LOG_DEV_QUEUE_UNLOCK() mtx_unlock(&tcp_log_dev_queue_lock) +#define TCP_LOG_DEV_QUEUE_LOCK_ASSERT() mtx_assert(&tcp_log_dev_queue_lock, MA_OWNED) +#define TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT() mtx_assert(&tcp_log_dev_queue_lock, MA_NOTOWNED) +#define TCP_LOG_DEV_QUEUE_REF(tldq) refcount_acquire(&((tldq)->tldq_refcnt)) +#define TCP_LOG_DEV_QUEUE_UNREF(tldq) refcount_release(&((tldq)->tldq_refcnt)) + +static void tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry); +static void tcp_log_dev_clear_cdevpriv(void *data); +static int tcp_log_dev_open(struct cdev *dev __unused, int flags, + int devtype __unused, struct thread *td __unused); +static int tcp_log_dev_write(struct cdev *dev __unused, + struct uio *uio __unused, int flags __unused); +static int tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, + int flags __unused); +static int tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, + caddr_t data, int fflag __unused, struct thread *td __unused); +static int tcp_log_dev_poll(struct cdev *dev __unused, int events, + struct thread *td); + + +enum tcp_log_dev_queue_lock_state { + QUEUE_UNLOCKED = 0, + QUEUE_LOCKED, +}; + +static struct cdevsw tcp_log_cdevsw = { + .d_version = D_VERSION, + .d_read = tcp_log_dev_read, + .d_open = tcp_log_dev_open, + .d_write = tcp_log_dev_write, + .d_poll = tcp_log_dev_poll, + .d_ioctl = tcp_log_dev_ioctl, +#ifdef NOTYET + .d_mmap = tcp_log_dev_mmap, +#endif + .d_name = "tcp_log", +}; + +static __inline void +tcp_log_dev_queue_validate_lock(int lockstate) +{ + +#ifdef INVARIANTS + switch (lockstate) { + case QUEUE_LOCKED: + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); + break; + case QUEUE_UNLOCKED: + TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT(); + break; + default: + kassert_panic("%s:%d: unknown queue lock state", __func__, + __LINE__); + } +#endif +} + +/* + * Clear the refcount. If appropriate, it will remove the entry from the + * queue and call the destructor. + * + * This must be called with the queue lock held. + */ +static void +tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry) +{ + + KASSERT(entry != NULL, ("%s: called with NULL entry", __func__)); + + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); + + if (TCP_LOG_DEV_QUEUE_UNREF(entry)) { +#ifdef TCPLOG_DEBUG_COUNTERS + counter_u64_add(tcp_log_que_freed, 1); +#endif + /* Remove the entry from the queue and call the destructor. */ + STAILQ_REMOVE(&tcp_log_dev_queue_head, entry, tcp_log_dev_queue, + tldq_queue); + (*entry->tldq_dtor)(entry); + } +} + +static void +tcp_log_dev_clear_cdevpriv(void *data) +{ + struct tcp_log_dev_info *priv; + struct tcp_log_dev_queue *entry, *entry_tmp; + + priv = (struct tcp_log_dev_info *)data; + if (priv == NULL) + return; + + /* + * Lock the queue and drop our references. We hold references to all + * the entries starting with tldi_head (or, if tldi_head == NULL, all + * entries in the queue). + * + * Because we don't want anyone adding addition things to the queue + * while we are doing this, we lock the queue. + */ + TCP_LOG_DEV_QUEUE_LOCK(); + if (priv->tldi_head != NULL) { + entry = priv->tldi_head; + STAILQ_FOREACH_FROM_SAFE(entry, &tcp_log_dev_queue_head, + tldq_queue, entry_tmp) { + tcp_log_dev_clear_refcount(entry); + } + } + tcp_log_dev_listeners--; + KASSERT(tcp_log_dev_listeners >= 0, + ("%s: tcp_log_dev_listeners is unexpectedly negative", __func__)); + STAILQ_REMOVE(&tcp_log_dev_reader_head, priv, tcp_log_dev_info, + tldi_list); + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); + TCP_LOG_DEV_QUEUE_UNLOCK(); + free(priv, M_TCPLOGDEV); +} + +static int +tcp_log_dev_open(struct cdev *dev __unused, int flags, int devtype __unused, + struct thread *td __unused) +{ + struct tcp_log_dev_info *priv; + struct tcp_log_dev_queue *entry; + int rv; + + /* + * Ideally, we shouldn't see these because of file system + * permissions. + */ + if (flags & (FWRITE | FEXEC | FAPPEND | O_TRUNC)) + return (ENODEV); + + /* Allocate space to hold information about where we are. */ + priv = malloc(sizeof(struct tcp_log_dev_info), M_TCPLOGDEV, + M_ZERO | M_WAITOK); + + /* Stash the private data away. */ + rv = devfs_set_cdevpriv((void *)priv, tcp_log_dev_clear_cdevpriv); + if (!rv) { + /* + * Increase the listener count, add this reader to the list, and + * take references on all current queues. + */ + TCP_LOG_DEV_QUEUE_LOCK(); + tcp_log_dev_listeners++; + STAILQ_INSERT_HEAD(&tcp_log_dev_reader_head, priv, tldi_list); + priv->tldi_head = STAILQ_FIRST(&tcp_log_dev_queue_head); + if (priv->tldi_head != NULL) + priv->tldi_cur = priv->tldi_head->tldq_buf; + STAILQ_FOREACH(entry, &tcp_log_dev_queue_head, tldq_queue) + TCP_LOG_DEV_QUEUE_REF(entry); + TCP_LOG_DEV_QUEUE_UNLOCK(); + } else { + /* Free the entry. */ + free(priv, M_TCPLOGDEV); + } + return (rv); +} + +static int +tcp_log_dev_write(struct cdev *dev __unused, struct uio *uio __unused, + int flags __unused) +{ + + return (ENODEV); +} + +static __inline void +tcp_log_dev_rotate_bufs(struct tcp_log_dev_info *priv, int *lockstate) +{ + struct tcp_log_dev_queue *entry; + + KASSERT(priv->tldi_head != NULL, + ("%s:%d: priv->tldi_head unexpectedly NULL", + __func__, __LINE__)); + KASSERT(priv->tldi_head->tldq_buf == priv->tldi_cur, + ("%s:%d: buffer mismatch (%p vs %p)", + __func__, __LINE__, priv->tldi_head->tldq_buf, + priv->tldi_cur)); + tcp_log_dev_queue_validate_lock(*lockstate); + + if (*lockstate == QUEUE_UNLOCKED) { + TCP_LOG_DEV_QUEUE_LOCK(); + *lockstate = QUEUE_LOCKED; + } + entry = priv->tldi_head; + priv->tldi_head = STAILQ_NEXT(entry, tldq_queue); + tcp_log_dev_clear_refcount(entry); + priv->tldi_cur = NULL; +} + +static int +tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, int flags) +{ + struct tcp_log_common_header *buf; + struct tcp_log_dev_info *priv; + struct tcp_log_dev_queue *entry; + ssize_t len; + int lockstate, rv; + + /* Get our private info. */ + rv = devfs_get_cdevpriv((void **)&priv); + if (rv) + return (rv); + + lockstate = QUEUE_UNLOCKED; + + /* Do we need to get a new buffer? */ + while (priv->tldi_cur == NULL || + priv->tldi_cur->tlch_length <= priv->tldi_off) { + /* Did we somehow forget to rotate? */ + KASSERT(priv->tldi_cur == NULL, + ("%s:%d: tldi_cur is unexpectedly non-NULL", __func__, + __LINE__)); + if (priv->tldi_cur != NULL) + tcp_log_dev_rotate_bufs(priv, &lockstate); + + /* + * Before we start looking at tldi_head, we need a lock on the + * queue to make sure tldi_head stays stable. + */ + if (lockstate == QUEUE_UNLOCKED) { + TCP_LOG_DEV_QUEUE_LOCK(); + lockstate = QUEUE_LOCKED; + } + + /* We need the next buffer. Do we have one? */ + if (priv->tldi_head == NULL && (flags & FNONBLOCK)) { + rv = EAGAIN; + goto done; + } + if (priv->tldi_head == NULL) { + /* Sleep and wait for more things we can read. */ + rv = mtx_sleep(&tcp_log_dev_listeners, + &tcp_log_dev_queue_lock, PCATCH, "tcplogdev", 0); + if (rv) + goto done; + if (priv->tldi_head == NULL) + continue; + } + + /* + * We have an entry to read. We want to try to create a + * buffer, if one doesn't already exist. + */ + entry = priv->tldi_head; + if (entry->tldq_buf == NULL) { + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); + buf = (*entry->tldq_xform)(entry); + if (buf == NULL) { + rv = EBUSY; + goto done; + } + entry->tldq_buf = buf; + } + + priv->tldi_cur = entry->tldq_buf; + priv->tldi_off = 0; + } + + /* Copy what we can from this buffer to the output buffer. */ + if (uio->uio_resid > 0) { + /* Drop locks so we can take page faults. */ + if (lockstate == QUEUE_LOCKED) + TCP_LOG_DEV_QUEUE_UNLOCK(); + lockstate = QUEUE_UNLOCKED; + + KASSERT(priv->tldi_cur != NULL, + ("%s: priv->tldi_cur is unexpectedly NULL", __func__)); + + /* Copy as much as we can to this uio. */ + len = priv->tldi_cur->tlch_length - priv->tldi_off; + if (len > uio->uio_resid) + len = uio->uio_resid; + rv = uiomove(((uint8_t *)priv->tldi_cur) + priv->tldi_off, + len, uio); + if (rv != 0) + goto done; + priv->tldi_off += len; +#ifdef TCPLOG_DEBUG_COUNTERS + counter_u64_add(tcp_log_que_read, len); +#endif + } + /* Are we done with this buffer? If so, find the next one. */ + if (priv->tldi_off >= priv->tldi_cur->tlch_length) { + KASSERT(priv->tldi_off == priv->tldi_cur->tlch_length, + ("%s: offset (%ju) exceeds length (%ju)", __func__, + (uintmax_t)priv->tldi_off, + (uintmax_t)priv->tldi_cur->tlch_length)); + tcp_log_dev_rotate_bufs(priv, &lockstate); + } +done: + tcp_log_dev_queue_validate_lock(lockstate); + if (lockstate == QUEUE_LOCKED) + TCP_LOG_DEV_QUEUE_UNLOCK(); + return (rv); +} + +static int +tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data, + int fflag __unused, struct thread *td __unused) +{ + struct tcp_log_dev_info *priv; + int rv; + + /* Get our private info. */ + rv = devfs_get_cdevpriv((void **)&priv); + if (rv) + return (rv); + + /* + * Set things. Here, we are most concerned about the non-blocking I/O + * flag. + */ + rv = 0; + switch (cmd) { + case FIONBIO: + break; + case FIOASYNC: + if (*(int *)data != 0) + rv = EINVAL; + break; + default: + rv = ENOIOCTL; + } + return (rv); +} + +static int +tcp_log_dev_poll(struct cdev *dev __unused, int events, struct thread *td) +{ + struct tcp_log_dev_info *priv; + int revents; + + /* + * Get our private info. If this fails, claim that all events are + * ready. That should prod the user to do something that will + * make the error evident to them. + */ + if (devfs_get_cdevpriv((void **)&priv)) + return (events); + + revents = 0; + if (events & (POLLIN | POLLRDNORM)) { + /* + * We can (probably) read right now if we are partway through + * a buffer or if we are just about to start a buffer. + * Because we are going to read tldi_head, we should acquire + * a read lock on the queue. + */ + TCP_LOG_DEV_QUEUE_LOCK(); + if ((priv->tldi_head != NULL && priv->tldi_cur == NULL) || + (priv->tldi_cur != NULL && + priv->tldi_off < priv->tldi_cur->tlch_length)) + revents = events & (POLLIN | POLLRDNORM); + else + selrecord(td, &tcp_log_sel); + TCP_LOG_DEV_QUEUE_UNLOCK(); + } else { + /* + * It only makes sense to poll for reading. So, again, prod the + * user to do something that will make the error of their ways + * apparent. + */ + revents = events; + } + return (revents); +} + +int +tcp_log_dev_add_log(struct tcp_log_dev_queue *entry) +{ + struct tcp_log_dev_info *priv; + int rv; + bool wakeup_needed; + + KASSERT(entry->tldq_buf != NULL || entry->tldq_xform != NULL, + ("%s: Called with both tldq_buf and tldq_xform set to NULL", + __func__)); + KASSERT(entry->tldq_dtor != NULL, + ("%s: Called with tldq_dtor set to NULL", __func__)); + + /* Get a lock on the queue. */ + TCP_LOG_DEV_QUEUE_LOCK(); + + /* If no one is listening, tell the caller to free the resources. */ + if (tcp_log_dev_listeners == 0) { + rv = ENXIO; + goto done; + } + + /* Add this to the end of the tailq. */ + STAILQ_INSERT_TAIL(&tcp_log_dev_queue_head, entry, tldq_queue); + + /* Add references for all current listeners. */ + refcount_init(&entry->tldq_refcnt, tcp_log_dev_listeners); + + /* + * If any listener is currently stuck on NULL, that means they are + * waiting. Point their head to this new entry. + */ + wakeup_needed = false; + STAILQ_FOREACH(priv, &tcp_log_dev_reader_head, tldi_list) + if (priv->tldi_head == NULL) { + priv->tldi_head = entry; + wakeup_needed = true; + } + + if (wakeup_needed) { + selwakeup(&tcp_log_sel); + wakeup(&tcp_log_dev_listeners); + } + + rv = 0; + +done: + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); + TCP_LOG_DEV_QUEUE_UNLOCK(); + return (rv); +} + +static int +tcp_log_dev_modevent(module_t mod __unused, int type, void *data __unused) +{ + + /* TODO: Support intelligent unloading. */ + switch (type) { + case MOD_LOAD: + if (bootverbose) + printf("tcp_log: tcp_log device\n"); + memset(&tcp_log_sel, 0, sizeof(tcp_log_sel)); + memset(&tcp_log_dev_queue_lock, 0, sizeof(struct mtx)); + mtx_init(&tcp_log_dev_queue_lock, "tcp_log dev", + "tcp_log device queues", MTX_DEF); + tcp_log_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, + &tcp_log_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0400, + "tcp_log"); + break; + default: + return (EOPNOTSUPP); + } + + return (0); +} + +DEV_MODULE(tcp_log_dev, tcp_log_dev_modevent, NULL); +MODULE_VERSION(tcp_log_dev, 1); Added: head/sys/dev/tcp_log/tcp_log_dev.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/tcp_log/tcp_log_dev.h Thu Mar 22 09:40:08 2018 (r331347) @@ -0,0 +1,88 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2016 + * Netflix Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __tcp_log_dev_h__ +#define __tcp_log_dev_h__ + +/* + * This is the common header for data streamed from the log device. All + * blocks of data need to start with this header. + */ +struct tcp_log_common_header { + uint32_t tlch_version; /* Version is specific to type. */ + uint32_t tlch_type; /* Type of entry(ies) that follow. */ + uint64_t tlch_length; /* Total length, including header. */ +} __packed; + +#define TCP_LOG_DEV_TYPE_BBR 1 /* black box recorder */ + +#ifdef _KERNEL +/* + * This is a queue entry. All queue entries need to start with this structure + * so the common code can cast them to this structure; however, other modules + * are free to include additional data after this structure. + * + * The elements are explained here: + * tldq_queue: used by the common code to maintain this entry's position in the + * queue. + * tldq_buf: should be NULL, or a pointer to a chunk of data. The data must be + * as long as the common header indicates. + * tldq_xform: If tldq_buf is NULL, the code will call this to create the + * the tldq_buf object. The function should *not* directly modify tldq_buf, + * but should return the buffer (which must meet the restrictions + * indicated for tldq_buf). + * tldq_dtor: This function is called to free the queue entry. If tldq_buf is + * not NULL, the dtor function must free that, too. + * tldq_refcnt: used by the common code to indicate how many readers still need + * this data. + */ +struct tcp_log_dev_queue { + STAILQ_ENTRY(tcp_log_dev_queue) tldq_queue; + struct tcp_log_common_header *tldq_buf; + struct tcp_log_common_header *(*tldq_xform)(struct tcp_log_dev_queue *entry); + void (*tldq_dtor)(struct tcp_log_dev_queue *entry); + volatile u_int tldq_refcnt; +}; + +STAILQ_HEAD(log_queueh, tcp_log_dev_queue); + +struct tcp_log_dev_info { + STAILQ_ENTRY(tcp_log_dev_info) tldi_list; + struct tcp_log_dev_queue *tldi_head; + struct tcp_log_common_header *tldi_cur; + off_t tldi_off; +}; +STAILQ_HEAD(log_infoh, tcp_log_dev_info); + + +MALLOC_DECLARE(M_TCPLOGDEV); +int tcp_log_dev_add_log(struct tcp_log_dev_queue *entry); +#endif /* _KERNEL */ +#endif /* !__tcp_log_dev_h__ */ Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Thu Mar 22 08:32:39 2018 (r331346) +++ head/sys/kern/subr_witness.c Thu Mar 22 09:40:08 2018 (r331347) @@ -640,6 +640,14 @@ static struct witness_order_list_entry order_lists[] = { "db->db_mtx", &lock_class_sx }, { NULL, NULL }, /* + * TCP log locks + */ + { "TCP ID tree", &lock_class_rw }, + { "tcp log id bucket", &lock_class_mtx_sleep }, + { "tcpinp", &lock_class_rw }, + { "TCP log expireq", &lock_class_mtx_sleep }, + { NULL, NULL }, + /* * spin locks */ #ifdef SMP Modified: head/sys/netinet/tcp.h ============================================================================== --- head/sys/netinet/tcp.h Thu Mar 22 08:32:39 2018 (r331346) +++ head/sys/netinet/tcp.h Thu Mar 22 09:40:08 2018 (r331347) @@ -168,6 +168,12 @@ struct tcphdr { #define TCP_NOOPT 8 /* don't use TCP options */ #define TCP_MD5SIG 16 /* use MD5 digests (RFC2385) */ #define TCP_INFO 32 /* retrieve tcp_info structure */ +#define TCP_LOG 34 /* configure event logging for connection */ +#define TCP_LOGBUF 35 /* retrieve event log for connection */ +#define TCP_LOGID 36 /* configure log ID to correlate connections */ +#define TCP_LOGDUMP 37 /* dump connection log events to device */ +#define TCP_LOGDUMPID 38 /* dump events from connections with same ID to + device */ #define TCP_CONGESTION 64 /* get/set congestion control algorithm */ #define TCP_CCALGOOPT 65 /* get/set cc algorithm specific options */ #define TCP_KEEPINIT 128 /* N, time to establish connection */ @@ -188,6 +194,9 @@ struct tcphdr { #define TCPI_OPT_WSCALE 0x04 #define TCPI_OPT_ECN 0x08 #define TCPI_OPT_TOE 0x10 + +/* Maximum length of log ID. */ +#define TCP_LOG_ID_LEN 64 /* * The TCP_INFO socket option comes from the Linux 2.6 TCP API, and permits Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Thu Mar 22 08:32:39 2018 (r331346) +++ head/sys/netinet/tcp_input.c Thu Mar 22 09:40:08 2018 (r331347) @@ -102,6 +102,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1592,6 +1593,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru /* Save segment, if requested. */ tcp_pcap_add(th, m, &(tp->t_inpkts)); #endif + TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0, + tlen, NULL, true); if ((thflags & TH_SYN) && (thflags & TH_FIN) && V_drop_synfin) { if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { Added: head/sys/netinet/tcp_log_buf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netinet/tcp_log_buf.c Thu Mar 22 09:40:08 2018 (r331347) @@ -0,0 +1,2480 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2016-2018 + * Netflix Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +/* Default expiry time */ +#define TCP_LOG_EXPIRE_TIME ((sbintime_t)60 * SBT_1S) + +/* Max interval at which to run the expiry timer */ +#define TCP_LOG_EXPIRE_INTVL ((sbintime_t)5 * SBT_1S) + +bool tcp_log_verbose; +static uma_zone_t tcp_log_bucket_zone, tcp_log_node_zone, tcp_log_zone; +static int tcp_log_session_limit = TCP_LOG_BUF_DEFAULT_SESSION_LIMIT; +static uint32_t tcp_log_version = TCP_LOG_BUF_VER; +RB_HEAD(tcp_log_id_tree, tcp_log_id_bucket); +static struct tcp_log_id_tree tcp_log_id_head; +static STAILQ_HEAD(, tcp_log_id_node) tcp_log_expireq_head = + STAILQ_HEAD_INITIALIZER(tcp_log_expireq_head); +static struct mtx tcp_log_expireq_mtx; +static struct callout tcp_log_expireq_callout; +static uint64_t tcp_log_auto_ratio = 0; +static uint64_t tcp_log_auto_ratio_cur = 0; +static uint32_t tcp_log_auto_mode = TCP_LOG_STATE_TAIL; +static bool tcp_log_auto_all = false; + +RB_PROTOTYPE_STATIC(tcp_log_id_tree, tcp_log_id_bucket, tlb_rb, tcp_log_id_cmp) + +SYSCTL_NODE(_net_inet_tcp, OID_AUTO, bb, CTLFLAG_RW, 0, "TCP Black Box controls"); + +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_verbose, CTLFLAG_RW, &tcp_log_verbose, + 0, "Force verbose logging for TCP traces"); + +SYSCTL_INT(_net_inet_tcp_bb, OID_AUTO, log_session_limit, + CTLFLAG_RW, &tcp_log_session_limit, 0, + "Maximum number of events maintained for each TCP session"); + +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_global_limit, CTLFLAG_RW, + &tcp_log_zone, "Maximum number of events maintained for all TCP sessions"); + +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_global_entries, CTLFLAG_RD, + &tcp_log_zone, "Current number of events maintained for all TCP sessions"); + +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_limit, CTLFLAG_RW, + &tcp_log_bucket_zone, "Maximum number of log IDs"); + +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_entries, CTLFLAG_RD, + &tcp_log_bucket_zone, "Current number of log IDs"); + +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_limit, CTLFLAG_RW, + &tcp_log_node_zone, "Maximum number of tcpcbs with log IDs"); + +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_entries, CTLFLAG_RD, + &tcp_log_node_zone, "Current number of tcpcbs with log IDs"); + +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_version, CTLFLAG_RD, &tcp_log_version, + 0, "Version of log formats exported"); + +SYSCTL_U64(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW, + &tcp_log_auto_ratio, 0, "Do auto capturing for 1 out of N sessions"); + +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_auto_mode, CTLFLAG_RW, + &tcp_log_auto_mode, TCP_LOG_STATE_HEAD_AUTO, + "Logging mode for auto-selected sessions (default is TCP_LOG_STATE_HEAD_AUTO)"); + +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_auto_all, CTLFLAG_RW, + &tcp_log_auto_all, false, + "Auto-select from all sessions (rather than just those with IDs)"); + +#ifdef TCPLOG_DEBUG_COUNTERS +counter_u64_t tcp_log_queued; +counter_u64_t tcp_log_que_fail1; +counter_u64_t tcp_log_que_fail2; +counter_u64_t tcp_log_que_fail3; +counter_u64_t tcp_log_que_fail4; +counter_u64_t tcp_log_que_fail5; +counter_u64_t tcp_log_que_copyout; +counter_u64_t tcp_log_que_read; +counter_u64_t tcp_log_que_freed; + +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, queued, CTLFLAG_RD, + &tcp_log_queued, "Number of entries queued"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail1, CTLFLAG_RD, + &tcp_log_que_fail1, "Number of entries queued but fail 1"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail2, CTLFLAG_RD, + &tcp_log_que_fail2, "Number of entries queued but fail 2"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail3, CTLFLAG_RD, + &tcp_log_que_fail3, "Number of entries queued but fail 3"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail4, CTLFLAG_RD, + &tcp_log_que_fail4, "Number of entries queued but fail 4"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail5, CTLFLAG_RD, + &tcp_log_que_fail5, "Number of entries queued but fail 4"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, copyout, CTLFLAG_RD, + &tcp_log_que_copyout, "Number of entries copied out"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, read, CTLFLAG_RD, + &tcp_log_que_read, "Number of entries read from the queue"); +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, freed, CTLFLAG_RD, + &tcp_log_que_freed, "Number of entries freed after reading"); +#endif + +#ifdef INVARIANTS +#define TCPLOG_DEBUG_RINGBUF +#endif + +struct tcp_log_mem +{ + STAILQ_ENTRY(tcp_log_mem) tlm_queue; + struct tcp_log_buffer tlm_buf; + struct tcp_log_verbose tlm_v; +#ifdef TCPLOG_DEBUG_RINGBUF + volatile int tlm_refcnt; +#endif +}; + +/* 60 bytes for the header, + 16 bytes for padding */ +static uint8_t zerobuf[76]; + +/* + * Lock order: + * 1. TCPID_TREE + * 2. TCPID_BUCKET + * 3. INP + * + * Rules: + * A. You need a lock on the Tree to add/remove buckets. + * B. You need a lock on the bucket to add/remove nodes from the bucket. + * C. To change information in a node, you need the INP lock if the tln_closed + * field is false. Otherwise, you need the bucket lock. (Note that the + * tln_closed field can change at any point, so you need to recheck the + * entry after acquiring the INP lock.) + * D. To remove a node from the bucket, you must have that entry locked, + * according to the criteria of Rule C. Also, the node must not be on + * the expiry queue. + * E. The exception to C is the expiry queue fields, which are locked by + * the TCPLOG_EXPIREQ lock. + * + * Buckets have a reference count. Each node is a reference. Further, + * other callers may add reference counts to keep a bucket from disappearing. + * You can add a reference as long as you own a lock sufficient to keep the + * bucket from disappearing. For example, a common use is: + * a. Have a locked INP, but need to lock the TCPID_BUCKET. + * b. Add a refcount on the bucket. (Safe because the INP lock prevents + * the TCPID_BUCKET from going away.) + * c. Drop the INP lock. + * d. Acquire a lock on the TCPID_BUCKET. + * e. Acquire a lock on the INP. + * f. Drop the refcount on the bucket. + * (At this point, the bucket may disappear.) + * + * Expire queue lock: + * You can acquire this with either the bucket or INP lock. Don't reverse it. + * When the expire code has committed to freeing a node, it resets the expiry + * time to SBT_MAX. That is the signal to everyone else that they should + * leave that node alone. + */ +static struct rwlock tcp_id_tree_lock; +#define TCPID_TREE_WLOCK() rw_wlock(&tcp_id_tree_lock) +#define TCPID_TREE_RLOCK() rw_rlock(&tcp_id_tree_lock) +#define TCPID_TREE_UPGRADE() rw_try_upgrade(&tcp_id_tree_lock) +#define TCPID_TREE_WUNLOCK() rw_wunlock(&tcp_id_tree_lock) +#define TCPID_TREE_RUNLOCK() rw_runlock(&tcp_id_tree_lock) +#define TCPID_TREE_WLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_WLOCKED) +#define TCPID_TREE_RLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_RLOCKED) +#define TCPID_TREE_UNLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_UNLOCKED) + +#define TCPID_BUCKET_LOCK_INIT(tlb) mtx_init(&((tlb)->tlb_mtx), "tcp log id bucket", NULL, MTX_DEF) +#define TCPID_BUCKET_LOCK_DESTROY(tlb) mtx_destroy(&((tlb)->tlb_mtx)) +#define TCPID_BUCKET_LOCK(tlb) mtx_lock(&((tlb)->tlb_mtx)) +#define TCPID_BUCKET_UNLOCK(tlb) mtx_unlock(&((tlb)->tlb_mtx)) +#define TCPID_BUCKET_LOCK_ASSERT(tlb) mtx_assert(&((tlb)->tlb_mtx), MA_OWNED) +#define TCPID_BUCKET_UNLOCK_ASSERT(tlb) mtx_assert(&((tlb)->tlb_mtx), MA_NOTOWNED) + +#define TCPID_BUCKET_REF(tlb) refcount_acquire(&((tlb)->tlb_refcnt)) +#define TCPID_BUCKET_UNREF(tlb) refcount_release(&((tlb)->tlb_refcnt)) + +#define TCPLOG_EXPIREQ_LOCK() mtx_lock(&tcp_log_expireq_mtx) +#define TCPLOG_EXPIREQ_UNLOCK() mtx_unlock(&tcp_log_expireq_mtx) + +SLIST_HEAD(tcp_log_id_head, tcp_log_id_node); + +struct tcp_log_id_bucket +{ + /* + * tlb_id must be first. This lets us use strcmp on + * (struct tcp_log_id_bucket *) and (char *) interchangeably. + */ + char tlb_id[TCP_LOG_ID_LEN]; + RB_ENTRY(tcp_log_id_bucket) tlb_rb; + struct tcp_log_id_head tlb_head; + struct mtx tlb_mtx; + volatile u_int tlb_refcnt; +}; + +struct tcp_log_id_node +{ + SLIST_ENTRY(tcp_log_id_node) tln_list; + STAILQ_ENTRY(tcp_log_id_node) tln_expireq; /* Locked by the expireq lock */ + sbintime_t tln_expiretime; /* Locked by the expireq lock */ + + /* + * If INP is NULL, that means the connection has closed. We've + * saved the connection endpoint information and the log entries + * in the tln_ie and tln_entries members. We've also saved a pointer + * to the enclosing bucket here. If INP is not NULL, the information is + * in the PCB and not here. + */ + struct inpcb *tln_inp; + struct tcpcb *tln_tp; + struct tcp_log_id_bucket *tln_bucket; + struct in_endpoints tln_ie; + struct tcp_log_stailq tln_entries; + int tln_count; + volatile int tln_closed; + uint8_t tln_af; +}; + +enum tree_lock_state { + TREE_UNLOCKED = 0, + TREE_RLOCKED, + TREE_WLOCKED, +}; + +/* Do we want to select this session for auto-logging? */ +static __inline bool +tcp_log_selectauto(void) +{ + + /* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Mar 22 09:43:15 2018 Return-Path: Delivered-To: svn-src-head@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 B6AF8F55130; Thu, 22 Mar 2018 09:43:15 +0000 (UTC) (envelope-from jtl@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 6552A6AE1E; Thu, 22 Mar 2018 09:43:15 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 603707CA3; Thu, 22 Mar 2018 09:43:15 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M9hFSg072345; Thu, 22 Mar 2018 09:43:15 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M9hFmC072344; Thu, 22 Mar 2018 09:43:15 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201803220943.w2M9hFmC072344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Thu, 22 Mar 2018 09:43:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331348 - head/usr.bin/netstat X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/usr.bin/netstat X-SVN-Commit-Revision: 331348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 09:43:15 -0000 Author: jtl Date: Thu Mar 22 09:43:15 2018 New Revision: 331348 URL: https://svnweb.freebsd.org/changeset/base/331348 Log: Bump netstat.1's .Dd after r331347. Modified: head/usr.bin/netstat/netstat.1 Modified: head/usr.bin/netstat/netstat.1 ============================================================================== --- head/usr.bin/netstat/netstat.1 Thu Mar 22 09:40:08 2018 (r331347) +++ head/usr.bin/netstat/netstat.1 Thu Mar 22 09:43:15 2018 (r331348) @@ -28,7 +28,7 @@ .\" @(#)netstat.1 8.8 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd September 9, 2017 +.Dd March 22, 2018 .Dt NETSTAT 1 .Os .Sh NAME From owner-svn-src-head@freebsd.org Thu Mar 22 11:42:31 2018 Return-Path: Delivered-To: svn-src-head@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 C17D5F5D933; Thu, 22 Mar 2018 11:42:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B6EB6F6EA; Thu, 22 Mar 2018 11:42:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w2MBgEcE026609 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 22 Mar 2018 13:42:18 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w2MBgEcE026609 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w2MBgDcG026607; Thu, 22 Mar 2018 13:42:13 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 22 Mar 2018 13:42:13 +0200 From: Konstantin Belousov To: Bruce Evans Cc: Warner Losh , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons Message-ID: <20180322114213.GR76926@kib.kiev.ua> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> <20180321202752.GO76926@kib.kiev.ua> <20180322174025.Q1053@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180322174025.Q1053@besplex.bde.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 11:42:32 -0000 On Thu, Mar 22, 2018 at 05:50:57PM +1100, Bruce Evans wrote: > On Wed, 21 Mar 2018, Warner Losh wrote: > > > On Wed, Mar 21, 2018 at 2:27 PM, Konstantin Belousov > > wrote: > >> ... > >> Are you saying that fast interrupt handlers call shutdown_nice() ? This > >> is the quite serious bug on its own. To fix it, shutdown_nice() should > >> use a fast taskqueue to schedule the task which would lock the process > >> and send the signal. > > > > Is there some way we know we're in a fast interrupt handler? If so, it > > should be simple to fix. If not, then there's an API change ahead of us... > > There is a td_intr_nesting_level flag that might work. (I invented this, > but don't like its current use.) But why do we need to know this ? We can always schedule a task in the fast taskqueue if init is present and can be scheduled. > > > But bde is right: the system has to be in good enough shape to cope. I > > wonder if we should put that coping into kdb_reboot() instead. It's only an > > issue for TILDE ^R, which is a fairly edge case. > > shutdown_nice() is also called directly from syscons and vt for the reboot, > halt and poweroff keys. This happens in normal interrupt handler context, > so there is only a problem when init is not running. diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index e5ea9644ad3..e7c6d4c92b2 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -276,6 +277,28 @@ sys_reboot(struct thread *td, struct reboot_args *uap) return (error); } +static void +shutdown_nice_task_fn(void *arg, int pending __unused) +{ + int howto; + + howto = (uintptr_t)arg; + /* Send a signal to init(8) and have it shutdown the world. */ + PROC_LOCK(initproc); + if (howto & RB_POWEROFF) + kern_psignal(initproc, SIGUSR2); + else if (howto & RB_POWERCYCLE) + kern_psignal(initproc, SIGWINCH); + else if (howto & RB_HALT) + kern_psignal(initproc, SIGUSR1); + else + kern_psignal(initproc, SIGINT); + PROC_UNLOCK(initproc); +} + +static struct task shutdown_nice_task = TASK_INITIALIZER(0, + &shutdown_nice_task_fn, NULL); + /* * Called by events that want to shut down.. e.g on a PC */ @@ -283,20 +306,14 @@ void shutdown_nice(int howto) { - if (initproc != NULL) { - /* Send a signal to init(8) and have it shutdown the world. */ - PROC_LOCK(initproc); - if (howto & RB_POWEROFF) - kern_psignal(initproc, SIGUSR2); - else if (howto & RB_POWERCYCLE) - kern_psignal(initproc, SIGWINCH); - else if (howto & RB_HALT) - kern_psignal(initproc, SIGUSR1); - else - kern_psignal(initproc, SIGINT); - PROC_UNLOCK(initproc); + if (initproc != NULL && !SCHEDULER_STOPPED()) { + shutdown_nice_task.ta_context = (void *)(uintptr_t)howto; + taskqueue_enqueue(taskqueue_fast, &shutdown_nice_task); } else { - /* No init(8) running, so simply reboot. */ + /* + * No init(8) running, or scheduler would not allow it + * to run, so simply reboot. + */ kern_reboot(howto | RB_NOSYNC); } } From owner-svn-src-head@freebsd.org Thu Mar 22 11:58:00 2018 Return-Path: Delivered-To: svn-src-head@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 199CAF5EC8A; Thu, 22 Mar 2018 11:58:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 BE06F703D8; Thu, 22 Mar 2018 11:57:59 +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 B8D561114C; Thu, 22 Mar 2018 11:57:59 +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 w2MBvxmh037611; Thu, 22 Mar 2018 11:57:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MBvx0h037610; Thu, 22 Mar 2018 11:57:59 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803221157.w2MBvx0h037610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Mar 2018 11:57:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331353 - head X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 331353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 11:58:00 -0000 Author: kevans Date: Thu Mar 22 11:57:59 2018 New Revision: 331353 URL: https://svnweb.freebsd.org/changeset/base/331353 Log: Partially revert r328780 efi.4th was added to ObsoleteFiles and disconnected from the build, but not removed from hte repo. We've since found a mild use for it that makes some amount of sense, so partially revert r328780 and bring it back to life. Reported by: many X-MFC-With: r331326 Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Thu Mar 22 11:57:12 2018 (r331352) +++ head/ObsoleteFiles.inc Thu Mar 22 11:57:59 2018 (r331353) @@ -59,7 +59,6 @@ OLD_FILES+=usr/share/openssl/man/man1/c_rehash.1.gz # 20180206: remove gdbtui OLD_FILES+=usr/bin/gdbtui # 20180201: Obsolete forth files -OLD_FILES+=boot/efi.4th OLD_FILES+=boot/pcibios.4th # 20180114: new clang import which bumps version from 5.0.1 to 6.0.0. OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/allocator_interface.h From owner-svn-src-head@freebsd.org Thu Mar 22 12:02:38 2018 Return-Path: Delivered-To: svn-src-head@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 D74E2F5FA7F; Thu, 22 Mar 2018 12:02:37 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 7599470BC3; Thu, 22 Mar 2018 12:02:36 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from [IPv6:2a02:c7f:1e13:cf00:f91e:df97:532a:2e3f] (unknown [IPv6:2a02:c7f:1e13:cf00:f91e:df97:532a:2e3f]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 85DF94EBE3; Thu, 22 Mar 2018 12:02:04 +0000 (UTC) From: Andrew Turner Message-Id: <8722C20F-9581-4C58-98D8-86FD0016BC6B@fubar.geek.nz> Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: svn commit: r331306 - head/sys/dev/usb/controller Date: Thu, 22 Mar 2018 12:02:03 +0000 In-Reply-To: <00c43a84-893e-cbd8-ff6d-f7a551ae3beb@selasky.org> Cc: Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Hans Petter Selasky References: <201803211517.w2LFHsHf007714@repo.freebsd.org> <898DF1A6-F1D2-474C-92B5-12F65DC71A40@fubar.geek.nz> <00c43a84-893e-cbd8-ff6d-f7a551ae3beb@selasky.org> X-Mailer: Apple Mail (2.3445.5.20) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 12:02:38 -0000 > On 21 Mar 2018, at 21:54, Hans Petter Selasky wrote: >=20 > On 03/21/18 17:45, Andrew Turner wrote: >>> On 21 Mar 2018, at 15:37, Hans Petter Selasky = wrote: >>>=20 >>> On 03/21/18 16:24, Kyle Evans wrote: >>>>> + { >>>>> + .ep_end =3D 7, >>>>> + .ep_fifosz_shift =3D 9, >>>>> + .ep_fifosz_reg =3D MUSB2_VAL_FIFOSZ_512 | = MUSB2_MASK_FIFODB, >>>>> + }, >>>> I'm afraid I'm not familiar with this- why did .ep_fifosz_shift for >>>> this case drop to 9? frx =3D 10 in the temp < 8 case in the = removals of >>>> the following hunks. Mostly curious because the others seemed to = stay >>>> the same. >>>=20 >>> Hi Andrew, >>>=20 >>> It might be an idea to keep the fifosz_shift at 10, else high-speed = BULK traffic won't be double buffered, and this might affect = performance. >> Should the endpoint 1 size also be fixed? The register has it at 4k, = but it wasn=E2=80=99t an 8k buffer. >=20 > No, because High-Speed BULK will only use 512 byte packets, and 4k is = reserved for isochronous, which doesn't need double buffering at the = moment. Ok, in that case should we remove the double buffer flag on endpoint 1? = The Linux driver seems to always use a 512 byte buffer there, and always = doubles the offset increment when the double buffer flag is set. Andrew From owner-svn-src-head@freebsd.org Thu Mar 22 12:08:14 2018 Return-Path: Delivered-To: svn-src-head@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 4B9E2F60251; Thu, 22 Mar 2018 12:08:14 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC37670F2D; Thu, 22 Mar 2018 12:08:13 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 6887B260834; Thu, 22 Mar 2018 13:08:05 +0100 (CET) Subject: Re: svn commit: r331306 - head/sys/dev/usb/controller To: Andrew Turner Cc: Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803211517.w2LFHsHf007714@repo.freebsd.org> <898DF1A6-F1D2-474C-92B5-12F65DC71A40@fubar.geek.nz> <00c43a84-893e-cbd8-ff6d-f7a551ae3beb@selasky.org> <8722C20F-9581-4C58-98D8-86FD0016BC6B@fubar.geek.nz> From: Hans Petter Selasky Message-ID: Date: Thu, 22 Mar 2018 13:07:59 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <8722C20F-9581-4C58-98D8-86FD0016BC6B@fubar.geek.nz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 12:08:14 -0000 On 03/22/18 13:02, Andrew Turner wrote: >> On 21 Mar 2018, at 21:54, Hans Petter Selasky wrote: >> >> On 03/21/18 17:45, Andrew Turner wrote: >>>> On 21 Mar 2018, at 15:37, Hans Petter Selasky wrote: >>>> >>>> On 03/21/18 16:24, Kyle Evans wrote: >>>>>> + { >>>>>> + .ep_end = 7, >>>>>> + .ep_fifosz_shift = 9, >>>>>> + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512 | MUSB2_MASK_FIFODB, >>>>>> + }, >>>>> I'm afraid I'm not familiar with this- why did .ep_fifosz_shift for >>>>> this case drop to 9? frx = 10 in the temp < 8 case in the removals of >>>>> the following hunks. Mostly curious because the others seemed to stay >>>>> the same. >>>> >>>> Hi Andrew, >>>> >>>> It might be an idea to keep the fifosz_shift at 10, else high-speed BULK traffic won't be double buffered, and this might affect performance. >>> Should the endpoint 1 size also be fixed? The register has it at 4k, but it wasn’t an 8k buffer. >> >> No, because High-Speed BULK will only use 512 byte packets, and 4k is reserved for isochronous, which doesn't need double buffering at the moment. > > Ok, in that case should we remove the double buffer flag on endpoint 1? The Linux driver seems to always use a 512 byte buffer there, and always doubles the offset increment when the double buffer flag is set. Hi Andrew, That's a good question. I think you should leave the double buffer flag on for this register. Double buffering is then later on re-programmed by: > static void > musbotg_clear_stall_sub(struct musbotg_softc *sc, uint16_t wMaxPacket, > uint8_t ep_no, uint8_t ep_type, uint8_t ep_dir) If you look at the writes to MUSB2_REG_TXDBDIS and MUSB2_REG_RXDBDIS. I think those registers override the "master" register. You might want to check the PRM to be absolutely sure. --HPS From owner-svn-src-head@freebsd.org Thu Mar 22 12:26:27 2018 Return-Path: Delivered-To: svn-src-head@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 D2A88F61A9C; Thu, 22 Mar 2018 12:26:27 +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 8626171C5B; Thu, 22 Mar 2018 12:26:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 812181160F; Thu, 22 Mar 2018 12:26: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 w2MCQRqL051873; Thu, 22 Mar 2018 12:26:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MCQRVO051872; Thu, 22 Mar 2018 12:26:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803221226.w2MCQRVO051872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Mar 2018 12:26:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331355 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 331355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 12:26:28 -0000 Author: hselasky Date: Thu Mar 22 12:26:27 2018 New Revision: 331355 URL: https://svnweb.freebsd.org/changeset/base/331355 Log: Clear old MSIX IRQ numbers in the LinuxKPI. When disabling the MSIX IRQ vectors for a PCI device through the LinuxKPI, make sure any old MSIX IRQ numbers are no longer visible to the linux_pci_find_irq_dev() function else IRQs can be requested from the wrong PCI device. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/pci.h Thu Mar 22 12:01:30 2018 (r331354) +++ head/sys/compat/linuxkpi/common/include/linux/pci.h Thu Mar 22 12:26:27 2018 (r331355) @@ -425,6 +425,15 @@ pci_disable_msix(struct pci_dev *pdev) { pci_release_msi(pdev->dev.bsddev); + + /* + * The MSIX IRQ numbers associated with this PCI device are no + * longer valid and might be re-assigned. Make sure + * linux_pci_find_irq_dev() does no longer see them by + * resetting their references to zero: + */ + pdev->dev.msix = 0; + pdev->dev.msix_max = 0; } static inline bus_addr_t From owner-svn-src-head@freebsd.org Thu Mar 22 12:58:51 2018 Return-Path: Delivered-To: svn-src-head@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 93E81F646F9; Thu, 22 Mar 2018 12:58:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 1CD187313B; Thu, 22 Mar 2018 12:58:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1376511A98; Thu, 22 Mar 2018 12:58:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MCwoFf067058; Thu, 22 Mar 2018 12:58:50 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MCwov4067050; Thu, 22 Mar 2018 12:58:50 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803221258.w2MCwov4067050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Mar 2018 12:58:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331356 - in head: lib/libsysdecode sys/amd64/linux sys/amd64/linux32 sys/compat/linux sys/i386/linux sys/modules/linux_common X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: lib/libsysdecode sys/amd64/linux sys/amd64/linux32 sys/compat/linux sys/i386/linux sys/modules/linux_common X-SVN-Commit-Revision: 331356 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 12:58:51 -0000 Author: emaste Date: Thu Mar 22 12:58:49 2018 New Revision: 331356 URL: https://svnweb.freebsd.org/changeset/base/331356 Log: Share Linux errno table with libsysdecode Requested by: jhb Reviewed by: jhb Sponsored by: Turing Robotic Industries Inc. Added: head/sys/compat/linux/linux_errno.inc - copied, changed from r331355, head/sys/compat/linux/linux_errno.c Modified: head/lib/libsysdecode/errno.c head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/compat/linux/linux_emul.h head/sys/compat/linux/linux_errno.c head/sys/i386/linux/linux_sysvec.c head/sys/modules/linux_common/Makefile Modified: head/lib/libsysdecode/errno.c ============================================================================== --- head/lib/libsysdecode/errno.c Thu Mar 22 12:26:27 2018 (r331355) +++ head/lib/libsysdecode/errno.c Thu Mar 22 12:58:49 2018 (r331356) @@ -37,25 +37,8 @@ __FBSDID("$FreeBSD$"); #include #if defined(__i386__) || defined(__amd64__) -/* - * Linux syscalls return negative errno's, we do positive and map them - * Reference: - * FreeBSD: src/sys/sys/errno.h - * Linux: include/uapi/asm-generic/errno-base.h - * include/uapi/asm-generic/errno.h - */ -static int bsd_to_linux_errno[ELAST + 1] = { - -0, -1, -2, -3, -4, -5, -6, -7, -8, -9, - -10, -35, -12, -13, -14, -15, -16, -17, -18, -19, - -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, - -30, -31, -32, -33, -34, -11,-115,-114, -88, -89, - -90, -91, -92, -93, -94, -95, -96, -97, -98, -99, - -100,-101,-102,-103,-104,-105,-106,-107,-108,-109, - -110,-111, -40, -36,-112,-113, -39, -11, -87,-122, - -116, -66, -6, -6, -6, -6, -6, -37, -38, -9, - -6, -6, -43, -42, -75,-125, -84, -61, -16, -74, - -72, -67, -71, -1, -1, -131, -130 -}; +static +#include #endif #include @@ -156,8 +139,8 @@ sysdecode_abi_to_freebsd_errno(enum sysdecode_abi abi, * This is imprecise since it returns the first * matching errno. */ - for (i = 0; i < nitems(bsd_to_linux_errno); i++) { - if (error == bsd_to_linux_errno[i]) + for (i = 0; i < nitems(linux_errtbl); i++) { + if (error == linux_errtbl[i]) return (i); } break; @@ -187,7 +170,7 @@ sysdecode_freebsd_to_abi_errno(enum sysdecode_abi abi, case SYSDECODE_ABI_LINUX: case SYSDECODE_ABI_LINUX32: if (error >= 0 && error <= ELAST) - return (bsd_to_linux_errno[error]); + return (linux_errtbl[error]); break; #endif case SYSDECODE_ABI_CLOUDABI32: Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Thu Mar 22 12:26:27 2018 (r331355) +++ head/sys/amd64/linux/linux_sysvec.c Thu Mar 22 12:58:49 2018 (r331356) @@ -752,7 +752,7 @@ struct sysentvec elf_linux_sysvec = { .sv_table = linux_sysent, .sv_mask = 0, .sv_errsize = ELAST + 1, - .sv_errtbl = bsd_to_linux_errno_generic, + .sv_errtbl = linux_errtbl, .sv_transtrap = linux_translate_traps, .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_rt_sendsig, Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Thu Mar 22 12:26:27 2018 (r331355) +++ head/sys/amd64/linux32/linux32_sysvec.c Thu Mar 22 12:58:49 2018 (r331356) @@ -952,7 +952,7 @@ struct sysentvec elf_linux_sysvec = { .sv_table = linux32_sysent, .sv_mask = 0, .sv_errsize = ELAST + 1, - .sv_errtbl = bsd_to_linux_errno_generic, + .sv_errtbl = linux_errtbl, .sv_transtrap = linux_translate_traps, .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_sendsig, Modified: head/sys/compat/linux/linux_emul.h ============================================================================== --- head/sys/compat/linux/linux_emul.h Thu Mar 22 12:26:27 2018 (r331355) +++ head/sys/compat/linux/linux_emul.h Thu Mar 22 12:58:49 2018 (r331356) @@ -77,6 +77,6 @@ struct linux_pemuldata { struct linux_pemuldata *pem_find(struct proc *); -extern const int bsd_to_linux_errno_generic[]; +extern const int linux_errtbl[]; #endif /* !_LINUX_EMUL_H_ */ Modified: head/sys/compat/linux/linux_errno.c ============================================================================== --- head/sys/compat/linux/linux_errno.c Thu Mar 22 12:26:27 2018 (r331355) +++ head/sys/compat/linux/linux_errno.c Thu Mar 22 12:58:49 2018 (r331356) @@ -1,151 +1,6 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1994-1996 Søren Schmidt - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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$ - */ +/* $FreeBSD$ */ #include #include -/* - * Linux syscalls return negative errno's, we do positive and map them - * Reference: - * FreeBSD: src/sys/sys/errno.h - * Linux: include/uapi/asm-generic/errno-base.h - * include/uapi/asm-generic/errno.h - */ -const int bsd_to_linux_errno_generic[ELAST + 1] = { - -0, - -1, - -2, - -3, - -4, - -5, - -6, - -7, - -8, - -9, - - -10, - -35, /* EDEADLK */ - -12, - -13, - -14, - -15, - -16, - -17, - -18, - -19, - - -20, - -21, - -22, - -23, - -24, - -25, - -26, - -27, - -28, - -29, - - -30, - -31, - -32, - -33, - -34, - -11, /* EAGAIN */ - -115, - -114, - -88, - -89, - - -90, - -91, - -92, - -93, - -94, - -95, - -96, - -97, - -98, - -99, - - -100, - -101, - -102, - -103, - -104, - -105, - -106, - -107, - -108, - -109, - - -110, - -111, - -40, - -36, - -112, - -113, - -39, - -11, - -87, - -122, - - -116, - -66, - -6, /* EBADRPC -> ENXIO */ - -6, /* ERPCMISMATCH -> ENXIO */ - -6, /* EPROGUNAVAIL -> ENXIO */ - -6, /* EPROGMISMATCH -> ENXIO */ - -6, /* EPROCUNAVAIL -> ENXIO */ - -37, - -38, - -9, - - -6, /* EAUTH -> ENXIO */ - -6, /* ENEEDAUTH -> ENXIO */ - -43, - -42, - -75, - -125, - -84, - -61, - -16, /* EDOOFUS -> EBUSY */ - -74, - - -72, - -67, - -71, - -1, /* ENOTCAPABLE -> EPERM */ - -1, /* ECAPMODE -> EPERM */ - -131, /* ENOTRECOVERABLE */ - -130, /* EOWNERDEAD */ -}; - -_Static_assert(ELAST == 96, - "missing errno entries in bsd_to_linux_errno_generic"); +#include Copied and modified: head/sys/compat/linux/linux_errno.inc (from r331355, head/sys/compat/linux/linux_errno.c) ============================================================================== --- head/sys/compat/linux/linux_errno.c Thu Mar 22 12:26:27 2018 (r331355, copy source) +++ head/sys/compat/linux/linux_errno.inc Thu Mar 22 12:58:49 2018 (r331356) @@ -28,9 +28,6 @@ * $FreeBSD$ */ -#include -#include - /* * Linux syscalls return negative errno's, we do positive and map them * Reference: @@ -38,7 +35,7 @@ * Linux: include/uapi/asm-generic/errno-base.h * include/uapi/asm-generic/errno.h */ -const int bsd_to_linux_errno_generic[ELAST + 1] = { +const int linux_errtbl[ELAST + 1] = { -0, -1, -2, @@ -148,4 +145,4 @@ const int bsd_to_linux_errno_generic[ELAST + 1] = { }; _Static_assert(ELAST == 96, - "missing errno entries in bsd_to_linux_errno_generic"); + "missing errno entries in linux_errtbl"); Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Thu Mar 22 12:26:27 2018 (r331355) +++ head/sys/i386/linux/linux_sysvec.c Thu Mar 22 12:58:49 2018 (r331356) @@ -893,7 +893,7 @@ struct sysentvec linux_sysvec = { .sv_table = linux_sysent, .sv_mask = 0, .sv_errsize = ELAST + 1, - .sv_errtbl = bsd_to_linux_errno_generic, + .sv_errtbl = linux_errtbl, .sv_transtrap = linux_translate_traps, .sv_fixup = linux_fixup, .sv_sendsig = linux_sendsig, @@ -930,7 +930,7 @@ struct sysentvec elf_linux_sysvec = { .sv_table = linux_sysent, .sv_mask = 0, .sv_errsize = ELAST + 1, - .sv_errtbl = bsd_to_linux_errno_generic, + .sv_errtbl = linux_errtbl, .sv_transtrap = linux_translate_traps, .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_sendsig, Modified: head/sys/modules/linux_common/Makefile ============================================================================== --- head/sys/modules/linux_common/Makefile Thu Mar 22 12:26:27 2018 (r331355) +++ head/sys/modules/linux_common/Makefile Thu Mar 22 12:58:49 2018 (r331356) @@ -8,8 +8,8 @@ SRCS= linux_common.c linux_mib.c linux_mmap.c linux_ut linux.c opt_compat.h device_if.h vnode_if.h bus_if.h EXPORT_SYMS= -EXPORT_SYMS+= bsd_to_linux_errno_generic EXPORT_SYMS+= linux_emul_path +EXPORT_SYMS+= linux_errtbl EXPORT_SYMS+= linux_ioctl_register_handler EXPORT_SYMS+= linux_ioctl_unregister_handler EXPORT_SYMS+= linux_get_osname From owner-svn-src-head@freebsd.org Thu Mar 22 13:30:35 2018 Return-Path: Delivered-To: svn-src-head@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 D3B75F6751D; Thu, 22 Mar 2018 13:30: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 86D0874775; Thu, 22 Mar 2018 13:30:35 +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 81A8D11F21; Thu, 22 Mar 2018 13:30:35 +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 w2MDUZuT082003; Thu, 22 Mar 2018 13:30:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MDUZTD082002; Thu, 22 Mar 2018 13:30:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803221330.w2MDUZTD082002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Mar 2018 13:30:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331357 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 331357 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 13:30:36 -0000 Author: hselasky Date: Thu Mar 22 13:30:35 2018 New Revision: 331357 URL: https://svnweb.freebsd.org/changeset/base/331357 Log: The pci_disable_device() function is also expected to clear the PCI busmaster. This fixes LinuxKPI compliancy with Linux. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/pci.h Thu Mar 22 12:58:49 2018 (r331356) +++ head/sys/compat/linuxkpi/common/include/linux/pci.h Thu Mar 22 13:30:35 2018 (r331357) @@ -343,6 +343,7 @@ pci_disable_device(struct pci_dev *pdev) pci_disable_io(pdev->dev.bsddev, SYS_RES_IOPORT); pci_disable_io(pdev->dev.bsddev, SYS_RES_MEMORY); + pci_disable_busmaster(pdev->dev.bsddev); } static inline int From owner-svn-src-head@freebsd.org Thu Mar 22 13:56:08 2018 Return-Path: Delivered-To: svn-src-head@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 2D5EBF697C6; Thu, 22 Mar 2018 13:56:08 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x231.google.com (mail-io0-x231.google.com [IPv6:2607:f8b0:4001:c06::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B249F75A38; Thu, 22 Mar 2018 13:56:07 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x231.google.com with SMTP id r18so11062569ioa.1; Thu, 22 Mar 2018 06:56:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=uakfouoawlKl1TFqxIkqZ1IrFaRs9rQ+4AdTL9GNk7o=; b=OcHvDgJ6bEHCQtV+a3sxiBD4GSXuSUZYdmpqLNDkDMVmfdSAMEoH0lUWr+/nExsI2i 1ViINsiBw20wLYLGkdJ5TpletIgQmx6AUjjJHHfxN662MJ7fvES1AamIYPYIYsVgRSWw HBO2l+gJ8BkqLRJhQ/oOyo7RGaS1WcS8mbAFZKFTHD1GfFo+J8cHdAfo2iNtoPBzZS/v YkmigSxhjV5gSYpOplHXVD4ml56/2MUOaKzLYGMCUvSqrXOe+m64SY8Ibtmg1OZ6bYSH +Qe5R8fEJds2Zr0C9FzxEOxn1jyxMgOfAt+rPRdbd7tjcsQbnkm2WPy40ACFzaRNtJhV EqVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=uakfouoawlKl1TFqxIkqZ1IrFaRs9rQ+4AdTL9GNk7o=; b=I9JTSIkTgwHyGMwHh5oYLFCajqIPfe1dxLNV+wgDno+XIr7VCX8m0GBE6b6/skqEvB 62X+xLJcRGJQumn2rI1+0wa1BqdxMaTpfvIigbDdgmXCTS2xb+kYun23KFSnDt79kBT9 0B8bqXKXyZ2Bk1zEO3/rVDiZ5R7CzwJ7jm0d/Nu62LTeZS5kld9nL6P8qw5dEMVWBjDm QMczw7QPjCWVfKcwJf3Z/EJBBCzjP6qNfmA1/17FYHTVmD78T58Pv/8yvkj/3RsUwrih HKSSoaRkqcPOfNrH4VU2bmD7qatHOah0eIG8Xz62xbX9+SKWh96PRttXmyvccWXTwgAM SFqw== X-Gm-Message-State: AElRT7EXav3LoRAh1QZS4pyFapNTdC6ls0W1GgbYFNrhuSF6r0W9GkHT 4GQYV6rxubNYseY7VWb0NcpMMfYcx1NAQa6MufBTixVD X-Google-Smtp-Source: AG47ELuukn/u9thJ3wP/pcHD2ajMKg+x7vpp7RB6axhIrtQipdT/5dn2e6ivdOWQysBtEL9so7uhvi//cfaXEP+empg= X-Received: by 10.107.46.30 with SMTP id i30mr26172402ioo.288.1521726966887; Thu, 22 Mar 2018 06:56:06 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.163.13 with HTTP; Thu, 22 Mar 2018 06:55:46 -0700 (PDT) In-Reply-To: <201803221258.w2MCwov4067050@repo.freebsd.org> References: <201803221258.w2MCwov4067050@repo.freebsd.org> From: Ed Maste Date: Thu, 22 Mar 2018 09:55:46 -0400 X-Google-Sender-Auth: Lv1kjfuXu3eOel0uMMZUX4ulMvo Message-ID: Subject: Re: svn commit: r331356 - in head: lib/libsysdecode sys/amd64/linux sys/amd64/linux32 sys/compat/linux sys/i386/linux sys/modules/linux_common To: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 13:56:08 -0000 On 22 March 2018 at 08:58, Ed Maste wrote: > Author: emaste > Date: Thu Mar 22 12:58:49 2018 > New Revision: 331356 > URL: https://svnweb.freebsd.org/changeset/base/331356 > > Log: > Share Linux errno table with libsysdecode I had a question about using ".inc" vs ".h". I followed the ".inc" convention from some examples in llvm and elsewhere, because linux_errno.inc is unlike regular headers - it's not idempotent, and the array has to be the first non-comment content in the file because it's prefixed with "static" before one of the #includes. From owner-svn-src-head@freebsd.org Thu Mar 22 14:21:48 2018 Return-Path: Delivered-To: svn-src-head@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 0D3AFF6B865; Thu, 22 Mar 2018 14:21:48 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 567C576FA5; Thu, 22 Mar 2018 14:21:46 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 31DC6104B94; Fri, 23 Mar 2018 01:21:44 +1100 (AEDT) Date: Fri, 23 Mar 2018 01:21:43 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Warner Losh , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons In-Reply-To: <20180322114213.GR76926@kib.kiev.ua> Message-ID: <20180322235735.J3354@besplex.bde.org> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> <20180321202752.GO76926@kib.kiev.ua> <20180322174025.Q1053@besplex.bde.org> <20180322114213.GR76926@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VJytp5HX c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=gcR34HTtTRcHr_MuQ_EA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 14:21:48 -0000 On Thu, 22 Mar 2018, Konstantin Belousov wrote: > On Thu, Mar 22, 2018 at 05:50:57PM +1100, Bruce Evans wrote: >> On Wed, 21 Mar 2018, Warner Losh wrote: >> >>> On Wed, Mar 21, 2018 at 2:27 PM, Konstantin Belousov >>> wrote: >>>> ... >>>> Are you saying that fast interrupt handlers call shutdown_nice() ? This >>>> is the quite serious bug on its own. To fix it, shutdown_nice() should >>>> use a fast taskqueue to schedule the task which would lock the process >>>> and send the signal. >>> >>> Is there some way we know we're in a fast interrupt handler? If so, it >>> should be simple to fix. If not, then there's an API change ahead of us... >> >> There is a td_intr_nesting_level flag that might work. (I invented this, >> but don't like its current use.) > But why do we need to know this ? We can always schedule a task in the > fast taskqueue if init is present and can be scheduled. Not quite always. In my version, fast interrupt handlers are actually fast, so they can interrupt any spin mutex and cannot call any scheduling function. This is enforced by setting the pcpu pointer to NULL. Taskqueues and even SWIs are unavailable for fast interrupt handlers. Scheduling is done by setting a flag that is checked in timeout handlers like it was in FreeBSD-1. > ... >> shutdown_nice() is also called directly from syscons and vt for the reboot, >> halt and poweroff keys. This happens in normal interrupt handler context, >> so there is only a problem when init is not running. > > diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c > index e5ea9644ad3..e7c6d4c92b2 100644 > --- a/sys/kern/kern_shutdown.c > +++ b/sys/kern/kern_shutdown.c > @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > > @@ -276,6 +277,28 @@ sys_reboot(struct thread *td, struct reboot_args *uap) > return (error); > } > > +static void > +shutdown_nice_task_fn(void *arg, int pending __unused) > +{ > + int howto; > + > + howto = (uintptr_t)arg; > + /* Send a signal to init(8) and have it shutdown the world. */ > + PROC_LOCK(initproc); > + if (howto & RB_POWEROFF) > + kern_psignal(initproc, SIGUSR2); > + else if (howto & RB_POWERCYCLE) > + kern_psignal(initproc, SIGWINCH); > + else if (howto & RB_HALT) > + kern_psignal(initproc, SIGUSR1); > + else > + kern_psignal(initproc, SIGINT); > + PROC_UNLOCK(initproc); > +} > + > +static struct task shutdown_nice_task = TASK_INITIALIZER(0, > + &shutdown_nice_task_fn, NULL); > + I don't like having a whole task for this. The whole thing is just a hack to work around some the upper layers of the tty driver and some lower layers not having any input [escape] sequences to control the kernel. Only the syscons and vt lower layers have such sequences (where they are actually key combinations that are converted to control operations instead of to input [escape] sequences). To work around for hardware ttys, the filter for kdb sequences is abused to implement a non-kdb sequence for rebooting. The tty input methods could check for kernel-control sequences and safely signal init. This is a bit too complicated for syscons and vt since they can more easily check for key combinations, but wouldhave to convert these to standard sequences to get the tty layer to do the same thing. (They have many more kernel-control key combinations and the non-kdb one for rebooting is just a bug for them.) This is a bit complicated for hardware tty drivers too -- some use the tty bulk-input method and this shouldn't check for sequences, but should reduce to bcopy(). Hoever, to detect the kdb sequences, these drivers han to check at a low level anyway. They can be clever about this and only check for the console device[s] which are usually only used for for input at a low rate. > /* > * Called by events that want to shut down.. e.g on a PC > */ > @@ -283,20 +306,14 @@ void > shutdown_nice(int howto) > { > > - if (initproc != NULL) { > - /* Send a signal to init(8) and have it shutdown the world. */ > - PROC_LOCK(initproc); > - if (howto & RB_POWEROFF) > - kern_psignal(initproc, SIGUSR2); > - else if (howto & RB_POWERCYCLE) > - kern_psignal(initproc, SIGWINCH); > - else if (howto & RB_HALT) > - kern_psignal(initproc, SIGUSR1); > - else > - kern_psignal(initproc, SIGINT); > - PROC_UNLOCK(initproc); > + if (initproc != NULL && !SCHEDULER_STOPPED()) { > + shutdown_nice_task.ta_context = (void *)(uintptr_t)howto; > + taskqueue_enqueue(taskqueue_fast, &shutdown_nice_task); > } else { > - /* No init(8) running, so simply reboot. */ > + /* > + * No init(8) running, or scheduler would not allow it > + * to run, so simply reboot. > + */ > kern_reboot(howto | RB_NOSYNC); > } > } Calling kern_reboot() from fast interrupt handlers is still invalid. It is quite likely to deadlock. In particular, it should deadlock in when kern_reboot() prints messages to the console. Most console drivers have races instead of deadlocks by dropping their lock[s] in their fast interrupt handler before calling the buggy alt escape function. Bruce From owner-svn-src-head@freebsd.org Thu Mar 22 14:25:06 2018 Return-Path: Delivered-To: svn-src-head@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 88BB1F6BD44; Thu, 22 Mar 2018 14:25:06 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-42.csi.cam.ac.uk (ppsw-42.csi.cam.ac.uk [131.111.8.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19FC077279; Thu, 22 Mar 2018 14:25:05 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:63235) by ppsw-42.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1ez19M-000zp5-7j (Exim 4.89_2) (return-path ); Thu, 22 Mar 2018 14:25:04 +0000 Date: Thu, 22 Mar 2018 14:16:06 +0000 From: Ruslan Bukin To: "Jonathan T. Looney" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat Message-ID: <20180322141606.GA4972@bsdpad.com> References: <201803220940.w2M9e8T4067719@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201803220940.w2M9e8T4067719@repo.freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 14:25:07 -0000 We don't have atomic_fetchadd_64 for mips32 I think Ruslan On Thu, Mar 22, 2018 at 09:40:08AM +0000, Jonathan T. Looney wrote: > Author: jtl > Date: Thu Mar 22 09:40:08 2018 > New Revision: 331347 > URL: https://svnweb.freebsd.org/changeset/base/331347 > > Log: > Add the "TCP Blackbox Recorder" which we discussed at the developer > summits at BSDCan and BSDCam in 2017. > > The TCP Blackbox Recorder allows you to capture events on a TCP connection > in a ring buffer. It stores metadata with the event. It optionally stores > the TCP header associated with an event (if the event is associated with a > packet) and also optionally stores information on the sockets. > > It supports setting a log ID on a TCP connection and using this to correlate > multiple connections that share a common log ID. > > You can log connections in different modes. If you are doing a coordinated > test with a particular connection, you may tell the system to put it in > mode 4 (continuous dump). Or, if you just want to monitor for errors, you > can put it in mode 1 (ring buffer) and dump all the ring buffers associated > with the connection ID when we receive an error signal for that connection > ID. You can set a default mode that will be applied to a particular ratio > of incoming connections. You can also manually set a mode using a socket > option. > > This commit includes only basic probes. rrs@ has added quite an abundance > of probes in his TCP development work. He plans to commit those soon. > > There are user-space programs which we plan to commit as ports. These read > the data from the log device and output pcapng files, and then let you > analyze the data (and metadata) in the pcapng files. > > Reviewed by: gnn (previous version) > Obtained from: Netflix, Inc. > Relnotes: yes > Differential Revision: https://reviews.freebsd.org/D11085 > > Added: > head/sys/dev/tcp_log/ > head/sys/dev/tcp_log/tcp_log_dev.c (contents, props changed) > head/sys/dev/tcp_log/tcp_log_dev.h (contents, props changed) > head/sys/netinet/tcp_log_buf.c (contents, props changed) > head/sys/netinet/tcp_log_buf.h (contents, props changed) > Modified: > head/etc/mtree/BSD.include.dist > head/include/Makefile > head/sys/conf/files > head/sys/kern/subr_witness.c > head/sys/netinet/tcp.h > head/sys/netinet/tcp_input.c > head/sys/netinet/tcp_output.c > head/sys/netinet/tcp_subr.c > head/sys/netinet/tcp_timer.c > head/sys/netinet/tcp_usrreq.c > head/sys/netinet/tcp_var.h > head/usr.bin/netstat/inet.c > head/usr.bin/netstat/main.c > head/usr.bin/netstat/netstat.1 > head/usr.bin/netstat/netstat.h > > Modified: head/etc/mtree/BSD.include.dist > ============================================================================== > --- head/etc/mtree/BSD.include.dist Thu Mar 22 08:32:39 2018 (r331346) > +++ head/etc/mtree/BSD.include.dist Thu Mar 22 09:40:08 2018 (r331347) > @@ -158,6 +158,8 @@ > .. > speaker > .. > + tcp_log > + .. > usb > .. > vkbd > > Modified: head/include/Makefile > ============================================================================== > --- head/include/Makefile Thu Mar 22 08:32:39 2018 (r331346) > +++ head/include/Makefile Thu Mar 22 09:40:08 2018 (r331347) > @@ -47,7 +47,7 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ > dev/hwpmc dev/hyperv \ > dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ > dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ > - dev/speaker dev/vkbd dev/wi \ > + dev/speaker dev/tcp_log dev/vkbd dev/wi \ > fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ > fs/procfs fs/smbfs fs/udf fs/unionfs \ > geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ > > Modified: head/sys/conf/files > ============================================================================== > --- head/sys/conf/files Thu Mar 22 08:32:39 2018 (r331346) > +++ head/sys/conf/files Thu Mar 22 09:40:08 2018 (r331347) > @@ -3161,6 +3161,7 @@ dev/syscons/star/star_saver.c optional star_saver > dev/syscons/syscons.c optional sc > dev/syscons/sysmouse.c optional sc > dev/syscons/warp/warp_saver.c optional warp_saver > +dev/tcp_log/tcp_log_dev.c optional inet | inet6 > dev/tdfx/tdfx_linux.c optional tdfx_linux tdfx compat_linux > dev/tdfx/tdfx_pci.c optional tdfx pci > dev/ti/if_ti.c optional ti pci > @@ -4309,6 +4310,7 @@ netinet/tcp_debug.c optional tcpdebug > netinet/tcp_fastopen.c optional inet tcp_rfc7413 | inet6 tcp_rfc7413 > netinet/tcp_hostcache.c optional inet | inet6 > netinet/tcp_input.c optional inet | inet6 > +netinet/tcp_log_buf.c optional inet | inet6 > netinet/tcp_lro.c optional inet | inet6 > netinet/tcp_output.c optional inet | inet6 > netinet/tcp_offload.c optional tcp_offload inet | tcp_offload inet6 > > Added: head/sys/dev/tcp_log/tcp_log_dev.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/tcp_log/tcp_log_dev.c Thu Mar 22 09:40:08 2018 (r331347) > @@ -0,0 +1,521 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2016-2017 > + * Netflix Inc. All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +#ifdef TCPLOG_DEBUG_COUNTERS > +extern counter_u64_t tcp_log_que_read; > +extern counter_u64_t tcp_log_que_freed; > +#endif > + > +static struct cdev *tcp_log_dev; > +static struct selinfo tcp_log_sel; > + > +static struct log_queueh tcp_log_dev_queue_head = STAILQ_HEAD_INITIALIZER(tcp_log_dev_queue_head); > +static struct log_infoh tcp_log_dev_reader_head = STAILQ_HEAD_INITIALIZER(tcp_log_dev_reader_head); > + > +MALLOC_DEFINE(M_TCPLOGDEV, "tcp_log_dev", "TCP log device data structures"); > + > +static int tcp_log_dev_listeners = 0; > + > +static struct mtx tcp_log_dev_queue_lock; > + > +#define TCP_LOG_DEV_QUEUE_LOCK() mtx_lock(&tcp_log_dev_queue_lock) > +#define TCP_LOG_DEV_QUEUE_UNLOCK() mtx_unlock(&tcp_log_dev_queue_lock) > +#define TCP_LOG_DEV_QUEUE_LOCK_ASSERT() mtx_assert(&tcp_log_dev_queue_lock, MA_OWNED) > +#define TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT() mtx_assert(&tcp_log_dev_queue_lock, MA_NOTOWNED) > +#define TCP_LOG_DEV_QUEUE_REF(tldq) refcount_acquire(&((tldq)->tldq_refcnt)) > +#define TCP_LOG_DEV_QUEUE_UNREF(tldq) refcount_release(&((tldq)->tldq_refcnt)) > + > +static void tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry); > +static void tcp_log_dev_clear_cdevpriv(void *data); > +static int tcp_log_dev_open(struct cdev *dev __unused, int flags, > + int devtype __unused, struct thread *td __unused); > +static int tcp_log_dev_write(struct cdev *dev __unused, > + struct uio *uio __unused, int flags __unused); > +static int tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, > + int flags __unused); > +static int tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, > + caddr_t data, int fflag __unused, struct thread *td __unused); > +static int tcp_log_dev_poll(struct cdev *dev __unused, int events, > + struct thread *td); > + > + > +enum tcp_log_dev_queue_lock_state { > + QUEUE_UNLOCKED = 0, > + QUEUE_LOCKED, > +}; > + > +static struct cdevsw tcp_log_cdevsw = { > + .d_version = D_VERSION, > + .d_read = tcp_log_dev_read, > + .d_open = tcp_log_dev_open, > + .d_write = tcp_log_dev_write, > + .d_poll = tcp_log_dev_poll, > + .d_ioctl = tcp_log_dev_ioctl, > +#ifdef NOTYET > + .d_mmap = tcp_log_dev_mmap, > +#endif > + .d_name = "tcp_log", > +}; > + > +static __inline void > +tcp_log_dev_queue_validate_lock(int lockstate) > +{ > + > +#ifdef INVARIANTS > + switch (lockstate) { > + case QUEUE_LOCKED: > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > + break; > + case QUEUE_UNLOCKED: > + TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT(); > + break; > + default: > + kassert_panic("%s:%d: unknown queue lock state", __func__, > + __LINE__); > + } > +#endif > +} > + > +/* > + * Clear the refcount. If appropriate, it will remove the entry from the > + * queue and call the destructor. > + * > + * This must be called with the queue lock held. > + */ > +static void > +tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry) > +{ > + > + KASSERT(entry != NULL, ("%s: called with NULL entry", __func__)); > + > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > + > + if (TCP_LOG_DEV_QUEUE_UNREF(entry)) { > +#ifdef TCPLOG_DEBUG_COUNTERS > + counter_u64_add(tcp_log_que_freed, 1); > +#endif > + /* Remove the entry from the queue and call the destructor. */ > + STAILQ_REMOVE(&tcp_log_dev_queue_head, entry, tcp_log_dev_queue, > + tldq_queue); > + (*entry->tldq_dtor)(entry); > + } > +} > + > +static void > +tcp_log_dev_clear_cdevpriv(void *data) > +{ > + struct tcp_log_dev_info *priv; > + struct tcp_log_dev_queue *entry, *entry_tmp; > + > + priv = (struct tcp_log_dev_info *)data; > + if (priv == NULL) > + return; > + > + /* > + * Lock the queue and drop our references. We hold references to all > + * the entries starting with tldi_head (or, if tldi_head == NULL, all > + * entries in the queue). > + * > + * Because we don't want anyone adding addition things to the queue > + * while we are doing this, we lock the queue. > + */ > + TCP_LOG_DEV_QUEUE_LOCK(); > + if (priv->tldi_head != NULL) { > + entry = priv->tldi_head; > + STAILQ_FOREACH_FROM_SAFE(entry, &tcp_log_dev_queue_head, > + tldq_queue, entry_tmp) { > + tcp_log_dev_clear_refcount(entry); > + } > + } > + tcp_log_dev_listeners--; > + KASSERT(tcp_log_dev_listeners >= 0, > + ("%s: tcp_log_dev_listeners is unexpectedly negative", __func__)); > + STAILQ_REMOVE(&tcp_log_dev_reader_head, priv, tcp_log_dev_info, > + tldi_list); > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > + TCP_LOG_DEV_QUEUE_UNLOCK(); > + free(priv, M_TCPLOGDEV); > +} > + > +static int > +tcp_log_dev_open(struct cdev *dev __unused, int flags, int devtype __unused, > + struct thread *td __unused) > +{ > + struct tcp_log_dev_info *priv; > + struct tcp_log_dev_queue *entry; > + int rv; > + > + /* > + * Ideally, we shouldn't see these because of file system > + * permissions. > + */ > + if (flags & (FWRITE | FEXEC | FAPPEND | O_TRUNC)) > + return (ENODEV); > + > + /* Allocate space to hold information about where we are. */ > + priv = malloc(sizeof(struct tcp_log_dev_info), M_TCPLOGDEV, > + M_ZERO | M_WAITOK); > + > + /* Stash the private data away. */ > + rv = devfs_set_cdevpriv((void *)priv, tcp_log_dev_clear_cdevpriv); > + if (!rv) { > + /* > + * Increase the listener count, add this reader to the list, and > + * take references on all current queues. > + */ > + TCP_LOG_DEV_QUEUE_LOCK(); > + tcp_log_dev_listeners++; > + STAILQ_INSERT_HEAD(&tcp_log_dev_reader_head, priv, tldi_list); > + priv->tldi_head = STAILQ_FIRST(&tcp_log_dev_queue_head); > + if (priv->tldi_head != NULL) > + priv->tldi_cur = priv->tldi_head->tldq_buf; > + STAILQ_FOREACH(entry, &tcp_log_dev_queue_head, tldq_queue) > + TCP_LOG_DEV_QUEUE_REF(entry); > + TCP_LOG_DEV_QUEUE_UNLOCK(); > + } else { > + /* Free the entry. */ > + free(priv, M_TCPLOGDEV); > + } > + return (rv); > +} > + > +static int > +tcp_log_dev_write(struct cdev *dev __unused, struct uio *uio __unused, > + int flags __unused) > +{ > + > + return (ENODEV); > +} > + > +static __inline void > +tcp_log_dev_rotate_bufs(struct tcp_log_dev_info *priv, int *lockstate) > +{ > + struct tcp_log_dev_queue *entry; > + > + KASSERT(priv->tldi_head != NULL, > + ("%s:%d: priv->tldi_head unexpectedly NULL", > + __func__, __LINE__)); > + KASSERT(priv->tldi_head->tldq_buf == priv->tldi_cur, > + ("%s:%d: buffer mismatch (%p vs %p)", > + __func__, __LINE__, priv->tldi_head->tldq_buf, > + priv->tldi_cur)); > + tcp_log_dev_queue_validate_lock(*lockstate); > + > + if (*lockstate == QUEUE_UNLOCKED) { > + TCP_LOG_DEV_QUEUE_LOCK(); > + *lockstate = QUEUE_LOCKED; > + } > + entry = priv->tldi_head; > + priv->tldi_head = STAILQ_NEXT(entry, tldq_queue); > + tcp_log_dev_clear_refcount(entry); > + priv->tldi_cur = NULL; > +} > + > +static int > +tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, int flags) > +{ > + struct tcp_log_common_header *buf; > + struct tcp_log_dev_info *priv; > + struct tcp_log_dev_queue *entry; > + ssize_t len; > + int lockstate, rv; > + > + /* Get our private info. */ > + rv = devfs_get_cdevpriv((void **)&priv); > + if (rv) > + return (rv); > + > + lockstate = QUEUE_UNLOCKED; > + > + /* Do we need to get a new buffer? */ > + while (priv->tldi_cur == NULL || > + priv->tldi_cur->tlch_length <= priv->tldi_off) { > + /* Did we somehow forget to rotate? */ > + KASSERT(priv->tldi_cur == NULL, > + ("%s:%d: tldi_cur is unexpectedly non-NULL", __func__, > + __LINE__)); > + if (priv->tldi_cur != NULL) > + tcp_log_dev_rotate_bufs(priv, &lockstate); > + > + /* > + * Before we start looking at tldi_head, we need a lock on the > + * queue to make sure tldi_head stays stable. > + */ > + if (lockstate == QUEUE_UNLOCKED) { > + TCP_LOG_DEV_QUEUE_LOCK(); > + lockstate = QUEUE_LOCKED; > + } > + > + /* We need the next buffer. Do we have one? */ > + if (priv->tldi_head == NULL && (flags & FNONBLOCK)) { > + rv = EAGAIN; > + goto done; > + } > + if (priv->tldi_head == NULL) { > + /* Sleep and wait for more things we can read. */ > + rv = mtx_sleep(&tcp_log_dev_listeners, > + &tcp_log_dev_queue_lock, PCATCH, "tcplogdev", 0); > + if (rv) > + goto done; > + if (priv->tldi_head == NULL) > + continue; > + } > + > + /* > + * We have an entry to read. We want to try to create a > + * buffer, if one doesn't already exist. > + */ > + entry = priv->tldi_head; > + if (entry->tldq_buf == NULL) { > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > + buf = (*entry->tldq_xform)(entry); > + if (buf == NULL) { > + rv = EBUSY; > + goto done; > + } > + entry->tldq_buf = buf; > + } > + > + priv->tldi_cur = entry->tldq_buf; > + priv->tldi_off = 0; > + } > + > + /* Copy what we can from this buffer to the output buffer. */ > + if (uio->uio_resid > 0) { > + /* Drop locks so we can take page faults. */ > + if (lockstate == QUEUE_LOCKED) > + TCP_LOG_DEV_QUEUE_UNLOCK(); > + lockstate = QUEUE_UNLOCKED; > + > + KASSERT(priv->tldi_cur != NULL, > + ("%s: priv->tldi_cur is unexpectedly NULL", __func__)); > + > + /* Copy as much as we can to this uio. */ > + len = priv->tldi_cur->tlch_length - priv->tldi_off; > + if (len > uio->uio_resid) > + len = uio->uio_resid; > + rv = uiomove(((uint8_t *)priv->tldi_cur) + priv->tldi_off, > + len, uio); > + if (rv != 0) > + goto done; > + priv->tldi_off += len; > +#ifdef TCPLOG_DEBUG_COUNTERS > + counter_u64_add(tcp_log_que_read, len); > +#endif > + } > + /* Are we done with this buffer? If so, find the next one. */ > + if (priv->tldi_off >= priv->tldi_cur->tlch_length) { > + KASSERT(priv->tldi_off == priv->tldi_cur->tlch_length, > + ("%s: offset (%ju) exceeds length (%ju)", __func__, > + (uintmax_t)priv->tldi_off, > + (uintmax_t)priv->tldi_cur->tlch_length)); > + tcp_log_dev_rotate_bufs(priv, &lockstate); > + } > +done: > + tcp_log_dev_queue_validate_lock(lockstate); > + if (lockstate == QUEUE_LOCKED) > + TCP_LOG_DEV_QUEUE_UNLOCK(); > + return (rv); > +} > + > +static int > +tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data, > + int fflag __unused, struct thread *td __unused) > +{ > + struct tcp_log_dev_info *priv; > + int rv; > + > + /* Get our private info. */ > + rv = devfs_get_cdevpriv((void **)&priv); > + if (rv) > + return (rv); > + > + /* > + * Set things. Here, we are most concerned about the non-blocking I/O > + * flag. > + */ > + rv = 0; > + switch (cmd) { > + case FIONBIO: > + break; > + case FIOASYNC: > + if (*(int *)data != 0) > + rv = EINVAL; > + break; > + default: > + rv = ENOIOCTL; > + } > + return (rv); > +} > + > +static int > +tcp_log_dev_poll(struct cdev *dev __unused, int events, struct thread *td) > +{ > + struct tcp_log_dev_info *priv; > + int revents; > + > + /* > + * Get our private info. If this fails, claim that all events are > + * ready. That should prod the user to do something that will > + * make the error evident to them. > + */ > + if (devfs_get_cdevpriv((void **)&priv)) > + return (events); > + > + revents = 0; > + if (events & (POLLIN | POLLRDNORM)) { > + /* > + * We can (probably) read right now if we are partway through > + * a buffer or if we are just about to start a buffer. > + * Because we are going to read tldi_head, we should acquire > + * a read lock on the queue. > + */ > + TCP_LOG_DEV_QUEUE_LOCK(); > + if ((priv->tldi_head != NULL && priv->tldi_cur == NULL) || > + (priv->tldi_cur != NULL && > + priv->tldi_off < priv->tldi_cur->tlch_length)) > + revents = events & (POLLIN | POLLRDNORM); > + else > + selrecord(td, &tcp_log_sel); > + TCP_LOG_DEV_QUEUE_UNLOCK(); > + } else { > + /* > + * It only makes sense to poll for reading. So, again, prod the > + * user to do something that will make the error of their ways > + * apparent. > + */ > + revents = events; > + } > + return (revents); > +} > + > +int > +tcp_log_dev_add_log(struct tcp_log_dev_queue *entry) > +{ > + struct tcp_log_dev_info *priv; > + int rv; > + bool wakeup_needed; > + > + KASSERT(entry->tldq_buf != NULL || entry->tldq_xform != NULL, > + ("%s: Called with both tldq_buf and tldq_xform set to NULL", > + __func__)); > + KASSERT(entry->tldq_dtor != NULL, > + ("%s: Called with tldq_dtor set to NULL", __func__)); > + > + /* Get a lock on the queue. */ > + TCP_LOG_DEV_QUEUE_LOCK(); > + > + /* If no one is listening, tell the caller to free the resources. */ > + if (tcp_log_dev_listeners == 0) { > + rv = ENXIO; > + goto done; > + } > + > + /* Add this to the end of the tailq. */ > + STAILQ_INSERT_TAIL(&tcp_log_dev_queue_head, entry, tldq_queue); > + > + /* Add references for all current listeners. */ > + refcount_init(&entry->tldq_refcnt, tcp_log_dev_listeners); > + > + /* > + * If any listener is currently stuck on NULL, that means they are > + * waiting. Point their head to this new entry. > + */ > + wakeup_needed = false; > + STAILQ_FOREACH(priv, &tcp_log_dev_reader_head, tldi_list) > + if (priv->tldi_head == NULL) { > + priv->tldi_head = entry; > + wakeup_needed = true; > + } > + > + if (wakeup_needed) { > + selwakeup(&tcp_log_sel); > + wakeup(&tcp_log_dev_listeners); > + } > + > + rv = 0; > + > +done: > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > + TCP_LOG_DEV_QUEUE_UNLOCK(); > + return (rv); > +} > + > +static int > +tcp_log_dev_modevent(module_t mod __unused, int type, void *data __unused) > +{ > + > + /* TODO: Support intelligent unloading. */ > + switch (type) { > + case MOD_LOAD: > + if (bootverbose) > + printf("tcp_log: tcp_log device\n"); > + memset(&tcp_log_sel, 0, sizeof(tcp_log_sel)); > + memset(&tcp_log_dev_queue_lock, 0, sizeof(struct mtx)); > + mtx_init(&tcp_log_dev_queue_lock, "tcp_log dev", > + "tcp_log device queues", MTX_DEF); > + tcp_log_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, > + &tcp_log_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0400, > + "tcp_log"); > + break; > + default: > + return (EOPNOTSUPP); > + } > + > + return (0); > +} > + > +DEV_MODULE(tcp_log_dev, tcp_log_dev_modevent, NULL); > +MODULE_VERSION(tcp_log_dev, 1); > > Added: head/sys/dev/tcp_log/tcp_log_dev.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/tcp_log/tcp_log_dev.h Thu Mar 22 09:40:08 2018 (r331347) > @@ -0,0 +1,88 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2016 > + * Netflix Inc. All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +#ifndef __tcp_log_dev_h__ > +#define __tcp_log_dev_h__ > + > +/* > + * This is the common header for data streamed from the log device. All > + * blocks of data need to start with this header. > + */ > +struct tcp_log_common_header { > + uint32_t tlch_version; /* Version is specific to type. */ > + uint32_t tlch_type; /* Type of entry(ies) that follow. */ > + uint64_t tlch_length; /* Total length, including header. */ > +} __packed; > + > +#define TCP_LOG_DEV_TYPE_BBR 1 /* black box recorder */ > + > +#ifdef _KERNEL > +/* > + * This is a queue entry. All queue entries need to start with this structure > + * so the common code can cast them to this structure; however, other modules > + * are free to include additional data after this structure. > + * > + * The elements are explained here: > + * tldq_queue: used by the common code to maintain this entry's position in the > + * queue. > + * tldq_buf: should be NULL, or a pointer to a chunk of data. The data must be > + * as long as the common header indicates. > + * tldq_xform: If tldq_buf is NULL, the code will call this to create the > + * the tldq_buf object. The function should *not* directly modify tldq_buf, > + * but should return the buffer (which must meet the restrictions > + * indicated for tldq_buf). > + * tldq_dtor: This function is called to free the queue entry. If tldq_buf is > + * not NULL, the dtor function must free that, too. > + * tldq_refcnt: used by the common code to indicate how many readers still need > + * this data. > + */ > +struct tcp_log_dev_queue { > + STAILQ_ENTRY(tcp_log_dev_queue) tldq_queue; > + struct tcp_log_common_header *tldq_buf; > + struct tcp_log_common_header *(*tldq_xform)(struct tcp_log_dev_queue *entry); > + void (*tldq_dtor)(struct tcp_log_dev_queue *entry); > + volatile u_int tldq_refcnt; > +}; > + > +STAILQ_HEAD(log_queueh, tcp_log_dev_queue); > + > +struct tcp_log_dev_info { > + STAILQ_ENTRY(tcp_log_dev_info) tldi_list; > + struct tcp_log_dev_queue *tldi_head; > + struct tcp_log_common_header *tldi_cur; > + off_t tldi_off; > +}; > +STAILQ_HEAD(log_infoh, tcp_log_dev_info); > + > + > +MALLOC_DECLARE(M_TCPLOGDEV); > +int tcp_log_dev_add_log(struct tcp_log_dev_queue *entry); > +#endif /* _KERNEL */ > +#endif /* !__tcp_log_dev_h__ */ > > Modified: head/sys/kern/subr_witness.c > ============================================================================== > --- head/sys/kern/subr_witness.c Thu Mar 22 08:32:39 2018 (r331346) > +++ head/sys/kern/subr_witness.c Thu Mar 22 09:40:08 2018 (r331347) > @@ -640,6 +640,14 @@ static struct witness_order_list_entry order_lists[] = > { "db->db_mtx", &lock_class_sx }, > { NULL, NULL }, > /* > + * TCP log locks > + */ > + { "TCP ID tree", &lock_class_rw }, > + { "tcp log id bucket", &lock_class_mtx_sleep }, > + { "tcpinp", &lock_class_rw }, > + { "TCP log expireq", &lock_class_mtx_sleep }, > + { NULL, NULL }, > + /* > * spin locks > */ > #ifdef SMP > > Modified: head/sys/netinet/tcp.h > ============================================================================== > --- head/sys/netinet/tcp.h Thu Mar 22 08:32:39 2018 (r331346) > +++ head/sys/netinet/tcp.h Thu Mar 22 09:40:08 2018 (r331347) > @@ -168,6 +168,12 @@ struct tcphdr { > #define TCP_NOOPT 8 /* don't use TCP options */ > #define TCP_MD5SIG 16 /* use MD5 digests (RFC2385) */ > #define TCP_INFO 32 /* retrieve tcp_info structure */ > +#define TCP_LOG 34 /* configure event logging for connection */ > +#define TCP_LOGBUF 35 /* retrieve event log for connection */ > +#define TCP_LOGID 36 /* configure log ID to correlate connections */ > +#define TCP_LOGDUMP 37 /* dump connection log events to device */ > +#define TCP_LOGDUMPID 38 /* dump events from connections with same ID to > + device */ > #define TCP_CONGESTION 64 /* get/set congestion control algorithm */ > #define TCP_CCALGOOPT 65 /* get/set cc algorithm specific options */ > #define TCP_KEEPINIT 128 /* N, time to establish connection */ > @@ -188,6 +194,9 @@ struct tcphdr { > #define TCPI_OPT_WSCALE 0x04 > #define TCPI_OPT_ECN 0x08 > #define TCPI_OPT_TOE 0x10 > + > +/* Maximum length of log ID. */ > +#define TCP_LOG_ID_LEN 64 > > /* > * The TCP_INFO socket option comes from the Linux 2.6 TCP API, and permits > > Modified: head/sys/netinet/tcp_input.c > ============================================================================== > --- head/sys/netinet/tcp_input.c Thu Mar 22 08:32:39 2018 (r331346) > +++ head/sys/netinet/tcp_input.c Thu Mar 22 09:40:08 2018 (r331347) > @@ -102,6 +102,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -1592,6 +1593,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru > /* Save segment, if requested. */ > tcp_pcap_add(th, m, &(tp->t_inpkts)); > #endif > + TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0, > + tlen, NULL, true); > > if ((thflags & TH_SYN) && (thflags & TH_FIN) && V_drop_synfin) { > if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { > > Added: head/sys/netinet/tcp_log_buf.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/netinet/tcp_log_buf.c Thu Mar 22 09:40:08 2018 (r331347) > @@ -0,0 +1,2480 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2016-2018 > + * Netflix Inc. All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > + > +/* Default expiry time */ > +#define TCP_LOG_EXPIRE_TIME ((sbintime_t)60 * SBT_1S) > + > +/* Max interval at which to run the expiry timer */ > +#define TCP_LOG_EXPIRE_INTVL ((sbintime_t)5 * SBT_1S) > + > +bool tcp_log_verbose; > +static uma_zone_t tcp_log_bucket_zone, tcp_log_node_zone, tcp_log_zone; > +static int tcp_log_session_limit = TCP_LOG_BUF_DEFAULT_SESSION_LIMIT; > +static uint32_t tcp_log_version = TCP_LOG_BUF_VER; > +RB_HEAD(tcp_log_id_tree, tcp_log_id_bucket); > +static struct tcp_log_id_tree tcp_log_id_head; > +static STAILQ_HEAD(, tcp_log_id_node) tcp_log_expireq_head = > + STAILQ_HEAD_INITIALIZER(tcp_log_expireq_head); > +static struct mtx tcp_log_expireq_mtx; > +static struct callout tcp_log_expireq_callout; > +static uint64_t tcp_log_auto_ratio = 0; > +static uint64_t tcp_log_auto_ratio_cur = 0; > +static uint32_t tcp_log_auto_mode = TCP_LOG_STATE_TAIL; > +static bool tcp_log_auto_all = false; > + > +RB_PROTOTYPE_STATIC(tcp_log_id_tree, tcp_log_id_bucket, tlb_rb, tcp_log_id_cmp) > + > +SYSCTL_NODE(_net_inet_tcp, OID_AUTO, bb, CTLFLAG_RW, 0, "TCP Black Box controls"); > + > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_verbose, CTLFLAG_RW, &tcp_log_verbose, > + 0, "Force verbose logging for TCP traces"); > + > +SYSCTL_INT(_net_inet_tcp_bb, OID_AUTO, log_session_limit, > + CTLFLAG_RW, &tcp_log_session_limit, 0, > + "Maximum number of events maintained for each TCP session"); > + > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_global_limit, CTLFLAG_RW, > + &tcp_log_zone, "Maximum number of events maintained for all TCP sessions"); > + > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_global_entries, CTLFLAG_RD, > + &tcp_log_zone, "Current number of events maintained for all TCP sessions"); > + > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_limit, CTLFLAG_RW, > + &tcp_log_bucket_zone, "Maximum number of log IDs"); > + > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_entries, CTLFLAG_RD, > + &tcp_log_bucket_zone, "Current number of log IDs"); > + > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_limit, CTLFLAG_RW, > + &tcp_log_node_zone, "Maximum number of tcpcbs with log IDs"); > + > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_entries, CTLFLAG_RD, > + &tcp_log_node_zone, "Current number of tcpcbs with log IDs"); > + > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_version, CTLFLAG_RD, &tcp_log_version, > + 0, "Version of log formats exported"); > + > +SYSCTL_U64(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW, > + &tcp_log_auto_ratio, 0, "Do auto capturing for 1 out of N sessions"); > + > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_auto_mode, CTLFLAG_RW, > + &tcp_log_auto_mode, TCP_LOG_STATE_HEAD_AUTO, > + "Logging mode for auto-selected sessions (default is TCP_LOG_STATE_HEAD_AUTO)"); > + > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_auto_all, CTLFLAG_RW, > + &tcp_log_auto_all, false, > + "Auto-select from all sessions (rather than just those with IDs)"); > + > +#ifdef TCPLOG_DEBUG_COUNTERS > +counter_u64_t tcp_log_queued; > +counter_u64_t tcp_log_que_fail1; > +counter_u64_t tcp_log_que_fail2; > +counter_u64_t tcp_log_que_fail3; > +counter_u64_t tcp_log_que_fail4; > +counter_u64_t tcp_log_que_fail5; > +counter_u64_t tcp_log_que_copyout; > +counter_u64_t tcp_log_que_read; > +counter_u64_t tcp_log_que_freed; > + > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, queued, CTLFLAG_RD, > + &tcp_log_queued, "Number of entries queued"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail1, CTLFLAG_RD, > + &tcp_log_que_fail1, "Number of entries queued but fail 1"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail2, CTLFLAG_RD, > + &tcp_log_que_fail2, "Number of entries queued but fail 2"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail3, CTLFLAG_RD, > + &tcp_log_que_fail3, "Number of entries queued but fail 3"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail4, CTLFLAG_RD, > + &tcp_log_que_fail4, "Number of entries queued but fail 4"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail5, CTLFLAG_RD, > + &tcp_log_que_fail5, "Number of entries queued but fail 4"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, copyout, CTLFLAG_RD, > + &tcp_log_que_copyout, "Number of entries copied out"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, read, CTLFLAG_RD, > + &tcp_log_que_read, "Number of entries read from the queue"); > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, freed, CTLFLAG_RD, > + &tcp_log_que_freed, "Number of entries freed after reading"); > +#endif > + > +#ifdef INVARIANTS > +#define TCPLOG_DEBUG_RINGBUF > +#endif > + > +struct tcp_log_mem > +{ > + STAILQ_ENTRY(tcp_log_mem) tlm_queue; > + struct tcp_log_buffer tlm_buf; > + struct tcp_log_verbose tlm_v; > +#ifdef TCPLOG_DEBUG_RINGBUF > + volatile int tlm_refcnt; > +#endif > +}; > + > +/* 60 bytes for the header, + 16 bytes for padding */ > +static uint8_t zerobuf[76]; > + > +/* > + * Lock order: > + * 1. TCPID_TREE > + * 2. TCPID_BUCKET > + * 3. INP > + * > + * Rules: > + * A. You need a lock on the Tree to add/remove buckets. > + * B. You need a lock on the bucket to add/remove nodes from the bucket. > + * C. To change information in a node, you need the INP lock if the tln_closed > + * field is false. Otherwise, you need the bucket lock. (Note that the > + * tln_closed field can change at any point, so you need to recheck the > + * entry after acquiring the INP lock.) > + * D. To remove a node from the bucket, you must have that entry locked, > + * according to the criteria of Rule C. Also, the node must not be on > + * the expiry queue. > + * E. The exception to C is the expiry queue fields, which are locked by > + * the TCPLOG_EXPIREQ lock. > + * > + * Buckets have a reference count. Each node is a reference. Further, > + * other callers may add reference counts to keep a bucket from disappearing. > + * You can add a reference as long as you own a lock sufficient to keep the > + * bucket from disappearing. For example, a common use is: > + * a. Have a locked INP, but need to lock the TCPID_BUCKET. > + * b. Add a refcount on the bucket. (Safe because the INP lock prevents > + * the TCPID_BUCKET from going away.) > + * c. Drop the INP lock. > + * d. Acquire a lock on the TCPID_BUCKET. > + * e. Acquire a lock on the INP. > + * f. Drop the refcount on the bucket. > + * (At this point, the bucket may disappear.) > + * > + * Expire queue lock: > + * You can acquire this with either the bucket or INP lock. Don't reverse it. > + * When the expire code has committed to freeing a node, it resets the expiry > + * time to SBT_MAX. That is the signal to everyone else that they should > + * leave that node alone. > + */ > +static struct rwlock tcp_id_tree_lock; > +#define TCPID_TREE_WLOCK() rw_wlock(&tcp_id_tree_lock) > +#define TCPID_TREE_RLOCK() rw_rlock(&tcp_id_tree_lock) > +#define TCPID_TREE_UPGRADE() rw_try_upgrade(&tcp_id_tree_lock) > +#define TCPID_TREE_WUNLOCK() rw_wunlock(&tcp_id_tree_lock) > +#define TCPID_TREE_RUNLOCK() rw_runlock(&tcp_id_tree_lock) > +#define TCPID_TREE_WLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_WLOCKED) > +#define TCPID_TREE_RLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_RLOCKED) > +#define TCPID_TREE_UNLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_UNLOCKED) > + > +#define TCPID_BUCKET_LOCK_INIT(tlb) mtx_init(&((tlb)->tlb_mtx), "tcp log id bucket", NULL, MTX_DEF) > +#define TCPID_BUCKET_LOCK_DESTROY(tlb) mtx_destroy(&((tlb)->tlb_mtx)) > +#define TCPID_BUCKET_LOCK(tlb) mtx_lock(&((tlb)->tlb_mtx)) > +#define TCPID_BUCKET_UNLOCK(tlb) mtx_unlock(&((tlb)->tlb_mtx)) > +#define TCPID_BUCKET_LOCK_ASSERT(tlb) mtx_assert(&((tlb)->tlb_mtx), MA_OWNED) > +#define TCPID_BUCKET_UNLOCK_ASSERT(tlb) mtx_assert(&((tlb)->tlb_mtx), MA_NOTOWNED) > + > +#define TCPID_BUCKET_REF(tlb) refcount_acquire(&((tlb)->tlb_refcnt)) > +#define TCPID_BUCKET_UNREF(tlb) refcount_release(&((tlb)->tlb_refcnt)) > + > +#define TCPLOG_EXPIREQ_LOCK() mtx_lock(&tcp_log_expireq_mtx) > +#define TCPLOG_EXPIREQ_UNLOCK() mtx_unlock(&tcp_log_expireq_mtx) > + > +SLIST_HEAD(tcp_log_id_head, tcp_log_id_node); > + > +struct tcp_log_id_bucket > +{ > + /* > + * tlb_id must be first. This lets us use strcmp on > + * (struct tcp_log_id_bucket *) and (char *) interchangeably. > + */ > + char tlb_id[TCP_LOG_ID_LEN]; > + RB_ENTRY(tcp_log_id_bucket) tlb_rb; > + struct tcp_log_id_head tlb_head; > + struct mtx tlb_mtx; > + volatile u_int tlb_refcnt; > +}; > + > +struct tcp_log_id_node > +{ > + SLIST_ENTRY(tcp_log_id_node) tln_list; > + STAILQ_ENTRY(tcp_log_id_node) tln_expireq; /* Locked by the expireq lock */ > + sbintime_t tln_expiretime; /* Locked by the expireq lock */ > + > + /* > + * If INP is NULL, that means the connection has closed. We've > + * saved the connection endpoint information and the log entries > + * in the tln_ie and tln_entries members. We've also saved a pointer > + * to the enclosing bucket here. If INP is not NULL, the information is > + * in the PCB and not here. > + */ > + struct inpcb *tln_inp; > + struct tcpcb *tln_tp; > + struct tcp_log_id_bucket *tln_bucket; > + struct in_endpoints tln_ie; > + struct tcp_log_stailq tln_entries; > + int tln_count; > + volatile int tln_closed; > + uint8_t tln_af; > +}; > + > +enum tree_lock_state { > + TREE_UNLOCKED = 0, > + TREE_RLOCKED, > + TREE_WLOCKED, > +}; > + > +/* Do we want to select this session for auto-logging? */ > +static __inline bool > +tcp_log_selectauto(void) > +{ > + > + /* > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-head@freebsd.org Thu Mar 22 14:31:25 2018 Return-Path: Delivered-To: svn-src-head@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 5CB10F6C6F8; Thu, 22 Mar 2018 14:31:25 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-42.csi.cam.ac.uk (ppsw-42.csi.cam.ac.uk [131.111.8.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF0EF7787D; Thu, 22 Mar 2018 14:31:24 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:59942) by ppsw-42.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1ez1FT-0004R6-8Q (Exim 4.89_2) (return-path ); Thu, 22 Mar 2018 14:31:23 +0000 Date: Thu, 22 Mar 2018 14:22:25 +0000 From: Ruslan Bukin To: "Jonathan T. Looney" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat Message-ID: <20180322142225.GA5139@bsdpad.com> References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180322141606.GA4972@bsdpad.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 14:31:25 -0000 Also can this be pluggable ? It looks like it is optional device which means it can free up some space in embedded environment when unused Ruslan On Thu, Mar 22, 2018 at 02:16:06PM +0000, Ruslan Bukin wrote: > We don't have atomic_fetchadd_64 for mips32 I think > > Ruslan > > On Thu, Mar 22, 2018 at 09:40:08AM +0000, Jonathan T. Looney wrote: > > Author: jtl > > Date: Thu Mar 22 09:40:08 2018 > > New Revision: 331347 > > URL: https://svnweb.freebsd.org/changeset/base/331347 > > > > Log: > > Add the "TCP Blackbox Recorder" which we discussed at the developer > > summits at BSDCan and BSDCam in 2017. > > > > The TCP Blackbox Recorder allows you to capture events on a TCP connection > > in a ring buffer. It stores metadata with the event. It optionally stores > > the TCP header associated with an event (if the event is associated with a > > packet) and also optionally stores information on the sockets. > > > > It supports setting a log ID on a TCP connection and using this to correlate > > multiple connections that share a common log ID. > > > > You can log connections in different modes. If you are doing a coordinated > > test with a particular connection, you may tell the system to put it in > > mode 4 (continuous dump). Or, if you just want to monitor for errors, you > > can put it in mode 1 (ring buffer) and dump all the ring buffers associated > > with the connection ID when we receive an error signal for that connection > > ID. You can set a default mode that will be applied to a particular ratio > > of incoming connections. You can also manually set a mode using a socket > > option. > > > > This commit includes only basic probes. rrs@ has added quite an abundance > > of probes in his TCP development work. He plans to commit those soon. > > > > There are user-space programs which we plan to commit as ports. These read > > the data from the log device and output pcapng files, and then let you > > analyze the data (and metadata) in the pcapng files. > > > > Reviewed by: gnn (previous version) > > Obtained from: Netflix, Inc. > > Relnotes: yes > > Differential Revision: https://reviews.freebsd.org/D11085 > > > > Added: > > head/sys/dev/tcp_log/ > > head/sys/dev/tcp_log/tcp_log_dev.c (contents, props changed) > > head/sys/dev/tcp_log/tcp_log_dev.h (contents, props changed) > > head/sys/netinet/tcp_log_buf.c (contents, props changed) > > head/sys/netinet/tcp_log_buf.h (contents, props changed) > > Modified: > > head/etc/mtree/BSD.include.dist > > head/include/Makefile > > head/sys/conf/files > > head/sys/kern/subr_witness.c > > head/sys/netinet/tcp.h > > head/sys/netinet/tcp_input.c > > head/sys/netinet/tcp_output.c > > head/sys/netinet/tcp_subr.c > > head/sys/netinet/tcp_timer.c > > head/sys/netinet/tcp_usrreq.c > > head/sys/netinet/tcp_var.h > > head/usr.bin/netstat/inet.c > > head/usr.bin/netstat/main.c > > head/usr.bin/netstat/netstat.1 > > head/usr.bin/netstat/netstat.h > > > > Modified: head/etc/mtree/BSD.include.dist > > ============================================================================== > > --- head/etc/mtree/BSD.include.dist Thu Mar 22 08:32:39 2018 (r331346) > > +++ head/etc/mtree/BSD.include.dist Thu Mar 22 09:40:08 2018 (r331347) > > @@ -158,6 +158,8 @@ > > .. > > speaker > > .. > > + tcp_log > > + .. > > usb > > .. > > vkbd > > > > Modified: head/include/Makefile > > ============================================================================== > > --- head/include/Makefile Thu Mar 22 08:32:39 2018 (r331346) > > +++ head/include/Makefile Thu Mar 22 09:40:08 2018 (r331347) > > @@ -47,7 +47,7 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ > > dev/hwpmc dev/hyperv \ > > dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ > > dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ > > - dev/speaker dev/vkbd dev/wi \ > > + dev/speaker dev/tcp_log dev/vkbd dev/wi \ > > fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ > > fs/procfs fs/smbfs fs/udf fs/unionfs \ > > geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ > > > > Modified: head/sys/conf/files > > ============================================================================== > > --- head/sys/conf/files Thu Mar 22 08:32:39 2018 (r331346) > > +++ head/sys/conf/files Thu Mar 22 09:40:08 2018 (r331347) > > @@ -3161,6 +3161,7 @@ dev/syscons/star/star_saver.c optional star_saver > > dev/syscons/syscons.c optional sc > > dev/syscons/sysmouse.c optional sc > > dev/syscons/warp/warp_saver.c optional warp_saver > > +dev/tcp_log/tcp_log_dev.c optional inet | inet6 > > dev/tdfx/tdfx_linux.c optional tdfx_linux tdfx compat_linux > > dev/tdfx/tdfx_pci.c optional tdfx pci > > dev/ti/if_ti.c optional ti pci > > @@ -4309,6 +4310,7 @@ netinet/tcp_debug.c optional tcpdebug > > netinet/tcp_fastopen.c optional inet tcp_rfc7413 | inet6 tcp_rfc7413 > > netinet/tcp_hostcache.c optional inet | inet6 > > netinet/tcp_input.c optional inet | inet6 > > +netinet/tcp_log_buf.c optional inet | inet6 > > netinet/tcp_lro.c optional inet | inet6 > > netinet/tcp_output.c optional inet | inet6 > > netinet/tcp_offload.c optional tcp_offload inet | tcp_offload inet6 > > > > Added: head/sys/dev/tcp_log/tcp_log_dev.c > > ============================================================================== > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/sys/dev/tcp_log/tcp_log_dev.c Thu Mar 22 09:40:08 2018 (r331347) > > @@ -0,0 +1,521 @@ > > +/*- > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > + * > > + * Copyright (c) 2016-2017 > > + * Netflix Inc. All rights reserved. > > + * > > + * Redistribution and use in source and binary forms, with or without > > + * modification, are permitted provided that the following conditions > > + * are met: > > + * 1. Redistributions of source code must retain the above copyright > > + * notice, this list of conditions and the following disclaimer. > > + * 2. Redistributions in binary form must reproduce the above copyright > > + * notice, this list of conditions and the following disclaimer in the > > + * documentation and/or other materials provided with the distribution. > > + * > > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > > + * SUCH DAMAGE. > > + * > > + */ > > + > > +#include > > +__FBSDID("$FreeBSD$"); > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > + > > +#ifdef TCPLOG_DEBUG_COUNTERS > > +extern counter_u64_t tcp_log_que_read; > > +extern counter_u64_t tcp_log_que_freed; > > +#endif > > + > > +static struct cdev *tcp_log_dev; > > +static struct selinfo tcp_log_sel; > > + > > +static struct log_queueh tcp_log_dev_queue_head = STAILQ_HEAD_INITIALIZER(tcp_log_dev_queue_head); > > +static struct log_infoh tcp_log_dev_reader_head = STAILQ_HEAD_INITIALIZER(tcp_log_dev_reader_head); > > + > > +MALLOC_DEFINE(M_TCPLOGDEV, "tcp_log_dev", "TCP log device data structures"); > > + > > +static int tcp_log_dev_listeners = 0; > > + > > +static struct mtx tcp_log_dev_queue_lock; > > + > > +#define TCP_LOG_DEV_QUEUE_LOCK() mtx_lock(&tcp_log_dev_queue_lock) > > +#define TCP_LOG_DEV_QUEUE_UNLOCK() mtx_unlock(&tcp_log_dev_queue_lock) > > +#define TCP_LOG_DEV_QUEUE_LOCK_ASSERT() mtx_assert(&tcp_log_dev_queue_lock, MA_OWNED) > > +#define TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT() mtx_assert(&tcp_log_dev_queue_lock, MA_NOTOWNED) > > +#define TCP_LOG_DEV_QUEUE_REF(tldq) refcount_acquire(&((tldq)->tldq_refcnt)) > > +#define TCP_LOG_DEV_QUEUE_UNREF(tldq) refcount_release(&((tldq)->tldq_refcnt)) > > + > > +static void tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry); > > +static void tcp_log_dev_clear_cdevpriv(void *data); > > +static int tcp_log_dev_open(struct cdev *dev __unused, int flags, > > + int devtype __unused, struct thread *td __unused); > > +static int tcp_log_dev_write(struct cdev *dev __unused, > > + struct uio *uio __unused, int flags __unused); > > +static int tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, > > + int flags __unused); > > +static int tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, > > + caddr_t data, int fflag __unused, struct thread *td __unused); > > +static int tcp_log_dev_poll(struct cdev *dev __unused, int events, > > + struct thread *td); > > + > > + > > +enum tcp_log_dev_queue_lock_state { > > + QUEUE_UNLOCKED = 0, > > + QUEUE_LOCKED, > > +}; > > + > > +static struct cdevsw tcp_log_cdevsw = { > > + .d_version = D_VERSION, > > + .d_read = tcp_log_dev_read, > > + .d_open = tcp_log_dev_open, > > + .d_write = tcp_log_dev_write, > > + .d_poll = tcp_log_dev_poll, > > + .d_ioctl = tcp_log_dev_ioctl, > > +#ifdef NOTYET > > + .d_mmap = tcp_log_dev_mmap, > > +#endif > > + .d_name = "tcp_log", > > +}; > > + > > +static __inline void > > +tcp_log_dev_queue_validate_lock(int lockstate) > > +{ > > + > > +#ifdef INVARIANTS > > + switch (lockstate) { > > + case QUEUE_LOCKED: > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > + break; > > + case QUEUE_UNLOCKED: > > + TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT(); > > + break; > > + default: > > + kassert_panic("%s:%d: unknown queue lock state", __func__, > > + __LINE__); > > + } > > +#endif > > +} > > + > > +/* > > + * Clear the refcount. If appropriate, it will remove the entry from the > > + * queue and call the destructor. > > + * > > + * This must be called with the queue lock held. > > + */ > > +static void > > +tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry) > > +{ > > + > > + KASSERT(entry != NULL, ("%s: called with NULL entry", __func__)); > > + > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > + > > + if (TCP_LOG_DEV_QUEUE_UNREF(entry)) { > > +#ifdef TCPLOG_DEBUG_COUNTERS > > + counter_u64_add(tcp_log_que_freed, 1); > > +#endif > > + /* Remove the entry from the queue and call the destructor. */ > > + STAILQ_REMOVE(&tcp_log_dev_queue_head, entry, tcp_log_dev_queue, > > + tldq_queue); > > + (*entry->tldq_dtor)(entry); > > + } > > +} > > + > > +static void > > +tcp_log_dev_clear_cdevpriv(void *data) > > +{ > > + struct tcp_log_dev_info *priv; > > + struct tcp_log_dev_queue *entry, *entry_tmp; > > + > > + priv = (struct tcp_log_dev_info *)data; > > + if (priv == NULL) > > + return; > > + > > + /* > > + * Lock the queue and drop our references. We hold references to all > > + * the entries starting with tldi_head (or, if tldi_head == NULL, all > > + * entries in the queue). > > + * > > + * Because we don't want anyone adding addition things to the queue > > + * while we are doing this, we lock the queue. > > + */ > > + TCP_LOG_DEV_QUEUE_LOCK(); > > + if (priv->tldi_head != NULL) { > > + entry = priv->tldi_head; > > + STAILQ_FOREACH_FROM_SAFE(entry, &tcp_log_dev_queue_head, > > + tldq_queue, entry_tmp) { > > + tcp_log_dev_clear_refcount(entry); > > + } > > + } > > + tcp_log_dev_listeners--; > > + KASSERT(tcp_log_dev_listeners >= 0, > > + ("%s: tcp_log_dev_listeners is unexpectedly negative", __func__)); > > + STAILQ_REMOVE(&tcp_log_dev_reader_head, priv, tcp_log_dev_info, > > + tldi_list); > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > + free(priv, M_TCPLOGDEV); > > +} > > + > > +static int > > +tcp_log_dev_open(struct cdev *dev __unused, int flags, int devtype __unused, > > + struct thread *td __unused) > > +{ > > + struct tcp_log_dev_info *priv; > > + struct tcp_log_dev_queue *entry; > > + int rv; > > + > > + /* > > + * Ideally, we shouldn't see these because of file system > > + * permissions. > > + */ > > + if (flags & (FWRITE | FEXEC | FAPPEND | O_TRUNC)) > > + return (ENODEV); > > + > > + /* Allocate space to hold information about where we are. */ > > + priv = malloc(sizeof(struct tcp_log_dev_info), M_TCPLOGDEV, > > + M_ZERO | M_WAITOK); > > + > > + /* Stash the private data away. */ > > + rv = devfs_set_cdevpriv((void *)priv, tcp_log_dev_clear_cdevpriv); > > + if (!rv) { > > + /* > > + * Increase the listener count, add this reader to the list, and > > + * take references on all current queues. > > + */ > > + TCP_LOG_DEV_QUEUE_LOCK(); > > + tcp_log_dev_listeners++; > > + STAILQ_INSERT_HEAD(&tcp_log_dev_reader_head, priv, tldi_list); > > + priv->tldi_head = STAILQ_FIRST(&tcp_log_dev_queue_head); > > + if (priv->tldi_head != NULL) > > + priv->tldi_cur = priv->tldi_head->tldq_buf; > > + STAILQ_FOREACH(entry, &tcp_log_dev_queue_head, tldq_queue) > > + TCP_LOG_DEV_QUEUE_REF(entry); > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > + } else { > > + /* Free the entry. */ > > + free(priv, M_TCPLOGDEV); > > + } > > + return (rv); > > +} > > + > > +static int > > +tcp_log_dev_write(struct cdev *dev __unused, struct uio *uio __unused, > > + int flags __unused) > > +{ > > + > > + return (ENODEV); > > +} > > + > > +static __inline void > > +tcp_log_dev_rotate_bufs(struct tcp_log_dev_info *priv, int *lockstate) > > +{ > > + struct tcp_log_dev_queue *entry; > > + > > + KASSERT(priv->tldi_head != NULL, > > + ("%s:%d: priv->tldi_head unexpectedly NULL", > > + __func__, __LINE__)); > > + KASSERT(priv->tldi_head->tldq_buf == priv->tldi_cur, > > + ("%s:%d: buffer mismatch (%p vs %p)", > > + __func__, __LINE__, priv->tldi_head->tldq_buf, > > + priv->tldi_cur)); > > + tcp_log_dev_queue_validate_lock(*lockstate); > > + > > + if (*lockstate == QUEUE_UNLOCKED) { > > + TCP_LOG_DEV_QUEUE_LOCK(); > > + *lockstate = QUEUE_LOCKED; > > + } > > + entry = priv->tldi_head; > > + priv->tldi_head = STAILQ_NEXT(entry, tldq_queue); > > + tcp_log_dev_clear_refcount(entry); > > + priv->tldi_cur = NULL; > > +} > > + > > +static int > > +tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, int flags) > > +{ > > + struct tcp_log_common_header *buf; > > + struct tcp_log_dev_info *priv; > > + struct tcp_log_dev_queue *entry; > > + ssize_t len; > > + int lockstate, rv; > > + > > + /* Get our private info. */ > > + rv = devfs_get_cdevpriv((void **)&priv); > > + if (rv) > > + return (rv); > > + > > + lockstate = QUEUE_UNLOCKED; > > + > > + /* Do we need to get a new buffer? */ > > + while (priv->tldi_cur == NULL || > > + priv->tldi_cur->tlch_length <= priv->tldi_off) { > > + /* Did we somehow forget to rotate? */ > > + KASSERT(priv->tldi_cur == NULL, > > + ("%s:%d: tldi_cur is unexpectedly non-NULL", __func__, > > + __LINE__)); > > + if (priv->tldi_cur != NULL) > > + tcp_log_dev_rotate_bufs(priv, &lockstate); > > + > > + /* > > + * Before we start looking at tldi_head, we need a lock on the > > + * queue to make sure tldi_head stays stable. > > + */ > > + if (lockstate == QUEUE_UNLOCKED) { > > + TCP_LOG_DEV_QUEUE_LOCK(); > > + lockstate = QUEUE_LOCKED; > > + } > > + > > + /* We need the next buffer. Do we have one? */ > > + if (priv->tldi_head == NULL && (flags & FNONBLOCK)) { > > + rv = EAGAIN; > > + goto done; > > + } > > + if (priv->tldi_head == NULL) { > > + /* Sleep and wait for more things we can read. */ > > + rv = mtx_sleep(&tcp_log_dev_listeners, > > + &tcp_log_dev_queue_lock, PCATCH, "tcplogdev", 0); > > + if (rv) > > + goto done; > > + if (priv->tldi_head == NULL) > > + continue; > > + } > > + > > + /* > > + * We have an entry to read. We want to try to create a > > + * buffer, if one doesn't already exist. > > + */ > > + entry = priv->tldi_head; > > + if (entry->tldq_buf == NULL) { > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > + buf = (*entry->tldq_xform)(entry); > > + if (buf == NULL) { > > + rv = EBUSY; > > + goto done; > > + } > > + entry->tldq_buf = buf; > > + } > > + > > + priv->tldi_cur = entry->tldq_buf; > > + priv->tldi_off = 0; > > + } > > + > > + /* Copy what we can from this buffer to the output buffer. */ > > + if (uio->uio_resid > 0) { > > + /* Drop locks so we can take page faults. */ > > + if (lockstate == QUEUE_LOCKED) > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > + lockstate = QUEUE_UNLOCKED; > > + > > + KASSERT(priv->tldi_cur != NULL, > > + ("%s: priv->tldi_cur is unexpectedly NULL", __func__)); > > + > > + /* Copy as much as we can to this uio. */ > > + len = priv->tldi_cur->tlch_length - priv->tldi_off; > > + if (len > uio->uio_resid) > > + len = uio->uio_resid; > > + rv = uiomove(((uint8_t *)priv->tldi_cur) + priv->tldi_off, > > + len, uio); > > + if (rv != 0) > > + goto done; > > + priv->tldi_off += len; > > +#ifdef TCPLOG_DEBUG_COUNTERS > > + counter_u64_add(tcp_log_que_read, len); > > +#endif > > + } > > + /* Are we done with this buffer? If so, find the next one. */ > > + if (priv->tldi_off >= priv->tldi_cur->tlch_length) { > > + KASSERT(priv->tldi_off == priv->tldi_cur->tlch_length, > > + ("%s: offset (%ju) exceeds length (%ju)", __func__, > > + (uintmax_t)priv->tldi_off, > > + (uintmax_t)priv->tldi_cur->tlch_length)); > > + tcp_log_dev_rotate_bufs(priv, &lockstate); > > + } > > +done: > > + tcp_log_dev_queue_validate_lock(lockstate); > > + if (lockstate == QUEUE_LOCKED) > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > + return (rv); > > +} > > + > > +static int > > +tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data, > > + int fflag __unused, struct thread *td __unused) > > +{ > > + struct tcp_log_dev_info *priv; > > + int rv; > > + > > + /* Get our private info. */ > > + rv = devfs_get_cdevpriv((void **)&priv); > > + if (rv) > > + return (rv); > > + > > + /* > > + * Set things. Here, we are most concerned about the non-blocking I/O > > + * flag. > > + */ > > + rv = 0; > > + switch (cmd) { > > + case FIONBIO: > > + break; > > + case FIOASYNC: > > + if (*(int *)data != 0) > > + rv = EINVAL; > > + break; > > + default: > > + rv = ENOIOCTL; > > + } > > + return (rv); > > +} > > + > > +static int > > +tcp_log_dev_poll(struct cdev *dev __unused, int events, struct thread *td) > > +{ > > + struct tcp_log_dev_info *priv; > > + int revents; > > + > > + /* > > + * Get our private info. If this fails, claim that all events are > > + * ready. That should prod the user to do something that will > > + * make the error evident to them. > > + */ > > + if (devfs_get_cdevpriv((void **)&priv)) > > + return (events); > > + > > + revents = 0; > > + if (events & (POLLIN | POLLRDNORM)) { > > + /* > > + * We can (probably) read right now if we are partway through > > + * a buffer or if we are just about to start a buffer. > > + * Because we are going to read tldi_head, we should acquire > > + * a read lock on the queue. > > + */ > > + TCP_LOG_DEV_QUEUE_LOCK(); > > + if ((priv->tldi_head != NULL && priv->tldi_cur == NULL) || > > + (priv->tldi_cur != NULL && > > + priv->tldi_off < priv->tldi_cur->tlch_length)) > > + revents = events & (POLLIN | POLLRDNORM); > > + else > > + selrecord(td, &tcp_log_sel); > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > + } else { > > + /* > > + * It only makes sense to poll for reading. So, again, prod the > > + * user to do something that will make the error of their ways > > + * apparent. > > + */ > > + revents = events; > > + } > > + return (revents); > > +} > > + > > +int > > +tcp_log_dev_add_log(struct tcp_log_dev_queue *entry) > > +{ > > + struct tcp_log_dev_info *priv; > > + int rv; > > + bool wakeup_needed; > > + > > + KASSERT(entry->tldq_buf != NULL || entry->tldq_xform != NULL, > > + ("%s: Called with both tldq_buf and tldq_xform set to NULL", > > + __func__)); > > + KASSERT(entry->tldq_dtor != NULL, > > + ("%s: Called with tldq_dtor set to NULL", __func__)); > > + > > + /* Get a lock on the queue. */ > > + TCP_LOG_DEV_QUEUE_LOCK(); > > + > > + /* If no one is listening, tell the caller to free the resources. */ > > + if (tcp_log_dev_listeners == 0) { > > + rv = ENXIO; > > + goto done; > > + } > > + > > + /* Add this to the end of the tailq. */ > > + STAILQ_INSERT_TAIL(&tcp_log_dev_queue_head, entry, tldq_queue); > > + > > + /* Add references for all current listeners. */ > > + refcount_init(&entry->tldq_refcnt, tcp_log_dev_listeners); > > + > > + /* > > + * If any listener is currently stuck on NULL, that means they are > > + * waiting. Point their head to this new entry. > > + */ > > + wakeup_needed = false; > > + STAILQ_FOREACH(priv, &tcp_log_dev_reader_head, tldi_list) > > + if (priv->tldi_head == NULL) { > > + priv->tldi_head = entry; > > + wakeup_needed = true; > > + } > > + > > + if (wakeup_needed) { > > + selwakeup(&tcp_log_sel); > > + wakeup(&tcp_log_dev_listeners); > > + } > > + > > + rv = 0; > > + > > +done: > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > + return (rv); > > +} > > + > > +static int > > +tcp_log_dev_modevent(module_t mod __unused, int type, void *data __unused) > > +{ > > + > > + /* TODO: Support intelligent unloading. */ > > + switch (type) { > > + case MOD_LOAD: > > + if (bootverbose) > > + printf("tcp_log: tcp_log device\n"); > > + memset(&tcp_log_sel, 0, sizeof(tcp_log_sel)); > > + memset(&tcp_log_dev_queue_lock, 0, sizeof(struct mtx)); > > + mtx_init(&tcp_log_dev_queue_lock, "tcp_log dev", > > + "tcp_log device queues", MTX_DEF); > > + tcp_log_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, > > + &tcp_log_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0400, > > + "tcp_log"); > > + break; > > + default: > > + return (EOPNOTSUPP); > > + } > > + > > + return (0); > > +} > > + > > +DEV_MODULE(tcp_log_dev, tcp_log_dev_modevent, NULL); > > +MODULE_VERSION(tcp_log_dev, 1); > > > > Added: head/sys/dev/tcp_log/tcp_log_dev.h > > ============================================================================== > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/sys/dev/tcp_log/tcp_log_dev.h Thu Mar 22 09:40:08 2018 (r331347) > > @@ -0,0 +1,88 @@ > > +/*- > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > + * > > + * Copyright (c) 2016 > > + * Netflix Inc. All rights reserved. > > + * > > + * Redistribution and use in source and binary forms, with or without > > + * modification, are permitted provided that the following conditions > > + * are met: > > + * 1. Redistributions of source code must retain the above copyright > > + * notice, this list of conditions and the following disclaimer. > > + * 2. Redistributions in binary form must reproduce the above copyright > > + * notice, this list of conditions and the following disclaimer in the > > + * documentation and/or other materials provided with the distribution. > > + * > > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > > + * SUCH DAMAGE. > > + * > > + * $FreeBSD$ > > + */ > > + > > +#ifndef __tcp_log_dev_h__ > > +#define __tcp_log_dev_h__ > > + > > +/* > > + * This is the common header for data streamed from the log device. All > > + * blocks of data need to start with this header. > > + */ > > +struct tcp_log_common_header { > > + uint32_t tlch_version; /* Version is specific to type. */ > > + uint32_t tlch_type; /* Type of entry(ies) that follow. */ > > + uint64_t tlch_length; /* Total length, including header. */ > > +} __packed; > > + > > +#define TCP_LOG_DEV_TYPE_BBR 1 /* black box recorder */ > > + > > +#ifdef _KERNEL > > +/* > > + * This is a queue entry. All queue entries need to start with this structure > > + * so the common code can cast them to this structure; however, other modules > > + * are free to include additional data after this structure. > > + * > > + * The elements are explained here: > > + * tldq_queue: used by the common code to maintain this entry's position in the > > + * queue. > > + * tldq_buf: should be NULL, or a pointer to a chunk of data. The data must be > > + * as long as the common header indicates. > > + * tldq_xform: If tldq_buf is NULL, the code will call this to create the > > + * the tldq_buf object. The function should *not* directly modify tldq_buf, > > + * but should return the buffer (which must meet the restrictions > > + * indicated for tldq_buf). > > + * tldq_dtor: This function is called to free the queue entry. If tldq_buf is > > + * not NULL, the dtor function must free that, too. > > + * tldq_refcnt: used by the common code to indicate how many readers still need > > + * this data. > > + */ > > +struct tcp_log_dev_queue { > > + STAILQ_ENTRY(tcp_log_dev_queue) tldq_queue; > > + struct tcp_log_common_header *tldq_buf; > > + struct tcp_log_common_header *(*tldq_xform)(struct tcp_log_dev_queue *entry); > > + void (*tldq_dtor)(struct tcp_log_dev_queue *entry); > > + volatile u_int tldq_refcnt; > > +}; > > + > > +STAILQ_HEAD(log_queueh, tcp_log_dev_queue); > > + > > +struct tcp_log_dev_info { > > + STAILQ_ENTRY(tcp_log_dev_info) tldi_list; > > + struct tcp_log_dev_queue *tldi_head; > > + struct tcp_log_common_header *tldi_cur; > > + off_t tldi_off; > > +}; > > +STAILQ_HEAD(log_infoh, tcp_log_dev_info); > > + > > + > > +MALLOC_DECLARE(M_TCPLOGDEV); > > +int tcp_log_dev_add_log(struct tcp_log_dev_queue *entry); > > +#endif /* _KERNEL */ > > +#endif /* !__tcp_log_dev_h__ */ > > > > Modified: head/sys/kern/subr_witness.c > > ============================================================================== > > --- head/sys/kern/subr_witness.c Thu Mar 22 08:32:39 2018 (r331346) > > +++ head/sys/kern/subr_witness.c Thu Mar 22 09:40:08 2018 (r331347) > > @@ -640,6 +640,14 @@ static struct witness_order_list_entry order_lists[] = > > { "db->db_mtx", &lock_class_sx }, > > { NULL, NULL }, > > /* > > + * TCP log locks > > + */ > > + { "TCP ID tree", &lock_class_rw }, > > + { "tcp log id bucket", &lock_class_mtx_sleep }, > > + { "tcpinp", &lock_class_rw }, > > + { "TCP log expireq", &lock_class_mtx_sleep }, > > + { NULL, NULL }, > > + /* > > * spin locks > > */ > > #ifdef SMP > > > > Modified: head/sys/netinet/tcp.h > > ============================================================================== > > --- head/sys/netinet/tcp.h Thu Mar 22 08:32:39 2018 (r331346) > > +++ head/sys/netinet/tcp.h Thu Mar 22 09:40:08 2018 (r331347) > > @@ -168,6 +168,12 @@ struct tcphdr { > > #define TCP_NOOPT 8 /* don't use TCP options */ > > #define TCP_MD5SIG 16 /* use MD5 digests (RFC2385) */ > > #define TCP_INFO 32 /* retrieve tcp_info structure */ > > +#define TCP_LOG 34 /* configure event logging for connection */ > > +#define TCP_LOGBUF 35 /* retrieve event log for connection */ > > +#define TCP_LOGID 36 /* configure log ID to correlate connections */ > > +#define TCP_LOGDUMP 37 /* dump connection log events to device */ > > +#define TCP_LOGDUMPID 38 /* dump events from connections with same ID to > > + device */ > > #define TCP_CONGESTION 64 /* get/set congestion control algorithm */ > > #define TCP_CCALGOOPT 65 /* get/set cc algorithm specific options */ > > #define TCP_KEEPINIT 128 /* N, time to establish connection */ > > @@ -188,6 +194,9 @@ struct tcphdr { > > #define TCPI_OPT_WSCALE 0x04 > > #define TCPI_OPT_ECN 0x08 > > #define TCPI_OPT_TOE 0x10 > > + > > +/* Maximum length of log ID. */ > > +#define TCP_LOG_ID_LEN 64 > > > > /* > > * The TCP_INFO socket option comes from the Linux 2.6 TCP API, and permits > > > > Modified: head/sys/netinet/tcp_input.c > > ============================================================================== > > --- head/sys/netinet/tcp_input.c Thu Mar 22 08:32:39 2018 (r331346) > > +++ head/sys/netinet/tcp_input.c Thu Mar 22 09:40:08 2018 (r331347) > > @@ -102,6 +102,7 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -1592,6 +1593,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru > > /* Save segment, if requested. */ > > tcp_pcap_add(th, m, &(tp->t_inpkts)); > > #endif > > + TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0, > > + tlen, NULL, true); > > > > if ((thflags & TH_SYN) && (thflags & TH_FIN) && V_drop_synfin) { > > if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { > > > > Added: head/sys/netinet/tcp_log_buf.c > > ============================================================================== > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/sys/netinet/tcp_log_buf.c Thu Mar 22 09:40:08 2018 (r331347) > > @@ -0,0 +1,2480 @@ > > +/*- > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > + * > > + * Copyright (c) 2016-2018 > > + * Netflix Inc. All rights reserved. > > + * > > + * Redistribution and use in source and binary forms, with or without > > + * modification, are permitted provided that the following conditions > > + * are met: > > + * 1. Redistributions of source code must retain the above copyright > > + * notice, this list of conditions and the following disclaimer. > > + * 2. Redistributions in binary form must reproduce the above copyright > > + * notice, this list of conditions and the following disclaimer in the > > + * documentation and/or other materials provided with the distribution. > > + * > > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > > + * SUCH DAMAGE. > > + * > > + */ > > + > > +#include > > +__FBSDID("$FreeBSD$"); > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > + > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +/* Default expiry time */ > > +#define TCP_LOG_EXPIRE_TIME ((sbintime_t)60 * SBT_1S) > > + > > +/* Max interval at which to run the expiry timer */ > > +#define TCP_LOG_EXPIRE_INTVL ((sbintime_t)5 * SBT_1S) > > + > > +bool tcp_log_verbose; > > +static uma_zone_t tcp_log_bucket_zone, tcp_log_node_zone, tcp_log_zone; > > +static int tcp_log_session_limit = TCP_LOG_BUF_DEFAULT_SESSION_LIMIT; > > +static uint32_t tcp_log_version = TCP_LOG_BUF_VER; > > +RB_HEAD(tcp_log_id_tree, tcp_log_id_bucket); > > +static struct tcp_log_id_tree tcp_log_id_head; > > +static STAILQ_HEAD(, tcp_log_id_node) tcp_log_expireq_head = > > + STAILQ_HEAD_INITIALIZER(tcp_log_expireq_head); > > +static struct mtx tcp_log_expireq_mtx; > > +static struct callout tcp_log_expireq_callout; > > +static uint64_t tcp_log_auto_ratio = 0; > > +static uint64_t tcp_log_auto_ratio_cur = 0; > > +static uint32_t tcp_log_auto_mode = TCP_LOG_STATE_TAIL; > > +static bool tcp_log_auto_all = false; > > + > > +RB_PROTOTYPE_STATIC(tcp_log_id_tree, tcp_log_id_bucket, tlb_rb, tcp_log_id_cmp) > > + > > +SYSCTL_NODE(_net_inet_tcp, OID_AUTO, bb, CTLFLAG_RW, 0, "TCP Black Box controls"); > > + > > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_verbose, CTLFLAG_RW, &tcp_log_verbose, > > + 0, "Force verbose logging for TCP traces"); > > + > > +SYSCTL_INT(_net_inet_tcp_bb, OID_AUTO, log_session_limit, > > + CTLFLAG_RW, &tcp_log_session_limit, 0, > > + "Maximum number of events maintained for each TCP session"); > > + > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_global_limit, CTLFLAG_RW, > > + &tcp_log_zone, "Maximum number of events maintained for all TCP sessions"); > > + > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_global_entries, CTLFLAG_RD, > > + &tcp_log_zone, "Current number of events maintained for all TCP sessions"); > > + > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_limit, CTLFLAG_RW, > > + &tcp_log_bucket_zone, "Maximum number of log IDs"); > > + > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_entries, CTLFLAG_RD, > > + &tcp_log_bucket_zone, "Current number of log IDs"); > > + > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_limit, CTLFLAG_RW, > > + &tcp_log_node_zone, "Maximum number of tcpcbs with log IDs"); > > + > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_entries, CTLFLAG_RD, > > + &tcp_log_node_zone, "Current number of tcpcbs with log IDs"); > > + > > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_version, CTLFLAG_RD, &tcp_log_version, > > + 0, "Version of log formats exported"); > > + > > +SYSCTL_U64(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW, > > + &tcp_log_auto_ratio, 0, "Do auto capturing for 1 out of N sessions"); > > + > > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_auto_mode, CTLFLAG_RW, > > + &tcp_log_auto_mode, TCP_LOG_STATE_HEAD_AUTO, > > + "Logging mode for auto-selected sessions (default is TCP_LOG_STATE_HEAD_AUTO)"); > > + > > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_auto_all, CTLFLAG_RW, > > + &tcp_log_auto_all, false, > > + "Auto-select from all sessions (rather than just those with IDs)"); > > + > > +#ifdef TCPLOG_DEBUG_COUNTERS > > +counter_u64_t tcp_log_queued; > > +counter_u64_t tcp_log_que_fail1; > > +counter_u64_t tcp_log_que_fail2; > > +counter_u64_t tcp_log_que_fail3; > > +counter_u64_t tcp_log_que_fail4; > > +counter_u64_t tcp_log_que_fail5; > > +counter_u64_t tcp_log_que_copyout; > > +counter_u64_t tcp_log_que_read; > > +counter_u64_t tcp_log_que_freed; > > + > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, queued, CTLFLAG_RD, > > + &tcp_log_queued, "Number of entries queued"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail1, CTLFLAG_RD, > > + &tcp_log_que_fail1, "Number of entries queued but fail 1"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail2, CTLFLAG_RD, > > + &tcp_log_que_fail2, "Number of entries queued but fail 2"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail3, CTLFLAG_RD, > > + &tcp_log_que_fail3, "Number of entries queued but fail 3"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail4, CTLFLAG_RD, > > + &tcp_log_que_fail4, "Number of entries queued but fail 4"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail5, CTLFLAG_RD, > > + &tcp_log_que_fail5, "Number of entries queued but fail 4"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, copyout, CTLFLAG_RD, > > + &tcp_log_que_copyout, "Number of entries copied out"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, read, CTLFLAG_RD, > > + &tcp_log_que_read, "Number of entries read from the queue"); > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, freed, CTLFLAG_RD, > > + &tcp_log_que_freed, "Number of entries freed after reading"); > > +#endif > > + > > +#ifdef INVARIANTS > > +#define TCPLOG_DEBUG_RINGBUF > > +#endif > > + > > +struct tcp_log_mem > > +{ > > + STAILQ_ENTRY(tcp_log_mem) tlm_queue; > > + struct tcp_log_buffer tlm_buf; > > + struct tcp_log_verbose tlm_v; > > +#ifdef TCPLOG_DEBUG_RINGBUF > > + volatile int tlm_refcnt; > > +#endif > > +}; > > + > > +/* 60 bytes for the header, + 16 bytes for padding */ > > +static uint8_t zerobuf[76]; > > + > > +/* > > + * Lock order: > > + * 1. TCPID_TREE > > + * 2. TCPID_BUCKET > > + * 3. INP > > + * > > + * Rules: > > + * A. You need a lock on the Tree to add/remove buckets. > > + * B. You need a lock on the bucket to add/remove nodes from the bucket. > > + * C. To change information in a node, you need the INP lock if the tln_closed > > + * field is false. Otherwise, you need the bucket lock. (Note that the > > + * tln_closed field can change at any point, so you need to recheck the > > + * entry after acquiring the INP lock.) > > + * D. To remove a node from the bucket, you must have that entry locked, > > + * according to the criteria of Rule C. Also, the node must not be on > > + * the expiry queue. > > + * E. The exception to C is the expiry queue fields, which are locked by > > + * the TCPLOG_EXPIREQ lock. > > + * > > + * Buckets have a reference count. Each node is a reference. Further, > > + * other callers may add reference counts to keep a bucket from disappearing. > > + * You can add a reference as long as you own a lock sufficient to keep the > > + * bucket from disappearing. For example, a common use is: > > + * a. Have a locked INP, but need to lock the TCPID_BUCKET. > > + * b. Add a refcount on the bucket. (Safe because the INP lock prevents > > + * the TCPID_BUCKET from going away.) > > + * c. Drop the INP lock. > > + * d. Acquire a lock on the TCPID_BUCKET. > > + * e. Acquire a lock on the INP. > > + * f. Drop the refcount on the bucket. > > + * (At this point, the bucket may disappear.) > > + * > > + * Expire queue lock: > > + * You can acquire this with either the bucket or INP lock. Don't reverse it. > > + * When the expire code has committed to freeing a node, it resets the expiry > > + * time to SBT_MAX. That is the signal to everyone else that they should > > + * leave that node alone. > > + */ > > +static struct rwlock tcp_id_tree_lock; > > +#define TCPID_TREE_WLOCK() rw_wlock(&tcp_id_tree_lock) > > +#define TCPID_TREE_RLOCK() rw_rlock(&tcp_id_tree_lock) > > +#define TCPID_TREE_UPGRADE() rw_try_upgrade(&tcp_id_tree_lock) > > +#define TCPID_TREE_WUNLOCK() rw_wunlock(&tcp_id_tree_lock) > > +#define TCPID_TREE_RUNLOCK() rw_runlock(&tcp_id_tree_lock) > > +#define TCPID_TREE_WLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_WLOCKED) > > +#define TCPID_TREE_RLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_RLOCKED) > > +#define TCPID_TREE_UNLOCK_ASSERT() rw_assert(&tcp_id_tree_lock, RA_UNLOCKED) > > + > > +#define TCPID_BUCKET_LOCK_INIT(tlb) mtx_init(&((tlb)->tlb_mtx), "tcp log id bucket", NULL, MTX_DEF) > > +#define TCPID_BUCKET_LOCK_DESTROY(tlb) mtx_destroy(&((tlb)->tlb_mtx)) > > +#define TCPID_BUCKET_LOCK(tlb) mtx_lock(&((tlb)->tlb_mtx)) > > +#define TCPID_BUCKET_UNLOCK(tlb) mtx_unlock(&((tlb)->tlb_mtx)) > > +#define TCPID_BUCKET_LOCK_ASSERT(tlb) mtx_assert(&((tlb)->tlb_mtx), MA_OWNED) > > +#define TCPID_BUCKET_UNLOCK_ASSERT(tlb) mtx_assert(&((tlb)->tlb_mtx), MA_NOTOWNED) > > + > > +#define TCPID_BUCKET_REF(tlb) refcount_acquire(&((tlb)->tlb_refcnt)) > > +#define TCPID_BUCKET_UNREF(tlb) refcount_release(&((tlb)->tlb_refcnt)) > > + > > +#define TCPLOG_EXPIREQ_LOCK() mtx_lock(&tcp_log_expireq_mtx) > > +#define TCPLOG_EXPIREQ_UNLOCK() mtx_unlock(&tcp_log_expireq_mtx) > > + > > +SLIST_HEAD(tcp_log_id_head, tcp_log_id_node); > > + > > +struct tcp_log_id_bucket > > +{ > > + /* > > + * tlb_id must be first. This lets us use strcmp on > > + * (struct tcp_log_id_bucket *) and (char *) interchangeably. > > + */ > > + char tlb_id[TCP_LOG_ID_LEN]; > > + RB_ENTRY(tcp_log_id_bucket) tlb_rb; > > + struct tcp_log_id_head tlb_head; > > + struct mtx tlb_mtx; > > + volatile u_int tlb_refcnt; > > +}; > > + > > +struct tcp_log_id_node > > +{ > > + SLIST_ENTRY(tcp_log_id_node) tln_list; > > + STAILQ_ENTRY(tcp_log_id_node) tln_expireq; /* Locked by the expireq lock */ > > + sbintime_t tln_expiretime; /* Locked by the expireq lock */ > > + > > + /* > > + * If INP is NULL, that means the connection has closed. We've > > + * saved the connection endpoint information and the log entries > > + * in the tln_ie and tln_entries members. We've also saved a pointer > > + * to the enclosing bucket here. If INP is not NULL, the information is > > + * in the PCB and not here. > > + */ > > + struct inpcb *tln_inp; > > + struct tcpcb *tln_tp; > > + struct tcp_log_id_bucket *tln_bucket; > > + struct in_endpoints tln_ie; > > + struct tcp_log_stailq tln_entries; > > + int tln_count; > > + volatile int tln_closed; > > + uint8_t tln_af; > > +}; > > + > > +enum tree_lock_state { > > + TREE_UNLOCKED = 0, > > + TREE_RLOCKED, > > + TREE_WLOCKED, > > +}; > > + > > +/* Do we want to select this session for auto-logging? */ > > +static __inline bool > > +tcp_log_selectauto(void) > > +{ > > + > > + /* > > > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > > From owner-svn-src-head@freebsd.org Thu Mar 22 14:51:06 2018 Return-Path: Delivered-To: svn-src-head@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 A3AC4F4A584; Thu, 22 Mar 2018 14:51:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 4B5BA78883; Thu, 22 Mar 2018 14:51:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D89712C9E; Thu, 22 Mar 2018 14:51:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MEp6dA025087; Thu, 22 Mar 2018 14:51:06 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MEp6Jv025086; Thu, 22 Mar 2018 14:51:06 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201803221451.w2MEp6Jv025086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 22 Mar 2018 14:51:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331358 - head/libexec/tftpd/tests X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/libexec/tftpd/tests X-SVN-Commit-Revision: 331358 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 14:51:06 -0000 Author: asomers Date: Thu Mar 22 14:51:05 2018 New Revision: 331358 URL: https://svnweb.freebsd.org/changeset/base/331358 Log: tftpd: misc Coverity cleanup in the tests A bunch of unchecked return values from open(2) and read(2) Reported by: Coverity CID: 1386900, 1386911, 1386926, 1386928, 1386932, 1386942 CID: 1386961, 1386979 MFC after: 8 days X-MFC-With: 330696 Modified: head/libexec/tftpd/tests/functional.c Modified: head/libexec/tftpd/tests/functional.c ============================================================================== --- head/libexec/tftpd/tests/functional.c Thu Mar 22 13:30:35 2018 (r331357) +++ head/libexec/tftpd/tests/functional.c Thu Mar 22 14:51:05 2018 (r331358) @@ -224,19 +224,17 @@ do { \ static void cleanup(void) { - int fd = -1; - char buffer[80] = {0}; + FILE *f; pid_t pid; - fd = open(pidfile, O_RDONLY); - if (fd < 0) + f = fopen(pidfile, "r"); + if (f == NULL) return; - if (read(fd, buffer, sizeof(buffer)) > 0) { - sscanf(buffer, "%d", &pid); + if (fscanf(f, "%d", &pid) == 1) { kill(pid, SIGTERM); waitpid(pid, NULL, 0); } - close(fd); + fclose(f); unlink(pidfile); } @@ -698,6 +696,7 @@ TFTPD_TC_DEFINE(w_flag,, w_flag = 1;) recv_ack(1); fd = open("small.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq(contents, contents_len, buffer, r); @@ -734,6 +733,7 @@ TFTPD_TC_DEFINE(wrq_dropped_ack,) recv_ack(2); fd = open("medium.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq((const char*)contents, 768, buffer, r); @@ -766,6 +766,7 @@ TFTPD_TC_DEFINE(wrq_dropped_data,) recv_ack(1); fd = open("small.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq(contents, contents_len, buffer, r); @@ -799,6 +800,7 @@ TFTPD_TC_DEFINE(wrq_duped_data,) recv_ack(2); fd = open("medium.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq((const char*)contents, 768, buffer, r); @@ -862,6 +864,7 @@ TFTPD_TC_DEFINE(wrq_medium,) recv_ack(2); fd = open("medium.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq((const char*)contents, 768, buffer, r); @@ -894,6 +897,7 @@ TFTPD_TC_DEFINE(wrq_netascii,) recv_ack(1); fd = open("unix.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq(expected, sizeof(expected), buffer, r); @@ -931,6 +935,7 @@ TFTPD_TC_DEFINE(wrq_small,) recv_ack(1); fd = open("small.txt", O_RDONLY); + ATF_REQUIRE(fd >= 0); r = read(fd, buffer, sizeof(buffer)); close(fd); require_bufeq(contents, contents_len, buffer, r); From owner-svn-src-head@freebsd.org Thu Mar 22 14:57:49 2018 Return-Path: Delivered-To: svn-src-head@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 522FFF4B392 for ; Thu, 22 Mar 2018 14:57:49 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x231.google.com (mail-io0-x231.google.com [IPv6:2607:f8b0:4001:c06::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D72CD78FC9 for ; Thu, 22 Mar 2018 14:57:48 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x231.google.com with SMTP id e7so11318360iof.2 for ; Thu, 22 Mar 2018 07:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=IKfpoCv2+ZMQrSqOcjqNT/2jCK965pV2H0xxJD0A1P0=; b=iS6brQNsL9aNdBH7JwAZPR4uMHZHCR3HL3yeMVLTTe7x+1GS6wyQoJbjv2ZN8z4Oc5 3L2IODiWg/0GQUH6wX5D0E4VLgeyX7inn8yV7OoMan6e4L199vjhW9XScFXZ12tVcdF5 DnWrsFonARfUjalYUNeEwjyAohdvOy6D59BcOA6KV98XwiIklWZjb/zvDwKTUbR4w4v6 f56kW08DzjV/EPVsbzAxyviQkvwk+FzFVNI6FylhQECmSDbmOG++YVLUcFAIlfKCkJIm SkR1IKC0vBgAVnrZUEALnl6pz/sACdHyCN8QN170hGxaOJZtBVaNU3G0F1A3lq1q/M7B azXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=IKfpoCv2+ZMQrSqOcjqNT/2jCK965pV2H0xxJD0A1P0=; b=d3sJz3+1n2tAxvfJ7P00unUzIzcl152dM+OEFA6svsGcjVOyg8UciYNNJgXkItZ2Qa 7gT0R7/F93lqrQbk95gmPqecMH0B6EWdbtDsE6eaIeRyimhrFcZNb2AOeLiBnTHKNzdk wn8GqAMlm2gewS1rOL3MsDOXZ8l5JzaOwat7DCCIFmV0ykmE7hV1H2rZGN3ZX/PIh8a+ LOKoFKq7Odgf+wbLC6Ke9mOkiqDQv/Si/q5M1nKg925QyGzTiX6W5gXCdL0uFTFN7lBm C8N7sIXUMODd6C1xW8dPf6FlIJPM6QSPg7wXYrjB04jogIvot8GyrC4zibwiS2d0hbog jH9A== X-Gm-Message-State: AElRT7EWwMKQjQXlOuqBWZ3onGHKHcqdrtO6CxapKDl4KRH19BgWgMpV 9yI2OaEmQkIV/RM0JfGpLM4UBhwhgrfpNwbBhpAWFQ== X-Google-Smtp-Source: AG47ELt61niFwEgc4gmfgi3ChVdX/PICs4qhLedsvgxG9W4r+CZUVFMyzkesp29RFVLz+EQTY46wFciHnxD+Cui2UqA= X-Received: by 10.107.12.230 with SMTP id 99mr25324573iom.117.1521730667830; Thu, 22 Mar 2018 07:57:47 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Thu, 22 Mar 2018 07:57:47 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:18a2:a4f7:170:8dd9] In-Reply-To: <20180322114213.GR76926@kib.kiev.ua> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> <20180321202752.GO76926@kib.kiev.ua> <20180322174025.Q1053@besplex.bde.org> <20180322114213.GR76926@kib.kiev.ua> From: Warner Losh Date: Thu, 22 Mar 2018 08:57:47 -0600 X-Google-Sender-Auth: vOax_in7ZnGHFQzXf8DMpL9pVoM Message-ID: Subject: Re: svn commit: r331298 - head/sys/dev/syscons To: Konstantin Belousov Cc: Bruce Evans , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 14:57:49 -0000 On Thu, Mar 22, 2018 at 5:42 AM, Konstantin Belousov wrote: > On Thu, Mar 22, 2018 at 05:50:57PM +1100, Bruce Evans wrote: > > On Wed, 21 Mar 2018, Warner Losh wrote: > > > > > On Wed, Mar 21, 2018 at 2:27 PM, Konstantin Belousov < > kostikbel@gmail.com> > > > wrote: > > >> ... > > >> Are you saying that fast interrupt handlers call shutdown_nice() ? > This > > >> is the quite serious bug on its own. To fix it, shutdown_nice() > should > > >> use a fast taskqueue to schedule the task which would lock the process > > >> and send the signal. > > > > > > Is there some way we know we're in a fast interrupt handler? If so, it > > > should be simple to fix. If not, then there's an API change ahead of > us... > > > > There is a td_intr_nesting_level flag that might work. (I invented this, > > but don't like its current use.) > But why do we need to know this ? We can always schedule a task in the > fast taskqueue if init is present and can be scheduled. Ah, good point. Seems like a poster child example of doing a fast task queue deferment. That's always safe, except maybe in BDE's fast interrupt world. > > But bde is right: the system has to be in good enough shape to cope. I > > > wonder if we should put that coping into kdb_reboot() instead. It's > only an > > > issue for TILDE ^R, which is a fairly edge case. > > > > shutdown_nice() is also called directly from syscons and vt for the > reboot, > > halt and poweroff keys. This happens in normal interrupt handler > context, > > so there is only a problem when init is not running. > > diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c > index e5ea9644ad3..e7c6d4c92b2 100644 > --- a/sys/kern/kern_shutdown.c > +++ b/sys/kern/kern_shutdown.c > @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > > @@ -276,6 +277,28 @@ sys_reboot(struct thread *td, struct reboot_args *uap) > return (error); > } > > +static void > +shutdown_nice_task_fn(void *arg, int pending __unused) > +{ > + int howto; > + > + howto = (uintptr_t)arg; > + /* Send a signal to init(8) and have it shutdown the world. */ > + PROC_LOCK(initproc); > + if (howto & RB_POWEROFF) > + kern_psignal(initproc, SIGUSR2); > + else if (howto & RB_POWERCYCLE) > + kern_psignal(initproc, SIGWINCH); > + else if (howto & RB_HALT) > + kern_psignal(initproc, SIGUSR1); > + else > + kern_psignal(initproc, SIGINT); > + PROC_UNLOCK(initproc); > +} > + > +static struct task shutdown_nice_task = TASK_INITIALIZER(0, > + &shutdown_nice_task_fn, NULL); > + > /* > * Called by events that want to shut down.. e.g on a PC > */ > @@ -283,20 +306,14 @@ void > shutdown_nice(int howto) > { > > - if (initproc != NULL) { > - /* Send a signal to init(8) and have it shutdown the > world. */ > - PROC_LOCK(initproc); > - if (howto & RB_POWEROFF) > - kern_psignal(initproc, SIGUSR2); > - else if (howto & RB_POWERCYCLE) > - kern_psignal(initproc, SIGWINCH); > - else if (howto & RB_HALT) > - kern_psignal(initproc, SIGUSR1); > - else > - kern_psignal(initproc, SIGINT); > - PROC_UNLOCK(initproc); > + if (initproc != NULL && !SCHEDULER_STOPPED()) { > + shutdown_nice_task.ta_context = (void *)(uintptr_t)howto; > + taskqueue_enqueue(taskqueue_fast, &shutdown_nice_task); > } else { > - /* No init(8) running, so simply reboot. */ > + /* > + * No init(8) running, or scheduler would not allow it > + * to run, so simply reboot. > + */ > kern_reboot(howto | RB_NOSYNC); > } > } > I like this elegance. I think we should commit this. While it would be nice to support the super-fast interrupts that bde has done, we already don't support it in a number of places. Conceptually, I like the notion of the tilde escape machine in the tty layer, but I don't like the trade offs. Here we only defer to reboot, which requires a fair amount of machinery working to work right. it's not the dependencies I'd prefer, but usually it doesn't matter. However, to do that, it would also mean that breaking to the debugger would need to be done in the tty layer, which requires more of the context switching mechanisms to be working, which would be a bigger loss. So this is a good trade-off. If kern_reboot() can't be called from a fast interrupt handler in bdeBSD, it would be a simple matter to put a wrapper around it here so his kernel can context switch. Though, if the scheduler isn't running, I'm not sure what you can do in this situation. The system is already hung or in a really bad way, so it would have to jump to somewhere late in the kern_reboot() code, though I'm not sure. It's kinda hard to know what's safe just from descriptions from bde. We're already not synching the data to the disks, so I'm not sure what more can be done. I think we should commit this change. It makes things better, but Warner From owner-svn-src-head@freebsd.org Thu Mar 22 15:09:19 2018 Return-Path: Delivered-To: svn-src-head@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 043D3F4C425; Thu, 22 Mar 2018 15:09:19 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78373796B8; Thu, 22 Mar 2018 15:09:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w2MF96o8072517 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 22 Mar 2018 17:09:09 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w2MF96o8072517 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w2MF96wO072516; Thu, 22 Mar 2018 17:09:06 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 22 Mar 2018 17:09:06 +0200 From: Konstantin Belousov To: Bruce Evans Cc: Warner Losh , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331298 - head/sys/dev/syscons Message-ID: <20180322150906.GV76926@kib.kiev.ua> References: <201803211447.w2LElDcK091988@repo.freebsd.org> <20180322024846.S4293@besplex.bde.org> <20180321202752.GO76926@kib.kiev.ua> <20180322174025.Q1053@besplex.bde.org> <20180322114213.GR76926@kib.kiev.ua> <20180322235735.J3354@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180322235735.J3354@besplex.bde.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 15:09:19 -0000 On Fri, Mar 23, 2018 at 01:21:43AM +1100, Bruce Evans wrote: > I don't like having a whole task for this. The whole thing is just a > hack to work around some the upper layers of the tty driver and some > lower layers not having any input [escape] sequences to control the > kernel. Only the syscons and vt lower layers have such sequences > (where they are actually key combinations that are converted to control > operations instead of to input [escape] sequences). To work around for > hardware ttys, the filter for kdb sequences is abused to implement a > non-kdb sequence for rebooting. > > The tty input methods could check for kernel-control sequences and safely > signal init. This is a bit too complicated for syscons and vt since they > can more easily check for key combinations, but wouldhave to convert these > to standard sequences to get the tty layer to do the same thing. (They > have many more kernel-control key combinations and the non-kdb one for > rebooting is just a bug for them.) This is a bit complicated for hardware > tty drivers too -- some use the tty bulk-input method and this shouldn't > check for sequences, but should reduce to bcopy(). Hoever, to detect the > kdb sequences, these drivers han to check at a low level anyway. They > can be clever about this and only check for the console device[s] which are > usually only used for for input at a low rate. This is both complicated and mostly pointless. The task mechanism provides the easy solution, and more, the task mechanism was specifically designed to allow to schedule activities in the more allowing context, from a more restrictive context. I have no intent to start the self-inflicting activity to code the attempt to modify a lot of drivers to do what can be done in 10 lines of code. > Calling kern_reboot() from fast interrupt handlers is still invalid. > It is quite likely to deadlock. In particular, it should deadlock in > when kern_reboot() prints messages to the console. Most console drivers > have races instead of deadlocks by dropping their lock[s] in their > fast interrupt handler before calling the buggy alt escape function. I agree that it is mostly invalid. If SCHEDULER_STOPPED() evaluates to true, then the clean shutdown is not possible at all on modern hardware. Most drivers are asynchronous, and even the hardware reboot command management is async. Similarly, if initproc is not yet initialized, it is silly to expect clean shutdown to occur. I just keep the existing behavior for these corner cases, perhaps it was added for some reasons and might sometime work. From owner-svn-src-head@freebsd.org Thu Mar 22 15:11:54 2018 Return-Path: Delivered-To: svn-src-head@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 8DF44F4C9A9; Thu, 22 Mar 2018 15:11:54 +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 4136E79B03; Thu, 22 Mar 2018 15:11:54 +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 3C39212FD3; Thu, 22 Mar 2018 15:11:54 +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 w2MFBsk5033829; Thu, 22 Mar 2018 15:11:54 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MFBsX4033828; Thu, 22 Mar 2018 15:11:54 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803221511.w2MFBsX4033828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Mar 2018 15:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331359 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 331359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 15:11:54 -0000 Author: imp Date: Thu Mar 22 15:11:53 2018 New Revision: 331359 URL: https://svnweb.freebsd.org/changeset/base/331359 Log: Revert r331298 Normally, shutdown_nice() just signals init. However, sometimes it calls kern_reboot directly. For that case, r331298 dropped the Giant lock before calling it. This turns out to be incorrect for the more common case where init exists and we just signal it. Restore the old behavior. The direct call to kern_reboot() doesn't sync buffers to the disk, so should work with Giant held, so we don't need to drop locks here for that. Noticed by: bde@ Sponsored by: Netflix Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Thu Mar 22 14:51:05 2018 (r331358) +++ head/sys/dev/syscons/syscons.c Thu Mar 22 15:11:53 2018 (r331359) @@ -3858,28 +3858,22 @@ next_code: case RBT: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) { - mtx_unlock(&Giant); + if (enable_reboot && !(flags & SCGETC_CN)) shutdown_nice(0); - } #endif break; case HALT: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) { - mtx_unlock(&Giant); + if (enable_reboot && !(flags & SCGETC_CN)) shutdown_nice(RB_HALT); - } #endif break; case PDWN: #ifndef SC_DISABLE_REBOOT - if (enable_reboot && !(flags & SCGETC_CN)) { - mtx_unlock(&Giant); + if (enable_reboot && !(flags & SCGETC_CN)) shutdown_nice(RB_HALT|RB_POWEROFF); - } #endif break; From owner-svn-src-head@freebsd.org Thu Mar 22 15:24:27 2018 Return-Path: Delivered-To: svn-src-head@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 3C74DF4E1B3; Thu, 22 Mar 2018 15:24:27 +0000 (UTC) (envelope-from andrew@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 E31617AA49; Thu, 22 Mar 2018 15:24:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE0D91317D; Thu, 22 Mar 2018 15:24:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MFOQjL041955; Thu, 22 Mar 2018 15:24:26 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MFOQjT041954; Thu, 22 Mar 2018 15:24:26 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201803221524.w2MFOQjT041954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 22 Mar 2018 15:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331360 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 331360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 15:24:27 -0000 Author: andrew Date: Thu Mar 22 15:24:26 2018 New Revision: 331360 URL: https://svnweb.freebsd.org/changeset/base/331360 Log: Increase the size of the endpoint buffers. They are double buffered so need to be twice the size. Sponsored by: DARPA, AFRL Modified: head/sys/dev/usb/controller/musb_otg.c Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Thu Mar 22 15:11:53 2018 (r331359) +++ head/sys/dev/usb/controller/musb_otg.c Thu Mar 22 15:24:26 2018 (r331360) @@ -157,7 +157,7 @@ static const struct musb_otg_ep_cfg musbotg_ep_default }, { .ep_end = 7, - .ep_fifosz_shift = 9, + .ep_fifosz_shift = 10, .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512 | MUSB2_MASK_FIFODB, }, { From owner-svn-src-head@freebsd.org Thu Mar 22 15:32:58 2018 Return-Path: Delivered-To: svn-src-head@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 2797BF4EEAE; Thu, 22 Mar 2018 15:32:58 +0000 (UTC) (envelope-from andrew@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 C8C0E7B2BD; Thu, 22 Mar 2018 15:32:57 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2483132F4; Thu, 22 Mar 2018 15:32:57 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MFWv2p047089; Thu, 22 Mar 2018 15:32:57 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MFWv8W047088; Thu, 22 Mar 2018 15:32:57 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201803221532.w2MFWv8W047088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 22 Mar 2018 15:32:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331361 - head/sys/dev/efidev X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/efidev X-SVN-Commit-Revision: 331361 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 15:32:58 -0000 Author: andrew Date: Thu Mar 22 15:32:57 2018 New Revision: 331361 URL: https://svnweb.freebsd.org/changeset/base/331361 Log: Enter into the EFI environment before dereferencing the runtime services pointer. This may be within the EFI address space and not the FreeBSD kernel address space. X-MFC-With: r330868 Sponsored by: DARPA, AFRL Modified: head/sys/dev/efidev/efirt.c Modified: head/sys/dev/efidev/efirt.c ============================================================================== --- head/sys/dev/efidev/efirt.c Thu Mar 22 15:24:26 2018 (r331360) +++ head/sys/dev/efidev/efirt.c Thu Mar 22 15:32:57 2018 (r331361) @@ -88,6 +88,9 @@ static int efi_status2err[25] = { EPROTO /* EFI_PROTOCOL_ERROR */ }; +static int efi_enter(void); +static void efi_leave(void); + static int efi_status_to_errno(efi_status status) { @@ -190,9 +193,14 @@ efi_init(void) * call RS->SetVirtualAddressMap. As this is not always the case, e.g. * with an old loader.efi, check if the RS->GetTime function is within * the EFI map, and fail to attach if not. + * + * We need to enter into the EFI environment as efi_runtime may point + * to an EFI address. */ + efi_enter(); if (!efi_is_in_map(map, efihdr->memory_size / efihdr->descriptor_size, efihdr->descriptor_size, (vm_offset_t)efi_runtime->rt_gettime)) { + efi_leave(); if (bootverbose) printf( "EFI runtime services table has an invalid pointer\n"); @@ -200,6 +208,7 @@ efi_init(void) efi_destroy_1t1_map(); return (ENXIO); } + efi_leave(); return (0); } From owner-svn-src-head@freebsd.org Thu Mar 22 15:34:38 2018 Return-Path: Delivered-To: svn-src-head@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 EF7D8F4F117; Thu, 22 Mar 2018 15:34:37 +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 A0B137B492; Thu, 22 Mar 2018 15:34:37 +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 9AE83132FD; Thu, 22 Mar 2018 15:34:37 +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 w2MFYbxe047215; Thu, 22 Mar 2018 15:34:37 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MFYbC8047214; Thu, 22 Mar 2018 15:34:37 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803221534.w2MFYbC8047214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Mar 2018 15:34:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331362 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331362 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 15:34:38 -0000 Author: imp Date: Thu Mar 22 15:34:37 2018 New Revision: 331362 URL: https://svnweb.freebsd.org/changeset/base/331362 Log: Drop any recursed taking of Giant once and for all at the top of kern_reboot(). The shutdown path is now safe to run without Giant. Discussed with: kib@ Sponsored by: Netflix Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Thu Mar 22 15:32:57 2018 (r331361) +++ head/sys/kern/kern_shutdown.c Thu Mar 22 15:34:37 2018 (r331362) @@ -366,6 +366,17 @@ kern_reboot(int howto) { static int once = 0; + /* + * Normal paths here don't hold Giant, but we can wind up here + * unexpectedly with it held. Drop it now so we don't have to + * drop and pick it up elsewhere. The paths it is locking will + * never be returned to, and it is preferable to preclude + * deadlock than to lock against code that won't ever + * continue. + */ + while (mtx_owned(&Giant)) + mtx_unlock(&Giant); + #if defined(SMP) /* * Bind us to the first CPU so that all shutdown code runs there. Some From owner-svn-src-head@freebsd.org Thu Mar 22 15:39:27 2018 Return-Path: Delivered-To: svn-src-head@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 7C9D5F4F79D; Thu, 22 Mar 2018 15:39:26 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4EEF7B915; Thu, 22 Mar 2018 15:39:25 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: by mail-wm0-x234.google.com with SMTP id x82so16913718wmg.1; Thu, 22 Mar 2018 08:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=t7apYKAZ/U6t+UiSvzDVT5hq6Jv1hVSNFojhz4PQwP0=; b=A1emKm8mBW/s/upx7uVXED4Tq+dGayXWG52NmgjrGMdquxmKhUly0bNCjzhIJ5qR0E JwcUbXVpgP5EacDU6B4xx2r6PxL2A1TH9e1fO623U2tnzbFLunmLRnfNGOdXnqK08g8U DCukQ89hweFQxgyZTNjMuXdLorrE7jjTPpXp937mJIRSZewEuIqz6tYqX0T+K/YfvbpW jLSKWX+i8bMl8K68dhh/vFjPLhEONwdXEc4IHSVSYCx7n72AraaMHYUSCYwxNmxRjwYk bga+rBDCUDn3L+JFZQLNKMN/9y3fIbkVKR4LiESIdi7OVvdO7kILQf0QbE8948CkkRsy dPTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=t7apYKAZ/U6t+UiSvzDVT5hq6Jv1hVSNFojhz4PQwP0=; b=nfdyq3S5/5OxVbJosmuKFEIoli+yHLxzNC8xLgWMyThUmCh6x4HSGH0knhLIY5x0OL kzGD73XRydFD7igd1IQbLZoP2vA1GBN3iqCKfRphnWK7uR15oIm265sGy/FT6hjAlWIr lHGEyFf1MQuzjjBYEjoIthNU9wYWistTuLOXGQPwWz1qTt/2CTHnK+b3lhcxUcl/XuAD rhQw8x2Cfo+HP4f2SaYRoZRHvyxg5VFJ4pU0rHvEWwrjD9gk+OMbiOz6rS/u3A5dKJrs fK1IedYsRKKRRILSFxWx2QWpavM0ATz2cL/p6TBogMgGCkTSky8gVMQXBQ0NQb/NwOjq lYHA== X-Gm-Message-State: AElRT7HJvNVqoUKtSGW+7y4hc6FQJpd3y4PVVIn05frWKFiKkPI4FoDI 1j+nB9mhiW4SFGAEPOrTV9W38luxp3QDa2OnWQI= X-Google-Smtp-Source: AG47ELuEgPErZF/UEIhKVo88k/iHe/8Pxi16nUOxIafxtvQCq0y3EJZ6X4zMHqWN6FukXwdfrOs6YU0pYHaQnkOW0pQ= X-Received: by 10.28.160.9 with SMTP id j9mr6408272wme.51.1521733164472; Thu, 22 Mar 2018 08:39:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.192.2 with HTTP; Thu, 22 Mar 2018 08:39:23 -0700 (PDT) In-Reply-To: <20180322142225.GA5139@bsdpad.com> References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> <20180322142225.GA5139@bsdpad.com> From: Jonathan Looney Date: Thu, 22 Mar 2018 15:39:23 +0000 Message-ID: Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat To: Ruslan Bukin Cc: "Jonathan T. Looney" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 15:39:27 -0000 A tinderbox build didn't complain about atomic_fetchadd_64, so I assume it is OK. Yes, this can be made optional, if there is a need for that. Jonathan On Thu, Mar 22, 2018 at 2:22 PM, Ruslan Bukin wrote: > Also can this be pluggable ? > It looks like it is optional device which means it can free up some space > in embedded environment when unused > > Ruslan > > On Thu, Mar 22, 2018 at 02:16:06PM +0000, Ruslan Bukin wrote: > > We don't have atomic_fetchadd_64 for mips32 I think > > > > Ruslan > > > > On Thu, Mar 22, 2018 at 09:40:08AM +0000, Jonathan T. Looney wrote: > > > Author: jtl > > > Date: Thu Mar 22 09:40:08 2018 > > > New Revision: 331347 > > > URL: https://svnweb.freebsd.org/changeset/base/331347 > > > > > > Log: > > > Add the "TCP Blackbox Recorder" which we discussed at the developer > > > summits at BSDCan and BSDCam in 2017. > > > > > > The TCP Blackbox Recorder allows you to capture events on a TCP > connection > > > in a ring buffer. It stores metadata with the event. It optionally > stores > > > the TCP header associated with an event (if the event is associated > with a > > > packet) and also optionally stores information on the sockets. > > > > > > It supports setting a log ID on a TCP connection and using this to > correlate > > > multiple connections that share a common log ID. > > > > > > You can log connections in different modes. If you are doing a > coordinated > > > test with a particular connection, you may tell the system to put it > in > > > mode 4 (continuous dump). Or, if you just want to monitor for > errors, you > > > can put it in mode 1 (ring buffer) and dump all the ring buffers > associated > > > with the connection ID when we receive an error signal for that > connection > > > ID. You can set a default mode that will be applied to a particular > ratio > > > of incoming connections. You can also manually set a mode using a > socket > > > option. > > > > > > This commit includes only basic probes. rrs@ has added quite an > abundance > > > of probes in his TCP development work. He plans to commit those soon. > > > > > > There are user-space programs which we plan to commit as ports. > These read > > > the data from the log device and output pcapng files, and then let > you > > > analyze the data (and metadata) in the pcapng files. > > > > > > Reviewed by: gnn (previous version) > > > Obtained from: Netflix, Inc. > > > Relnotes: yes > > > Differential Revision: https://reviews.freebsd.org/D11085 > > > > > > Added: > > > head/sys/dev/tcp_log/ > > > head/sys/dev/tcp_log/tcp_log_dev.c (contents, props changed) > > > head/sys/dev/tcp_log/tcp_log_dev.h (contents, props changed) > > > head/sys/netinet/tcp_log_buf.c (contents, props changed) > > > head/sys/netinet/tcp_log_buf.h (contents, props changed) > > > Modified: > > > head/etc/mtree/BSD.include.dist > > > head/include/Makefile > > > head/sys/conf/files > > > head/sys/kern/subr_witness.c > > > head/sys/netinet/tcp.h > > > head/sys/netinet/tcp_input.c > > > head/sys/netinet/tcp_output.c > > > head/sys/netinet/tcp_subr.c > > > head/sys/netinet/tcp_timer.c > > > head/sys/netinet/tcp_usrreq.c > > > head/sys/netinet/tcp_var.h > > > head/usr.bin/netstat/inet.c > > > head/usr.bin/netstat/main.c > > > head/usr.bin/netstat/netstat.1 > > > head/usr.bin/netstat/netstat.h > > > > > > Modified: head/etc/mtree/BSD.include.dist > > > ============================================================ > ================== > > > --- head/etc/mtree/BSD.include.dist Thu Mar 22 08:32:39 2018 > (r331346) > > > +++ head/etc/mtree/BSD.include.dist Thu Mar 22 09:40:08 2018 > (r331347) > > > @@ -158,6 +158,8 @@ > > > .. > > > speaker > > > .. > > > + tcp_log > > > + .. > > > usb > > > .. > > > vkbd > > > > > > Modified: head/include/Makefile > > > ============================================================ > ================== > > > --- head/include/Makefile Thu Mar 22 08:32:39 2018 (r331346) > > > +++ head/include/Makefile Thu Mar 22 09:40:08 2018 (r331347) > > > @@ -47,7 +47,7 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ > > > dev/hwpmc dev/hyperv \ > > > dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ > > > dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus > dev/smbus \ > > > - dev/speaker dev/vkbd dev/wi \ > > > + dev/speaker dev/tcp_log dev/vkbd dev/wi \ > > > fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ > > > fs/procfs fs/smbfs fs/udf fs/unionfs \ > > > geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ > > > > > > Modified: head/sys/conf/files > > > ============================================================ > ================== > > > --- head/sys/conf/files Thu Mar 22 08:32:39 2018 (r331346) > > > +++ head/sys/conf/files Thu Mar 22 09:40:08 2018 (r331347) > > > @@ -3161,6 +3161,7 @@ dev/syscons/star/star_saver.c optional star_saver > > > dev/syscons/syscons.c optional sc > > > dev/syscons/sysmouse.c optional sc > > > dev/syscons/warp/warp_saver.c optional warp_saver > > > +dev/tcp_log/tcp_log_dev.c optional inet | inet6 > > > dev/tdfx/tdfx_linux.c optional tdfx_linux tdfx > compat_linux > > > dev/tdfx/tdfx_pci.c optional tdfx pci > > > dev/ti/if_ti.c optional ti pci > > > @@ -4309,6 +4310,7 @@ netinet/tcp_debug.c optional tcpdebug > > > netinet/tcp_fastopen.c optional inet tcp_rfc7413 | inet6 > tcp_rfc7413 > > > netinet/tcp_hostcache.c optional inet | inet6 > > > netinet/tcp_input.c optional inet | inet6 > > > +netinet/tcp_log_buf.c optional inet | inet6 > > > netinet/tcp_lro.c optional inet | inet6 > > > netinet/tcp_output.c optional inet | inet6 > > > netinet/tcp_offload.c optional tcp_offload inet | > tcp_offload inet6 > > > > > > Added: head/sys/dev/tcp_log/tcp_log_dev.c > > > ============================================================ > ================== > > > --- /dev/null 00:00:00 1970 (empty, because file is newly > added) > > > +++ head/sys/dev/tcp_log/tcp_log_dev.c Thu Mar 22 09:40:08 2018 > (r331347) > > > @@ -0,0 +1,521 @@ > > > +/*- > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > > + * > > > + * Copyright (c) 2016-2017 > > > + * Netflix Inc. All rights reserved. > > > + * > > > + * Redistribution and use in source and binary forms, with or without > > > + * modification, are permitted provided that the following conditions > > > + * are met: > > > + * 1. Redistributions of source code must retain the above copyright > > > + * notice, this list of conditions and the following disclaimer. > > > + * 2. Redistributions in binary form must reproduce the above > copyright > > > + * notice, this list of conditions and the following disclaimer in > the > > > + * documentation and/or other materials provided with the > distribution. > > > + * > > > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' > AND > > > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, > THE > > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR > PURPOSE > > > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE > LIABLE > > > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL > > > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE > GOODS > > > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > INTERRUPTION) > > > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > CONTRACT, STRICT > > > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN > ANY WAY > > > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF > > > + * SUCH DAMAGE. > > > + * > > > + */ > > > + > > > +#include > > > +__FBSDID("$FreeBSD$"); > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +#include > > > + > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > +extern counter_u64_t tcp_log_que_read; > > > +extern counter_u64_t tcp_log_que_freed; > > > +#endif > > > + > > > +static struct cdev *tcp_log_dev; > > > +static struct selinfo tcp_log_sel; > > > + > > > +static struct log_queueh tcp_log_dev_queue_head = > STAILQ_HEAD_INITIALIZER(tcp_log_dev_queue_head); > > > +static struct log_infoh tcp_log_dev_reader_head = > STAILQ_HEAD_INITIALIZER(tcp_log_dev_reader_head); > > > + > > > +MALLOC_DEFINE(M_TCPLOGDEV, "tcp_log_dev", "TCP log device data > structures"); > > > + > > > +static int tcp_log_dev_listeners = 0; > > > + > > > +static struct mtx tcp_log_dev_queue_lock; > > > + > > > +#define TCP_LOG_DEV_QUEUE_LOCK() > mtx_lock(&tcp_log_dev_queue_lock) > > > +#define TCP_LOG_DEV_QUEUE_UNLOCK() > mtx_unlock(&tcp_log_dev_queue_lock) > > > +#define TCP_LOG_DEV_QUEUE_LOCK_ASSERT() > mtx_assert(&tcp_log_dev_queue_lock, MA_OWNED) > > > +#define TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT() > mtx_assert(&tcp_log_dev_queue_lock, MA_NOTOWNED) > > > +#define TCP_LOG_DEV_QUEUE_REF(tldq) refcount_acquire(&((tldq)-> > tldq_refcnt)) > > > +#define TCP_LOG_DEV_QUEUE_UNREF(tldq) refcount_release(&((tldq)-> > tldq_refcnt)) > > > + > > > +static void tcp_log_dev_clear_refcount(struct > tcp_log_dev_queue *entry); > > > +static void tcp_log_dev_clear_cdevpriv(void *data); > > > +static int tcp_log_dev_open(struct cdev *dev __unused, int flags, > > > + int devtype __unused, struct thread *td __unused); > > > +static int tcp_log_dev_write(struct cdev *dev __unused, > > > + struct uio *uio __unused, int flags __unused); > > > +static int tcp_log_dev_read(struct cdev *dev __unused, struct uio > *uio, > > > + int flags __unused); > > > +static int tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, > > > + caddr_t data, int fflag __unused, struct thread *td __unused); > > > +static int tcp_log_dev_poll(struct cdev *dev __unused, int events, > > > + struct thread *td); > > > + > > > + > > > +enum tcp_log_dev_queue_lock_state { > > > + QUEUE_UNLOCKED = 0, > > > + QUEUE_LOCKED, > > > +}; > > > + > > > +static struct cdevsw tcp_log_cdevsw = { > > > + .d_version = D_VERSION, > > > + .d_read = tcp_log_dev_read, > > > + .d_open = tcp_log_dev_open, > > > + .d_write = tcp_log_dev_write, > > > + .d_poll = tcp_log_dev_poll, > > > + .d_ioctl = tcp_log_dev_ioctl, > > > +#ifdef NOTYET > > > + .d_mmap = tcp_log_dev_mmap, > > > +#endif > > > + .d_name = "tcp_log", > > > +}; > > > + > > > +static __inline void > > > +tcp_log_dev_queue_validate_lock(int lockstate) > > > +{ > > > + > > > +#ifdef INVARIANTS > > > + switch (lockstate) { > > > + case QUEUE_LOCKED: > > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > + break; > > > + case QUEUE_UNLOCKED: > > > + TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT(); > > > + break; > > > + default: > > > + kassert_panic("%s:%d: unknown queue lock state", __func__, > > > + __LINE__); > > > + } > > > +#endif > > > +} > > > + > > > +/* > > > + * Clear the refcount. If appropriate, it will remove the entry from > the > > > + * queue and call the destructor. > > > + * > > > + * This must be called with the queue lock held. > > > + */ > > > +static void > > > +tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry) > > > +{ > > > + > > > + KASSERT(entry != NULL, ("%s: called with NULL entry", __func__)); > > > + > > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > + > > > + if (TCP_LOG_DEV_QUEUE_UNREF(entry)) { > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > + counter_u64_add(tcp_log_que_freed, 1); > > > +#endif > > > + /* Remove the entry from the queue and call the > destructor. */ > > > + STAILQ_REMOVE(&tcp_log_dev_queue_head, entry, > tcp_log_dev_queue, > > > + tldq_queue); > > > + (*entry->tldq_dtor)(entry); > > > + } > > > +} > > > + > > > +static void > > > +tcp_log_dev_clear_cdevpriv(void *data) > > > +{ > > > + struct tcp_log_dev_info *priv; > > > + struct tcp_log_dev_queue *entry, *entry_tmp; > > > + > > > + priv = (struct tcp_log_dev_info *)data; > > > + if (priv == NULL) > > > + return; > > > + > > > + /* > > > + * Lock the queue and drop our references. We hold references to > all > > > + * the entries starting with tldi_head (or, if tldi_head == NULL, > all > > > + * entries in the queue). > > > + * > > > + * Because we don't want anyone adding addition things to the queue > > > + * while we are doing this, we lock the queue. > > > + */ > > > + TCP_LOG_DEV_QUEUE_LOCK(); > > > + if (priv->tldi_head != NULL) { > > > + entry = priv->tldi_head; > > > + STAILQ_FOREACH_FROM_SAFE(entry, &tcp_log_dev_queue_head, > > > + tldq_queue, entry_tmp) { > > > + tcp_log_dev_clear_refcount(entry); > > > + } > > > + } > > > + tcp_log_dev_listeners--; > > > + KASSERT(tcp_log_dev_listeners >= 0, > > > + ("%s: tcp_log_dev_listeners is unexpectedly negative", > __func__)); > > > + STAILQ_REMOVE(&tcp_log_dev_reader_head, priv, tcp_log_dev_info, > > > + tldi_list); > > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > > + free(priv, M_TCPLOGDEV); > > > +} > > > + > > > +static int > > > +tcp_log_dev_open(struct cdev *dev __unused, int flags, int devtype > __unused, > > > + struct thread *td __unused) > > > +{ > > > + struct tcp_log_dev_info *priv; > > > + struct tcp_log_dev_queue *entry; > > > + int rv; > > > + > > > + /* > > > + * Ideally, we shouldn't see these because of file system > > > + * permissions. > > > + */ > > > + if (flags & (FWRITE | FEXEC | FAPPEND | O_TRUNC)) > > > + return (ENODEV); > > > + > > > + /* Allocate space to hold information about where we are. */ > > > + priv = malloc(sizeof(struct tcp_log_dev_info), M_TCPLOGDEV, > > > + M_ZERO | M_WAITOK); > > > + > > > + /* Stash the private data away. */ > > > + rv = devfs_set_cdevpriv((void *)priv, tcp_log_dev_clear_cdevpriv); > > > + if (!rv) { > > > + /* > > > + * Increase the listener count, add this reader to the > list, and > > > + * take references on all current queues. > > > + */ > > > + TCP_LOG_DEV_QUEUE_LOCK(); > > > + tcp_log_dev_listeners++; > > > + STAILQ_INSERT_HEAD(&tcp_log_dev_reader_head, priv, > tldi_list); > > > + priv->tldi_head = STAILQ_FIRST(&tcp_log_dev_queue_head); > > > + if (priv->tldi_head != NULL) > > > + priv->tldi_cur = priv->tldi_head->tldq_buf; > > > + STAILQ_FOREACH(entry, &tcp_log_dev_queue_head, tldq_queue) > > > + TCP_LOG_DEV_QUEUE_REF(entry); > > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > > + } else { > > > + /* Free the entry. */ > > > + free(priv, M_TCPLOGDEV); > > > + } > > > + return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_write(struct cdev *dev __unused, struct uio *uio __unused, > > > + int flags __unused) > > > +{ > > > + > > > + return (ENODEV); > > > +} > > > + > > > +static __inline void > > > +tcp_log_dev_rotate_bufs(struct tcp_log_dev_info *priv, int > *lockstate) > > > +{ > > > + struct tcp_log_dev_queue *entry; > > > + > > > + KASSERT(priv->tldi_head != NULL, > > > + ("%s:%d: priv->tldi_head unexpectedly NULL", > > > + __func__, __LINE__)); > > > + KASSERT(priv->tldi_head->tldq_buf == priv->tldi_cur, > > > + ("%s:%d: buffer mismatch (%p vs %p)", > > > + __func__, __LINE__, priv->tldi_head->tldq_buf, > > > + priv->tldi_cur)); > > > + tcp_log_dev_queue_validate_lock(*lockstate); > > > + > > > + if (*lockstate == QUEUE_UNLOCKED) { > > > + TCP_LOG_DEV_QUEUE_LOCK(); > > > + *lockstate = QUEUE_LOCKED; > > > + } > > > + entry = priv->tldi_head; > > > + priv->tldi_head = STAILQ_NEXT(entry, tldq_queue); > > > + tcp_log_dev_clear_refcount(entry); > > > + priv->tldi_cur = NULL; > > > +} > > > + > > > +static int > > > +tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, int > flags) > > > +{ > > > + struct tcp_log_common_header *buf; > > > + struct tcp_log_dev_info *priv; > > > + struct tcp_log_dev_queue *entry; > > > + ssize_t len; > > > + int lockstate, rv; > > > + > > > + /* Get our private info. */ > > > + rv = devfs_get_cdevpriv((void **)&priv); > > > + if (rv) > > > + return (rv); > > > + > > > + lockstate = QUEUE_UNLOCKED; > > > + > > > + /* Do we need to get a new buffer? */ > > > + while (priv->tldi_cur == NULL || > > > + priv->tldi_cur->tlch_length <= priv->tldi_off) { > > > + /* Did we somehow forget to rotate? */ > > > + KASSERT(priv->tldi_cur == NULL, > > > + ("%s:%d: tldi_cur is unexpectedly non-NULL", __func__, > > > + __LINE__)); > > > + if (priv->tldi_cur != NULL) > > > + tcp_log_dev_rotate_bufs(priv, &lockstate); > > > + > > > + /* > > > + * Before we start looking at tldi_head, we need a lock on > the > > > + * queue to make sure tldi_head stays stable. > > > + */ > > > + if (lockstate == QUEUE_UNLOCKED) { > > > + TCP_LOG_DEV_QUEUE_LOCK(); > > > + lockstate = QUEUE_LOCKED; > > > + } > > > + > > > + /* We need the next buffer. Do we have one? */ > > > + if (priv->tldi_head == NULL && (flags & FNONBLOCK)) { > > > + rv = EAGAIN; > > > + goto done; > > > + } > > > + if (priv->tldi_head == NULL) { > > > + /* Sleep and wait for more things we can read. */ > > > + rv = mtx_sleep(&tcp_log_dev_listeners, > > > + &tcp_log_dev_queue_lock, PCATCH, "tcplogdev", > 0); > > > + if (rv) > > > + goto done; > > > + if (priv->tldi_head == NULL) > > > + continue; > > > + } > > > + > > > + /* > > > + * We have an entry to read. We want to try to create a > > > + * buffer, if one doesn't already exist. > > > + */ > > > + entry = priv->tldi_head; > > > + if (entry->tldq_buf == NULL) { > > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > + buf = (*entry->tldq_xform)(entry); > > > + if (buf == NULL) { > > > + rv = EBUSY; > > > + goto done; > > > + } > > > + entry->tldq_buf = buf; > > > + } > > > + > > > + priv->tldi_cur = entry->tldq_buf; > > > + priv->tldi_off = 0; > > > + } > > > + > > > + /* Copy what we can from this buffer to the output buffer. */ > > > + if (uio->uio_resid > 0) { > > > + /* Drop locks so we can take page faults. */ > > > + if (lockstate == QUEUE_LOCKED) > > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > > + lockstate = QUEUE_UNLOCKED; > > > + > > > + KASSERT(priv->tldi_cur != NULL, > > > + ("%s: priv->tldi_cur is unexpectedly NULL", __func__)); > > > + > > > + /* Copy as much as we can to this uio. */ > > > + len = priv->tldi_cur->tlch_length - priv->tldi_off; > > > + if (len > uio->uio_resid) > > > + len = uio->uio_resid; > > > + rv = uiomove(((uint8_t *)priv->tldi_cur) + priv->tldi_off, > > > + len, uio); > > > + if (rv != 0) > > > + goto done; > > > + priv->tldi_off += len; > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > + counter_u64_add(tcp_log_que_read, len); > > > +#endif > > > + } > > > + /* Are we done with this buffer? If so, find the next one. */ > > > + if (priv->tldi_off >= priv->tldi_cur->tlch_length) { > > > + KASSERT(priv->tldi_off == priv->tldi_cur->tlch_length, > > > + ("%s: offset (%ju) exceeds length (%ju)", __func__, > > > + (uintmax_t)priv->tldi_off, > > > + (uintmax_t)priv->tldi_cur->tlch_length)); > > > + tcp_log_dev_rotate_bufs(priv, &lockstate); > > > + } > > > +done: > > > + tcp_log_dev_queue_validate_lock(lockstate); > > > + if (lockstate == QUEUE_LOCKED) > > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > > + return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data, > > > + int fflag __unused, struct thread *td __unused) > > > +{ > > > + struct tcp_log_dev_info *priv; > > > + int rv; > > > + > > > + /* Get our private info. */ > > > + rv = devfs_get_cdevpriv((void **)&priv); > > > + if (rv) > > > + return (rv); > > > + > > > + /* > > > + * Set things. Here, we are most concerned about the non-blocking > I/O > > > + * flag. > > > + */ > > > + rv = 0; > > > + switch (cmd) { > > > + case FIONBIO: > > > + break; > > > + case FIOASYNC: > > > + if (*(int *)data != 0) > > > + rv = EINVAL; > > > + break; > > > + default: > > > + rv = ENOIOCTL; > > > + } > > > + return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_poll(struct cdev *dev __unused, int events, struct thread > *td) > > > +{ > > > + struct tcp_log_dev_info *priv; > > > + int revents; > > > + > > > + /* > > > + * Get our private info. If this fails, claim that all events are > > > + * ready. That should prod the user to do something that will > > > + * make the error evident to them. > > > + */ > > > + if (devfs_get_cdevpriv((void **)&priv)) > > > + return (events); > > > + > > > + revents = 0; > > > + if (events & (POLLIN | POLLRDNORM)) { > > > + /* > > > + * We can (probably) read right now if we are partway > through > > > + * a buffer or if we are just about to start a buffer. > > > + * Because we are going to read tldi_head, we should > acquire > > > + * a read lock on the queue. > > > + */ > > > + TCP_LOG_DEV_QUEUE_LOCK(); > > > + if ((priv->tldi_head != NULL && priv->tldi_cur == NULL) || > > > + (priv->tldi_cur != NULL && > > > + priv->tldi_off < priv->tldi_cur->tlch_length)) > > > + revents = events & (POLLIN | POLLRDNORM); > > > + else > > > + selrecord(td, &tcp_log_sel); > > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > > + } else { > > > + /* > > > + * It only makes sense to poll for reading. So, again, > prod the > > > + * user to do something that will make the error of their > ways > > > + * apparent. > > > + */ > > > + revents = events; > > > + } > > > + return (revents); > > > +} > > > + > > > +int > > > +tcp_log_dev_add_log(struct tcp_log_dev_queue *entry) > > > +{ > > > + struct tcp_log_dev_info *priv; > > > + int rv; > > > + bool wakeup_needed; > > > + > > > + KASSERT(entry->tldq_buf != NULL || entry->tldq_xform != NULL, > > > + ("%s: Called with both tldq_buf and tldq_xform set to NULL", > > > + __func__)); > > > + KASSERT(entry->tldq_dtor != NULL, > > > + ("%s: Called with tldq_dtor set to NULL", __func__)); > > > + > > > + /* Get a lock on the queue. */ > > > + TCP_LOG_DEV_QUEUE_LOCK(); > > > + > > > + /* If no one is listening, tell the caller to free the resources. > */ > > > + if (tcp_log_dev_listeners == 0) { > > > + rv = ENXIO; > > > + goto done; > > > + } > > > + > > > + /* Add this to the end of the tailq. */ > > > + STAILQ_INSERT_TAIL(&tcp_log_dev_queue_head, entry, tldq_queue); > > > + > > > + /* Add references for all current listeners. */ > > > + refcount_init(&entry->tldq_refcnt, tcp_log_dev_listeners); > > > + > > > + /* > > > + * If any listener is currently stuck on NULL, that means they are > > > + * waiting. Point their head to this new entry. > > > + */ > > > + wakeup_needed = false; > > > + STAILQ_FOREACH(priv, &tcp_log_dev_reader_head, tldi_list) > > > + if (priv->tldi_head == NULL) { > > > + priv->tldi_head = entry; > > > + wakeup_needed = true; > > > + } > > > + > > > + if (wakeup_needed) { > > > + selwakeup(&tcp_log_sel); > > > + wakeup(&tcp_log_dev_listeners); > > > + } > > > + > > > + rv = 0; > > > + > > > +done: > > > + TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > + TCP_LOG_DEV_QUEUE_UNLOCK(); > > > + return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_modevent(module_t mod __unused, int type, void *data > __unused) > > > +{ > > > + > > > + /* TODO: Support intelligent unloading. */ > > > + switch (type) { > > > + case MOD_LOAD: > > > + if (bootverbose) > > > + printf("tcp_log: tcp_log device\n"); > > > + memset(&tcp_log_sel, 0, sizeof(tcp_log_sel)); > > > + memset(&tcp_log_dev_queue_lock, 0, sizeof(struct mtx)); > > > + mtx_init(&tcp_log_dev_queue_lock, "tcp_log dev", > > > + "tcp_log device queues", MTX_DEF); > > > + tcp_log_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, > > > + &tcp_log_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0400, > > > + "tcp_log"); > > > + break; > > > + default: > > > + return (EOPNOTSUPP); > > > + } > > > + > > > + return (0); > > > +} > > > + > > > +DEV_MODULE(tcp_log_dev, tcp_log_dev_modevent, NULL); > > > +MODULE_VERSION(tcp_log_dev, 1); > > > > > > Added: head/sys/dev/tcp_log/tcp_log_dev.h > > > ============================================================ > ================== > > > --- /dev/null 00:00:00 1970 (empty, because file is newly > added) > > > +++ head/sys/dev/tcp_log/tcp_log_dev.h Thu Mar 22 09:40:08 2018 > (r331347) > > > @@ -0,0 +1,88 @@ > > > +/*- > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > > + * > > > + * Copyright (c) 2016 > > > + * Netflix Inc. All rights reserved. > > > + * > > > + * Redistribution and use in source and binary forms, with or without > > > + * modification, are permitted provided that the following conditions > > > + * are met: > > > + * 1. Redistributions of source code must retain the above copyright > > > + * notice, this list of conditions and the following disclaimer. > > > + * 2. Redistributions in binary form must reproduce the above > copyright > > > + * notice, this list of conditions and the following disclaimer in > the > > > + * documentation and/or other materials provided with the > distribution. > > > + * > > > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' > AND > > > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, > THE > > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR > PURPOSE > > > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE > LIABLE > > > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL > > > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE > GOODS > > > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > INTERRUPTION) > > > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > CONTRACT, STRICT > > > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN > ANY WAY > > > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF > > > + * SUCH DAMAGE. > > > + * > > > + * $FreeBSD$ > > > + */ > > > + > > > +#ifndef __tcp_log_dev_h__ > > > +#define __tcp_log_dev_h__ > > > + > > > +/* > > > + * This is the common header for data streamed from the log device. > All > > > + * blocks of data need to start with this header. > > > + */ > > > +struct tcp_log_common_header { > > > + uint32_t tlch_version; /* Version is specific to type. */ > > > + uint32_t tlch_type; /* Type of entry(ies) that follow. > */ > > > + uint64_t tlch_length; /* Total length, including header. > */ > > > +} __packed; > > > + > > > +#define TCP_LOG_DEV_TYPE_BBR 1 /* black box recorder */ > > > + > > > +#ifdef _KERNEL > > > +/* > > > + * This is a queue entry. All queue entries need to start with this > structure > > > + * so the common code can cast them to this structure; however, other > modules > > > + * are free to include additional data after this structure. > > > + * > > > + * The elements are explained here: > > > + * tldq_queue: used by the common code to maintain this entry's > position in the > > > + * queue. > > > + * tldq_buf: should be NULL, or a pointer to a chunk of data. The > data must be > > > + * as long as the common header indicates. > > > + * tldq_xform: If tldq_buf is NULL, the code will call this to create > the > > > + * the tldq_buf object. The function should *not* directly modify > tldq_buf, > > > + * but should return the buffer (which must meet the restrictions > > > + * indicated for tldq_buf). > > > + * tldq_dtor: This function is called to free the queue entry. If > tldq_buf is > > > + * not NULL, the dtor function must free that, too. > > > + * tldq_refcnt: used by the common code to indicate how many readers > still need > > > + * this data. > > > + */ > > > +struct tcp_log_dev_queue { > > > + STAILQ_ENTRY(tcp_log_dev_queue) tldq_queue; > > > + struct tcp_log_common_header *tldq_buf; > > > + struct tcp_log_common_header *(*tldq_xform)(struct > tcp_log_dev_queue *entry); > > > + void (*tldq_dtor)(struct tcp_log_dev_queue *entry); > > > + volatile u_int tldq_refcnt; > > > +}; > > > + > > > +STAILQ_HEAD(log_queueh, tcp_log_dev_queue); > > > + > > > +struct tcp_log_dev_info { > > > + STAILQ_ENTRY(tcp_log_dev_info) tldi_list; > > > + struct tcp_log_dev_queue *tldi_head; > > > + struct tcp_log_common_header *tldi_cur; > > > + off_t tldi_off; > > > +}; > > > +STAILQ_HEAD(log_infoh, tcp_log_dev_info); > > > + > > > + > > > +MALLOC_DECLARE(M_TCPLOGDEV); > > > +int tcp_log_dev_add_log(struct tcp_log_dev_queue *entry); > > > +#endif /* _KERNEL */ > > > +#endif /* !__tcp_log_dev_h__ */ > > > > > > Modified: head/sys/kern/subr_witness.c > > > ============================================================ > ================== > > > --- head/sys/kern/subr_witness.c Thu Mar 22 08:32:39 2018 > (r331346) > > > +++ head/sys/kern/subr_witness.c Thu Mar 22 09:40:08 2018 > (r331347) > > > @@ -640,6 +640,14 @@ static struct witness_order_list_entry > order_lists[] = > > > { "db->db_mtx", &lock_class_sx }, > > > { NULL, NULL }, > > > /* > > > + * TCP log locks > > > + */ > > > + { "TCP ID tree", &lock_class_rw }, > > > + { "tcp log id bucket", &lock_class_mtx_sleep }, > > > + { "tcpinp", &lock_class_rw }, > > > + { "TCP log expireq", &lock_class_mtx_sleep }, > > > + { NULL, NULL }, > > > + /* > > > * spin locks > > > */ > > > #ifdef SMP > > > > > > Modified: head/sys/netinet/tcp.h > > > ============================================================ > ================== > > > --- head/sys/netinet/tcp.h Thu Mar 22 08:32:39 2018 (r331346) > > > +++ head/sys/netinet/tcp.h Thu Mar 22 09:40:08 2018 (r331347) > > > @@ -168,6 +168,12 @@ struct tcphdr { > > > #define TCP_NOOPT 8 /* don't use TCP options */ > > > #define TCP_MD5SIG 16 /* use MD5 digests (RFC2385) */ > > > #define TCP_INFO 32 /* retrieve tcp_info structure */ > > > +#define TCP_LOG 34 /* configure event logging for > connection */ > > > +#define TCP_LOGBUF 35 /* retrieve event log for > connection */ > > > +#define TCP_LOGID 36 /* configure log ID to correlate > connections */ > > > +#define TCP_LOGDUMP 37 /* dump connection log events to > device */ > > > +#define TCP_LOGDUMPID 38 /* dump events from connections > with same ID to > > > + device */ > > > #define TCP_CONGESTION 64 /* get/set congestion control > algorithm */ > > > #define TCP_CCALGOOPT 65 /* get/set cc algorithm specific > options */ > > > #define TCP_KEEPINIT 128 /* N, time to establish connection > */ > > > @@ -188,6 +194,9 @@ struct tcphdr { > > > #define TCPI_OPT_WSCALE 0x04 > > > #define TCPI_OPT_ECN 0x08 > > > #define TCPI_OPT_TOE 0x10 > > > + > > > +/* Maximum length of log ID. */ > > > +#define TCP_LOG_ID_LEN 64 > > > > > > /* > > > * The TCP_INFO socket option comes from the Linux 2.6 TCP API, and > permits > > > > > > Modified: head/sys/netinet/tcp_input.c > > > ============================================================ > ================== > > > --- head/sys/netinet/tcp_input.c Thu Mar 22 08:32:39 2018 > (r331346) > > > +++ head/sys/netinet/tcp_input.c Thu Mar 22 09:40:08 2018 > (r331347) > > > @@ -102,6 +102,7 @@ __FBSDID("$FreeBSD$"); > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -1592,6 +1593,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr > *th, stru > > > /* Save segment, if requested. */ > > > tcp_pcap_add(th, m, &(tp->t_inpkts)); > > > #endif > > > + TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0, > > > + tlen, NULL, true); > > > > > > if ((thflags & TH_SYN) && (thflags & TH_FIN) && V_drop_synfin) { > > > if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { > > > > > > Added: head/sys/netinet/tcp_log_buf.c > > > ============================================================ > ================== > > > --- /dev/null 00:00:00 1970 (empty, because file is newly > added) > > > +++ head/sys/netinet/tcp_log_buf.c Thu Mar 22 09:40:08 2018 > (r331347) > > > @@ -0,0 +1,2480 @@ > > > +/*- > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > > + * > > > + * Copyright (c) 2016-2018 > > > + * Netflix Inc. All rights reserved. > > > + * > > > + * Redistribution and use in source and binary forms, with or without > > > + * modification, are permitted provided that the following conditions > > > + * are met: > > > + * 1. Redistributions of source code must retain the above copyright > > > + * notice, this list of conditions and the following disclaimer. > > > + * 2. Redistributions in binary form must reproduce the above > copyright > > > + * notice, this list of conditions and the following disclaimer in > the > > > + * documentation and/or other materials provided with the > distribution. > > > + * > > > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' > AND > > > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, > THE > > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR > PURPOSE > > > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE > LIABLE > > > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL > > > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE > GOODS > > > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > INTERRUPTION) > > > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > CONTRACT, STRICT > > > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN > ANY WAY > > > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF > > > + * SUCH DAMAGE. > > > + * > > > + */ > > > + > > > +#include > > > +__FBSDID("$FreeBSD$"); > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +#include > > > + > > > +#include > > > +#include > > > +#include > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +/* Default expiry time */ > > > +#define TCP_LOG_EXPIRE_TIME ((sbintime_t)60 * SBT_1S) > > > + > > > +/* Max interval at which to run the expiry timer */ > > > +#define TCP_LOG_EXPIRE_INTVL ((sbintime_t)5 * SBT_1S) > > > + > > > +bool tcp_log_verbose; > > > +static uma_zone_t tcp_log_bucket_zone, tcp_log_node_zone, > tcp_log_zone; > > > +static int tcp_log_session_limit = TCP_LOG_BUF_DEFAULT_SESSION_LIMIT; > > > +static uint32_t tcp_log_version = TCP_LOG_BUF_VER; > > > +RB_HEAD(tcp_log_id_tree, tcp_log_id_bucket); > > > +static struct tcp_log_id_tree tcp_log_id_head; > > > +static STAILQ_HEAD(, tcp_log_id_node) tcp_log_expireq_head = > > > + STAILQ_HEAD_INITIALIZER(tcp_log_expireq_head); > > > +static struct mtx tcp_log_expireq_mtx; > > > +static struct callout tcp_log_expireq_callout; > > > +static uint64_t tcp_log_auto_ratio = 0; > > > +static uint64_t tcp_log_auto_ratio_cur = 0; > > > +static uint32_t tcp_log_auto_mode = TCP_LOG_STATE_TAIL; > > > +static bool tcp_log_auto_all = false; > > > + > > > +RB_PROTOTYPE_STATIC(tcp_log_id_tree, tcp_log_id_bucket, tlb_rb, > tcp_log_id_cmp) > > > + > > > +SYSCTL_NODE(_net_inet_tcp, OID_AUTO, bb, CTLFLAG_RW, 0, "TCP Black > Box controls"); > > > + > > > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_verbose, CTLFLAG_RW, > &tcp_log_verbose, > > > + 0, "Force verbose logging for TCP traces"); > > > + > > > +SYSCTL_INT(_net_inet_tcp_bb, OID_AUTO, log_session_limit, > > > + CTLFLAG_RW, &tcp_log_session_limit, 0, > > > + "Maximum number of events maintained for each TCP session"); > > > + > > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_global_limit, > CTLFLAG_RW, > > > + &tcp_log_zone, "Maximum number of events maintained for all TCP > sessions"); > > > + > > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_global_entries, > CTLFLAG_RD, > > > + &tcp_log_zone, "Current number of events maintained for all TCP > sessions"); > > > + > > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_limit, CTLFLAG_RW, > > > + &tcp_log_bucket_zone, "Maximum number of log IDs"); > > > + > > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_entries, > CTLFLAG_RD, > > > + &tcp_log_bucket_zone, "Current number of log IDs"); > > > + > > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_limit, > CTLFLAG_RW, > > > + &tcp_log_node_zone, "Maximum number of tcpcbs with log IDs"); > > > + > > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_entries, > CTLFLAG_RD, > > > + &tcp_log_node_zone, "Current number of tcpcbs with log IDs"); > > > + > > > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_version, CTLFLAG_RD, > &tcp_log_version, > > > + 0, "Version of log formats exported"); > > > + > > > +SYSCTL_U64(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW, > > > + &tcp_log_auto_ratio, 0, "Do auto capturing for 1 out of N > sessions"); > > > + > > > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_auto_mode, CTLFLAG_RW, > > > + &tcp_log_auto_mode, TCP_LOG_STATE_HEAD_AUTO, > > > + "Logging mode for auto-selected sessions (default is > TCP_LOG_STATE_HEAD_AUTO)"); > > > + > > > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_auto_all, CTLFLAG_RW, > > > + &tcp_log_auto_all, false, > > > + "Auto-select from all sessions (rather than just those with > IDs)"); > > > + > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > +counter_u64_t tcp_log_queued; > > > +counter_u64_t tcp_log_que_fail1; > > > +counter_u64_t tcp_log_que_fail2; > > > +counter_u64_t tcp_log_que_fail3; > > > +counter_u64_t tcp_log_que_fail4; > > > +counter_u64_t tcp_log_que_fail5; > > > +counter_u64_t tcp_log_que_copyout; > > > +counter_u64_t tcp_log_que_read; > > > +counter_u64_t tcp_log_que_freed; > > > + > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, queued, CTLFLAG_RD, > > > + &tcp_log_queued, "Number of entries queued"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail1, CTLFLAG_RD, > > > + &tcp_log_que_fail1, "Number of entries queued but fail 1"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail2, CTLFLAG_RD, > > > + &tcp_log_que_fail2, "Number of entries queued but fail 2"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail3, CTLFLAG_RD, > > > + &tcp_log_que_fail3, "Number of entries queued but fail 3"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail4, CTLFLAG_RD, > > > + &tcp_log_que_fail4, "Number of entries queued but fail 4"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail5, CTLFLAG_RD, > > > + &tcp_log_que_fail5, "Number of entries queued but fail 4"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, copyout, CTLFLAG_RD, > > > + &tcp_log_que_copyout, "Number of entries copied out"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, read, CTLFLAG_RD, > > > + &tcp_log_que_read, "Number of entries read from the queue"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, freed, CTLFLAG_RD, > > > + &tcp_log_que_freed, "Number of entries freed after reading"); > > > +#endif > > > + > > > +#ifdef INVARIANTS > > > +#define TCPLOG_DEBUG_RINGBUF > > > +#endif > > > + > > > +struct tcp_log_mem > > > +{ > > > + STAILQ_ENTRY(tcp_log_mem) tlm_queue; > > > + struct tcp_log_buffer tlm_buf; > > > + struct tcp_log_verbose tlm_v; > > > +#ifdef TCPLOG_DEBUG_RINGBUF > > > + volatile int tlm_refcnt; > > > +#endif > > > +}; > > > + > > > +/* 60 bytes for the header, + 16 bytes for padding */ > > > +static uint8_t zerobuf[76]; > > > + > > > +/* > > > + * Lock order: > > > + * 1. TCPID_TREE > > > + * 2. TCPID_BUCKET > > > + * 3. INP > > > + * > > > + * Rules: > > > + * A. You need a lock on the Tree to add/remove buckets. > > > + * B. You need a lock on the bucket to add/remove nodes from the > bucket. > > > + * C. To change information in a node, you need the INP lock if the > tln_closed > > > + * field is false. Otherwise, you need the bucket lock. (Note that > the > > > + * tln_closed field can change at any point, so you need to > recheck the > > > + * entry after acquiring the INP lock.) > > > + * D. To remove a node from the bucket, you must have that entry > locked, > > > + * according to the criteria of Rule C. Also, the node must not be > on > > > + * the expiry queue. > > > + * E. The exception to C is the expiry queue fields, which are locked > by > > > + * the TCPLOG_EXPIREQ lock. > > > + * > > > + * Buckets have a reference count. Each node is a reference. Further, > > > + * other callers may add reference counts to keep a bucket from > disappearing. > > > + * You can add a reference as long as you own a lock sufficient to > keep the > > > + * bucket from disappearing. For example, a common use is: > > > + * a. Have a locked INP, but need to lock the TCPID_BUCKET. > > > + * b. Add a refcount on the bucket. (Safe because the INP lock > prevents > > > + * the TCPID_BUCKET from going away.) > > > + * c. Drop the INP lock. > > > + * d. Acquire a lock on the TCPID_BUCKET. > > > + * e. Acquire a lock on the INP. > > > + * f. Drop the refcount on the bucket. > > > + * (At this point, the bucket may disappear.) > > > + * > > > + * Expire queue lock: > > > + * You can acquire this with either the bucket or INP lock. Don't > reverse it. > > > + * When the expire code has committed to freeing a node, it resets > the expiry > > > + * time to SBT_MAX. That is the signal to everyone else that they > should > > > + * leave that node alone. > > > + */ > > > +static struct rwlock tcp_id_tree_lock; > > > +#define TCPID_TREE_WLOCK() rw_wlock(&tcp_id_tree_lock) > > > +#define TCPID_TREE_RLOCK() rw_rlock(&tcp_id_tree_lock) > > > +#define TCPID_TREE_UPGRADE() > rw_try_upgrade(&tcp_id_tree_lock) > > > +#define TCPID_TREE_WUNLOCK() > rw_wunlock(&tcp_id_tree_lock) > > > +#define TCPID_TREE_RUNLOCK() > rw_runlock(&tcp_id_tree_lock) > > > +#define TCPID_TREE_WLOCK_ASSERT() > rw_assert(&tcp_id_tree_lock, RA_WLOCKED) > > > +#define TCPID_TREE_RLOCK_ASSERT() > rw_assert(&tcp_id_tree_lock, RA_RLOCKED) > > > +#define TCPID_TREE_UNLOCK_ASSERT() > rw_assert(&tcp_id_tree_lock, RA_UNLOCKED) > > > + > > > +#define TCPID_BUCKET_LOCK_INIT(tlb) > mtx_init(&((tlb)->tlb_mtx), "tcp log id bucket", NULL, MTX_DEF) > > > +#define TCPID_BUCKET_LOCK_DESTROY(tlb) > mtx_destroy(&((tlb)->tlb_mtx)) > > > +#define TCPID_BUCKET_LOCK(tlb) mtx_lock(&((tlb)->tlb_mtx)) > > > +#define TCPID_BUCKET_UNLOCK(tlb) > mtx_unlock(&((tlb)->tlb_mtx)) > > > +#define TCPID_BUCKET_LOCK_ASSERT(tlb) > mtx_assert(&((tlb)->tlb_mtx), MA_OWNED) > > > +#define TCPID_BUCKET_UNLOCK_ASSERT(tlb) > mtx_assert(&((tlb)->tlb_mtx), MA_NOTOWNED) > > > + > > > +#define TCPID_BUCKET_REF(tlb) > refcount_acquire(&((tlb)->tlb_refcnt)) > > > +#define TCPID_BUCKET_UNREF(tlb) > refcount_release(&((tlb)->tlb_refcnt)) > > > + > > > +#define TCPLOG_EXPIREQ_LOCK() > mtx_lock(&tcp_log_expireq_mtx) > > > +#define TCPLOG_EXPIREQ_UNLOCK() > mtx_unlock(&tcp_log_expireq_mtx) > > > + > > > +SLIST_HEAD(tcp_log_id_head, tcp_log_id_node); > > > + > > > +struct tcp_log_id_bucket > > > +{ > > > + /* > > > + * tlb_id must be first. This lets us use strcmp on > > > + * (struct tcp_log_id_bucket *) and (char *) interchangeably. > > > + */ > > > + char tlb_id[TCP_LOG_ID_LEN]; > > > + RB_ENTRY(tcp_log_id_bucket) tlb_rb; > > > + struct tcp_log_id_head tlb_head; > > > + struct mtx tlb_mtx; > > > + volatile u_int tlb_refcnt; > > > +}; > > > + > > > +struct tcp_log_id_node > > > +{ > > > + SLIST_ENTRY(tcp_log_id_node) tln_list; > > > + STAILQ_ENTRY(tcp_log_id_node) tln_expireq; /* Locked by the > expireq lock */ > > > + sbintime_t tln_expiretime; /* Locked by the expireq > lock */ > > > + > > > + /* > > > + * If INP is NULL, that means the connection has closed. We've > > > + * saved the connection endpoint information and the log entries > > > + * in the tln_ie and tln_entries members. We've also saved a > pointer > > > + * to the enclosing bucket here. If INP is not NULL, the > information is > > > + * in the PCB and not here. > > > + */ > > > + struct inpcb *tln_inp; > > > + struct tcpcb *tln_tp; > > > + struct tcp_log_id_bucket *tln_bucket; > > > + struct in_endpoints tln_ie; > > > + struct tcp_log_stailq tln_entries; > > > + int tln_count; > > > + volatile int tln_closed; > > > + uint8_t tln_af; > > > +}; > > > + > > > +enum tree_lock_state { > > > + TREE_UNLOCKED = 0, > > > + TREE_RLOCKED, > > > + TREE_WLOCKED, > > > +}; > > > + > > > +/* Do we want to select this session for auto-logging? */ > > > +static __inline bool > > > +tcp_log_selectauto(void) > > > +{ > > > + > > > + /* > > > > > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > > > > > From owner-svn-src-head@freebsd.org Thu Mar 22 17:49:28 2018 Return-Path: Delivered-To: svn-src-head@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 803A6F5B28C; Thu, 22 Mar 2018 17:49:28 +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 2DCC981D25; Thu, 22 Mar 2018 17:49:28 +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 287FE147B7; Thu, 22 Mar 2018 17:49:28 +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 w2MHnRSD012756; Thu, 22 Mar 2018 17:49:27 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MHnRNR012755; Thu, 22 Mar 2018 17:49:27 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201803221749.w2MHnRNR012755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 22 Mar 2018 17:49:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331364 - head/release/tools X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/tools X-SVN-Commit-Revision: 331364 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 17:49:28 -0000 Author: gjb Date: Thu Mar 22 17:49:27 2018 New Revision: 331364 URL: https://svnweb.freebsd.org/changeset/base/331364 Log: Remove google_accounts_manager from VM_RC_LIST in the GCE configuration file, no longer needed. PR: 221714 MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/tools/gce.conf Modified: head/release/tools/gce.conf ============================================================================== --- head/release/tools/gce.conf Thu Mar 22 17:46:38 2018 (r331363) +++ head/release/tools/gce.conf Thu Mar 22 17:49:27 2018 (r331364) @@ -9,7 +9,7 @@ export VM_EXTRA_PACKAGES="firstboot-freebsd-update fir sysutils/py-google-compute-engine" # Set to a list of third-party software to enable in rc.conf(5). -export VM_RC_LIST="google_accounts_manager ntpd sshd firstboot_growfs \ +export VM_RC_LIST="ntpd sshd firstboot_growfs \ firstboot_pkgs firstboot_freebsd_update google_startup \ google_accounts_daemon google_clock_skew_daemon google_instance_setup google_ip_forwarding_daemon From owner-svn-src-head@freebsd.org Thu Mar 22 18:13:01 2018 Return-Path: Delivered-To: svn-src-head@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 E8AEDF5D2DA for ; Thu, 22 Mar 2018 18:13:00 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-wr0-x22a.google.com (mail-wr0-x22a.google.com [IPv6:2a00:1450:400c:c0c::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5D0B5830FD for ; Thu, 22 Mar 2018 18:13:00 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-wr0-x22a.google.com with SMTP id 80so8574646wrb.2 for ; Thu, 22 Mar 2018 11:13:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=dbMg26+8QMVVAAmclmVuYLj11uMaRB4D/K9SMlPfMyk=; b=NkvdOLgv/7whh1G4+mnQUa1yYkcAHtImbrzKEgcqwUr52pPIQoGR6mWDmzSzABjYQ0 8diAxtK+Wezz0kFKJFCroJBvrtHwyEiN9MRukR5FJUERqZBrx7201FBHgMbDLqga4njz FHgg7i61Ooq3L4LNlbXIG7waHrPVA5WSlkwa0R5l6jGIDeOcyMmqphJO01v7GR6KiqKk 924xOfJipendArXIJHXDU0gTjCtwhFk2QZ6u9QduaTf8qJgtt1L4KqR/psDLTrAUxA0i xn25ESNgFp7fkIwcS+c/kH+DR7uPKOCpZTmsp195YwKo66SDAKXqUqStzWoXMtOzTpbV 9UGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=dbMg26+8QMVVAAmclmVuYLj11uMaRB4D/K9SMlPfMyk=; b=p40bGK4RnBbLHEri6LAFLdN/ldgKq5hB+vxDryFHHDOGFwXfh0uBtlCr7Bm3CARymg 1elqAYzSIZ5Dj8fTsf3fZBnqrvgyvhPNNO58+zqPH462SY6iplM4z6PsglUQLBEcGnQn Pqv9trGSS0hkkC5dS9O+08+VzLEw4i6auRrrKfA95DTReu/BCuYNeXRg7sTda87uahaR CwSgbsQsTvmxE0GYDZelEJ0FfFK9P+8KRwMCjo1I7DGPzoY7neif+Ai5s3b87Kp+cOJl e/Fl2GHhZcZNbZL7rO+ZKlWHR0pL4O7ZuDYNGbe2N1ycPfNMEukD67i1vywB4WaQiVVG O7aA== X-Gm-Message-State: AElRT7HDPmXZUzByPs2HjEtc8DBIoMJu12LxLrcVBYKb4xsoEizkwzYb uQNCDyul13tRP82FZ2Wic8pYr8lN9B4= X-Google-Smtp-Source: AG47ELvzgn0HGCmX8Xd+wvq54/8anPaS8d7j6PFpdT+Ov79uocA3didhlMnGDdv+LdzFMUkYnqDdoQ== X-Received: by 10.223.179.9 with SMTP id j9mr16857496wrd.276.1521742378718; Thu, 22 Mar 2018 11:12:58 -0700 (PDT) Received: from [10.10.1.111] ([185.97.61.1]) by smtp.gmail.com with ESMTPSA id t132sm8648783wme.8.2018.03.22.11.12.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 11:12:57 -0700 (PDT) Subject: Re: svn commit: r331209 - head To: Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803191527.w2JFRr7B058668@repo.freebsd.org> From: Steven Hartland Message-ID: <8d9b163b-fcaa-3e9c-5972-8dc300f64b52@multiplay.co.uk> Date: Thu, 22 Mar 2018 18:13:29 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <201803191527.w2JFRr7B058668@repo.freebsd.org> Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 18:13:01 -0000 I think it would be worth specifically detailing the steps to achieve this, as its not immediately obvious how this would be done. On 19/03/2018 15:27, Kyle Evans wrote: > Author: kevans > Date: Mon Mar 19 15:27:53 2018 > New Revision: 331209 > URL: https://svnweb.freebsd.org/changeset/base/331209 > > Log: > Add note to UPDATING about UEFI changes requiring loader(8) update > > These problems have only been observed with boards using U-Boot (e.g. ARM) > where virtual addresses are already set in the memory map by the firmware > and the firmware is expecting a call to SetVirtualAddressMap to be made. > I refrain from mentioning this in the note because this could also be the > case on some not-yet-tested firmware on amd64 and it's not a bad > recommendation for the general case. > > Modified: > head/UPDATING > > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Mon Mar 19 15:11:10 2018 (r331208) > +++ head/UPDATING Mon Mar 19 15:27:53 2018 (r331209) > @@ -51,6 +51,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: > > ****************************** SPECIAL WARNING: ****************************** > > +20180319: > + For UEFI systems: the UEFI loader(8), loader.efi, should be updated in > + conjunction with installing a new kernel after r330868. The kernel, > + after this revision, will be more lenient when mapping addresses for > + UEFI Runtime Services and this may result in a kernel panic without the > + corresponding loader(8) update. > + > 20180212: > FreeBSD boot loader enhanced with Lua scripting. It's purely opt-in for > now by building WITH_LOADER_LUA and WITHOUT_FORTH in /etc/src.conf. > From owner-svn-src-head@freebsd.org Thu Mar 22 18:16:17 2018 Return-Path: Delivered-To: svn-src-head@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 6E3BDF5D7D2; Thu, 22 Mar 2018 18:16:17 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D0E3D834E5; Thu, 22 Mar 2018 18:16:16 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f45.google.com with SMTP id t132-v6so14584838lfe.2; Thu, 22 Mar 2018 11:16:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8JMwZbBfLBgXyN6hdWbFmymAucU2KEpsZZQ3SwHL1lE=; b=KDSCDRCvXLFff2A6t+kn5t7CSfm47ytrpWbds9aAQ9Al76UiHflULgwjF2Xyjori/H 2FI1xFrnmTNSXrroFWOAiaqL/9W0RcItnNdIkNufc3Sp7vYxdax+kCPqRfpi4DkZgife TDTvXplq0qh1CjLC+2Ni6ED109lPuwypxrUzoBXzFEssCR62nUf9+/2qEr4sk2RF1/1V GhDfC/HBxZD1zOTWLiiZES18BFfxrzdYo68sfu8WRAfDzZEBItl+WfDp/AM53SB1k27N eft8TR6gBKNu72dxAa6zDuLLxv7qRSlGWPCkOP6F+++XqD8Xr+kXR8SKsFizYM0ow46Y DihA== X-Gm-Message-State: AElRT7FzexC8o4pir8w911YBr1HnaTCZIDtP2h9RoqPNNpNc/DDYM0xB 5c1HB42YPa0NQOjHQ/LG0YMT+02Ym7I= X-Google-Smtp-Source: AIpwx4/p3WoT0X3apH2GnUXhNuJFDxqcZ3Zs0d0iqEBXOoyr8yqYs0MCcXrkwZIoIFivS57s48QPhA== X-Received: by 10.46.17.23 with SMTP id f23mr2586820lje.43.1521742574507; Thu, 22 Mar 2018 11:16:14 -0700 (PDT) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com. [209.85.215.46]) by smtp.gmail.com with ESMTPSA id l77-v6sm1751064lfk.62.2018.03.22.11.16.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 11:16:14 -0700 (PDT) Received: by mail-lf0-f46.google.com with SMTP id z143-v6so14579727lff.3; Thu, 22 Mar 2018 11:16:14 -0700 (PDT) X-Received: by 10.46.127.30 with SMTP id a30mr2507228ljd.93.1521742574243; Thu, 22 Mar 2018 11:16:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Thu, 22 Mar 2018 11:15:53 -0700 (PDT) In-Reply-To: <8d9b163b-fcaa-3e9c-5972-8dc300f64b52@multiplay.co.uk> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <8d9b163b-fcaa-3e9c-5972-8dc300f64b52@multiplay.co.uk> From: Kyle Evans Date: Thu, 22 Mar 2018 13:15:53 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331209 - head To: Steven Hartland Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 18:16:17 -0000 On Thu, Mar 22, 2018 at 1:13 PM, Steven Hartland wrote: > I think it would be worth specifically detailing the steps to achieve this, > as its not immediately obvious how this would be done. > Hi, A later commit clarified, but then an even later commit made these instructions obsolete. =) The problem this entry was made for has been eradicated, and the entry has since been removed. Thanks, Kyle Evans From owner-svn-src-head@freebsd.org Thu Mar 22 18:23:15 2018 Return-Path: Delivered-To: svn-src-head@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 04647F5E379; Thu, 22 Mar 2018 18:23:15 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-40.csi.cam.ac.uk (ppsw-40.csi.cam.ac.uk [131.111.8.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7FBA783B50; Thu, 22 Mar 2018 18:23:14 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:35633) by ppsw-40.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1ez4rp-000sJt-jZ (Exim 4.89_2) (return-path ); Thu, 22 Mar 2018 18:23:13 +0000 Date: Thu, 22 Mar 2018 18:14:15 +0000 From: Ruslan Bukin To: Jonathan Looney Cc: "Jonathan T. Looney" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat Message-ID: <20180322181415.GA8657@bsdpad.com> References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> <20180322142225.GA5139@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 18:23:15 -0000 Look at these https://ci.freebsd.org/job/FreeBSD-head-mips-build/lastBuild/console https://ci.freebsd.org/job/FreeBSD-head-powerpc-build/lastBuild/console Example make -j5 TARGET=mips TARGET_ARCH=mipsel kernel-toolchain make -j5 TARGET=mips TARGET_ARCH=mipsel KERNCONF=CANNA buildkernel Ruslan On Thu, Mar 22, 2018 at 03:39:23PM +0000, Jonathan Looney wrote: > A tinderbox build didn't complain about atomic_fetchadd_64, so I assume it > is OK. > Yes, this can be made optional, if there is a need for that. > Jonathan > On Thu, Mar 22, 2018 at 2:22 PM, Ruslan Bukin > <[1]ruslan.bukin@cl.cam.ac.uk> wrote: > > Also can this be pluggable ? > It looks like it is optional device which means it can free up some > space in embedded environment when unused > Ruslan > On Thu, Mar 22, 2018 at 02:16:06PM +0000, Ruslan Bukin wrote: > > We don't have atomic_fetchadd_64 for mips32 I think > > > > Ruslan > > > > On Thu, Mar 22, 2018 at 09:40:08AM +0000, Jonathan T. Looney wrote: > > > Author: jtl > > > Date: Thu Mar 22 09:40:08 2018 > > > New Revision: 331347 > > > URL: [2]https://svnweb.freebsd.org/changeset/base/331347 > > > > > > Log: > > >   Add the "TCP Blackbox Recorder" which we discussed at the > developer > > >   summits at BSDCan and BSDCam in 2017. > > > > > >   The TCP Blackbox Recorder allows you to capture events on a TCP > connection > > >   in a ring buffer. It stores metadata with the event. It > optionally stores > > >   the TCP header associated with an event (if the event is > associated with a > > >   packet) and also optionally stores information on the sockets. > > > > > >   It supports setting a log ID on a TCP connection and using this > to correlate > > >   multiple connections that share a common log ID. > > > > > >   You can log connections in different modes. If you are doing a > coordinated > > >   test with a particular connection, you may tell the system to > put it in > > >   mode 4 (continuous dump). Or, if you just want to monitor for > errors, you > > >   can put it in mode 1 (ring buffer) and dump all the ring buffers > associated > > >   with the connection ID when we receive an error signal for that > connection > > >   ID. You can set a default mode that will be applied to a > particular ratio > > >   of incoming connections. You can also manually set a mode using > a socket > > >   option. > > > > > >   This commit includes only basic probes. rrs@ has added quite an > abundance > > >   of probes in his TCP development work. He plans to commit those > soon. > > > > > >   There are user-space programs which we plan to commit as ports. > These read > > >   the data from the log device and output pcapng files, and then > let you > > >   analyze the data (and metadata) in the pcapng files. > > > > > >   Reviewed by:      gnn (previous version) > > >   Obtained from:    Netflix, Inc. > > >   Relnotes: yes > > >   Differential Revision:    > [3]https://reviews.freebsd.org/D11085 > > > > > > Added: > > >   head/sys/dev/tcp_log/ > > >   head/sys/dev/tcp_log/tcp_log_dev.c   (contents, props changed) > > >   head/sys/dev/tcp_log/tcp_log_dev.h   (contents, props changed) > > >   head/sys/netinet/tcp_log_buf.c   (contents, props changed) > > >   head/sys/netinet/tcp_log_buf.h   (contents, props changed) > > > Modified: > > >   head/etc/mtree/BSD.include.dist > > >   head/include/Makefile > > >   head/sys/conf/files > > >   head/sys/kern/subr_witness.c > > >   head/sys/netinet/tcp.h > > >   head/sys/netinet/tcp_input.c > > >   head/sys/netinet/tcp_output.c > > >   head/sys/netinet/tcp_subr.c > > >   head/sys/netinet/tcp_timer.c > > >   head/sys/netinet/tcp_usrreq.c > > >   head/sys/netinet/tcp_var.h > > >   head/usr.bin/netstat/inet.c > > >   head/usr.bin/netstat/main.c > > >   head/usr.bin/netstat/netstat.1 > > >   head/usr.bin/netstat/netstat.h > > > > > > Modified: head/etc/mtree/BSD.include.dist > > > > ============================================================================== > > > --- head/etc/mtree/BSD.include.dist Thu Mar 22 08:32:39 2018      >   (r331346) > > > +++ head/etc/mtree/BSD.include.dist Thu Mar 22 09:40:08 2018      >   (r331347) > > > @@ -158,6 +158,8 @@ > > >          .. > > >          speaker > > >          .. > > > +        tcp_log > > > +        .. > > >          usb > > >          .. > > >          vkbd > > > > > > Modified: head/include/Makefile > > > > ============================================================================== > > > --- head/include/Makefile   Thu Mar 22 08:32:39 2018        > (r331346) > > > +++ head/include/Makefile   Thu Mar 22 09:40:08 2018        > (r331347) > > > @@ -47,7 +47,7 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ > > >     dev/hwpmc dev/hyperv \ > > >     dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ > > >     dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus > dev/smbus \ > > > -   dev/speaker dev/vkbd dev/wi \ > > > +   dev/speaker dev/tcp_log dev/vkbd dev/wi \ > > >     fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ > > >     fs/procfs fs/smbfs fs/udf fs/unionfs \ > > >     geom/cache geom/concat geom/eli geom/gate geom/journal > geom/label \ > > > > > > Modified: head/sys/conf/files > > > > ============================================================================== > > > --- head/sys/conf/files     Thu Mar 22 08:32:39 2018        > (r331346) > > > +++ head/sys/conf/files     Thu Mar 22 09:40:08 2018        > (r331347) > > > @@ -3161,6 +3161,7 @@ dev/syscons/star/star_saver.c optional > star_saver > > >  dev/syscons/syscons.c              optional sc > > >  dev/syscons/sysmouse.c             optional sc > > >  dev/syscons/warp/warp_saver.c      optional warp_saver > > > +dev/tcp_log/tcp_log_dev.c  optional inet | inet6 > > >  dev/tdfx/tdfx_linux.c              optional tdfx_linux tdfx > compat_linux > > >  dev/tdfx/tdfx_pci.c                optional tdfx pci > > >  dev/ti/if_ti.c                     optional ti pci > > > @@ -4309,6 +4310,7 @@ netinet/tcp_debug.c           optional > tcpdebug > > >  netinet/tcp_fastopen.c             optional inet > tcp_rfc7413 | inet6 tcp_rfc7413 > > >  netinet/tcp_hostcache.c            optional inet | inet6 > > >  netinet/tcp_input.c                optional inet | inet6 > > > +netinet/tcp_log_buf.c              optional inet | inet6 > > >  netinet/tcp_lro.c          optional inet | inet6 > > >  netinet/tcp_output.c               optional inet | inet6 > > >  netinet/tcp_offload.c              optional tcp_offload > inet | tcp_offload inet6 > > > > > > Added: head/sys/dev/tcp_log/tcp_log_dev.c > > > > ============================================================================== > > > --- /dev/null       00:00:00 1970   (empty, because file is > newly added) > > > +++ head/sys/dev/tcp_log/tcp_log_dev.c      Thu Mar 22 09:40:08 > 2018        (r331347) > > > @@ -0,0 +1,521 @@ > > > +/*- > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > > + * > > > + * Copyright (c) 2016-2017 > > > + * Netflix Inc.  All rights reserved. > > > + * > > > + * Redistribution and use in source and binary forms, with or > without > > > + * modification, are permitted provided that the following > conditions > > > + * are met: > > > + * 1. Redistributions of source code must retain the above > copyright > > > + *    notice, this list of conditions and the following > disclaimer. > > > + * 2. Redistributions in binary form must reproduce the above > copyright > > > + *    notice, this list of conditions and the following > disclaimer in the > > > + *    documentation and/or other materials provided with the > distribution. > > > + * > > > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS > IS'' AND > > > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED > TO, THE > > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > PARTICULAR PURPOSE > > > + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS > BE LIABLE > > > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL > > > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF > SUBSTITUTE GOODS > > > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > INTERRUPTION) > > > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > CONTRACT, STRICT > > > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING > IN ANY WAY > > > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF > > > + * SUCH DAMAGE. > > > + * > > > + */ > > > + > > > +#include > > > +__FBSDID("$FreeBSD$"); > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +#include > > > + > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > +extern counter_u64_t tcp_log_que_read; > > > +extern counter_u64_t tcp_log_que_freed; > > > +#endif > > > + > > > +static struct cdev *tcp_log_dev; > > > +static struct selinfo tcp_log_sel; > > > + > > > +static struct log_queueh tcp_log_dev_queue_head = > STAILQ_HEAD_INITIALIZER(tcp_log_dev_queue_head); > > > +static struct log_infoh tcp_log_dev_reader_head = > STAILQ_HEAD_INITIALIZER(tcp_log_dev_reader_head); > > > + > > > +MALLOC_DEFINE(M_TCPLOGDEV, "tcp_log_dev", "TCP log device data > structures"); > > > + > > > +static int tcp_log_dev_listeners = 0; > > > + > > > +static struct mtx tcp_log_dev_queue_lock; > > > + > > > +#define    TCP_LOG_DEV_QUEUE_LOCK()        > mtx_lock(&tcp_log_dev_queue_lock) > > > +#define    TCP_LOG_DEV_QUEUE_UNLOCK()      > mtx_unlock(&tcp_log_dev_queue_lock) > > > +#define    TCP_LOG_DEV_QUEUE_LOCK_ASSERT() > mtx_assert(&tcp_log_dev_queue_lock, MA_OWNED) > > > +#define    TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT() > mtx_assert(&tcp_log_dev_queue_lock, MA_NOTOWNED) > > > +#define    TCP_LOG_DEV_QUEUE_REF(tldq)    >  refcount_acquire(&((tldq)->tldq_refcnt)) > > > +#define    TCP_LOG_DEV_QUEUE_UNREF(tldq)  >  refcount_release(&((tldq)->tldq_refcnt)) > > > + > > > +static void        tcp_log_dev_clear_refcount(struct > tcp_log_dev_queue *entry); > > > +static void        tcp_log_dev_clear_cdevpriv(void *data); > > > +static int tcp_log_dev_open(struct cdev *dev __unused, int flags, > > > +    int devtype __unused, struct thread *td __unused); > > > +static int tcp_log_dev_write(struct cdev *dev __unused, > > > +    struct uio *uio __unused, int flags __unused); > > > +static int tcp_log_dev_read(struct cdev *dev __unused, struct uio > *uio, > > > +    int flags __unused); > > > +static int tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, > > > +    caddr_t data, int fflag __unused, struct thread *td > __unused); > > > +static int tcp_log_dev_poll(struct cdev *dev __unused, int events, > > > +    struct thread *td); > > > + > > > + > > > +enum tcp_log_dev_queue_lock_state { > > > +   QUEUE_UNLOCKED = 0, > > > +   QUEUE_LOCKED, > > > +}; > > > + > > > +static struct cdevsw tcp_log_cdevsw = { > > > +   .d_version =    D_VERSION, > > > +   .d_read =       tcp_log_dev_read, > > > +   .d_open =       tcp_log_dev_open, > > > +   .d_write =      tcp_log_dev_write, > > > +   .d_poll =       tcp_log_dev_poll, > > > +   .d_ioctl =      tcp_log_dev_ioctl, > > > +#ifdef NOTYET > > > +   .d_mmap =       tcp_log_dev_mmap, > > > +#endif > > > +   .d_name =       "tcp_log", > > > +}; > > > + > > > +static __inline void > > > +tcp_log_dev_queue_validate_lock(int lockstate) > > > +{ > > > + > > > +#ifdef INVARIANTS > > > +   switch (lockstate) { > > > +   case QUEUE_LOCKED: > > > +           TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > +           break; > > > +   case QUEUE_UNLOCKED: > > > +           TCP_LOG_DEV_QUEUE_UNLOCK_ASSERT(); > > > +           break; > > > +   default: > > > +           kassert_panic("%s:%d: unknown queue lock state", > __func__, > > > +               __LINE__); > > > +   } > > > +#endif > > > +} > > > + > > > +/* > > > + * Clear the refcount. If appropriate, it will remove the entry > from the > > > + * queue and call the destructor. > > > + * > > > + * This must be called with the queue lock held. > > > + */ > > > +static void > > > +tcp_log_dev_clear_refcount(struct tcp_log_dev_queue *entry) > > > +{ > > > + > > > +   KASSERT(entry != NULL, ("%s: called with NULL entry", > __func__)); > > > + > > > +   TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > + > > > +   if (TCP_LOG_DEV_QUEUE_UNREF(entry)) { > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > +           counter_u64_add(tcp_log_que_freed, 1); > > > +#endif > > > +           /* Remove the entry from the queue and call the > destructor. */ > > > +           STAILQ_REMOVE(&tcp_log_dev_queue_head, entry, > tcp_log_dev_queue, > > > +               tldq_queue); > > > +           (*entry->tldq_dtor)(entry); > > > +   } > > > +} > > > + > > > +static void > > > +tcp_log_dev_clear_cdevpriv(void *data) > > > +{ > > > +   struct tcp_log_dev_info *priv; > > > +   struct tcp_log_dev_queue *entry, *entry_tmp; > > > + > > > +   priv = (struct tcp_log_dev_info *)data; > > > +   if (priv == NULL) > > > +           return; > > > + > > > +   /* > > > +    * Lock the queue and drop our references. We hold references > to all > > > +    * the entries starting with tldi_head (or, if tldi_head == > NULL, all > > > +    * entries in the queue). > > > +    * > > > +    * Because we don't want anyone adding addition things to the > queue > > > +    * while we are doing this, we lock the queue. > > > +    */ > > > +   TCP_LOG_DEV_QUEUE_LOCK(); > > > +   if (priv->tldi_head != NULL) { > > > +           entry = priv->tldi_head; > > > +           STAILQ_FOREACH_FROM_SAFE(entry, > &tcp_log_dev_queue_head, > > > +               tldq_queue, entry_tmp) { > > > +                   tcp_log_dev_clear_refcount(entry); > > > +           } > > > +   } > > > +   tcp_log_dev_listeners--; > > > +   KASSERT(tcp_log_dev_listeners >= 0, > > > +       ("%s: tcp_log_dev_listeners is unexpectedly negative", > __func__)); > > > +   STAILQ_REMOVE(&tcp_log_dev_reader_head, priv, > tcp_log_dev_info, > > > +       tldi_list); > > > +   TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > +   TCP_LOG_DEV_QUEUE_UNLOCK(); > > > +   free(priv, M_TCPLOGDEV); > > > +} > > > + > > > +static int > > > +tcp_log_dev_open(struct cdev *dev __unused, int flags, int devtype > __unused, > > > +    struct thread *td __unused) > > > +{ > > > +   struct tcp_log_dev_info *priv; > > > +   struct tcp_log_dev_queue *entry; > > > +   int rv; > > > + > > > +   /* > > > +    * Ideally, we shouldn't see these because of file system > > > +    * permissions. > > > +    */ > > > +   if (flags & (FWRITE | FEXEC | FAPPEND | O_TRUNC)) > > > +           return (ENODEV); > > > + > > > +   /* Allocate space to hold information about where we are. */ > > > +   priv = malloc(sizeof(struct tcp_log_dev_info), M_TCPLOGDEV, > > > +       M_ZERO | M_WAITOK); > > > + > > > +   /* Stash the private data away. */ > > > +   rv = devfs_set_cdevpriv((void *)priv, > tcp_log_dev_clear_cdevpriv); > > > +   if (!rv) { > > > +           /* > > > +            * Increase the listener count, add this reader to > the list, and > > > +            * take references on all current queues. > > > +            */ > > > +           TCP_LOG_DEV_QUEUE_LOCK(); > > > +           tcp_log_dev_listeners++; > > > +           STAILQ_INSERT_HEAD(&tcp_log_dev_reader_head, priv, > tldi_list); > > > +           priv->tldi_head = > STAILQ_FIRST(&tcp_log_dev_queue_head); > > > +           if (priv->tldi_head != NULL) > > > +                   priv->tldi_cur = > priv->tldi_head->tldq_buf; > > > +           STAILQ_FOREACH(entry, &tcp_log_dev_queue_head, > tldq_queue) > > > +                   TCP_LOG_DEV_QUEUE_REF(entry); > > > +           TCP_LOG_DEV_QUEUE_UNLOCK(); > > > +   } else { > > > +           /* Free the entry. */ > > > +           free(priv, M_TCPLOGDEV); > > > +   } > > > +   return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_write(struct cdev *dev __unused, struct uio *uio > __unused, > > > +    int flags __unused) > > > +{ > > > + > > > +   return (ENODEV); > > > +} > > > + > > > +static __inline void > > > +tcp_log_dev_rotate_bufs(struct tcp_log_dev_info *priv, int > *lockstate) > > > +{ > > > +   struct tcp_log_dev_queue *entry; > > > + > > > +   KASSERT(priv->tldi_head != NULL, > > > +       ("%s:%d: priv->tldi_head unexpectedly NULL", > > > +       __func__, __LINE__)); > > > +   KASSERT(priv->tldi_head->tldq_buf == priv->tldi_cur, > > > +       ("%s:%d: buffer mismatch (%p vs %p)", > > > +       __func__, __LINE__, priv->tldi_head->tldq_buf, > > > +       priv->tldi_cur)); > > > +   tcp_log_dev_queue_validate_lock(*lockstate); > > > + > > > +   if (*lockstate == QUEUE_UNLOCKED) { > > > +           TCP_LOG_DEV_QUEUE_LOCK(); > > > +           *lockstate = QUEUE_LOCKED; > > > +   } > > > +   entry = priv->tldi_head; > > > +   priv->tldi_head = STAILQ_NEXT(entry, tldq_queue); > > > +   tcp_log_dev_clear_refcount(entry); > > > +   priv->tldi_cur = NULL; > > > +} > > > + > > > +static int > > > +tcp_log_dev_read(struct cdev *dev __unused, struct uio *uio, int > flags) > > > +{ > > > +   struct tcp_log_common_header *buf; > > > +   struct tcp_log_dev_info *priv; > > > +   struct tcp_log_dev_queue *entry; > > > +   ssize_t len; > > > +   int lockstate, rv; > > > + > > > +   /* Get our private info. */ > > > +   rv = devfs_get_cdevpriv((void **)&priv); > > > +   if (rv) > > > +           return (rv); > > > + > > > +   lockstate = QUEUE_UNLOCKED; > > > + > > > +   /* Do we need to get a new buffer? */ > > > +   while (priv->tldi_cur == NULL || > > > +       priv->tldi_cur->tlch_length <= priv->tldi_off) { > > > +           /* Did we somehow forget to rotate? */ > > > +           KASSERT(priv->tldi_cur == NULL, > > > +               ("%s:%d: tldi_cur is unexpectedly non-NULL", > __func__, > > > +               __LINE__)); > > > +           if (priv->tldi_cur != NULL) > > > +                   tcp_log_dev_rotate_bufs(priv, > &lockstate); > > > + > > > +           /* > > > +            * Before we start looking at tldi_head, we need a > lock on the > > > +            * queue to make sure tldi_head stays stable. > > > +            */ > > > +           if (lockstate == QUEUE_UNLOCKED) { > > > +                   TCP_LOG_DEV_QUEUE_LOCK(); > > > +                   lockstate = QUEUE_LOCKED; > > > +           } > > > + > > > +           /* We need the next buffer. Do we have one? */ > > > +           if (priv->tldi_head == NULL && (flags & > FNONBLOCK)) { > > > +                   rv = EAGAIN; > > > +                   goto done; > > > +           } > > > +           if (priv->tldi_head == NULL) { > > > +                   /* Sleep and wait for more things we > can read. */ > > > +                   rv = mtx_sleep(&tcp_log_dev_listeners, > > > +                       &tcp_log_dev_queue_lock, PCATCH, > "tcplogdev", 0); > > > +                   if (rv) > > > +                           goto done; > > > +                   if (priv->tldi_head == NULL) > > > +                           continue; > > > +           } > > > + > > > +           /* > > > +            * We have an entry to read. We want to try to > create a > > > +            * buffer, if one doesn't already exist. > > > +            */ > > > +           entry = priv->tldi_head; > > > +           if (entry->tldq_buf == NULL) { > > > +                   TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > +                   buf = (*entry->tldq_xform)(entry); > > > +                   if (buf == NULL) { > > > +                           rv = EBUSY; > > > +                           goto done; > > > +                   } > > > +                   entry->tldq_buf = buf; > > > +           } > > > + > > > +           priv->tldi_cur = entry->tldq_buf; > > > +           priv->tldi_off = 0; > > > +   } > > > + > > > +   /* Copy what we can from this buffer to the output buffer. */ > > > +   if (uio->uio_resid > 0) { > > > +           /* Drop locks so we can take page faults. */ > > > +           if (lockstate == QUEUE_LOCKED) > > > +                   TCP_LOG_DEV_QUEUE_UNLOCK(); > > > +           lockstate = QUEUE_UNLOCKED; > > > + > > > +           KASSERT(priv->tldi_cur != NULL, > > > +               ("%s: priv->tldi_cur is unexpectedly NULL", > __func__)); > > > + > > > +           /* Copy as much as we can to this uio. */ > > > +           len = priv->tldi_cur->tlch_length - > priv->tldi_off; > > > +           if (len > uio->uio_resid) > > > +                   len = uio->uio_resid; > > > +           rv = uiomove(((uint8_t *)priv->tldi_cur) + > priv->tldi_off, > > > +               len, uio); > > > +           if (rv != 0) > > > +                   goto done; > > > +           priv->tldi_off += len; > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > +           counter_u64_add(tcp_log_que_read, len); > > > +#endif > > > +   } > > > +   /* Are we done with this buffer? If so, find the next one. */ > > > +   if (priv->tldi_off >= priv->tldi_cur->tlch_length) { > > > +           KASSERT(priv->tldi_off == > priv->tldi_cur->tlch_length, > > > +               ("%s: offset (%ju) exceeds length (%ju)", > __func__, > > > +               (uintmax_t)priv->tldi_off, > > > +               (uintmax_t)priv->tldi_cur->tlch_length)); > > > +           tcp_log_dev_rotate_bufs(priv, &lockstate); > > > +   } > > > +done: > > > +   tcp_log_dev_queue_validate_lock(lockstate); > > > +   if (lockstate == QUEUE_LOCKED) > > > +           TCP_LOG_DEV_QUEUE_UNLOCK(); > > > +   return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t > data, > > > +    int fflag __unused, struct thread *td __unused) > > > +{ > > > +   struct tcp_log_dev_info *priv; > > > +   int rv; > > > + > > > +   /* Get our private info. */ > > > +   rv = devfs_get_cdevpriv((void **)&priv); > > > +   if (rv) > > > +           return (rv); > > > + > > > +   /* > > > +    * Set things. Here, we are most concerned about the > non-blocking I/O > > > +    * flag. > > > +    */ > > > +   rv = 0; > > > +   switch (cmd) { > > > +   case FIONBIO: > > > +           break; > > > +   case FIOASYNC: > > > +           if (*(int *)data != 0) > > > +                   rv = EINVAL; > > > +           break; > > > +   default: > > > +           rv = ENOIOCTL; > > > +   } > > > +   return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_poll(struct cdev *dev __unused, int events, struct > thread *td) > > > +{ > > > +   struct tcp_log_dev_info *priv; > > > +   int revents; > > > + > > > +   /* > > > +    * Get our private info. If this fails, claim that all events > are > > > +    * ready. That should prod the user to do something that will > > > +    * make the error evident to them. > > > +    */ > > > +   if (devfs_get_cdevpriv((void **)&priv)) > > > +           return (events); > > > + > > > +   revents = 0; > > > +   if (events & (POLLIN | POLLRDNORM)) { > > > +           /* > > > +            * We can (probably) read right now if we are > partway through > > > +            * a buffer or if we are just about to start a > buffer. > > > +            * Because we are going to read tldi_head, we > should acquire > > > +            * a read lock on the queue. > > > +            */ > > > +           TCP_LOG_DEV_QUEUE_LOCK(); > > > +           if ((priv->tldi_head != NULL && priv->tldi_cur == > NULL) || > > > +               (priv->tldi_cur != NULL && > > > +               priv->tldi_off < > priv->tldi_cur->tlch_length)) > > > +                   revents = events & (POLLIN | > POLLRDNORM); > > > +           else > > > +                   selrecord(td, &tcp_log_sel); > > > +           TCP_LOG_DEV_QUEUE_UNLOCK(); > > > +   } else { > > > +           /* > > > +            * It only makes sense to poll for reading. So, > again, prod the > > > +            * user to do something that will make the error > of their ways > > > +            * apparent. > > > +            */ > > > +           revents = events; > > > +   } > > > +   return (revents); > > > +} > > > + > > > +int > > > +tcp_log_dev_add_log(struct tcp_log_dev_queue *entry) > > > +{ > > > +   struct tcp_log_dev_info *priv; > > > +   int rv; > > > +   bool wakeup_needed; > > > + > > > +   KASSERT(entry->tldq_buf != NULL || entry->tldq_xform != NULL, > > > +       ("%s: Called with both tldq_buf and tldq_xform set to > NULL", > > > +       __func__)); > > > +   KASSERT(entry->tldq_dtor != NULL, > > > +       ("%s: Called with tldq_dtor set to NULL", __func__)); > > > + > > > +   /* Get a lock on the queue. */ > > > +   TCP_LOG_DEV_QUEUE_LOCK(); > > > + > > > +   /* If no one is listening, tell the caller to free the > resources. */ > > > +   if (tcp_log_dev_listeners == 0) { > > > +           rv = ENXIO; > > > +           goto done; > > > +   } > > > + > > > +   /* Add this to the end of the tailq. */ > > > +   STAILQ_INSERT_TAIL(&tcp_log_dev_queue_head, entry, > tldq_queue); > > > + > > > +   /* Add references for all current listeners. */ > > > +   refcount_init(&entry->tldq_refcnt, tcp_log_dev_listeners); > > > + > > > +   /* > > > +    * If any listener is currently stuck on NULL, that means they > are > > > +    * waiting. Point their head to this new entry. > > > +    */ > > > +   wakeup_needed = false; > > > +   STAILQ_FOREACH(priv, &tcp_log_dev_reader_head, tldi_list) > > > +           if (priv->tldi_head == NULL) { > > > +                   priv->tldi_head = entry; > > > +                   wakeup_needed = true; > > > +           } > > > + > > > +   if (wakeup_needed) { > > > +           selwakeup(&tcp_log_sel); > > > +           wakeup(&tcp_log_dev_listeners); > > > +   } > > > + > > > +   rv = 0; > > > + > > > +done: > > > +   TCP_LOG_DEV_QUEUE_LOCK_ASSERT(); > > > +   TCP_LOG_DEV_QUEUE_UNLOCK(); > > > +   return (rv); > > > +} > > > + > > > +static int > > > +tcp_log_dev_modevent(module_t mod __unused, int type, void *data > __unused) > > > +{ > > > + > > > +   /* TODO: Support intelligent unloading. */ > > > +   switch (type) { > > > +   case MOD_LOAD: > > > +           if (bootverbose) > > > +                   printf("tcp_log: tcp_log device\n"); > > > +           memset(&tcp_log_sel, 0, sizeof(tcp_log_sel)); > > > +           memset(&tcp_log_dev_queue_lock, 0, sizeof(struct > mtx)); > > > +           mtx_init(&tcp_log_dev_queue_lock, "tcp_log dev", > > > +                    "tcp_log device queues", MTX_DEF); > > > +           tcp_log_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, > > > +               &tcp_log_cdevsw, 0, NULL, UID_ROOT, > GID_WHEEL, 0400, > > > +               "tcp_log"); > > > +           break; > > > +   default: > > > +           return (EOPNOTSUPP); > > > +   } > > > + > > > +   return (0); > > > +} > > > + > > > +DEV_MODULE(tcp_log_dev, tcp_log_dev_modevent, NULL); > > > +MODULE_VERSION(tcp_log_dev, 1); > > > > > > Added: head/sys/dev/tcp_log/tcp_log_dev.h > > > > ============================================================================== > > > --- /dev/null       00:00:00 1970   (empty, because file is > newly added) > > > +++ head/sys/dev/tcp_log/tcp_log_dev.h      Thu Mar 22 09:40:08 > 2018        (r331347) > > > @@ -0,0 +1,88 @@ > > > +/*- > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > > + * > > > + * Copyright (c) 2016 > > > + * Netflix Inc.  All rights reserved. > > > + * > > > + * Redistribution and use in source and binary forms, with or > without > > > + * modification, are permitted provided that the following > conditions > > > + * are met: > > > + * 1. Redistributions of source code must retain the above > copyright > > > + *    notice, this list of conditions and the following > disclaimer. > > > + * 2. Redistributions in binary form must reproduce the above > copyright > > > + *    notice, this list of conditions and the following > disclaimer in the > > > + *    documentation and/or other materials provided with the > distribution. > > > + * > > > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS > IS'' AND > > > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED > TO, THE > > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > PARTICULAR PURPOSE > > > + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS > BE LIABLE > > > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL > > > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF > SUBSTITUTE GOODS > > > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > INTERRUPTION) > > > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > CONTRACT, STRICT > > > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING > IN ANY WAY > > > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF > > > + * SUCH DAMAGE. > > > + * > > > + * $FreeBSD$ > > > + */ > > > + > > > +#ifndef __tcp_log_dev_h__ > > > +#define    __tcp_log_dev_h__ > > > + > > > +/* > > > + * This is the common header for data streamed from the log device. > All > > > + * blocks of data need to start with this header. > > > + */ > > > +struct tcp_log_common_header { > > > +   uint32_t        tlch_version;   /* Version is specific > to type. */ > > > +   uint32_t        tlch_type;      /* Type of entry(ies) > that follow. */ > > > +   uint64_t        tlch_length;    /* Total length, > including header. */ > > > +} __packed; > > > + > > > +#define    TCP_LOG_DEV_TYPE_BBR    1       /* black box > recorder */ > > > + > > > +#ifdef _KERNEL > > > +/* > > > + * This is a queue entry. All queue entries need to start with this > structure > > > + * so the common code can cast them to this structure; however, > other modules > > > + * are free to include additional data after this structure. > > > + * > > > + * The elements are explained here: > > > + * tldq_queue: used by the common code to maintain this entry's > position in the > > > + *     queue. > > > + * tldq_buf: should be NULL, or a pointer to a chunk of data. The > data must be > > > + *     as long as the common header indicates. > > > + * tldq_xform: If tldq_buf is NULL, the code will call this to > create the > > > + *     the tldq_buf object. The function should *not* directly > modify tldq_buf, > > > + *     but should return the buffer (which must meet the > restrictions > > > + *     indicated for tldq_buf). > > > + * tldq_dtor: This function is called to free the queue entry. If > tldq_buf is > > > + *     not NULL, the dtor function must free that, too. > > > + * tldq_refcnt: used by the common code to indicate how many > readers still need > > > + *     this data. > > > + */ > > > +struct tcp_log_dev_queue { > > > +   STAILQ_ENTRY(tcp_log_dev_queue) tldq_queue; > > > +   struct tcp_log_common_header *tldq_buf; > > > +   struct tcp_log_common_header *(*tldq_xform)(struct > tcp_log_dev_queue *entry); > > > +   void    (*tldq_dtor)(struct tcp_log_dev_queue *entry); > > > +   volatile u_int tldq_refcnt; > > > +}; > > > + > > > +STAILQ_HEAD(log_queueh, tcp_log_dev_queue); > > > + > > > +struct tcp_log_dev_info { > > > +   STAILQ_ENTRY(tcp_log_dev_info) tldi_list; > > > +   struct tcp_log_dev_queue *tldi_head; > > > +   struct tcp_log_common_header *tldi_cur; > > > +   off_t                   tldi_off; > > > +}; > > > +STAILQ_HEAD(log_infoh, tcp_log_dev_info); > > > + > > > + > > > +MALLOC_DECLARE(M_TCPLOGDEV); > > > +int tcp_log_dev_add_log(struct tcp_log_dev_queue *entry); > > > +#endif /* _KERNEL */ > > > +#endif /* !__tcp_log_dev_h__ */ > > > > > > Modified: head/sys/kern/subr_witness.c > > > > ============================================================================== > > > --- head/sys/kern/subr_witness.c    Thu Mar 22 08:32:39 2018    >     (r331346) > > > +++ head/sys/kern/subr_witness.c    Thu Mar 22 09:40:08 2018    >     (r331347) > > > @@ -640,6 +640,14 @@ static struct witness_order_list_entry > order_lists[] = > > >     { "db->db_mtx", &lock_class_sx }, > > >     { NULL, NULL }, > > >     /* > > > +    * TCP log locks > > > +    */ > > > +   { "TCP ID tree", &lock_class_rw }, > > > +   { "tcp log id bucket", &lock_class_mtx_sleep }, > > > +   { "tcpinp", &lock_class_rw }, > > > +   { "TCP log expireq", &lock_class_mtx_sleep }, > > > +   { NULL, NULL }, > > > +   /* > > >      * spin locks > > >      */ > > >  #ifdef SMP > > > > > > Modified: head/sys/netinet/tcp.h > > > > ============================================================================== > > > --- head/sys/netinet/tcp.h  Thu Mar 22 08:32:39 2018        > (r331346) > > > +++ head/sys/netinet/tcp.h  Thu Mar 22 09:40:08 2018        > (r331347) > > > @@ -168,6 +168,12 @@ struct tcphdr { > > >  #define TCP_NOOPT  8       /* don't use TCP options */ > > >  #define TCP_MD5SIG 16      /* use MD5 digests (RFC2385) */ > > >  #define    TCP_INFO        32      /* retrieve tcp_info > structure */ > > > +#define    TCP_LOG         34      /* configure event > logging for connection */ > > > +#define    TCP_LOGBUF      35      /* retrieve event log > for connection */ > > > +#define    TCP_LOGID       36      /* configure log ID to > correlate connections */ > > > +#define    TCP_LOGDUMP     37      /* dump connection log > events to device */ > > > +#define    TCP_LOGDUMPID   38      /* dump events from > connections with same ID to > > > +                              device */ > > >  #define    TCP_CONGESTION  64      /* get/set congestion > control algorithm */ > > >  #define    TCP_CCALGOOPT   65      /* get/set cc algorithm > specific options */ > > >  #define    TCP_KEEPINIT    128     /* N, time to establish > connection */ > > > @@ -188,6 +194,9 @@ struct tcphdr { > > >  #define    TCPI_OPT_WSCALE         0x04 > > >  #define    TCPI_OPT_ECN            0x08 > > >  #define    TCPI_OPT_TOE            0x10 > > > + > > > +/* Maximum length of log ID. */ > > > +#define TCP_LOG_ID_LEN     64 > > > > > >  /* > > >   * The TCP_INFO socket option comes from the Linux 2.6 TCP API, > and permits > > > > > > Modified: head/sys/netinet/tcp_input.c > > > > ============================================================================== > > > --- head/sys/netinet/tcp_input.c    Thu Mar 22 08:32:39 2018    >     (r331346) > > > +++ head/sys/netinet/tcp_input.c    Thu Mar 22 09:40:08 2018    >     (r331347) > > > @@ -102,6 +102,7 @@ __FBSDID("$FreeBSD$"); > > >  #include > > >  #include > > >  #include > > > +#include > > >  #include > > >  #include > > >  #include > > > @@ -1592,6 +1593,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr > *th, stru > > >     /* Save segment, if requested. */ > > >     tcp_pcap_add(th, m, &(tp->t_inpkts)); > > >  #endif > > > +   TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0, > > > +       tlen, NULL, true); > > > > > >     if ((thflags & TH_SYN) && (thflags & TH_FIN) && > V_drop_synfin) { > > >             if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { > > > > > > Added: head/sys/netinet/tcp_log_buf.c > > > > ============================================================================== > > > --- /dev/null       00:00:00 1970   (empty, because file is > newly added) > > > +++ head/sys/netinet/tcp_log_buf.c  Thu Mar 22 09:40:08 2018    >     (r331347) > > > @@ -0,0 +1,2480 @@ > > > +/*- > > > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > > + * > > > + * Copyright (c) 2016-2018 > > > + * Netflix Inc.  All rights reserved. > > > + * > > > + * Redistribution and use in source and binary forms, with or > without > > > + * modification, are permitted provided that the following > conditions > > > + * are met: > > > + * 1. Redistributions of source code must retain the above > copyright > > > + *    notice, this list of conditions and the following > disclaimer. > > > + * 2. Redistributions in binary form must reproduce the above > copyright > > > + *    notice, this list of conditions and the following > disclaimer in the > > > + *    documentation and/or other materials provided with the > distribution. > > > + * > > > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS > IS'' AND > > > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED > TO, THE > > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > PARTICULAR PURPOSE > > > + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS > BE LIABLE > > > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL > > > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF > SUBSTITUTE GOODS > > > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > INTERRUPTION) > > > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > CONTRACT, STRICT > > > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING > IN ANY WAY > > > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF > > > + * SUCH DAMAGE. > > > + * > > > + */ > > > + > > > +#include > > > +__FBSDID("$FreeBSD$"); > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +#include > > > + > > > +#include > > > +#include > > > +#include > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +/* Default expiry time */ > > > +#define    TCP_LOG_EXPIRE_TIME     ((sbintime_t)60 * SBT_1S) > > > + > > > +/* Max interval at which to run the expiry timer */ > > > +#define    TCP_LOG_EXPIRE_INTVL    ((sbintime_t)5 * SBT_1S) > > > + > > > +bool       tcp_log_verbose; > > > +static uma_zone_t tcp_log_bucket_zone, tcp_log_node_zone, > tcp_log_zone; > > > +static int tcp_log_session_limit = > TCP_LOG_BUF_DEFAULT_SESSION_LIMIT; > > > +static uint32_t    tcp_log_version = TCP_LOG_BUF_VER; > > > +RB_HEAD(tcp_log_id_tree, tcp_log_id_bucket); > > > +static struct tcp_log_id_tree tcp_log_id_head; > > > +static STAILQ_HEAD(, tcp_log_id_node) tcp_log_expireq_head = > > > +    STAILQ_HEAD_INITIALIZER(tcp_log_expireq_head); > > > +static struct mtx tcp_log_expireq_mtx; > > > +static struct callout tcp_log_expireq_callout; > > > +static uint64_t tcp_log_auto_ratio = 0; > > > +static uint64_t tcp_log_auto_ratio_cur = 0; > > > +static uint32_t tcp_log_auto_mode = TCP_LOG_STATE_TAIL; > > > +static bool tcp_log_auto_all = false; > > > + > > > +RB_PROTOTYPE_STATIC(tcp_log_id_tree, tcp_log_id_bucket, tlb_rb, > tcp_log_id_cmp) > > > + > > > +SYSCTL_NODE(_net_inet_tcp, OID_AUTO, bb, CTLFLAG_RW, 0, "TCP Black > Box controls"); > > > + > > > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_verbose, CTLFLAG_RW, > &tcp_log_verbose, > > > +    0, "Force verbose logging for TCP traces"); > > > + > > > +SYSCTL_INT(_net_inet_tcp_bb, OID_AUTO, log_session_limit, > > > +    CTLFLAG_RW, &tcp_log_session_limit, 0, > > > +    "Maximum number of events maintained for each TCP session"); > > > + > > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_global_limit, > CTLFLAG_RW, > > > +    &tcp_log_zone, "Maximum number of events maintained for all > TCP sessions"); > > > + > > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_global_entries, > CTLFLAG_RD, > > > +    &tcp_log_zone, "Current number of events maintained for all > TCP sessions"); > > > + > > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_limit, > CTLFLAG_RW, > > > +    &tcp_log_bucket_zone, "Maximum number of log IDs"); > > > + > > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_entries, > CTLFLAG_RD, > > > +    &tcp_log_bucket_zone, "Current number of log IDs"); > > > + > > > +SYSCTL_UMA_MAX(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_limit, > CTLFLAG_RW, > > > +    &tcp_log_node_zone, "Maximum number of tcpcbs with log IDs"); > > > + > > > +SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_tcpcb_entries, > CTLFLAG_RD, > > > +    &tcp_log_node_zone, "Current number of tcpcbs with log IDs"); > > > + > > > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_version, CTLFLAG_RD, > &tcp_log_version, > > > +    0, "Version of log formats exported"); > > > + > > > +SYSCTL_U64(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW, > > > +    &tcp_log_auto_ratio, 0, "Do auto capturing for 1 out of N > sessions"); > > > + > > > +SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_auto_mode, CTLFLAG_RW, > > > +    &tcp_log_auto_mode, TCP_LOG_STATE_HEAD_AUTO, > > > +    "Logging mode for auto-selected sessions (default is > TCP_LOG_STATE_HEAD_AUTO)"); > > > + > > > +SYSCTL_BOOL(_net_inet_tcp_bb, OID_AUTO, log_auto_all, CTLFLAG_RW, > > > +    &tcp_log_auto_all, false, > > > +    "Auto-select from all sessions (rather than just those with > IDs)"); > > > + > > > +#ifdef TCPLOG_DEBUG_COUNTERS > > > +counter_u64_t tcp_log_queued; > > > +counter_u64_t tcp_log_que_fail1; > > > +counter_u64_t tcp_log_que_fail2; > > > +counter_u64_t tcp_log_que_fail3; > > > +counter_u64_t tcp_log_que_fail4; > > > +counter_u64_t tcp_log_que_fail5; > > > +counter_u64_t tcp_log_que_copyout; > > > +counter_u64_t tcp_log_que_read; > > > +counter_u64_t tcp_log_que_freed; > > > + > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, queued, CTLFLAG_RD, > > > +    &tcp_log_queued, "Number of entries queued"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail1, CTLFLAG_RD, > > > +    &tcp_log_que_fail1, "Number of entries queued but fail 1"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail2, CTLFLAG_RD, > > > +    &tcp_log_que_fail2, "Number of entries queued but fail 2"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail3, CTLFLAG_RD, > > > +    &tcp_log_que_fail3, "Number of entries queued but fail 3"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail4, CTLFLAG_RD, > > > +    &tcp_log_que_fail4, "Number of entries queued but fail 4"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, fail5, CTLFLAG_RD, > > > +    &tcp_log_que_fail5, "Number of entries queued but fail 4"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, copyout, CTLFLAG_RD, > > > +    &tcp_log_que_copyout, "Number of entries copied out"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, read, CTLFLAG_RD, > > > +    &tcp_log_que_read, "Number of entries read from the queue"); > > > +SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, freed, CTLFLAG_RD, > > > +    &tcp_log_que_freed, "Number of entries freed after reading"); > > > +#endif > > > + > > > +#ifdef INVARIANTS > > > +#define    TCPLOG_DEBUG_RINGBUF > > > +#endif > > > + > > > +struct tcp_log_mem > > > +{ > > > +   STAILQ_ENTRY(tcp_log_mem) tlm_queue; > > > +   struct tcp_log_buffer   tlm_buf; > > > +   struct tcp_log_verbose  tlm_v; > > > +#ifdef TCPLOG_DEBUG_RINGBUF > > > +   volatile int            tlm_refcnt; > > > +#endif > > > +}; > > > + > > > +/* 60 bytes for the header, + 16 bytes for padding */ > > > +static uint8_t     zerobuf[76]; > > > + > > > +/* > > > + * Lock order: > > > + * 1. TCPID_TREE > > > + * 2. TCPID_BUCKET > > > + * 3. INP > > > + * > > > + * Rules: > > > + * A. You need a lock on the Tree to add/remove buckets. > > > + * B. You need a lock on the bucket to add/remove nodes from the > bucket. > > > + * C. To change information in a node, you need the INP lock if the > tln_closed > > > + *    field is false. Otherwise, you need the bucket lock. (Note > that the > > > + *    tln_closed field can change at any point, so you need to > recheck the > > > + *    entry after acquiring the INP lock.) > > > + * D. To remove a node from the bucket, you must have that entry > locked, > > > + *    according to the criteria of Rule C. Also, the node must > not be on > > > + *    the expiry queue. > > > + * E. The exception to C is the expiry queue fields, which are > locked by > > > + *    the TCPLOG_EXPIREQ lock. > > > + * > > > + * Buckets have a reference count. Each node is a reference. > Further, > > > + * other callers may add reference counts to keep a bucket from > disappearing. > > > + * You can add a reference as long as you own a lock sufficient to > keep the > > > + * bucket from disappearing. For example, a common use is: > > > + *   a. Have a locked INP, but need to lock the TCPID_BUCKET. > > > + *   b. Add a refcount on the bucket. (Safe because the INP lock > prevents > > > + *      the TCPID_BUCKET from going away.) > > > + *   c. Drop the INP lock. > > > + *   d. Acquire a lock on the TCPID_BUCKET. > > > + *   e. Acquire a lock on the INP. > > > + *   f. Drop the refcount on the bucket. > > > + *      (At this point, the bucket may disappear.) > > > + * > > > + * Expire queue lock: > > > + * You can acquire this with either the bucket or INP lock. Don't > reverse it. > > > + * When the expire code has committed to freeing a node, it resets > the expiry > > > + * time to SBT_MAX. That is the signal to everyone else that they > should > > > + * leave that node alone. > > > + */ > > > +static struct rwlock tcp_id_tree_lock; > > > +#define    TCPID_TREE_WLOCK()              > rw_wlock(&tcp_id_tree_lock) > > > +#define    TCPID_TREE_RLOCK()              > rw_rlock(&tcp_id_tree_lock) > > > +#define    TCPID_TREE_UPGRADE()            > rw_try_upgrade(&tcp_id_tree_lock) > > > +#define    TCPID_TREE_WUNLOCK()            > rw_wunlock(&tcp_id_tree_lock) > > > +#define    TCPID_TREE_RUNLOCK()            > rw_runlock(&tcp_id_tree_lock) > > > +#define    TCPID_TREE_WLOCK_ASSERT()      >  rw_assert(&tcp_id_tree_lock, RA_WLOCKED) > > > +#define    TCPID_TREE_RLOCK_ASSERT()      >  rw_assert(&tcp_id_tree_lock, RA_RLOCKED) > > > +#define    TCPID_TREE_UNLOCK_ASSERT()      > rw_assert(&tcp_id_tree_lock, RA_UNLOCKED) > > > + > > > +#define    TCPID_BUCKET_LOCK_INIT(tlb)    >  mtx_init(&((tlb)->tlb_mtx), "tcp log id bucket", NULL, MTX_DEF) > > > +#define    TCPID_BUCKET_LOCK_DESTROY(tlb)  > mtx_destroy(&((tlb)->tlb_mtx)) > > > +#define    TCPID_BUCKET_LOCK(tlb)          > mtx_lock(&((tlb)->tlb_mtx)) > > > +#define    TCPID_BUCKET_UNLOCK(tlb)        > mtx_unlock(&((tlb)->tlb_mtx)) > > > +#define    TCPID_BUCKET_LOCK_ASSERT(tlb)  >  mtx_assert(&((tlb)->tlb_mtx), MA_OWNED) > > > +#define    TCPID_BUCKET_UNLOCK_ASSERT(tlb) > mtx_assert(&((tlb)->tlb_mtx), MA_NOTOWNED) > > > + > > > +#define    TCPID_BUCKET_REF(tlb)          >  refcount_acquire(&((tlb)->tlb_refcnt)) > > > +#define    TCPID_BUCKET_UNREF(tlb)        >  refcount_release(&((tlb)->tlb_refcnt)) > > > + > > > +#define    TCPLOG_EXPIREQ_LOCK()          >  mtx_lock(&tcp_log_expireq_mtx) > > > +#define    TCPLOG_EXPIREQ_UNLOCK()        >  mtx_unlock(&tcp_log_expireq_mtx) > > > + > > > +SLIST_HEAD(tcp_log_id_head, tcp_log_id_node); > > > + > > > +struct tcp_log_id_bucket > > > +{ > > > +   /* > > > +    * tlb_id must be first. This lets us use strcmp on > > > +    * (struct tcp_log_id_bucket *) and (char *) interchangeably. > > > +    */ > > > +   char                            > tlb_id[TCP_LOG_ID_LEN]; > > > +   RB_ENTRY(tcp_log_id_bucket)     tlb_rb; > > > +   struct tcp_log_id_head          tlb_head; > > > +   struct mtx                      tlb_mtx; > > > +   volatile u_int                  tlb_refcnt; > > > +}; > > > + > > > +struct tcp_log_id_node > > > +{ > > > +   SLIST_ENTRY(tcp_log_id_node) tln_list; > > > +   STAILQ_ENTRY(tcp_log_id_node) tln_expireq; /* Locked by the > expireq lock */ > > > +   sbintime_t              tln_expiretime; /* Locked by > the expireq lock */ > > > + > > > +   /* > > > +    * If INP is NULL, that means the connection has closed. We've > > > +    * saved the connection endpoint information and the log > entries > > > +    * in the tln_ie and tln_entries members. We've also saved a > pointer > > > +    * to the enclosing bucket here. If INP is not NULL, the > information is > > > +    * in the PCB and not here. > > > +    */ > > > +   struct inpcb            *tln_inp; > > > +   struct tcpcb            *tln_tp; > > > +   struct tcp_log_id_bucket *tln_bucket; > > > +   struct in_endpoints     tln_ie; > > > +   struct tcp_log_stailq   tln_entries; > > > +   int                     tln_count; > > > +   volatile int            tln_closed; > > > +   uint8_t                 tln_af; > > > +}; > > > + > > > +enum tree_lock_state { > > > +   TREE_UNLOCKED = 0, > > > +   TREE_RLOCKED, > > > +   TREE_WLOCKED, > > > +}; > > > + > > > +/* Do we want to select this session for auto-logging? */ > > > +static __inline bool > > > +tcp_log_selectauto(void) > > > +{ > > > + > > > +   /* > > > > > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > > > > > > References > > Visible links > 1. mailto:ruslan.bukin@cl.cam.ac.uk > 2. https://svnweb.freebsd.org/changeset/base/331347 > 3. https://reviews.freebsd.org/D11085 From owner-svn-src-head@freebsd.org Thu Mar 22 18:24:01 2018 Return-Path: Delivered-To: svn-src-head@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 1242AF5E4CA; Thu, 22 Mar 2018 18:24:01 +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 B4C7183CBB; Thu, 22 Mar 2018 18:24:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 957DB14E43; Thu, 22 Mar 2018 18:24:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MIO0XX032989; Thu, 22 Mar 2018 18:24:00 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MIO0EL032986; Thu, 22 Mar 2018 18:24:00 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803221824.w2MIO0EL032986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Mar 2018 18:24:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331365 - in head/sys: amd64/amd64 dev/efidev X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: amd64/amd64 dev/efidev X-SVN-Commit-Revision: 331365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 18:24:01 -0000 Author: kevans Date: Thu Mar 22 18:24:00 2018 New Revision: 331365 URL: https://svnweb.freebsd.org/changeset/base/331365 Log: Re-work efidev ordering to fix efirt preloaded by loader on amd64 On amd64, efi_enter calls fpu_kern_enter(). This may not be called until fpuinitstate has been invoked, resulting in a kernel panic with efirt_load="YES" in loader.conf(5). Move fpuinitstate a little earlier in SI_SUB_DRIVERS so that we can squeeze efirt between it and efirtc at SI_SUB_DRIVERS, SI_ORDER_ANY. efidev must be after efirt and doesn't really need to be at SI_SUB_DEVFS, so drop it at SI_SUB_DRIVER, SI_ORDER_ANY. The not immediately obvious dependency of fpuinitstate by efirt has been noted in both places. Discussed with: kib, andrew Reported by: Jakob Alvermark X-MFC-With: r330868 Modified: head/sys/amd64/amd64/fpu.c head/sys/dev/efidev/efidev.c head/sys/dev/efidev/efirt.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Thu Mar 22 17:49:27 2018 (r331364) +++ head/sys/amd64/amd64/fpu.c Thu Mar 22 18:24:00 2018 (r331365) @@ -366,7 +366,8 @@ fpuinitstate(void *arg __unused) start_emulating(); intr_restore(saveintr); } -SYSINIT(fpuinitstate, SI_SUB_DRIVERS, SI_ORDER_ANY, fpuinitstate, NULL); +/* EFIRT needs this to be initialized before we can enter our EFI environment */ +SYSINIT(fpuinitstate, SI_SUB_DRIVERS, SI_ORDER_FIRST, fpuinitstate, NULL); /* * Free coprocessor (if we have it). Modified: head/sys/dev/efidev/efidev.c ============================================================================== --- head/sys/dev/efidev/efidev.c Thu Mar 22 17:49:27 2018 (r331364) +++ head/sys/dev/efidev/efidev.c Thu Mar 22 18:24:00 2018 (r331365) @@ -216,6 +216,6 @@ static moduledata_t efidev_moddata = { .priv = NULL, }; -DECLARE_MODULE(efidev, efidev_moddata, SI_SUB_DEVFS, SI_ORDER_ANY); +DECLARE_MODULE(efidev, efidev_moddata, SI_SUB_DRIVERS, SI_ORDER_ANY); MODULE_VERSION(efidev, 1); MODULE_DEPEND(efidev, efirt, 1, 1, 1); Modified: head/sys/dev/efidev/efirt.c ============================================================================== --- head/sys/dev/efidev/efirt.c Thu Mar 22 17:49:27 2018 (r331364) +++ head/sys/dev/efidev/efirt.c Thu Mar 22 18:24:00 2018 (r331365) @@ -450,5 +450,6 @@ static moduledata_t efirt_moddata = { .evhand = efirt_modevents, .priv = NULL, }; -DECLARE_MODULE(efirt, efirt_moddata, SI_SUB_VM_CONF, SI_ORDER_ANY); +/* After fpuinitstate, before efidev */ +DECLARE_MODULE(efirt, efirt_moddata, SI_SUB_DRIVERS, SI_ORDER_SECOND); MODULE_VERSION(efirt, 1); From owner-svn-src-head@freebsd.org Thu Mar 22 18:42:14 2018 Return-Path: Delivered-To: svn-src-head@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 59BC4F5FC02; Thu, 22 Mar 2018 18:42:14 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-40.csi.cam.ac.uk (ppsw-40.csi.cam.ac.uk [131.111.8.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA35D8478C; Thu, 22 Mar 2018 18:42:13 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:13669) by ppsw-40.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1ez5AC-00085K-kG (Exim 4.89_2) (return-path ); Thu, 22 Mar 2018 18:42:12 +0000 Date: Thu, 22 Mar 2018 18:33:14 +0000 From: Ruslan Bukin To: Jonathan Looney Cc: "Jonathan T. Looney" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat Message-ID: <20180322183314.GA8919@bsdpad.com> References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> <20180322142225.GA5139@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 18:42:14 -0000 On Thu, Mar 22, 2018 at 03:39:23PM +0000, Jonathan Looney wrote: > Yes, this can be made optional, if there is a need for that. It may be good to have kernel option for that I think. As we target embedded market it is good to have things pluggable. Example: I able to fit freebsd kernel and minimalistic world to 2MB flash device (compressed). But I think if some code added I unable to fit anymore. But I agree that ROM memory is almost free, however some ASICs has this memory only and you may have no space for external chips on PCB. Ruslan From owner-svn-src-head@freebsd.org Thu Mar 22 18:58:36 2018 Return-Path: Delivered-To: svn-src-head@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 3A8F8F61019; Thu, 22 Mar 2018 18:58:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 DC0FE8519B; Thu, 22 Mar 2018 18:58:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6C36152DE; Thu, 22 Mar 2018 18:58:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MIwZKF048051; Thu, 22 Mar 2018 18:58:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MIwYcg048038; Thu, 22 Mar 2018 18:58:34 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201803221858.w2MIwYcg048038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 22 Mar 2018 18:58:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331366 - in head/contrib/llvm: include/llvm/MC lib/MC lib/MC/MCParser lib/Object X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/contrib/llvm: include/llvm/MC lib/MC lib/MC/MCParser lib/Object X-SVN-Commit-Revision: 331366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 18:58:36 -0000 Author: dim Date: Thu Mar 22 18:58:34 2018 New Revision: 331366 URL: https://svnweb.freebsd.org/changeset/base/331366 Log: Pull in r327101 from upstream llvm trunk (by Rafael Espindola): Don't treat .symver as a regular alias definition. This patch starts simplifying the handling of .symver. For now it just moves the responsibility for creating an alias down to the streamer. With that the asm streamer can pass a .symver unchanged, which is nice since gas cannot parse "foo@bar = zed". In a followup I hope to move the handling down to the writer so that we don't need special hacks for avoiding breaking names with @@@ on windows. Pull in r327160 from upstream llvm trunk (by Rafael Espindola): Delay creating an alias for @@@. With this we only create an alias for @@@ once we know if it should use @ or @@. This avoids last minutes renames and hacks to handle MS names. This only handles the ELF writer. LTO still has issues with @@@ aliases. Pull in r327928 from upstream llvm trunk (by Vitaly Buka): Object: Move attribute calculation into RecordStreamer. NFC Summary: Preparation for D44274 Reviewers: pcc, espindola Subscribers: hiraditya Differential Revision: https://reviews.llvm.org/D44276 Pull in r327930 from upstream llvm trunk (by Vitaly Buka): Object: Fix handling of @@@ in .symver directive Summary: name@@@nodename is going to be replaced with name@@nodename if symbols is defined in the assembled file, or name@nodename if undefined. https://sourceware.org/binutils/docs/as/Symver.html Fixes PR36623 Reviewers: pcc, espindola Subscribers: mehdi_amini, hiraditya Differential Revision: https://reviews.llvm.org/D44274 Together, these changes fix handling of @@@ in .symver directives when doing Link Time Optimization. Reported by: Shawn Webb MFC after: 3 months X-MFC-With: r327952 Modified: head/contrib/llvm/include/llvm/MC/MCAssembler.h head/contrib/llvm/include/llvm/MC/MCELFStreamer.h head/contrib/llvm/include/llvm/MC/MCStreamer.h head/contrib/llvm/lib/MC/ELFObjectWriter.cpp head/contrib/llvm/lib/MC/MCAsmStreamer.cpp head/contrib/llvm/lib/MC/MCELFStreamer.cpp head/contrib/llvm/lib/MC/MCParser/ELFAsmParser.cpp head/contrib/llvm/lib/MC/MCStreamer.cpp head/contrib/llvm/lib/Object/ModuleSymbolTable.cpp head/contrib/llvm/lib/Object/RecordStreamer.cpp head/contrib/llvm/lib/Object/RecordStreamer.h Modified: head/contrib/llvm/include/llvm/MC/MCAssembler.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCAssembler.h Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/include/llvm/MC/MCAssembler.h Thu Mar 22 18:58:34 2018 (r331366) @@ -206,6 +206,8 @@ class MCAssembler { (private) handleFixup(const MCAsmLayout &Layout, MCFragment &F, const MCFixup &Fixup); public: + std::vector> Symvers; + /// Construct a new assembler instance. // // FIXME: How are we going to parameterize this? Two obvious options are stay Modified: head/contrib/llvm/include/llvm/MC/MCELFStreamer.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCELFStreamer.h Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/include/llvm/MC/MCELFStreamer.h Thu Mar 22 18:58:34 2018 (r331366) @@ -51,6 +51,8 @@ class MCELFStreamer : public MCObjectStreamer { (publi unsigned ByteAlignment) override; void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override; + void emitELFSymverDirective(StringRef AliasName, + const MCSymbol *Aliasee) override; void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override; Modified: head/contrib/llvm/include/llvm/MC/MCStreamer.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCStreamer.h Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/include/llvm/MC/MCStreamer.h Thu Mar 22 18:58:34 2018 (r331366) @@ -519,9 +519,10 @@ class MCStreamer { (public) /// /// This corresponds to an assembler statement such as: /// .symver _start, foo@@SOME_VERSION - /// \param Alias - The versioned alias (i.e. "foo@@SOME_VERSION") + /// \param AliasName - The versioned alias (i.e. "foo@@SOME_VERSION") /// \param Aliasee - The aliased symbol (i.e. "_start") - virtual void emitELFSymverDirective(MCSymbol *Alias, const MCSymbol *Aliasee); + virtual void emitELFSymverDirective(StringRef AliasName, + const MCSymbol *Aliasee); /// \brief Emit a Linker Optimization Hint (LOH) directive. /// \param Args - Arguments of the LOH. Modified: head/contrib/llvm/lib/MC/ELFObjectWriter.cpp ============================================================================== --- head/contrib/llvm/lib/MC/ELFObjectWriter.cpp Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/MC/ELFObjectWriter.cpp Thu Mar 22 18:58:34 2018 (r331366) @@ -128,8 +128,6 @@ class ELFObjectWriter : public MCObjectWriter { /// @name Symbol Table Data /// @{ - BumpPtrAllocator Alloc; - StringSaver VersionSymSaver{Alloc}; StringTableBuilder StrTabBuilder{StringTableBuilder::ELF}; /// @} @@ -391,27 +389,29 @@ void ELFObjectWriter::executePostLayoutBinding(MCAssem const MCAsmLayout &Layout) { // The presence of symbol versions causes undefined symbols and // versions declared with @@@ to be renamed. - for (const MCSymbol &A : Asm.symbols()) { - const auto &Alias = cast(A); - // Not an alias. - if (!Alias.isVariable()) - continue; - auto *Ref = dyn_cast(Alias.getVariableValue()); - if (!Ref) - continue; - const auto &Symbol = cast(Ref->getSymbol()); - - StringRef AliasName = Alias.getName(); + for (const std::pair &P : Asm.Symvers) { + StringRef AliasName = P.first; + const auto &Symbol = cast(*P.second); size_t Pos = AliasName.find('@'); - if (Pos == StringRef::npos) - continue; + assert(Pos != StringRef::npos); + StringRef Prefix = AliasName.substr(0, Pos); + StringRef Rest = AliasName.substr(Pos); + StringRef Tail = Rest; + if (Rest.startswith("@@@")) + Tail = Rest.substr(Symbol.isUndefined() ? 2 : 1); + + auto *Alias = + cast(Asm.getContext().getOrCreateSymbol(Prefix + Tail)); + Asm.registerSymbol(*Alias); + const MCExpr *Value = MCSymbolRefExpr::create(&Symbol, Asm.getContext()); + Alias->setVariableValue(Value); + // Aliases defined with .symvar copy the binding from the symbol they alias. // This is the first place we are able to copy this information. - Alias.setExternal(Symbol.isExternal()); - Alias.setBinding(Symbol.getBinding()); + Alias->setExternal(Symbol.isExternal()); + Alias->setBinding(Symbol.getBinding()); - StringRef Rest = AliasName.substr(Pos); if (!Symbol.isUndefined() && !Rest.startswith("@@@")) continue; @@ -420,7 +420,7 @@ void ELFObjectWriter::executePostLayoutBinding(MCAssem !Rest.startswith("@@@")) report_fatal_error("A @@ version cannot be undefined"); - Renames.insert(std::make_pair(&Symbol, &Alias)); + Renames.insert(std::make_pair(&Symbol, Alias)); } } @@ -836,44 +836,7 @@ void ELFObjectWriter::computeSymbolTable( HasLargeSectionIndex = true; } - // The @@@ in symbol version is replaced with @ in undefined symbols and @@ - // in defined ones. - // - // FIXME: All name handling should be done before we get to the writer, - // including dealing with GNU-style version suffixes. Fixing this isn't - // trivial. - // - // We thus have to be careful to not perform the symbol version replacement - // blindly: - // - // The ELF format is used on Windows by the MCJIT engine. Thus, on - // Windows, the ELFObjectWriter can encounter symbols mangled using the MS - // Visual Studio C++ name mangling scheme. Symbols mangled using the MSVC - // C++ name mangling can legally have "@@@" as a sub-string. In that case, - // the EFLObjectWriter should not interpret the "@@@" sub-string as - // specifying GNU-style symbol versioning. The ELFObjectWriter therefore - // checks for the MSVC C++ name mangling prefix which is either "?", "@?", - // "__imp_?" or "__imp_@?". - // - // It would have been interesting to perform the MS mangling prefix check - // only when the target triple is of the form *-pc-windows-elf. But, it - // seems that this information is not easily accessible from the - // ELFObjectWriter. StringRef Name = Symbol.getName(); - SmallString<32> Buf; - if (!Name.startswith("?") && !Name.startswith("@?") && - !Name.startswith("__imp_?") && !Name.startswith("__imp_@?")) { - // This symbol isn't following the MSVC C++ name mangling convention. We - // can thus safely interpret the @@@ in symbol names as specifying symbol - // versioning. - size_t Pos = Name.find("@@@"); - if (Pos != StringRef::npos) { - Buf += Name.substr(0, Pos); - unsigned Skip = MSD.SectionIndex == ELF::SHN_UNDEF ? 2 : 1; - Buf += Name.substr(Pos + Skip); - Name = VersionSymSaver.save(Buf.c_str()); - } - } // Sections have their own string table if (Symbol.getType() != ELF::STT_SECTION) { Modified: head/contrib/llvm/lib/MC/MCAsmStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCAsmStreamer.cpp Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/MC/MCAsmStreamer.cpp Thu Mar 22 18:58:34 2018 (r331366) @@ -129,6 +129,9 @@ class MCAsmStreamer final : public MCStreamer { (publi void ChangeSection(MCSection *Section, const MCExpr *Subsection) override; + void emitELFSymverDirective(StringRef AliasName, + const MCSymbol *Aliasee) override; + void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override; void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override; @@ -409,6 +412,14 @@ void MCAsmStreamer::ChangeSection(MCSection *Section, *MAI, getContext().getObjectFileInfo()->getTargetTriple(), OS, Subsection); } +} + +void MCAsmStreamer::emitELFSymverDirective(StringRef AliasName, + const MCSymbol *Aliasee) { + OS << ".symver "; + Aliasee->print(OS, MAI); + OS << ", " << AliasName; + EmitEOL(); } void MCAsmStreamer::EmitLabel(MCSymbol *Symbol, SMLoc Loc) { Modified: head/contrib/llvm/lib/MC/MCELFStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCELFStreamer.cpp Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/MC/MCELFStreamer.cpp Thu Mar 22 18:58:34 2018 (r331366) @@ -337,6 +337,11 @@ void MCELFStreamer::emitELFSize(MCSymbol *Symbol, cons cast(Symbol)->setSize(Value); } +void MCELFStreamer::emitELFSymverDirective(StringRef AliasName, + const MCSymbol *Aliasee) { + getAssembler().Symvers.push_back({AliasName, Aliasee}); +} + void MCELFStreamer::EmitLocalCommonSymbol(MCSymbol *S, uint64_t Size, unsigned ByteAlignment) { auto *Symbol = cast(S); Modified: head/contrib/llvm/lib/MC/MCParser/ELFAsmParser.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCParser/ELFAsmParser.cpp Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/MC/MCParser/ELFAsmParser.cpp Thu Mar 22 18:58:34 2018 (r331366) @@ -767,12 +767,8 @@ bool ELFAsmParser::ParseDirectiveSymver(StringRef, SML if (AliasName.find('@') == StringRef::npos) return TokError("expected a '@' in the name"); - MCSymbol *Alias = getContext().getOrCreateSymbol(AliasName); MCSymbol *Sym = getContext().getOrCreateSymbol(Name); - const MCExpr *Value = MCSymbolRefExpr::create(Sym, getContext()); - - getStreamer().EmitAssignment(Alias, Value); - getStreamer().emitELFSymverDirective(Alias, Sym); + getStreamer().emitELFSymverDirective(AliasName, Sym); return false; } Modified: head/contrib/llvm/lib/MC/MCStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCStreamer.cpp Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/MC/MCStreamer.cpp Thu Mar 22 18:58:34 2018 (r331366) @@ -925,7 +925,7 @@ void MCStreamer::EmitCOFFSymbolType(int Type) { llvm_unreachable("this directive only supported on COFF targets"); } void MCStreamer::emitELFSize(MCSymbol *Symbol, const MCExpr *Value) {} -void MCStreamer::emitELFSymverDirective(MCSymbol *Alias, +void MCStreamer::emitELFSymverDirective(StringRef AliasName, const MCSymbol *Aliasee) {} void MCStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) {} Modified: head/contrib/llvm/lib/Object/ModuleSymbolTable.cpp ============================================================================== --- head/contrib/llvm/lib/Object/ModuleSymbolTable.cpp Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/Object/ModuleSymbolTable.cpp Thu Mar 22 18:58:34 2018 (r331366) @@ -24,7 +24,6 @@ #include "llvm/IR/GlobalAlias.h" #include "llvm/IR/GlobalValue.h" #include "llvm/IR/GlobalVariable.h" -#include "llvm/IR/Mangler.h" #include "llvm/IR/Module.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" @@ -69,81 +68,6 @@ void ModuleSymbolTable::addModule(Module *M) { }); } -// Ensure ELF .symver aliases get the same binding as the defined symbol -// they alias with. -static void handleSymverAliases(const Module &M, RecordStreamer &Streamer) { - if (Streamer.symverAliases().empty()) - return; - - // The name in the assembler will be mangled, but the name in the IR - // might not, so we first compute a mapping from mangled name to GV. - Mangler Mang; - SmallString<64> MangledName; - StringMap MangledNameMap; - auto GetMangledName = [&](const GlobalValue &GV) { - if (!GV.hasName()) - return; - - MangledName.clear(); - MangledName.reserve(GV.getName().size() + 1); - Mang.getNameWithPrefix(MangledName, &GV, /*CannotUsePrivateLabel=*/false); - MangledNameMap[MangledName] = &GV; - }; - for (const Function &F : M) - GetMangledName(F); - for (const GlobalVariable &GV : M.globals()) - GetMangledName(GV); - for (const GlobalAlias &GA : M.aliases()) - GetMangledName(GA); - - // Walk all the recorded .symver aliases, and set up the binding - // for each alias. - for (auto &Symver : Streamer.symverAliases()) { - const MCSymbol *Aliasee = Symver.first; - MCSymbolAttr Attr = MCSA_Invalid; - - // First check if the aliasee binding was recorded in the asm. - RecordStreamer::State state = Streamer.getSymbolState(Aliasee); - switch (state) { - case RecordStreamer::Global: - case RecordStreamer::DefinedGlobal: - Attr = MCSA_Global; - break; - case RecordStreamer::UndefinedWeak: - case RecordStreamer::DefinedWeak: - Attr = MCSA_Weak; - break; - default: - break; - } - - // If we don't have a symbol attribute from assembly, then check if - // the aliasee was defined in the IR. - if (Attr == MCSA_Invalid) { - const auto *GV = M.getNamedValue(Aliasee->getName()); - if (!GV) { - auto MI = MangledNameMap.find(Aliasee->getName()); - if (MI != MangledNameMap.end()) - GV = MI->second; - else - continue; - } - if (GV->hasExternalLinkage()) - Attr = MCSA_Global; - else if (GV->hasLocalLinkage()) - Attr = MCSA_Local; - else if (GV->isWeakForLinker()) - Attr = MCSA_Weak; - } - if (Attr == MCSA_Invalid) - continue; - - // Set the detected binding on each alias with this aliasee. - for (auto &Alias : Symver.second) - Streamer.EmitSymbolAttribute(Alias, Attr); - } -} - void ModuleSymbolTable::CollectAsmSymbols( const Module &M, function_ref AsmSymbol) { @@ -176,7 +100,7 @@ void ModuleSymbolTable::CollectAsmSymbols( MCObjectFileInfo MOFI; MCContext MCCtx(MAI.get(), MRI.get(), &MOFI); MOFI.InitMCObjectFileInfo(TT, /*PIC*/ false, MCCtx); - RecordStreamer Streamer(MCCtx); + RecordStreamer Streamer(MCCtx, M); T->createNullTargetStreamer(Streamer); std::unique_ptr Buffer(MemoryBuffer::getMemBuffer(InlineAsm)); @@ -195,7 +119,7 @@ void ModuleSymbolTable::CollectAsmSymbols( if (Parser->Run(false)) return; - handleSymverAliases(M, Streamer); + Streamer.flushSymverDirectives(); for (auto &KV : Streamer) { StringRef Key = KV.first(); Modified: head/contrib/llvm/lib/Object/RecordStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/Object/RecordStreamer.cpp Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/Object/RecordStreamer.cpp Thu Mar 22 18:58:34 2018 (r331366) @@ -8,6 +8,9 @@ //===----------------------------------------------------------------------===// #include "RecordStreamer.h" +#include "llvm/IR/Mangler.h" +#include "llvm/IR/Module.h" +#include "llvm/MC/MCContext.h" #include "llvm/MC/MCSymbol.h" using namespace llvm; @@ -70,7 +73,8 @@ void RecordStreamer::markUsed(const MCSymbol &Symbol) void RecordStreamer::visitUsedSymbol(const MCSymbol &Sym) { markUsed(Sym); } -RecordStreamer::RecordStreamer(MCContext &Context) : MCStreamer(Context) {} +RecordStreamer::RecordStreamer(MCContext &Context, const Module &M) + : MCStreamer(Context), M(M) {} RecordStreamer::const_iterator RecordStreamer::begin() { return Symbols.begin(); @@ -112,7 +116,109 @@ void RecordStreamer::EmitCommonSymbol(MCSymbol *Symbol markDefined(*Symbol); } -void RecordStreamer::emitELFSymverDirective(MCSymbol *Alias, +RecordStreamer::State RecordStreamer::getSymbolState(const MCSymbol *Sym) { + auto SI = Symbols.find(Sym->getName()); + if (SI == Symbols.end()) + return NeverSeen; + return SI->second; +} + +void RecordStreamer::emitELFSymverDirective(StringRef AliasName, const MCSymbol *Aliasee) { - SymverAliasMap[Aliasee].push_back(Alias); + SymverAliasMap[Aliasee].push_back(AliasName); +} + +void RecordStreamer::flushSymverDirectives() { + // Mapping from mangled name to GV. + StringMap MangledNameMap; + // The name in the assembler will be mangled, but the name in the IR + // might not, so we first compute a mapping from mangled name to GV. + Mangler Mang; + SmallString<64> MangledName; + for (const GlobalValue &GV : M.global_values()) { + if (!GV.hasName()) + continue; + MangledName.clear(); + MangledName.reserve(GV.getName().size() + 1); + Mang.getNameWithPrefix(MangledName, &GV, /*CannotUsePrivateLabel=*/false); + MangledNameMap[MangledName] = &GV; + } + + // Walk all the recorded .symver aliases, and set up the binding + // for each alias. + for (auto &Symver : SymverAliasMap) { + const MCSymbol *Aliasee = Symver.first; + MCSymbolAttr Attr = MCSA_Invalid; + bool IsDefined = false; + + // First check if the aliasee binding was recorded in the asm. + RecordStreamer::State state = getSymbolState(Aliasee); + switch (state) { + case RecordStreamer::Global: + case RecordStreamer::DefinedGlobal: + Attr = MCSA_Global; + break; + case RecordStreamer::UndefinedWeak: + case RecordStreamer::DefinedWeak: + Attr = MCSA_Weak; + break; + default: + break; + } + + switch (state) { + case RecordStreamer::Defined: + case RecordStreamer::DefinedGlobal: + case RecordStreamer::DefinedWeak: + IsDefined = true; + break; + case RecordStreamer::NeverSeen: + case RecordStreamer::Global: + case RecordStreamer::Used: + case RecordStreamer::UndefinedWeak: + break; + } + + if (Attr == MCSA_Invalid || !IsDefined) { + const GlobalValue *GV = M.getNamedValue(Aliasee->getName()); + if (!GV) { + auto MI = MangledNameMap.find(Aliasee->getName()); + if (MI != MangledNameMap.end()) + GV = MI->second; + } + if (GV) { + // If we don't have a symbol attribute from assembly, then check if + // the aliasee was defined in the IR. + if (Attr == MCSA_Invalid) { + if (GV->hasExternalLinkage()) + Attr = MCSA_Global; + else if (GV->hasLocalLinkage()) + Attr = MCSA_Local; + else if (GV->isWeakForLinker()) + Attr = MCSA_Weak; + } + IsDefined = IsDefined || !GV->isDeclarationForLinker(); + } + } + + // Set the detected binding on each alias with this aliasee. + for (auto AliasName : Symver.second) { + std::pair Split = AliasName.split("@@@"); + SmallString<128> NewName; + if (!Split.second.empty() && !Split.second.startswith("@")) { + // Special processing for "@@@" according + // https://sourceware.org/binutils/docs/as/Symver.html + const char *Separator = IsDefined ? "@@" : "@"; + AliasName = + (Split.first + Separator + Split.second).toStringRef(NewName); + } + MCSymbol *Alias = getContext().getOrCreateSymbol(AliasName); + // TODO: Handle "@@@". Depending on SymbolAttribute value it needs to be + // converted into @ or @@. + const MCExpr *Value = MCSymbolRefExpr::create(Aliasee, getContext()); + EmitAssignment(Alias, Value); + if (Attr != MCSA_Invalid) + EmitSymbolAttribute(Alias, Attr); + } + } } Modified: head/contrib/llvm/lib/Object/RecordStreamer.h ============================================================================== --- head/contrib/llvm/lib/Object/RecordStreamer.h Thu Mar 22 18:24:00 2018 (r331365) +++ head/contrib/llvm/lib/Object/RecordStreamer.h Thu Mar 22 18:58:34 2018 (r331366) @@ -20,25 +20,32 @@ namespace llvm { +class GlobalValue; +class Module; + class RecordStreamer : public MCStreamer { public: enum State { NeverSeen, Global, Defined, DefinedGlobal, DefinedWeak, Used, UndefinedWeak}; private: + const Module &M; StringMap Symbols; // Map of aliases created by .symver directives, saved so we can update // their symbol binding after parsing complete. This maps from each // aliasee to its list of aliases. - DenseMap> SymverAliasMap; + DenseMap> SymverAliasMap; + /// Get the state recorded for the given symbol. + State getSymbolState(const MCSymbol *Sym); + void markDefined(const MCSymbol &Symbol); void markGlobal(const MCSymbol &Symbol, MCSymbolAttr Attribute); void markUsed(const MCSymbol &Symbol); void visitUsedSymbol(const MCSymbol &Sym) override; public: - RecordStreamer(MCContext &Context); + RecordStreamer(MCContext &Context, const Module &M); using const_iterator = StringMap::const_iterator; @@ -54,20 +61,11 @@ class RecordStreamer : public MCStreamer { (public) void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override; /// Record .symver aliases for later processing. - void emitELFSymverDirective(MCSymbol *Alias, + void emitELFSymverDirective(StringRef AliasName, const MCSymbol *Aliasee) override; - /// Return the map of .symver aliasee to associated aliases. - DenseMap> &symverAliases() { - return SymverAliasMap; - } - - /// Get the state recorded for the given symbol. - State getSymbolState(const MCSymbol *Sym) { - auto SI = Symbols.find(Sym->getName()); - if (SI == Symbols.end()) - return NeverSeen; - return SI->second; - } + // Emit ELF .symver aliases and ensure they have the same binding as the + // defined symbol they alias with. + void flushSymverDirectives(); }; } // end namespace llvm From owner-svn-src-head@freebsd.org Thu Mar 22 19:06:51 2018 Return-Path: Delivered-To: svn-src-head@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 47997F61DA6; Thu, 22 Mar 2018 19:06:51 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 EA8C2859EA; Thu, 22 Mar 2018 19:06:50 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E57201545C; Thu, 22 Mar 2018 19:06:50 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MJ6oJo052899; Thu, 22 Mar 2018 19:06:50 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MJ6o3v052898; Thu, 22 Mar 2018 19:06:50 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803221906.w2MJ6o3v052898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Thu, 22 Mar 2018 19:06:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331367 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331367 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 19:06:51 -0000 Author: jeff Date: Thu Mar 22 19:06:50 2018 New Revision: 331367 URL: https://svnweb.freebsd.org/changeset/base/331367 Log: Use read_mostly and alignment tags to eliminate or limit false sharing. Reviewed by: markj (Part of D14707) Sponsored by: Netflix, Dell/EMC Isilon Modified: head/sys/vm/vm_phys.c Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Thu Mar 22 18:58:34 2018 (r331366) +++ head/sys/vm/vm_phys.c Thu Mar 22 19:06:50 2018 (r331367) @@ -73,14 +73,14 @@ _Static_assert(sizeof(long) * NBBY >= VM_PHYSSEG_MAX, "Too many physsegs."); #ifdef NUMA -struct mem_affinity *mem_affinity; -int *mem_locality; +struct mem_affinity __read_mostly *mem_affinity; +int __read_mostly *mem_locality; #endif -int vm_ndomains = 1; +int __read_mostly vm_ndomains = 1; -struct vm_phys_seg vm_phys_segs[VM_PHYSSEG_MAX]; -int vm_phys_nsegs; +struct vm_phys_seg __read_mostly vm_phys_segs[VM_PHYSSEG_MAX]; +int __read_mostly vm_phys_nsegs; struct vm_phys_fictitious_seg; static int vm_phys_fictitious_cmp(struct vm_phys_fictitious_seg *, @@ -100,18 +100,18 @@ struct vm_phys_fictitious_seg { RB_GENERATE_STATIC(fict_tree, vm_phys_fictitious_seg, node, vm_phys_fictitious_cmp); -static struct rwlock vm_phys_fictitious_reg_lock; +static struct rwlock_padalign vm_phys_fictitious_reg_lock; MALLOC_DEFINE(M_FICT_PAGES, "vm_fictitious", "Fictitious VM pages"); -static struct vm_freelist +static struct vm_freelist __aligned(CACHE_LINE_SIZE) vm_phys_free_queues[MAXMEMDOM][VM_NFREELIST][VM_NFREEPOOL][VM_NFREEORDER]; -static int vm_nfreelists; +static int __read_mostly vm_nfreelists; /* * Provides the mapping from VM_FREELIST_* to free list indices (flind). */ -static int vm_freelist_to_flind[VM_NFREELIST]; +static int __read_mostly vm_freelist_to_flind[VM_NFREELIST]; CTASSERT(VM_FREELIST_DEFAULT == 0); From owner-svn-src-head@freebsd.org Thu Mar 22 19:11:44 2018 Return-Path: Delivered-To: svn-src-head@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 AE954F62485; Thu, 22 Mar 2018 19:11:44 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 616C685ED1; Thu, 22 Mar 2018 19:11:44 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C3AF155CF; Thu, 22 Mar 2018 19:11:44 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MJBit3056727; Thu, 22 Mar 2018 19:11:44 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MJBirP056724; Thu, 22 Mar 2018 19:11:44 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803221911.w2MJBirP056724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Thu, 22 Mar 2018 19:11:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331368 - in head/sys: kern sys vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: kern sys vm X-SVN-Commit-Revision: 331368 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 19:11:44 -0000 Author: jeff Date: Thu Mar 22 19:11:43 2018 New Revision: 331368 URL: https://svnweb.freebsd.org/changeset/base/331368 Log: Start witness much earlier in boot so that we can shrink the pend list and make it more immune to further change. Reviewed by: markj, imp (Part of D14707) Sponsored by: Netflix, Dell/EMC Isilon Modified: head/sys/kern/subr_witness.c head/sys/sys/lock.h head/sys/vm/vm_page.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Thu Mar 22 19:06:50 2018 (r331367) +++ head/sys/kern/subr_witness.c Thu Mar 22 19:11:43 2018 (r331368) @@ -139,7 +139,7 @@ __FBSDID("$FreeBSD$"); #define WITNESS_COUNT 1536 #endif #define WITNESS_HASH_SIZE 251 /* Prime, gives load factor < 2 */ -#define WITNESS_PENDLIST (2048 + (MAXCPU * 4)) +#define WITNESS_PENDLIST (512 + (MAXCPU * 4)) /* Allocate 256 KB of stack data space */ #define WITNESS_LO_DATA_COUNT 2048 @@ -752,27 +752,45 @@ fixup_filename(const char *file) } /* + * Calculate the size of early witness structures. + */ +int +witness_startup_count(void) +{ + int sz; + + sz = sizeof(struct witness) * witness_count; + sz += sizeof(*w_rmatrix) * (witness_count + 1); + sz += sizeof(*w_rmatrix[0]) * (witness_count + 1) * + (witness_count + 1); + + return (sz); +} + +/* * The WITNESS-enabled diagnostic code. Note that the witness code does * assume that the early boot is single-threaded at least until after this * routine is completed. */ -static void -witness_initialize(void *dummy __unused) +void +witness_startup(void *mem) { struct lock_object *lock; struct witness_order_list_entry *order; struct witness *w, *w1; + uintptr_t p; int i; - w_data = malloc(sizeof (struct witness) * witness_count, M_WITNESS, - M_WAITOK | M_ZERO); + p = (uintptr_t)mem; + w_data = (void *)p; + p += sizeof(struct witness) * witness_count; - w_rmatrix = malloc(sizeof(*w_rmatrix) * (witness_count + 1), - M_WITNESS, M_WAITOK | M_ZERO); + w_rmatrix = (void *)p; + p += sizeof(*w_rmatrix) * (witness_count + 1); for (i = 0; i < witness_count + 1; i++) { - w_rmatrix[i] = malloc(sizeof(*w_rmatrix[i]) * - (witness_count + 1), M_WITNESS, M_WAITOK | M_ZERO); + w_rmatrix[i] = (void *)p; + p += sizeof(*w_rmatrix[i]) * (witness_count + 1); } badstack_sbuf_size = witness_count * 256; @@ -840,8 +858,6 @@ witness_initialize(void *dummy __unused) mtx_lock(&Giant); } -SYSINIT(witness_init, SI_SUB_WITNESS, SI_ORDER_FIRST, witness_initialize, - NULL); void witness_init(struct lock_object *lock, const char *type) Modified: head/sys/sys/lock.h ============================================================================== --- head/sys/sys/lock.h Thu Mar 22 19:06:50 2018 (r331367) +++ head/sys/sys/lock.h Thu Mar 22 19:11:43 2018 (r331368) @@ -277,6 +277,8 @@ const char *witness_file(struct lock_object *); void witness_thread_exit(struct thread *); #ifdef WITNESS +int witness_startup_count(void); +void witness_startup(void *); /* Flags for witness_warn(). */ #define WARN_GIANTOK 0x01 /* Giant is exempt from this check. */ Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Mar 22 19:06:50 2018 (r331367) +++ head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) @@ -539,6 +539,15 @@ vm_page_startup(vm_offset_t vaddr) bzero((void *)mapped, end - new_end); uma_startup((void *)mapped, boot_pages); +#ifdef WITNESS + end = new_end; + new_end = end - round_page(witness_startup_count()); + mapped = pmap_map(&vaddr, new_end, end, + VM_PROT_READ | VM_PROT_WRITE); + bzero((void *)mapped, end - new_end); + witness_startup((void *)mapped); +#endif + #if defined(__aarch64__) || defined(__amd64__) || defined(__arm__) || \ defined(__i386__) || defined(__mips__) /* From owner-svn-src-head@freebsd.org Thu Mar 22 19:21:12 2018 Return-Path: Delivered-To: svn-src-head@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 F1CFAF632AF; Thu, 22 Mar 2018 19:21:11 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 A468C864DD; Thu, 22 Mar 2018 19:21:11 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D8E01566A; Thu, 22 Mar 2018 19:21:11 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MJLBNI058564; Thu, 22 Mar 2018 19:21:11 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MJLBi7058560; Thu, 22 Mar 2018 19:21:11 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803221921.w2MJLBi7058560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Thu, 22 Mar 2018 19:21:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331369 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 19:21:12 -0000 Author: jeff Date: Thu Mar 22 19:21:11 2018 New Revision: 331369 URL: https://svnweb.freebsd.org/changeset/base/331369 Log: Lock reservations with a dedicated lock in each reservation. Protect the vmd_free_count with atomics. This allows us to allocate and free from reservations without the free lock except where a superpage is allocated from the physical layer, which is roughly 1/512 of the operations on amd64. Use the counter api to eliminate cache conention on counters. Reviewed by: markj Tested by: pho Sponsored by: Netflix, Dell/EMC Isilon Differential Revision: https://reviews.freebsd.org/D14707 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_pagequeue.h head/sys/vm/vm_reserv.c head/sys/vm/vm_reserv.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369) @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; static void vm_page_alloc_check(vm_page_t m); static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); static void vm_page_enqueue(uint8_t queue, vm_page_t m); -static void vm_page_free_phys(struct vm_domain *vmd, vm_page_t m); static void vm_page_init(void *dummy); static int vm_page_insert_after(vm_page_t m, vm_object_t object, vm_pindex_t pindex, vm_page_t mpred); @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_t pi * for the request class and false otherwise. */ int -vm_domain_available(struct vm_domain *vmd, int req, int npages) +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) { + u_int limit, old, new; - vm_domain_free_assert_locked(vmd); req = req & VM_ALLOC_CLASS_MASK; /* @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int req, in */ if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) req = VM_ALLOC_SYSTEM; + if (req == VM_ALLOC_INTERRUPT) + limit = 0; + else if (req == VM_ALLOC_SYSTEM) + limit = vmd->vmd_interrupt_free_min; + else + limit = vmd->vmd_free_reserved; - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || - (req == VM_ALLOC_SYSTEM && - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) || - (req == VM_ALLOC_INTERRUPT && - vmd->vmd_free_count >= npages)) - return (1); + /* + * Attempt to reserve the pages. Fail if we're below the limit. + */ + limit += npages; + old = vmd->vmd_free_count; + do { + if (old < limit) + return (0); + new = old - npages; + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == 0); - return (0); + /* Wake the page daemon if we've crossed the threshold. */ + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) + pagedaemon_wakeup(vmd->vmd_domain); + + /* Only update bitsets on transitions. */ + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) + vm_domain_set(vmd); + + return (1); } vm_page_t @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind again: m = NULL; #if VM_NRESERVLEVEL > 0 + /* + * Can we allocate the page from a reservation? + */ if (vm_object_reserv(object) && - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) - != NULL) { + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) != NULL || + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred)) != NULL)) { domain = vm_phys_domain(m); vmd = VM_DOMAIN(domain); goto found; } #endif vmd = VM_DOMAIN(domain); - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, 1)) { + if (vm_domain_allocate(vmd, req, 1)) { /* - * Can we allocate the page from a reservation? + * If not, allocate it from the free page queues. */ + vm_domain_free_lock(vmd); + m = vm_phys_alloc_pages(domain, object != NULL ? + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); + vm_domain_free_unlock(vmd); + if (m == NULL) { + vm_domain_freecnt_inc(vmd, 1); #if VM_NRESERVLEVEL > 0 - if (!vm_object_reserv(object) || - (m = vm_reserv_alloc_page(object, pindex, - domain, mpred)) == NULL) + if (vm_reserv_reclaim_inactive(domain)) + goto again; #endif - { - /* - * If not, allocate it from the free page queues. - */ - m = vm_phys_alloc_pages(domain, object != NULL ? - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); -#if VM_NRESERVLEVEL > 0 - if (m == NULL && vm_reserv_reclaim_inactive(domain)) { - m = vm_phys_alloc_pages(domain, - object != NULL ? - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, - 0); - } -#endif } } - if (m != NULL) - vm_domain_freecnt_dec(vmd, 1); - vm_domain_free_unlock(vmd); if (m == NULL) { /* * Not allocatable, give up. @@ -1775,9 +1783,7 @@ again: */ KASSERT(m != NULL, ("missing page")); -#if VM_NRESERVLEVEL > 0 found: -#endif vm_page_alloc_check(m); /* @@ -1934,9 +1940,14 @@ vm_page_alloc_contig_domain(vm_object_t object, vm_pin */ again: #if VM_NRESERVLEVEL > 0 + /* + * Can we allocate the pages from a reservation? + */ if (vm_object_reserv(object) && - (m_ret = vm_reserv_extend_contig(req, object, pindex, domain, - npages, low, high, alignment, boundary, mpred)) != NULL) { + ((m_ret = vm_reserv_extend_contig(req, object, pindex, domain, + npages, low, high, alignment, boundary, mpred)) != NULL || + (m_ret = vm_reserv_alloc_contig(req, object, pindex, domain, + npages, low, high, alignment, boundary, mpred)) != NULL)) { domain = vm_phys_domain(m_ret); vmd = VM_DOMAIN(domain); goto found; @@ -1944,31 +1955,23 @@ again: #endif m_ret = NULL; vmd = VM_DOMAIN(domain); - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, npages)) { + if (vm_domain_allocate(vmd, req, npages)) { /* - * Can we allocate the pages from a reservation? + * allocate them from the free page queues. */ + vm_domain_free_lock(vmd); + m_ret = vm_phys_alloc_contig(domain, npages, low, high, + alignment, boundary); + vm_domain_free_unlock(vmd); + if (m_ret == NULL) { + vm_domain_freecnt_inc(vmd, npages); #if VM_NRESERVLEVEL > 0 -retry: - if (!vm_object_reserv(object) || - (m_ret = vm_reserv_alloc_contig(object, pindex, domain, - npages, low, high, alignment, boundary, mpred)) == NULL) + if (vm_reserv_reclaim_contig(domain, npages, low, + high, alignment, boundary)) + goto again; #endif - /* - * If not, allocate them from the free page queues. - */ - m_ret = vm_phys_alloc_contig(domain, npages, low, high, - alignment, boundary); -#if VM_NRESERVLEVEL > 0 - if (m_ret == NULL && vm_reserv_reclaim_contig( - domain, npages, low, high, alignment, boundary)) - goto retry; -#endif + } } - if (m_ret != NULL) - vm_domain_freecnt_dec(vmd, npages); - vm_domain_free_unlock(vmd); if (m_ret == NULL) { if (vm_domain_alloc_fail(vmd, object, req)) goto again; @@ -2109,13 +2112,14 @@ vm_page_alloc_freelist_domain(int domain, int freelist */ vmd = VM_DOMAIN(domain); again: - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, 1)) + if (vm_domain_allocate(vmd, req, 1)) { + vm_domain_free_lock(vmd); m = vm_phys_alloc_freelist_pages(domain, freelist, VM_FREEPOOL_DIRECT, 0); - if (m != NULL) - vm_domain_freecnt_dec(vmd, 1); - vm_domain_free_unlock(vmd); + vm_domain_free_unlock(vmd); + if (m == NULL) + vm_domain_freecnt_inc(vmd, 1); + } if (m == NULL) { if (vm_domain_alloc_fail(vmd, NULL, req)) goto again; @@ -2491,8 +2495,9 @@ retry: vm_page_remque(m); vm_page_replace_checked(m_new, object, m->pindex, m); - m->valid = 0; - vm_page_undirty(m); + if (vm_page_free_prep(m, false)) + SLIST_INSERT_HEAD(&free, m, + plinks.s.ss); /* * The new page must be deactivated @@ -2504,10 +2509,12 @@ retry: m->flags &= ~PG_ZERO; vm_page_remque(m); vm_page_remove(m); + if (vm_page_free_prep(m, false)) + SLIST_INSERT_HEAD(&free, m, + plinks.s.ss); KASSERT(m->dirty == 0, ("page %p is dirty", m)); } - SLIST_INSERT_HEAD(&free, m, plinks.s.ss); } else error = EBUSY; unlock: @@ -2548,7 +2555,7 @@ unlock: do { MPASS(vm_phys_domain(m) == domain); SLIST_REMOVE_HEAD(&free, plinks.s.ss); - vm_page_free_phys(vmd, m); + vm_phys_free_pages(m, 0); cnt++; } while ((m = SLIST_FIRST(&free)) != NULL); vm_domain_free_unlock(vmd); @@ -3159,24 +3166,12 @@ vm_page_free_prep(vm_page_t m, bool pagequeue_locked) if (pmap_page_get_memattr(m) != VM_MEMATTR_DEFAULT) pmap_page_set_memattr(m, VM_MEMATTR_DEFAULT); - return (true); -} - -/* - * Insert the page into the physical memory allocator's free page - * queues. This is the last step to free a page. The caller is - * responsible for adjusting the free page count. - */ -static void -vm_page_free_phys(struct vm_domain *vmd, vm_page_t m) -{ - - vm_domain_free_assert_locked(vmd); - #if VM_NRESERVLEVEL > 0 - if (!vm_reserv_free_page(m)) + if (vm_reserv_free_page(m)) + return (false); #endif - vm_phys_free_pages(m, 0); + + return (true); } void @@ -3200,7 +3195,7 @@ vm_page_free_phys_pglist(struct pglist *tq) vmd = vm_pagequeue_domain(m); vm_domain_free_lock(vmd); } - vm_page_free_phys(vmd, m); + vm_phys_free_pages(m, 0); cnt++; } if (vmd != NULL) { @@ -3227,7 +3222,7 @@ vm_page_free_toq(vm_page_t m) return; vmd = vm_pagequeue_domain(m); vm_domain_free_lock(vmd); - vm_page_free_phys(vmd, m); + vm_phys_free_pages(m, 0); vm_domain_free_unlock(vmd); vm_domain_freecnt_inc(vmd, 1); } Modified: head/sys/vm/vm_pagequeue.h ============================================================================== --- head/sys/vm/vm_pagequeue.h Thu Mar 22 19:11:43 2018 (r331368) +++ head/sys/vm/vm_pagequeue.h Thu Mar 22 19:21:11 2018 (r331369) @@ -180,7 +180,7 @@ vm_pagequeue_cnt_add(struct vm_pagequeue *pq, int adde void vm_domain_set(struct vm_domain *vmd); void vm_domain_clear(struct vm_domain *vmd); -int vm_domain_available(struct vm_domain *vmd, int req, int npages); +int vm_domain_allocate(struct vm_domain *vmd, int req, int npages); /* * vm_pagequeue_domain: @@ -265,23 +265,6 @@ vm_domain_freecnt_inc(struct vm_domain *vmd, int adj) new >= vmd->vmd_pageout_free_min))) vm_domain_clear(vmd); } - -static inline void -vm_domain_freecnt_dec(struct vm_domain *vmd, int adj) -{ - u_int old, new; - - old = atomic_fetchadd_int(&vmd->vmd_free_count, -adj); - new = old - adj; - KASSERT(new >= 0, ("vm_domain_freecnt_dec: free count underflow")); - if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) - pagedaemon_wakeup(vmd->vmd_domain); - /* Only update bitsets on transitions. */ - if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || - (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) - vm_domain_set(vmd); -} - #endif /* _KERNEL */ #endif /* !_VM_PAGEQUEUE_ */ Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Thu Mar 22 19:11:43 2018 (r331368) +++ head/sys/vm/vm_reserv.c Thu Mar 22 19:21:11 2018 (r331369) @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -54,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -166,22 +169,37 @@ popmap_is_set(popmap_t popmap[], int i) * * A partially populated reservation can be broken and reclaimed at any time. * - * f - vm_domain_free_lock + * r - vm_reserv_lock + * d - vm_reserv_domain_lock * o - vm_reserv_object_lock * c - constant after boot */ struct vm_reserv { - TAILQ_ENTRY(vm_reserv) partpopq; /* (f) per-domain queue. */ - LIST_ENTRY(vm_reserv) objq; /* (o, f) object queue */ - vm_object_t object; /* (o, f) containing object */ - vm_pindex_t pindex; /* (o, f) offset in object */ + struct mtx lock; /* reservation lock. */ + TAILQ_ENTRY(vm_reserv) partpopq; /* (d) per-domain queue. */ + LIST_ENTRY(vm_reserv) objq; /* (o, r) object queue */ + vm_object_t object; /* (o, r) containing object */ + vm_pindex_t pindex; /* (o, r) offset in object */ vm_page_t pages; /* (c) first page */ - int domain; /* (c) NUMA domain. */ - int popcnt; /* (f) # of pages in use */ - char inpartpopq; /* (f) */ - popmap_t popmap[NPOPMAP]; /* (f) bit vector, used pages */ + uint16_t domain; /* (c) NUMA domain. */ + uint16_t popcnt; /* (r) # of pages in use */ + char inpartpopq; /* (d) */ + popmap_t popmap[NPOPMAP]; /* (r) bit vector, used pages */ }; +#define vm_reserv_lockptr(rv) (&(rv)->lock) +#define vm_reserv_assert_locked(rv) \ + mtx_assert(vm_reserv_lockptr(rv), MA_OWNED) +#define vm_reserv_lock(rv) mtx_lock(vm_reserv_lockptr(rv)) +#define vm_reserv_trylock(rv) mtx_trylock(vm_reserv_lockptr(rv)) +#define vm_reserv_unlock(rv) mtx_unlock(vm_reserv_lockptr(rv)) + +static struct mtx_padalign vm_reserv_domain_locks[MAXMEMDOM]; + +#define vm_reserv_domain_lockptr(d) &vm_reserv_domain_locks[(d)] +#define vm_reserv_domain_lock(d) mtx_lock(vm_reserv_domain_lockptr(d)) +#define vm_reserv_domain_unlock(d) mtx_unlock(vm_reserv_domain_lockptr(d)) + /* * The reservation array * @@ -218,13 +236,13 @@ static TAILQ_HEAD(, vm_reserv) vm_rvq_partpop[MAXMEMDO static SYSCTL_NODE(_vm, OID_AUTO, reserv, CTLFLAG_RD, 0, "Reservation Info"); -static long vm_reserv_broken; -SYSCTL_LONG(_vm_reserv, OID_AUTO, broken, CTLFLAG_RD, - &vm_reserv_broken, 0, "Cumulative number of broken reservations"); +static counter_u64_t vm_reserv_broken = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, broken, CTLFLAG_RD, + &vm_reserv_broken, "Cumulative number of broken reservations"); -static long vm_reserv_freed; -SYSCTL_LONG(_vm_reserv, OID_AUTO, freed, CTLFLAG_RD, - &vm_reserv_freed, 0, "Cumulative number of freed reservations"); +static counter_u64_t vm_reserv_freed = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, freed, CTLFLAG_RD, + &vm_reserv_freed, "Cumulative number of freed reservations"); static int sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS); @@ -236,9 +254,9 @@ static int sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_AR SYSCTL_OID(_vm_reserv, OID_AUTO, partpopq, CTLTYPE_STRING | CTLFLAG_RD, NULL, 0, sysctl_vm_reserv_partpopq, "A", "Partially populated reservation queues"); -static long vm_reserv_reclaimed; -SYSCTL_LONG(_vm_reserv, OID_AUTO, reclaimed, CTLFLAG_RD, - &vm_reserv_reclaimed, 0, "Cumulative number of reclaimed reservations"); +static counter_u64_t vm_reserv_reclaimed = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, reclaimed, CTLFLAG_RD, + &vm_reserv_reclaimed, "Cumulative number of reclaimed reservations"); /* * The object lock pool is used to synchronize the rvq. We can not use a @@ -313,12 +331,12 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS) for (level = -1; level <= VM_NRESERVLEVEL - 2; level++) { counter = 0; unused_pages = 0; - vm_domain_free_lock(VM_DOMAIN(domain)); + vm_reserv_domain_lock(domain); TAILQ_FOREACH(rv, &vm_rvq_partpop[domain], partpopq) { counter++; unused_pages += VM_LEVEL_0_NPAGES - rv->popcnt; } - vm_domain_free_unlock(VM_DOMAIN(domain)); + vm_reserv_domain_unlock(domain); sbuf_printf(&sbuf, "%6d, %7d, %6dK, %6d\n", domain, level, unused_pages * ((int)PAGE_SIZE / 1024), counter); @@ -337,6 +355,9 @@ vm_reserv_remove(vm_reserv_t rv) { vm_object_t object; + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); KASSERT(rv->object != NULL, ("vm_reserv_remove: reserv %p is free", rv)); KASSERT(!rv->inpartpopq, @@ -356,6 +377,11 @@ vm_reserv_insert(vm_reserv_t rv, vm_object_t object, v { int i; + vm_reserv_assert_locked(rv); + CTR6(KTR_VM, + "%s: rv %p(%p) object %p new %p popcnt %d", + __FUNCTION__, rv, rv->pages, rv->object, object, + rv->popcnt); KASSERT(rv->object == NULL, ("vm_reserv_insert: reserv %p isn't free", rv)); KASSERT(rv->popcnt == 0, @@ -377,14 +403,15 @@ vm_reserv_insert(vm_reserv_t rv, vm_object_t object, v * becomes zero, the reservation is destroyed. Additionally, moves the * reservation to the tail of the partially populated reservation queue if the * population count is non-zero. - * - * The free page queue lock must be held. */ static void vm_reserv_depopulate(vm_reserv_t rv, int index) { + struct vm_domain *vmd; - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); KASSERT(rv->object != NULL, ("vm_reserv_depopulate: reserv %p is free", rv)); KASSERT(popmap_is_set(rv->popmap, index), @@ -395,10 +422,7 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, ("vm_reserv_depopulate: reserv %p's domain is corrupted %d", rv, rv->domain)); - if (rv->inpartpopq) { - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); - rv->inpartpopq = FALSE; - } else { + if (rv->popcnt == VM_LEVEL_0_NPAGES) { KASSERT(rv->pages->psind == 1, ("vm_reserv_depopulate: reserv %p is already demoted", rv)); @@ -406,14 +430,25 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) } popmap_clear(rv->popmap, index); rv->popcnt--; + vm_reserv_domain_lock(rv->domain); + if (rv->inpartpopq) { + TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + rv->inpartpopq = FALSE; + } + if (rv->popcnt != 0) { + rv->inpartpopq = TRUE; + TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); + } + vm_reserv_domain_unlock(rv->domain); + vmd = VM_DOMAIN(rv->domain); if (rv->popcnt == 0) { vm_reserv_remove(rv); + vm_domain_free_lock(vmd); vm_phys_free_pages(rv->pages, VM_LEVEL_0_ORDER); - vm_reserv_freed++; - } else { - rv->inpartpopq = TRUE; - TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); + vm_domain_free_unlock(vmd); + counter_u64_add(vm_reserv_freed, 1); } + vm_domain_freecnt_inc(vmd, 1); } /* @@ -484,7 +519,9 @@ static void vm_reserv_populate(vm_reserv_t rv, int index) { - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); KASSERT(rv->object != NULL, ("vm_reserv_populate: reserv %p is free", rv)); KASSERT(popmap_is_clear(rv->popmap, index), @@ -497,17 +534,23 @@ vm_reserv_populate(vm_reserv_t rv, int index) KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, ("vm_reserv_populate: reserv %p's domain is corrupted %d", rv, rv->domain)); + popmap_set(rv->popmap, index); + rv->popcnt++; + vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); rv->inpartpopq = FALSE; } - popmap_set(rv->popmap, index); - rv->popcnt++; if (rv->popcnt < VM_LEVEL_0_NPAGES) { rv->inpartpopq = TRUE; TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); - } else + } else { + KASSERT(rv->pages->psind == 0, + ("vm_reserv_populate: reserv %p is already promoted", + rv)); rv->pages->psind = 1; + } + vm_reserv_domain_unlock(rv->domain); } /* @@ -572,31 +615,29 @@ vm_reserv_extend_contig(int req, vm_object_t object, v return (NULL); domain = rv->domain; vmd = VM_DOMAIN(domain); - vm_domain_free_lock(vmd); - if (rv->object != object || !vm_domain_available(vmd, req, npages)) { - m = NULL; + vm_reserv_lock(rv); + if (rv->object != object) goto out; - } m = &rv->pages[index]; pa = VM_PAGE_TO_PHYS(m); if (pa < low || pa + size > high || (pa & (alignment - 1)) != 0 || - ((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) { - m = NULL; + ((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) goto out; - } /* Handle vm_page_rename(m, new_object, ...). */ for (i = 0; i < npages; i++) { - if (popmap_is_set(rv->popmap, index + i)) { - m = NULL; + if (popmap_is_set(rv->popmap, index + i)) goto out; - } } + if (!vm_domain_allocate(vmd, req, npages)) + goto out; for (i = 0; i < npages; i++) vm_reserv_populate(rv, index + i); - vm_domain_freecnt_dec(vmd, npages); -out: - vm_domain_free_unlock(vmd); + vm_reserv_unlock(rv); return (m); + +out: + vm_reserv_unlock(rv); + return (NULL); } /* @@ -618,10 +659,11 @@ out: * The object and free page queue must be locked. */ vm_page_t -vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t pindex, int domain, +vm_reserv_alloc_contig(int req, vm_object_t object, vm_pindex_t pindex, int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, vm_page_t mpred) { + struct vm_domain *vmd; vm_paddr_t pa, size; vm_page_t m, m_ret, msucc; vm_pindex_t first, leftcap, rightcap; @@ -629,7 +671,6 @@ vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t u_long allocpages, maxpages, minpages; int i, index, n; - vm_domain_free_assert_locked(VM_DOMAIN(domain)); VM_OBJECT_ASSERT_WLOCKED(object); KASSERT(npages != 0, ("vm_reserv_alloc_contig: npages is 0")); @@ -737,9 +778,19 @@ vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t * specified index may not be the first page within the first new * reservation. */ - m = vm_phys_alloc_contig(domain, allocpages, low, high, ulmax(alignment, - VM_LEVEL_0_SIZE), boundary > VM_LEVEL_0_SIZE ? boundary : 0); - if (m == NULL) + m = NULL; + vmd = VM_DOMAIN(domain); + if (vm_domain_allocate(vmd, req, npages)) { + vm_domain_free_lock(vmd); + m = vm_phys_alloc_contig(domain, allocpages, low, high, + ulmax(alignment, VM_LEVEL_0_SIZE), + boundary > VM_LEVEL_0_SIZE ? boundary : 0); + vm_domain_free_unlock(vmd); + if (m == NULL) { + vm_domain_freecnt_inc(vmd, npages); + return (NULL); + } + } else return (NULL); KASSERT(vm_phys_domain(m) == domain, ("vm_reserv_alloc_contig: Page domain does not match requested.")); @@ -757,6 +808,7 @@ vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t KASSERT(rv->pages == m, ("vm_reserv_alloc_contig: reserv %p's pages is corrupted", rv)); + vm_reserv_lock(rv); vm_reserv_insert(rv, object, first); n = ulmin(VM_LEVEL_0_NPAGES - index, npages); for (i = 0; i < n; i++) @@ -766,6 +818,7 @@ vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t m_ret = &rv->pages[index]; index = 0; } + vm_reserv_unlock(rv); m += VM_LEVEL_0_NPAGES; first += VM_LEVEL_0_NPAGES; allocpages -= VM_LEVEL_0_NPAGES; @@ -813,18 +866,20 @@ vm_reserv_extend(int req, vm_object_t object, vm_pinde vmd = VM_DOMAIN(domain); index = VM_RESERV_INDEX(object, pindex); m = &rv->pages[index]; - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, 1) == 0 || - /* Handle reclaim race. */ - rv->object != object || + vm_reserv_lock(rv); + /* Handle reclaim race. */ + if (rv->object != object || /* Handle vm_page_rename(m, new_object, ...). */ - popmap_is_set(rv->popmap, index)) + popmap_is_set(rv->popmap, index)) { m = NULL; - if (m != NULL) { - vm_reserv_populate(rv, index); - vm_domain_freecnt_dec(vmd, 1); + goto out; } - vm_domain_free_unlock(vmd); + if (vm_domain_allocate(vmd, req, 1) == 0) + m = NULL; + else + vm_reserv_populate(rv, index); +out: + vm_reserv_unlock(rv); return (m); } @@ -840,15 +895,15 @@ vm_reserv_extend(int req, vm_object_t object, vm_pinde * The object and free page queue must be locked. */ vm_page_t -vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex, int domain, +vm_reserv_alloc_page(int req, vm_object_t object, vm_pindex_t pindex, int domain, vm_page_t mpred) { + struct vm_domain *vmd; vm_page_t m, msucc; vm_pindex_t first, leftcap, rightcap; vm_reserv_t rv; int index; - vm_domain_free_assert_locked(VM_DOMAIN(domain)); VM_OBJECT_ASSERT_WLOCKED(object); /* @@ -917,15 +972,28 @@ vm_reserv_alloc_page(vm_object_t object, vm_pindex_t p /* * Allocate and populate the new reservation. */ - m = vm_phys_alloc_pages(domain, VM_FREEPOOL_DEFAULT, VM_LEVEL_0_ORDER); - if (m == NULL) + m = NULL; + vmd = VM_DOMAIN(domain); + if (vm_domain_allocate(vmd, req, 1)) { + vm_domain_free_lock(vmd); + m = vm_phys_alloc_pages(domain, VM_FREEPOOL_DEFAULT, + VM_LEVEL_0_ORDER); + vm_domain_free_unlock(vmd); + if (m == NULL) { + vm_domain_freecnt_inc(vmd, 1); + return (NULL); + } + } else return (NULL); rv = vm_reserv_from_page(m); + vm_reserv_lock(rv); KASSERT(rv->pages == m, ("vm_reserv_alloc_page: reserv %p's pages is corrupted", rv)); vm_reserv_insert(rv, object, first); index = VM_RESERV_INDEX(object, pindex); vm_reserv_populate(rv, index); + vm_reserv_unlock(rv); + return (&rv->pages[index]); } @@ -942,7 +1010,9 @@ vm_reserv_break(vm_reserv_t rv) { int begin_zeroes, hi, i, lo; - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); vm_reserv_remove(rv); rv->pages->psind = 0; i = hi = 0; @@ -981,12 +1051,14 @@ vm_reserv_break(vm_reserv_t rv) if (i != NPOPMAP) /* Convert from ffsl() to ordinary bit numbering. */ hi--; + vm_domain_free_lock(VM_DOMAIN(rv->domain)); vm_phys_free_contig(&rv->pages[begin_zeroes], NBPOPMAP * i + hi - begin_zeroes); + vm_domain_free_unlock(VM_DOMAIN(rv->domain)); } while (i < NPOPMAP); KASSERT(rv->popcnt == 0, ("vm_reserv_break: reserv %p's popcnt is corrupted", rv)); - vm_reserv_broken++; + counter_u64_add(vm_reserv_broken, 1); } /* @@ -996,7 +1068,6 @@ void vm_reserv_break_all(vm_object_t object) { vm_reserv_t rv; - struct vm_domain *vmd; /* * This access of object->rvq is unsynchronized so that the @@ -1005,27 +1076,22 @@ vm_reserv_break_all(vm_object_t object) * lock prevents new additions, so we are guaranteed that when * it returns NULL the object is properly empty. */ - vmd = NULL; while ((rv = LIST_FIRST(&object->rvq)) != NULL) { - if (vmd != VM_DOMAIN(rv->domain)) { - if (vmd != NULL) - vm_domain_free_unlock(vmd); - vmd = VM_DOMAIN(rv->domain); - vm_domain_free_lock(vmd); - } + vm_reserv_lock(rv); /* Reclaim race. */ - if (rv->object != object) + if (rv->object != object) { + vm_reserv_unlock(rv); continue; - KASSERT(rv->object == object, - ("vm_reserv_break_all: reserv %p is corrupted", rv)); + } + vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); rv->inpartpopq = FALSE; } + vm_reserv_domain_unlock(rv->domain); vm_reserv_break(rv); + vm_reserv_unlock(rv); } - if (vmd != NULL) - vm_domain_free_unlock(vmd); } /* @@ -1038,13 +1104,21 @@ boolean_t vm_reserv_free_page(vm_page_t m) { vm_reserv_t rv; + boolean_t ret; rv = vm_reserv_from_page(m); if (rv->object == NULL) return (FALSE); - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); - vm_reserv_depopulate(rv, m - rv->pages); - return (TRUE); + vm_reserv_lock(rv); + /* Re-validate after lock. */ + if (rv->object != NULL) { + vm_reserv_depopulate(rv, m - rv->pages); + ret = TRUE; + } else + ret = FALSE; + vm_reserv_unlock(rv); + + return (ret); } /* @@ -1058,6 +1132,7 @@ vm_reserv_init(void) { vm_paddr_t paddr; struct vm_phys_seg *seg; + struct vm_reserv *rv; int i, segind; /* @@ -1068,15 +1143,22 @@ vm_reserv_init(void) seg = &vm_phys_segs[segind]; paddr = roundup2(seg->start, VM_LEVEL_0_SIZE); while (paddr + VM_LEVEL_0_SIZE <= seg->end) { - vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT].pages = - PHYS_TO_VM_PAGE(paddr); - vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT].domain = - seg->domain; + rv = &vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT]; + rv->pages = PHYS_TO_VM_PAGE(paddr); + rv->domain = seg->domain; + mtx_init(&rv->lock, "vm reserv", NULL, MTX_DEF); paddr += VM_LEVEL_0_SIZE; } } - for (i = 0; i < MAXMEMDOM; i++) + for (i = 0; i < MAXMEMDOM; i++) { + mtx_init(&vm_reserv_domain_locks[i], "VM reserv domain", NULL, + MTX_DEF); TAILQ_INIT(&vm_rvq_partpop[i]); + } + + for (i = 0; i < VM_RESERV_OBJ_LOCK_COUNT; i++) + mtx_init(&vm_reserv_object_mtx[i], "resv obj lock", NULL, + MTX_DEF); } /* @@ -1091,7 +1173,6 @@ vm_reserv_is_page_free(vm_page_t m) rv = vm_reserv_from_page(m); if (rv->object == NULL) return (false); - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); return (popmap_is_clear(rv->popmap, m - rv->pages)); } @@ -1131,7 +1212,10 @@ static void vm_reserv_reclaim(vm_reserv_t rv) { - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); + vm_reserv_domain_lock(rv->domain); KASSERT(rv->inpartpopq, ("vm_reserv_reclaim: reserv %p's inpartpopq is FALSE", rv)); KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, @@ -1139,8 +1223,9 @@ vm_reserv_reclaim(vm_reserv_t rv) rv, rv->domain)); TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); rv->inpartpopq = FALSE; + vm_reserv_domain_unlock(rv->domain); vm_reserv_break(rv); - vm_reserv_reclaimed++; + counter_u64_add(vm_reserv_reclaimed, 1); } /* @@ -1155,9 +1240,14 @@ vm_reserv_reclaim_inactive(int domain) { vm_reserv_t rv; - vm_domain_free_assert_locked(VM_DOMAIN(domain)); - if ((rv = TAILQ_FIRST(&vm_rvq_partpop[domain])) != NULL) { + while ((rv = TAILQ_FIRST(&vm_rvq_partpop[domain])) != NULL) { + vm_reserv_lock(rv); + if (rv != TAILQ_FIRST(&vm_rvq_partpop[domain])) { + vm_reserv_unlock(rv); + continue; + } vm_reserv_reclaim(rv); + vm_reserv_unlock(rv); return (TRUE); } return (FALSE); @@ -1176,14 +1266,16 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm vm_paddr_t high, u_long alignment, vm_paddr_t boundary) { vm_paddr_t pa, size; - vm_reserv_t rv; + vm_reserv_t rv, rvn; int hi, i, lo, low_index, next_free; - vm_domain_free_assert_locked(VM_DOMAIN(domain)); if (npages > VM_LEVEL_0_NPAGES - 1) return (FALSE); size = npages << PAGE_SHIFT; - TAILQ_FOREACH(rv, &vm_rvq_partpop[domain], partpopq) { + vm_reserv_domain_lock(domain); +again: + for (rv = TAILQ_FIRST(&vm_rvq_partpop[domain]); rv != NULL; rv = rvn) { + rvn = TAILQ_NEXT(rv, partpopq); pa = VM_PAGE_TO_PHYS(&rv->pages[VM_LEVEL_0_NPAGES - 1]); if (pa + PAGE_SIZE - size < low) { /* This entire reservation is too low; go to next. */ @@ -1194,6 +1286,17 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm /* This entire reservation is too high; go to next. */ continue; } + if (vm_reserv_trylock(rv) == 0) { + vm_reserv_domain_unlock(domain); + vm_reserv_lock(rv); + if (!rv->inpartpopq) { + vm_reserv_domain_lock(domain); + if (!rvn->inpartpopq) + goto again; + continue; + } + } else + vm_reserv_domain_unlock(domain); if (pa < low) { /* Start the search for free pages at "low". */ low_index = (low + PAGE_MASK - pa) >> PAGE_SHIFT; @@ -1239,6 +1342,7 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm if ((NBPOPMAP * i - next_free) * PAGE_SIZE >= size) { vm_reserv_reclaim(rv); + vm_reserv_unlock(rv); return (TRUE); } hi = ffsl(rv->popmap[i]); @@ -1249,10 +1353,16 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm if ((NBPOPMAP * i + hi - next_free) * PAGE_SIZE >= size) { vm_reserv_reclaim(rv); + vm_reserv_unlock(rv); return (TRUE); } } while (i < NPOPMAP); + vm_reserv_unlock(rv); + vm_reserv_domain_lock(domain); + if (rvn != NULL && !rvn->inpartpopq) + goto again; } + vm_reserv_domain_unlock(domain); return (FALSE); } @@ -1270,7 +1380,11 @@ vm_reserv_rename(vm_page_t m, vm_object_t new_object, VM_OBJECT_ASSERT_WLOCKED(new_object); rv = vm_reserv_from_page(m); if (rv->object == old_object) { - vm_domain_free_lock(VM_DOMAIN(rv->domain)); + vm_reserv_lock(rv); + CTR6(KTR_VM, + "%s: rv %p object %p new %p popcnt %d inpartpop %d", *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Mar 22 20:21:06 2018 Return-Path: Delivered-To: svn-src-head@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 730CAF6835E; Thu, 22 Mar 2018 20:21:06 +0000 (UTC) (envelope-from sbruno@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 2432A69746; Thu, 22 Mar 2018 20:21:06 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F2FA1609D; Thu, 22 Mar 2018 20:21:06 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MKL6Pa090789; Thu, 22 Mar 2018 20:21:06 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MKL5Aa090788; Thu, 22 Mar 2018 20:21:05 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201803222021.w2MKL5Aa090788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 22 Mar 2018 20:21:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331373 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 331373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 20:21:06 -0000 Author: sbruno Date: Thu Mar 22 20:21:05 2018 New Revision: 331373 URL: https://svnweb.freebsd.org/changeset/base/331373 Log: Improve write locking in ip6_ctloutput() with macros. Submitted by: Jason Eggleston Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14620 Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Thu Mar 22 19:49:37 2018 (r331372) +++ head/sys/netinet6/ip6_output.c Thu Mar 22 20:21:05 2018 (r331373) @@ -1596,23 +1596,34 @@ do { \ } while (/*CONSTCOND*/ 0) #define OPTBIT(bit) (in6p->inp_flags & (bit) ? 1 : 0) -#define OPTSET2(bit, val) do { \ - INP_WLOCK(in6p); \ +#define OPTSET2_N(bit, val) do { \ if (val) \ in6p->inp_flags2 |= bit; \ else \ in6p->inp_flags2 &= ~bit; \ +} while (0) +#define OPTSET2(bit, val) do { \ + INP_WLOCK(in6p); \ + OPTSET2_N(bit, val); \ INP_WUNLOCK(in6p); \ } while (0) #define OPTBIT2(bit) (in6p->inp_flags2 & (bit) ? 1 : 0) +#define OPTSET2292_EXCLUSIVE(bit) \ +do { \ + INP_WLOCK(in6p); \ + if (OPTBIT(IN6P_RFC2292)) { \ + error = EINVAL; \ + } else { \ + if (optval) \ + in6p->inp_flags |= (bit); \ + else \ + in6p->inp_flags &= ~(bit); \ + } \ + INP_WUNLOCK(in6p); \ +} while (/*CONSTCOND*/ 0) case IPV6_RECVPKTINFO: - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - OPTSET(IN6P_PKTINFO); + OPTSET2292_EXCLUSIVE(IN6P_PKTINFO); break; case IPV6_HOPLIMIT: @@ -1633,48 +1644,23 @@ do { \ } case IPV6_RECVHOPLIMIT: - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - OPTSET(IN6P_HOPLIMIT); + OPTSET2292_EXCLUSIVE(IN6P_HOPLIMIT); break; case IPV6_RECVHOPOPTS: - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - OPTSET(IN6P_HOPOPTS); + OPTSET2292_EXCLUSIVE(IN6P_HOPOPTS); break; case IPV6_RECVDSTOPTS: - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - OPTSET(IN6P_DSTOPTS); + OPTSET2292_EXCLUSIVE(IN6P_DSTOPTS); break; case IPV6_RECVRTHDRDSTOPTS: - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - OPTSET(IN6P_RTHDRDSTOPTS); + OPTSET2292_EXCLUSIVE(IN6P_RTHDRDSTOPTS); break; case IPV6_RECVRTHDR: - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - OPTSET(IN6P_RTHDR); + OPTSET2292_EXCLUSIVE(IN6P_RTHDR); break; case IPV6_RECVPATHMTU: @@ -1717,11 +1703,7 @@ do { \ break; case IPV6_RECVTCLASS: /* cannot mix with RFC2292 XXX */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - OPTSET(IN6P_TCLASS); + OPTSET2292_EXCLUSIVE(IN6P_TCLASS); break; case IPV6_AUTOFLOWLABEL: OPTSET(IN6P_AUTOFLOWLABEL); @@ -1741,8 +1723,10 @@ do { \ case IPV6_RSS_LISTEN_BUCKET: if ((optval >= 0) && (optval < rss_getnumbuckets())) { + INP_WLOCK(in6p); in6p->inp_rss_listen_bucket = optval; - OPTSET2(INP_RSS_BUCKET_SET, 1); + OPTSET2_N(INP_RSS_BUCKET_SET, 1); + INP_WUNLOCK(in6p); } else { error = EINVAL; } From owner-svn-src-head@freebsd.org Thu Mar 22 20:44:26 2018 Return-Path: Delivered-To: svn-src-head@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 47C2CF6A1C6; Thu, 22 Mar 2018 20:44:26 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf0-f41.google.com (mail-lf0-f41.google.com [209.85.215.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ABF6C6A889; Thu, 22 Mar 2018 20:44:25 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf0-f41.google.com with SMTP id l4-v6so10854755lfg.12; Thu, 22 Mar 2018 13:44:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=WDlPqANqI77ugioLd4k5c/YOghLJFg4m9EZTINy94pw=; b=KF6xV48MYPTPs3CAfa+BwTwrdVHRrVOMLoEgfDdu2YNdjZFyzi88c0M4XwqX7MjKbp 1g9xv8Kj41yl4Nv3z6I4xbNtRvfB2Rt2b/bqrLr4sb0IDoXKdMBDCUNdrA9aaZefIhpW lbLENfe4sl5k3PzOY8+obQitou36vWEePDiq6g6OqQgARf3HFvMERLwXd4824Xf4EUTP fbdZKbYyS9yCqgYMi8r3ZEiBz7Yj/3QndUwWuKsjRSjdff4efJuHadszP/PvNr6/F5in qTYAZVst52JnOcunvaXOHUKGQ0GI0M/WnQtnRHHpvHWRBPJgOZgTusQ6emWdQk79Hizm 6L7g== X-Gm-Message-State: AElRT7Gtl9XhIdjhYofq3hN8TY9myqwFcf8xWNJ96bcFvHSot6JDj4xn W9pRihrFXB7TRmh6wry2wekoxRFch0I= X-Google-Smtp-Source: AG47ELuuFjNXfiRRHfdSyjzq/ZJUk3Jaim2yA19Iq0PC+kLxAyB4LE1b/RjmQ51XDJuBMMFALJ+zBA== X-Received: by 2002:a19:1d12:: with SMTP id d18-v6mr17026281lfd.128.1521751457978; Thu, 22 Mar 2018 13:44:17 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id 94-v6sm1831371lft.85.2018.03.22.13.44.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 13:44:17 -0700 (PDT) Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat To: Jonathan Looney , Ruslan Bukin Cc: "Jonathan T. Looney" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> <20180322142225.GA5139@bsdpad.com> From: Andriy Gapon Message-ID: <27fbc131-990b-0b4b-1a90-ab84c2162e0e@FreeBSD.org> Date: Thu, 22 Mar 2018 22:44:15 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 20:44:26 -0000 On 22/03/2018 17:39, Jonathan Looney wrote: > A tinderbox build didn't complain about atomic_fetchadd_64, so I assume it is OK. > > Yes, this can be made optional, if there is a need for that. > FWWI, TARGET=powerpc TARGET_ARCH=powerpc build failed for me. cc1: warnings being treated as errors /usr/devel/svn/head/sys/netinet/tcp_log_buf.c: In function 'tcp_log_selectauto': /usr/devel/svn/head/sys/netinet/tcp_log_buf.c:286: warning: implicit declaration of function 'atomic_fetchadd_64' /usr/devel/svn/head/sys/netinet/tcp_log_buf.c:286: warning: nested extern declaration of 'atomic_fetchadd_64' [-Wnested-externs] -- Andriy Gapon From owner-svn-src-head@freebsd.org Thu Mar 22 20:44:28 2018 Return-Path: Delivered-To: svn-src-head@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 19282F6A1D4; Thu, 22 Mar 2018 20:44:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 C0B8D6A88D; Thu, 22 Mar 2018 20:44:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A17D016423; Thu, 22 Mar 2018 20:44:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MKiRs4003854; Thu, 22 Mar 2018 20:44:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MKiRDZ003853; Thu, 22 Mar 2018 20:44:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803222044.w2MKiRDZ003853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 22 Mar 2018 20:44:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331374 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 331374 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 20:44:28 -0000 Author: kib Date: Thu Mar 22 20:44:27 2018 New Revision: 331374 URL: https://svnweb.freebsd.org/changeset/base/331374 Log: Fixes for ptrace(PT_GETXSTATE_INFO) related to the padding in struct ptrace_xstate_info). struct ptrace_xstate_info has 64bit member but ends up with 32bit one. As result, on amd64 there is a 32bit padding at the end, but not on i386. We must clear the padding before doing the copyout. For compat32 case, we must copyout the structure which does not have the padding at the end. The later fixes 32bit gdb display of the YMM registers when running on amd64 kernel. Reported by: Vlad Tsyrklevich Reviewed by: brooks (previous version) Sponsored by: The FreeBSD Foundation admbugs: 765 MFC after: 1 week Differential revision: https://reviews.freebsd.org/D14794 Modified: head/sys/amd64/amd64/ptrace_machdep.c Modified: head/sys/amd64/amd64/ptrace_machdep.c ============================================================================== --- head/sys/amd64/amd64/ptrace_machdep.c Thu Mar 22 20:21:05 2018 (r331373) +++ head/sys/amd64/amd64/ptrace_machdep.c Thu Mar 22 20:44:27 2018 (r331374) @@ -45,10 +45,20 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef COMPAT_FREEBSD32 +struct ptrace_xstate_info32 { + uint32_t xsave_mask1, xsave_mask2; + uint32_t xsave_len; +}; +#endif + static int cpu_ptrace_xstate(struct thread *td, int req, void *addr, int data) { struct ptrace_xstate_info info; +#ifdef COMPAT_FREEBSD32 + struct ptrace_xstate_info32 info32; +#endif char *savefpu; int error; @@ -78,13 +88,28 @@ cpu_ptrace_xstate(struct thread *td, int req, void *ad break; case PT_GETXSTATE_INFO: - if (data != sizeof(info)) { - error = EINVAL; - break; +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) { + if (data != sizeof(info32)) { + error = EINVAL; + } else { + info32.xsave_len = cpu_max_ext_state_size; + info32.xsave_mask1 = xsave_mask; + info32.xsave_mask2 = xsave_mask >> 32; + error = copyout(&info32, addr, data); + } + } else +#endif + { + if (data != sizeof(info)) { + error = EINVAL; + } else { + bzero(&info, sizeof(info)); + info.xsave_len = cpu_max_ext_state_size; + info.xsave_mask = xsave_mask; + error = copyout(&info, addr, data); + } } - info.xsave_len = cpu_max_ext_state_size; - info.xsave_mask = xsave_mask; - error = copyout(&info, addr, data); break; case PT_GETXSTATE: From owner-svn-src-head@freebsd.org Thu Mar 22 20:47:26 2018 Return-Path: Delivered-To: svn-src-head@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 D38F8F6A663; Thu, 22 Mar 2018 20:47:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 774996AC32; Thu, 22 Mar 2018 20:47:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 70A9916437; Thu, 22 Mar 2018 20:47:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MKlPHj004000; Thu, 22 Mar 2018 20:47:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MKlPrQ003999; Thu, 22 Mar 2018 20:47:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803222047.w2MKlPrQ003999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 22 Mar 2018 20:47:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331375 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331375 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 20:47:26 -0000 Author: kib Date: Thu Mar 22 20:47:25 2018 New Revision: 331375 URL: https://svnweb.freebsd.org/changeset/base/331375 Log: Do not send signals to init directly from shutdown_nice(9), do it from the task context. shutdown_nice() is used from the fast interrupt handlers, mostly for console drivers, where we cannot lock blockable locks. Schedule the task in the fast queue to send the signal from the proper context. Reviewed by: imp Discussed with: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Thu Mar 22 20:44:27 2018 (r331374) +++ head/sys/kern/kern_shutdown.c Thu Mar 22 20:47:25 2018 (r331375) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -276,6 +277,28 @@ sys_reboot(struct thread *td, struct reboot_args *uap) return (error); } +static void +shutdown_nice_task_fn(void *arg, int pending __unused) +{ + int howto; + + howto = (uintptr_t)arg; + /* Send a signal to init(8) and have it shutdown the world. */ + PROC_LOCK(initproc); + if (howto & RB_POWEROFF) + kern_psignal(initproc, SIGUSR2); + else if (howto & RB_POWERCYCLE) + kern_psignal(initproc, SIGWINCH); + else if (howto & RB_HALT) + kern_psignal(initproc, SIGUSR1); + else + kern_psignal(initproc, SIGINT); + PROC_UNLOCK(initproc); +} + +static struct task shutdown_nice_task = TASK_INITIALIZER(0, + &shutdown_nice_task_fn, NULL); + /* * Called by events that want to shut down.. e.g on a PC */ @@ -283,20 +306,14 @@ void shutdown_nice(int howto) { - if (initproc != NULL) { - /* Send a signal to init(8) and have it shutdown the world. */ - PROC_LOCK(initproc); - if (howto & RB_POWEROFF) - kern_psignal(initproc, SIGUSR2); - else if (howto & RB_POWERCYCLE) - kern_psignal(initproc, SIGWINCH); - else if (howto & RB_HALT) - kern_psignal(initproc, SIGUSR1); - else - kern_psignal(initproc, SIGINT); - PROC_UNLOCK(initproc); + if (initproc != NULL && !SCHEDULER_STOPPED()) { + shutdown_nice_task.ta_context = (void *)(uintptr_t)howto; + taskqueue_enqueue(taskqueue_fast, &shutdown_nice_task); } else { - /* No init(8) running, so simply reboot. */ + /* + * No init(8) running, or scheduler would not allow it + * to run, so simply reboot. + */ kern_reboot(howto | RB_NOSYNC); } } From owner-svn-src-head@freebsd.org Thu Mar 22 21:06:02 2018 Return-Path: Delivered-To: svn-src-head@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 B8573F6C0D2; Thu, 22 Mar 2018 21:06:02 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lf0-x22e.google.com (mail-lf0-x22e.google.com [IPv6:2a00:1450:4010:c07::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F9CD6BB2D; Thu, 22 Mar 2018 21:06:02 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lf0-x22e.google.com with SMTP id z143-v6so15266186lff.3; Thu, 22 Mar 2018 14:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=/bzaCmnkkanJC2WkgWLAxsgS/KtHmZFKmJ1pypjyGTc=; b=lUKshBA8MaYz2RQtuLQICdzPlK6Dtvo7QIuBIWQNS3pj9hIgq6RizIwonJuWCxCROi +3Ior6aGJS/x8euIa0DHpoxWkfjUtsIiNJUHNETExY6aKaPqorcHRi+AuLB4JwdCcbmo A93sJzj58gxIFZvsXFw18PSJYj/frAIs7GSxxOtprwKtJMW99XfqqeyFRypDjwFLeE4+ oLeF7CZGWGOB1FINTw841KWcNQJOg/b9neyeN4M0dzzjKAJtaNkWuqnygmSl/u2U61a/ Y+73LxldLNaLsBfvEnQERGO4ngWMg77sY6vAHeNjAmsn1FdL9t+zfsF6kOG+V53AM9jt FOPQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alumni-cwru-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=/bzaCmnkkanJC2WkgWLAxsgS/KtHmZFKmJ1pypjyGTc=; b=DRWu3+QoEGRwm1XZBHcNWWuMiqLdFSUkPks6lf6kqyNmzV8/AdJRQ5P1gxP93Wwpbe 5ur4itFBjnMCUEWXl4eujDaHWDQvVTsYBrVhXxCPhQcFkWd7GNkqClGtwM1KFc+X+Hu4 sqD5JOkDBqqqVonuK7n4TIafpmyPkWUEolCxat9hJ1psDJ/yXlmxUFJO8G+3BvX1rC0X IVAa4iJrbw3i4+g5E1RjcPCgrx0taeVKjTkkw1YrMTKj9rPWdt1d+HNZg3PLmYxZQzB7 SoGwkw5C6iQUQ6jOHfXg0EJfwHuYKHTyGB491On3O1xKoxJnjunzyBvP2kGRdJq2RBA7 ecuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=/bzaCmnkkanJC2WkgWLAxsgS/KtHmZFKmJ1pypjyGTc=; b=N3L2pXCzpjZUREQ+MFQVsQR+J6ZSS/tNlr+oh930DMNZffkiUpUxW+Bigk4SHKd+vG zevc3jlIFUcp7ZsY/YHP94HpJCUXGWyTd3TvsbWpsqvYd5383uF4qqvy2jKvGlnoJurP HX5BB7hwA8cWiQgdcZ1aNyp06CKBydWDATqyd1/NB1iMom0gYC22K7Wvo0cL5/FiwOgY S8gEOIptOwcAcUEERMoVpPYXqBuUrQz8gj3wxcJN+YCT/rUDw/emW2J3e/htFAwqy0+Q 3FM5s9kl6DNRUh7niNLAEtq+HoKTXOmG9qFvQcVFnbfrriE9ncRIuSp24+AGsNTM5dyX avUg== X-Gm-Message-State: AElRT7FEAz4gWHZnda4sRDF5M8v8HwgyLKNQcOV2Y/Yfw/NQW+dH0zNF 71witZB5t/wYN/yMcIP8EMVzzOisf1xLTu5UCEQ= X-Google-Smtp-Source: AG47ELukVoDTBzmNfAOJaJDwvEE7hd1Xd/l9SEICFrLztZzBjECc/kgSkgIWsk6+zcaxGtAAZxcGpEC73kNwXfk4N1E= X-Received: by 2002:a19:d50e:: with SMTP id m14-v6mr12449145lfg.5.1521752760425; Thu, 22 Mar 2018 14:06:00 -0700 (PDT) MIME-Version: 1.0 Sender: chmeeedalf@gmail.com Received: by 10.46.85.13 with HTTP; Thu, 22 Mar 2018 14:05:59 -0700 (PDT) In-Reply-To: <27fbc131-990b-0b4b-1a90-ab84c2162e0e@FreeBSD.org> References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> <20180322142225.GA5139@bsdpad.com> <27fbc131-990b-0b4b-1a90-ab84c2162e0e@FreeBSD.org> From: Justin Hibbits Date: Thu, 22 Mar 2018 16:05:59 -0500 X-Google-Sender-Auth: bu-bEA5kFeU8EjRXKq62tEmPc0c Message-ID: Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat To: Andriy Gapon Cc: Jonathan Looney , Ruslan Bukin , "Jonathan T. Looney" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 21:06:03 -0000 On Thu, Mar 22, 2018 at 3:44 PM, Andriy Gapon wrote: > On 22/03/2018 17:39, Jonathan Looney wrote: >> A tinderbox build didn't complain about atomic_fetchadd_64, so I assume it is OK. >> >> Yes, this can be made optional, if there is a need for that. >> > > FWWI, TARGET=powerpc TARGET_ARCH=powerpc build failed for me. > > cc1: warnings being treated as errors > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c: In function 'tcp_log_selectauto': > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c:286: warning: implicit declaration > of function 'atomic_fetchadd_64' > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c:286: warning: nested extern > declaration of 'atomic_fetchadd_64' [-Wnested-externs] > > -- > Andriy Gapon > mips complains, too. Check out https://ci.freebsd.org/tinderbox . - Justin From owner-svn-src-head@freebsd.org Thu Mar 22 21:18:35 2018 Return-Path: Delivered-To: svn-src-head@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 64897F6D0B0; Thu, 22 Mar 2018 21:18:35 +0000 (UTC) (envelope-from sbruno@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 164236C3B4; Thu, 22 Mar 2018 21:18:35 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1133D168D1; Thu, 22 Mar 2018 21:18:35 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MLIYeK019125; Thu, 22 Mar 2018 21:18:34 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MLIYIm019124; Thu, 22 Mar 2018 21:18:34 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201803222118.w2MLIYIm019124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 22 Mar 2018 21:18:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331376 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 331376 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 21:18:35 -0000 Author: sbruno Date: Thu Mar 22 21:18:34 2018 New Revision: 331376 URL: https://svnweb.freebsd.org/changeset/base/331376 Log: Handle locking and memory safety for IPV6_PATHMTU in ip6_ctloutput(). Submitted by: Jason Eggleston Reviewed by: ae Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14622 Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Thu Mar 22 20:47:25 2018 (r331375) +++ head/sys/netinet6/ip6_output.c Thu Mar 22 21:18:34 2018 (r331376) @@ -2053,6 +2053,7 @@ do { \ { u_long pmtu = 0; struct ip6_mtuinfo mtuinfo; + struct in6_addr addr; if (!(so->so_state & SS_ISCONNECTED)) return (ENOTCONN); @@ -2060,9 +2061,14 @@ do { \ * XXX: we dot not consider the case of source * routing, or optional information to specify * the outgoing interface. + * Copy faddr out of in6p to avoid holding lock + * on inp during route lookup. */ + INP_RLOCK(in6p); + bcopy(&in6p->in6p_faddr, &addr, sizeof(addr)); + INP_RUNLOCK(in6p); error = ip6_getpmtu_ctl(so->so_fibnum, - &in6p->in6p_faddr, &pmtu); + &addr, &pmtu); if (error) break; if (pmtu > IPV6_MAXPACKET) From owner-svn-src-head@freebsd.org Thu Mar 22 21:25:34 2018 Return-Path: Delivered-To: svn-src-head@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 484DBF6D99E; Thu, 22 Mar 2018 21:25:34 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lf0-x22a.google.com (mail-lf0-x22a.google.com [IPv6:2a00:1450:4010:c07::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8BE746C98D; Thu, 22 Mar 2018 21:25:33 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lf0-x22a.google.com with SMTP id m16-v6so11588686lfc.4; Thu, 22 Mar 2018 14:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=eQFfyfBmXT6GMMChB+lKHDRFEjtCO7+BSCfjUGT11gQ=; b=dCTFzcYAWBlh5KFSliE6F/kmzRf+zl+Ez+vwf28Bj+6ylk9PM8wPoQ5Oj8+c4TI5g4 PNvkQpZC0ftM7u+s4YgdPV6ntrbAu/xCK/4gEFmWD/S6tJ3PaBa8ISXReRE2kag6N/OH fXEJibi8KstFbY5pq6fh1C8oir9BeI2PaQEe6G8jk3zCi4kDkaUYw/pVVFwPbJuDsq8r pBSPpjQ/esVHVoIK+DdmKJmDpDRsnqkBXedfawK3OLlDpvJ2+SfbC2VWdrH9GfuXrVnF C4YFceDiQK4hQzwa0LweouvIm+dcaMkXAphoWmiK/RJi+MCGht54KVhYbS1krClr4Jg6 CEKA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alumni-cwru-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=eQFfyfBmXT6GMMChB+lKHDRFEjtCO7+BSCfjUGT11gQ=; b=QAP89QRxSV0FaJw2PMVT7n3reDkNNBHFtppCrsc9KRX/Ryumc8NKV5O3+fV2iyXfL2 nGfrr5texE3pxa91xuAmZK5UO7dfg3ny8KwN0HoS5p/zZLEgsBZxJP/O6sOqne2AWXEY OyyIVpDX1Qw41Q3LpUpcva3h4ouo6rf36XHRJ+bxPePqzkomqswhXV94YQqmzgnbShrm itFDb+3mg8HtBqMbXpdApqCw2rc2BY1D3WA00eNZSpuHfqVeamyTZCMXEZXdKqYzgomz g5Wy2n80m0reBtsPo13LURxEPfwDBRiGAhVC/fmi+9s4RKld3dvyRkSPVxkYOHZhLZMl gIOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=eQFfyfBmXT6GMMChB+lKHDRFEjtCO7+BSCfjUGT11gQ=; b=Tcdk5O0rPMMcCsRMcjfn+et9AmOsNdhX3OTStUZEqXszPbTUG+MWNgznsjDd2LkEri 8eC5/s5W6VoHVifknHAd1uYXd/hSh4l0+SSvVKTjuh+U6bMxhZ2+vjhzp5AYLRa0aIDr PB1Rs8s4Lo6149eeCuzdHnFSU1DI/OuguOpUz6Wbn71c//Fd5xtzZ4ZE1Xm2r6ZSPSF7 DJEWroj3JggAEPi8cXM8OHoGiRhQe/8DhCsBGNk4olvM1yA8KXJz++vCCLci6W040Unl YfbxLE6LKvMlGgRrRYSvmPn78+1TSNUZU68Lz6yc+zjvElQKg3GAkpfz5VtLfa5Y0iZa CsMw== X-Gm-Message-State: AElRT7FhEcnOmuKpOSI357IGEWcVCsG2aldMixoaFUoF69R4R4Jt7lmY I7vXaljS5iXSF7JR/rk4+g9Eg5TpNWJSLwtN+rb90Q== X-Google-Smtp-Source: AG47ELvC0Rz8U3R32LPwLd2RGlo4ZRZURz4bA5AGFGR+2zR1ZwpfodIE4YuQ6/34MgYHYaB6H3NokNWBCCtpz4doeLE= X-Received: by 10.46.60.23 with SMTP id j23mr17175110lja.18.1521753931414; Thu, 22 Mar 2018 14:25:31 -0700 (PDT) MIME-Version: 1.0 Sender: chmeeedalf@gmail.com Received: by 10.46.85.13 with HTTP; Thu, 22 Mar 2018 14:25:30 -0700 (PDT) In-Reply-To: <201803221921.w2MJLBi7058560@repo.freebsd.org> References: <201803221921.w2MJLBi7058560@repo.freebsd.org> From: Justin Hibbits Date: Thu, 22 Mar 2018 16:25:30 -0500 X-Google-Sender-Auth: cNNp4cKer7YtozdbquVcyAogTe4 Message-ID: Subject: Re: svn commit: r331369 - head/sys/vm To: Jeff Roberson Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 21:25:34 -0000 This broke gcc builds. On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: > Author: jeff > Date: Thu Mar 22 19:21:11 2018 > New Revision: 331369 > URL: https://svnweb.freebsd.org/changeset/base/331369 > > Log: > Lock reservations with a dedicated lock in each reservation. Protect the > vmd_free_count with atomics. > > This allows us to allocate and free from reservations without the free lock > except where a superpage is allocated from the physical layer, which is > roughly 1/512 of the operations on amd64. > > Use the counter api to eliminate cache conention on counters. > > Reviewed by: markj > Tested by: pho > Sponsored by: Netflix, Dell/EMC Isilon > Differential Revision: https://reviews.freebsd.org/D14707 > > Modified: > head/sys/vm/vm_page.c > head/sys/vm/vm_pagequeue.h > head/sys/vm/vm_reserv.c > head/sys/vm/vm_reserv.h > > Modified: head/sys/vm/vm_page.c > ============================================================================== > --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) > +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369) > @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; > static void vm_page_alloc_check(vm_page_t m); > static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); > static void vm_page_enqueue(uint8_t queue, vm_page_t m); > -static void vm_page_free_phys(struct vm_domain *vmd, vm_page_t m); > static void vm_page_init(void *dummy); > static int vm_page_insert_after(vm_page_t m, vm_object_t object, > vm_pindex_t pindex, vm_page_t mpred); > @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_t pi > * for the request class and false otherwise. > */ > int > -vm_domain_available(struct vm_domain *vmd, int req, int npages) > +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) > { > + u_int limit, old, new; > > - vm_domain_free_assert_locked(vmd); > req = req & VM_ALLOC_CLASS_MASK; > > /* > @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int req, in > */ > if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) > req = VM_ALLOC_SYSTEM; > + if (req == VM_ALLOC_INTERRUPT) > + limit = 0; > + else if (req == VM_ALLOC_SYSTEM) > + limit = vmd->vmd_interrupt_free_min; > + else > + limit = vmd->vmd_free_reserved; > > - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || > - (req == VM_ALLOC_SYSTEM && > - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) || > - (req == VM_ALLOC_INTERRUPT && > - vmd->vmd_free_count >= npages)) > - return (1); > + /* > + * Attempt to reserve the pages. Fail if we're below the limit. > + */ > + limit += npages; > + old = vmd->vmd_free_count; > + do { > + if (old < limit) > + return (0); > + new = old - npages; > + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == 0); > > - return (0); > + /* Wake the page daemon if we've crossed the threshold. */ > + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) > + pagedaemon_wakeup(vmd->vmd_domain); > + > + /* Only update bitsets on transitions. */ > + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || > + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) > + vm_domain_set(vmd); > + > + return (1); > } > > vm_page_t > @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind > again: > m = NULL; > #if VM_NRESERVLEVEL > 0 > + /* > + * Can we allocate the page from a reservation? > + */ > if (vm_object_reserv(object) && > - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) > - != NULL) { > + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) != NULL || > + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred)) != NULL)) { > domain = vm_phys_domain(m); > vmd = VM_DOMAIN(domain); > goto found; > } > #endif > vmd = VM_DOMAIN(domain); > - vm_domain_free_lock(vmd); > - if (vm_domain_available(vmd, req, 1)) { > + if (vm_domain_allocate(vmd, req, 1)) { > /* > - * Can we allocate the page from a reservation? > + * If not, allocate it from the free page queues. > */ > + vm_domain_free_lock(vmd); > + m = vm_phys_alloc_pages(domain, object != NULL ? > + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > + vm_domain_free_unlock(vmd); > + if (m == NULL) { > + vm_domain_freecnt_inc(vmd, 1); > #if VM_NRESERVLEVEL > 0 > - if (!vm_object_reserv(object) || > - (m = vm_reserv_alloc_page(object, pindex, > - domain, mpred)) == NULL) > + if (vm_reserv_reclaim_inactive(domain)) > + goto again; > #endif > - { > - /* > - * If not, allocate it from the free page queues. > - */ > - m = vm_phys_alloc_pages(domain, object != NULL ? > - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > -#if VM_NRESERVLEVEL > 0 > - if (m == NULL && vm_reserv_reclaim_inactive(domain)) { > - m = vm_phys_alloc_pages(domain, > - object != NULL ? > - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, > - 0); > - } > -#endif > } > } > - if (m != NULL) > - vm_domain_freecnt_dec(vmd, 1); > - vm_domain_free_unlock(vmd); > if (m == NULL) { > /* > * Not allocatable, give up. > @@ -1775,9 +1783,7 @@ again: > */ > KASSERT(m != NULL, ("missing page")); > > -#if VM_NRESERVLEVEL > 0 > found: > -#endif 'found' is now declared, but unused on powerpc64. - Justin From owner-svn-src-head@freebsd.org Thu Mar 22 22:13:47 2018 Return-Path: Delivered-To: svn-src-head@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 1A120F4D583; Thu, 22 Mar 2018 22:13:47 +0000 (UTC) (envelope-from landonf@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 B97626E7A8; Thu, 22 Mar 2018 22:13:46 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B19A11726B; Thu, 22 Mar 2018 22:13:46 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MMDk9w048459; Thu, 22 Mar 2018 22:13:46 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MMDk07048458; Thu, 22 Mar 2018 22:13:46 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201803222213.w2MMDk07048458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Thu, 22 Mar 2018 22:13:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331378 - head/sys/dev/bhnd/nvram X-SVN-Group: head X-SVN-Commit-Author: landonf X-SVN-Commit-Paths: head/sys/dev/bhnd/nvram X-SVN-Commit-Revision: 331378 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 22:13:47 -0000 Author: landonf Date: Thu Mar 22 22:13:46 2018 New Revision: 331378 URL: https://svnweb.freebsd.org/changeset/base/331378 Log: Add missing NULL checks when calling malloc(M_NOWAIT) in bhnd_nv_strdup/bhnd_nv_strndup. If malloc(9) failed during initial bhnd(4) attach, while allocating the root NVRAM path string ("/"), the returned NULL pointer would be passed as the destination to memcpy(). Reported by: Ilja Van Sprundel Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_private.h Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_private.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_private.h Thu Mar 22 21:57:10 2018 (r331377) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_private.h Thu Mar 22 22:13:46 2018 (r331378) @@ -91,6 +91,9 @@ bhnd_nv_strdup(const char *str) len = strlen(str); dest = malloc(len + 1, M_BHND_NVRAM, M_NOWAIT); + if (dest == NULL) + return (NULL); + memcpy(dest, str, len); dest[len] = '\0'; @@ -105,6 +108,9 @@ bhnd_nv_strndup(const char *str, size_t len) len = strnlen(str, len); dest = malloc(len + 1, M_BHND_NVRAM, M_NOWAIT); + if (dest == NULL) + return (NULL); + memcpy(dest, str, len); dest[len] = '\0'; From owner-svn-src-head@freebsd.org Thu Mar 22 22:29:33 2018 Return-Path: Delivered-To: svn-src-head@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 F1A6CF4EA6B; Thu, 22 Mar 2018 22:29:32 +0000 (UTC) (envelope-from sbruno@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 9F73A6F629; Thu, 22 Mar 2018 22:29:32 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98AE21740C; Thu, 22 Mar 2018 22:29:32 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MMTWIW054630; Thu, 22 Mar 2018 22:29:32 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MMTWWx054627; Thu, 22 Mar 2018 22:29:32 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201803222229.w2MMTWWx054627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 22 Mar 2018 22:29:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331379 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 331379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 22:29:33 -0000 Author: sbruno Date: Thu Mar 22 22:29:32 2018 New Revision: 331379 URL: https://svnweb.freebsd.org/changeset/base/331379 Log: Simple locking fixes in ip_ctloutput, ip6_ctloutput, rip_ctloutput. Submitted by: Jason Eggleston Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14624 Modified: head/sys/netinet/ip_output.c head/sys/netinet/raw_ip.c head/sys/netinet6/ip6_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Thu Mar 22 22:13:46 2018 (r331378) +++ head/sys/netinet/ip_output.c Thu Mar 22 22:29:32 2018 (r331379) @@ -1314,12 +1314,14 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) break; case IP_PORTRANGE: + INP_RLOCK(inp); if (inp->inp_flags & INP_HIGHPORT) optval = IP_PORTRANGE_HIGH; else if (inp->inp_flags & INP_LOWPORT) optval = IP_PORTRANGE_LOW; else optval = 0; + INP_RUNLOCK(inp); break; case IP_ONESBCAST: @@ -1345,9 +1347,11 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) break; #ifdef RSS case IP_RSSBUCKETID: + INP_RLOCK(inp); retval = rss_hash2bucket(inp->inp_flowid, inp->inp_flowtype, &rss_bucket); + INP_RUNLOCK(inp); if (retval == 0) optval = rss_bucket; else Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Thu Mar 22 22:13:46 2018 (r331378) +++ head/sys/netinet/raw_ip.c Thu Mar 22 22:29:32 2018 (r331379) @@ -639,10 +639,12 @@ rip_ctloutput(struct socket *so, struct sockopt *sopt) sizeof optval); if (error) break; + INP_WLOCK(inp); if (optval) inp->inp_flags |= INP_HDRINCL; else inp->inp_flags &= ~INP_HDRINCL; + INP_WUNLOCK(inp); break; case IP_FW3: /* generic ipfw v.3 functions */ Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Thu Mar 22 22:13:46 2018 (r331378) +++ head/sys/netinet6/ip6_output.c Thu Mar 22 22:29:32 2018 (r331379) @@ -1498,8 +1498,10 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt) error = soopt_mcopyin(sopt, m); /* XXX */ if (error != 0) break; + INP_WLOCK(in6p); error = ip6_pcbopts(&in6p->in6p_outputopts, m, so, sopt); + INP_WUNLOCK(in6p); m_freem(m); /* XXX */ break; } @@ -1635,11 +1637,13 @@ do { \ error = EINVAL; break; } + INP_WLOCK(in6p); optp = &in6p->in6p_outputopts; error = ip6_pcbopt(IPV6_HOPLIMIT, (u_char *)&optval, sizeof(optval), optp, (td != NULL) ? td->td_ucred : NULL, uproto); + INP_WUNLOCK(in6p); break; } @@ -1690,8 +1694,10 @@ do { \ * available only prior to bind(2). * see ipng mailing list, Jun 22 2001. */ + INP_WLOCK(in6p); if (in6p->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) { + INP_WUNLOCK(in6p); error = EINVAL; break; } @@ -1700,6 +1706,7 @@ do { \ in6p->inp_vflag &= ~INP_IPV4; else in6p->inp_vflag |= INP_IPV4; + INP_WUNLOCK(in6p); break; case IPV6_RECVTCLASS: /* cannot mix with RFC2292 XXX */ @@ -1749,11 +1756,13 @@ do { \ break; { struct ip6_pktopts **optp; + INP_WLOCK(in6p); optp = &in6p->in6p_outputopts; error = ip6_pcbopt(optname, (u_char *)&optval, sizeof(optval), optp, (td != NULL) ? td->td_ucred : NULL, uproto); + INP_WUNLOCK(in6p); break; } @@ -1818,12 +1827,6 @@ do { \ int optlen; struct ip6_pktopts **optp; - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - error = EINVAL; - break; - } - /* * We only ensure valsize is not too large * here. Further validation will be done @@ -1833,12 +1836,21 @@ do { \ sizeof(optbuf_storage), 0); if (error) break; + + INP_WLOCK(in6p); + /* cannot mix with RFC2292 */ + if (OPTBIT(IN6P_RFC2292)) { + INP_WUNLOCK(in6p); + error = EINVAL; + break; + } optlen = sopt->sopt_valsize; optbuf = optbuf_storage; optp = &in6p->in6p_outputopts; error = ip6_pcbopt(optname, optbuf, optlen, optp, (td != NULL) ? td->td_ucred : NULL, uproto); + INP_WUNLOCK(in6p); break; } #undef OPTSET @@ -2023,10 +2035,12 @@ do { \ break; #ifdef RSS case IPV6_RSSBUCKETID: + INP_RLOCK(in6p); retval = rss_hash2bucket(in6p->inp_flowid, in6p->inp_flowtype, &rss_bucket); + INP_RUNLOCK(in6p); if (retval == 0) optval = rss_bucket; else @@ -2230,6 +2244,8 @@ ip6_pcbopts(struct ip6_pktopts **pktopt, struct mbuf * int error = 0; struct thread *td = sopt->sopt_td; + INP_WLOCK_ASSERT(sotoinpcb(so)); + /* turn off any old options. */ if (opt) { #ifdef DIAGNOSTIC @@ -3073,6 +3089,8 @@ int ip6_optlen(struct inpcb *in6p) { int len; + + INP_WLOCK_ASSERT(in6p); if (!in6p->in6p_outputopts) return 0; From owner-svn-src-head@freebsd.org Thu Mar 22 23:34:49 2018 Return-Path: Delivered-To: svn-src-head@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 D090FF534E8; Thu, 22 Mar 2018 23:34:48 +0000 (UTC) (envelope-from sbruno@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 8261C719C0; Thu, 22 Mar 2018 23:34:48 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7968317F5A; Thu, 22 Mar 2018 23:34:48 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNYm5u089613; Thu, 22 Mar 2018 23:34:48 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNYma9089612; Thu, 22 Mar 2018 23:34:48 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201803222334.w2MNYma9089612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 22 Mar 2018 23:34:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331380 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 331380 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 23:34:49 -0000 Author: sbruno Date: Thu Mar 22 23:34:48 2018 New Revision: 331380 URL: https://svnweb.freebsd.org/changeset/base/331380 Log: Refactor ip6_getpcbopt() for better locking and memory management Created GET_PKTOPT_EXT_HDR() and GET_PKTOPT_SOCKADDR() macros to handle safely fetching options from in6p_outputopts, including properly dealing with in6p locking and preparing memory for sooptcopyout(). Changed the function signature of ip6_getpcbopt() to allow the function to acquire and release locks on in6p as needed. Submitted by: Jason Eggleston Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14619 Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Thu Mar 22 22:29:32 2018 (r331379) +++ head/sys/netinet6/ip6_output.c Thu Mar 22 23:34:48 2018 (r331380) @@ -135,7 +135,7 @@ static int ip6_pcbopt(int, u_char *, int, struct ip6_p struct ucred *, int); static int ip6_pcbopts(struct ip6_pktopts **, struct mbuf *, struct socket *, struct sockopt *); -static int ip6_getpcbopt(struct ip6_pktopts *, int, struct sockopt *); +static int ip6_getpcbopt(struct inpcb *, int, struct sockopt *); static int ip6_setpktopt(int, u_char *, int, struct ip6_pktopts *, struct ucred *, int, int, int); @@ -2132,8 +2132,7 @@ do { \ case IPV6_DONTFRAG: case IPV6_USE_MIN_MTU: case IPV6_PREFER_TEMPADDR: - error = ip6_getpcbopt(in6p->in6p_outputopts, - optname, sopt); + error = ip6_getpcbopt(in6p, optname, sopt); break; case IPV6_MULTICAST_IF: @@ -2310,18 +2309,51 @@ ip6_pcbopt(int optname, u_char *buf, int len, struct i return (ip6_setpktopt(optname, buf, len, opt, cred, 1, 0, uproto)); } +#define GET_PKTOPT_VAR(field, lenexpr) do { \ + if (pktopt && pktopt->field) { \ + INP_RUNLOCK(in6p); \ + optdata = malloc(sopt->sopt_valsize, M_TEMP, M_WAITOK); \ + malloc_optdata = true; \ + INP_RLOCK(in6p); \ + if (in6p->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { \ + INP_RUNLOCK(in6p); \ + free(optdata, M_TEMP); \ + return (ECONNRESET); \ + } \ + pktopt = in6p->in6p_outputopts; \ + if (pktopt && pktopt->field) { \ + optdatalen = min(lenexpr, sopt->sopt_valsize); \ + bcopy(&pktopt->field, optdata, optdatalen); \ + } else { \ + free(optdata, M_TEMP); \ + optdata = NULL; \ + malloc_optdata = false; \ + } \ + } \ +} while(0) + +#define GET_PKTOPT_EXT_HDR(field) GET_PKTOPT_VAR(field, \ + (((struct ip6_ext *)pktopt->field)->ip6e_len + 1) << 3) + +#define GET_PKTOPT_SOCKADDR(field) GET_PKTOPT_VAR(field, \ + pktopt->field->sa_len) + static int -ip6_getpcbopt(struct ip6_pktopts *pktopt, int optname, struct sockopt *sopt) +ip6_getpcbopt(struct inpcb *in6p, int optname, struct sockopt *sopt) { void *optdata = NULL; + bool malloc_optdata = false; int optdatalen = 0; - struct ip6_ext *ip6e; int error = 0; struct in6_pktinfo null_pktinfo; int deftclass = 0, on; int defminmtu = IP6PO_MINMTU_MCASTONLY; int defpreftemp = IP6PO_TEMPADDR_SYSTEM; + struct ip6_pktopts *pktopt; + INP_RLOCK(in6p); + pktopt = in6p->in6p_outputopts; + switch (optname) { case IPV6_PKTINFO: optdata = (void *)&null_pktinfo; @@ -2337,50 +2369,29 @@ ip6_getpcbopt(struct ip6_pktopts *pktopt, int optname, break; case IPV6_TCLASS: if (pktopt && pktopt->ip6po_tclass >= 0) - optdata = (void *)&pktopt->ip6po_tclass; - else - optdata = (void *)&deftclass; + deftclass = pktopt->ip6po_tclass; + optdata = (void *)&deftclass; optdatalen = sizeof(int); break; case IPV6_HOPOPTS: - if (pktopt && pktopt->ip6po_hbh) { - optdata = (void *)pktopt->ip6po_hbh; - ip6e = (struct ip6_ext *)pktopt->ip6po_hbh; - optdatalen = (ip6e->ip6e_len + 1) << 3; - } + GET_PKTOPT_EXT_HDR(ip6po_hbh); break; case IPV6_RTHDR: - if (pktopt && pktopt->ip6po_rthdr) { - optdata = (void *)pktopt->ip6po_rthdr; - ip6e = (struct ip6_ext *)pktopt->ip6po_rthdr; - optdatalen = (ip6e->ip6e_len + 1) << 3; - } + GET_PKTOPT_EXT_HDR(ip6po_rthdr); break; case IPV6_RTHDRDSTOPTS: - if (pktopt && pktopt->ip6po_dest1) { - optdata = (void *)pktopt->ip6po_dest1; - ip6e = (struct ip6_ext *)pktopt->ip6po_dest1; - optdatalen = (ip6e->ip6e_len + 1) << 3; - } + GET_PKTOPT_EXT_HDR(ip6po_dest1); break; case IPV6_DSTOPTS: - if (pktopt && pktopt->ip6po_dest2) { - optdata = (void *)pktopt->ip6po_dest2; - ip6e = (struct ip6_ext *)pktopt->ip6po_dest2; - optdatalen = (ip6e->ip6e_len + 1) << 3; - } + GET_PKTOPT_EXT_HDR(ip6po_dest2); break; case IPV6_NEXTHOP: - if (pktopt && pktopt->ip6po_nexthop) { - optdata = (void *)pktopt->ip6po_nexthop; - optdatalen = pktopt->ip6po_nexthop->sa_len; - } + GET_PKTOPT_SOCKADDR(ip6po_nexthop); break; case IPV6_USE_MIN_MTU: if (pktopt) - optdata = (void *)&pktopt->ip6po_minmtu; - else - optdata = (void *)&defminmtu; + defminmtu = pktopt->ip6po_minmtu; + optdata = (void *)&defminmtu; optdatalen = sizeof(int); break; case IPV6_DONTFRAG: @@ -2393,19 +2404,22 @@ ip6_getpcbopt(struct ip6_pktopts *pktopt, int optname, break; case IPV6_PREFER_TEMPADDR: if (pktopt) - optdata = (void *)&pktopt->ip6po_prefer_tempaddr; - else - optdata = (void *)&defpreftemp; + defpreftemp = pktopt->ip6po_prefer_tempaddr; + optdata = (void *)&defpreftemp; optdatalen = sizeof(int); break; default: /* should not happen */ #ifdef DIAGNOSTIC panic("ip6_getpcbopt: unexpected option\n"); #endif + INP_RUNLOCK(in6p); return (ENOPROTOOPT); } + INP_RUNLOCK(in6p); error = sooptcopyout(sopt, optdata, optdatalen); + if (malloc_optdata) + free(optdata, M_TEMP); return (error); } From owner-svn-src-head@freebsd.org Fri Mar 23 00:40:09 2018 Return-Path: Delivered-To: svn-src-head@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 20DFBF59230; Fri, 23 Mar 2018 00:40:09 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 CA28B75B4C; Fri, 23 Mar 2018 00:40:08 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0F9C18A60; Fri, 23 Mar 2018 00:40:08 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N0e8h5021388; Fri, 23 Mar 2018 00:40:08 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N0e8Fs021387; Fri, 23 Mar 2018 00:40:08 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201803230040.w2N0e8Fs021387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Mar 2018 00:40:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331401 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 331401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 00:40:09 -0000 Author: jhibbits Date: Fri Mar 23 00:40:08 2018 New Revision: 331401 URL: https://svnweb.freebsd.org/changeset/base/331401 Log: Debug interrupts aren't instruction traps The EXC_DEBUG type is akin to the MPC74xx "Instruction Breakpoint" trap. Don't treat it as a trap instruction. Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Fri Mar 23 00:20:42 2018 (r331400) +++ head/sys/powerpc/powerpc/trap.c Fri Mar 23 00:40:08 2018 (r331401) @@ -189,7 +189,7 @@ frame_is_trap_inst(struct trapframe *frame) #ifdef AIM return (frame->exc == EXC_PGM && frame->srr1 & EXC_PGM_TRAP); #else - return (frame->exc == EXC_DEBUG || frame->cpu.booke.esr & ESR_PTR); + return ((frame->cpu.booke.esr & ESR_PTR) != 0); #endif } @@ -895,6 +895,7 @@ db_trap_glue(struct trapframe *frame) && (frame->exc == EXC_TRC || frame->exc == EXC_RUNMODETRC || frame_is_trap_inst(frame) || frame->exc == EXC_BPT + || frame->exc == EXC_DEBUG || frame->exc == EXC_DSI)) { int type = frame->exc; From owner-svn-src-head@freebsd.org Fri Mar 23 00:53:03 2018 Return-Path: Delivered-To: svn-src-head@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 1EBABF5A26E for ; Fri, 23 Mar 2018 00:53:03 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pl0-x236.google.com (mail-pl0-x236.google.com [IPv6:2607:f8b0:400e:c01::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C4C576526 for ; Fri, 23 Mar 2018 00:53:02 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pl0-x236.google.com with SMTP id x4-v6so6435466pln.7 for ; Thu, 22 Mar 2018 17:53:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jroberson-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=iRQGdrNV/na0Zp0a6w61Q363ZuwXUbsJlSdDxFv6twk=; b=jpeh9dNeN6kbONsjmYUdyjQS0WvibXFX+8AGZElX61w1djVrCvKXwB1NAKkTZPPVI+ HWDTF1P6Zg78hUliSVpvS9/3KJF3shN8X8vK4WaV6lq8t15PFB2hDND8RckSaRYJLHK+ qYgw7kGI5UVfic4zBsVwFyfn42Fwj1m/SABJtpNLlXfEaaChWO1GPFyCOR0QcvVAAPLo OuslWeGoAKAAuCeNOJZtTs5nmepsMGjpBbOVayV3fpfutg5R51JR3FaBmwcoGtPRQ5vH Yy6dZBCka2xZHc4GhGz42aHyW/oSpK5MCk7aa8GY9AKMNA1wwVpp7skUYIvh3QsHv7S/ c/8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=iRQGdrNV/na0Zp0a6w61Q363ZuwXUbsJlSdDxFv6twk=; b=VGY7sd423qHHciaNP5+2avO0KGng6CN/TdEfZqomGAsMZEuw3Kofe0yZfwlgFf54r7 OIX+y6SqGemzuXdzJKChlCsFUk5W+27wBYkxG/RcPJd1EC3xaMEhbnmgmrLG/dqFBlwK aRbOEdXNJikGcHZPJzEdiuby7GibQY4l3oWZLnamTVoH+f/j7nclOePrPm9xw9qkKAlr OnG8wjo8pHw6HlSa5EHk4NqmRJYB9qZEVKxNjClZURQfIuuyiNzXrWeMycN1UmLfXhsQ 1XSX9rYGhJoMCd7MDTqGgLkU76isISoj40vCXU7CRwCP00Ixr5YWyOTSwZ0bwUZuOmbG SC2A== X-Gm-Message-State: AElRT7GF8i9H61rXa8EGLvOE1FR4waVOjQbVz0J2wELEkKIMDqIY1cR+ tJj4mudIVJdYFq+vhpCZnFeVAg== X-Google-Smtp-Source: AG47ELta3MbOF/gVgUhBEcGwrur63u2YuDL9UXbawXXiiDEZNJUIdTTijj9tTnM+2xeokBxev36zRw== X-Received: by 2002:a17:902:c6:: with SMTP id a64-v6mr21952838pla.408.1521766381446; Thu, 22 Mar 2018 17:53:01 -0700 (PDT) Received: from rrcs-66-91-135-210.west.biz.rr.com (rrcs-66-91-135-210.west.biz.rr.com. [66.91.135.210]) by smtp.gmail.com with ESMTPSA id 13sm16526293pfm.10.2018.03.22.17.52.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 17:53:00 -0700 (PDT) Date: Thu, 22 Mar 2018 14:52:01 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Justin Hibbits cc: Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: Message-ID: References: <201803221921.w2MJLBi7058560@repo.freebsd.org> User-Agent: Alpine 2.21 (BSF 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 00:53:03 -0000 Thank you, working on it. I had done a make universe before getting review feedback. Jeff On Thu, 22 Mar 2018, Justin Hibbits wrote: > This broke gcc builds. > > On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: >> Author: jeff >> Date: Thu Mar 22 19:21:11 2018 >> New Revision: 331369 >> URL: https://svnweb.freebsd.org/changeset/base/331369 >> >> Log: >> Lock reservations with a dedicated lock in each reservation. Protect the >> vmd_free_count with atomics. >> >> This allows us to allocate and free from reservations without the free lock >> except where a superpage is allocated from the physical layer, which is >> roughly 1/512 of the operations on amd64. >> >> Use the counter api to eliminate cache conention on counters. >> >> Reviewed by: markj >> Tested by: pho >> Sponsored by: Netflix, Dell/EMC Isilon >> Differential Revision: https://reviews.freebsd.org/D14707 >> >> Modified: >> head/sys/vm/vm_page.c >> head/sys/vm/vm_pagequeue.h >> head/sys/vm/vm_reserv.c >> head/sys/vm/vm_reserv.h >> >> Modified: head/sys/vm/vm_page.c >> ============================================================================== >> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) >> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369) >> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; >> static void vm_page_alloc_check(vm_page_t m); >> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); >> static void vm_page_enqueue(uint8_t queue, vm_page_t m); >> -static void vm_page_free_phys(struct vm_domain *vmd, vm_page_t m); >> static void vm_page_init(void *dummy); >> static int vm_page_insert_after(vm_page_t m, vm_object_t object, >> vm_pindex_t pindex, vm_page_t mpred); >> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_t pi >> * for the request class and false otherwise. >> */ >> int >> -vm_domain_available(struct vm_domain *vmd, int req, int npages) >> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) >> { >> + u_int limit, old, new; >> >> - vm_domain_free_assert_locked(vmd); >> req = req & VM_ALLOC_CLASS_MASK; >> >> /* >> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int req, in >> */ >> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) >> req = VM_ALLOC_SYSTEM; >> + if (req == VM_ALLOC_INTERRUPT) >> + limit = 0; >> + else if (req == VM_ALLOC_SYSTEM) >> + limit = vmd->vmd_interrupt_free_min; >> + else >> + limit = vmd->vmd_free_reserved; >> >> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || >> - (req == VM_ALLOC_SYSTEM && >> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) || >> - (req == VM_ALLOC_INTERRUPT && >> - vmd->vmd_free_count >= npages)) >> - return (1); >> + /* >> + * Attempt to reserve the pages. Fail if we're below the limit. >> + */ >> + limit += npages; >> + old = vmd->vmd_free_count; >> + do { >> + if (old < limit) >> + return (0); >> + new = old - npages; >> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == 0); >> >> - return (0); >> + /* Wake the page daemon if we've crossed the threshold. */ >> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) >> + pagedaemon_wakeup(vmd->vmd_domain); >> + >> + /* Only update bitsets on transitions. */ >> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || >> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) >> + vm_domain_set(vmd); >> + >> + return (1); >> } >> >> vm_page_t >> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind >> again: >> m = NULL; >> #if VM_NRESERVLEVEL > 0 >> + /* >> + * Can we allocate the page from a reservation? >> + */ >> if (vm_object_reserv(object) && >> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) >> - != NULL) { >> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) != NULL || >> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred)) != NULL)) { >> domain = vm_phys_domain(m); >> vmd = VM_DOMAIN(domain); >> goto found; >> } >> #endif >> vmd = VM_DOMAIN(domain); >> - vm_domain_free_lock(vmd); >> - if (vm_domain_available(vmd, req, 1)) { >> + if (vm_domain_allocate(vmd, req, 1)) { >> /* >> - * Can we allocate the page from a reservation? >> + * If not, allocate it from the free page queues. >> */ >> + vm_domain_free_lock(vmd); >> + m = vm_phys_alloc_pages(domain, object != NULL ? >> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); >> + vm_domain_free_unlock(vmd); >> + if (m == NULL) { >> + vm_domain_freecnt_inc(vmd, 1); >> #if VM_NRESERVLEVEL > 0 >> - if (!vm_object_reserv(object) || >> - (m = vm_reserv_alloc_page(object, pindex, >> - domain, mpred)) == NULL) >> + if (vm_reserv_reclaim_inactive(domain)) >> + goto again; >> #endif >> - { >> - /* >> - * If not, allocate it from the free page queues. >> - */ >> - m = vm_phys_alloc_pages(domain, object != NULL ? >> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); >> -#if VM_NRESERVLEVEL > 0 >> - if (m == NULL && vm_reserv_reclaim_inactive(domain)) { >> - m = vm_phys_alloc_pages(domain, >> - object != NULL ? >> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, >> - 0); >> - } >> -#endif >> } >> } >> - if (m != NULL) >> - vm_domain_freecnt_dec(vmd, 1); >> - vm_domain_free_unlock(vmd); >> if (m == NULL) { >> /* >> * Not allocatable, give up. >> @@ -1775,9 +1783,7 @@ again: >> */ >> KASSERT(m != NULL, ("missing page")); >> >> -#if VM_NRESERVLEVEL > 0 >> found: >> -#endif > > 'found' is now declared, but unused on powerpc64. > > - Justin > From owner-svn-src-head@freebsd.org Fri Mar 23 00:59:11 2018 Return-Path: Delivered-To: svn-src-head@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 1B485F5A87F; Fri, 23 Mar 2018 00:59:11 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6577B767F7; Fri, 23 Mar 2018 00:59:10 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id zB2uefcv3U5pnzB2wem7L4; Thu, 22 Mar 2018 18:59:08 -0600 X-Authority-Analysis: v=2.3 cv=Tai4SyYh c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=v2DPQv5-lfwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=1IRbpGNzCyaoQT8CEAwA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id B3DD91248; Thu, 22 Mar 2018 17:59:04 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w2N0x2Kg077301; Thu, 22 Mar 2018 17:59:02 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w2N0x2fw077291; Thu, 22 Mar 2018 17:59:02 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201803230059.w2N0x2fw077291@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jeff Roberson cc: Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: Message from Jeff Roberson of "Thu, 22 Mar 2018 14:52:01 -1000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 22 Mar 2018 17:59:02 -0700 X-CMAE-Envelope: MS4wfF13DQe+MfdEAy6Ew3KCgDcUJSJrsoiZnPVcft2wGRv+qq6Y6TGEI94fTvuGEL2uVCV66bklvOEj4nQ214YLBNgIb2NbdicC1DiFt8ZfuTm6LzRCq+zs 8mdqPkGFBGZ6pnE4t4R31XR2YMbKTJYmvrsHdNrX3NZWYUjEuAd9wapZ/LhGLYSy8qdbghFsaHYtwnvKRklripuH5lcff4BjZK2fpgxopRxKMdeuuTgUiZa/ LcjePc4SKmO32Td3Mz5MhRIk9ILhxRRU1SFZC1LsvgFtNnakyWZFcmmbImz2C6wAbw0UgBLVwjkqIRv6j9V8RBR5J0/cIwopqbNdDec36CBDcLZ0q8kzlbr7 zlpAsQwc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 00:59:11 -0000 It broke i386 too. Index: sys/vm/vm_reserv.c =================================================================== --- sys/vm/vm_reserv.c (revision 331399) +++ sys/vm/vm_reserv.c (working copy) @@ -45,8 +45,6 @@ #include #include -#include -#include #include #include #include @@ -55,6 +53,8 @@ #include #include #include +#include +#include #include #include This is because sys/i386/include/machine.h uses critical_enter() and critical_exit() which are defined in sys/systm.h. It built nicely on my amd64's though. ~cy In message , Jeff Roberson writes: > Thank you, working on it. I had done a make universe before getting > review feedback. > > Jeff > > On Thu, 22 Mar 2018, Justin Hibbits wrote: > > > This broke gcc builds. > > > > On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: > >> Author: jeff > >> Date: Thu Mar 22 19:21:11 2018 > >> New Revision: 331369 > >> URL: https://svnweb.freebsd.org/changeset/base/331369 > >> > >> Log: > >> Lock reservations with a dedicated lock in each reservation. Protect th > e > >> vmd_free_count with atomics. > >> > >> This allows us to allocate and free from reservations without the free l > ock > >> except where a superpage is allocated from the physical layer, which is > >> roughly 1/512 of the operations on amd64. > >> > >> Use the counter api to eliminate cache conention on counters. > >> > >> Reviewed by: markj > >> Tested by: pho > >> Sponsored by: Netflix, Dell/EMC Isilon > >> Differential Revision: https://reviews.freebsd.org/D14707 > >> > >> Modified: > >> head/sys/vm/vm_page.c > >> head/sys/vm/vm_pagequeue.h > >> head/sys/vm/vm_reserv.c > >> head/sys/vm/vm_reserv.h > >> > >> Modified: head/sys/vm/vm_page.c > >> ========================================================================== > ==== > >> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) > >> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369) > >> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; > >> static void vm_page_alloc_check(vm_page_t m); > >> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits > ); > >> static void vm_page_enqueue(uint8_t queue, vm_page_t m); > >> -static void vm_page_free_phys(struct vm_domain *vmd, vm_page_t m); > >> static void vm_page_init(void *dummy); > >> static int vm_page_insert_after(vm_page_t m, vm_object_t object, > >> vm_pindex_t pindex, vm_page_t mpred); > >> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_ > t pi > >> * for the request class and false otherwise. > >> */ > >> int > >> -vm_domain_available(struct vm_domain *vmd, int req, int npages) > >> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) > >> { > >> + u_int limit, old, new; > >> > >> - vm_domain_free_assert_locked(vmd); > >> req = req & VM_ALLOC_CLASS_MASK; > >> > >> /* > >> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int req > , in > >> */ > >> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) > >> req = VM_ALLOC_SYSTEM; > >> + if (req == VM_ALLOC_INTERRUPT) > >> + limit = 0; > >> + else if (req == VM_ALLOC_SYSTEM) > >> + limit = vmd->vmd_interrupt_free_min; > >> + else > >> + limit = vmd->vmd_free_reserved; > >> > >> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || > >> - (req == VM_ALLOC_SYSTEM && > >> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) | > | > >> - (req == VM_ALLOC_INTERRUPT && > >> - vmd->vmd_free_count >= npages)) > >> - return (1); > >> + /* > >> + * Attempt to reserve the pages. Fail if we're below the limit. > >> + */ > >> + limit += npages; > >> + old = vmd->vmd_free_count; > >> + do { > >> + if (old < limit) > >> + return (0); > >> + new = old - npages; > >> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == 0) > ; > >> > >> - return (0); > >> + /* Wake the page daemon if we've crossed the threshold. */ > >> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) > >> + pagedaemon_wakeup(vmd->vmd_domain); > >> + > >> + /* Only update bitsets on transitions. */ > >> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || > >> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) > >> + vm_domain_set(vmd); > >> + > >> + return (1); > >> } > >> > >> vm_page_t > >> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, vm_ > pind > >> again: > >> m = NULL; > >> #if VM_NRESERVLEVEL > 0 > >> + /* > >> + * Can we allocate the page from a reservation? > >> + */ > >> if (vm_object_reserv(object) && > >> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) > >> - != NULL) { > >> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) != > NULL || > >> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred)) > != NULL)) { > >> domain = vm_phys_domain(m); > >> vmd = VM_DOMAIN(domain); > >> goto found; > >> } > >> #endif > >> vmd = VM_DOMAIN(domain); > >> - vm_domain_free_lock(vmd); > >> - if (vm_domain_available(vmd, req, 1)) { > >> + if (vm_domain_allocate(vmd, req, 1)) { > >> /* > >> - * Can we allocate the page from a reservation? > >> + * If not, allocate it from the free page queues. > >> */ > >> + vm_domain_free_lock(vmd); > >> + m = vm_phys_alloc_pages(domain, object != NULL ? > >> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > >> + vm_domain_free_unlock(vmd); > >> + if (m == NULL) { > >> + vm_domain_freecnt_inc(vmd, 1); > >> #if VM_NRESERVLEVEL > 0 > >> - if (!vm_object_reserv(object) || > >> - (m = vm_reserv_alloc_page(object, pindex, > >> - domain, mpred)) == NULL) > >> + if (vm_reserv_reclaim_inactive(domain)) > >> + goto again; > >> #endif > >> - { > >> - /* > >> - * If not, allocate it from the free page queues. > >> - */ > >> - m = vm_phys_alloc_pages(domain, object != NULL ? > >> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > >> -#if VM_NRESERVLEVEL > 0 > >> - if (m == NULL && vm_reserv_reclaim_inactive(domain > )) { > >> - m = vm_phys_alloc_pages(domain, > >> - object != NULL ? > >> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRE > CT, > >> - 0); > >> - } > >> -#endif > >> } > >> } > >> - if (m != NULL) > >> - vm_domain_freecnt_dec(vmd, 1); > >> - vm_domain_free_unlock(vmd); > >> if (m == NULL) { > >> /* > >> * Not allocatable, give up. > >> @@ -1775,9 +1783,7 @@ again: > >> */ > >> KASSERT(m != NULL, ("missing page")); > >> > >> -#if VM_NRESERVLEVEL > 0 > >> found: > >> -#endif > > > > 'found' is now declared, but unused on powerpc64. > > > > - Justin > > > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Fri Mar 23 01:20:26 2018 Return-Path: Delivered-To: svn-src-head@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 9ABC1F5C2D3 for ; Fri, 23 Mar 2018 01:20:26 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pl0-x236.google.com (mail-pl0-x236.google.com [IPv6:2607:f8b0:400e:c01::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1B8E27754A for ; Fri, 23 Mar 2018 01:20:26 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pl0-x236.google.com with SMTP id m22-v6so6484882pls.5 for ; Thu, 22 Mar 2018 18:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jroberson-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=jCdVj0tIOFf3syaz8NMfukM7vCrMSGuhP8lRkIZMtXs=; b=Y7f6fagq2EVNony+xkLczUj2YoNXB2jrY7mouIYu6xfDnJfuxN4SBZ2V4ofIg4wWVh ToEhaT+RnfmvpOrXgVYJQozsBWlHCLmDRC60LOGXFMfU03fnTaLSxetILsRqamLAgZhS 7JGwtMcVz3Vl55/Qj6HkMd/ljnUqO4jQEv/C0Msgqikomyr+YIKU/eDzuNSdF60nymuP 1bAcb6g+rPnCVqCjgB2P1kuZAbnJRFa9bCfcUS+yBWswpsYpWQwqrVFYPyrmOdguUL+E KeF8XJ+qBhUpy2O8Jq89SusK+JlXJ8/53chtJw74UwIykG27NYL4rnCEJFW+1na8qphK I/vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=jCdVj0tIOFf3syaz8NMfukM7vCrMSGuhP8lRkIZMtXs=; b=rUh/36q49i7iJVdH74Ks/pjjMOMN/d4nMfvfkgpB9iKlGE4TJ1thKq6eP8vxYs60UC U4tJg7fT0fMVbsok0YRauo0DqP4DexnCb3u97fb6SXquIFEr9kfNylHnpAj3kYK+IuXp EV0MALN6krOAkm+X0RQOnT3CEthaEq1GPRy45EjjJs6HoYRa4lLESYSADVoMvWI54B6Z htF5BPRcBMO5ZsaIJTFBEzDVuObDyL0HAJZ1NOjoLEJjsx0V4ME87rHxLZ4AM/UY4b63 fDQu5jT8exSS8FHEPi76fhXMLjHyoVM7axiCjSYP260CQhNtj8CHp4bZEhKPFoJ7G8eG upMw== X-Gm-Message-State: AElRT7F6MwSzVmDJ9OXIlmoi6B/TKfAJ13lQQxxB7LaH1qpn7fDEV9w+ 9H3eyK+aP7Y6gG1PkEQebQkKJg== X-Google-Smtp-Source: AG47ELu35D99abYM/iIgHzoGKLi1AyKWlcm6zxMMfxXUHXAagukQrNb/26KzZpHv1qHJP0FoW9VTVw== X-Received: by 2002:a17:902:6ac1:: with SMTP id i1-v6mr24103735plt.152.1521768025080; Thu, 22 Mar 2018 18:20:25 -0700 (PDT) Received: from rrcs-66-91-135-210.west.biz.rr.com (rrcs-66-91-135-210.west.biz.rr.com. [66.91.135.210]) by smtp.gmail.com with ESMTPSA id 5sm16213207pfh.133.2018.03.22.18.20.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 18:20:24 -0700 (PDT) Date: Thu, 22 Mar 2018 15:19:25 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Cy Schubert cc: Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: <201803230059.w2N0x2fw077291@slippy.cwsent.com> Message-ID: References: <201803230059.w2N0x2fw077291@slippy.cwsent.com> User-Agent: Alpine 2.21 (BSF 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 01:20:26 -0000 On Thu, 22 Mar 2018, Cy Schubert wrote: > It broke i386 too. I just did TARGET_ARCH=i386 make buildworld TARGET_ARCH=i386 make buildkernel This worked for me? Jeff > > Index: sys/vm/vm_reserv.c > =================================================================== > --- sys/vm/vm_reserv.c (revision 331399) > +++ sys/vm/vm_reserv.c (working copy) > @@ -45,8 +45,6 @@ > > #include > #include > -#include > -#include > #include > #include > #include > @@ -55,6 +53,8 @@ > #include > #include > #include > +#include > +#include > #include > #include > > This is because sys/i386/include/machine.h uses critical_enter() and > critical_exit() which are defined in sys/systm.h. > > It built nicely on my amd64's though. > > ~cy > > In message , Jeff Roberson > writes: >> Thank you, working on it. I had done a make universe before getting >> review feedback. >> >> Jeff >> >> On Thu, 22 Mar 2018, Justin Hibbits wrote: >> >>> This broke gcc builds. >>> >>> On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: >>>> Author: jeff >>>> Date: Thu Mar 22 19:21:11 2018 >>>> New Revision: 331369 >>>> URL: https://svnweb.freebsd.org/changeset/base/331369 >>>> >>>> Log: >>>> Lock reservations with a dedicated lock in each reservation. Protect th >> e >>>> vmd_free_count with atomics. >>>> >>>> This allows us to allocate and free from reservations without the free l >> ock >>>> except where a superpage is allocated from the physical layer, which is >>>> roughly 1/512 of the operations on amd64. >>>> >>>> Use the counter api to eliminate cache conention on counters. >>>> >>>> Reviewed by: markj >>>> Tested by: pho >>>> Sponsored by: Netflix, Dell/EMC Isilon >>>> Differential Revision: https://reviews.freebsd.org/D14707 >>>> >>>> Modified: >>>> head/sys/vm/vm_page.c >>>> head/sys/vm/vm_pagequeue.h >>>> head/sys/vm/vm_reserv.c >>>> head/sys/vm/vm_reserv.h >>>> >>>> Modified: head/sys/vm/vm_page.c >>>> ========================================================================== >> ==== >>>> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) >>>> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369) >>>> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; >>>> static void vm_page_alloc_check(vm_page_t m); >>>> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits >> ); >>>> static void vm_page_enqueue(uint8_t queue, vm_page_t m); >>>> -static void vm_page_free_phys(struct vm_domain *vmd, vm_page_t m); >>>> static void vm_page_init(void *dummy); >>>> static int vm_page_insert_after(vm_page_t m, vm_object_t object, >>>> vm_pindex_t pindex, vm_page_t mpred); >>>> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_ >> t pi >>>> * for the request class and false otherwise. >>>> */ >>>> int >>>> -vm_domain_available(struct vm_domain *vmd, int req, int npages) >>>> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) >>>> { >>>> + u_int limit, old, new; >>>> >>>> - vm_domain_free_assert_locked(vmd); >>>> req = req & VM_ALLOC_CLASS_MASK; >>>> >>>> /* >>>> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int req >> , in >>>> */ >>>> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) >>>> req = VM_ALLOC_SYSTEM; >>>> + if (req == VM_ALLOC_INTERRUPT) >>>> + limit = 0; >>>> + else if (req == VM_ALLOC_SYSTEM) >>>> + limit = vmd->vmd_interrupt_free_min; >>>> + else >>>> + limit = vmd->vmd_free_reserved; >>>> >>>> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || >>>> - (req == VM_ALLOC_SYSTEM && >>>> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) | >> | >>>> - (req == VM_ALLOC_INTERRUPT && >>>> - vmd->vmd_free_count >= npages)) >>>> - return (1); >>>> + /* >>>> + * Attempt to reserve the pages. Fail if we're below the limit. >>>> + */ >>>> + limit += npages; >>>> + old = vmd->vmd_free_count; >>>> + do { >>>> + if (old < limit) >>>> + return (0); >>>> + new = old - npages; >>>> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == 0) >> ; >>>> >>>> - return (0); >>>> + /* Wake the page daemon if we've crossed the threshold. */ >>>> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) >>>> + pagedaemon_wakeup(vmd->vmd_domain); >>>> + >>>> + /* Only update bitsets on transitions. */ >>>> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || >>>> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) >>>> + vm_domain_set(vmd); >>>> + >>>> + return (1); >>>> } >>>> >>>> vm_page_t >>>> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, vm_ >> pind >>>> again: >>>> m = NULL; >>>> #if VM_NRESERVLEVEL > 0 >>>> + /* >>>> + * Can we allocate the page from a reservation? >>>> + */ >>>> if (vm_object_reserv(object) && >>>> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) >>>> - != NULL) { >>>> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) != >> NULL || >>>> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred)) >> != NULL)) { >>>> domain = vm_phys_domain(m); >>>> vmd = VM_DOMAIN(domain); >>>> goto found; >>>> } >>>> #endif >>>> vmd = VM_DOMAIN(domain); >>>> - vm_domain_free_lock(vmd); >>>> - if (vm_domain_available(vmd, req, 1)) { >>>> + if (vm_domain_allocate(vmd, req, 1)) { >>>> /* >>>> - * Can we allocate the page from a reservation? >>>> + * If not, allocate it from the free page queues. >>>> */ >>>> + vm_domain_free_lock(vmd); >>>> + m = vm_phys_alloc_pages(domain, object != NULL ? >>>> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); >>>> + vm_domain_free_unlock(vmd); >>>> + if (m == NULL) { >>>> + vm_domain_freecnt_inc(vmd, 1); >>>> #if VM_NRESERVLEVEL > 0 >>>> - if (!vm_object_reserv(object) || >>>> - (m = vm_reserv_alloc_page(object, pindex, >>>> - domain, mpred)) == NULL) >>>> + if (vm_reserv_reclaim_inactive(domain)) >>>> + goto again; >>>> #endif >>>> - { >>>> - /* >>>> - * If not, allocate it from the free page queues. >>>> - */ >>>> - m = vm_phys_alloc_pages(domain, object != NULL ? >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); >>>> -#if VM_NRESERVLEVEL > 0 >>>> - if (m == NULL && vm_reserv_reclaim_inactive(domain >> )) { >>>> - m = vm_phys_alloc_pages(domain, >>>> - object != NULL ? >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRE >> CT, >>>> - 0); >>>> - } >>>> -#endif >>>> } >>>> } >>>> - if (m != NULL) >>>> - vm_domain_freecnt_dec(vmd, 1); >>>> - vm_domain_free_unlock(vmd); >>>> if (m == NULL) { >>>> /* >>>> * Not allocatable, give up. >>>> @@ -1775,9 +1783,7 @@ again: >>>> */ >>>> KASSERT(m != NULL, ("missing page")); >>>> >>>> -#if VM_NRESERVLEVEL > 0 >>>> found: >>>> -#endif >>> >>> 'found' is now declared, but unused on powerpc64. >>> >>> - Justin >>> >> > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: http://www.FreeBSD.org > > The need of the many outweighs the greed of the few. > > From owner-svn-src-head@freebsd.org Fri Mar 23 01:43:42 2018 Return-Path: Delivered-To: svn-src-head@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 75106F5E0B4 for ; Fri, 23 Mar 2018 01:43:42 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pg0-x22e.google.com (mail-pg0-x22e.google.com [IPv6:2607:f8b0:400e:c05::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E5C78786A2 for ; Fri, 23 Mar 2018 01:43:41 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pg0-x22e.google.com with SMTP id n11so4006965pgp.4 for ; Thu, 22 Mar 2018 18:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jroberson-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=8BEgLg/bQWM2TNW0NJqT8/Ie9n+0a9+Aoi+T/CrzEZk=; b=WzZWpYl3rrhsO9CDbpAGKLed6mDWyZuvYhFip3Jo2HYo8bypoeECYSttKsY6JT5Lcs V3DcikVcRWLlx4RocgBry/o03pLnKzxxUrqz7A5Ptm0zJ/uJNO+dTH5tpwmCHJ/k3JH+ akzEdmpLoe7eJsxHZ8pc8/1TznPvkhKapl1kH+ZqiCcuQTW/jVOMteo1BENusexpAw6a ujS1SjTt59IXq3M4rcJRubknymU0d9Y2Gt3ZRvRnMI9MDLDhf7USyQV7VIsoTL5v33aL ar6/CewrzrSfG7lPPGBlQkLr/orDJRPcX92XIL58M16g2YRHQhJs1UMitvokIDrwdn2R hsvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=8BEgLg/bQWM2TNW0NJqT8/Ie9n+0a9+Aoi+T/CrzEZk=; b=SVzBXZrHHofZoMBrd0hPbC3crnzM1IqBXHnZPpGddTzDP6dP7CAs62NpGV1UjzVzaU r+Lftll+Q8NpmB+RAjr9p5F4r+pCncvZtkSy7vow5s29QzbvqYQocUjr17BQ6WAQIqVU YFymBjp2ZP09A8+jgHvmBqZ82hkZtINZnHFOH03FxPLWxdruioKHXhJrgaBjyvMJFJhP JDPg8pfBccBDNk+qOHEfuAJVXZNDDEIsHuCiZO3s/Vu/zY8PRqV3A2xVwUnGSg3NyO0M dV+GGzRXVP9bjGjaoXEplL0FkK1AT/bUWd4XWv9GR9sKDTlwutl6U+Tjj/NR99SLduNp MqHA== X-Gm-Message-State: AElRT7EQv2y9+HfUtMwrXsWbz0ZVbDNAKrxHeP/WP7a+I7HuoOv/Blxe /uXaOE8AJjRMLnI0u/4udete4Ik5 X-Google-Smtp-Source: AG47ELuc/pyoAn7A3pfd5DcuI4caB+tTJOKQoj/JkqkuctSk0QzbVYUonlKgZY933DO41ndjG01ZJw== X-Received: by 10.99.65.6 with SMTP id o6mr10841562pga.57.1521769420752; Thu, 22 Mar 2018 18:43:40 -0700 (PDT) Received: from rrcs-66-91-135-210.west.biz.rr.com (rrcs-66-91-135-210.west.biz.rr.com. [66.91.135.210]) by smtp.gmail.com with ESMTPSA id 26sm15235343pfn.68.2018.03.22.18.43.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 18:43:39 -0700 (PDT) Date: Thu, 22 Mar 2018 15:42:41 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Cy Schubert cc: Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: <201803230059.w2N0x2fw077291@slippy.cwsent.com> Message-ID: References: <201803230059.w2N0x2fw077291@slippy.cwsent.com> User-Agent: Alpine 2.21 (BSF 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 01:43:42 -0000 On Thu, 22 Mar 2018, Cy Schubert wrote: > It broke i386 too. I believe I'm not able to reproduce this because it is a result of changes in kernel config. I can not reproduce it so I can't verify the fix. Since you can, would you mind committing? I see no problem with the diff below. Thanks, Jeff > > Index: sys/vm/vm_reserv.c > =================================================================== > --- sys/vm/vm_reserv.c (revision 331399) > +++ sys/vm/vm_reserv.c (working copy) > @@ -45,8 +45,6 @@ > > #include > #include > -#include > -#include > #include > #include > #include > @@ -55,6 +53,8 @@ > #include > #include > #include > +#include > +#include > #include > #include > > This is because sys/i386/include/machine.h uses critical_enter() and > critical_exit() which are defined in sys/systm.h. > > It built nicely on my amd64's though. > > ~cy > > In message , Jeff Roberson > writes: >> Thank you, working on it. I had done a make universe before getting >> review feedback. >> >> Jeff >> >> On Thu, 22 Mar 2018, Justin Hibbits wrote: >> >>> This broke gcc builds. >>> >>> On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: >>>> Author: jeff >>>> Date: Thu Mar 22 19:21:11 2018 >>>> New Revision: 331369 >>>> URL: https://svnweb.freebsd.org/changeset/base/331369 >>>> >>>> Log: >>>> Lock reservations with a dedicated lock in each reservation. Protect th >> e >>>> vmd_free_count with atomics. >>>> >>>> This allows us to allocate and free from reservations without the free l >> ock >>>> except where a superpage is allocated from the physical layer, which is >>>> roughly 1/512 of the operations on amd64. >>>> >>>> Use the counter api to eliminate cache conention on counters. >>>> >>>> Reviewed by: markj >>>> Tested by: pho >>>> Sponsored by: Netflix, Dell/EMC Isilon >>>> Differential Revision: https://reviews.freebsd.org/D14707 >>>> >>>> Modified: >>>> head/sys/vm/vm_page.c >>>> head/sys/vm/vm_pagequeue.h >>>> head/sys/vm/vm_reserv.c >>>> head/sys/vm/vm_reserv.h >>>> >>>> Modified: head/sys/vm/vm_page.c >>>> ========================================================================== >> ==== >>>> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) >>>> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369) >>>> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; >>>> static void vm_page_alloc_check(vm_page_t m); >>>> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits >> ); >>>> static void vm_page_enqueue(uint8_t queue, vm_page_t m); >>>> -static void vm_page_free_phys(struct vm_domain *vmd, vm_page_t m); >>>> static void vm_page_init(void *dummy); >>>> static int vm_page_insert_after(vm_page_t m, vm_object_t object, >>>> vm_pindex_t pindex, vm_page_t mpred); >>>> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_ >> t pi >>>> * for the request class and false otherwise. >>>> */ >>>> int >>>> -vm_domain_available(struct vm_domain *vmd, int req, int npages) >>>> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) >>>> { >>>> + u_int limit, old, new; >>>> >>>> - vm_domain_free_assert_locked(vmd); >>>> req = req & VM_ALLOC_CLASS_MASK; >>>> >>>> /* >>>> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int req >> , in >>>> */ >>>> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) >>>> req = VM_ALLOC_SYSTEM; >>>> + if (req == VM_ALLOC_INTERRUPT) >>>> + limit = 0; >>>> + else if (req == VM_ALLOC_SYSTEM) >>>> + limit = vmd->vmd_interrupt_free_min; >>>> + else >>>> + limit = vmd->vmd_free_reserved; >>>> >>>> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || >>>> - (req == VM_ALLOC_SYSTEM && >>>> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) | >> | >>>> - (req == VM_ALLOC_INTERRUPT && >>>> - vmd->vmd_free_count >= npages)) >>>> - return (1); >>>> + /* >>>> + * Attempt to reserve the pages. Fail if we're below the limit. >>>> + */ >>>> + limit += npages; >>>> + old = vmd->vmd_free_count; >>>> + do { >>>> + if (old < limit) >>>> + return (0); >>>> + new = old - npages; >>>> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == 0) >> ; >>>> >>>> - return (0); >>>> + /* Wake the page daemon if we've crossed the threshold. */ >>>> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) >>>> + pagedaemon_wakeup(vmd->vmd_domain); >>>> + >>>> + /* Only update bitsets on transitions. */ >>>> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || >>>> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) >>>> + vm_domain_set(vmd); >>>> + >>>> + return (1); >>>> } >>>> >>>> vm_page_t >>>> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, vm_ >> pind >>>> again: >>>> m = NULL; >>>> #if VM_NRESERVLEVEL > 0 >>>> + /* >>>> + * Can we allocate the page from a reservation? >>>> + */ >>>> if (vm_object_reserv(object) && >>>> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) >>>> - != NULL) { >>>> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) != >> NULL || >>>> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred)) >> != NULL)) { >>>> domain = vm_phys_domain(m); >>>> vmd = VM_DOMAIN(domain); >>>> goto found; >>>> } >>>> #endif >>>> vmd = VM_DOMAIN(domain); >>>> - vm_domain_free_lock(vmd); >>>> - if (vm_domain_available(vmd, req, 1)) { >>>> + if (vm_domain_allocate(vmd, req, 1)) { >>>> /* >>>> - * Can we allocate the page from a reservation? >>>> + * If not, allocate it from the free page queues. >>>> */ >>>> + vm_domain_free_lock(vmd); >>>> + m = vm_phys_alloc_pages(domain, object != NULL ? >>>> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); >>>> + vm_domain_free_unlock(vmd); >>>> + if (m == NULL) { >>>> + vm_domain_freecnt_inc(vmd, 1); >>>> #if VM_NRESERVLEVEL > 0 >>>> - if (!vm_object_reserv(object) || >>>> - (m = vm_reserv_alloc_page(object, pindex, >>>> - domain, mpred)) == NULL) >>>> + if (vm_reserv_reclaim_inactive(domain)) >>>> + goto again; >>>> #endif >>>> - { >>>> - /* >>>> - * If not, allocate it from the free page queues. >>>> - */ >>>> - m = vm_phys_alloc_pages(domain, object != NULL ? >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); >>>> -#if VM_NRESERVLEVEL > 0 >>>> - if (m == NULL && vm_reserv_reclaim_inactive(domain >> )) { >>>> - m = vm_phys_alloc_pages(domain, >>>> - object != NULL ? >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRE >> CT, >>>> - 0); >>>> - } >>>> -#endif >>>> } >>>> } >>>> - if (m != NULL) >>>> - vm_domain_freecnt_dec(vmd, 1); >>>> - vm_domain_free_unlock(vmd); >>>> if (m == NULL) { >>>> /* >>>> * Not allocatable, give up. >>>> @@ -1775,9 +1783,7 @@ again: >>>> */ >>>> KASSERT(m != NULL, ("missing page")); >>>> >>>> -#if VM_NRESERVLEVEL > 0 >>>> found: >>>> -#endif >>> >>> 'found' is now declared, but unused on powerpc64. >>> >>> - Justin >>> >> > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: http://www.FreeBSD.org > > The need of the many outweighs the greed of the few. > > From owner-svn-src-head@freebsd.org Fri Mar 23 01:50:58 2018 Return-Path: Delivered-To: svn-src-head@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 B06EBF5E861; Fri, 23 Mar 2018 01:50:58 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 07B5578AD9; Fri, 23 Mar 2018 01:50:57 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id zBqzefvitU5pnzBr0emDd4; Thu, 22 Mar 2018 19:50:51 -0600 X-Authority-Analysis: v=2.3 cv=Tai4SyYh c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=v2DPQv5-lfwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=yqQTKvdX5MLKBJhURkEA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 1B25A12D6; Thu, 22 Mar 2018 18:50:49 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w2N1om2X036182; Thu, 22 Mar 2018 18:50:48 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w2N1omDY036179; Thu, 22 Mar 2018 18:50:48 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201803230150.w2N1omDY036179@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jeff Roberson cc: Cy Schubert , Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: Message from Jeff Roberson of "Thu, 22 Mar 2018 15:19:25 -1000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 22 Mar 2018 18:50:47 -0700 X-CMAE-Envelope: MS4wfED8Sp1RAp/lyPhXbOJ4vvEhjsHHu+56ExKc0uUSoDNIr3HC3joo8Sqqwrlqpx65/lIr/znJgQZc2NAGHyGmmFxsa4hhIYYQMd+cQKXsOo5h9k8pO0TR mWZhnJQjHQu05NAIfI5T7pTmpUJewzfgenX0otBicHH9L5mIT1ZCvfqklG8qRQtvotm0m+ZAaHD0RDQoGFNrc++MBLi+TIqEQczvRUiro0EUxc64beDUJTyU B9KEFPkATb7/UXGuHf31PLmMlSP9J0+rVQARbinrJImFoaeAaB8M/jPkgv+umw6VpWDxFCRv0SynH5dTpTL2wyC9wmU9QTM8t6chlIcfZKpAWAn4hs45Y6fw UZmSH7YS X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 01:50:58 -0000 In message , Jeff Roberson writes: > On Thu, 22 Mar 2018, Cy Schubert wrote: > > > It broke i386 too. > > I just did > TARGET_ARCH=i386 make buildworld > TARGET_ARCH=i386 make buildkernel > > This worked for me? > > Jeff hmmm. make TARGET=i386 TARGET_ARCH=i386 buildkernel --- vm_reserv.o --- In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:48: In file included from /opt/src/svn-current/sys/sys/counter.h:37: ./machine/counter.h:174:3: error: implicit declaration of function 'critical_enter' is invalid in C99 [-Werror,-Wimplicit-function-declarat ion] critical_enter(); ^ ./machine/counter.h:174:3: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] ./machine/counter.h:176:3: error: implicit declaration of function 'critical_exit' is invalid in C99 [-Werror,-Wimplicit-function-declarati on] critical_exit(); ^ ./machine/counter.h:176:3: note: did you mean 'critical_enter'? ./machine/counter.h:174:3: note: 'critical_enter' declared here critical_enter(); ^ ./machine/counter.h:176:3: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] critical_exit(); ^ In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:57: /opt/src/svn-current/sys/sys/systm.h:217:6: error: conflicting types for 'critical_enter' void critical_enter(void); ^ ./machine/counter.h:174:3: note: previous implicit declaration is here critical_enter(); ^ In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:57: /opt/src/svn-current/sys/sys/systm.h:218:6: error: conflicting types for 'critical_exit' void critical_exit(void); ^ ./machine/counter.h:176:3: note: previous implicit declaration is here critical_exit(); ^ 6 errors generated. *** [vm_reserv.o] Error code 1 make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK --- modules-all --- A failure has been detected in another branch of the parallel make make[3]: stopped in /opt/src/svn-current/sys/modules *** [modules-all] Error code 2 make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK 2 errors make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK *** [buildkernel] Error code 2 make[1]: stopped in /opt/src/svn-current 1 error make[1]: stopped in /opt/src/svn-current *** [buildkernel] Error code 2 make: stopped in /opt/src/svn-current 1 error make: stopped in /opt/src/svn-current ~cy > > > > > Index: sys/vm/vm_reserv.c > > =================================================================== > > --- sys/vm/vm_reserv.c (revision 331399) > > +++ sys/vm/vm_reserv.c (working copy) > > @@ -45,8 +45,6 @@ > > > > #include > > #include > > -#include > > -#include > > #include > > #include > > #include > > @@ -55,6 +53,8 @@ > > #include > > #include > > #include > > +#include > > +#include > > #include > > #include > > > > This is because sys/i386/include/machine.h uses critical_enter() and > > critical_exit() which are defined in sys/systm.h. > > > > It built nicely on my amd64's though. > > > > ~cy > > > > In message , Jeff Roberson > > writes: > >> Thank you, working on it. I had done a make universe before getting > >> review feedback. > >> > >> Jeff > >> > >> On Thu, 22 Mar 2018, Justin Hibbits wrote: > >> > >>> This broke gcc builds. > >>> > >>> On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: > >>>> Author: jeff > >>>> Date: Thu Mar 22 19:21:11 2018 > >>>> New Revision: 331369 > >>>> URL: https://svnweb.freebsd.org/changeset/base/331369 > >>>> > >>>> Log: > >>>> Lock reservations with a dedicated lock in each reservation. Protect > th > >> e > >>>> vmd_free_count with atomics. > >>>> > >>>> This allows us to allocate and free from reservations without the free > l > >> ock > >>>> except where a superpage is allocated from the physical layer, which i > s > >>>> roughly 1/512 of the operations on amd64. > >>>> > >>>> Use the counter api to eliminate cache conention on counters. > >>>> > >>>> Reviewed by: markj > >>>> Tested by: pho > >>>> Sponsored by: Netflix, Dell/EMC Isilon > >>>> Differential Revision: https://reviews.freebsd.org/D14707 > >>>> > >>>> Modified: > >>>> head/sys/vm/vm_page.c > >>>> head/sys/vm/vm_pagequeue.h > >>>> head/sys/vm/vm_reserv.c > >>>> head/sys/vm/vm_reserv.h > >>>> > >>>> Modified: head/sys/vm/vm_page.c > >>>> ======================================================================== > == > >> ==== > >>>> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368 > ) > >>>> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369 > ) > >>>> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; > >>>> static void vm_page_alloc_check(vm_page_t m); > >>>> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebi > ts > >> ); > >>>> static void vm_page_enqueue(uint8_t queue, vm_page_t m); > >>>> -static void vm_page_free_phys(struct vm_domain *vmd, vm_page_t m); > >>>> static void vm_page_init(void *dummy); > >>>> static int vm_page_insert_after(vm_page_t m, vm_object_t object, > >>>> vm_pindex_t pindex, vm_page_t mpred); > >>>> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pinde > x_ > >> t pi > >>>> * for the request class and false otherwise. > >>>> */ > >>>> int > >>>> -vm_domain_available(struct vm_domain *vmd, int req, int npages) > >>>> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) > >>>> { > >>>> + u_int limit, old, new; > >>>> > >>>> - vm_domain_free_assert_locked(vmd); > >>>> req = req & VM_ALLOC_CLASS_MASK; > >>>> > >>>> /* > >>>> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int r > eq > >> , in > >>>> */ > >>>> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) > >>>> req = VM_ALLOC_SYSTEM; > >>>> + if (req == VM_ALLOC_INTERRUPT) > >>>> + limit = 0; > >>>> + else if (req == VM_ALLOC_SYSTEM) > >>>> + limit = vmd->vmd_interrupt_free_min; > >>>> + else > >>>> + limit = vmd->vmd_free_reserved; > >>>> > >>>> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || > >>>> - (req == VM_ALLOC_SYSTEM && > >>>> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) > | > >> | > >>>> - (req == VM_ALLOC_INTERRUPT && > >>>> - vmd->vmd_free_count >= npages)) > >>>> - return (1); > >>>> + /* > >>>> + * Attempt to reserve the pages. Fail if we're below the limit. > >>>> + */ > >>>> + limit += npages; > >>>> + old = vmd->vmd_free_count; > >>>> + do { > >>>> + if (old < limit) > >>>> + return (0); > >>>> + new = old - npages; > >>>> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == > 0) > >> ; > >>>> > >>>> - return (0); > >>>> + /* Wake the page daemon if we've crossed the threshold. */ > >>>> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) > >>>> + pagedaemon_wakeup(vmd->vmd_domain); > >>>> + > >>>> + /* Only update bitsets on transitions. */ > >>>> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || > >>>> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) > >>>> + vm_domain_set(vmd); > >>>> + > >>>> + return (1); > >>>> } > >>>> > >>>> vm_page_t > >>>> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, v > m_ > >> pind > >>>> again: > >>>> m = NULL; > >>>> #if VM_NRESERVLEVEL > 0 > >>>> + /* > >>>> + * Can we allocate the page from a reservation? > >>>> + */ > >>>> if (vm_object_reserv(object) && > >>>> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) > >>>> - != NULL) { > >>>> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) > != > >> NULL || > >>>> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred > )) > >> != NULL)) { > >>>> domain = vm_phys_domain(m); > >>>> vmd = VM_DOMAIN(domain); > >>>> goto found; > >>>> } > >>>> #endif > >>>> vmd = VM_DOMAIN(domain); > >>>> - vm_domain_free_lock(vmd); > >>>> - if (vm_domain_available(vmd, req, 1)) { > >>>> + if (vm_domain_allocate(vmd, req, 1)) { > >>>> /* > >>>> - * Can we allocate the page from a reservation? > >>>> + * If not, allocate it from the free page queues. > >>>> */ > >>>> + vm_domain_free_lock(vmd); > >>>> + m = vm_phys_alloc_pages(domain, object != NULL ? > >>>> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > >>>> + vm_domain_free_unlock(vmd); > >>>> + if (m == NULL) { > >>>> + vm_domain_freecnt_inc(vmd, 1); > >>>> #if VM_NRESERVLEVEL > 0 > >>>> - if (!vm_object_reserv(object) || > >>>> - (m = vm_reserv_alloc_page(object, pindex, > >>>> - domain, mpred)) == NULL) > >>>> + if (vm_reserv_reclaim_inactive(domain)) > >>>> + goto again; > >>>> #endif > >>>> - { > >>>> - /* > >>>> - * If not, allocate it from the free page queues > . > >>>> - */ > >>>> - m = vm_phys_alloc_pages(domain, object != NULL ? > >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0) > ; > >>>> -#if VM_NRESERVLEVEL > 0 > >>>> - if (m == NULL && vm_reserv_reclaim_inactive(doma > in > >> )) { > >>>> - m = vm_phys_alloc_pages(domain, > >>>> - object != NULL ? > >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DI > RE > >> CT, > >>>> - 0); > >>>> - } > >>>> -#endif > >>>> } > >>>> } > >>>> - if (m != NULL) > >>>> - vm_domain_freecnt_dec(vmd, 1); > >>>> - vm_domain_free_unlock(vmd); > >>>> if (m == NULL) { > >>>> /* > >>>> * Not allocatable, give up. > >>>> @@ -1775,9 +1783,7 @@ again: > >>>> */ > >>>> KASSERT(m != NULL, ("missing page")); > >>>> > >>>> -#if VM_NRESERVLEVEL > 0 > >>>> found: > >>>> -#endif > >>> > >>> 'found' is now declared, but unused on powerpc64. > >>> > >>> - Justin > >>> > >> > > > > -- > > Cheers, > > Cy Schubert > > FreeBSD UNIX: Web: http://www.FreeBSD.org > > > > The need of the many outweighs the greed of the few. > > > > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Fri Mar 23 01:54:52 2018 Return-Path: Delivered-To: svn-src-head@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 259D3F5ECB3 for ; Fri, 23 Mar 2018 01:54:52 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pl0-x22f.google.com (mail-pl0-x22f.google.com [IPv6:2607:f8b0:400e:c01::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 92A0378DC4 for ; Fri, 23 Mar 2018 01:54:51 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pl0-x22f.google.com with SMTP id 61-v6so6548697plf.3 for ; Thu, 22 Mar 2018 18:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jroberson-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=MVU0zafikC46w4TBpJGlh8R5GnA9t0lQUm9f9KFpLlU=; b=L4Xd6JazxwhQXktjhRnFew4npiTIy9VtK7xhrcGbygneHEgDJOiQR1L3fQpO9afVXc woapbD54UfNVAA29hPFjGdkm5U5am/vhBiqrycukTKYdteOhC8keuOgKbHGwcDGDDoFW 8exYuzlF6vvtPekrE/+fPdVr5KCW+sWOOMkNIFreU4VRhSTZgOVEHcBd6BetTZQpfHrx aGbbwXayQBg+xUfC81LpsBprUpGQtt2CiQ4+iB23Utpy7+nCs+Id3ydLRRUQZ++BePTl 2XNa7PNv/0VpWumLutNNW3FbjZR2C+s3a+fHEN72I7m+gzoqRIdMOD1qvkaB54HNRFkr jqjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=MVU0zafikC46w4TBpJGlh8R5GnA9t0lQUm9f9KFpLlU=; b=fPStF0U8JRo1W60EDt5bBK89RXx/1cIS9KYRVxSIGTT76dX0xFFyiP6Sf9uvTAtj38 1+P7upt/cNj4M2LwQwmA9dl+MDRYDF81ZQ8Iv2H7+fFF3VnNXvlhIBMX2Nyxqf1gUaEB zhKjhajq809+Jf5XtcDkAsQX2xjw4G5Jfk4k+mlBMVJIXV+lvPSrVOnQ9V6jmBWlIoWc 02xXe39cyUlQmschySzxL6sjPlPbVfq3p6M86ZDPIa6tTc8xXHohgzZNojE8SzSbCONJ uDsemE3KT8U3tFa60t8WpX2Gc6aK+rpd27DyrrxPlQAsud4iXW64KHKSC4MWxFUXR+tJ 219Q== X-Gm-Message-State: AElRT7ESgv18HFceMY4GLuhOguPf/i492MACFpW5pUeQhPAMfvZeOt2D E6djBzGmqX0XhtgnIcagUOR9OA== X-Google-Smtp-Source: AG47ELs4Q9rnFsYq/uhxzdgW2Y/BAOOSZKZznIQGo7lFntn6yFX9q3C0Duk7UK2AZq7bv+DXvGC67w== X-Received: by 2002:a17:902:28c4:: with SMTP id f62-v6mr6916138plb.19.1521770090551; Thu, 22 Mar 2018 18:54:50 -0700 (PDT) Received: from rrcs-66-91-135-210.west.biz.rr.com (rrcs-66-91-135-210.west.biz.rr.com. [66.91.135.210]) by smtp.gmail.com with ESMTPSA id n187sm4218926pfn.8.2018.03.22.18.54.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 18:54:49 -0700 (PDT) Date: Thu, 22 Mar 2018 15:53:51 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Cy Schubert cc: Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: <201803230150.w2N1omDY036179@slippy.cwsent.com> Message-ID: References: <201803230150.w2N1omDY036179@slippy.cwsent.com> User-Agent: Alpine 2.21 (BSF 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 01:54:52 -0000 On Thu, 22 Mar 2018, Cy Schubert wrote: > In message , Jeff Roberson > writes: >> On Thu, 22 Mar 2018, Cy Schubert wrote: >> >>> It broke i386 too. >> >> I just did >> TARGET_ARCH=i386 make buildworld >> TARGET_ARCH=i386 make buildkernel >> >> This worked for me? >> >> Jeff > > hmmm. > > make TARGET=i386 TARGET_ARCH=i386 buildkernel Do you have changes to GENERIC? Thanks, Jeff > > --- vm_reserv.o --- > In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:48: > In file included from /opt/src/svn-current/sys/sys/counter.h:37: > ./machine/counter.h:174:3: error: implicit declaration of function > 'critical_enter' is invalid in C99 [-Werror,-Wimplicit-function-declarat > ion] > critical_enter(); > ^ > ./machine/counter.h:174:3: error: this function declaration is not a > prototype [-Werror,-Wstrict-prototypes] > ./machine/counter.h:176:3: error: implicit declaration of function > 'critical_exit' is invalid in C99 [-Werror,-Wimplicit-function-declarati > on] > critical_exit(); > ^ > ./machine/counter.h:176:3: note: did you mean 'critical_enter'? > ./machine/counter.h:174:3: note: 'critical_enter' declared here > critical_enter(); > ^ > ./machine/counter.h:176:3: error: this function declaration is not a > prototype [-Werror,-Wstrict-prototypes] > critical_exit(); > ^ > In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:57: > /opt/src/svn-current/sys/sys/systm.h:217:6: error: conflicting types > for 'critical_enter' > void critical_enter(void); > ^ > ./machine/counter.h:174:3: note: previous implicit declaration is here > critical_enter(); > ^ > In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:57: > /opt/src/svn-current/sys/sys/systm.h:218:6: error: conflicting types > for 'critical_exit' > void critical_exit(void); > ^ > ./machine/counter.h:176:3: note: previous implicit declaration is here > critical_exit(); > ^ > 6 errors generated. > *** [vm_reserv.o] Error code 1 > > make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK > --- modules-all --- > A failure has been detected in another branch of the parallel make > > make[3]: stopped in /opt/src/svn-current/sys/modules > *** [modules-all] Error code 2 > > make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK > 2 errors > > make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK > *** [buildkernel] Error code 2 > > make[1]: stopped in /opt/src/svn-current > 1 error > > make[1]: stopped in /opt/src/svn-current > *** [buildkernel] Error code 2 > > make: stopped in /opt/src/svn-current > 1 error > > make: stopped in /opt/src/svn-current > > ~cy > >> >>> >>> Index: sys/vm/vm_reserv.c >>> =================================================================== >>> --- sys/vm/vm_reserv.c (revision 331399) >>> +++ sys/vm/vm_reserv.c (working copy) >>> @@ -45,8 +45,6 @@ >>> >>> #include >>> #include >>> -#include >>> -#include >>> #include >>> #include >>> #include >>> @@ -55,6 +53,8 @@ >>> #include >>> #include >>> #include >>> +#include >>> +#include >>> #include >>> #include >>> >>> This is because sys/i386/include/machine.h uses critical_enter() and >>> critical_exit() which are defined in sys/systm.h. >>> >>> It built nicely on my amd64's though. >>> >>> ~cy >>> >>> In message , Jeff Roberson >>> writes: >>>> Thank you, working on it. I had done a make universe before getting >>>> review feedback. >>>> >>>> Jeff >>>> >>>> On Thu, 22 Mar 2018, Justin Hibbits wrote: >>>> >>>>> This broke gcc builds. >>>>> >>>>> On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: >>>>>> Author: jeff >>>>>> Date: Thu Mar 22 19:21:11 2018 >>>>>> New Revision: 331369 >>>>>> URL: https://svnweb.freebsd.org/changeset/base/331369 >>>>>> >>>>>> Log: >>>>>> Lock reservations with a dedicated lock in each reservation. Protect >> th >>>> e >>>>>> vmd_free_count with atomics. >>>>>> >>>>>> This allows us to allocate and free from reservations without the free >> l >>>> ock >>>>>> except where a superpage is allocated from the physical layer, which i >> s >>>>>> roughly 1/512 of the operations on amd64. >>>>>> >>>>>> Use the counter api to eliminate cache conention on counters. >>>>>> >>>>>> Reviewed by: markj >>>>>> Tested by: pho >>>>>> Sponsored by: Netflix, Dell/EMC Isilon >>>>>> Differential Revision: https://reviews.freebsd.org/D14707 >>>>>> >>>>>> Modified: >>>>>> head/sys/vm/vm_page.c >>>>>> head/sys/vm/vm_pagequeue.h >>>>>> head/sys/vm/vm_reserv.c >>>>>> head/sys/vm/vm_reserv.h >>>>>> >>>>>> Modified: head/sys/vm/vm_page.c >>>>>> ======================================================================== >> == >>>> ==== >>>>>> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368 >> ) >>>>>> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369 >> ) >>>>>> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; >>>>>> static void vm_page_alloc_check(vm_page_t m); >>>>>> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebi >> ts >>>> ); >>>>>> static void vm_page_enqueue(uint8_t queue, vm_page_t m); >>>>>> -static void vm_page_free_phys(struct vm_domain *vmd, vm_page_t m); >>>>>> static void vm_page_init(void *dummy); >>>>>> static int vm_page_insert_after(vm_page_t m, vm_object_t object, >>>>>> vm_pindex_t pindex, vm_page_t mpred); >>>>>> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pinde >> x_ >>>> t pi >>>>>> * for the request class and false otherwise. >>>>>> */ >>>>>> int >>>>>> -vm_domain_available(struct vm_domain *vmd, int req, int npages) >>>>>> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) >>>>>> { >>>>>> + u_int limit, old, new; >>>>>> >>>>>> - vm_domain_free_assert_locked(vmd); >>>>>> req = req & VM_ALLOC_CLASS_MASK; >>>>>> >>>>>> /* >>>>>> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int r >> eq >>>> , in >>>>>> */ >>>>>> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) >>>>>> req = VM_ALLOC_SYSTEM; >>>>>> + if (req == VM_ALLOC_INTERRUPT) >>>>>> + limit = 0; >>>>>> + else if (req == VM_ALLOC_SYSTEM) >>>>>> + limit = vmd->vmd_interrupt_free_min; >>>>>> + else >>>>>> + limit = vmd->vmd_free_reserved; >>>>>> >>>>>> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || >>>>>> - (req == VM_ALLOC_SYSTEM && >>>>>> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) >> | >>>> | >>>>>> - (req == VM_ALLOC_INTERRUPT && >>>>>> - vmd->vmd_free_count >= npages)) >>>>>> - return (1); >>>>>> + /* >>>>>> + * Attempt to reserve the pages. Fail if we're below the limit. >>>>>> + */ >>>>>> + limit += npages; >>>>>> + old = vmd->vmd_free_count; >>>>>> + do { >>>>>> + if (old < limit) >>>>>> + return (0); >>>>>> + new = old - npages; >>>>>> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == >> 0) >>>> ; >>>>>> >>>>>> - return (0); >>>>>> + /* Wake the page daemon if we've crossed the threshold. */ >>>>>> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) >>>>>> + pagedaemon_wakeup(vmd->vmd_domain); >>>>>> + >>>>>> + /* Only update bitsets on transitions. */ >>>>>> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || >>>>>> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) >>>>>> + vm_domain_set(vmd); >>>>>> + >>>>>> + return (1); >>>>>> } >>>>>> >>>>>> vm_page_t >>>>>> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, v >> m_ >>>> pind >>>>>> again: >>>>>> m = NULL; >>>>>> #if VM_NRESERVLEVEL > 0 >>>>>> + /* >>>>>> + * Can we allocate the page from a reservation? >>>>>> + */ >>>>>> if (vm_object_reserv(object) && >>>>>> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) >>>>>> - != NULL) { >>>>>> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) >> != >>>> NULL || >>>>>> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred >> )) >>>> != NULL)) { >>>>>> domain = vm_phys_domain(m); >>>>>> vmd = VM_DOMAIN(domain); >>>>>> goto found; >>>>>> } >>>>>> #endif >>>>>> vmd = VM_DOMAIN(domain); >>>>>> - vm_domain_free_lock(vmd); >>>>>> - if (vm_domain_available(vmd, req, 1)) { >>>>>> + if (vm_domain_allocate(vmd, req, 1)) { >>>>>> /* >>>>>> - * Can we allocate the page from a reservation? >>>>>> + * If not, allocate it from the free page queues. >>>>>> */ >>>>>> + vm_domain_free_lock(vmd); >>>>>> + m = vm_phys_alloc_pages(domain, object != NULL ? >>>>>> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); >>>>>> + vm_domain_free_unlock(vmd); >>>>>> + if (m == NULL) { >>>>>> + vm_domain_freecnt_inc(vmd, 1); >>>>>> #if VM_NRESERVLEVEL > 0 >>>>>> - if (!vm_object_reserv(object) || >>>>>> - (m = vm_reserv_alloc_page(object, pindex, >>>>>> - domain, mpred)) == NULL) >>>>>> + if (vm_reserv_reclaim_inactive(domain)) >>>>>> + goto again; >>>>>> #endif >>>>>> - { >>>>>> - /* >>>>>> - * If not, allocate it from the free page queues >> . >>>>>> - */ >>>>>> - m = vm_phys_alloc_pages(domain, object != NULL ? >>>>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0) >> ; >>>>>> -#if VM_NRESERVLEVEL > 0 >>>>>> - if (m == NULL && vm_reserv_reclaim_inactive(doma >> in >>>> )) { >>>>>> - m = vm_phys_alloc_pages(domain, >>>>>> - object != NULL ? >>>>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DI >> RE >>>> CT, >>>>>> - 0); >>>>>> - } >>>>>> -#endif >>>>>> } >>>>>> } >>>>>> - if (m != NULL) >>>>>> - vm_domain_freecnt_dec(vmd, 1); >>>>>> - vm_domain_free_unlock(vmd); >>>>>> if (m == NULL) { >>>>>> /* >>>>>> * Not allocatable, give up. >>>>>> @@ -1775,9 +1783,7 @@ again: >>>>>> */ >>>>>> KASSERT(m != NULL, ("missing page")); >>>>>> >>>>>> -#if VM_NRESERVLEVEL > 0 >>>>>> found: >>>>>> -#endif >>>>> >>>>> 'found' is now declared, but unused on powerpc64. >>>>> >>>>> - Justin >>>>> >>>> >>> >>> -- >>> Cheers, >>> Cy Schubert >>> FreeBSD UNIX: Web: http://www.FreeBSD.org >>> >>> The need of the many outweighs the greed of the few. >>> >>> > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: http://www.FreeBSD.org > > The need of the many outweighs the greed of the few. > > From owner-svn-src-head@freebsd.org Fri Mar 23 02:15:08 2018 Return-Path: Delivered-To: svn-src-head@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 ABC6DF60375; Fri, 23 Mar 2018 02:15:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 596B8797F3; Fri, 23 Mar 2018 02:15:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FE6119B47; Fri, 23 Mar 2018 02:15:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N2F7bP070734; Fri, 23 Mar 2018 02:15:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2F6wL070720; Fri, 23 Mar 2018 02:15:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803230215.w2N2F6wL070720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Mar 2018 02:15:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331404 - in head: cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/contrib/opensolaris/uts/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/u... X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/contrib/opensolaris/uts/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys sys/... X-SVN-Commit-Revision: 331404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:15:08 -0000 Author: mav Date: Fri Mar 23 02:15:05 2018 New Revision: 331404 URL: https://svnweb.freebsd.org/changeset/base/331404 Log: MFV r331400: 8484 Implement aggregate sum and use for arc counters In pursuit of improving performance on multi-core systems, we should implements fanned out counters and use them to improve the performance of some of the arc statistics. These stats are updated extremely frequently, and can consume a significant amount of CPU time. Reviewed by: Pavel Zakharov Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Paul Dagnelie Added: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash - copied unchanged from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip - copied unchanged from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.c - copied unchanged from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/aggsum.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/cityhash.c - copied unchanged from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/cityhash.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h - copied, changed from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/aggsum.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/cityhash.h - copied unchanged from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/cityhash.h Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h head/sys/conf/files Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Fri Mar 23 01:43:27 2018 (r331403) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Fri Mar 23 02:15:05 2018 (r331404) @@ -559,6 +559,7 @@ extern void delay(clock_t ticks); } while (0); #define max_ncpus 64 +#define boot_ncpus (sysconf(_SC_NPROCESSORS_ONLN)) #define minclsyspri 60 #define maxclsyspri 99 Modified: head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Fri Mar 23 01:43:27 2018 (r331403) +++ head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Fri Mar 23 02:15:05 2018 (r331404) @@ -63,12 +63,14 @@ LUA_OBJS += \ ZFS_COMMON_OBJS += \ abd.o \ + aggsum.o \ arc.o \ bplist.o \ blkptr.o \ bpobj.o \ bptree.o \ bqueue.o \ + cityhash.o \ dbuf.o \ ddt.o \ ddt_zap.o \ Copied: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash (from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash Fri Mar 23 02:15:05 2018 (r331404, copy of r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash) @@ -0,0 +1,19 @@ +Copyright (c) 2011 Google, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. Copied: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip (from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip Fri Mar 23 02:15:05 2018 (r331404, copy of r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip) @@ -0,0 +1 @@ +CITYHASH CHECKSUM FUNCTIONALITY IN ZFS Copied: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.c (from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/aggsum.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.c Fri Mar 23 02:15:05 2018 (r331404, copy of r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/aggsum.c) @@ -0,0 +1,232 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2017 by Delphix. All rights reserved. + */ + +#include +#include + +/* + * Aggregate-sum counters are a form of fanned-out counter, used when atomic + * instructions on a single field cause enough CPU cache line contention to + * slow system performance. Due to their increased overhead and the expense + * involved with precisely reading from them, they should only be used in cases + * where the write rate (increment/decrement) is much higher than the read rate + * (get value). + * + * Aggregate sum counters are comprised of two basic parts, the core and the + * buckets. The core counter contains a lock for the entire counter, as well + * as the current upper and lower bounds on the value of the counter. The + * aggsum_bucket structure contains a per-bucket lock to protect the contents of + * the bucket, the current amount that this bucket has changed from the global + * counter (called the delta), and the amount of increment and decrement we have + * "borrowed" from the core counter. + * + * The basic operation of an aggsum is simple. Threads that wish to modify the + * counter will modify one bucket's counter (determined by their current CPU, to + * help minimize lock and cache contention). If the bucket already has + * sufficient capacity borrowed from the core structure to handle their request, + * they simply modify the delta and return. If the bucket does not, we clear + * the bucket's current state (to prevent the borrowed amounts from getting too + * large), and borrow more from the core counter. Borrowing is done by adding to + * the upper bound (or subtracting from the lower bound) of the core counter, + * and setting the borrow value for the bucket to the amount added (or + * subtracted). Clearing the bucket is the opposite; we add the current delta + * to both the lower and upper bounds of the core counter, subtract the borrowed + * incremental from the upper bound, and add the borrowed decrement from the + * lower bound. Note that only borrowing and clearing require access to the + * core counter; since all other operations access CPU-local resources, + * performance can be much higher than a traditional counter. + * + * Threads that wish to read from the counter have a slightly more challenging + * task. It is fast to determine the upper and lower bounds of the aggum; this + * does not require grabbing any locks. This suffices for cases where an + * approximation of the aggsum's value is acceptable. However, if one needs to + * know whether some specific value is above or below the current value in the + * aggsum, they invoke aggsum_compare(). This function operates by repeatedly + * comparing the target value to the upper and lower bounds of the aggsum, and + * then clearing a bucket. This proceeds until the target is outside of the + * upper and lower bounds and we return a response, or the last bucket has been + * cleared and we know that the target is equal to the aggsum's value. Finally, + * the most expensive operation is determining the precise value of the aggsum. + * To do this, we clear every bucket and then return the upper bound (which must + * be equal to the lower bound). What makes aggsum_compare() and aggsum_value() + * expensive is clearing buckets. This involves grabbing the global lock + * (serializing against themselves and borrow operations), grabbing a bucket's + * lock (preventing threads on those CPUs from modifying their delta), and + * zeroing out the borrowed value (forcing that thread to borrow on its next + * request, which will also be expensive). This is what makes aggsums well + * suited for write-many read-rarely operations. + */ + +/* + * We will borrow aggsum_borrow_multiplier times the current request, so we will + * have to get the as_lock approximately every aggsum_borrow_multiplier calls to + * aggsum_delta(). + */ +static uint_t aggsum_borrow_multiplier = 10; + +void +aggsum_init(aggsum_t *as, uint64_t value) +{ + bzero(as, sizeof (*as)); + as->as_lower_bound = as->as_upper_bound = value; + mutex_init(&as->as_lock, NULL, MUTEX_DEFAULT, NULL); + as->as_numbuckets = boot_ncpus; + as->as_buckets = kmem_zalloc(boot_ncpus * sizeof (aggsum_bucket_t), + KM_SLEEP); + for (int i = 0; i < as->as_numbuckets; i++) { + mutex_init(&as->as_buckets[i].asc_lock, + NULL, MUTEX_DEFAULT, NULL); + } +} + +void +aggsum_fini(aggsum_t *as) +{ + for (int i = 0; i < as->as_numbuckets; i++) + mutex_destroy(&as->as_buckets[i].asc_lock); + mutex_destroy(&as->as_lock); +} + +int64_t +aggsum_lower_bound(aggsum_t *as) +{ + return (as->as_lower_bound); +} + +int64_t +aggsum_upper_bound(aggsum_t *as) +{ + return (as->as_upper_bound); +} + +static void +aggsum_flush_bucket(aggsum_t *as, struct aggsum_bucket *asb) +{ + ASSERT(MUTEX_HELD(&as->as_lock)); + ASSERT(MUTEX_HELD(&asb->asc_lock)); + + /* + * We use atomic instructions for this because we read the upper and + * lower bounds without the lock, so we need stores to be atomic. + */ + atomic_add_64((volatile uint64_t *)&as->as_lower_bound, asb->asc_delta); + atomic_add_64((volatile uint64_t *)&as->as_upper_bound, asb->asc_delta); + asb->asc_delta = 0; + atomic_add_64((volatile uint64_t *)&as->as_upper_bound, + -asb->asc_borrowed); + atomic_add_64((volatile uint64_t *)&as->as_lower_bound, + asb->asc_borrowed); + asb->asc_borrowed = 0; +} + +uint64_t +aggsum_value(aggsum_t *as) +{ + int64_t rv; + + mutex_enter(&as->as_lock); + if (as->as_lower_bound == as->as_upper_bound) { + rv = as->as_lower_bound; + for (int i = 0; i < as->as_numbuckets; i++) { + ASSERT0(as->as_buckets[i].asc_delta); + ASSERT0(as->as_buckets[i].asc_borrowed); + } + mutex_exit(&as->as_lock); + return (rv); + } + for (int i = 0; i < as->as_numbuckets; i++) { + struct aggsum_bucket *asb = &as->as_buckets[i]; + mutex_enter(&asb->asc_lock); + aggsum_flush_bucket(as, asb); + mutex_exit(&asb->asc_lock); + } + VERIFY3U(as->as_lower_bound, ==, as->as_upper_bound); + rv = as->as_lower_bound; + mutex_exit(&as->as_lock); + + return (rv); +} + +static void +aggsum_borrow(aggsum_t *as, int64_t delta, struct aggsum_bucket *asb) +{ + int64_t abs_delta = (delta < 0 ? -delta : delta); + mutex_enter(&as->as_lock); + mutex_enter(&asb->asc_lock); + + aggsum_flush_bucket(as, asb); + + atomic_add_64((volatile uint64_t *)&as->as_upper_bound, abs_delta); + atomic_add_64((volatile uint64_t *)&as->as_lower_bound, -abs_delta); + asb->asc_borrowed = abs_delta; + + mutex_exit(&asb->asc_lock); + mutex_exit(&as->as_lock); +} + +void +aggsum_add(aggsum_t *as, int64_t delta) +{ + struct aggsum_bucket *asb = + &as->as_buckets[CPU_SEQID % as->as_numbuckets]; + + for (;;) { + mutex_enter(&asb->asc_lock); + if (asb->asc_delta + delta <= (int64_t)asb->asc_borrowed && + asb->asc_delta + delta >= -(int64_t)asb->asc_borrowed) { + asb->asc_delta += delta; + mutex_exit(&asb->asc_lock); + return; + } + mutex_exit(&asb->asc_lock); + aggsum_borrow(as, delta * aggsum_borrow_multiplier, asb); + } +} + +/* + * Compare the aggsum value to target efficiently. Returns -1 if the value + * represented by the aggsum is less than target, 1 if it's greater, and 0 if + * they are equal. + */ +int +aggsum_compare(aggsum_t *as, uint64_t target) +{ + if (as->as_upper_bound < target) + return (-1); + if (as->as_lower_bound > target) + return (1); + mutex_enter(&as->as_lock); + for (int i = 0; i < as->as_numbuckets; i++) { + struct aggsum_bucket *asb = &as->as_buckets[i]; + mutex_enter(&asb->asc_lock); + aggsum_flush_bucket(as, asb); + mutex_exit(&asb->asc_lock); + if (as->as_upper_bound < target) { + mutex_exit(&as->as_lock); + return (-1); + } + if (as->as_lower_bound > target) { + mutex_exit(&as->as_lock); + return (1); + } + } + VERIFY3U(as->as_lower_bound, ==, as->as_upper_bound); + ASSERT3U(as->as_lower_bound, ==, target); + mutex_exit(&as->as_lock); + return (0); +} Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Mar 23 01:43:27 2018 (r331403) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Mar 23 02:15:05 2018 (r331404) @@ -275,6 +275,8 @@ #include #include #include +#include +#include #include @@ -561,6 +563,7 @@ typedef struct arc_stats { kstat_named_t arcstat_c; kstat_named_t arcstat_c_min; kstat_named_t arcstat_c_max; + /* Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_size; /* * Number of compressed bytes stored in the arc_buf_hdr_t's b_pabd. @@ -589,12 +592,14 @@ typedef struct arc_stats { * (allocated via arc_buf_hdr_t_full and arc_buf_hdr_t_l2only * caches), and arc_buf_t structures (allocated via arc_buf_t * cache). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_hdr_size; /* * Number of bytes consumed by ARC buffers of type equal to * ARC_BUFC_DATA. This is generally consumed by buffers backing * on disk user data (e.g. plain file contents). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_data_size; /* @@ -602,6 +607,7 @@ typedef struct arc_stats { * ARC_BUFC_METADATA. This is generally consumed by buffers * backing on disk data that is used for internal ZFS * structures (e.g. ZAP, dnode, indirect blocks, etc). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_metadata_size; /* @@ -610,6 +616,7 @@ typedef struct arc_stats { * buffers (allocated directly via zio_buf_* functions), * dmu_buf_impl_t structures (allocated via dmu_buf_impl_t * cache), and dnode_t structures (allocated via dnode_t cache). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_other_size; /* @@ -617,6 +624,7 @@ typedef struct arc_stats { * arc_anon state. This includes *all* buffers in the arc_anon * state; e.g. data, metadata, evictable, and unevictable buffers * are all included in this value. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_anon_size; /* @@ -624,6 +632,7 @@ typedef struct arc_stats { * following criteria: backing buffers of type ARC_BUFC_DATA, * residing in the arc_anon state, and are eligible for eviction * (e.g. have no outstanding holds on the buffer). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_anon_evictable_data; /* @@ -631,6 +640,7 @@ typedef struct arc_stats { * following criteria: backing buffers of type ARC_BUFC_METADATA, * residing in the arc_anon state, and are eligible for eviction * (e.g. have no outstanding holds on the buffer). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_anon_evictable_metadata; /* @@ -638,6 +648,7 @@ typedef struct arc_stats { * arc_mru state. This includes *all* buffers in the arc_mru * state; e.g. data, metadata, evictable, and unevictable buffers * are all included in this value. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_size; /* @@ -645,6 +656,7 @@ typedef struct arc_stats { * following criteria: backing buffers of type ARC_BUFC_DATA, * residing in the arc_mru state, and are eligible for eviction * (e.g. have no outstanding holds on the buffer). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_evictable_data; /* @@ -652,6 +664,7 @@ typedef struct arc_stats { * following criteria: backing buffers of type ARC_BUFC_METADATA, * residing in the arc_mru state, and are eligible for eviction * (e.g. have no outstanding holds on the buffer). + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_evictable_metadata; /* @@ -662,18 +675,21 @@ typedef struct arc_stats { * don't actually have ARC buffers linked off of these headers. * Thus, *if* the headers had associated ARC buffers, these * buffers *would have* consumed this number of bytes. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_ghost_size; /* * Number of bytes that *would have been* consumed by ARC * buffers that are eligible for eviction, of type * ARC_BUFC_DATA, and linked off the arc_mru_ghost state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_ghost_evictable_data; /* * Number of bytes that *would have been* consumed by ARC * buffers that are eligible for eviction, of type * ARC_BUFC_METADATA, and linked off the arc_mru_ghost state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mru_ghost_evictable_metadata; /* @@ -681,36 +697,42 @@ typedef struct arc_stats { * arc_mfu state. This includes *all* buffers in the arc_mfu * state; e.g. data, metadata, evictable, and unevictable buffers * are all included in this value. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_size; /* * Number of bytes consumed by ARC buffers that are eligible for * eviction, of type ARC_BUFC_DATA, and reside in the arc_mfu * state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_evictable_data; /* * Number of bytes consumed by ARC buffers that are eligible for * eviction, of type ARC_BUFC_METADATA, and reside in the * arc_mfu state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_evictable_metadata; /* * Total number of bytes that *would have been* consumed by ARC * buffers in the arc_mfu_ghost state. See the comment above * arcstat_mru_ghost_size for more details. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_ghost_size; /* * Number of bytes that *would have been* consumed by ARC * buffers that are eligible for eviction, of type * ARC_BUFC_DATA, and linked off the arc_mfu_ghost state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_ghost_evictable_data; /* * Number of bytes that *would have been* consumed by ARC * buffers that are eligible for eviction, of type * ARC_BUFC_METADATA, and linked off the arc_mru_ghost state. + * Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_mfu_ghost_evictable_metadata; kstat_named_t arcstat_l2_hits; @@ -732,6 +754,7 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_io_error; kstat_named_t arcstat_l2_lsize; kstat_named_t arcstat_l2_psize; + /* Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_l2_hdr_size; kstat_named_t arcstat_l2_write_trylock_fail; kstat_named_t arcstat_l2_write_passed_headroom; @@ -746,6 +769,7 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_write_buffer_list_iter; kstat_named_t arcstat_l2_write_buffer_list_null_iter; kstat_named_t arcstat_memory_throttle_count; + /* Not updated directly; only synced in arc_kstat_update. */ kstat_named_t arcstat_meta_used; kstat_named_t arcstat_meta_limit; kstat_named_t arcstat_meta_max; @@ -905,14 +929,12 @@ static arc_state_t *arc_l2c_only; * the possibility of inconsistency by having shadow copies of the variables, * while still allowing the code to be readable. */ -#define arc_size ARCSTAT(arcstat_size) /* actual total arc size */ #define arc_p ARCSTAT(arcstat_p) /* target size of MRU */ #define arc_c ARCSTAT(arcstat_c) /* target size of cache */ #define arc_c_min ARCSTAT(arcstat_c_min) /* min target cache size */ #define arc_c_max ARCSTAT(arcstat_c_max) /* max target cache size */ #define arc_meta_limit ARCSTAT(arcstat_meta_limit) /* max size for metadata */ #define arc_meta_min ARCSTAT(arcstat_meta_min) /* min size for metadata */ -#define arc_meta_used ARCSTAT(arcstat_meta_used) /* size of metadata */ #define arc_meta_max ARCSTAT(arcstat_meta_max) /* max size of metadata */ /* compressed size of entire arc */ @@ -922,6 +944,22 @@ static arc_state_t *arc_l2c_only; /* number of bytes in the arc from arc_buf_t's */ #define arc_overhead_size ARCSTAT(arcstat_overhead_size) +/* + * There are also some ARC variables that we want to export, but that are + * updated so often that having the canonical representation be the statistic + * variable causes a performance bottleneck. We want to use aggsum_t's for these + * instead, but still be able to export the kstat in the same way as before. + * The solution is to always use the aggsum version, except in the kstat update + * callback. + */ +aggsum_t arc_size; +aggsum_t arc_meta_used; +aggsum_t astat_data_size; +aggsum_t astat_metadata_size; +aggsum_t astat_hdr_size; +aggsum_t astat_other_size; +aggsum_t astat_l2_hdr_size; + static int arc_no_grow; /* Don't try to grow cache size */ static uint64_t arc_tempreserve; static uint64_t arc_loaned_bytes; @@ -1433,21 +1471,14 @@ l2arc_trim(const arc_buf_hdr_t *hdr) } } +/* + * We use Cityhash for this. It's fast, and has good hash properties without + * requiring any large static buffers. + */ static uint64_t buf_hash(uint64_t spa, const dva_t *dva, uint64_t birth) { - uint8_t *vdva = (uint8_t *)dva; - uint64_t crc = -1ULL; - int i; - - ASSERT(zfs_crc64_table[128] == ZFS_CRC64_POLY); - - for (i = 0; i < sizeof (dva_t); i++) - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ vdva[i]) & 0xFF]; - - crc ^= (spa>>8) ^ birth; - - return (crc); + return (cityhash4(spa, dva->dva_word[0], dva->dva_word[1], birth)); } #define HDR_EMPTY(hdr) \ @@ -2643,26 +2674,26 @@ arc_space_consume(uint64_t space, arc_space_type_t typ switch (type) { case ARC_SPACE_DATA: - ARCSTAT_INCR(arcstat_data_size, space); + aggsum_add(&astat_data_size, space); break; case ARC_SPACE_META: - ARCSTAT_INCR(arcstat_metadata_size, space); + aggsum_add(&astat_metadata_size, space); break; case ARC_SPACE_OTHER: - ARCSTAT_INCR(arcstat_other_size, space); + aggsum_add(&astat_other_size, space); break; case ARC_SPACE_HDRS: - ARCSTAT_INCR(arcstat_hdr_size, space); + aggsum_add(&astat_hdr_size, space); break; case ARC_SPACE_L2HDRS: - ARCSTAT_INCR(arcstat_l2_hdr_size, space); + aggsum_add(&astat_l2_hdr_size, space); break; } if (type != ARC_SPACE_DATA) - ARCSTAT_INCR(arcstat_meta_used, space); + aggsum_add(&arc_meta_used, space); - atomic_add_64(&arc_size, space); + aggsum_add(&arc_size, space); } void @@ -2672,31 +2703,36 @@ arc_space_return(uint64_t space, arc_space_type_t type switch (type) { case ARC_SPACE_DATA: - ARCSTAT_INCR(arcstat_data_size, -space); + aggsum_add(&astat_data_size, -space); break; case ARC_SPACE_META: - ARCSTAT_INCR(arcstat_metadata_size, -space); + aggsum_add(&astat_metadata_size, -space); break; case ARC_SPACE_OTHER: - ARCSTAT_INCR(arcstat_other_size, -space); + aggsum_add(&astat_other_size, -space); break; case ARC_SPACE_HDRS: - ARCSTAT_INCR(arcstat_hdr_size, -space); + aggsum_add(&astat_hdr_size, -space); break; case ARC_SPACE_L2HDRS: - ARCSTAT_INCR(arcstat_l2_hdr_size, -space); + aggsum_add(&astat_l2_hdr_size, -space); break; } if (type != ARC_SPACE_DATA) { - ASSERT(arc_meta_used >= space); - if (arc_meta_max < arc_meta_used) - arc_meta_max = arc_meta_used; - ARCSTAT_INCR(arcstat_meta_used, -space); + ASSERT(aggsum_compare(&arc_meta_used, space) >= 0); + /* + * We use the upper bound here rather than the precise value + * because the arc_meta_max value doesn't need to be + * precise. It's only consumed by humans via arcstats. + */ + if (arc_meta_max < aggsum_upper_bound(&arc_meta_used)) + arc_meta_max = aggsum_upper_bound(&arc_meta_used); + aggsum_add(&arc_meta_used, -space); } - ASSERT(arc_size >= space); - atomic_add_64(&arc_size, -space); + ASSERT(aggsum_compare(&arc_size, space) >= 0); + aggsum_add(&arc_size, -space); } /* @@ -3898,7 +3934,7 @@ arc_adjust_impl(arc_state_t *state, uint64_t spa, int6 * capped by the arc_meta_limit tunable. */ static uint64_t -arc_adjust_meta(void) +arc_adjust_meta(uint64_t meta_used) { uint64_t total_evicted = 0; int64_t target; @@ -3910,7 +3946,7 @@ arc_adjust_meta(void) * we're over the meta limit more than we're over arc_p, we * evict some from the MRU here, and some from the MFU below. */ - target = MIN((int64_t)(arc_meta_used - arc_meta_limit), + target = MIN((int64_t)(meta_used - arc_meta_limit), (int64_t)(refcount_count(&arc_anon->arcs_size) + refcount_count(&arc_mru->arcs_size) - arc_p)); @@ -3921,8 +3957,9 @@ arc_adjust_meta(void) * below the meta limit, but not so much as to drop us below the * space allotted to the MFU (which is defined as arc_c - arc_p). */ - target = MIN((int64_t)(arc_meta_used - arc_meta_limit), - (int64_t)(refcount_count(&arc_mfu->arcs_size) - (arc_c - arc_p))); + target = MIN((int64_t)(meta_used - arc_meta_limit), + (int64_t)(refcount_count(&arc_mfu->arcs_size) - + (arc_c - arc_p))); total_evicted += arc_adjust_impl(arc_mfu, 0, target, ARC_BUFC_METADATA); @@ -4013,12 +4050,14 @@ arc_adjust(void) uint64_t total_evicted = 0; uint64_t bytes; int64_t target; + uint64_t asize = aggsum_value(&arc_size); + uint64_t ameta = aggsum_value(&arc_meta_used); /* * If we're over arc_meta_limit, we want to correct that before * potentially evicting data buffers below. */ - total_evicted += arc_adjust_meta(); + total_evicted += arc_adjust_meta(ameta); /* * Adjust MRU size @@ -4030,9 +4069,9 @@ arc_adjust(void) * the MRU is over arc_p, we'll evict enough to get back to * arc_p here, and then evict more from the MFU below. */ - target = MIN((int64_t)(arc_size - arc_c), + target = MIN((int64_t)(asize - arc_c), (int64_t)(refcount_count(&arc_anon->arcs_size) + - refcount_count(&arc_mru->arcs_size) + arc_meta_used - arc_p)); + refcount_count(&arc_mru->arcs_size) + ameta - arc_p)); /* * If we're below arc_meta_min, always prefer to evict data. @@ -4043,7 +4082,7 @@ arc_adjust(void) * type, spill over into the next type. */ if (arc_adjust_type(arc_mru) == ARC_BUFC_METADATA && - arc_meta_used > arc_meta_min) { + ameta > arc_meta_min) { bytes = arc_adjust_impl(arc_mru, 0, target, ARC_BUFC_METADATA); total_evicted += bytes; @@ -4076,10 +4115,10 @@ arc_adjust(void) * size back to arc_p, if we're still above the target cache * size, we evict the rest from the MFU. */ - target = arc_size - arc_c; + target = asize - arc_c; if (arc_adjust_type(arc_mfu) == ARC_BUFC_METADATA && - arc_meta_used > arc_meta_min) { + ameta > arc_meta_min) { bytes = arc_adjust_impl(arc_mfu, 0, target, ARC_BUFC_METADATA); total_evicted += bytes; @@ -4180,6 +4219,7 @@ arc_flush(spa_t *spa, boolean_t retry) void arc_shrink(int64_t to_free) { + uint64_t asize = aggsum_value(&arc_size); if (arc_c > arc_c_min) { DTRACE_PROBE4(arc__shrink, uint64_t, arc_c, uint64_t, arc_c_min, uint64_t, arc_p, uint64_t, to_free); @@ -4189,8 +4229,8 @@ arc_shrink(int64_t to_free) arc_c = arc_c_min; atomic_add_64(&arc_p, -(arc_p >> arc_shrink_shift)); - if (arc_c > arc_size) - arc_c = MAX(arc_size, arc_c_min); + if (asize < arc_c) + arc_c = MAX(asize, arc_c_min); if (arc_p > arc_c) arc_p = (arc_c >> 1); @@ -4201,8 +4241,8 @@ arc_shrink(int64_t to_free) ASSERT((int64_t)arc_p >= 0); } - if (arc_size > arc_c) { - DTRACE_PROBE2(arc__shrink_adjust, uint64_t, arc_size, + if (asize > arc_c) { + DTRACE_PROBE2(arc__shrink_adjust, uint64_t, asize, uint64_t, arc_c); (void) arc_adjust(); } @@ -4383,7 +4423,7 @@ arc_kmem_reap_now(void) DTRACE_PROBE(arc__kmem_reap_start); #ifdef _KERNEL - if (arc_meta_used >= arc_meta_limit) { + if (aggsum_compare(&arc_meta_used, arc_meta_limit) >= 0) { /* * We are exceeding our meta-data cache limit. * Purge some DNLC entries to release holds on meta-data. @@ -4547,7 +4587,7 @@ arc_reclaim_thread(void *unused __unused) * be helpful and could potentially cause us to enter an * infinite loop. */ - if (arc_size <= arc_c || evicted == 0) { + if (aggsum_compare(&arc_size, arc_c) <= 0|| evicted == 0) { /* * We're either no longer overflowing, or we * can't evict anything more, so we should wake @@ -4680,7 +4720,8 @@ arc_adapt(int bytes, arc_state_t *state) * If we're within (2 * maxblocksize) bytes of the target * cache size, increment the target cache size */ - if (arc_size > arc_c - (2ULL << SPA_MAXBLOCKSHIFT)) { + if (aggsum_compare(&arc_size, arc_c - (2ULL << SPA_MAXBLOCKSHIFT)) > + 0) { DTRACE_PROBE1(arc__inc_adapt, int, bytes); atomic_add_64(&arc_c, (int64_t)bytes); if (arc_c > arc_c_max) @@ -4704,7 +4745,16 @@ arc_is_overflowing(void) uint64_t overflow = MAX(SPA_MAXBLOCKSIZE, arc_c >> zfs_arc_overflow_shift); - return (arc_size >= arc_c + overflow); + /* + * We just compare the lower bound here for performance reasons. Our + * primary goals are to make sure that the arc never grows without + * bound, and that it can reach its maximum size. This check + * accomplishes both goals. The maximum amount we could run over by is + * 2 * aggsum_borrow_multiplier * NUM_CPUS * the average size of a block + * in the ARC. In practice, that's in the tens of MB, which is low + * enough to be safe. + */ + return (aggsum_lower_bound(&arc_size) >= arc_c + overflow); } static abd_t * @@ -4819,7 +4869,8 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, v * If we are growing the cache, and we are adding anonymous * data, and we have outgrown arc_p, update arc_p */ - if (arc_size < arc_c && hdr->b_l1hdr.b_state == arc_anon && + if (aggsum_compare(&arc_size, arc_c) < 0 && + hdr->b_l1hdr.b_state == arc_anon && (refcount_count(&arc_anon->arcs_size) + refcount_count(&arc_mru->arcs_size) > arc_p)) arc_p = MIN(arc_c, arc_p + size); @@ -6273,6 +6324,15 @@ arc_kstat_update(kstat_t *ksp, int rw) &as->arcstat_mfu_ghost_size, &as->arcstat_mfu_ghost_evictable_data, &as->arcstat_mfu_ghost_evictable_metadata); + + ARCSTAT(arcstat_size) = aggsum_value(&arc_size); + ARCSTAT(arcstat_meta_used) = aggsum_value(&arc_meta_used); + ARCSTAT(arcstat_data_size) = aggsum_value(&astat_data_size); + ARCSTAT(arcstat_metadata_size) = + aggsum_value(&astat_metadata_size); + ARCSTAT(arcstat_hdr_size) = aggsum_value(&astat_hdr_size); + ARCSTAT(arcstat_other_size) = aggsum_value(&astat_other_size); + ARCSTAT(arcstat_l2_hdr_size) = aggsum_value(&astat_l2_hdr_size); } return (0); @@ -6405,6 +6465,14 @@ arc_state_init(void) refcount_create(&arc_mfu->arcs_size); refcount_create(&arc_mfu_ghost->arcs_size); refcount_create(&arc_l2c_only->arcs_size); + + aggsum_init(&arc_meta_used, 0); + aggsum_init(&arc_size, 0); + aggsum_init(&astat_data_size, 0); + aggsum_init(&astat_metadata_size, 0); + aggsum_init(&astat_hdr_size, 0); + aggsum_init(&astat_other_size, 0); + aggsum_init(&astat_l2_hdr_size, 0); } static void @@ -6509,7 +6577,6 @@ arc_init(void) arc_c = arc_c_max; arc_p = (arc_c >> 1); - arc_size = 0; /* limit meta-data to 1/4 of the arc capacity */ arc_meta_limit = arc_c_max / 4; Copied: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/cityhash.c (from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/cityhash.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/cityhash.c Fri Mar 23 02:15:05 2018 (r331404, copy of r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/cityhash.c) @@ -0,0 +1,63 @@ +// Copyright (c) 2011 Google, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/* + * Copyright (c) 2017 by Delphix. All rights reserved. + */ + +#include + +#define HASH_K1 0xb492b66fbe98f273ULL +#define HASH_K2 0x9ae16a3b2f90404fULL + +/* + * Bitwise right rotate. Normally this will compile to a single + * instruction. + */ +static inline uint64_t +rotate(uint64_t val, int shift) +{ + // Avoid shifting by 64: doing so yields an undefined result. + return (shift == 0 ? val : (val >> shift) | (val << (64 - shift))); +} + +static inline uint64_t +cityhash_helper(uint64_t u, uint64_t v, uint64_t mul) +{ + uint64_t a = (u ^ v) * mul; + a ^= (a >> 47); + uint64_t b = (v ^ a) * mul; + b ^= (b >> 47); + b *= mul; + return (b); +} + +uint64_t +cityhash4(uint64_t w1, uint64_t w2, uint64_t w3, uint64_t w4) +{ + uint64_t mul = HASH_K2 + 64; + uint64_t a = w1 * HASH_K1; + uint64_t b = w2; + uint64_t c = w4 * mul; + uint64_t d = w3 * HASH_K2; + return (cityhash_helper(rotate(a + b, 43) + rotate(c, 30) + d, + a + rotate(b + HASH_K2, 18) + c, mul)); + +} Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Mar 23 01:43:27 2018 (r331403) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Mar 23 02:15:05 2018 (r331404) @@ -48,6 +48,7 @@ #include #include #include +#include uint_t zfs_dbuf_evict_key; @@ -177,23 +178,14 @@ static dbuf_hash_table_t dbuf_hash_table; static uint64_t dbuf_hash_count; +/* + * We use Cityhash for this. It's fast, and has good hash properties without + * requiring any large static buffers. + */ static uint64_t dbuf_hash(void *os, uint64_t obj, uint8_t lvl, uint64_t blkid) { - uintptr_t osv = (uintptr_t)os; - uint64_t crc = -1ULL; - - ASSERT(zfs_crc64_table[128] == ZFS_CRC64_POLY); - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (lvl)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (osv >> 6)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (obj >> 0)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (obj >> 8)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (blkid >> 0)) & 0xFF]; - crc = (crc >> 8) ^ zfs_crc64_table[(crc ^ (blkid >> 8)) & 0xFF]; - - crc ^= (osv>>14) ^ (obj>>16) ^ (blkid>>16); - - return (crc); + return (cityhash4((uintptr_t)os, obj, (uint64_t)lvl, blkid)); } #define DBUF_EQUAL(dbuf, os, obj, level, blkid) \ Copied and modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h (from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/aggsum.h) ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/aggsum.h Fri Mar 23 00:20:42 2018 (r331400, copy source) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h Fri Mar 23 02:15:05 2018 (r331404) @@ -25,8 +25,6 @@ extern "C" { #endif -#define CACHE_LINE_SIZE 64 - typedef struct aggsum_bucket { kmutex_t asc_lock; int64_t asc_delta; Copied: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/cityhash.h (from r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/cityhash.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/cityhash.h Fri Mar 23 02:15:05 2018 (r331404, copy of r331400, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/cityhash.h) @@ -0,0 +1,41 @@ +// Copyright (c) 2011 Google, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +/* + * Copyright (c) 2017 by Delphix. All rights reserved. + */ + +#ifndef _SYS_CITYHASH_H +#define _SYS_CITYHASH_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +uint64_t cityhash4(uint64_t, uint64_t, uint64_t, uint64_t); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_CITYHASH_H */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Fri Mar 23 01:43:27 2018 (r331403) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Fri Mar 23 02:15:05 2018 (r331404) @@ -114,6 +114,8 @@ extern "C" { #include #include +#define boot_ncpus (mp_ncpus) + #define CPU_SEQID (curcpu) #define tsd_create(keyp, destructor) do { \ Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Mar 23 01:43:27 2018 (r331403) +++ head/sys/conf/files Fri Mar 23 02:15:05 2018 (r331404) @@ -162,12 +162,14 @@ cddl/contrib/opensolaris/common/zfs/zpool_prop.c opt cddl/contrib/opensolaris/common/zfs/zprop_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/vnode.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/blkptr.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c optional zfs compile-with "${ZFS_C}" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Mar 23 02:24:53 2018 Return-Path: Delivered-To: svn-src-head@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 F3B31F61033; Fri, 23 Mar 2018 02:24:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 9C53B79FCC; Fri, 23 Mar 2018 02:24:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FF9A19CD6; Fri, 23 Mar 2018 02:24:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N2Oqu7075630; Fri, 23 Mar 2018 02:24:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2OqR3075629; Fri, 23 Mar 2018 02:24:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803230224.w2N2OqR3075629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Mar 2018 02:24:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331406 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 331406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:24:53 -0000 Author: mav Date: Fri Mar 23 02:24:52 2018 New Revision: 331406 URL: https://svnweb.freebsd.org/changeset/base/331406 Log: MFV r331405: 9084 spa_*_ashift must ignore spare devices illumos/illumos-gate@b037f3dbd69cef4a7ffd576ad33e07bfaf0b1e84 Reviewed by: Prashanth Sreenivasa Reviewed by: George Wilson Approved by: Dan McDonald Author: Prakash Surya Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Mar 23 02:22:16 2018 (r331405) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Mar 23 02:24:52 2018 (r331406) @@ -1589,14 +1589,6 @@ vdev_open(vdev_t *vd) return (error); } - if (vd->vdev_top == vd && vd->vdev_ashift != 0 && - !vd->vdev_isl2cache && !vd->vdev_islog) { - if (vd->vdev_ashift > spa->spa_max_ashift) - spa->spa_max_ashift = vd->vdev_ashift; - if (vd->vdev_ashift < spa->spa_min_ashift) - spa->spa_min_ashift = vd->vdev_ashift; - } - /* * Track the min and max ashift values for normal data devices. */ From owner-svn-src-head@freebsd.org Fri Mar 23 02:30:31 2018 Return-Path: Delivered-To: svn-src-head@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 CFE5BF617A8; Fri, 23 Mar 2018 02:30:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 7CBA17A4CC; Fri, 23 Mar 2018 02:30:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5956C19CDD; Fri, 23 Mar 2018 02:30:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N2UUwv075976; Fri, 23 Mar 2018 02:30:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2UTsL075973; Fri, 23 Mar 2018 02:30:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803230230.w2N2UTsL075973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Mar 2018 02:30:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331408 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 331408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:30:31 -0000 Author: mav Date: Fri Mar 23 02:30:29 2018 New Revision: 331408 URL: https://svnweb.freebsd.org/changeset/base/331408 Log: MFV r331407: 9213 zfs: sytem typo illumos/illumos-gate@edc8ef7d921c96b23969898aeb766cb24960bda7 Reviewed by: C Fraire Reviewed by: Andy Fiddaman Approved by: Joshua M. Clulow Author: Toomas Soome Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Fri Mar 23 02:28:37 2018 (r331407) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Fri Mar 23 02:30:29 2018 (r331408) @@ -2215,7 +2215,7 @@ zfs_do_upgrade(int argc, char **argv) if (cb.cb_numfailed != 0) ret = 1; } else { - /* List old-version filesytems */ + /* List old-version filesystems */ boolean_t found; (void) printf(gettext("This system is currently running " "ZFS filesystem version %llu.\n\n"), ZPL_VERSION); Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Fri Mar 23 02:28:37 2018 (r331407) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Fri Mar 23 02:30:29 2018 (r331408) @@ -1852,7 +1852,7 @@ show_import(nvlist_t *config) case ZPOOL_STATUS_UNSUP_FEAT_READ: (void) printf(gettext("status: The pool uses the following " - "feature(s) not supported on this sytem:\n")); + "feature(s) not supported on this system:\n")); zpool_print_unsup_feat(config); break; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Fri Mar 23 02:28:37 2018 (r331407) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Fri Mar 23 02:30:29 2018 (r331408) @@ -2369,7 +2369,7 @@ slow: /* * Determine whether Access should be granted/denied. * - * The least priv subsytem is always consulted as a basic privilege + * The least priv subsystem is always consulted as a basic privilege * can define any form of access. */ int From owner-svn-src-head@freebsd.org Fri Mar 23 02:34:54 2018 Return-Path: Delivered-To: svn-src-head@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 BAE7BF61FBE; Fri, 23 Mar 2018 02:34:54 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 1355D7ABD7; Fri, 23 Mar 2018 02:34:53 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id zCXUeB38KYxCTzCXWe5miT; Thu, 22 Mar 2018 20:34:46 -0600 X-Authority-Analysis: v=2.3 cv=cav8UELM c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=v2DPQv5-lfwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=4Q51EqK4VeBSQbaRQZ8A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id B12AD133F; Thu, 22 Mar 2018 19:34:44 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w2N2Yh4j004874; Thu, 22 Mar 2018 19:34:43 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w2N2YhAL004871; Thu, 22 Mar 2018 19:34:43 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201803230234.w2N2YhAL004871@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jeff Roberson cc: Cy Schubert , Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: Message from Jeff Roberson of "Thu, 22 Mar 2018 15:42:41 -1000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 22 Mar 2018 19:34:43 -0700 X-CMAE-Envelope: MS4wfB0ZMIE4LlEeSBoC2L7tm9oJvc+5ze027nK1LXx2/KaDHkOQ28jwWpiuLJY9J06DQwjRm5wH2Rn8eby6k/J89RWcd5LrFCj0ClYhkCXMaW3IT/+Ti3GH NbmA8hrp+sF/sUhqflFxp+4Na6aIfwVBaaYlcAc/VCVSEhe/JKI/YDeOS7Q1Csv1p5Xtksm4EVXWUv0j7BSqOjwRIYkemK1Z0+GFngyAL/7I7TjjnFobJeNb rf/bLbsT7M9QFigP2g6c49h351VgfSxPb8cvZmq+zHnAlUVLXgfGQpLGbuxRXQktwhXzvNvhQVSgCqdM9k31m07HqsOpGpDrfjY+P0MIKxJkk9UQ02LG6Ftw iBzQklnH X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:34:55 -0000 In message , Jeff Roberson writes: > On Thu, 22 Mar 2018, Cy Schubert wrote: > > > It broke i386 too. > > I believe I'm not able to reproduce this because it is a result of changes > in kernel config. I can not reproduce it so I can't verify the fix. > Since you can, would you mind committing? I see no problem with the diff > below. I don't mind. > > Thanks, > Jeff > > > > > Index: sys/vm/vm_reserv.c > > =================================================================== > > --- sys/vm/vm_reserv.c (revision 331399) > > +++ sys/vm/vm_reserv.c (working copy) > > @@ -45,8 +45,6 @@ > > > > #include > > #include > > -#include > > -#include > > #include > > #include > > #include > > @@ -55,6 +53,8 @@ > > #include > > #include > > #include > > +#include > > +#include > > #include > > #include > > > > This is because sys/i386/include/machine.h uses critical_enter() and > > critical_exit() which are defined in sys/systm.h. > > > > It built nicely on my amd64's though. > > > > ~cy > > > > In message , Jeff Roberson > > writes: > >> Thank you, working on it. I had done a make universe before getting > >> review feedback. > >> > >> Jeff > >> > >> On Thu, 22 Mar 2018, Justin Hibbits wrote: > >> > >>> This broke gcc builds. > >>> > >>> On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: > >>>> Author: jeff > >>>> Date: Thu Mar 22 19:21:11 2018 > >>>> New Revision: 331369 > >>>> URL: https://svnweb.freebsd.org/changeset/base/331369 > >>>> > >>>> Log: > >>>> Lock reservations with a dedicated lock in each reservation. Protect > th > >> e > >>>> vmd_free_count with atomics. > >>>> > >>>> This allows us to allocate and free from reservations without the free > l > >> ock > >>>> except where a superpage is allocated from the physical layer, which i > s > >>>> roughly 1/512 of the operations on amd64. > >>>> > >>>> Use the counter api to eliminate cache conention on counters. > >>>> > >>>> Reviewed by: markj > >>>> Tested by: pho > >>>> Sponsored by: Netflix, Dell/EMC Isilon > >>>> Differential Revision: https://reviews.freebsd.org/D14707 > >>>> > >>>> Modified: > >>>> head/sys/vm/vm_page.c > >>>> head/sys/vm/vm_pagequeue.h > >>>> head/sys/vm/vm_reserv.c > >>>> head/sys/vm/vm_reserv.h > >>>> > >>>> Modified: head/sys/vm/vm_page.c > >>>> ======================================================================== > == > >> ==== > >>>> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368 > ) > >>>> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369 > ) > >>>> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; > >>>> static void vm_page_alloc_check(vm_page_t m); > >>>> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebi > ts > >> ); > >>>> static void vm_page_enqueue(uint8_t queue, vm_page_t m); > >>>> -static void vm_page_free_phys(struct vm_domain *vmd, vm_page_t m); > >>>> static void vm_page_init(void *dummy); > >>>> static int vm_page_insert_after(vm_page_t m, vm_object_t object, > >>>> vm_pindex_t pindex, vm_page_t mpred); > >>>> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pinde > x_ > >> t pi > >>>> * for the request class and false otherwise. > >>>> */ > >>>> int > >>>> -vm_domain_available(struct vm_domain *vmd, int req, int npages) > >>>> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) > >>>> { > >>>> + u_int limit, old, new; > >>>> > >>>> - vm_domain_free_assert_locked(vmd); > >>>> req = req & VM_ALLOC_CLASS_MASK; > >>>> > >>>> /* > >>>> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int r > eq > >> , in > >>>> */ > >>>> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) > >>>> req = VM_ALLOC_SYSTEM; > >>>> + if (req == VM_ALLOC_INTERRUPT) > >>>> + limit = 0; > >>>> + else if (req == VM_ALLOC_SYSTEM) > >>>> + limit = vmd->vmd_interrupt_free_min; > >>>> + else > >>>> + limit = vmd->vmd_free_reserved; > >>>> > >>>> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || > >>>> - (req == VM_ALLOC_SYSTEM && > >>>> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) > | > >> | > >>>> - (req == VM_ALLOC_INTERRUPT && > >>>> - vmd->vmd_free_count >= npages)) > >>>> - return (1); > >>>> + /* > >>>> + * Attempt to reserve the pages. Fail if we're below the limit. > >>>> + */ > >>>> + limit += npages; > >>>> + old = vmd->vmd_free_count; > >>>> + do { > >>>> + if (old < limit) > >>>> + return (0); > >>>> + new = old - npages; > >>>> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == > 0) > >> ; > >>>> > >>>> - return (0); > >>>> + /* Wake the page daemon if we've crossed the threshold. */ > >>>> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) > >>>> + pagedaemon_wakeup(vmd->vmd_domain); > >>>> + > >>>> + /* Only update bitsets on transitions. */ > >>>> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || > >>>> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) > >>>> + vm_domain_set(vmd); > >>>> + > >>>> + return (1); > >>>> } > >>>> > >>>> vm_page_t > >>>> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, v > m_ > >> pind > >>>> again: > >>>> m = NULL; > >>>> #if VM_NRESERVLEVEL > 0 > >>>> + /* > >>>> + * Can we allocate the page from a reservation? > >>>> + */ > >>>> if (vm_object_reserv(object) && > >>>> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) > >>>> - != NULL) { > >>>> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) > != > >> NULL || > >>>> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred > )) > >> != NULL)) { > >>>> domain = vm_phys_domain(m); > >>>> vmd = VM_DOMAIN(domain); > >>>> goto found; > >>>> } > >>>> #endif > >>>> vmd = VM_DOMAIN(domain); > >>>> - vm_domain_free_lock(vmd); > >>>> - if (vm_domain_available(vmd, req, 1)) { > >>>> + if (vm_domain_allocate(vmd, req, 1)) { > >>>> /* > >>>> - * Can we allocate the page from a reservation? > >>>> + * If not, allocate it from the free page queues. > >>>> */ > >>>> + vm_domain_free_lock(vmd); > >>>> + m = vm_phys_alloc_pages(domain, object != NULL ? > >>>> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > >>>> + vm_domain_free_unlock(vmd); > >>>> + if (m == NULL) { > >>>> + vm_domain_freecnt_inc(vmd, 1); > >>>> #if VM_NRESERVLEVEL > 0 > >>>> - if (!vm_object_reserv(object) || > >>>> - (m = vm_reserv_alloc_page(object, pindex, > >>>> - domain, mpred)) == NULL) > >>>> + if (vm_reserv_reclaim_inactive(domain)) > >>>> + goto again; > >>>> #endif > >>>> - { > >>>> - /* > >>>> - * If not, allocate it from the free page queues > . > >>>> - */ > >>>> - m = vm_phys_alloc_pages(domain, object != NULL ? > >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0) > ; > >>>> -#if VM_NRESERVLEVEL > 0 > >>>> - if (m == NULL && vm_reserv_reclaim_inactive(doma > in > >> )) { > >>>> - m = vm_phys_alloc_pages(domain, > >>>> - object != NULL ? > >>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DI > RE > >> CT, > >>>> - 0); > >>>> - } > >>>> -#endif > >>>> } > >>>> } > >>>> - if (m != NULL) > >>>> - vm_domain_freecnt_dec(vmd, 1); > >>>> - vm_domain_free_unlock(vmd); > >>>> if (m == NULL) { > >>>> /* > >>>> * Not allocatable, give up. > >>>> @@ -1775,9 +1783,7 @@ again: > >>>> */ > >>>> KASSERT(m != NULL, ("missing page")); > >>>> > >>>> -#if VM_NRESERVLEVEL > 0 > >>>> found: > >>>> -#endif > >>> > >>> 'found' is now declared, but unused on powerpc64. > >>> > >>> - Justin > >>> > >> > > > > -- > > Cheers, > > Cy Schubert > > FreeBSD UNIX: Web: http://www.FreeBSD.org > > > > The need of the many outweighs the greed of the few. > > > > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Fri Mar 23 02:36:43 2018 Return-Path: Delivered-To: svn-src-head@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 6F5ADF622FC; Fri, 23 Mar 2018 02:36:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt0-x234.google.com (mail-qt0-x234.google.com [IPv6:2607:f8b0:400d:c0d::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0216B7ADF6; Fri, 23 Mar 2018 02:36:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt0-x234.google.com with SMTP id q11so11182651qtl.9; Thu, 22 Mar 2018 19:36:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=BvixQ4uByB/yZ8W/K8iK6nHz/H5dPuXCD8nkN4rLwjg=; b=KFHYVWgLd9fkUr4WH6qAlDCLTp8uuw6iD7torv52vBO9U07zbhriCEDYom+oUaTKYb w6/azmBY2bC7yAhQz2iHy/24hgxAO5ZS8SMhSZpu5y7sIJ3yCrclC8r6WVLdgPtQ7uRe HNI6mKLqKHzwLhAhj5ZdcsuBw4c4sJ7V0GPMWeeqDwBj3DoTHdumfZfriZWwDCLpkMYP hQjN4SFFjC2BEfjVTc/ePcd7GlbRcszxRJo+MLma+gJCv6HZBIUEGDk2GLyR6lRxemzs +1YCu0oTmTWvqC/yN42jxy44VqiEMRdDjJFRHY9370U9UmgesbAYOLen9alZnLBku/4Z 6EIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=BvixQ4uByB/yZ8W/K8iK6nHz/H5dPuXCD8nkN4rLwjg=; b=nsODck0nYx4y7F8h7dcXTyiWZl25P/PvnoerL29rqIHdIt56ZS3qozJRV5Exxl6q2F ncXFQJoRdtdi+VexxM8B+KS1BkEloz1lurxxnyP9C71Qo1FBS3dQJXre9l+2qCGNgUw1 UgoiZxlTF2D1/n237vrp66A56ye4Yj+tmVaymVXT5kkpk4ree2P33iBrGUyH6DKfjDDr F5hRAlj/eLKaZY37PnP6QPpUMwIlmxcYN4sH3eiZVTb9MuBUYTpYjtZobKHsFPfGSy/v ImRE0HaVzX2KnVApDQe9+ds0oI3pvApm1ukjz935iglF5v/QaKipbJ91W+xJ/+VNqkqN 50tw== X-Gm-Message-State: AElRT7EQHGmarimDnucw6rc0LvX00VZRQADIE3LJVr8wueFymyNMVFO8 lOVxTy7HMHbm2cf9BNR3MIfBjAU8CD5aMMxbiUWuJg== X-Google-Smtp-Source: AG47ELuDdDGNle14rfWYPlbls+teCyMcVg49KaBjKaqZhYpqlgr94d8Z6DT/rHARcLneyvk261ypEo2dKT5VjB1VPCk= X-Received: by 10.237.62.243 with SMTP id o48mr37520818qtf.3.1521772602095; Thu, 22 Mar 2018 19:36:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.36.52 with HTTP; Thu, 22 Mar 2018 19:36:41 -0700 (PDT) In-Reply-To: <201803230215.w2N2F6wL070720@repo.freebsd.org> References: <201803230215.w2N2F6wL070720@repo.freebsd.org> From: Mateusz Guzik Date: Fri, 23 Mar 2018 03:36:41 +0100 Message-ID: Subject: Re: svn commit: r331404 - in head: cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/contrib/opensolaris/uts/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/u... To: Alexander Motin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:36:43 -0000 On Fri, Mar 23, 2018 at 3:15 AM, Alexander Motin wrote: > Author: mav > Date: Fri Mar 23 02:15:05 2018 > New Revision: 331404 > URL: https://svnweb.freebsd.org/changeset/base/331404 > > Log: > MFV r331400: 8484 Implement aggregate sum and use for arc counters > > In pursuit of improving performance on multi-core systems, we should > implements fanned out counters and use them to improve the performance of > some of the arc statistics. These stats are updated extremely frequently, > and can consume a significant amount of CPU time. > > > > Due to seriously fat locks this struct: typedef struct aggsum_bucket { kmutex_t asc_lock; int64_t asc_delta; uint64_t asc_borrowed; uint64_t asc_pad[4]; /* pad out to cache line (64 bytes) */ } aggsum_bucket_t __aligned(CACHE_LINE_SIZE); ends up using *two* cache lines. Without asc_pad the size is 48 bytes. asc_pad adds 4 * 8 = 32 which pushes it to the next line for no good reason. That said, I suggest #ifndefing it the field. -- Mateusz Guzik From owner-svn-src-head@freebsd.org Fri Mar 23 02:40:41 2018 Return-Path: Delivered-To: svn-src-head@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 BAAF8F6290D; Fri, 23 Mar 2018 02:40:40 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 170477B32C; Fri, 23 Mar 2018 02:40:39 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id zCdAegDbuU5pnzCdBemKPO; Thu, 22 Mar 2018 20:40:38 -0600 X-Authority-Analysis: v=2.3 cv=Tai4SyYh c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=v2DPQv5-lfwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=PkHr_DOy3S1xoynW2OsA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 0E35D1369; Thu, 22 Mar 2018 19:40:36 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w2N2eZJY005405; Thu, 22 Mar 2018 19:40:35 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w2N2eZDb005402; Thu, 22 Mar 2018 19:40:35 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201803230240.w2N2eZDb005402@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jeff Roberson cc: Cy Schubert , Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: Message from Jeff Roberson of "Thu, 22 Mar 2018 15:53:51 -1000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 22 Mar 2018 19:40:35 -0700 X-CMAE-Envelope: MS4wfHhV48vLNYhjVGlMO5/+uD96XunXltx11wdK3LDHTOh2H2b67yKcchO1v+/XBO2fhlJ4lKj6IQ6TbuuuUef1Z2z6wqVqrd5I7qPxMY8D+Ix48vs7X4jm 1b3ltrUXY8ez8evdE/x+SsnBWAI2TotGvewyzsRxuy4vyewzsAe9IgeMqd6InIU81cbARXmywQbV3y3a4S7Snu9gmLTRfOXHayh5yyPl5QaRr6tv1VzFjwBn oxhNhcXUrWMSXvlbvcKrffy5D+OEAV8lmu18vHgbgaBJvLMu0dUEZitm56hH6oM/ZY5iM2Z6d5dqnBIVSzmb88a5TRlu2Skr925lmseXVDqE6kDAfWkZ+itS AVsAiQiO X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:40:41 -0000 In message , Jeff Roberson writes: > On Thu, 22 Mar 2018, Cy Schubert wrote: > > > In message , Jeff Roberson > > writes: > >> On Thu, 22 Mar 2018, Cy Schubert wrote: > >> > >>> It broke i386 too. > >> > >> I just did > >> TARGET_ARCH=i386 make buildworld > >> TARGET_ARCH=i386 make buildkernel > >> > >> This worked for me? > >> > >> Jeff > > > > hmmm. > > > > make TARGET=i386 TARGET_ARCH=i386 buildkernel > > Do you have changes to GENERIC? Not to GENERIC but I used a different kernel by default that removes most drivers (as I load them dynamically -- single kernel different modules on each machine). Ahh but this particular i386 kernel I was building does not include INVARIANTS. sys/i386/include/counter.h at line 35 has: #ifdef INVARIANTS #include #endif sys/proc.h includes sys/systm.h. i386 without INVARIANTS will fail to build. With INVARIANTS i386 does build. I'll commit the fix. ~cy > > Thanks, > Jeff > > > > --- vm_reserv.o --- > > In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:48: > > In file included from /opt/src/svn-current/sys/sys/counter.h:37: > > ./machine/counter.h:174:3: error: implicit declaration of function > > 'critical_enter' is invalid in C99 [-Werror,-Wimplicit-function-declarat > > ion] > > critical_enter(); > > ^ > > ./machine/counter.h:174:3: error: this function declaration is not a > > prototype [-Werror,-Wstrict-prototypes] > > ./machine/counter.h:176:3: error: implicit declaration of function > > 'critical_exit' is invalid in C99 [-Werror,-Wimplicit-function-declarati > > on] > > critical_exit(); > > ^ > > ./machine/counter.h:176:3: note: did you mean 'critical_enter'? > > ./machine/counter.h:174:3: note: 'critical_enter' declared here > > critical_enter(); > > ^ > > ./machine/counter.h:176:3: error: this function declaration is not a > > prototype [-Werror,-Wstrict-prototypes] > > critical_exit(); > > ^ > > In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:57: > > /opt/src/svn-current/sys/sys/systm.h:217:6: error: conflicting types > > for 'critical_enter' > > void critical_enter(void); > > ^ > > ./machine/counter.h:174:3: note: previous implicit declaration is here > > critical_enter(); > > ^ > > In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:57: > > /opt/src/svn-current/sys/sys/systm.h:218:6: error: conflicting types > > for 'critical_exit' > > void critical_exit(void); > > ^ > > ./machine/counter.h:176:3: note: previous implicit declaration is here > > critical_exit(); > > ^ > > 6 errors generated. > > *** [vm_reserv.o] Error code 1 > > > > make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK > > --- modules-all --- > > A failure has been detected in another branch of the parallel make > > > > make[3]: stopped in /opt/src/svn-current/sys/modules > > *** [modules-all] Error code 2 > > > > make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK > > 2 errors > > > > make[2]: stopped in /export/obj/opt/src/svn-current/i386.i386/sys/BREAK > > *** [buildkernel] Error code 2 > > > > make[1]: stopped in /opt/src/svn-current > > 1 error > > > > make[1]: stopped in /opt/src/svn-current > > *** [buildkernel] Error code 2 > > > > make: stopped in /opt/src/svn-current > > 1 error > > > > make: stopped in /opt/src/svn-current > > > > ~cy > > > >> > >>> > >>> Index: sys/vm/vm_reserv.c > >>> =================================================================== > >>> --- sys/vm/vm_reserv.c (revision 331399) > >>> +++ sys/vm/vm_reserv.c (working copy) > >>> @@ -45,8 +45,6 @@ > >>> > >>> #include > >>> #include > >>> -#include > >>> -#include > >>> #include > >>> #include > >>> #include > >>> @@ -55,6 +53,8 @@ > >>> #include > >>> #include > >>> #include > >>> +#include > >>> +#include > >>> #include > >>> #include > >>> > >>> This is because sys/i386/include/machine.h uses critical_enter() and > >>> critical_exit() which are defined in sys/systm.h. > >>> > >>> It built nicely on my amd64's though. > >>> > >>> ~cy > >>> > >>> In message , Jeff Roberson > >>> writes: > >>>> Thank you, working on it. I had done a make universe before getting > >>>> review feedback. > >>>> > >>>> Jeff > >>>> > >>>> On Thu, 22 Mar 2018, Justin Hibbits wrote: > >>>> > >>>>> This broke gcc builds. > >>>>> > >>>>> On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote > : > >>>>>> Author: jeff > >>>>>> Date: Thu Mar 22 19:21:11 2018 > >>>>>> New Revision: 331369 > >>>>>> URL: https://svnweb.freebsd.org/changeset/base/331369 > >>>>>> > >>>>>> Log: > >>>>>> Lock reservations with a dedicated lock in each reservation. Protec > t > >> th > >>>> e > >>>>>> vmd_free_count with atomics. > >>>>>> > >>>>>> This allows us to allocate and free from reservations without the fr > ee > >> l > >>>> ock > >>>>>> except where a superpage is allocated from the physical layer, which > i > >> s > >>>>>> roughly 1/512 of the operations on amd64. > >>>>>> > >>>>>> Use the counter api to eliminate cache conention on counters. > >>>>>> > >>>>>> Reviewed by: markj > >>>>>> Tested by: pho > >>>>>> Sponsored by: Netflix, Dell/EMC Isilon > >>>>>> Differential Revision: https://reviews.freebsd.org/D14707 > >>>>>> > >>>>>> Modified: > >>>>>> head/sys/vm/vm_page.c > >>>>>> head/sys/vm/vm_pagequeue.h > >>>>>> head/sys/vm/vm_reserv.c > >>>>>> head/sys/vm/vm_reserv.h > >>>>>> > >>>>>> Modified: head/sys/vm/vm_page.c > >>>>>> ====================================================================== > == > >> == > >>>> ==== > >>>>>> --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r3313 > 68 > >> ) > >>>>>> +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r3313 > 69 > >> ) > >>>>>> @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; > >>>>>> static void vm_page_alloc_check(vm_page_t m); > >>>>>> static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t page > bi > >> ts > >>>> ); > >>>>>> static void vm_page_enqueue(uint8_t queue, vm_page_t m); > >>>>>> -static void vm_page_free_phys(struct vm_domain *vmd, vm_page_t m); > >>>>>> static void vm_page_init(void *dummy); > >>>>>> static int vm_page_insert_after(vm_page_t m, vm_object_t object, > >>>>>> vm_pindex_t pindex, vm_page_t mpred); > >>>>>> @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pin > de > >> x_ > >>>> t pi > >>>>>> * for the request class and false otherwise. > >>>>>> */ > >>>>>> int > >>>>>> -vm_domain_available(struct vm_domain *vmd, int req, int npages) > >>>>>> +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) > >>>>>> { > >>>>>> + u_int limit, old, new; > >>>>>> > >>>>>> - vm_domain_free_assert_locked(vmd); > >>>>>> req = req & VM_ALLOC_CLASS_MASK; > >>>>>> > >>>>>> /* > >>>>>> @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int > r > >> eq > >>>> , in > >>>>>> */ > >>>>>> if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) > >>>>>> req = VM_ALLOC_SYSTEM; > >>>>>> + if (req == VM_ALLOC_INTERRUPT) > >>>>>> + limit = 0; > >>>>>> + else if (req == VM_ALLOC_SYSTEM) > >>>>>> + limit = vmd->vmd_interrupt_free_min; > >>>>>> + else > >>>>>> + limit = vmd->vmd_free_reserved; > >>>>>> > >>>>>> - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || > >>>>>> - (req == VM_ALLOC_SYSTEM && > >>>>>> - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_mi > n) > >> | > >>>> | > >>>>>> - (req == VM_ALLOC_INTERRUPT && > >>>>>> - vmd->vmd_free_count >= npages)) > >>>>>> - return (1); > >>>>>> + /* > >>>>>> + * Attempt to reserve the pages. Fail if we're below the limi > t. > >>>>>> + */ > >>>>>> + limit += npages; > >>>>>> + old = vmd->vmd_free_count; > >>>>>> + do { > >>>>>> + if (old < limit) > >>>>>> + return (0); > >>>>>> + new = old - npages; > >>>>>> + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) = > = > >> 0) > >>>> ; > >>>>>> > >>>>>> - return (0); > >>>>>> + /* Wake the page daemon if we've crossed the threshold. */ > >>>>>> + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) > >>>>>> + pagedaemon_wakeup(vmd->vmd_domain); > >>>>>> + > >>>>>> + /* Only update bitsets on transitions. */ > >>>>>> + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || > >>>>>> + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe > )) > >>>>>> + vm_domain_set(vmd); > >>>>>> + > >>>>>> + return (1); > >>>>>> } > >>>>>> > >>>>>> vm_page_t > >>>>>> @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, > v > >> m_ > >>>> pind > >>>>>> again: > >>>>>> m = NULL; > >>>>>> #if VM_NRESERVLEVEL > 0 > >>>>>> + /* > >>>>>> + * Can we allocate the page from a reservation? > >>>>>> + */ > >>>>>> if (vm_object_reserv(object) && > >>>>>> - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) > >>>>>> - != NULL) { > >>>>>> + ((m = vm_reserv_extend(req, object, pindex, domain, mpred) > ) > >> != > >>>> NULL || > >>>>>> + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpr > ed > >> )) > >>>> != NULL)) { > >>>>>> domain = vm_phys_domain(m); > >>>>>> vmd = VM_DOMAIN(domain); > >>>>>> goto found; > >>>>>> } > >>>>>> #endif > >>>>>> vmd = VM_DOMAIN(domain); > >>>>>> - vm_domain_free_lock(vmd); > >>>>>> - if (vm_domain_available(vmd, req, 1)) { > >>>>>> + if (vm_domain_allocate(vmd, req, 1)) { > >>>>>> /* > >>>>>> - * Can we allocate the page from a reservation? > >>>>>> + * If not, allocate it from the free page queues. > >>>>>> */ > >>>>>> + vm_domain_free_lock(vmd); > >>>>>> + m = vm_phys_alloc_pages(domain, object != NULL ? > >>>>>> + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > >>>>>> + vm_domain_free_unlock(vmd); > >>>>>> + if (m == NULL) { > >>>>>> + vm_domain_freecnt_inc(vmd, 1); > >>>>>> #if VM_NRESERVLEVEL > 0 > >>>>>> - if (!vm_object_reserv(object) || > >>>>>> - (m = vm_reserv_alloc_page(object, pindex, > >>>>>> - domain, mpred)) == NULL) > >>>>>> + if (vm_reserv_reclaim_inactive(domain)) > >>>>>> + goto again; > >>>>>> #endif > >>>>>> - { > >>>>>> - /* > >>>>>> - * If not, allocate it from the free page queu > es > >> . > >>>>>> - */ > >>>>>> - m = vm_phys_alloc_pages(domain, object != NULL > ? > >>>>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, > 0) > >> ; > >>>>>> -#if VM_NRESERVLEVEL > 0 > >>>>>> - if (m == NULL && vm_reserv_reclaim_inactive(do > ma > >> in > >>>> )) { > >>>>>> - m = vm_phys_alloc_pages(domain, > >>>>>> - object != NULL ? > >>>>>> - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_ > DI > >> RE > >>>> CT, > >>>>>> - 0); > >>>>>> - } > >>>>>> -#endif > >>>>>> } > >>>>>> } > >>>>>> - if (m != NULL) > >>>>>> - vm_domain_freecnt_dec(vmd, 1); > >>>>>> - vm_domain_free_unlock(vmd); > >>>>>> if (m == NULL) { > >>>>>> /* > >>>>>> * Not allocatable, give up. > >>>>>> @@ -1775,9 +1783,7 @@ again: > >>>>>> */ > >>>>>> KASSERT(m != NULL, ("missing page")); > >>>>>> > >>>>>> -#if VM_NRESERVLEVEL > 0 > >>>>>> found: > >>>>>> -#endif > >>>>> > >>>>> 'found' is now declared, but unused on powerpc64. > >>>>> > >>>>> - Justin > >>>>> > >>>> > >>> > >>> -- > >>> Cheers, > >>> Cy Schubert > >>> FreeBSD UNIX: Web: http://www.FreeBSD.org > >>> > >>> The need of the many outweighs the greed of the few. > >>> > >>> > > > > -- > > Cheers, > > Cy Schubert > > FreeBSD UNIX: Web: http://www.FreeBSD.org > > > > The need of the many outweighs the greed of the few. > > > > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Fri Mar 23 02:45:09 2018 Return-Path: Delivered-To: svn-src-head@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 B8AE4F62F93; Fri, 23 Mar 2018 02:45:09 +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 6E3B27B81D; Fri, 23 Mar 2018 02:45:09 +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 659EC1A010; Fri, 23 Mar 2018 02:45:09 +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 w2N2j9g2085681; Fri, 23 Mar 2018 02:45:09 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2j9lt085680; Fri, 23 Mar 2018 02:45:09 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803230245.w2N2j9lt085680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Mar 2018 02:45:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331413 - head/sys/dev/efidev X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/efidev X-SVN-Commit-Revision: 331413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:45:09 -0000 Author: kevans Date: Fri Mar 23 02:45:09 2018 New Revision: 331413 URL: https://svnweb.freebsd.org/changeset/base/331413 Log: efidev: Drop a quick note in about efi_cfgtbl/efi_runtime There's no real annotation for it, so it's not immediately obvious to the unfamiliar that these pointers are to locations in the EFI runtime map unlike the system table pointer immediately above them. Modified: head/sys/dev/efidev/efirt.c Modified: head/sys/dev/efidev/efirt.c ============================================================================== --- head/sys/dev/efidev/efirt.c Fri Mar 23 02:38:31 2018 (r331412) +++ head/sys/dev/efidev/efirt.c Fri Mar 23 02:45:09 2018 (r331413) @@ -57,6 +57,11 @@ __FBSDID("$FreeBSD$"); #include static struct efi_systbl *efi_systbl; +/* + * The following pointers point to tables in the EFI runtime service data pages. + * Care should be taken to make sure that we've properly entered the EFI runtime + * environment (efi_enter()) before dereferencing them. + */ static struct efi_cfgtbl *efi_cfgtbl; static struct efi_rt *efi_runtime; From owner-svn-src-head@freebsd.org Fri Mar 23 02:50:39 2018 Return-Path: Delivered-To: svn-src-head@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 7E87CF636D1; Fri, 23 Mar 2018 02:50:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 304E87BB78; Fri, 23 Mar 2018 02:50:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 275591A01B; Fri, 23 Mar 2018 02:50:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N2odeu085925; Fri, 23 Mar 2018 02:50:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2odbi085924; Fri, 23 Mar 2018 02:50:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803230250.w2N2odbi085924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Mar 2018 02:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331414 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 331414 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 02:50:39 -0000 Author: mav Date: Fri Mar 23 02:50:38 2018 New Revision: 331414 URL: https://svnweb.freebsd.org/changeset/base/331414 Log: Reduce struct aggsum_bucket padding to fit into one cache line. Reported by: mjg Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h Fri Mar 23 02:45:09 2018 (r331413) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h Fri Mar 23 02:50:38 2018 (r331414) @@ -29,7 +29,7 @@ typedef struct aggsum_bucket { kmutex_t asc_lock; int64_t asc_delta; uint64_t asc_borrowed; - uint64_t asc_pad[4]; /* pad out to cache line (64 bytes) */ + uint64_t asc_pad[2]; /* pad out to cache line (64 bytes) */ } aggsum_bucket_t __aligned(CACHE_LINE_SIZE); /* From owner-svn-src-head@freebsd.org Fri Mar 23 03:22:30 2018 Return-Path: Delivered-To: svn-src-head@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 C1420F65BC1; Fri, 23 Mar 2018 03:22:30 +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 6E1EC7D1A5; Fri, 23 Mar 2018 03:22:30 +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 691D01A6F0; Fri, 23 Mar 2018 03:22:30 +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 w2N3MUxS006653; Fri, 23 Mar 2018 03:22:30 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N3MUbV006652; Fri, 23 Mar 2018 03:22:30 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201803230322.w2N3MUbV006652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 23 Mar 2018 03:22:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331415 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331415 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 03:22:30 -0000 Author: cy Date: Fri Mar 23 03:22:30 2018 New Revision: 331415 URL: https://svnweb.freebsd.org/changeset/base/331415 Log: Fix build on i386 without INVARIANTS following r331369. --- vm_reserv.o --- In file included from /opt/src/svn-current/sys/vm/vm_reserv.c:48: In file included from /opt/src/svn-current/sys/sys/counter.h:37: ./machine/counter.h:174:3: error: implicit declaration of function 'critical_enter' is invalid in C99 [-Werror,-Wimplicit-function-declarat ion] critical_enter(); Reviewed by: jeff@ Modified: head/sys/vm/vm_reserv.c Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Fri Mar 23 02:50:38 2018 (r331414) +++ head/sys/vm/vm_reserv.c Fri Mar 23 03:22:30 2018 (r331415) @@ -45,8 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include #include #include @@ -55,6 +53,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include From owner-svn-src-head@freebsd.org Fri Mar 23 03:48:46 2018 Return-Path: Delivered-To: svn-src-head@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 B81FDF67791; Fri, 23 Mar 2018 03:48:46 +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 665787DE5A; Fri, 23 Mar 2018 03:48:46 +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 615CB1AA29; Fri, 23 Mar 2018 03:48:46 +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 w2N3mk56017083; Fri, 23 Mar 2018 03:48:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N3mka2017081; Fri, 23 Mar 2018 03:48:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803230348.w2N3mka2017081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Mar 2018 03:48:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331416 - in head/stand: efi/libefi i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: efi/libefi i386/libi386 X-SVN-Commit-Revision: 331416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 03:48:46 -0000 Author: kevans Date: Fri Mar 23 03:48:45 2018 New Revision: 331416 URL: https://svnweb.freebsd.org/changeset/base/331416 Log: Loader consoles: Implement SGR 22, reset intensity MFC after: 3 days Modified: head/stand/efi/libefi/efi_console.c head/stand/i386/libi386/vidconsole.c Modified: head/stand/efi/libefi/efi_console.c ============================================================================== --- head/stand/efi/libefi/efi_console.c Fri Mar 23 03:22:30 2018 (r331415) +++ head/stand/efi/libefi/efi_console.c Fri Mar 23 03:48:45 2018 (r331416) @@ -383,6 +383,9 @@ efi_term_emu(int c) fg_c = bg_c; bg_c = t; break; + case 22: /* normal intensity */ + fg_c &= ~0x8; + break; case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: fg_c = ansi_col[args[i] - 30]; Modified: head/stand/i386/libi386/vidconsole.c ============================================================================== --- head/stand/i386/libi386/vidconsole.c Fri Mar 23 03:22:30 2018 (r331415) +++ head/stand/i386/libi386/vidconsole.c Fri Mar 23 03:48:45 2018 (r331416) @@ -449,6 +449,9 @@ vidc_term_emu(int c) fg_c = bg_c; bg_c = t; break; + case 22: /* normal intensity */ + fg_c &= ~0x8; + break; case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: fg_c = ansi_col[args[i] - 30]; From owner-svn-src-head@freebsd.org Fri Mar 23 04:31:20 2018 Return-Path: Delivered-To: svn-src-head@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 3403BF6A7E4; Fri, 23 Mar 2018 04:31:20 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 D71D67F5E1; Fri, 23 Mar 2018 04:31:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1BFD1B0C0; Fri, 23 Mar 2018 04:31:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N4VJ86039717; Fri, 23 Mar 2018 04:31:19 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N4VJV4039715; Fri, 23 Mar 2018 04:31:19 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803230431.w2N4VJV4039715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 23 Mar 2018 04:31:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331417 - head/tools/tools/crypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/tools/tools/crypto X-SVN-Commit-Revision: 331417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 04:31:20 -0000 Author: cem Date: Fri Mar 23 04:31:19 2018 New Revision: 331417 URL: https://svnweb.freebsd.org/changeset/base/331417 Log: Bring in JHB's cryptocheck tool It can be used to validate basic algorithm correctness on a variety of inputs, by comarison to openssl. While here, add some sanity to the crypto/Makefile. The tool may not be perfect, but getting it in tree where collaboration can happen is a nice first step. The pace of development outside of svn seems to have slowed down mid-2017. Obtained from: github bsdjhb/freebsd:cryptocheck Sponsored by: Dell EMC Isilon Added: head/tools/tools/crypto/cryptocheck.c (contents, props changed) Modified: head/tools/tools/crypto/Makefile Modified: head/tools/tools/crypto/Makefile ============================================================================== --- head/tools/tools/crypto/Makefile Fri Mar 23 03:48:45 2018 (r331416) +++ head/tools/tools/crypto/Makefile Fri Mar 23 04:31:19 2018 (r331417) @@ -1,5 +1,6 @@ # $FreeBSD$ # +# Copyright (c) 2018 Conrad Meyer # Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting # All rights reserved. # @@ -25,40 +26,23 @@ # SUCH DAMAGE. # -ALL= cryptotest cryptokeytest cryptostats \ +PROGS= cryptocheck cryptotest cryptokeytest cryptostats \ ubsecstats hifnstats ipsecstats safestats -BINDIR= /usr/local/bin +MAN= +BINDIR?= /usr/local/bin -all: ${ALL} +# cryptocheck: test symmetric crypto functions +LIBADD.cryptocheck+= crypto ssl util -# program to test asymmetric crypto functions -cryptokeytest: cryptokeytest.c - ${CC} -o cryptokeytest cryptokeytest.c -lcrypto +# cryptokeytest: test asymmetric crypto functions +LIBADD.cryptokeytest+= crypto -# program to dump statistics kept by the core crypto code -cryptostats: cryptostats.c - ${CC} -o cryptostats cryptostats.c +# cryptostats: dump statistics kept by the core crypto code +# ubsecstats: print statistics kept by the Broadcom driver +# hifnstats: print statistics kept by the HIFN driver +# safestats: statistics kept by the SafeNet driver +# ipsecstats: print statistics kept by fast ipsec -# program to print statistics kept by the Broadcom driver -ubsecstats: ubsecstats.c - ${CC} -o ubsecstats ubsecstats.c +CLEANFILES+= core a.out -# program to print statistics kept by the HIFN driver -hifnstats: hifnstats.c - ${CC} -o hifnstats hifnstats.c - -# program to print statistics kept by the SafeNet driver -safestats: safestats.c - ${CC} -o safestats safestats.c - -# program to print statistics kept by fast ipsec -ipsecstats: ipsecstats.c - ${CC} -o ipsecstats ipsecstats.c - -clean: - rm -f ${ALL} core a.out - -install: ${ALL} - for i in ${ALL}; do \ - install $$i ${DESTDIR}${BINDIR}; \ - done +.include Added: head/tools/tools/crypto/cryptocheck.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/crypto/cryptocheck.c Fri Mar 23 04:31:19 2018 (r331417) @@ -0,0 +1,1168 @@ +/*- + * Copyright (c) 2017 John Baldwin, + * Copyright (c) 2004 Sam Leffler, Errno Consulting + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGES. + * + * $FreeBSD$ + */ + +/* + * A different tool for checking hardware crypto support. Whereas + * cryptotest is focused on simple performance numbers, this tool is + * focused on correctness. For each crypto operation, it performs the + * operation once in software via OpenSSL and a second time via + * OpenCrypto and compares the results. + * + * cryptocheck [-vz] [-A aad length] [-a algorithm] [-d dev] [size ...] + * + * Options: + * -v Verbose. + * -z Run all algorithms on a variety of buffer sizes. + * + * Supported algorithms: + * all Run all tests + * hmac Run all hmac tests + * blkcipher Run all block cipher tests + * authenc Run all authenticated encryption tests + * aead Run all authenticated encryption with associated data + * tests + * + * HMACs: + * sha1 sha1 hmac + * sha256 256-bit sha2 hmac + * sha384 384-bit sha2 hmac + * sha512 512-bit sha2 hmac + * + * Block Ciphers: + * aes-cbc 128-bit aes cbc + * aes-cbc192 192-bit aes cbc + * aes-cbc256 256-bit aes cbc + * aes-ctr 128-bit aes ctr + * aes-ctr192 192-bit aes ctr + * aes-ctr256 256-bit aes ctr + * aes-xts 128-bit aes xts + * aes-xts256 256-bit aes xts + * + * Authenticated Encryption: + * + + * + * Authenticated Encryption with Associated Data: + * aes-gcm 128-bit aes gcm + * aes-gcm192 192-bit aes gcm + * aes-gcm256 256-bit aes gcm + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +/* XXX: Temporary hack */ +#ifndef COP_F_CIPHER_FIRST +#define COP_F_CIPHER_FIRST 0x0001 /* Cipher before MAC. */ +#endif + +struct alg { + const char *name; + int cipher; + int mac; + enum { T_HMAC, T_BLKCIPHER, T_AUTHENC, T_GCM } type; + const EVP_CIPHER *(*evp_cipher)(void); + const EVP_MD *(*evp_md)(void); +} algs[] = { + { .name = "sha1", .mac = CRYPTO_SHA1_HMAC, .type = T_HMAC, + .evp_md = EVP_sha1 }, + { .name = "sha256", .mac = CRYPTO_SHA2_256_HMAC, .type = T_HMAC, + .evp_md = EVP_sha256 }, + { .name = "sha384", .mac = CRYPTO_SHA2_384_HMAC, .type = T_HMAC, + .evp_md = EVP_sha384 }, + { .name = "sha512", .mac = CRYPTO_SHA2_512_HMAC, .type = T_HMAC, + .evp_md = EVP_sha512 }, + { .name = "aes-cbc", .cipher = CRYPTO_AES_CBC, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_128_cbc }, + { .name = "aes-cbc192", .cipher = CRYPTO_AES_CBC, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_192_cbc }, + { .name = "aes-cbc256", .cipher = CRYPTO_AES_CBC, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_256_cbc }, + { .name = "aes-ctr", .cipher = CRYPTO_AES_ICM, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_128_ctr }, + { .name = "aes-ctr192", .cipher = CRYPTO_AES_ICM, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_192_ctr }, + { .name = "aes-ctr256", .cipher = CRYPTO_AES_ICM, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_256_ctr }, + { .name = "aes-xts", .cipher = CRYPTO_AES_XTS, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_128_xts }, + { .name = "aes-xts256", .cipher = CRYPTO_AES_XTS, .type = T_BLKCIPHER, + .evp_cipher = EVP_aes_256_xts }, + { .name = "aes-gcm", .cipher = CRYPTO_AES_NIST_GCM_16, + .mac = CRYPTO_AES_128_NIST_GMAC, .type = T_GCM, + .evp_cipher = EVP_aes_128_gcm }, + { .name = "aes-gcm192", .cipher = CRYPTO_AES_NIST_GCM_16, + .mac = CRYPTO_AES_192_NIST_GMAC, .type = T_GCM, + .evp_cipher = EVP_aes_192_gcm }, + { .name = "aes-gcm256", .cipher = CRYPTO_AES_NIST_GCM_16, + .mac = CRYPTO_AES_256_NIST_GMAC, .type = T_GCM, + .evp_cipher = EVP_aes_256_gcm }, +}; + +static bool verbose; +static int crid; +static size_t aad_len; + +static void +usage(void) +{ + fprintf(stderr, + "usage: cryptocheck [-z] [-a algorithm] [-d dev] [size ...]\n"); + exit(1); +} + +static struct alg * +find_alg(const char *name) +{ + u_int i; + + for (i = 0; i < nitems(algs); i++) + if (strcasecmp(algs[i].name, name) == 0) + return (&algs[i]); + return (NULL); +} + +static struct alg * +build_authenc(struct alg *cipher, struct alg *hmac) +{ + static struct alg authenc; + char *name; + + assert(cipher->type == T_BLKCIPHER); + assert(hmac->type == T_HMAC); + memset(&authenc, 0, sizeof(authenc)); + asprintf(&name, "%s+%s", cipher->name, hmac->name); + authenc.name = name; + authenc.cipher = cipher->cipher; + authenc.mac = hmac->mac; + authenc.type = T_AUTHENC; + authenc.evp_cipher = cipher->evp_cipher; + authenc.evp_md = hmac->evp_md; + return (&authenc); +} + +static struct alg * +build_authenc_name(const char *name) +{ + struct alg *cipher, *hmac; + const char *hmac_name; + char *cp, *cipher_name; + + cp = strchr(name, '+'); + cipher_name = strndup(name, cp - name); + hmac_name = cp + 1; + cipher = find_alg(cipher_name); + free(cipher_name); + if (cipher == NULL) + errx(1, "Invalid cipher %s", cipher_name); + hmac = find_alg(hmac_name); + if (hmac == NULL) + errx(1, "Invalid hash %s", hmac_name); + return (build_authenc(cipher, hmac)); +} + +static int +devcrypto(void) +{ + static int fd = -1; + + if (fd < 0) { + fd = open("/dev/crypto", O_RDWR | O_CLOEXEC, 0); + if (fd < 0) + err(1, "/dev/crypto"); + } + return (fd); +} + +static int +crlookup(const char *devname) +{ + struct crypt_find_op find; + + if (strncmp(devname, "soft", 4) == 0) + return CRYPTO_FLAG_SOFTWARE; + + find.crid = -1; + strlcpy(find.name, devname, sizeof(find.name)); + if (ioctl(devcrypto(), CIOCFINDDEV, &find) == -1) + err(1, "ioctl(CIOCFINDDEV)"); + return (find.crid); +} + +const char * +crfind(int crid) +{ + static struct crypt_find_op find; + + if (crid == CRYPTO_FLAG_SOFTWARE) + return ("soft"); + else if (crid == CRYPTO_FLAG_HARDWARE) + return ("unknown"); + + bzero(&find, sizeof(find)); + find.crid = crid; + if (ioctl(devcrypto(), CRIOFINDDEV, &find) == -1) + err(1, "ioctl(CIOCFINDDEV): crid %d", crid); + return (find.name); +} + +static int +crget(void) +{ + int fd; + + if (ioctl(devcrypto(), CRIOGET, &fd) == -1) + err(1, "ioctl(CRIOGET)"); + if (fcntl(fd, F_SETFD, 1) == -1) + err(1, "fcntl(F_SETFD) (crget)"); + return fd; +} + +static char +rdigit(void) +{ + const char a[] = { + 0x10,0x54,0x11,0x48,0x45,0x12,0x4f,0x13,0x49,0x53,0x14,0x41, + 0x15,0x16,0x4e,0x55,0x54,0x17,0x18,0x4a,0x4f,0x42,0x19,0x01 + }; + return 0x20+a[random()%nitems(a)]; +} + +static char * +alloc_buffer(size_t len) +{ + char *buf; + size_t i; + + buf = malloc(len); + for (i = 0; i < len; i++) + buf[i] = rdigit(); + return (buf); +} + +static char * +generate_iv(size_t len, struct alg *alg) +{ + char *iv; + + iv = alloc_buffer(len); + switch (alg->cipher) { + case CRYPTO_AES_ICM: + /* Clear the low 32 bits of the IV to hold the counter. */ + iv[len - 4] = 0; + iv[len - 3] = 0; + iv[len - 2] = 0; + iv[len - 1] = 0; + break; + case CRYPTO_AES_XTS: + /* + * Clear the low 64-bits to only store a 64-bit block + * number. + */ + iv[len - 8] = 0; + iv[len - 7] = 0; + iv[len - 6] = 0; + iv[len - 5] = 0; + iv[len - 4] = 0; + iv[len - 3] = 0; + iv[len - 2] = 0; + iv[len - 1] = 0; + break; + } + return (iv); +} + +static bool +ocf_hmac(struct alg *alg, const char *buffer, size_t size, const char *key, + size_t key_len, char *digest, int *cridp) +{ + struct session2_op sop; + struct crypt_op cop; + int fd; + + memset(&sop, 0, sizeof(sop)); + memset(&cop, 0, sizeof(cop)); + sop.crid = crid; + sop.mackeylen = key_len; + sop.mackey = (char *)key; + sop.mac = alg->mac; + fd = crget(); + if (ioctl(fd, CIOCGSESSION2, &sop) < 0) { + warn("cryptodev %s HMAC not supported for device %s", + alg->name, crfind(crid)); + close(fd); + return (false); + } + + cop.ses = sop.ses; + cop.op = 0; + cop.len = size; + cop.src = (char *)buffer; + cop.dst = NULL; + cop.mac = digest; + cop.iv = NULL; + + if (ioctl(fd, CIOCCRYPT, &cop) < 0) { + warn("cryptodev %s (%zu) HMAC failed for device %s", alg->name, + size, crfind(crid)); + close(fd); + return (false); + } + + if (ioctl(fd, CIOCFSESSION, &sop.ses) < 0) + warn("ioctl(CIOCFSESSION)"); + + close(fd); + *cridp = sop.crid; + return (true); +} + +static void +run_hmac_test(struct alg *alg, size_t size) +{ + const EVP_MD *md; + char *key, *buffer; + u_int key_len, digest_len; + int crid; + char control_digest[EVP_MAX_MD_SIZE], test_digest[EVP_MAX_MD_SIZE]; + + memset(control_digest, 0x3c, sizeof(control_digest)); + memset(test_digest, 0x3c, sizeof(test_digest)); + + md = alg->evp_md(); + key_len = EVP_MD_size(md); + assert(EVP_MD_size(md) <= sizeof(control_digest)); + + key = alloc_buffer(key_len); + buffer = alloc_buffer(size); + + /* OpenSSL HMAC. */ + digest_len = sizeof(control_digest); + if (HMAC(md, key, key_len, (u_char *)buffer, size, + (u_char *)control_digest, &digest_len) == NULL) + errx(1, "OpenSSL %s (%zu) HMAC failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + + /* cryptodev HMAC. */ + if (!ocf_hmac(alg, buffer, size, key, key_len, test_digest, &crid)) + goto out; + if (memcmp(control_digest, test_digest, sizeof(control_digest)) != 0) { + if (memcmp(control_digest, test_digest, EVP_MD_size(md)) == 0) + printf("%s (%zu) mismatch in trailer:\n", + alg->name, size); + else + printf("%s (%zu) mismatch:\n", alg->name, size); + printf("control:\n"); + hexdump(control_digest, sizeof(control_digest), NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(test_digest, sizeof(test_digest), NULL, 0); + goto out; + } + + if (verbose) + printf("%s (%zu) matched (cryptodev device %s)\n", + alg->name, size, crfind(crid)); + +out: + free(buffer); + free(key); +} + +static void +openssl_cipher(struct alg *alg, const EVP_CIPHER *cipher, const char *key, + const char *iv, const char *input, char *output, size_t size, int enc) +{ + EVP_CIPHER_CTX *ctx; + int outl, total; + + ctx = EVP_CIPHER_CTX_new(); + if (ctx == NULL) + errx(1, "OpenSSL %s (%zu) ctx new failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + if (EVP_CipherInit_ex(ctx, cipher, NULL, (const u_char *)key, + (const u_char *)iv, enc) != 1) + errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_set_padding(ctx, 0); + if (EVP_CipherUpdate(ctx, (u_char *)output, &outl, + (const u_char *)input, size) != 1) + errx(1, "OpenSSL %s (%zu) cipher update failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + total = outl; + if (EVP_CipherFinal_ex(ctx, (u_char *)output + outl, &outl) != 1) + errx(1, "OpenSSL %s (%zu) cipher final failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + total += outl; + if (total != size) + errx(1, "OpenSSL %s (%zu) cipher size mismatch: %d", alg->name, + size, total); + EVP_CIPHER_CTX_free(ctx); +} + +static bool +ocf_cipher(struct alg *alg, const char *key, size_t key_len, + const char *iv, const char *input, char *output, size_t size, int enc, + int *cridp) +{ + struct session2_op sop; + struct crypt_op cop; + int fd; + + memset(&sop, 0, sizeof(sop)); + memset(&cop, 0, sizeof(cop)); + sop.crid = crid; + sop.keylen = key_len; + sop.key = (char *)key; + sop.cipher = alg->cipher; + fd = crget(); + if (ioctl(fd, CIOCGSESSION2, &sop) < 0) { + warn("cryptodev %s block cipher not supported for device %s", + alg->name, crfind(crid)); + close(fd); + return (false); + } + + cop.ses = sop.ses; + cop.op = enc ? COP_ENCRYPT : COP_DECRYPT; + cop.len = size; + cop.src = (char *)input; + cop.dst = output; + cop.mac = NULL; + cop.iv = (char *)iv; + + if (ioctl(fd, CIOCCRYPT, &cop) < 0) { + warn("cryptodev %s (%zu) block cipher failed for device %s", + alg->name, size, crfind(crid)); + close(fd); + return (false); + } + + if (ioctl(fd, CIOCFSESSION, &sop.ses) < 0) + warn("ioctl(CIOCFSESSION)"); + + close(fd); + *cridp = sop.crid; + return (true); +} + +static void +run_blkcipher_test(struct alg *alg, size_t size) +{ + const EVP_CIPHER *cipher; + char *buffer, *cleartext, *ciphertext; + char *iv, *key; + u_int iv_len, key_len; + int crid; + + cipher = alg->evp_cipher(); + if (size % EVP_CIPHER_block_size(cipher) != 0) { + if (verbose) + printf( + "%s (%zu): invalid buffer size (block size %d)\n", + alg->name, size, EVP_CIPHER_block_size(cipher)); + return; + } + + key_len = EVP_CIPHER_key_length(cipher); + iv_len = EVP_CIPHER_iv_length(cipher); + + key = alloc_buffer(key_len); + iv = generate_iv(iv_len, alg); + cleartext = alloc_buffer(size); + buffer = malloc(size); + ciphertext = malloc(size); + + /* OpenSSL cipher. */ + openssl_cipher(alg, cipher, key, iv, cleartext, ciphertext, size, 1); + if (size > 0 && memcmp(cleartext, ciphertext, size) == 0) + errx(1, "OpenSSL %s (%zu): cipher text unchanged", alg->name, + size); + openssl_cipher(alg, cipher, key, iv, ciphertext, buffer, size, 0); + if (memcmp(cleartext, buffer, size) != 0) { + printf("OpenSSL %s (%zu): cipher mismatch:", alg->name, size); + printf("original:\n"); + hexdump(cleartext, size, NULL, 0); + printf("decrypted:\n"); + hexdump(buffer, size, NULL, 0); + exit(1); + } + + /* OCF encrypt. */ + if (!ocf_cipher(alg, key, key_len, iv, cleartext, buffer, size, 1, + &crid)) + goto out; + if (memcmp(ciphertext, buffer, size) != 0) { + printf("%s (%zu) encryption mismatch:\n", alg->name, size); + printf("control:\n"); + hexdump(ciphertext, size, NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(buffer, size, NULL, 0); + goto out; + } + + /* OCF decrypt. */ + if (!ocf_cipher(alg, key, key_len, iv, ciphertext, buffer, size, 0, + &crid)) + goto out; + if (memcmp(cleartext, buffer, size) != 0) { + printf("%s (%zu) decryption mismatch:\n", alg->name, size); + printf("control:\n"); + hexdump(cleartext, size, NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(buffer, size, NULL, 0); + goto out; + } + + if (verbose) + printf("%s (%zu) matched (cryptodev device %s)\n", + alg->name, size, crfind(crid)); + +out: + free(ciphertext); + free(buffer); + free(cleartext); + free(iv); + free(key); +} + +static bool +ocf_authenc(struct alg *alg, const char *cipher_key, size_t cipher_key_len, + const char *iv, size_t iv_len, const char *auth_key, size_t auth_key_len, + const char *aad, size_t aad_len, const char *input, char *output, + size_t size, char *digest, int enc, int *cridp) +{ + struct session2_op sop; + int fd; + + memset(&sop, 0, sizeof(sop)); + sop.crid = crid; + sop.keylen = cipher_key_len; + sop.key = (char *)cipher_key; + sop.cipher = alg->cipher; + sop.mackeylen = auth_key_len; + sop.mackey = (char *)auth_key; + sop.mac = alg->mac; + fd = crget(); + if (ioctl(fd, CIOCGSESSION2, &sop) < 0) { + warn("cryptodev %s AUTHENC not supported for device %s", + alg->name, crfind(crid)); + close(fd); + return (false); + } + + if (aad_len != 0) { + struct crypt_aead caead; + + memset(&caead, 0, sizeof(caead)); + caead.ses = sop.ses; + caead.op = enc ? COP_ENCRYPT : COP_DECRYPT; + caead.flags = enc ? COP_F_CIPHER_FIRST : 0; + caead.len = size; + caead.aadlen = aad_len; + caead.ivlen = iv_len; + caead.src = (char *)input; + caead.dst = output; + caead.aad = (char *)aad; + caead.tag = digest; + caead.iv = (char *)iv; + + if (ioctl(fd, CIOCCRYPTAEAD, &caead) < 0) { + warn("cryptodev %s (%zu) failed for device %s", + alg->name, size, crfind(crid)); + close(fd); + return (false); + } + } else { + struct crypt_op cop; + + memset(&cop, 0, sizeof(cop)); + cop.ses = sop.ses; + cop.op = enc ? COP_ENCRYPT : COP_DECRYPT; + cop.flags = enc ? COP_F_CIPHER_FIRST : 0; + cop.len = size; + cop.src = (char *)input; + cop.dst = output; + cop.mac = digest; + cop.iv = (char *)iv; + + if (ioctl(fd, CIOCCRYPT, &cop) < 0) { + warn("cryptodev %s (%zu) AUTHENC failed for device %s", + alg->name, size, crfind(crid)); + close(fd); + return (false); + } + } + + if (ioctl(fd, CIOCFSESSION, &sop.ses) < 0) + warn("ioctl(CIOCFSESSION)"); + + close(fd); + *cridp = sop.crid; + return (true); +} + +static void +run_authenc_test(struct alg *alg, size_t size) +{ + const EVP_CIPHER *cipher; + const EVP_MD *md; + char *aad, *buffer, *cleartext, *ciphertext; + char *iv, *auth_key, *cipher_key; + u_int iv_len, auth_key_len, cipher_key_len, digest_len; + int crid; + char control_digest[EVP_MAX_MD_SIZE], test_digest[EVP_MAX_MD_SIZE]; + + cipher = alg->evp_cipher(); + if (size % EVP_CIPHER_block_size(cipher) != 0) { + if (verbose) + printf( + "%s (%zu): invalid buffer size (block size %d)\n", + alg->name, size, EVP_CIPHER_block_size(cipher)); + return; + } + + memset(control_digest, 0x3c, sizeof(control_digest)); + memset(test_digest, 0x3c, sizeof(test_digest)); + + md = alg->evp_md(); + + cipher_key_len = EVP_CIPHER_key_length(cipher); + iv_len = EVP_CIPHER_iv_length(cipher); + auth_key_len = EVP_MD_size(md); + + cipher_key = alloc_buffer(cipher_key_len); + iv = generate_iv(iv_len, alg); + auth_key = alloc_buffer(auth_key_len); + cleartext = alloc_buffer(aad_len + size); + buffer = malloc(aad_len + size); + ciphertext = malloc(aad_len + size); + + /* OpenSSL encrypt + HMAC. */ + if (aad_len != 0) + memcpy(ciphertext, cleartext, aad_len); + openssl_cipher(alg, cipher, cipher_key, iv, cleartext + aad_len, + ciphertext + aad_len, size, 1); + if (size > 0 && memcmp(cleartext + aad_len, ciphertext + aad_len, + size) == 0) + errx(1, "OpenSSL %s (%zu): cipher text unchanged", alg->name, + size); + digest_len = sizeof(control_digest); + if (HMAC(md, auth_key, auth_key_len, (u_char *)ciphertext, + aad_len + size, (u_char *)control_digest, &digest_len) == NULL) + errx(1, "OpenSSL %s (%zu) HMAC failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + + /* OCF encrypt + HMAC. */ + if (!ocf_authenc(alg, cipher_key, cipher_key_len, iv, iv_len, auth_key, + auth_key_len, aad_len != 0 ? cleartext : NULL, aad_len, + cleartext + aad_len, buffer + aad_len, size, test_digest, 1, &crid)) + goto out; + if (memcmp(ciphertext + aad_len, buffer + aad_len, size) != 0) { + printf("%s (%zu) encryption mismatch:\n", alg->name, size); + printf("control:\n"); + hexdump(ciphertext + aad_len, size, NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(buffer + aad_len, size, NULL, 0); + goto out; + } + if (memcmp(control_digest, test_digest, sizeof(control_digest)) != 0) { + if (memcmp(control_digest, test_digest, EVP_MD_size(md)) == 0) + printf("%s (%zu) enc hash mismatch in trailer:\n", + alg->name, size); + else + printf("%s (%zu) enc hash mismatch:\n", alg->name, + size); + printf("control:\n"); + hexdump(control_digest, sizeof(control_digest), NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(test_digest, sizeof(test_digest), NULL, 0); + goto out; + } + + /* OCF HMAC + decrypt. */ + memset(test_digest, 0x3c, sizeof(test_digest)); + if (!ocf_authenc(alg, cipher_key, cipher_key_len, iv, iv_len, auth_key, + auth_key_len, aad_len != 0 ? ciphertext : NULL, aad_len, + ciphertext + aad_len, buffer + aad_len, size, test_digest, 0, + &crid)) + goto out; + if (memcmp(control_digest, test_digest, sizeof(control_digest)) != 0) { + if (memcmp(control_digest, test_digest, EVP_MD_size(md)) == 0) + printf("%s (%zu) dec hash mismatch in trailer:\n", + alg->name, size); + else + printf("%s (%zu) dec hash mismatch:\n", alg->name, + size); + printf("control:\n"); + hexdump(control_digest, sizeof(control_digest), NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(test_digest, sizeof(test_digest), NULL, 0); + goto out; + } + if (memcmp(cleartext + aad_len, buffer + aad_len, size) != 0) { + printf("%s (%zu) decryption mismatch:\n", alg->name, size); + printf("control:\n"); + hexdump(cleartext, size, NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(buffer, size, NULL, 0); + goto out; + } + + if (verbose) + printf("%s (%zu) matched (cryptodev device %s)\n", + alg->name, size, crfind(crid)); + +out: + free(ciphertext); + free(buffer); + free(cleartext); + free(auth_key); + free(iv); + free(cipher_key); +} + +static void +openssl_gcm_encrypt(struct alg *alg, const EVP_CIPHER *cipher, const char *key, + const char *iv, const char *aad, size_t aad_len, const char *input, + char *output, size_t size, char *tag) +{ + EVP_CIPHER_CTX *ctx; + int outl, total; + + ctx = EVP_CIPHER_CTX_new(); + if (ctx == NULL) + errx(1, "OpenSSL %s (%zu) ctx new failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + if (EVP_EncryptInit_ex(ctx, cipher, NULL, (const u_char *)key, + (const u_char *)iv) != 1) + errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_set_padding(ctx, 0); + if (aad != NULL) { + if (EVP_EncryptUpdate(ctx, NULL, &outl, (const u_char *)aad, + aad_len) != 1) + errx(1, "OpenSSL %s (%zu) aad update failed: %s", + alg->name, size, + ERR_error_string(ERR_get_error(), NULL)); + } + if (EVP_EncryptUpdate(ctx, (u_char *)output, &outl, + (const u_char *)input, size) != 1) + errx(1, "OpenSSL %s (%zu) encrypt update failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + total = outl; + if (EVP_EncryptFinal_ex(ctx, (u_char *)output + outl, &outl) != 1) + errx(1, "OpenSSL %s (%zu) encrypt final failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + total += outl; + if (total != size) + errx(1, "OpenSSL %s (%zu) encrypt size mismatch: %d", alg->name, + size, total); + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, AES_GMAC_HASH_LEN, + tag) != 1) + errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_free(ctx); +} + +static bool +ocf_gcm(struct alg *alg, const char *key, size_t key_len, const char *iv, + size_t iv_len, const char *aad, size_t aad_len, const char *input, + char *output, size_t size, char *tag, int enc, int *cridp) +{ + struct session2_op sop; + struct crypt_aead caead; + int fd; + + memset(&sop, 0, sizeof(sop)); + memset(&caead, 0, sizeof(caead)); + sop.crid = crid; + sop.keylen = key_len; + sop.key = (char *)key; + sop.cipher = alg->cipher; + sop.mackeylen = key_len; + sop.mackey = (char *)key; + sop.mac = alg->mac; + fd = crget(); + if (ioctl(fd, CIOCGSESSION2, &sop) < 0) { + warn("cryptodev %s not supported for device %s", + alg->name, crfind(crid)); + close(fd); + return (false); + } + + caead.ses = sop.ses; + caead.op = enc ? COP_ENCRYPT : COP_DECRYPT; + caead.len = size; + caead.aadlen = aad_len; + caead.ivlen = iv_len; + caead.src = (char *)input; + caead.dst = output; + caead.aad = (char *)aad; + caead.tag = tag; + caead.iv = (char *)iv; + + if (ioctl(fd, CIOCCRYPTAEAD, &caead) < 0) { + warn("cryptodev %s (%zu) failed for device %s", + alg->name, size, crfind(crid)); + close(fd); + return (false); + } + + if (ioctl(fd, CIOCFSESSION, &sop.ses) < 0) + warn("ioctl(CIOCFSESSION)"); + + close(fd); + *cridp = sop.crid; + return (true); +} + +#ifdef notused +static bool +openssl_gcm_decrypt(struct alg *alg, const EVP_CIPHER *cipher, const char *key, + const char *iv, const char *aad, size_t aad_len, const char *input, + char *output, size_t size, char *tag) +{ + EVP_CIPHER_CTX *ctx; + int outl, total; + bool valid; + + ctx = EVP_CIPHER_CTX_new(); + if (ctx == NULL) + errx(1, "OpenSSL %s (%zu) ctx new failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + if (EVP_DecryptInit_ex(ctx, cipher, NULL, (const u_char *)key, + (const u_char *)iv) != 1) + errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_set_padding(ctx, 0); + if (aad != NULL) { + if (EVP_DecryptUpdate(ctx, NULL, &outl, (const u_char *)aad, + aad_len) != 1) + errx(1, "OpenSSL %s (%zu) aad update failed: %s", + alg->name, size, + ERR_error_string(ERR_get_error(), NULL)); + } + if (EVP_DecryptUpdate(ctx, (u_char *)output, &outl, + (const u_char *)input, size) != 1) + errx(1, "OpenSSL %s (%zu) decrypt update failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + total = outl; + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, AES_GMAC_HASH_LEN, + tag) != 1) + errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); + valid = (EVP_DecryptFinal_ex(ctx, (u_char *)output + outl, &outl) != 1); + total += outl; + if (total != size) + errx(1, "OpenSSL %s (%zu) decrypt size mismatch: %d", alg->name, + size, total); + EVP_CIPHER_CTX_free(ctx); + return (valid); +} +#endif + +static void +run_gcm_test(struct alg *alg, size_t size) +{ + const EVP_CIPHER *cipher; + char *aad, *buffer, *cleartext, *ciphertext; + char *iv, *key; + u_int iv_len, key_len; + int crid; + char control_tag[AES_GMAC_HASH_LEN], test_tag[AES_GMAC_HASH_LEN]; + + cipher = alg->evp_cipher(); + if (size % EVP_CIPHER_block_size(cipher) != 0) { + if (verbose) + printf( + "%s (%zu): invalid buffer size (block size %d)\n", + alg->name, size, EVP_CIPHER_block_size(cipher)); + return; + } + + memset(control_tag, 0x3c, sizeof(control_tag)); + memset(test_tag, 0x3c, sizeof(test_tag)); + + key_len = EVP_CIPHER_key_length(cipher); + iv_len = EVP_CIPHER_iv_length(cipher); + + key = alloc_buffer(key_len); + iv = generate_iv(iv_len, alg); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Mar 23 04:38:14 2018 Return-Path: Delivered-To: svn-src-head@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 4659BF6B07C; Fri, 23 Mar 2018 04:38:14 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 7244A7F9D7; Fri, 23 Mar 2018 04:38:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 29B68D4AB33; Fri, 23 Mar 2018 15:38:09 +1100 (AEDT) Date: Fri, 23 Mar 2018 15:38:08 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jeff Roberson cc: Cy Schubert , Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: Message-ID: <20180323150709.H968@besplex.bde.org> References: <201803230059.w2N0x2fw077291@slippy.cwsent.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=SJCHQCfh3hcGHLzz5TgA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 04:38:14 -0000 On Thu, 22 Mar 2018, Jeff Roberson wrote: > On Thu, 22 Mar 2018, Cy Schubert wrote: > >> It broke i386 too. > > I just did > TARGET_ARCH=i386 make buildworld > TARGET_ARCH=i386 make buildkernel > > This worked for me? >> >> Index: sys/vm/vm_reserv.c >> =================================================================== >> --- sys/vm/vm_reserv.c (revision 331399) >> +++ sys/vm/vm_reserv.c (working copy) >> @@ -45,8 +45,6 @@ >> >> #include >> #include >> -#include >> -#include >> #include >> #include >> #include >> @@ -55,6 +53,8 @@ >> #include >> #include >> #include >> +#include >> +#include >> #include >> #include >> >> This is because sys/i386/include/machine.h uses critical_enter() and >> critical_exit() which are defined in sys/systm.h. Wrong fix. I see you committed this. Now there are more bugs to fix. is a prerequisite for all kernel headers except , since it defines and declares things like KASSERT() and critical_enter() which might be used in other headers (except sys/param.h and its standard pollution). Sometimes sys/systm.h is included as undocumented namespace pollution in headers that are accidentally included before the (other) ones that use KASSERT(), etc. The headers that have this bug have it to work around bugs in .c files like the one above. It is more usual to have this bug by not including sys/systm.h at all than to have it by including it in a wrong order. Sorting it alphabetically almost always gives a wrong order. It must be included after sys/param.h and that must be included first. It is a related bug to include only sys/types.h and not sys/param.h. This requires chumminess with the current implementation and all future implementations. sys/param.h provides certain undocumented but standard namespace pollution which might vary with the implementation, as necessary to satisfy some of the pollution requirements of all current and future implementations of other headers. (The pollution should be monotonically decreasing but it was only that for a few years about 20 years ago when I worked on fixing it.) .c files that include sys/types.h instead of sys/param.h have do some subset of the includes in sys/param.h. Since nothing is documented and the subset might depend on the arch and user options, it is hard to know the minimal subset. .c files that include sys/types.h tend to have lots of other #include bugs like not including sys/systm.h. Again it is hard to know the minimal replacement for sys/systm.h and its undocumented but standard pollution. It is a style bug to include both sys/types.h and sys/param.h. style(9) even explicitly forbids including both. It is a larger style bug to include the standard pollution in sys/systm.h direction. This includes especially and . These should be considered as being implemented in sys/systm.h, with the headers for them only and implementation detail. Similarly for . >> It built nicely on my amd64's though. amd64 apparently has more namespace pollution which breaks detection of the bug. But I couldn't find where it is. sys/systm.h isn't included nested in any amd64 or x86 headers. Apparently some amd64 option gives it. Bruce From owner-svn-src-head@freebsd.org Fri Mar 23 05:37:19 2018 Return-Path: Delivered-To: svn-src-head@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 8CDC8F6EB74; Fri, 23 Mar 2018 05:37:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 3FF37817C2; Fri, 23 Mar 2018 05:37:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 369D51BBA1; Fri, 23 Mar 2018 05:37:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N5bI9W071282; Fri, 23 Mar 2018 05:37:18 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N5bI6h071280; Fri, 23 Mar 2018 05:37:18 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201803230537.w2N5bI6h071280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 23 Mar 2018 05:37:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331418 - head/tools/tools/crypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/tools/tools/crypto X-SVN-Commit-Revision: 331418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 05:37:19 -0000 Author: cem Date: Fri Mar 23 05:37:18 2018 New Revision: 331418 URL: https://svnweb.freebsd.org/changeset/base/331418 Log: cryptocheck: Add support for Blake2{B,S} hashes Since they are not yet present in the version of openssl in base, this will require installing the ports openssl. Sponsored by: Dell EMC Isilon Modified: head/tools/tools/crypto/Makefile head/tools/tools/crypto/cryptocheck.c Modified: head/tools/tools/crypto/Makefile ============================================================================== --- head/tools/tools/crypto/Makefile Fri Mar 23 04:31:19 2018 (r331417) +++ head/tools/tools/crypto/Makefile Fri Mar 23 05:37:18 2018 (r331418) @@ -32,7 +32,10 @@ MAN= BINDIR?= /usr/local/bin # cryptocheck: test symmetric crypto functions -LIBADD.cryptocheck+= crypto ssl util +# Use openssl from ports for Blake2 algorithms +CFLAGS.cryptocheck.c+= $$(pkg-config --cflags openssl) +LDFLAGS.cryptocheck+= $$(pkg-config --libs openssl) +LIBADD.cryptocheck+= util # cryptokeytest: test asymmetric crypto functions LIBADD.cryptokeytest+= crypto Modified: head/tools/tools/crypto/cryptocheck.c ============================================================================== --- head/tools/tools/crypto/cryptocheck.c Fri Mar 23 04:31:19 2018 (r331417) +++ head/tools/tools/crypto/cryptocheck.c Fri Mar 23 05:37:18 2018 (r331418) @@ -59,6 +59,8 @@ * sha256 256-bit sha2 hmac * sha384 384-bit sha2 hmac * sha512 512-bit sha2 hmac + * blake2b Blake2-B + * blake2s Blake2-S * * Block Ciphers: * aes-cbc 128-bit aes cbc @@ -115,6 +117,10 @@ struct alg { .evp_md = EVP_sha384 }, { .name = "sha512", .mac = CRYPTO_SHA2_512_HMAC, .type = T_HMAC, .evp_md = EVP_sha512 }, + { .name = "blake2b", .mac = CRYPTO_BLAKE2B, .type = T_HMAC, + .evp_md = EVP_blake2b512 }, + { .name = "blake2s", .mac = CRYPTO_BLAKE2S, .type = T_HMAC, + .evp_md = EVP_blake2s256 }, { .name = "aes-cbc", .cipher = CRYPTO_AES_CBC, .type = T_BLKCIPHER, .evp_cipher = EVP_aes_128_cbc }, { .name = "aes-cbc192", .cipher = CRYPTO_AES_CBC, .type = T_BLKCIPHER, From owner-svn-src-head@freebsd.org Fri Mar 23 06:15:36 2018 Return-Path: Delivered-To: svn-src-head@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 C4FACF4A49E; Fri, 23 Mar 2018 06:15:36 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 1793E8292E; Fri, 23 Mar 2018 06:15:35 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id zFz9ehJb4U5pnzFzAemn2j; Fri, 23 Mar 2018 00:15:34 -0600 X-Authority-Analysis: v=2.3 cv=Tai4SyYh c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=v2DPQv5-lfwA:10 a=JzwRw_2MAAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=KOz5PoXyROM3pLaX7PQA:9 a=CjuIK1q_8ugA:10 a=_bBvcJC8wCc67rcU61zu:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 5682298; Thu, 22 Mar 2018 23:15:31 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w2N6FUOW040644; Thu, 22 Mar 2018 23:15:30 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w2N6FTMJ040628; Thu, 22 Mar 2018 23:15:29 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201803230615.w2N6FTMJ040628@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Bruce Evans cc: Jeff Roberson , Cy Schubert , Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: Message from Bruce Evans of "Fri, 23 Mar 2018 15:38:08 +1100." <20180323150709.H968@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 22 Mar 2018 23:15:29 -0700 X-CMAE-Envelope: MS4wfJs+r7omdWf+Otrml2Q8nLd1Np0GcJ6obUh1atf5U4xHOZ4O1fxijDwi5YJHtTtHfKdaT1R1dg7YwTOCpGLVw49kjLRNw3uI3p37w7QVWi/j1qWszdHN x/MqikPHVA19WLRXfMi/pFY3nVkq/z00F7oc6WS2VjALHYIv20+3MEkxBIuljnooc8+8wsu+GetHnDHbLsTSdJo88o9DfMV7RfyvbvoCxKXZ9F6uDKZZGs98 6pEyS5hGyDEa+/JxKhDRhiqK+qEgrINjoujrzoVplowq0z1kgQ5J5VZmKkmtsLKKVLa8JdkfyDu4SkeOkS1r62LShygpDPDpKFlGui0871ffBmKM4i3mDaU7 d8S21n7oBg4IezwbxLQatJxwoG2v1w== X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 06:15:37 -0000 In message <20180323150709.H968@besplex.bde.org>, Bruce Evans writes: > On Thu, 22 Mar 2018, Jeff Roberson wrote: > > > On Thu, 22 Mar 2018, Cy Schubert wrote: > > > >> It broke i386 too. > > > > I just did > > TARGET_ARCH=i386 make buildworld > > TARGET_ARCH=i386 make buildkernel > > > > This worked for me? > >> > >> Index: sys/vm/vm_reserv.c > >> =================================================================== > >> --- sys/vm/vm_reserv.c (revision 331399) > >> +++ sys/vm/vm_reserv.c (working copy) > >> @@ -45,8 +45,6 @@ > >> > >> #include > >> #include > >> -#include > >> -#include > >> #include > >> #include > >> #include > >> @@ -55,6 +53,8 @@ > >> #include > >> #include > >> #include > >> +#include > >> +#include > >> #include > >> #include > >> > >> This is because sys/i386/include/machine.h uses critical_enter() and > >> critical_exit() which are defined in sys/systm.h. > > Wrong fix. I see you committed this. Now there are more bugs to fix. > > is a prerequisite for all kernel headers except > , since it defines and declares things like KASSERT() and > critical_enter() which might be used in other headers (except > sys/param.h and its standard pollution). Sometimes sys/systm.h is > included as undocumented namespace pollution in headers that are > accidentally included before the (other) ones that use KASSERT(), etc. > The headers that have this bug have it to work around bugs in .c files > like the one above. It is more usual to have this bug by not including > sys/systm.h at all than to have it by including it in a wrong order. > Sorting it alphabetically almost always gives a wrong order. It must > be included after sys/param.h and that must be included first. Agreed on alphabetic sorting. > > It is a related bug to include only sys/types.h and not sys/param.h. > This requires chumminess with the current implementation and all > future implementations. sys/param.h provides certain undocumented > but standard namespace pollution which might vary with the implementation, > as necessary to satisfy some of the pollution requirements of all current > and future implementations of other headers. (The pollution should be > monotonically decreasing but it was only that for a few years about 20 > years ago when I worked on fixing it.) .c files that include sys/types.h > instead of sys/param.h have do some subset of the includes in sys/param.h. > Since nothing is documented and the subset might depend on the arch and > user options, it is hard to know the minimal subset. That's not the case here. sys/types.h is not included in this file but point taken. > > .c files that include sys/types.h tend to have lots of other #include > bugs like not including sys/systm.h. Again it is hard to know the > minimal replacement for sys/systm.h and its undocumented but standard > pollution. It is a style bug to include both sys/types.h and sys/param.h. > style(9) even explicitly forbids including both. It is a larger style > bug to include the standard pollution in sys/systm.h direction. This > includes especially and . These > should be considered as being implemented in sys/systm.h, with the > headers for them only and implementation detail. Similarly > for . > > >> It built nicely on my amd64's though. > > amd64 apparently has more namespace pollution which breaks detection > of the bug. But I couldn't find where it is. sys/systm.h isn't included > nested in any amd64 or x86 headers. Apparently some amd64 option gives > it. The reason is amd64 doesn't use critical_enter() and critical_exit() because counter_enter() and counter_exit() are NOPs. The reason they are NOPs in amd64 and not in i386 is not all i386 processors support cmpxchg8b. It is only then that the critical_*() functions are called. > > Bruce I can create a phabricator revision to clean this instance up and move sys/systm.h just after sys/param.h. I'm just about to head out of town so I'll create it after I get back, after April 4. Thank you for your input Bruce. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Fri Mar 23 07:37:34 2018 Return-Path: Delivered-To: svn-src-head@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 D4CA6F4F3C2; Fri, 23 Mar 2018 07:37:33 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wm0-x22b.google.com (mail-wm0-x22b.google.com [IPv6:2a00:1450:400c:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FF8484D6A; Fri, 23 Mar 2018 07:37:33 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wm0-x22b.google.com with SMTP id t6so1758436wmt.5; Fri, 23 Mar 2018 00:37:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qPb5JPEHcIzfrjTldtGEyZlKTx8KOyU/v9hGdwJYogc=; b=OjLCiPKINHHDl3ncRFBGtsliRXe2HLKFW8iyoTgYgLnP/1pVbLS5jOSvlchKrkDfrQ DjCyDs/w7gk7d49ZQZJRkLD9QFfgnGJTGqHAKFh8kNjeSmJc49c5P19XEhH3uZUEpqLm FO8Evs1PXWZ3zrpWqL/eZZ4RE4GmpDfFZS72fiJE8E3GuhnCXlfnmV8+bENhFFlBUl5R 7dJhccVlh0yIpyELCU8WIm0Ztk9zI8vbwMWqWRf9qEm23DTdDXwMYRrhnMvWyATNC6Qh ix2ExNakAN3H5wFalHZzsQrCmeXiskIePFZ9zIqzTWizOcogqAkeM4RaiG6tGf7kWV2c XuQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qPb5JPEHcIzfrjTldtGEyZlKTx8KOyU/v9hGdwJYogc=; b=eqv+gJToSr9u+7vj2R+IBSJLwY4/J3rJaXvatfJ4FWrPJARSwcStY+dcRA0xt+1t8Y yP3WjF+a2H6ZNsPyYUmGQzdsywvdfSiMGkDS7wvEmTknMu0jTHtX/7bNGGd9iM2LnmXi erFlqR6pgJH4qoNG4Gwhsc4kPXv+aKSWD/sD+w/W2lWpgndQElI2WT0iauip4yv8dnkV DAPqaLfKWrQMBuhm8RxNbL1qM4PxiFyKT7rJ11jaDEdsqkJ9hi0EVXCrLPo0xN2LiueR iBjpWT1mUn4F4eDbBXmfVK0XufG60fKoUiPudrTXJMaXNKM/c/lgWSKv17Tt+3dZC7HP yS3w== X-Gm-Message-State: AElRT7HjtMkVMFhYHagKb5BW4OwyFjNv/ob2YgD5F4Fe9bnGt40ADPpz EBBTNTHE28ANiBkRfMlqc1NM6ghL56KUlAcxFvV16w== X-Google-Smtp-Source: AG47ELvJenWRuA3xX9d3+Zr/Y+Yz7dmzUct5JCElbbtrs7EsNtVUFALSGDKiC6Rve0PA/OJkxCbTU3ckCjYReknmLTo= X-Received: by 10.28.105.19 with SMTP id e19mr8007897wmc.3.1521790649624; Fri, 23 Mar 2018 00:37:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.4.12 with HTTP; Fri, 23 Mar 2018 00:37:28 -0700 (PDT) In-Reply-To: <201802071859.w17IxtxX060804@repo.freebsd.org> References: <201802071859.w17IxtxX060804@repo.freebsd.org> From: Adrian Chadd Date: Fri, 23 Mar 2018 00:37:28 -0700 Message-ID: Subject: Re: svn commit: r328988 - in head/sys: conf modules/ipfw netinet netpfil/ipfw To: "Andrey V. Elsukov" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 07:37:34 -0000 Hi! It looks like this broke on mips32. I posted in -net on this. In addition i can't even build the concurrencykit regression suite from github. It just plainly fails to build, so I can't even attempt to cross compile it for mips to test things. Did you test this on any platform besides 64 bit intel? Thanks! -adrian On 7 February 2018 at 10:59, Andrey V. Elsukov wrote: > Author: ae > Date: Wed Feb 7 18:59:54 2018 > New Revision: 328988 > URL: https://svnweb.freebsd.org/changeset/base/328988 > > Log: > Rework ipfw dynamic states implementation to be lockless on fast path. > > o added struct ipfw_dyn_info that keeps all needed for ipfw_chk and > for dynamic states implementation information; > o added DYN_LOOKUP_NEEDED() macro that can be used to determine the > need of new lookup of dynamic states; > o ipfw_dyn_rule now becomes obsolete. Currently it used to pass > information from kernel to userland only. > o IPv4 and IPv6 states now described by different structures > dyn_ipv4_state and dyn_ipv6_state; > o IPv6 scope zones support is added; > o ipfw(4) now depends from Concurrency Kit; > o states are linked with "entry" field using CK_SLIST. This allows > lockless lookup and protected by mutex modifications. > o the "expired" SLIST field is used for states expiring. > o struct dyn_data is used to keep generic information for both IPv4 > and IPv6; > o struct dyn_parent is used to keep O_LIMIT_PARENT information; > o IPv4 and IPv6 states are stored in different hash tables; > o O_LIMIT_PARENT states now are kept separately from O_LIMIT and > O_KEEP_STATE states; > o per-cpu dyn_hp pointers are used to implement hazard pointers and they > prevent freeing states that are locklessly used by lookup threads; > o mutexes to protect modification of lists in hash tables now kept in > separate arrays. 65535 limit to maximum number of hash buckets now > removed. > o Separate lookup and install functions added for IPv4 and IPv6 states > and for parent states. > o By default now is used Jenkinks hash function. > > Obtained from: Yandex LLC > MFC after: 42 days > Sponsored by: Yandex LLC > Differential Revision: https://reviews.freebsd.org/D12685 > > Modified: > head/sys/conf/files > head/sys/modules/ipfw/Makefile > head/sys/netinet/ip_fw.h > head/sys/netpfil/ipfw/ip_fw2.c > head/sys/netpfil/ipfw/ip_fw_dynamic.c > head/sys/netpfil/ipfw/ip_fw_private.h > head/sys/netpfil/ipfw/ip_fw_sockopt.c > > Modified: head/sys/conf/files > ============================================================================== > --- head/sys/conf/files Wed Feb 7 18:50:36 2018 (r328987) > +++ head/sys/conf/files Wed Feb 7 18:59:54 2018 (r328988) > @@ -4374,7 +4374,8 @@ netpfil/ipfw/ip_dn_io.c optional inet dummynet > netpfil/ipfw/ip_dn_glue.c optional inet dummynet > netpfil/ipfw/ip_fw2.c optional inet ipfirewall > netpfil/ipfw/ip_fw_bpf.c optional inet ipfirewall > -netpfil/ipfw/ip_fw_dynamic.c optional inet ipfirewall > +netpfil/ipfw/ip_fw_dynamic.c optional inet ipfirewall \ > + compile-with "${NORMAL_C} -I$S/contrib/ck/include" > netpfil/ipfw/ip_fw_eaction.c optional inet ipfirewall > netpfil/ipfw/ip_fw_log.c optional inet ipfirewall > netpfil/ipfw/ip_fw_pfil.c optional inet ipfirewall > > Modified: head/sys/modules/ipfw/Makefile > ============================================================================== > --- head/sys/modules/ipfw/Makefile Wed Feb 7 18:50:36 2018 (r328987) > +++ head/sys/modules/ipfw/Makefile Wed Feb 7 18:59:54 2018 (r328988) > @@ -9,7 +9,7 @@ SRCS+= ip_fw_sockopt.c ip_fw_table.c ip_fw_table_algo. > SRCS+= ip_fw_table_value.c > SRCS+= opt_inet.h opt_inet6.h opt_ipdivert.h opt_ipfw.h > > -CFLAGS+= -DIPFIREWALL > +CFLAGS+= -DIPFIREWALL -I${SRCTOP}/sys/contrib/ck/include > # > #If you want it verbose > #CFLAGS+= -DIPFIREWALL_VERBOSE > > Modified: head/sys/netinet/ip_fw.h > ============================================================================== > --- head/sys/netinet/ip_fw.h Wed Feb 7 18:50:36 2018 (r328987) > +++ head/sys/netinet/ip_fw.h Wed Feb 7 18:59:54 2018 (r328988) > @@ -671,7 +671,7 @@ struct ipfw_flow_id { > uint32_t src_ip; > uint16_t dst_port; > uint16_t src_port; > - uint8_t fib; > + uint8_t fib; /* XXX: must be uint16_t */ > uint8_t proto; > uint8_t _flags; /* protocol-specific flags */ > uint8_t addr_type; /* 4=ip4, 6=ip6, 1=ether ? */ > @@ -682,6 +682,7 @@ struct ipfw_flow_id { > }; > #endif > > +#define IS_IP4_FLOW_ID(id) ((id)->addr_type == 4) > #define IS_IP6_FLOW_ID(id) ((id)->addr_type == 6) > > /* > > Modified: head/sys/netpfil/ipfw/ip_fw2.c > ============================================================================== > --- head/sys/netpfil/ipfw/ip_fw2.c Wed Feb 7 18:50:36 2018 (r328987) > +++ head/sys/netpfil/ipfw/ip_fw2.c Wed Feb 7 18:59:54 2018 (r328988) > @@ -1387,8 +1387,7 @@ ipfw_chk(struct ip_fw_args *args) > * MATCH_NONE when checked and not matched (q = NULL), > * MATCH_FORWARD or MATCH_REVERSE otherwise (q != NULL) > */ > - int dyn_dir = MATCH_UNKNOWN; > - uint16_t dyn_name = 0; > + struct ipfw_dyn_info dyn_info; > struct ip_fw *q = NULL; > struct ip_fw_chain *chain = &V_layer3_chain; > > @@ -1420,6 +1419,7 @@ ipfw_chk(struct ip_fw_args *args) > proto = args->f_id.proto = 0; /* mark f_id invalid */ > /* XXX 0 is a valid proto: IP/IPv6 Hop-by-Hop Option */ > > + DYN_INFO_INIT(&dyn_info); > /* > * PULLUP_TO(len, p, T) makes sure that len + sizeof(T) is contiguous, > * then it sets p to point at the offset "len" in the mbuf. WARNING: the > @@ -2605,7 +2605,8 @@ do { \ > case O_LIMIT: > case O_KEEP_STATE: > if (ipfw_dyn_install_state(chain, f, > - (ipfw_insn_limit *)cmd, args, tablearg)) { > + (ipfw_insn_limit *)cmd, args, ulp, > + pktlen, &dyn_info, tablearg)) { > /* error or limit violation */ > retval = IP_FW_DENY; > l = 0; /* exit inner loop */ > @@ -2619,34 +2620,15 @@ do { \ > /* > * dynamic rules are checked at the first > * keep-state or check-state occurrence, > - * with the result being stored in dyn_dir > - * and dyn_name. > + * with the result being stored in dyn_info. > * The compiler introduces a PROBE_STATE > * instruction for us when we have a > * KEEP_STATE (because PROBE_STATE needs > * to be run first). > - * > - * (dyn_dir == MATCH_UNKNOWN) means this is > - * first lookup for such f_id. Do lookup. > - * > - * (dyn_dir != MATCH_UNKNOWN && > - * dyn_name != 0 && dyn_name != cmd->arg1) > - * means previous lookup didn't find dynamic > - * rule for specific state name and current > - * lookup will search rule with another state > - * name. Redo lookup. > - * > - * (dyn_dir != MATCH_UNKNOWN && dyn_name == 0) > - * means previous lookup was for `any' name > - * and it didn't find rule. No need to do > - * lookup again. > */ > - if ((dyn_dir == MATCH_UNKNOWN || > - (dyn_name != 0 && > - dyn_name != cmd->arg1)) && > - (q = ipfw_dyn_lookup_state(&args->f_id, > - ulp, pktlen, &dyn_dir, > - (dyn_name = cmd->arg1))) != NULL) { > + if (DYN_LOOKUP_NEEDED(&dyn_info, cmd) && > + (q = ipfw_dyn_lookup_state(args, ulp, > + pktlen, cmd, &dyn_info)) != NULL) { > /* > * Found dynamic entry, jump to the > * 'action' part of the parent rule > @@ -2654,13 +2636,7 @@ do { \ > * cmdlen. > */ > f = q; > - /* XXX we would like to have f_pos > - * readily accessible in the dynamic > - * rule, instead of having to > - * lookup q->rule. > - */ > - f_pos = ipfw_find_rule(chain, > - f->rulenum, f->id); > + f_pos = dyn_info.f_pos; > cmd = ACTION_PTR(f); > l = f->cmd_len - f->act_ofs; > cmdlen = 0; > @@ -2877,7 +2853,8 @@ do { \ > case O_FORWARD_IP: > if (args->eh) /* not valid on layer2 pkts */ > break; > - if (q != f || dyn_dir == MATCH_FORWARD) { > + if (q != f || > + dyn_info.direction == MATCH_FORWARD) { > struct sockaddr_in *sa; > > sa = &(((ipfw_insn_sa *)cmd)->sa); > @@ -2937,7 +2914,8 @@ do { \ > case O_FORWARD_IP6: > if (args->eh) /* not valid on layer2 pkts */ > break; > - if (q != f || dyn_dir == MATCH_FORWARD) { > + if (q != f || > + dyn_info.direction == MATCH_FORWARD) { > struct sockaddr_in6 *sin6; > > sin6 = &(((ipfw_insn_sa6 *)cmd)->sa); > @@ -3089,7 +3067,7 @@ do { \ > * @args content, and it may be > * used for new state lookup later. > */ > - dyn_dir = MATCH_UNKNOWN; > + DYN_INFO_INIT(&dyn_info); > } > break; > > > Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c > ============================================================================== > --- head/sys/netpfil/ipfw/ip_fw_dynamic.c Wed Feb 7 18:50:36 2018 (r328987) > +++ head/sys/netpfil/ipfw/ip_fw_dynamic.c Wed Feb 7 18:59:54 2018 (r328988) > @@ -1,6 +1,8 @@ > /*- > * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > * > + * Copyright (c) 2017-2018 Yandex LLC > + * Copyright (c) 2017-2018 Andrey V. Elsukov > * Copyright (c) 2002 Luigi Rizzo, Universita` di Pisa > * > * Redistribution and use in source and binary forms, with or without > @@ -28,32 +30,27 @@ > #include > __FBSDID("$FreeBSD$"); > > -#define DEB(x) > -#define DDB(x) x > - > -/* > - * Dynamic rule support for ipfw > - */ > - > -#include "opt_ipfw.h" > #include "opt_inet.h" > +#include "opt_inet6.h" > +#include "opt_ipfw.h" > #ifndef INET > #error IPFIREWALL requires INET. > #endif /* INET */ > -#include "opt_inet6.h" > > #include > #include > -#include > +#include > #include > #include > -#include > #include > +#include > +#include > #include > +#include > #include > #include > #include > -#include /* for ETHERTYPE_IP */ > +#include > #include > #include > #include > @@ -61,8 +58,9 @@ __FBSDID("$FreeBSD$"); > > #include > #include > -#include /* ip_defttl */ > +#include > #include > +#include > #include > #include > > @@ -70,6 +68,7 @@ __FBSDID("$FreeBSD$"); > #ifdef INET6 > #include > #include > +#include > #endif > > #include > @@ -79,86 +78,261 @@ __FBSDID("$FreeBSD$"); > #ifdef MAC > #include > #endif > +#include > > /* > - * Description of dynamic rules. > + * Description of dynamic states. > * > - * Dynamic rules are stored in lists accessed through a hash table > - * (ipfw_dyn_v) whose size is curr_dyn_buckets. This value can > - * be modified through the sysctl variable dyn_buckets which is > - * updated when the table becomes empty. > + * Dynamic states are stored in lists accessed through a hash tables > + * whose size is curr_dyn_buckets. This value can be modified through > + * the sysctl variable dyn_buckets. > * > - * XXX currently there is only one list, ipfw_dyn. > + * Currently there are four tables: dyn_ipv4, dyn_ipv6, dyn_ipv4_parent, > + * and dyn_ipv6_parent. > * > - * When a packet is received, its address fields are first masked > - * with the mask defined for the rule, then hashed, then matched > - * against the entries in the corresponding list. > - * Dynamic rules can be used for different purposes: > + * When a packet is received, its address fields hashed, then matched > + * against the entries in the corresponding list by addr_type. > + * Dynamic states can be used for different purposes: > * + stateful rules; > * + enforcing limits on the number of sessions; > * + in-kernel NAT (not implemented yet) > * > - * The lifetime of dynamic rules is regulated by dyn_*_lifetime, > + * The lifetime of dynamic states is regulated by dyn_*_lifetime, > * measured in seconds and depending on the flags. > * > - * The total number of dynamic rules is equal to UMA zone items count. > - * The max number of dynamic rules is dyn_max. When we reach > + * The total number of dynamic states is equal to UMA zone items count. > + * The max number of dynamic states is dyn_max. When we reach > * the maximum number of rules we do not create anymore. This is > * done to avoid consuming too much memory, but also too much > * time when searching on each packet (ideally, we should try instead > * to put a limit on the length of the list on each bucket...). > * > - * Each dynamic rule holds a pointer to the parent ipfw rule so > - * we know what action to perform. Dynamic rules are removed when > - * the parent rule is deleted. This can be changed by dyn_keep_states > - * sysctl. > + * Each state holds a pointer to the parent ipfw rule so we know what > + * action to perform. Dynamic rules are removed when the parent rule is > + * deleted. > * > * There are some limitations with dynamic rules -- we do not > * obey the 'randomized match', and we do not do multiple > * passes through the firewall. XXX check the latter!!! > */ > > -struct ipfw_dyn_bucket { > - struct mtx mtx; /* Bucket protecting lock */ > - ipfw_dyn_rule *head; /* Pointer to first rule */ > +/* By default use jenkins hash function */ > +#define IPFIREWALL_JENKINSHASH > + > +#define DYN_COUNTER_INC(d, dir, pktlen) do { \ > + (d)->pcnt_ ## dir++; \ > + (d)->bcnt_ ## dir += pktlen; \ > + } while (0) > + > +struct dyn_data { > + void *parent; /* pointer to parent rule */ > + uint32_t chain_id; /* cached ruleset id */ > + uint32_t f_pos; /* cached rule index */ > + > + uint32_t hashval; /* hash value used for hash resize */ > + uint16_t fibnum; /* fib used to send keepalives */ > + uint8_t _pad[3]; > + uint8_t set; /* parent rule set number */ > + uint16_t rulenum; /* parent rule number */ > + uint32_t ruleid; /* parent rule id */ > + > + uint32_t state; /* TCP session state and flags */ > + uint32_t ack_fwd; /* most recent ACKs in forward */ > + uint32_t ack_rev; /* and reverse direction (used */ > + /* to generate keepalives) */ > + uint32_t sync; /* synchronization time */ > + uint32_t expire; /* expire time */ > + > + uint64_t pcnt_fwd; /* bytes counter in forward */ > + uint64_t bcnt_fwd; /* packets counter in forward */ > + uint64_t pcnt_rev; /* bytes counter in reverse */ > + uint64_t bcnt_rev; /* packets counter in reverse */ > }; > > +#define DPARENT_COUNT_DEC(p) do { \ > + MPASS(p->count > 0); \ > + ck_pr_dec_32(&(p)->count); \ > +} while (0) > +#define DPARENT_COUNT_INC(p) ck_pr_inc_32(&(p)->count) > +#define DPARENT_COUNT(p) ck_pr_load_32(&(p)->count) > +struct dyn_parent { > + void *parent; /* pointer to parent rule */ > + uint32_t count; /* number of linked states */ > + uint8_t _pad; > + uint8_t set; /* parent rule set number */ > + uint16_t rulenum; /* parent rule number */ > + uint32_t ruleid; /* parent rule id */ > + uint32_t hashval; /* hash value used for hash resize */ > + uint32_t expire; /* expire time */ > +}; > + > +struct dyn_ipv4_state { > + uint8_t type; /* State type */ > + uint8_t proto; /* UL Protocol */ > + uint16_t kidx; /* named object index */ > + uint16_t sport, dport; /* ULP source and destination ports */ > + in_addr_t src, dst; /* IPv4 source and destination */ > + > + union { > + struct dyn_data *data; > + struct dyn_parent *limit; > + }; > + CK_SLIST_ENTRY(dyn_ipv4_state) entry; > + SLIST_ENTRY(dyn_ipv4_state) expired; > +}; > +CK_SLIST_HEAD(dyn_ipv4ck_slist, dyn_ipv4_state); > +static VNET_DEFINE(struct dyn_ipv4ck_slist *, dyn_ipv4); > +static VNET_DEFINE(struct dyn_ipv4ck_slist *, dyn_ipv4_parent); > + > +SLIST_HEAD(dyn_ipv4_slist, dyn_ipv4_state); > +static VNET_DEFINE(struct dyn_ipv4_slist, dyn_expired_ipv4); > +#define V_dyn_ipv4 VNET(dyn_ipv4) > +#define V_dyn_ipv4_parent VNET(dyn_ipv4_parent) > +#define V_dyn_expired_ipv4 VNET(dyn_expired_ipv4) > + > +#ifdef INET6 > +struct dyn_ipv6_state { > + uint8_t type; /* State type */ > + uint8_t proto; /* UL Protocol */ > + uint16_t kidx; /* named object index */ > + uint16_t sport, dport; /* ULP source and destination ports */ > + struct in6_addr src, dst; /* IPv6 source and destination */ > + uint32_t zoneid; /* IPv6 scope zone id */ > + union { > + struct dyn_data *data; > + struct dyn_parent *limit; > + }; > + CK_SLIST_ENTRY(dyn_ipv6_state) entry; > + SLIST_ENTRY(dyn_ipv6_state) expired; > +}; > +CK_SLIST_HEAD(dyn_ipv6ck_slist, dyn_ipv6_state); > +static VNET_DEFINE(struct dyn_ipv6ck_slist *, dyn_ipv6); > +static VNET_DEFINE(struct dyn_ipv6ck_slist *, dyn_ipv6_parent); > + > +SLIST_HEAD(dyn_ipv6_slist, dyn_ipv6_state); > +static VNET_DEFINE(struct dyn_ipv6_slist, dyn_expired_ipv6); > +#define V_dyn_ipv6 VNET(dyn_ipv6) > +#define V_dyn_ipv6_parent VNET(dyn_ipv6_parent) > +#define V_dyn_expired_ipv6 VNET(dyn_expired_ipv6) > +#endif /* INET6 */ > + > /* > - * Static variables followed by global ones > + * Per-CPU pointer indicates that specified state is currently in use > + * and must not be reclaimed by expiration callout. > */ > -static VNET_DEFINE(struct ipfw_dyn_bucket *, ipfw_dyn_v); > -static VNET_DEFINE(u_int32_t, dyn_buckets_max); > -static VNET_DEFINE(u_int32_t, curr_dyn_buckets); > -static VNET_DEFINE(struct callout, ipfw_timeout); > -#define V_ipfw_dyn_v VNET(ipfw_dyn_v) > -#define V_dyn_buckets_max VNET(dyn_buckets_max) > -#define V_curr_dyn_buckets VNET(curr_dyn_buckets) > -#define V_ipfw_timeout VNET(ipfw_timeout) > +static void **dyn_hp_cache; > +static DPCPU_DEFINE(void *, dyn_hp); > +#define DYNSTATE_GET(cpu) ck_pr_load_ptr(DPCPU_ID_PTR((cpu), dyn_hp)) > +#define DYNSTATE_PROTECT(v) ck_pr_store_ptr(DPCPU_PTR(dyn_hp), (v)) > +#define DYNSTATE_RELEASE() DYNSTATE_PROTECT(NULL) > +#define DYNSTATE_CRITICAL_ENTER() critical_enter() > +#define DYNSTATE_CRITICAL_EXIT() do { \ > + DYNSTATE_RELEASE(); \ > + critical_exit(); \ > +} while (0); > > -static VNET_DEFINE(uma_zone_t, ipfw_dyn_rule_zone); > -#define V_ipfw_dyn_rule_zone VNET(ipfw_dyn_rule_zone) > +/* > + * We keep two version numbers, one is updated when new entry added to > + * the list. Second is updated when an entry deleted from the list. > + * Versions are updated under bucket lock. > + * > + * Bucket "add" version number is used to know, that in the time between > + * state lookup (i.e. ipfw_dyn_lookup_state()) and the followed state > + * creation (i.e. ipfw_dyn_install_state()) another concurrent thread did > + * not install some state in this bucket. Using this info we can avoid > + * additional state lookup, because we are sure that we will not install > + * the state twice. > + * > + * Also doing the tracking of bucket "del" version during lookup we can > + * be sure, that state entry was not unlinked and freed in time between > + * we read the state pointer and protect it with hazard pointer. > + * > + * An entry unlinked from CK list keeps unchanged until it is freed. > + * Unlinked entries are linked into expired lists using "expired" field. > + */ > > -#define IPFW_BUCK_LOCK_INIT(b) \ > - mtx_init(&(b)->mtx, "IPFW dynamic bucket", NULL, MTX_DEF) > -#define IPFW_BUCK_LOCK_DESTROY(b) \ > - mtx_destroy(&(b)->mtx) > -#define IPFW_BUCK_LOCK(i) mtx_lock(&V_ipfw_dyn_v[(i)].mtx) > -#define IPFW_BUCK_UNLOCK(i) mtx_unlock(&V_ipfw_dyn_v[(i)].mtx) > -#define IPFW_BUCK_ASSERT(i) mtx_assert(&V_ipfw_dyn_v[(i)].mtx, MA_OWNED) > +/* > + * dyn_expire_lock is used to protect access to dyn_expired_xxx lists. > + * dyn_bucket_lock is used to get write access to lists in specific bucket. > + * Currently one dyn_bucket_lock is used for all ipv4, ipv4_parent, ipv6, > + * and ipv6_parent lists. > + */ > +static VNET_DEFINE(struct mtx, dyn_expire_lock); > +static VNET_DEFINE(struct mtx *, dyn_bucket_lock); > +#define V_dyn_expire_lock VNET(dyn_expire_lock) > +#define V_dyn_bucket_lock VNET(dyn_bucket_lock) > > +/* > + * Bucket's add/delete generation versions. > + */ > +static VNET_DEFINE(uint32_t *, dyn_ipv4_add); > +static VNET_DEFINE(uint32_t *, dyn_ipv4_del); > +static VNET_DEFINE(uint32_t *, dyn_ipv4_parent_add); > +static VNET_DEFINE(uint32_t *, dyn_ipv4_parent_del); > +#define V_dyn_ipv4_add VNET(dyn_ipv4_add) > +#define V_dyn_ipv4_del VNET(dyn_ipv4_del) > +#define V_dyn_ipv4_parent_add VNET(dyn_ipv4_parent_add) > +#define V_dyn_ipv4_parent_del VNET(dyn_ipv4_parent_del) > > -static VNET_DEFINE(int, dyn_keep_states); > -#define V_dyn_keep_states VNET(dyn_keep_states) > +#ifdef INET6 > +static VNET_DEFINE(uint32_t *, dyn_ipv6_add); > +static VNET_DEFINE(uint32_t *, dyn_ipv6_del); > +static VNET_DEFINE(uint32_t *, dyn_ipv6_parent_add); > +static VNET_DEFINE(uint32_t *, dyn_ipv6_parent_del); > +#define V_dyn_ipv6_add VNET(dyn_ipv6_add) > +#define V_dyn_ipv6_del VNET(dyn_ipv6_del) > +#define V_dyn_ipv6_parent_add VNET(dyn_ipv6_parent_add) > +#define V_dyn_ipv6_parent_del VNET(dyn_ipv6_parent_del) > +#endif /* INET6 */ > > +#define DYN_BUCKET(h, b) ((h) & (b - 1)) > +#define DYN_BUCKET_VERSION(b, v) ck_pr_load_32(&V_dyn_ ## v[(b)]) > +#define DYN_BUCKET_VERSION_BUMP(b, v) ck_pr_inc_32(&V_dyn_ ## v[(b)]) > + > +#define DYN_BUCKET_LOCK_INIT(lock, b) \ > + mtx_init(&lock[(b)], "IPFW dynamic bucket", NULL, MTX_DEF) > +#define DYN_BUCKET_LOCK_DESTROY(lock, b) mtx_destroy(&lock[(b)]) > +#define DYN_BUCKET_LOCK(b) mtx_lock(&V_dyn_bucket_lock[(b)]) > +#define DYN_BUCKET_UNLOCK(b) mtx_unlock(&V_dyn_bucket_lock[(b)]) > +#define DYN_BUCKET_ASSERT(b) mtx_assert(&V_dyn_bucket_lock[(b)], MA_OWNED) > + > +#define DYN_EXPIRED_LOCK_INIT() \ > + mtx_init(&V_dyn_expire_lock, "IPFW expired states list", NULL, MTX_DEF) > +#define DYN_EXPIRED_LOCK_DESTROY() mtx_destroy(&V_dyn_expire_lock) > +#define DYN_EXPIRED_LOCK() mtx_lock(&V_dyn_expire_lock) > +#define DYN_EXPIRED_UNLOCK() mtx_unlock(&V_dyn_expire_lock) > + > +static VNET_DEFINE(uint32_t, dyn_buckets_max); > +static VNET_DEFINE(uint32_t, curr_dyn_buckets); > +static VNET_DEFINE(struct callout, dyn_timeout); > +#define V_dyn_buckets_max VNET(dyn_buckets_max) > +#define V_curr_dyn_buckets VNET(curr_dyn_buckets) > +#define V_dyn_timeout VNET(dyn_timeout) > + > +/* Maximum length of states chain in a bucket */ > +static VNET_DEFINE(uint32_t, curr_max_length); > +#define V_curr_max_length VNET(curr_max_length) > + > +static VNET_DEFINE(uma_zone_t, dyn_data_zone); > +static VNET_DEFINE(uma_zone_t, dyn_parent_zone); > +static VNET_DEFINE(uma_zone_t, dyn_ipv4_zone); > +#ifdef INET6 > +static VNET_DEFINE(uma_zone_t, dyn_ipv6_zone); > +#define V_dyn_ipv6_zone VNET(dyn_ipv6_zone) > +#endif /* INET6 */ > +#define V_dyn_data_zone VNET(dyn_data_zone) > +#define V_dyn_parent_zone VNET(dyn_parent_zone) > +#define V_dyn_ipv4_zone VNET(dyn_ipv4_zone) > + > /* > * Timeouts for various events in handing dynamic rules. > */ > -static VNET_DEFINE(u_int32_t, dyn_ack_lifetime); > -static VNET_DEFINE(u_int32_t, dyn_syn_lifetime); > -static VNET_DEFINE(u_int32_t, dyn_fin_lifetime); > -static VNET_DEFINE(u_int32_t, dyn_rst_lifetime); > -static VNET_DEFINE(u_int32_t, dyn_udp_lifetime); > -static VNET_DEFINE(u_int32_t, dyn_short_lifetime); > +static VNET_DEFINE(uint32_t, dyn_ack_lifetime); > +static VNET_DEFINE(uint32_t, dyn_syn_lifetime); > +static VNET_DEFINE(uint32_t, dyn_fin_lifetime); > +static VNET_DEFINE(uint32_t, dyn_rst_lifetime); > +static VNET_DEFINE(uint32_t, dyn_udp_lifetime); > +static VNET_DEFINE(uint32_t, dyn_short_lifetime); > > #define V_dyn_ack_lifetime VNET(dyn_ack_lifetime) > #define V_dyn_syn_lifetime VNET(dyn_syn_lifetime) > @@ -174,10 +348,10 @@ static VNET_DEFINE(u_int32_t, dyn_short_lifetime); > * dyn_rst_lifetime and dyn_fin_lifetime should be strictly lower > * than dyn_keepalive_period. > */ > - > -static VNET_DEFINE(u_int32_t, dyn_keepalive_interval); > -static VNET_DEFINE(u_int32_t, dyn_keepalive_period); > -static VNET_DEFINE(u_int32_t, dyn_keepalive); > +#define DYN_KEEPALIVE_MAXQ 512 > +static VNET_DEFINE(uint32_t, dyn_keepalive_interval); > +static VNET_DEFINE(uint32_t, dyn_keepalive_period); > +static VNET_DEFINE(uint32_t, dyn_keepalive); > static VNET_DEFINE(time_t, dyn_keepalive_last); > > #define V_dyn_keepalive_interval VNET(dyn_keepalive_interval) > @@ -185,113 +359,208 @@ static VNET_DEFINE(time_t, dyn_keepalive_last); > #define V_dyn_keepalive VNET(dyn_keepalive) > #define V_dyn_keepalive_last VNET(dyn_keepalive_last) > > -static VNET_DEFINE(u_int32_t, dyn_max); /* max # of dynamic rules */ > - > -#define DYN_COUNT uma_zone_get_cur(V_ipfw_dyn_rule_zone) > +static VNET_DEFINE(uint32_t, dyn_max); /* max # of dynamic states */ > +static VNET_DEFINE(uint32_t, dyn_count); /* number of states */ > +static VNET_DEFINE(uint32_t, dyn_parent_max); /* max # of parent states */ > +static VNET_DEFINE(uint32_t, dyn_parent_count); /* number of parent states */ > #define V_dyn_max VNET(dyn_max) > +#define V_dyn_count VNET(dyn_count) > +#define V_dyn_parent_max VNET(dyn_parent_max) > +#define V_dyn_parent_count VNET(dyn_parent_count) > > -/* for userspace, we emulate the uma_zone_counter with ipfw_dyn_count */ > -static int ipfw_dyn_count; /* number of objects */ > +#define DYN_COUNT_DEC(name) do { \ > + MPASS((V_ ## name) > 0); \ > + ck_pr_dec_32(&(V_ ## name)); \ > +} while (0) > +#define DYN_COUNT_INC(name) ck_pr_inc_32(&(V_ ## name)) > +#define DYN_COUNT(name) ck_pr_load_32(&(V_ ## name)) > > -#ifdef USERSPACE /* emulation of UMA object counters for userspace */ > -#define uma_zone_get_cur(x) ipfw_dyn_count > -#endif /* USERSPACE */ > +static time_t last_log; /* Log ratelimiting */ > > -static int last_log; /* Log ratelimiting */ > +/* > + * Get/set maximum number of dynamic states in given VNET instance. > + */ > +static int > +sysctl_dyn_max(SYSCTL_HANDLER_ARGS) > +{ > + uint32_t nstates; > + int error; > > -static void ipfw_dyn_tick(void *vnetx); > -static void check_dyn_rules(struct ip_fw_chain *, ipfw_range_tlv *, int, int); > -#ifdef SYSCTL_NODE > + nstates = V_dyn_max; > + error = sysctl_handle_32(oidp, &nstates, 0, req); > + /* Read operation or some error */ > + if ((error != 0) || (req->newptr == NULL)) > + return (error); > > -static int sysctl_ipfw_dyn_count(SYSCTL_HANDLER_ARGS); > -static int sysctl_ipfw_dyn_max(SYSCTL_HANDLER_ARGS); > + V_dyn_max = nstates; > + uma_zone_set_max(V_dyn_data_zone, V_dyn_max); > + return (0); > +} > > -SYSBEGIN(f2) > +static int > +sysctl_dyn_parent_max(SYSCTL_HANDLER_ARGS) > +{ > + uint32_t nstates; > + int error; > > + nstates = V_dyn_parent_max; > + error = sysctl_handle_32(oidp, &nstates, 0, req); > + /* Read operation or some error */ > + if ((error != 0) || (req->newptr == NULL)) > + return (error); > + > + V_dyn_parent_max = nstates; > + uma_zone_set_max(V_dyn_parent_zone, V_dyn_parent_max); > + return (0); > +} > + > +static int > +sysctl_dyn_buckets(SYSCTL_HANDLER_ARGS) > +{ > + uint32_t nbuckets; > + int error; > + > + nbuckets = V_dyn_buckets_max; > + error = sysctl_handle_32(oidp, &nbuckets, 0, req); > + /* Read operation or some error */ > + if ((error != 0) || (req->newptr == NULL)) > + return (error); > + > + if (nbuckets > 256) > + V_dyn_buckets_max = 1 << fls(nbuckets - 1); > + else > + return (EINVAL); > + return (0); > +} > + > SYSCTL_DECL(_net_inet_ip_fw); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_buckets, > - CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_buckets_max), 0, > - "Max number of dyn. buckets"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, curr_dyn_buckets, > + > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_count, > + CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(dyn_count), 0, > + "Current number of dynamic states."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_parent_count, > + CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(dyn_parent_count), 0, > + "Current number of parent states. "); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, curr_dyn_buckets, > CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(curr_dyn_buckets), 0, > - "Current Number of dyn. buckets"); > -SYSCTL_PROC(_net_inet_ip_fw, OID_AUTO, dyn_count, > - CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RD, 0, 0, sysctl_ipfw_dyn_count, "IU", > - "Number of dyn. rules"); > + "Current number of buckets for states hash table."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, curr_max_length, > + CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(curr_max_length), 0, > + "Current maximum length of states chains in hash buckets."); > +SYSCTL_PROC(_net_inet_ip_fw, OID_AUTO, dyn_buckets, > + CTLFLAG_VNET | CTLTYPE_U32 | CTLFLAG_RW, 0, 0, sysctl_dyn_buckets, > + "IU", "Max number of buckets for dynamic states hash table."); > SYSCTL_PROC(_net_inet_ip_fw, OID_AUTO, dyn_max, > - CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW, 0, 0, sysctl_ipfw_dyn_max, "IU", > - "Max number of dyn. rules"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_ack_lifetime, > + CTLFLAG_VNET | CTLTYPE_U32 | CTLFLAG_RW, 0, 0, sysctl_dyn_max, > + "IU", "Max number of dynamic states."); > +SYSCTL_PROC(_net_inet_ip_fw, OID_AUTO, dyn_parent_max, > + CTLFLAG_VNET | CTLTYPE_U32 | CTLFLAG_RW, 0, 0, sysctl_dyn_parent_max, > + "IU", "Max number of parent dynamic states."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_ack_lifetime, > CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_ack_lifetime), 0, > - "Lifetime of dyn. rules for acks"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_syn_lifetime, > + "Lifetime of dynamic states for TCP ACK."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_syn_lifetime, > CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_syn_lifetime), 0, > - "Lifetime of dyn. rules for syn"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_fin_lifetime, > + "Lifetime of dynamic states for TCP SYN."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_fin_lifetime, > CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_fin_lifetime), 0, > - "Lifetime of dyn. rules for fin"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_rst_lifetime, > + "Lifetime of dynamic states for TCP FIN."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_rst_lifetime, > CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_rst_lifetime), 0, > - "Lifetime of dyn. rules for rst"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_udp_lifetime, > + "Lifetime of dynamic states for TCP RST."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_udp_lifetime, > CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_udp_lifetime), 0, > - "Lifetime of dyn. rules for UDP"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_short_lifetime, > + "Lifetime of dynamic states for UDP."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_short_lifetime, > CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_short_lifetime), 0, > - "Lifetime of dyn. rules for other situations"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_keepalive, > + "Lifetime of dynamic states for other situations."); > +SYSCTL_U32(_net_inet_ip_fw, OID_AUTO, dyn_keepalive, > CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_keepalive), 0, > - "Enable keepalives for dyn. rules"); > -SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, dyn_keep_states, > - CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(dyn_keep_states), 0, > - "Do not flush dynamic states on rule deletion"); > + "Enable keepalives for dynamic states."); > > -SYSEND > +#ifdef IPFIREWALL_DYNDEBUG > +#define DYN_DEBUG(fmt, ...) do { \ > + printf("%s: " fmt "\n", __func__, __VA_ARGS__); \ > +} while (0) > +#else > +#define DYN_DEBUG(fmt, ...) > +#endif /* !IPFIREWALL_DYNDEBUG */ > > -#endif /* SYSCTL_NODE */ > - > - > #ifdef INET6 > -static __inline int > -hash_packet6(const struct ipfw_flow_id *id) > -{ > - u_int32_t i; > - i = (id->dst_ip6.__u6_addr.__u6_addr32[2]) ^ > - (id->dst_ip6.__u6_addr.__u6_addr32[3]) ^ > - (id->src_ip6.__u6_addr.__u6_addr32[2]) ^ > - (id->src_ip6.__u6_addr.__u6_addr32[3]); > - return ntohl(i); > -} > -#endif > +/* Functions to work with IPv6 states */ > +static struct dyn_ipv6_state *dyn_lookup_ipv6_state( > + const struct ipfw_flow_id *, uint32_t, const void *, > + struct ipfw_dyn_info *, int); > +static int dyn_lookup_ipv6_state_locked(const struct ipfw_flow_id *, > + uint32_t, const void *, int, const void *, uint32_t, uint16_t, uint32_t, > + uint16_t); > +static struct dyn_ipv6_state *dyn_alloc_ipv6_state( > + const struct ipfw_flow_id *, uint32_t, uint16_t, uint8_t); > +static int dyn_add_ipv6_state(void *, uint32_t, uint16_t, uint8_t, > + const struct ipfw_flow_id *, uint32_t, const void *, int, uint32_t, > + struct ipfw_dyn_info *, uint16_t, uint16_t, uint8_t); > +static void dyn_export_ipv6_state(const struct dyn_ipv6_state *, > + ipfw_dyn_rule *); > > -/* > - * IMPORTANT: the hash function for dynamic rules must be commutative > - * in source and destination (ip,port), because rules are bidirectional > - * and we want to find both in the same bucket. > - */ > -static __inline int > -hash_packet(const struct ipfw_flow_id *id, int buckets) > -{ > - u_int32_t i; > +static uint32_t dyn_getscopeid(const struct ip_fw_args *); > +static void dyn_make_keepalive_ipv6(struct mbuf *, const struct in6_addr *, > + const struct in6_addr *, uint32_t, uint32_t, uint32_t, uint16_t, > + uint16_t); > +static void dyn_enqueue_keepalive_ipv6(struct mbufq *, > + const struct dyn_ipv6_state *); > +static void dyn_send_keepalive_ipv6(struct ip_fw_chain *); > > -#ifdef INET6 > - if (IS_IP6_FLOW_ID(id)) > - i = hash_packet6(id); > - else > +static struct dyn_ipv6_state *dyn_lookup_ipv6_parent( > + const struct ipfw_flow_id *, uint32_t, const void *, uint32_t, uint16_t, > + uint32_t); > +static struct dyn_ipv6_state *dyn_lookup_ipv6_parent_locked( > + const struct ipfw_flow_id *, uint32_t, const void *, uint32_t, uint16_t, > + uint32_t); > +static struct dyn_ipv6_state *dyn_add_ipv6_parent(void *, uint32_t, uint16_t, > + uint8_t, const struct ipfw_flow_id *, uint32_t, uint32_t, uint32_t, > + uint16_t); > #endif /* INET6 */ > - i = (id->dst_ip) ^ (id->src_ip); > - i ^= (id->dst_port) ^ (id->src_port); > - return (i & (buckets - 1)); > -} > > -#if 0 > -#define DYN_DEBUG(fmt, ...) do { \ > - printf("%s: " fmt "\n", __func__, __VA_ARGS__); \ > -} while (0) > -#else > -#define DYN_DEBUG(fmt, ...) > -#endif > +/* Functions to work with limit states */ > +static void *dyn_get_parent_state(const struct ipfw_flow_id *, uint32_t, > + struct ip_fw *, uint32_t, uint32_t, uint16_t); > +static struct dyn_ipv4_state *dyn_lookup_ipv4_parent( > + const struct ipfw_flow_id *, const void *, uint32_t, uint16_t, uint32_t); > +static struct dyn_ipv4_state *dyn_lookup_ipv4_parent_locked( > + const struct ipfw_flow_id *, const void *, uint32_t, uint16_t, uint32_t); > +static struct dyn_parent *dyn_alloc_parent(void *, uint32_t, uint16_t, > + uint8_t, uint32_t); > +static struct dyn_ipv4_state *dyn_add_ipv4_parent(void *, uint32_t, uint16_t, > + uint8_t, const struct ipfw_flow_id *, uint32_t, uint32_t, uint16_t); > > +static void dyn_tick(void *); > +static void dyn_expire_states(struct ip_fw_chain *, ipfw_range_tlv *); > +static void dyn_free_states(struct ip_fw_chain *); > +static void dyn_export_parent(const struct dyn_parent *, uint16_t, > + ipfw_dyn_rule *); > +static void dyn_export_data(const struct dyn_data *, uint16_t, uint8_t, > + ipfw_dyn_rule *); > +static uint32_t dyn_update_tcp_state(struct dyn_data *, > + const struct ipfw_flow_id *, const struct tcphdr *, int); > +static void dyn_update_proto_state(struct dyn_data *, > + const struct ipfw_flow_id *, const void *, int, int); > + > +/* Functions to work with IPv4 states */ > +struct dyn_ipv4_state *dyn_lookup_ipv4_state(const struct ipfw_flow_id *, > + const void *, struct ipfw_dyn_info *, int); > +static int dyn_lookup_ipv4_state_locked(const struct ipfw_flow_id *, > + const void *, int, const void *, uint32_t, uint16_t, uint32_t, uint16_t); > +static struct dyn_ipv4_state *dyn_alloc_ipv4_state( > + const struct ipfw_flow_id *, uint16_t, uint8_t); > +static int dyn_add_ipv4_state(void *, uint32_t, uint16_t, uint8_t, > + const struct ipfw_flow_id *, const void *, int, uint32_t, > + struct ipfw_dyn_info *, uint16_t, uint16_t, uint8_t); > +static void dyn_export_ipv4_state(const struct dyn_ipv4_state *, > + ipfw_dyn_rule *); > + > +/* > + * Named states support. > + */ > static char *default_state_name = "default"; > struct dyn_state_obj { > struct named_object no; > @@ -438,7 +707,6 @@ dyn_destroy(struct ip_fw_chain *ch, struct named_objec > KASSERT(no->refcnt == 1, > ("Destroying object '%s' (type %u, idx %u) with refcnt %u", > no->name, no->etlv, no->kidx, no->refcnt)); > - > DYN_DEBUG("kidx %d", no->kidx); > obj = SRV_OBJECT(ch, no->kidx); > SRV_OBJECT(ch, no->kidx) = NULL; > @@ -474,7 +742,137 @@ static struct opcode_obj_rewrite dyn_opcodes[] = { > dyn_create, dyn_destroy > }, > }; > -/** > + > +/* > + * IMPORTANT: the hash function for dynamic rules must be commutative > + * in source and destination (ip,port), because rules are bidirectional > + * and we want to find both in the same bucket. > + */ > +#ifndef IPFIREWALL_JENKINSHASH > +static __inline uint32_t > +hash_packet(const struct ipfw_flow_id *id) > +{ > + uint32_t i; > + > +#ifdef INET6 > + if (IS_IP6_FLOW_ID(id)) > + i = ntohl((id->dst_ip6.__u6_addr.__u6_addr32[2]) ^ > + (id->dst_ip6.__u6_addr.__u6_addr32[3]) ^ > + (id->src_ip6.__u6_addr.__u6_addr32[2]) ^ > + (id->src_ip6.__u6_addr.__u6_addr32[3])); > + else > +#endif /* INET6 */ > + i = (id->dst_ip) ^ (id->src_ip); > + i ^= (id->dst_port) ^ (id->src_port); > + return (i); > +} > + > +static __inline uint32_t > +hash_parent(const struct ipfw_flow_id *id, const void *rule) > +{ > + > + return (hash_packet(id) ^ ((uintptr_t)rule)); > +} > + > +#else /* IPFIREWALL_JENKINSHASH */ > + > +static VNET_DEFINE(uint32_t, dyn_hashseed); > +#define V_dyn_hashseed VNET(dyn_hashseed) > + > +static __inline int > +addrcmp4(const struct ipfw_flow_id *id) > +{ > + > + if (id->src_ip < id->dst_ip) > + return (0); > + if (id->src_ip > id->dst_ip) > + return (1); > + if (id->src_port <= id->dst_port) > + return (0); > + return (1); > +} > + > +#ifdef INET6 > +static __inline int > +addrcmp6(const struct ipfw_flow_id *id) > +{ > + int ret; > + > + ret = memcmp(&id->src_ip6, &id->dst_ip6, sizeof(struct in6_addr)); > + if (ret < 0) > + return (0); > + if (ret > 0) > + return (1); > + if (id->src_port <= id->dst_port) > + return (0); > + return (1); > +} > + > +static __inline uint32_t > +hash_packet6(const struct ipfw_flow_id *id) > +{ > + struct tuple6 { > + struct in6_addr addr[2]; > + uint16_t port[2]; > + } t6; > + > + if (addrcmp6(id) == 0) { > + t6.addr[0] = id->src_ip6; > + t6.addr[1] = id->dst_ip6; > + t6.port[0] = id->src_port; > + t6.port[1] = id->dst_port; > + } else { > + t6.addr[0] = id->dst_ip6; > + t6.addr[1] = id->src_ip6; > + t6.port[0] = id->dst_port; > + t6.port[1] = id->src_port; > + } > + return (jenkins_hash32((const uint32_t *)&t6, > + sizeof(t6) / sizeof(uint32_t), V_dyn_hashseed)); > +} > +#endif > + > +static __inline uint32_t > +hash_packet(const struct ipfw_flow_id *id) > +{ > + struct tuple4 { > + in_addr_t addr[2]; > + uint16_t port[2]; > + } t4; > + > + if (IS_IP4_FLOW_ID(id)) { > + /* All fields are in host byte order */ > + if (addrcmp4(id) == 0) { > + t4.addr[0] = id->src_ip; > + t4.addr[1] = id->dst_ip; > + t4.port[0] = id->src_port; > + t4.port[1] = id->dst_port; > + } else { > + t4.addr[0] = id->dst_ip; > + t4.addr[1] = id->src_ip; > + t4.port[0] = id->dst_port; > + t4.port[1] = id->src_port; > + } > + return (jenkins_hash32((const uint32_t *)&t4, > + sizeof(t4) / sizeof(uint32_t), V_dyn_hashseed)); > + } else > +#ifdef INET6 > + if (IS_IP6_FLOW_ID(id)) > + return (hash_packet6(id)); > +#endif > + return (0); > +} > + > +static __inline uint32_t > +hash_parent(const struct ipfw_flow_id *id, const void *rule) > +{ > + > + return (jenkins_hash32((const uint32_t *)&rule, > + sizeof(rule) / sizeof(uint32_t), hash_packet(id))); > +} > +#endif /* IPFIREWALL_JENKINSHASH */ > + > +/* > * Print customizable flow id description via log(9) facility. > */ > static void > @@ -502,903 +900,1809 @@ print_dyn_rule_flags(const struct ipfw_flow_id *id, in > } > log(log_flags, "ipfw: %s type %d %s %d -> %s %d, %d %s\n", > prefix, dyn_type, src, id->src_port, dst, > - id->dst_port, DYN_COUNT, postfix); > + id->dst_port, V_dyn_count, postfix); > } > > #define print_dyn_rule(id, dtype, prefix, postfix) \ > print_dyn_rule_flags(id, dtype, LOG_DEBUG, prefix, postfix) > > -#define TIME_LEQ(a,b) ((int)((a)-(b)) <= 0) > -#define TIME_LE(a,b) ((int)((a)-(b)) < 0) > +#define TIME_LEQ(a,b) ((int)((a)-(b)) <= 0) > +#define TIME_LE(a,b) ((int)((a)-(b)) < 0) > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-head@freebsd.org Fri Mar 23 08:55:36 2018 Return-Path: Delivered-To: svn-src-head@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 C8823F554F0; Fri, 23 Mar 2018 08:55:36 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-40.csi.cam.ac.uk (ppsw-40.csi.cam.ac.uk [131.111.8.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5388587F50; Fri, 23 Mar 2018 08:55:36 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:26712) by ppsw-40.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1ezIU3-0011Zc-jt (Exim 4.89_2) (return-path ); Fri, 23 Mar 2018 08:55:35 +0000 Date: Fri, 23 Mar 2018 08:46:36 +0000 From: Ruslan Bukin To: Alan Somers Cc: Conrad Meyer , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r330894 - in head/sys/contrib/zstd: . contrib/meson doc doc/images lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuilder lib/legacy programs tests zlibWrapper zlibWr... Message-ID: <20180323084636.GA18215@bsdpad.com> References: <201803140300.w2E30HmE024745@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 08:55:37 -0000 On Sat, Mar 17, 2018 at 03:49:15PM -0600, Alan Somers wrote: > On Tue, Mar 13, 2018 at 9:00 PM, Conrad Meyer <[1]cem@freebsd.org> wrote: > > Author: cem > Date: Wed Mar 14 03:00:17 2018 > New Revision: 330894 > URL: [2]https://svnweb.freebsd.org/changeset/base/330894 > > Log: >   Update to Zstandard 1.3.3 > >   Includes patch to conditionalize use of __builtin_clz(ll) on > __has_builtin(). >   The issue is tracked upstream at > [3]https://github.com/facebook/zstd/pull/884 . >   Otherwise, these are vanilla Zstandard 1.3.3 files. > >   Note that the 1.3.4 release should be due out soon. > >   Sponsored by: Dell EMC Isilon > > I think this broke the build on RISC-V.  Could you please take a look? > > [4]https://ci.freebsd.org/job/FreeBSD-head-riscv64-build/7028/console > I can confirm it breaks RISC-V Ruslan From owner-svn-src-head@freebsd.org Fri Mar 23 09:40:42 2018 Return-Path: Delivered-To: svn-src-head@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 8840EF59014; Fri, 23 Mar 2018 09:40: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 36FD669A04; Fri, 23 Mar 2018 09:40: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 31BDB1E355; Fri, 23 Mar 2018 09:40:42 +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 w2N9efnL090261; Fri, 23 Mar 2018 09:40:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N9efoA090258; Fri, 23 Mar 2018 09:40:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803230940.w2N9efoA090258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 09:40:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331419 - head/lib/libusb X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/lib/libusb X-SVN-Commit-Revision: 331419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 09:40:42 -0000 Author: hselasky Date: Fri Mar 23 09:40:41 2018 New Revision: 331419 URL: https://svnweb.freebsd.org/changeset/base/331419 Log: Allow the libusb20_dev_get_port_path() function to be called when the USB device is closed. This fixes a compatibility issue with upstream libusb. Found by: romain@ MFC after: 1 week Modified: head/lib/libusb/libusb20.c head/lib/libusb/libusb20_int.h head/lib/libusb/libusb20_ugen20.c Modified: head/lib/libusb/libusb20.c ============================================================================== --- head/lib/libusb/libusb20.c Fri Mar 23 05:37:18 2018 (r331418) +++ head/lib/libusb/libusb20.c Fri Mar 23 09:40:41 2018 (r331419) @@ -77,7 +77,6 @@ dummy_callback(struct libusb20_transfer *xfer) #define dummy_check_connected (void *)dummy_int #define dummy_set_power_mode (void *)dummy_int #define dummy_get_power_mode (void *)dummy_int -#define dummy_get_port_path (void *)dummy_int #define dummy_get_power_usage (void *)dummy_int #define dummy_kernel_driver_active (void *)dummy_int #define dummy_detach_kernel_driver (void *)dummy_int @@ -745,7 +744,26 @@ libusb20_dev_get_power_mode(struct libusb20_device *pd int libusb20_dev_get_port_path(struct libusb20_device *pdev, uint8_t *buf, uint8_t bufsize) { - return (pdev->methods->get_port_path(pdev, buf, bufsize)); + + if (pdev->port_level == 0) { + /* + * Fallback for backends without port path: + */ + if (bufsize < 2) + return (LIBUSB20_ERROR_OVERFLOW); + buf[0] = pdev->parent_address; + buf[1] = pdev->parent_port; + return (2); + } + + /* check if client buffer is too small */ + if (pdev->port_level > bufsize) + return (LIBUSB20_ERROR_OVERFLOW); + + /* copy port number information */ + memcpy(buf, pdev->port_path, pdev->port_level); + + return (pdev->port_level); /* success */ } uint16_t Modified: head/lib/libusb/libusb20_int.h ============================================================================== --- head/lib/libusb/libusb20_int.h Fri Mar 23 05:37:18 2018 (r331418) +++ head/lib/libusb/libusb20_int.h Fri Mar 23 09:40:41 2018 (r331419) @@ -107,7 +107,6 @@ typedef int (libusb20_process_t)(struct libusb20_devic typedef int (libusb20_reset_device_t)(struct libusb20_device *pdev); typedef int (libusb20_set_power_mode_t)(struct libusb20_device *pdev, uint8_t power_mode); typedef int (libusb20_get_power_mode_t)(struct libusb20_device *pdev, uint8_t *power_mode); -typedef int (libusb20_get_port_path_t)(struct libusb20_device *pdev, uint8_t *buf, uint8_t bufsize); typedef int (libusb20_get_power_usage_t)(struct libusb20_device *pdev, uint16_t *power_usage); typedef int (libusb20_set_alt_index_t)(struct libusb20_device *pdev, uint8_t iface_index, uint8_t alt_index); typedef int (libusb20_set_config_index_t)(struct libusb20_device *pdev, uint8_t index); @@ -131,7 +130,6 @@ typedef void (libusb20_tr_cancel_async_t)(struct libus m(n, check_connected) \ m(n, set_power_mode) \ m(n, get_power_mode) \ - m(n, get_port_path) \ m(n, get_power_usage) \ m(n, set_alt_index) \ m(n, set_config_index) \ @@ -237,8 +235,11 @@ struct libusb20_device { uint8_t is_opened; uint8_t parent_address; uint8_t parent_port; + uint8_t port_level; char usb_desc[96]; +#define LIBUSB20_DEVICE_PORT_PATH_MAX 32 + uint8_t port_path[LIBUSB20_DEVICE_PORT_PATH_MAX]; }; extern const struct libusb20_backend_methods libusb20_ugen20_backend; Modified: head/lib/libusb/libusb20_ugen20.c ============================================================================== --- head/lib/libusb/libusb20_ugen20.c Fri Mar 23 05:37:18 2018 (r331418) +++ head/lib/libusb/libusb20_ugen20.c Fri Mar 23 09:40:41 2018 (r331419) @@ -79,7 +79,6 @@ static libusb20_reset_device_t ugen20_reset_device; static libusb20_check_connected_t ugen20_check_connected; static libusb20_set_power_mode_t ugen20_set_power_mode; static libusb20_get_power_mode_t ugen20_get_power_mode; -static libusb20_get_port_path_t ugen20_get_port_path; static libusb20_get_power_usage_t ugen20_get_power_usage; static libusb20_kernel_driver_active_t ugen20_kernel_driver_active; static libusb20_detach_kernel_driver_t ugen20_detach_kernel_driver; @@ -136,6 +135,7 @@ ugen20_enumerate(struct libusb20_device *pdev, const c const char *tmp = id; struct usb_device_descriptor ddesc; struct usb_device_info devinfo; + struct usb_device_port_path udpp; uint32_t plugtime; char buf[64]; int f; @@ -219,6 +219,13 @@ ugen20_enumerate(struct libusb20_device *pdev, const c pdev->device_address, devinfo.udi_vendor, devinfo.udi_product, pdev->bus_number); + /* get device port path, if any */ + if (ioctl(f, IOUSB(USB_GET_DEV_PORT_PATH), &udpp) == 0 && + udpp.udp_port_level < LIBUSB20_DEVICE_PORT_PATH_MAX) { + memcpy(pdev->port_path, udpp.udp_port_no, udpp.udp_port_level); + pdev->port_level = udpp.udp_port_level; + } + error = 0; done: close(f); @@ -648,22 +655,6 @@ ugen20_get_power_mode(struct libusb20_device *pdev, ui } *power_mode = temp; return (0); /* success */ -} - -static int -ugen20_get_port_path(struct libusb20_device *pdev, uint8_t *buf, uint8_t bufsize) -{ - struct usb_device_port_path udpp; - - if (ioctl(pdev->file_ctrl, IOUSB(USB_GET_DEV_PORT_PATH), &udpp)) - return (LIBUSB20_ERROR_OTHER); - - if (udpp.udp_port_level > bufsize) - return (LIBUSB20_ERROR_OVERFLOW); - - memcpy(buf, udpp.udp_port_no, udpp.udp_port_level); - - return (udpp.udp_port_level); /* success */ } static int From owner-svn-src-head@freebsd.org Fri Mar 23 09:40:51 2018 Return-Path: Delivered-To: svn-src-head@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 1B346F5904A; Fri, 23 Mar 2018 09:40:51 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: from mail-wr0-x235.google.com (mail-wr0-x235.google.com [IPv6:2a00:1450:400c:c0c::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8490269AF5; Fri, 23 Mar 2018 09:40:50 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: by mail-wr0-x235.google.com with SMTP id p53so3914545wrc.10; Fri, 23 Mar 2018 02:40:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=559ZytdChV8WC4P5pFapLq1ou8KI4ahg8XipA4c4dAI=; b=k/wvDgQRfSMtcDyl+CPpj9CaaDTR5y78UATMEJC6b/63Waa81SWd/zy4hWc9xTnDR1 sFNiu89k79Co4ouHNQYGmCakrou+PXSB9Pj0ImI32GWGrQnJYeWszjSXA4PowNtMSVOk lQ38ePZHtY/nae0TF3vElKym3i0aYg9mjIvnVqT+OXVbYPm/jysMGuEJ+B1J0uGkyqPu HNjmBkyY+LmU8Y37zbi4oB5TWW7ppsmRyL38zwQ9E1vphelq3s2upjV0onej6j+ybF3Z pgVaCjMU6/SQCtPKolzHOzflcX6t+ZoE+A26W+zLyOl5U2OOK+X0ARwBFuFEROejYlWL X3og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=559ZytdChV8WC4P5pFapLq1ou8KI4ahg8XipA4c4dAI=; b=dsB/W+Avvo1sMpaNY/osElDPIsgzHRyhc7DPA+SoH2FtRjn0TDxJQSRKapbkX62MHc OU+uF/U+WgOrLIqVVvQTdME2YS0CzibETtsMQNg5sjf0jVBiU2mK5hP16WQr5PJIp78l v7E/cC3zmjlB+15viV6vT0qVsw+uSjqWxCyp5BAIBjRKu9s8ec12TyXHwetllSGxdvS2 Tgk0DdCm2feZ7SN74yjAmUEUSdP0gc8cj6fCgGX7jH6CmfZBMGIMTiNIMQWiXHNIx/e2 owahFHTCCdlZzEhXzY6Rx1kr6ZB0pElE4++aB67KtK1+mZNtS1Fcih2Dfp0IvZPH+Pra jOwg== X-Gm-Message-State: AElRT7EpDH8dmsHZct5MHNH1X3Au9vqMupGQLCBDAUpjWzGOC1uWQ3Gy +hheblg0iTeWzVYspd8+0LUXhYsNBegmpx0VQaVE3Q== X-Google-Smtp-Source: AG47ELsDDBltR/NZw5OHiwKMYw9cJH9eK57IigZV7ltG09w/KetVm5qaTMMn1Z4on2liFRMlWF56JLy6UUrcF0xYzXI= X-Received: by 10.223.195.142 with SMTP id p14mr20646969wrf.32.1521798049395; Fri, 23 Mar 2018 02:40:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.192.2 with HTTP; Fri, 23 Mar 2018 02:40:48 -0700 (PDT) In-Reply-To: References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> <20180322142225.GA5139@bsdpad.com> <27fbc131-990b-0b4b-1a90-ab84c2162e0e@FreeBSD.org> From: Jonathan Looney Date: Fri, 23 Mar 2018 09:40:48 +0000 Message-ID: Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat To: Justin Hibbits Cc: Andriy Gapon , Ruslan Bukin , "Jonathan T. Looney" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 09:40:51 -0000 On Thu, Mar 22, 2018 at 9:05 PM, Justin Hibbits wrote: > On Thu, Mar 22, 2018 at 3:44 PM, Andriy Gapon wrote: > > On 22/03/2018 17:39, Jonathan Looney wrote: > >> A tinderbox build didn't complain about atomic_fetchadd_64, so I assume > it is OK. > >> > > FWWI, TARGET=powerpc TARGET_ARCH=powerpc build failed for me. > > > > cc1: warnings being treated as errors > > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c: In function > 'tcp_log_selectauto': > > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c:286: warning: implicit > declaration > > of function 'atomic_fetchadd_64' > > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c:286: warning: nested > extern > > declaration of 'atomic_fetchadd_64' [-Wnested-externs] > > mips complains, too. Check out https://ci.freebsd.org/tinderbox . > Thanks for all the reports! I'm working on a fix now. Jonathan From owner-svn-src-head@freebsd.org Fri Mar 23 09:42:47 2018 Return-Path: Delivered-To: svn-src-head@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 D1BE2F594C1; Fri, 23 Mar 2018 09:42:47 +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 7E3B269FB1; Fri, 23 Mar 2018 09:42:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7938F1E3DD; Fri, 23 Mar 2018 09:42:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N9glgW095018; Fri, 23 Mar 2018 09:42:47 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N9gl5Q095017; Fri, 23 Mar 2018 09:42:47 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803230942.w2N9gl5Q095017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 23 Mar 2018 09:42:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331420 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 331420 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 09:42:48 -0000 Author: avg Date: Fri Mar 23 09:42:47 2018 New Revision: 331420 URL: https://svnweb.freebsd.org/changeset/base/331420 Log: zfs: fix mismatch between format specifier and type vdev_dbgmsg_print_tree printed vdev_id of uint64_t type with %u format specifier. That caused subsequent parameters to be incorrectly read from the stack and lead to a crash when a wrong value was interpreted as a string pointer. This should be upstreamed. Reported by: pho MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Mar 23 09:40:41 2018 (r331419) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Mar 23 09:42:47 2018 (r331420) @@ -237,7 +237,7 @@ vdev_dbgmsg_print_tree(vdev_t *vd, int indent) } zfs_dbgmsg("%*svdev %u: %s%s, guid: %llu, path: %s, %s", indent, - "", vd->vdev_id, vd->vdev_ops->vdev_op_type, + "", (int)vd->vdev_id, vd->vdev_ops->vdev_op_type, vd->vdev_islog ? " (log)" : "", (u_longlong_t)vd->vdev_guid, vd->vdev_path ? vd->vdev_path : "N/A", state); From owner-svn-src-head@freebsd.org Fri Mar 23 11:08:59 2018 Return-Path: Delivered-To: svn-src-head@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 B7F6FF606E3; Fri, 23 Mar 2018 11:08:59 +0000 (UTC) (envelope-from andrew@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 6A6246DDFD; Fri, 23 Mar 2018 11:08:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60A891F0BD; Fri, 23 Mar 2018 11:08:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NB8xec035953; Fri, 23 Mar 2018 11:08:59 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NB8xdM035952; Fri, 23 Mar 2018 11:08:59 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201803231108.w2NB8xdM035952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 23 Mar 2018 11:08:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331421 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 331421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 11:08:59 -0000 Author: andrew Date: Fri Mar 23 11:08:59 2018 New Revision: 331421 URL: https://svnweb.freebsd.org/changeset/base/331421 Log: If sc->sc_ep_max is already set use it to find the number of RX and TX endpoints. The Allwinner driver will need to set this as the EPINFO register isn't useful there. Submitted by: jmcneill Reviewed by: hselasky Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D5881 Modified: head/sys/dev/usb/controller/musb_otg.c Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Fri Mar 23 09:42:47 2018 (r331420) +++ head/sys/dev/usb/controller/musb_otg.c Fri Mar 23 11:08:59 2018 (r331421) @@ -3168,19 +3168,24 @@ musbotg_init(struct musbotg_softc *sc) MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, 0); - /* read out number of endpoints */ + if (sc->sc_ep_max == 0) { + /* read out number of endpoints */ - nrx = - (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) / 16); + nrx = + (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) / 16); - ntx = - (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) % 16); + ntx = + (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) % 16); + sc->sc_ep_max = (nrx > ntx) ? nrx : ntx; + } else { + nrx = ntx = sc->sc_ep_max; + } + /* these numbers exclude the control endpoint */ DPRINTFN(2, "RX/TX endpoints: %u/%u\n", nrx, ntx); - sc->sc_ep_max = (nrx > ntx) ? nrx : ntx; if (sc->sc_ep_max == 0) { DPRINTFN(2, "ERROR: Looks like the clocks are off!\n"); } From owner-svn-src-head@freebsd.org Fri Mar 23 12:01:27 2018 Return-Path: Delivered-To: svn-src-head@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 B2602F65399; Fri, 23 Mar 2018 12:01:27 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-42.csi.cam.ac.uk (ppsw-42.csi.cam.ac.uk [131.111.8.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E31E7025E; Fri, 23 Mar 2018 12:01:26 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:57006) by ppsw-42.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1ezLNu-000o5d-6W (Exim 4.89_2) (return-path ); Fri, 23 Mar 2018 12:01:26 +0000 Date: Fri, 23 Mar 2018 11:52:27 +0000 From: Ruslan Bukin To: Alan Somers Cc: Conrad Meyer , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r330894 - in head/sys/contrib/zstd: . contrib/meson doc doc/images lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuilder lib/legacy programs tests zlibWrapper zlibWr... Message-ID: <20180323115227.GA21270@bsdpad.com> References: <201803140300.w2E30HmE024745@repo.freebsd.org> <20180323084636.GA18215@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180323084636.GA18215@bsdpad.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 12:01:27 -0000 On Fri, Mar 23, 2018 at 08:46:36AM +0000, Ruslan Bukin wrote: > On Sat, Mar 17, 2018 at 03:49:15PM -0600, Alan Somers wrote: > > On Tue, Mar 13, 2018 at 9:00 PM, Conrad Meyer <[1]cem@freebsd.org> wrote: > > > > Author: cem > > Date: Wed Mar 14 03:00:17 2018 > > New Revision: 330894 > > URL: [2]https://svnweb.freebsd.org/changeset/base/330894 > > > > Log: > >   Update to Zstandard 1.3.3 > > > > I think this broke the build on RISC-V.  Could you please take a look? > > I can confirm it breaks RISC-V > I found the problem: after this commit kernel become slightly bigger: it was 0x5fd080 bytes, become 0x61b080 bytes. Spike gives us 0x600000 free space only between start of physram to place where it puts DTB. So DTB appears under our BSS section and we clear it during boot, so DTB is no longer valid and kernel get stuck in fdt header checking routine. I'm currently looking for a solution and rearrangements, it will take some time. Thanks Ruslan From owner-svn-src-head@freebsd.org Fri Mar 23 13:52:27 2018 Return-Path: Delivered-To: svn-src-head@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 995E8F6E2BF; Fri, 23 Mar 2018 13:52:27 +0000 (UTC) (envelope-from ken@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 3D6587501C; Fri, 23 Mar 2018 13:52:27 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 3836120BF1; Fri, 23 Mar 2018 13:52:27 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NDqRhw021115; Fri, 23 Mar 2018 13:52:27 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NDqQUK021113; Fri, 23 Mar 2018 13:52:26 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201803231352.w2NDqQUK021113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 23 Mar 2018 13:52:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331422 - in head/sys/dev: mpr mps X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in head/sys/dev: mpr mps X-SVN-Commit-Revision: 331422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 13:52:27 -0000 Author: ken Date: Fri Mar 23 13:52:26 2018 New Revision: 331422 URL: https://svnweb.freebsd.org/changeset/base/331422 Log: Disable T10 Protection Information / EEDP handling for type 2 protection. The mps(4) and mpr(4) drivers and hardware handle T10 Protection Information, which is a system of checksums and guard blocks to protect data while it is being transferred and while it is on disk. It is also known as T10 DIF. For more details, see section 4.22 of the SBC-4 spec. Supporting Type 2 protection requires using 32 byte CDBs, and filling in the fields in those CDBs. We don't yet support that in the da(4) driver. Type 1 and Type 3 protection don't require that, and can be handled by the mps(4)/mpr(4) driver's code and firmware without any additional input from the da(4) driver. If a drive has Type 2 protection enabled (you frequently see this with SAS drives shipped from Dell), don't set the various EEDP fields in the mps(4)/mpr(4) driver command fields. Otherwise, you wind up with errors like this that would otherwise make no sense: (da9:mpr0:0:18:0): READ(10). CDB: 28 00 00 00 00 00 00 02 00 00 (da9:mpr0:0:18:0): CAM status: SCSI Status Error (da9:mpr0:0:18:0): SCSI status: Check Condition (da9:mpr0:0:18:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid command operation code) (da9:mpr0:0:18:0): (da9:mpr0:0:18:0): Field Replaceable Unit: 0 (da9:mpr0:0:18:0): Command Specific Info: 0 (da9:mpr0:0:18:0): (da9:mpr0:0:18:0): Descriptor 0x80: f8 21 (da9:mpr0:0:18:0): Descriptor 0x81: 00 00 00 00 00 00 (da9:mpr0:0:18:0): Error 22, Unretryable error In other words, what kind of strange SAS hard drive doesn't support a standard 10 byte SCSI READ command? In this case, one that has Type 2 protection enabled. We can revisit this when we put Type 2 protection support in the da(4) driver, but for now this will help people who put Type 2 formatted drives in a system and wonder what in the world is going on. MFC after: 3 days Sponsored by: Spectra Logic Modified: head/sys/dev/mpr/mpr_sas.c head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Fri Mar 23 11:08:59 2018 (r331421) +++ head/sys/dev/mpr/mpr_sas.c Fri Mar 23 13:52:26 2018 (r331422) @@ -2130,8 +2130,8 @@ mprsas_action_scsiio(struct mprsas_softc *sassc, union CDB.EEDP32.PrimaryReferenceTag); req->CDB.EEDP32.PrimaryApplicationTagMask = 0xFFFF; - req->CDB.CDB32[1] = (req->CDB.CDB32[1] & 0x1F) | - 0x20; + req->CDB.CDB32[1] = + (req->CDB.CDB32[1] & 0x1F) | 0x20; } else { eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_INC_PRI_APPTAG; @@ -3502,8 +3502,19 @@ mprsas_async(void *callback_arg, uint32_t code, struct if ((mprsas_get_ccbstatus((union ccb *)&cdai) == CAM_REQ_CMP) && (rcap_buf.prot & SRC16_PROT_EN)) { - lun->eedp_formatted = TRUE; - lun->eedp_block_size = scsi_4btoul(rcap_buf.length); + switch (rcap_buf.prot & SRC16_P_TYPE) { + case SRC16_PTYPE_1: + case SRC16_PTYPE_3: + lun->eedp_formatted = TRUE; + lun->eedp_block_size = + scsi_4btoul(rcap_buf.length); + break; + case SRC16_PTYPE_2: + default: + lun->eedp_formatted = FALSE; + lun->eedp_block_size = 0; + break; + } } else { lun->eedp_formatted = FALSE; lun->eedp_block_size = 0; Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Fri Mar 23 11:08:59 2018 (r331421) +++ head/sys/dev/mps/mps_sas.c Fri Mar 23 13:52:26 2018 (r331422) @@ -3231,8 +3231,19 @@ mpssas_async(void *callback_arg, uint32_t code, struct if ((mpssas_get_ccbstatus((union ccb *)&cdai) == CAM_REQ_CMP) && (rcap_buf.prot & SRC16_PROT_EN)) { - lun->eedp_formatted = TRUE; - lun->eedp_block_size = scsi_4btoul(rcap_buf.length); + switch (rcap_buf.prot & SRC16_P_TYPE) { + case SRC16_PTYPE_1: + case SRC16_PTYPE_3: + lun->eedp_formatted = TRUE; + lun->eedp_block_size = + scsi_4btoul(rcap_buf.length); + break; + case SRC16_PTYPE_2: + default: + lun->eedp_formatted = FALSE; + lun->eedp_block_size = 0; + break; + } } else { lun->eedp_formatted = FALSE; lun->eedp_block_size = 0; From owner-svn-src-head@freebsd.org Fri Mar 23 14:38:57 2018 Return-Path: Delivered-To: svn-src-head@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 58B31F4CC17; Fri, 23 Mar 2018 14:38:57 +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 0714A76F42; Fri, 23 Mar 2018 14:38:57 +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 F219621257; Fri, 23 Mar 2018 14:38:56 +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 w2NEcuJJ041424; Fri, 23 Mar 2018 14:38:56 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NEcuOv041423; Fri, 23 Mar 2018 14:38:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803231438.w2NEcuOv041423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 23 Mar 2018 14:38:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331425 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 14:38:57 -0000 Author: markj Date: Fri Mar 23 14:38:56 2018 New Revision: 331425 URL: https://svnweb.freebsd.org/changeset/base/331425 Log: Correct a couple of assertion messages in vm_page_reclaim_run(). MFC after: 3 days Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Mar 23 14:36:24 2018 (r331424) +++ head/sys/vm/vm_page.c Fri Mar 23 14:38:56 2018 (r331425) @@ -2473,7 +2473,7 @@ retry: goto unlock; } KASSERT(m_new->wire_count == 0, - ("page %p is wired", m)); + ("page %p is wired", m_new)); /* * Replace "m" with the new page. For @@ -2485,7 +2485,7 @@ retry: pmap_remove_all(m); m_new->aflags = m->aflags; KASSERT(m_new->oflags == VPO_UNMANAGED, - ("page %p is managed", m)); + ("page %p is managed", m_new)); m_new->oflags = m->oflags & VPO_NOSYNC; pmap_copy_page(m, m_new); m_new->valid = m->valid; From owner-svn-src-head@freebsd.org Fri Mar 23 14:39:35 2018 Return-Path: Delivered-To: svn-src-head@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 8E89FF4CCCF; Fri, 23 Mar 2018 14:39:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 3CD24770A5; Fri, 23 Mar 2018 14:39:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37AF121258; Fri, 23 Mar 2018 14:39:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NEdZEm041494; Fri, 23 Mar 2018 14:39:35 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NEdY03041489; Fri, 23 Mar 2018 14:39:34 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803231439.w2NEdY03041489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 14:39:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331426 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 331426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 14:39:35 -0000 Author: emaste Date: Fri Mar 23 14:39:34 2018 New Revision: 331426 URL: https://svnweb.freebsd.org/changeset/base/331426 Log: Rationalize license text on Linuxolator files Many licenses on Linuxolator files contained small variations from the standard FreeBSD license text. To avoid license proliferation switch to the standard 2-Clause FreeBSD license for those files where I have permission from each of the listed copyright holders. Approved by: rdivacky, marcel MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_ioctl.h head/sys/compat/linux/linux_ipc.h head/sys/compat/linux/linux_mib.h head/sys/compat/linux/linux_misc.h head/sys/compat/linux/linux_signal.h Modified: head/sys/compat/linux/linux_ioctl.h ============================================================================== --- head/sys/compat/linux/linux_ioctl.h Fri Mar 23 14:38:56 2018 (r331425) +++ head/sys/compat/linux/linux_ioctl.h Fri Mar 23 14:39:34 2018 (r331426) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 1999 Marcel Moolenaar * All rights reserved. @@ -8,24 +8,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * 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$ */ Modified: head/sys/compat/linux/linux_ipc.h ============================================================================== --- head/sys/compat/linux/linux_ipc.h Fri Mar 23 14:38:56 2018 (r331425) +++ head/sys/compat/linux/linux_ipc.h Fri Mar 23 14:39:34 2018 (r331426) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2000 Marcel Moolenaar * All rights reserved. @@ -8,24 +8,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * 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$ */ Modified: head/sys/compat/linux/linux_mib.h ============================================================================== --- head/sys/compat/linux/linux_mib.h Fri Mar 23 14:38:56 2018 (r331425) +++ head/sys/compat/linux/linux_mib.h Fri Mar 23 14:39:34 2018 (r331426) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 1999 Marcel Moolenaar * All rights reserved. @@ -8,24 +8,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * 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$ */ Modified: head/sys/compat/linux/linux_misc.h ============================================================================== --- head/sys/compat/linux/linux_misc.h Fri Mar 23 14:38:56 2018 (r331425) +++ head/sys/compat/linux/linux_misc.h Fri Mar 23 14:39:34 2018 (r331426) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2006 Roman Divacky * All rights reserved. @@ -8,24 +8,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * 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$ */ Modified: head/sys/compat/linux/linux_signal.h ============================================================================== --- head/sys/compat/linux/linux_signal.h Fri Mar 23 14:38:56 2018 (r331425) +++ head/sys/compat/linux/linux_signal.h Fri Mar 23 14:39:34 2018 (r331426) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2000 Marcel Moolenaar * All rights reserved. @@ -8,24 +8,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * 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$ */ From owner-svn-src-head@freebsd.org Fri Mar 23 15:25:55 2018 Return-Path: Delivered-To: svn-src-head@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 F314BF5115E; Fri, 23 Mar 2018 15:25:54 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-42.csi.cam.ac.uk (ppsw-42.csi.cam.ac.uk [131.111.8.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95A79796A7; Fri, 23 Mar 2018 15:25:54 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:18176) by ppsw-42.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1ezOZl-0004sy-7F (Exim 4.89_2) (return-path ); Fri, 23 Mar 2018 15:25:53 +0000 Date: Fri, 23 Mar 2018 15:16:54 +0000 From: Ruslan Bukin To: Alan Somers Cc: Conrad Meyer , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r330894 - in head/sys/contrib/zstd: . contrib/meson doc doc/images lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuilder lib/legacy programs tests zlibWrapper zlibWr... Message-ID: <20180323151654.GA24598@bsdpad.com> References: <201803140300.w2E30HmE024745@repo.freebsd.org> <20180323084636.GA18215@bsdpad.com> <20180323115227.GA21270@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180323115227.GA21270@bsdpad.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 15:25:55 -0000 On Fri, Mar 23, 2018 at 11:52:27AM +0000, Ruslan Bukin wrote: > On Fri, Mar 23, 2018 at 08:46:36AM +0000, Ruslan Bukin wrote: > > On Sat, Mar 17, 2018 at 03:49:15PM -0600, Alan Somers wrote: > > > On Tue, Mar 13, 2018 at 9:00 PM, Conrad Meyer <[1]cem@freebsd.org> wrote: > > > > > > Author: cem > > > Date: Wed Mar 14 03:00:17 2018 > > > New Revision: 330894 > > > URL: [2]https://svnweb.freebsd.org/changeset/base/330894 > > > > > > Log: > > >   Update to Zstandard 1.3.3 > > > > > > I think this broke the build on RISC-V.  Could you please take a look? > > > > I can confirm it breaks RISC-V > > > > I found the problem: after this commit kernel become slightly bigger: it was 0x5fd080 bytes, become 0x61b080 bytes. > > Spike gives us 0x600000 free space only between start of physram to place where it puts DTB. > So DTB appears under our BSS section and we clear it during boot, so DTB is no longer valid and kernel get stuck in fdt header checking routine. > > I'm currently looking for a solution and rearrangements, it will take some time. > I found that Berkeley Boot Loader (BBL) miscalculates the size of payload (freebsd kernel) -- they does not include BSS section to calculatons. I made a fix to our local riscv-pk (https://github.com/freebsd-riscv/riscv-pk) and created a pull request: https://github.com/riscv/riscv-pk/pull/91 Thanks Ruslan From owner-svn-src-head@freebsd.org Fri Mar 23 15:35:07 2018 Return-Path: Delivered-To: svn-src-head@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 A270AF51E2F; Fri, 23 Mar 2018 15:35:07 +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 54DDC79E51; Fri, 23 Mar 2018 15:35:07 +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 4FC2B21C2A; Fri, 23 Mar 2018 15:35:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NFZ7Le071663; Fri, 23 Mar 2018 15:35:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NFZ7Hj071662; Fri, 23 Mar 2018 15:35:07 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803231535.w2NFZ7Hj071662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Mar 2018 15:35:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331428 - head/sys/dev/ed X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/ed X-SVN-Commit-Revision: 331428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 15:35:07 -0000 Author: imp Date: Fri Mar 23 15:35:07 2018 New Revision: 331428 URL: https://svnweb.freebsd.org/changeset/base/331428 Log: kill traling white space Modified: head/sys/dev/ed/if_ed_pci.c Modified: head/sys/dev/ed/if_ed_pci.c ============================================================================== --- head/sys/dev/ed/if_ed_pci.c Fri Mar 23 14:59:30 2018 (r331427) +++ head/sys/dev/ed/if_ed_pci.c Fri Mar 23 15:35:07 2018 (r331428) @@ -147,4 +147,3 @@ MODULE_DEPEND(ed, pci, 1, 1, 1); MODULE_DEPEND(ed, ether, 1, 1, 1); MODULE_PNP_INFO("W32:vendor/device;D:#", pci, ed, pci_ids, sizeof(pci_ids[0]), nitems(pci_ids) - 1); - From owner-svn-src-head@freebsd.org Fri Mar 23 15:35:16 2018 Return-Path: Delivered-To: svn-src-head@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 EAA01F51E92; Fri, 23 Mar 2018 15:35:15 +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 9E87479F3A; Fri, 23 Mar 2018 15:35:15 +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 999B421C2B; Fri, 23 Mar 2018 15:35:15 +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 w2NFZFYP071720; Fri, 23 Mar 2018 15:35:15 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NFZFEO071719; Fri, 23 Mar 2018 15:35:15 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803231535.w2NFZFEO071719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Mar 2018 15:35:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331429 - head/sys/dev/xl X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/xl X-SVN-Commit-Revision: 331429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 15:35:16 -0000 Author: imp Date: Fri Mar 23 15:35:15 2018 New Revision: 331429 URL: https://svnweb.freebsd.org/changeset/base/331429 Log: Add PNP info to xl as an example. Modified: head/sys/dev/xl/if_xl.c Modified: head/sys/dev/xl/if_xl.c ============================================================================== --- head/sys/dev/xl/if_xl.c Fri Mar 23 15:35:07 2018 (r331428) +++ head/sys/dev/xl/if_xl.c Fri Mar 23 15:35:15 2018 (r331429) @@ -334,6 +334,8 @@ static devclass_t xl_devclass; DRIVER_MODULE_ORDERED(xl, pci, xl_driver, xl_devclass, NULL, NULL, SI_ORDER_ANY); DRIVER_MODULE(miibus, xl, miibus_driver, miibus_devclass, NULL, NULL); +MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, xl, xl_devs, sizeof(xl_devs[0]), + nitems(xl_devs) - 1); static void xl_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) From owner-svn-src-head@freebsd.org Fri Mar 23 15:35:23 2018 Return-Path: Delivered-To: svn-src-head@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 37CCFF51ECB; Fri, 23 Mar 2018 15:35: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 55D0379FE1; Fri, 23 Mar 2018 15:35:21 +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 6EAB621C2C; Fri, 23 Mar 2018 15:35:20 +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 w2NFZKYf071774; Fri, 23 Mar 2018 15:35:20 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NFZJ6E071772; Fri, 23 Mar 2018 15:35:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803231535.w2NFZJ6E071772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Mar 2018 15:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331430 - in head/sys: dev/adlink modules/adlink X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: dev/adlink modules/adlink X-SVN-Commit-Revision: 331430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 15:35:23 -0000 Author: imp Date: Fri Mar 23 15:35:19 2018 New Revision: 331430 URL: https://svnweb.freebsd.org/changeset/base/331430 Log: Convert the PCI ID selection from a simple if into a table. Mark the table with PNP info. Fix compilation by returning FILTER_STRAY in two places, as suggested by comments. Create a simple module from this. Left unconnected because I can't test it as a module. Added: head/sys/modules/adlink/ head/sys/modules/adlink/Makefile (contents, props changed) Modified: head/sys/dev/adlink/adlink.c Modified: head/sys/dev/adlink/adlink.c ============================================================================== --- head/sys/dev/adlink/adlink.c Fri Mar 23 15:35:15 2018 (r331429) +++ head/sys/dev/adlink/adlink.c Fri Mar 23 15:35:19 2018 (r331430) @@ -137,7 +137,7 @@ adlink_intr(void *arg) sc = arg; u = bus_read_4(sc->res[0], 0x38); if (!(u & 0x00800000)) - return; // XXX - FILTER_STRAY? + return (FILTER_STRAY); bus_write_4(sc->res[0], 0x38, u | 0x003f4000); sc->sample += sc->p0->chunksize / 2; @@ -150,7 +150,7 @@ adlink_intr(void *arg) if (sc->p0->state != STATE_RUN) { printf("adlink: stopping %d\n", sc->p0->state); - return; // XXX - FILTER_STRAY? + return (FILTER_STRAY); } pg = pg->next; @@ -346,14 +346,32 @@ adlink_ioctl(struct cdev *dev, u_long cmd, caddr_t dat static devclass_t adlink_devclass; +struct pci_id +{ + uint16_t vendor; + uint16_t device; + const char *desc; +} adlink_id[] = { + { .vendor = 0x10e8, .device = 0x80da, + .desc ="Adlink PCI-9812 4 ch 12 bit 20 msps" } +}; + static int adlink_probe(device_t self) { + int i; + uint16_t vendor, device; - if (pci_get_devid(self) != 0x80da10e8) - return (ENXIO); - device_set_desc(self, "Adlink PCI-9812 4 ch 12 bit 20 msps"); - return (BUS_PROBE_DEFAULT); + vendor = pci_get_vendor(self); + device = pci_get_device(self); + for (i = 0; i < nitems(adlink_id); i++) { + if (adlink_id[i].vendor == vendor && + adlink_id[i].device == device) { + device_set_desc(self, adlink_id[i].desc); + return (BUS_PROBE_DEFAULT); + } + } + return (ENXIO); } static struct resource_spec adlink_res_spec[] = { @@ -420,5 +438,6 @@ static driver_t adlink_driver = { }; DRIVER_MODULE(adlink, pci, adlink_driver, adlink_devclass, 0, 0); - +MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, adlink, adlink_id, sizeof(adlink_id[0]), + nitems(adlink_id)); #endif /* _KERNEL */ Added: head/sys/modules/adlink/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/adlink/Makefile Fri Mar 23 15:35:19 2018 (r331430) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/adlink + +KMOD= adlink +SRCS= adlink.c \ + device_if.h bus_if.h + +.include From owner-svn-src-head@freebsd.org Fri Mar 23 15:44:32 2018 Return-Path: Delivered-To: svn-src-head@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 7C85DF52B71; Fri, 23 Mar 2018 15:44:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 2E1057A898; Fri, 23 Mar 2018 15:44:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24E1821DD3; Fri, 23 Mar 2018 15:44:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NFiVbj076902; Fri, 23 Mar 2018 15:44:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NFiVrQ076901; Fri, 23 Mar 2018 15:44:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803231544.w2NFiVrQ076901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Mar 2018 15:44:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331431 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 331431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 15:44:32 -0000 Author: kib Date: Fri Mar 23 15:44:31 2018 New Revision: 331431 URL: https://svnweb.freebsd.org/changeset/base/331431 Log: Update comment to match current field names. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/i386/i386/vm86.c Modified: head/sys/i386/i386/vm86.c ============================================================================== --- head/sys/i386/i386/vm86.c Fri Mar 23 15:35:19 2018 (r331430) +++ head/sys/i386/i386/vm86.c Fri Mar 23 15:44:31 2018 (r331431) @@ -417,8 +417,8 @@ vm86_initialize(void) * pcb_esp = stack frame pointer at time of switch * pcb_ebx = va of vm86 page table * pcb_eip = argument pointer to initial call - * pcb_spare[0] = saved TSS descriptor, word 0 - * pcb_space[1] = saved TSS descriptor, word 1 + * pcb_vm86[0] = saved TSS descriptor, word 0 + * pcb_vm86[1] = saved TSS descriptor, word 1 */ #define new_ptd pcb_esi #define vm86_frame pcb_ebp From owner-svn-src-head@freebsd.org Fri Mar 23 15:46:53 2018 Return-Path: Delivered-To: svn-src-head@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 C3C66F52FF4; Fri, 23 Mar 2018 15:46:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 72D117ABC2; Fri, 23 Mar 2018 15:46:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D79821DD5; Fri, 23 Mar 2018 15:46:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NFkrRt077146; Fri, 23 Mar 2018 15:46:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NFkrl3077145; Fri, 23 Mar 2018 15:46:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803231546.w2NFkrl3077145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Mar 2018 15:46:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331432 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 331432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 15:46:53 -0000 Author: kib Date: Fri Mar 23 15:46:53 2018 New Revision: 331432 URL: https://svnweb.freebsd.org/changeset/base/331432 Log: There is no need to disable interrupts around npxsave call. i386 was changed to only require critical section around the thread FPU state manipulations, and vm86_bioscall callers already enter critical section for other reasons. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/i386/i386/vm86bios.s Modified: head/sys/i386/i386/vm86bios.s ============================================================================== --- head/sys/i386/i386/vm86bios.s Fri Mar 23 15:44:31 2018 (r331431) +++ head/sys/i386/i386/vm86bios.s Fri Mar 23 15:46:53 2018 (r331432) @@ -61,8 +61,6 @@ ENTRY(vm86_bioscall) pushl %edi pushl %gs - pushfl - cli movl PCPU(CURTHREAD),%ecx cmpl %ecx,PCPU(FPCURTHREAD) /* do we need to save fp? */ jne 1f @@ -73,8 +71,6 @@ ENTRY(vm86_bioscall) addl $4,%esp popl %edx /* recover our pcb */ 1: - popfl - movl SCR_VMFRAME(%edx),%ebx /* target frame location */ movl %ebx,%edi /* destination */ movl SCR_ARGFRAME(%edx),%esi /* source (set on entry) */ From owner-svn-src-head@freebsd.org Fri Mar 23 15:50:05 2018 Return-Path: Delivered-To: svn-src-head@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 1688AF533FE; Fri, 23 Mar 2018 15:50:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 BD2647AE29; Fri, 23 Mar 2018 15:50:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3DCB21DD9; Fri, 23 Mar 2018 15:50:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NFo47a077351; Fri, 23 Mar 2018 15:50:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NFo1kH077319; Fri, 23 Mar 2018 15:50:01 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803231550.w2NFo1kH077319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 15:50:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331433 - in head/sys/compat/linuxkpi/common: include/asm include/linux include/net src X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/asm include/linux include/net src X-SVN-Commit-Revision: 331433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 15:50:05 -0000 Author: emaste Date: Fri Mar 23 15:50:01 2018 New Revision: 331433 URL: https://svnweb.freebsd.org/changeset/base/331433 Log: linuxkpi whitespace cleanup Reviewed by: hselasky, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14807 Modified: head/sys/compat/linuxkpi/common/include/asm/byteorder.h head/sys/compat/linuxkpi/common/include/linux/bitops.h head/sys/compat/linuxkpi/common/include/linux/cdev.h head/sys/compat/linuxkpi/common/include/linux/compiler.h head/sys/compat/linuxkpi/common/include/linux/device.h head/sys/compat/linuxkpi/common/include/linux/dma-attrs.h head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h head/sys/compat/linuxkpi/common/include/linux/err.h head/sys/compat/linuxkpi/common/include/linux/errno.h head/sys/compat/linuxkpi/common/include/linux/etherdevice.h head/sys/compat/linuxkpi/common/include/linux/fs.h head/sys/compat/linuxkpi/common/include/linux/idr.h head/sys/compat/linuxkpi/common/include/linux/if_ether.h head/sys/compat/linuxkpi/common/include/linux/if_vlan.h head/sys/compat/linuxkpi/common/include/linux/io.h head/sys/compat/linuxkpi/common/include/linux/jiffies.h head/sys/compat/linuxkpi/common/include/linux/kernel.h head/sys/compat/linuxkpi/common/include/linux/kmod.h head/sys/compat/linuxkpi/common/include/linux/kobject.h head/sys/compat/linuxkpi/common/include/linux/ktime.h head/sys/compat/linuxkpi/common/include/linux/list.h head/sys/compat/linuxkpi/common/include/linux/log2.h head/sys/compat/linuxkpi/common/include/linux/miscdevice.h head/sys/compat/linuxkpi/common/include/linux/mutex.h head/sys/compat/linuxkpi/common/include/linux/pci.h head/sys/compat/linuxkpi/common/include/linux/rwlock.h head/sys/compat/linuxkpi/common/include/linux/rwsem.h head/sys/compat/linuxkpi/common/include/linux/slab.h head/sys/compat/linuxkpi/common/include/linux/spinlock.h head/sys/compat/linuxkpi/common/include/linux/sysfs.h head/sys/compat/linuxkpi/common/include/linux/usb.h head/sys/compat/linuxkpi/common/include/linux/workqueue.h head/sys/compat/linuxkpi/common/include/net/if_inet6.h head/sys/compat/linuxkpi/common/include/net/ipv6.h head/sys/compat/linuxkpi/common/include/net/netevent.h head/sys/compat/linuxkpi/common/src/linux_compat.c head/sys/compat/linuxkpi/common/src/linux_idr.c head/sys/compat/linuxkpi/common/src/linux_radix.c head/sys/compat/linuxkpi/common/src/linux_usb.c Modified: head/sys/compat/linuxkpi/common/include/asm/byteorder.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/asm/byteorder.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/asm/byteorder.h Fri Mar 23 15:50:01 2018 (r331433) @@ -87,7 +87,7 @@ static inline void be16_add_cpu(uint16_t *var, uint16_t val) -{ +{ *var = cpu_to_be16(be16_to_cpu(*var) + val); } Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/bitops.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/bitops.h Fri Mar 23 15:50:01 2018 (r331433) @@ -54,7 +54,7 @@ #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) #define GENMASK(h, l) (((~0UL) >> (BITS_PER_LONG - (h) - 1)) & ((~0UL) << (l))) #define GENMASK_ULL(h, l) (((~0ULL) >> (BITS_PER_LONG_LONG - (h) - 1)) & ((~0ULL) << (l))) -#define BITS_PER_BYTE 8 +#define BITS_PER_BYTE 8 #define hweight8(x) bitcount((uint8_t)(x)) #define hweight16(x) bitcount16(x) Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/cdev.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/cdev.h Fri Mar 23 15:50:01 2018 (r331433) @@ -112,7 +112,7 @@ cdev_add_ext(struct linux_cdev *cdev, dev_t dev, uid_t int error; cdev->dev = dev; - + /* Setup arguments for make_dev_s() */ make_dev_args_init(&args); args.mda_devsw = &linuxcdevsw; Modified: head/sys/compat/linuxkpi/common/include/linux/compiler.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/compiler.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/compiler.h Fri Mar 23 15:50:01 2018 (r331433) @@ -84,7 +84,7 @@ #define __PASTE(a,b) ___PASTE(a,b) #define ACCESS_ONCE(x) (*(volatile __typeof(x) *)&(x)) - + #define WRITE_ONCE(x,v) do { \ barrier(); \ ACCESS_ONCE(x) = (v); \ Modified: head/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/device.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/device.h Fri Mar 23 15:50:01 2018 (r331433) @@ -124,10 +124,10 @@ extern const struct kobj_type linux_dev_ktype; extern const struct kobj_type linux_class_ktype; struct class_attribute { - struct attribute attr; - ssize_t (*show)(struct class *, struct class_attribute *, char *); - ssize_t (*store)(struct class *, struct class_attribute *, const char *, size_t); - const void *(*namespace)(struct class *, const struct class_attribute *); + struct attribute attr; + ssize_t (*show)(struct class *, struct class_attribute *, char *); + ssize_t (*store)(struct class *, struct class_attribute *, const char *, size_t); + const void *(*namespace)(struct class *, const struct class_attribute *); }; #define CLASS_ATTR(_name, _mode, _show, _store) \ @@ -223,7 +223,7 @@ static inline char * dev_name(const struct device *dev) { - return kobject_name(&dev->kobj); + return kobject_name(&dev->kobj); } #define dev_set_name(_dev, _fmt, ...) \ @@ -533,7 +533,7 @@ class_remove_file(struct class *class, const struct cl static inline int dev_to_node(struct device *dev) { - return -1; + return -1; } char *kvasprintf(gfp_t, const char *, va_list); Modified: head/sys/compat/linuxkpi/common/include/linux/dma-attrs.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/dma-attrs.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/dma-attrs.h Fri Mar 23 15:50:01 2018 (r331433) @@ -38,7 +38,7 @@ enum dma_attr { DMA_ATTR_WRITE_BARRIER, DMA_ATTR_WEAK_ struct dma_attrs { unsigned long flags; }; - + #define DEFINE_DMA_ATTRS(x) struct dma_attrs x = { } static inline void Modified: head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h Fri Mar 23 15:50:01 2018 (r331433) @@ -97,7 +97,7 @@ dma_supported(struct device *dev, u64 mask) /* XXX busdma takes care of this elsewhere. */ return (1); } - + static inline int dma_set_mask(struct device *dev, u64 dma_mask) { @@ -150,7 +150,7 @@ dma_zalloc_coherent(struct device *dev, size_t size, d return (dma_alloc_coherent(dev, size, dma_handle, flag | __GFP_ZERO)); } - + static inline void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t dma_handle) @@ -180,7 +180,7 @@ dma_map_sg_attrs(struct device *dev, struct scatterlis { struct scatterlist *sg; int i; - + for_each_sg(sgl, sg, nents, i) sg_dma_address(sg) = sg_phys(sg); @@ -192,7 +192,7 @@ dma_unmap_sg_attrs(struct device *dev, struct scatterl enum dma_data_direction dir, struct dma_attrs *attrs) { } - + static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction direction) @@ -258,9 +258,9 @@ dma_mapping_error(struct device *dev, dma_addr_t dma_a } static inline unsigned int dma_set_max_seg_size(struct device *dev, - unsigned int size) + unsigned int size) { - return (0); + return (0); } Modified: head/sys/compat/linuxkpi/common/include/linux/err.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/err.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/err.h Fri Mar 23 15:50:01 2018 (r331433) @@ -70,10 +70,10 @@ ERR_CAST(void *ptr) static inline int PTR_ERR_OR_ZERO(const void *ptr) { - if (IS_ERR(ptr)) - return PTR_ERR(ptr); - else - return 0; + if (IS_ERR(ptr)) + return PTR_ERR(ptr); + else + return 0; } #define PTR_RET(p) PTR_ERR_OR_ZERO(p) Modified: head/sys/compat/linuxkpi/common/include/linux/errno.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/errno.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/errno.h Fri Mar 23 15:50:01 2018 (r331433) @@ -35,13 +35,13 @@ #define ECHRNG EDOM #define ETIME ETIMEDOUT -#define ECOMM ESTALE -#define ENODATA ECONNREFUSED +#define ECOMM ESTALE +#define ENODATA ECONNREFUSED #define ENOIOCTLCMD ENOIOCTL /* Use same value as Linux, because BSD's ERESTART is negative */ #define ERESTARTSYS 512 -#define ENOTSUPP EOPNOTSUPP -#define ENONET EHOSTDOWN +#define ENOTSUPP EOPNOTSUPP +#define ENONET EHOSTDOWN #define ERESTARTNOINTR 513 #define ERESTARTNOHAND 514 Modified: head/sys/compat/linuxkpi/common/include/linux/etherdevice.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/etherdevice.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/etherdevice.h Fri Mar 23 15:50:01 2018 (r331433) @@ -51,31 +51,31 @@ struct ethtool_modinfo { u32 eeprom_len; }; -static inline bool +static inline bool is_zero_ether_addr(const u8 * addr) { return ((addr[0] + addr[1] + addr[2] + addr[3] + addr[4] + addr[5]) == 0x00); } -static inline bool +static inline bool is_multicast_ether_addr(const u8 * addr) { return (0x01 & addr[0]); } -static inline bool +static inline bool is_broadcast_ether_addr(const u8 * addr) { return ((addr[0] + addr[1] + addr[2] + addr[3] + addr[4] + addr[5]) == (6 * 0xff)); } -static inline bool +static inline bool is_valid_ether_addr(const u8 * addr) { return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr); } -static inline void +static inline void ether_addr_copy(u8 * dst, const u8 * src) { memcpy(dst, src, 6); Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/fs.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/fs.h Fri Mar 23 15:50:01 2018 (r331433) @@ -82,7 +82,7 @@ struct linux_file_wait_queue { struct linux_file { struct file *_file; const struct file_operations *f_op; - void *private_data; + void *private_data; int f_flags; int f_mode; /* Just starting mode. */ struct dentry *f_dentry; @@ -140,7 +140,7 @@ struct file_operations { int (*fasync)(int, struct file *, int); /* Although not supported in FreeBSD, to align with Linux code - * we are adding llseek() only when it is mapped to no_llseek which returns + * we are adding llseek() only when it is mapped to no_llseek which returns * an illegal seek error */ loff_t (*llseek)(struct file *, loff_t, int); @@ -270,7 +270,7 @@ iput(struct inode *inode) vrele(inode); } -static inline loff_t +static inline loff_t no_llseek(struct file *file, loff_t offset, int whence) { Modified: head/sys/compat/linuxkpi/common/include/linux/idr.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/idr.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/idr.h Fri Mar 23 15:50:01 2018 (r331433) @@ -96,7 +96,7 @@ int idr_for_each(struct idr *idp, int (*fn)(int id, vo #define IDA_CHUNK_SIZE 128 /* 128 bytes per chunk */ #define IDA_BITMAP_LONGS (IDA_CHUNK_SIZE / sizeof(long) - 1) -#define IDA_BITMAP_BITS (IDA_BITMAP_LONGS * sizeof(long) * 8) +#define IDA_BITMAP_BITS (IDA_BITMAP_LONGS * sizeof(long) * 8) struct ida_bitmap { long nr_busy; Modified: head/sys/compat/linuxkpi/common/include/linux/if_ether.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/if_ether.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/if_ether.h Fri Mar 23 15:50:01 2018 (r331433) @@ -35,17 +35,17 @@ #include -#define ETH_HLEN ETHER_HDR_LEN /* Total octets in header. */ +#define ETH_HLEN ETHER_HDR_LEN /* Total octets in header. */ #ifndef ETH_ALEN -#define ETH_ALEN ETHER_ADDR_LEN +#define ETH_ALEN ETHER_ADDR_LEN #endif -#define ETH_FCS_LEN 4 /* Octets in the FCS */ -#define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) - * that VLAN requires. */ +#define ETH_FCS_LEN 4 /* Octets in the FCS */ +#define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) + * that VLAN requires. */ /* * defined Ethernet Protocol ID's. */ -#define ETH_P_IP ETHERTYPE_IP +#define ETH_P_IP ETHERTYPE_IP #define ETH_P_IPV6 ETHERTYPE_IPV6 #define ETH_P_MPLS_UC ETHERTYPE_MPLS #define ETH_P_MPLS_MC ETHERTYPE_MPLS_MCAST Modified: head/sys/compat/linuxkpi/common/include/linux/if_vlan.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/if_vlan.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/if_vlan.h Fri Mar 23 15:50:01 2018 (r331433) @@ -39,7 +39,7 @@ #include #include -#define VLAN_N_VID 4096 +#define VLAN_N_VID 4096 static inline int is_vlan_dev(struct ifnet *ifp) Modified: head/sys/compat/linuxkpi/common/include/linux/io.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/io.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/io.h Fri Mar 23 15:50:01 2018 (r331433) @@ -71,7 +71,7 @@ __raw_writeq(uint64_t b, volatile void *addr) static inline void writel(uint32_t b, void *addr) { - *(volatile uint32_t *)addr = b; + *(volatile uint32_t *)addr = b; } #undef writel_relaxed @@ -85,21 +85,21 @@ writel_relaxed(uint32_t b, void *addr) static inline void writeq(uint64_t b, void *addr) { - *(volatile uint64_t *)addr = b; + *(volatile uint64_t *)addr = b; } #undef writeb static inline void writeb(uint8_t b, void *addr) { - *(volatile uint8_t *)addr = b; + *(volatile uint8_t *)addr = b; } #undef writew static inline void writew(uint16_t b, void *addr) { - *(volatile uint16_t *)addr = b; + *(volatile uint16_t *)addr = b; } #undef ioread8 Modified: head/sys/compat/linuxkpi/common/include/linux/jiffies.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/jiffies.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/jiffies.h Fri Mar 23 15:50:01 2018 (r331433) @@ -38,7 +38,7 @@ #include #include -#define jiffies ticks +#define jiffies ticks #define jiffies_64 ticks #define jiffies_to_msecs(x) (((int64_t)(int)(x)) * 1000 / hz) Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Fri Mar 23 15:50:01 2018 (r331433) @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include @@ -170,12 +170,12 @@ scnprintf(char *buf, size_t size, const char *fmt, ... */ #ifdef DEBUG #define pr_debug(fmt, ...) \ - log(LOG_DEBUG, fmt, ##__VA_ARGS__) + log(LOG_DEBUG, fmt, ##__VA_ARGS__) #define pr_devel(fmt, ...) \ log(LOG_DEBUG, pr_fmt(fmt), ##__VA_ARGS__) #else #define pr_debug(fmt, ...) \ - ({ if (0) log(LOG_DEBUG, fmt, ##__VA_ARGS__); 0; }) + ({ if (0) log(LOG_DEBUG, fmt, ##__VA_ARGS__); 0; }) #define pr_devel(fmt, ...) \ ({ if (0) log(LOG_DEBUG, pr_fmt(fmt), ##__VA_ARGS__); 0; }) #endif @@ -238,19 +238,19 @@ scnprintf(char *buf, size_t size, const char *fmt, ... #ifndef WARN #define WARN(condition, ...) ({ \ - bool __ret_warn_on = (condition); \ - if (unlikely(__ret_warn_on)) \ - pr_warning(__VA_ARGS__); \ - unlikely(__ret_warn_on); \ + bool __ret_warn_on = (condition); \ + if (unlikely(__ret_warn_on)) \ + pr_warning(__VA_ARGS__); \ + unlikely(__ret_warn_on); \ }) #endif #ifndef WARN_ONCE #define WARN_ONCE(condition, ...) ({ \ - bool __ret_warn_on = (condition); \ - if (unlikely(__ret_warn_on)) \ - pr_warn_once(__VA_ARGS__); \ - unlikely(__ret_warn_on); \ + bool __ret_warn_on = (condition); \ + if (unlikely(__ret_warn_on)) \ + pr_warn_once(__VA_ARGS__); \ + unlikely(__ret_warn_on); \ }) #endif @@ -259,7 +259,7 @@ scnprintf(char *buf, size_t size, const char *fmt, ... const __typeof(((type *)0)->member) *__p = (ptr); \ (type *)((uintptr_t)__p - offsetof(type, member)); \ }) - + #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #define u64_to_user_ptr(val) ((void *)(uintptr_t)(val)) @@ -412,7 +412,7 @@ extern bool linux_cpu_has_clflush; #endif typedef struct pm_message { - int event; + int event; } pm_message_t; /* Swap values of a and b */ Modified: head/sys/compat/linuxkpi/common/include/linux/kmod.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kmod.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/kmod.h Fri Mar 23 15:50:01 2018 (r331433) @@ -41,7 +41,7 @@ #define request_module(...) \ ({\ char modname[128]; \ - int fileid; \ + int fileid; \ snprintf(modname, sizeof(modname), __VA_ARGS__); \ kern_kldload(curthread, modname, &fileid); \ }) Modified: head/sys/compat/linuxkpi/common/include/linux/kobject.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kobject.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/kobject.h Fri Mar 23 15:50:01 2018 (r331433) @@ -61,17 +61,17 @@ struct kobject { extern struct kobject *mm_kobj; struct attribute { - const char *name; + const char *name; struct module *owner; mode_t mode; }; struct kobj_attribute { - struct attribute attr; - ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, - char *buf); - ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr, - const char *buf, size_t count); + struct attribute attr; + ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, + char *buf); + ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr, + const char *buf, size_t count); }; static inline void Modified: head/sys/compat/linuxkpi/common/include/linux/ktime.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/ktime.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/ktime.h Fri Mar 23 15:50:01 2018 (r331433) @@ -40,8 +40,8 @@ /* time values in nanoseconds */ typedef s64 ktime_t; -#define KTIME_MAX ((s64)~((u64)1 << 63)) -#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) +#define KTIME_MAX ((s64)~((u64)1 << 63)) +#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) static inline int64_t ktime_to_ns(ktime_t kt) Modified: head/sys/compat/linuxkpi/common/include/linux/list.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/list.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/list.h Fri Mar 23 15:50:01 2018 (r331433) @@ -93,7 +93,7 @@ INIT_LIST_HEAD(struct list_head *list) list->next = list->prev = list; } - + static inline int list_empty(const struct list_head *head) { @@ -159,7 +159,7 @@ linux_list_add(struct list_head *new, struct list_head static inline void list_del_init(struct list_head *entry) -{ +{ list_del(entry); INIT_LIST_HEAD(entry); @@ -167,8 +167,8 @@ list_del_init(struct list_head *entry) #define list_entry(ptr, type, field) container_of(ptr, type, field) -#define list_first_entry(ptr, type, member) \ - list_entry((ptr)->next, type, member) +#define list_first_entry(ptr, type, member) \ + list_entry((ptr)->next, type, member) #define list_last_entry(ptr, type, member) \ list_entry((ptr)->prev, type, member) @@ -196,7 +196,7 @@ list_del_init(struct list_head *entry) p = list_entry((p)->field.next, typeof(*p), field)) #define list_for_each_entry_safe(p, n, h, field) \ - for (p = list_entry((h)->next, typeof(*p), field), \ + for (p = list_entry((h)->next, typeof(*p), field), \ n = list_entry((p)->field.next, typeof(*p), field); &(p)->field != (h);\ p = n, n = list_entry(n->field.next, typeof(*n), field)) @@ -208,7 +208,7 @@ list_del_init(struct list_head *entry) for (p = list_next_entry((p), field); &(p)->field != (h); \ p = list_next_entry((p), field)) -#define list_for_each_entry_safe_from(pos, n, head, member) \ +#define list_for_each_entry_safe_from(pos, n, head, member) \ for (n = list_entry((pos)->member.next, typeof(*pos), member); \ &(pos)->member != (head); \ pos = n, n = list_entry(n->member.next, typeof(*n), member)) @@ -218,7 +218,7 @@ list_del_init(struct list_head *entry) p = list_entry((p)->field.prev, typeof(*p), field)) #define list_for_each_entry_safe_reverse(p, n, h, field) \ - for (p = list_entry((h)->prev, typeof(*p), field), \ + for (p = list_entry((h)->prev, typeof(*p), field), \ n = list_entry((p)->field.prev, typeof(*p), field); &(p)->field != (h); \ p = n, n = list_entry(n->field.prev, typeof(*n), field)) @@ -259,7 +259,7 @@ list_move_tail(struct list_head *entry, struct list_he } static inline void -linux_list_splice(const struct list_head *list, struct list_head *prev, +linux_list_splice(const struct list_head *list, struct list_head *prev, struct list_head *next) { struct list_head *first; @@ -280,7 +280,7 @@ list_splice(const struct list_head *list, struct list_ { linux_list_splice(list, head, head->next); -} +} static inline void list_splice_tail(struct list_head *list, struct list_head *head) @@ -288,15 +288,15 @@ list_splice_tail(struct list_head *list, struct list_h linux_list_splice(list, head->prev, head); } - + static inline void list_splice_init(struct list_head *list, struct list_head *head) { linux_list_splice(list, head, head->next); - INIT_LIST_HEAD(list); + INIT_LIST_HEAD(list); } - + static inline void list_splice_tail_init(struct list_head *list, struct list_head *head) { @@ -344,9 +344,9 @@ static inline void hlist_del(struct hlist_node *n) { - if (n->next) - n->next->pprev = n->pprev; - *n->pprev = n->next; + if (n->next) + n->next->pprev = n->pprev; + *n->pprev = n->next; } static inline void @@ -379,7 +379,7 @@ hlist_add_before(struct hlist_node *n, struct hlist_no next->pprev = &n->next; *(n->pprev) = n; } - + static inline void hlist_add_after(struct hlist_node *n, struct hlist_node *next) { @@ -390,7 +390,7 @@ hlist_add_after(struct hlist_node *n, struct hlist_nod if (next->next) next->next->pprev = &next->next; } - + static inline void hlist_move_list(struct hlist_head *old, struct hlist_head *new) { @@ -433,11 +433,11 @@ static inline void list_cut_position(struct list_head } static inline int list_is_last(const struct list_head *list, - const struct list_head *head) + const struct list_head *head) { - return list->next == head; + return list->next == head; } - + #define hlist_entry(ptr, type, field) container_of(ptr, type, field) #define hlist_for_each(p, head) \ Modified: head/sys/compat/linuxkpi/common/include/linux/log2.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/log2.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/log2.h Fri Mar 23 15:50:01 2018 (r331433) @@ -50,7 +50,7 @@ is_power_of_2(unsigned long n) static inline unsigned long rounddown_pow_of_two(unsigned long x) { - return (1UL << (flsl(x) - 1)); + return (1UL << (flsl(x) - 1)); } #define ilog2(n) \ Modified: head/sys/compat/linuxkpi/common/include/linux/miscdevice.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/miscdevice.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/miscdevice.h Fri Mar 23 15:50:01 2018 (r331433) @@ -59,7 +59,7 @@ misc_register(struct miscdevice *misc) misc->cdev->owner = THIS_MODULE; misc->cdev->ops = misc->fops; kobject_set_name(&misc->cdev->kobj, misc->name); - if (cdev_add(misc->cdev, misc->this_device->devt, 1)) + if (cdev_add(misc->cdev, misc->this_device->devt, 1)) return -EINVAL; return (0); } Modified: head/sys/compat/linuxkpi/common/include/linux/mutex.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/mutex.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/mutex.h Fri Mar 23 15:50:01 2018 (r331433) @@ -116,7 +116,7 @@ mutex_is_owned(mutex_t *m) #ifdef WITNESS_ALL /* NOTE: the maximum WITNESS name is 64 chars */ #define __mutex_name(name, file, line) \ - (((const char *){file ":" #line "-" name}) + \ + (((const char *){file ":" #line "-" name}) + \ (sizeof(file) > 16 ? sizeof(file) - 16 : 0)) #else #define __mutex_name(name, file, line) name Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/pci.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/pci.h Fri Mar 23 15:50:01 2018 (r331433) @@ -96,8 +96,8 @@ struct pci_device_id { #define PCI_SUBDEVICE_ID_QEMU 0x1100 #define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) -#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) -#define PCI_FUNC(devfn) ((devfn) & 0x07) +#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) +#define PCI_FUNC(devfn) ((devfn) & 0x07) #define PCI_VDEVICE(_vendor, _device) \ .vendor = PCI_VENDOR_ID_##_vendor, .device = (_device), \ @@ -467,7 +467,7 @@ pci_find_capability(struct pci_dev *pdev, int capid) static inline int pci_pcie_cap(struct pci_dev *dev) { - return pci_find_capability(dev, PCI_CAP_ID_EXP); + return pci_find_capability(dev, PCI_CAP_ID_EXP); } @@ -598,12 +598,12 @@ pci_enable_msix_range(struct pci_dev *dev, struct msix static inline int pci_channel_offline(struct pci_dev *pdev) { - return false; + return false; } static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) { - return -ENODEV; + return -ENODEV; } static inline void pci_disable_sriov(struct pci_dev *dev) { @@ -666,169 +666,167 @@ typedef unsigned int __bitwise pci_channel_state_t; typedef unsigned int __bitwise pci_ers_result_t; enum pci_channel_state { - pci_channel_io_normal = 1, - pci_channel_io_frozen = 2, - pci_channel_io_perm_failure = 3, + pci_channel_io_normal = 1, + pci_channel_io_frozen = 2, + pci_channel_io_perm_failure = 3, }; enum pci_ers_result { - PCI_ERS_RESULT_NONE = 1, - PCI_ERS_RESULT_CAN_RECOVER = 2, - PCI_ERS_RESULT_NEED_RESET = 3, - PCI_ERS_RESULT_DISCONNECT = 4, - PCI_ERS_RESULT_RECOVERED = 5, + PCI_ERS_RESULT_NONE = 1, + PCI_ERS_RESULT_CAN_RECOVER = 2, + PCI_ERS_RESULT_NEED_RESET = 3, + PCI_ERS_RESULT_DISCONNECT = 4, + PCI_ERS_RESULT_RECOVERED = 5, }; /* PCI bus error event callbacks */ struct pci_error_handlers { - pci_ers_result_t (*error_detected)(struct pci_dev *dev, - enum pci_channel_state error); - pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev); - pci_ers_result_t (*link_reset)(struct pci_dev *dev); - pci_ers_result_t (*slot_reset)(struct pci_dev *dev); - void (*resume)(struct pci_dev *dev); + pci_ers_result_t (*error_detected)(struct pci_dev *dev, + enum pci_channel_state error); + pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev); + pci_ers_result_t (*link_reset)(struct pci_dev *dev); + pci_ers_result_t (*slot_reset)(struct pci_dev *dev); + void (*resume)(struct pci_dev *dev); }; /* FreeBSD does not support SRIOV - yet */ static inline struct pci_dev *pci_physfn(struct pci_dev *dev) { - return dev; + return dev; } static inline bool pci_is_pcie(struct pci_dev *dev) { - return !!pci_pcie_cap(dev); + return !!pci_pcie_cap(dev); } static inline u16 pcie_flags_reg(struct pci_dev *dev) { - int pos; - u16 reg16; + int pos; + u16 reg16; - pos = pci_find_capability(dev, PCI_CAP_ID_EXP); - if (!pos) - return 0; + pos = pci_find_capability(dev, PCI_CAP_ID_EXP); + if (!pos) + return 0; - pci_read_config_word(dev, pos + PCI_EXP_FLAGS, ®16); + pci_read_config_word(dev, pos + PCI_EXP_FLAGS, ®16); - return reg16; + return reg16; } static inline int pci_pcie_type(struct pci_dev *dev) { - return (pcie_flags_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4; + return (pcie_flags_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4; } static inline int pcie_cap_version(struct pci_dev *dev) { - return pcie_flags_reg(dev) & PCI_EXP_FLAGS_VERS; + return pcie_flags_reg(dev) & PCI_EXP_FLAGS_VERS; } static inline bool pcie_cap_has_lnkctl(struct pci_dev *dev) { - int type = pci_pcie_type(dev); + int type = pci_pcie_type(dev); - return pcie_cap_version(dev) > 1 || - type == PCI_EXP_TYPE_ROOT_PORT || - type == PCI_EXP_TYPE_ENDPOINT || - type == PCI_EXP_TYPE_LEG_END; + return pcie_cap_version(dev) > 1 || + type == PCI_EXP_TYPE_ROOT_PORT || + type == PCI_EXP_TYPE_ENDPOINT || + type == PCI_EXP_TYPE_LEG_END; } static inline bool pcie_cap_has_devctl(const struct pci_dev *dev) { - return true; + return true; } static inline bool pcie_cap_has_sltctl(struct pci_dev *dev) { - int type = pci_pcie_type(dev); + int type = pci_pcie_type(dev); - return pcie_cap_version(dev) > 1 || - type == PCI_EXP_TYPE_ROOT_PORT || - (type == PCI_EXP_TYPE_DOWNSTREAM && - pcie_flags_reg(dev) & PCI_EXP_FLAGS_SLOT); + return pcie_cap_version(dev) > 1 || type == PCI_EXP_TYPE_ROOT_PORT || + (type == PCI_EXP_TYPE_DOWNSTREAM && + pcie_flags_reg(dev) & PCI_EXP_FLAGS_SLOT); } static inline bool pcie_cap_has_rtctl(struct pci_dev *dev) { - int type = pci_pcie_type(dev); + int type = pci_pcie_type(dev); - return pcie_cap_version(dev) > 1 || - type == PCI_EXP_TYPE_ROOT_PORT || - type == PCI_EXP_TYPE_RC_EC; + return pcie_cap_version(dev) > 1 || type == PCI_EXP_TYPE_ROOT_PORT || + type == PCI_EXP_TYPE_RC_EC; } static bool pcie_capability_reg_implemented(struct pci_dev *dev, int pos) { - if (!pci_is_pcie(dev)) - return false; + if (!pci_is_pcie(dev)) + return false; - switch (pos) { - case PCI_EXP_FLAGS_TYPE: - return true; - case PCI_EXP_DEVCAP: - case PCI_EXP_DEVCTL: - case PCI_EXP_DEVSTA: - return pcie_cap_has_devctl(dev); - case PCI_EXP_LNKCAP: - case PCI_EXP_LNKCTL: - case PCI_EXP_LNKSTA: - return pcie_cap_has_lnkctl(dev); - case PCI_EXP_SLTCAP: - case PCI_EXP_SLTCTL: - case PCI_EXP_SLTSTA: - return pcie_cap_has_sltctl(dev); - case PCI_EXP_RTCTL: - case PCI_EXP_RTCAP: - case PCI_EXP_RTSTA: - return pcie_cap_has_rtctl(dev); - case PCI_EXP_DEVCAP2: - case PCI_EXP_DEVCTL2: - case PCI_EXP_LNKCAP2: - case PCI_EXP_LNKCTL2: - case PCI_EXP_LNKSTA2: - return pcie_cap_version(dev) > 1; - default: - return false; - } + switch (pos) { + case PCI_EXP_FLAGS_TYPE: + return true; + case PCI_EXP_DEVCAP: + case PCI_EXP_DEVCTL: + case PCI_EXP_DEVSTA: + return pcie_cap_has_devctl(dev); + case PCI_EXP_LNKCAP: + case PCI_EXP_LNKCTL: + case PCI_EXP_LNKSTA: + return pcie_cap_has_lnkctl(dev); + case PCI_EXP_SLTCAP: + case PCI_EXP_SLTCTL: + case PCI_EXP_SLTSTA: + return pcie_cap_has_sltctl(dev); + case PCI_EXP_RTCTL: + case PCI_EXP_RTCAP: + case PCI_EXP_RTSTA: + return pcie_cap_has_rtctl(dev); + case PCI_EXP_DEVCAP2: + case PCI_EXP_DEVCTL2: + case PCI_EXP_LNKCAP2: + case PCI_EXP_LNKCTL2: + case PCI_EXP_LNKSTA2: + return pcie_cap_version(dev) > 1; + default: + return false; + } } static inline int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *dst) { - if (pos & 3) - return -EINVAL; + if (pos & 3) + return -EINVAL; - if (!pcie_capability_reg_implemented(dev, pos)) - return -EINVAL; + if (!pcie_capability_reg_implemented(dev, pos)) + return -EINVAL; - return pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, dst); + return pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, dst); } static inline int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *dst) { - if (pos & 3) - return -EINVAL; + if (pos & 3) + return -EINVAL; - if (!pcie_capability_reg_implemented(dev, pos)) - return -EINVAL; + if (!pcie_capability_reg_implemented(dev, pos)) + return -EINVAL; - return pci_read_config_word(dev, pci_pcie_cap(dev) + pos, dst); + return pci_read_config_word(dev, pci_pcie_cap(dev) + pos, dst); } static inline int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val) { - if (pos & 1) - return -EINVAL; + if (pos & 1) + return -EINVAL; - if (!pcie_capability_reg_implemented(dev, pos)) - return 0; + if (!pcie_capability_reg_implemented(dev, pos)) + return 0; - return pci_write_config_word(dev, pci_pcie_cap(dev) + pos, val); + return pci_write_config_word(dev, pci_pcie_cap(dev) + pos, val); } static inline int pcie_get_minimum_link(struct pci_dev *dev, Modified: head/sys/compat/linuxkpi/common/include/linux/rwlock.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/rwlock.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/rwlock.h Fri Mar 23 15:50:01 2018 (r331433) @@ -48,9 +48,9 @@ typedef struct { #define read_unlock_irq(lock) read_unlock((lock)) #define write_lock_irq(lock) write_lock((lock)) #define write_unlock_irq(lock) write_unlock((lock)) -#define read_lock_irqsave(lock, flags) \ +#define read_lock_irqsave(lock, flags) \ do {(flags) = 0; read_lock(lock); } while (0) -#define write_lock_irqsave(lock, flags) \ +#define write_lock_irqsave(lock, flags) \ do {(flags) = 0; write_lock(lock); } while (0) #define read_unlock_irqrestore(lock, flags) \ do { read_unlock(lock); } while (0) Modified: head/sys/compat/linuxkpi/common/include/linux/rwsem.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/rwsem.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/rwsem.h Fri Mar 23 15:50:01 2018 (r331433) @@ -55,7 +55,7 @@ struct rw_semaphore { #ifdef WITNESS_ALL /* NOTE: the maximum WITNESS name is 64 chars */ #define __rwsem_name(name, file, line) \ - (((const char *){file ":" #line "-" name}) + \ + (((const char *){file ":" #line "-" name}) + \ (sizeof(file) > 16 ? sizeof(file) - 16 : 0)) #else #define __rwsem_name(name, file, line) name Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/slab.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/slab.h Fri Mar 23 15:50:01 2018 (r331433) @@ -49,9 +49,9 @@ MALLOC_DECLARE(M_KMALLOC); #define vzalloc(size) __vmalloc(size, GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, 0) #define vfree(arg) kfree(arg) #define kvfree(arg) kfree(arg) -#define vmalloc_node(size, node) __vmalloc(size, GFP_KERNEL, 0) -#define vmalloc_user(size) __vmalloc(size, GFP_KERNEL | __GFP_ZERO, 0) -#define vmalloc(size) __vmalloc(size, GFP_KERNEL, 0) +#define vmalloc_node(size, node) __vmalloc(size, GFP_KERNEL, 0) +#define vmalloc_user(size) __vmalloc(size, GFP_KERNEL | __GFP_ZERO, 0) +#define vmalloc(size) __vmalloc(size, GFP_KERNEL, 0) #define __kmalloc(...) kmalloc(__VA_ARGS__) #define kmalloc_node(chunk, flags, n) kmalloc(chunk, flags) @@ -62,7 +62,7 @@ MALLOC_DECLARE(M_KMALLOC); #define kmem_cache linux_kmem_cache #define kmem_cache_create(...) linux_kmem_cache_create(__VA_ARGS__) #define kmem_cache_alloc(...) linux_kmem_cache_alloc(__VA_ARGS__) -#define kmem_cache_free(...) linux_kmem_cache_free(__VA_ARGS__) +#define kmem_cache_free(...) linux_kmem_cache_free(__VA_ARGS__) #define kmem_cache_destroy(...) linux_kmem_cache_destroy(__VA_ARGS__) #define KMEM_CACHE(__struct, flags) \ @@ -79,7 +79,7 @@ struct linux_kmem_cache { }; #define SLAB_HWCACHE_ALIGN (1 << 0) -#define SLAB_TYPESAFE_BY_RCU (1 << 1) +#define SLAB_TYPESAFE_BY_RCU (1 << 1) #define SLAB_RECLAIM_ACCOUNT (1 << 2) #define SLAB_DESTROY_BY_RCU \ Modified: head/sys/compat/linuxkpi/common/include/linux/spinlock.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/spinlock.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/spinlock.h Fri Mar 23 15:50:01 2018 (r331433) @@ -125,7 +125,7 @@ typedef struct { #ifdef WITNESS_ALL /* NOTE: the maximum WITNESS name is 64 chars */ #define __spin_lock_name(name, file, line) \ - (((const char *){file ":" #line "-" name}) + \ + (((const char *){file ":" #line "-" name}) + \ (sizeof(file) > 16 ? sizeof(file) - 16 : 0)) #else #define __spin_lock_name(name, file, line) name Modified: head/sys/compat/linuxkpi/common/include/linux/sysfs.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/sysfs.h Fri Mar 23 15:46:53 2018 (r331432) +++ head/sys/compat/linuxkpi/common/include/linux/sysfs.h Fri Mar 23 15:50:01 2018 (r331433) @@ -45,14 +45,14 @@ struct sysfs_ops { struct attribute_group { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Mar 23 16:23:15 2018 Return-Path: Delivered-To: svn-src-head@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 CDEC8F5675F; Fri, 23 Mar 2018 16:23:15 +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 7DA3F7CBA8; Fri, 23 Mar 2018 16:23:15 +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 5E3B522490; Fri, 23 Mar 2018 16:23:15 +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 w2NGNF9w096795; Fri, 23 Mar 2018 16:23:15 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NGNF3i096794; Fri, 23 Mar 2018 16:23:15 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803231623.w2NGNF3i096794@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Mar 2018 16:23:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331435 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 331435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 16:23:16 -0000 Author: imp Date: Fri Mar 23 16:23:15 2018 New Revision: 331435 URL: https://svnweb.freebsd.org/changeset/base/331435 Log: Flag when we have a pending TUR. Don't schedule another one when we have one pending. Otherwise, we can race and send two, which is wasteful in close proximity. It can also cause the acaquire/release count for TUR to be > 1, which is undexpected. PR: 226510 Differential Review: https://reviews.freebsd.org/D14792 Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Fri Mar 23 16:15:07 2018 (r331434) +++ head/sys/cam/scsi/scsi_da.c Fri Mar 23 16:23:15 2018 (r331435) @@ -116,7 +116,8 @@ typedef enum { DA_FLAG_CAN_ATA_LOG = 0x008000, DA_FLAG_CAN_ATA_IDLOG = 0x010000, DA_FLAG_CAN_ATA_SUPCAP = 0x020000, - DA_FLAG_CAN_ATA_ZONE = 0x040000 + DA_FLAG_CAN_ATA_ZONE = 0x040000, + DA_FLAG_TUR_PENDING = 0x080000 } da_flags; typedef enum { @@ -2068,7 +2069,8 @@ daasync(void *callback_arg, u_int32_t code, case AC_SCSI_AEN: softc = (struct da_softc *)periph->softc; cam_periph_lock(periph); - if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { + if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR) && + (softc->flags & DA_FLAG_TUR_PENDING) == 0) { if (da_periph_acquire(periph, DA_REF_TUR) == 0) { cam_iosched_set_work_flags(softc->cam_iosched, DA_WORK_TUR); daschedule(periph); @@ -3113,6 +3115,7 @@ more: bp = cam_iosched_next_bio(softc->cam_iosched); if (bp == NULL) { if (cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { + softc->flags |= DA_FLAG_TUR_PENDING; cam_iosched_clr_work_flags(softc->cam_iosched, DA_WORK_TUR); scsi_test_unit_ready(&start_ccb->csio, /*retries*/ da_retry_count, @@ -5570,7 +5573,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) if (daerror(done_ccb, CAM_RETRY_SELTO, SF_RETRY_UA | SF_NO_RECOVERY | SF_NO_PRINT) == ERESTART) - return; + return; /* Will complete again, keep reference */ if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) cam_release_devq(done_ccb->ccb_h.path, /*relsim_flags*/0, @@ -5579,6 +5582,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) /*getcount_only*/0); } xpt_release_ccb(done_ccb); + softc->flags &= ~DA_FLAG_TUR_PENDING; da_periph_release_locked(periph, DA_REF_TUR); return; } @@ -5700,6 +5704,7 @@ damediapoll(void *arg) struct da_softc *softc = periph->softc; if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR) && + (softc->flags & DA_FLAG_TUR_PENDING) == 0 && LIST_EMPTY(&softc->pending_ccbs)) { if (da_periph_acquire(periph, DA_REF_TUR) == 0) { cam_iosched_set_work_flags(softc->cam_iosched, DA_WORK_TUR); From owner-svn-src-head@freebsd.org Fri Mar 23 16:38:53 2018 Return-Path: Delivered-To: svn-src-head@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 37AE5F57DFF; Fri, 23 Mar 2018 16:38:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFA387D963; Fri, 23 Mar 2018 16:38:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 159B710A8BE; Fri, 23 Mar 2018 12:38:52 -0400 (EDT) From: John Baldwin To: Alexey Dokuchaev Cc: Warner Losh , Kyle Evans , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Subject: Re: svn commit: r331209 - head Date: Thu, 22 Mar 2018 08:52:47 -0700 Message-ID: <3226647.aiAOVF4eaK@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <20180322043938.GA8311@FreeBSD.org> References: <201803191527.w2JFRr7B058668@repo.freebsd.org> <20180322043938.GA8311@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 23 Mar 2018 12:38:52 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 16:38:53 -0000 On Thursday, March 22, 2018 04:39:38 AM Alexey Dokuchaev wrote: > On Wed, Mar 21, 2018 at 10:34:15PM -0600, Warner Losh wrote: > > On Wed, Mar 21, 2018 at 10:03 PM, Alexey Dokuchaev > > wrote: > > > On Mon, Mar 19, 2018 at 09:20:40AM -0700, John Baldwin wrote: > > > > ... > > > > How does this fit with the recommended installation steps of doing > > > > 'make installkernel' and rebooting before doing a 'make installworld'? > > > > > > Rebooting? I vaguely recall recommended procedure was to switch to single > > > user mode prior to `installworld', but personally I've never bothered and > > > installed kernel, [mm -p,] world, mm -Fi, reboot. Am I missing something? > > > > Old advice was to do the installworld in single user, as that's the safest > > (and also ensures you have a new kernel and don't install before rebooting). > > However, we've had enough experience to see that usually an installworld + > > reboot is sufficient. > > Right, but John had mentioned extra reboot *between* installkernel and > installworld, which I've never heard of before. >From the end up of src/UPDATING: To rebuild everything and install it on the current system. ----------------------------------------------------------- # Note: sometimes if you are running current you gotta do more than # is listed here if you are upgrading from a really old current. make buildworld make kernel KERNCONF=YOUR_KERNEL_HERE [1] [3] mergemaster -Fp [5] make installworld mergemaster -Fi [4] make delete-old [6] See also https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html Often you can take shortcuts, but this is the only process we guarantee will always work. (We will also sometimes add additional shims to make some of the common shortcuts work, but we don't guarantee that.) -- John Baldwin From owner-svn-src-head@freebsd.org Fri Mar 23 16:56:47 2018 Return-Path: Delivered-To: svn-src-head@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 EB8BAF59A79; Fri, 23 Mar 2018 16:56:46 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 9D0FD7F433; Fri, 23 Mar 2018 16:56:46 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9394E2297A; Fri, 23 Mar 2018 16:56:46 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NGuk4I014968; Fri, 23 Mar 2018 16:56:46 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NGuifK014950; Fri, 23 Mar 2018 16:56:44 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803231656.w2NGuifK014950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Fri, 23 Mar 2018 16:56:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331436 - in head: share/man/man9 sys/net sys/netinet sys/netinet6 sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in head: share/man/man9 sys/net sys/netinet sys/netinet6 sys/netpfil/pf X-SVN-Commit-Revision: 331436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 16:56:47 -0000 Author: kp Date: Fri Mar 23 16:56:44 2018 New Revision: 331436 URL: https://svnweb.freebsd.org/changeset/base/331436 Log: netpfil: Introduce PFIL_FWD flag Forwarded packets passed through PFIL_OUT, which made it difficult for firewalls to figure out if they were forwarding or producing packets. This in turn is an issue for pf for IPv6 fragment handling: it needs to call ip6_output() or ip6_forward() to handle the fragments. Figuring out which was difficult (and until now, incorrect). Having pfil distinguish the two removes an ugly piece of code from pf. Introduce a new variant of the netpfil callbacks with a flags variable, which has PFIL_FWD set for forwarded packets. This allows pf to reliably work out if a packet is forwarded. Reviewed by: ae, kevans Differential Revision: https://reviews.freebsd.org/D13715 Modified: head/share/man/man9/pfil.9 head/sys/net/if_bridge.c head/sys/net/if_enc.c head/sys/net/if_ethersubr.c head/sys/net/pfil.c head/sys/net/pfil.h head/sys/net/pfvar.h head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_input.c head/sys/netinet/ip_output.c head/sys/netinet6/ip6_fastfwd.c head/sys/netinet6/ip6_forward.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_output.c head/sys/netpfil/pf/pf.c head/sys/netpfil/pf/pf.h head/sys/netpfil/pf/pf_ioctl.c Modified: head/share/man/man9/pfil.9 ============================================================================== --- head/share/man/man9/pfil.9 Fri Mar 23 16:23:15 2018 (r331435) +++ head/share/man/man9/pfil.9 Fri Mar 23 16:56:44 2018 (r331436) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2017 +.Dd March 10, 2018 .Dt PFIL 9 .Os .Sh NAME @@ -37,7 +37,9 @@ .Nm pfil_head_unregister , .Nm pfil_head_get , .Nm pfil_add_hook , +.Nm pfil_add_hook_flags , .Nm pfil_remove_hook , +.Nm pfil_remove_hook_flags , .Nm pfil_run_hooks , .Nm pfil_rlock , .Nm pfil_runlock , @@ -51,6 +53,8 @@ .In net/pfil.h .Bd -literal typedef int (*pfil_func_t)(void *arg, struct mbuf **mp, struct ifnet *, int dir, struct inpcb); +.Bd -literal +typedef int (*pfil_func_flags_t)(void *arg, struct mbuf **mp, struct ifnet *, int dir, int flags, struct inpcb); .Ft int .Fn pfil_head_register "struct pfil_head *head" .Ft int @@ -58,11 +62,15 @@ typedef int (*pfil_func_t)(void *arg, struct mbuf **mp .Ft "struct pfil_head *" .Fn pfil_head_get "int af" "u_long dlt" .Ft int -.Fn pfil_add_hook "pfil_func_t" "void *arg" "int flags" "struct pfil_head *" +.Fn pfil_add_hook "pfil_func_t" "void *arg" "struct pfil_head *" .Ft int -.Fn pfil_remove_hook "pfil_func_t" "void *arg" "int flags" "struct pfil_head *" +.Fn pfil_add_hook_flags "pfil_func_flags_t" "void *arg" "int flags" "struct pfil_head *" .Ft int -.Fn pfil_run_hooks "struct pfil_head *head" "struct mbuf **mp" "struct ifnet *" "int dir" "struct inpcb *" +.Fn pfil_remove_hook "pfil_func_t" "void *arg" "struct pfil_head *" +.Ft int +.Fn pfil_remove_hook_flags "pfil_func_flags_t" "void *arg" "int flags" "struct pfil_head *" +.Ft int +.Fn pfil_run_hooks "struct pfil_head *head" "struct mbuf **mp" "struct ifnet *" "int dir" "int flags" "struct inpcb *" .Ft void .Fn pfil_rlock "struct pfil_head *" "struct rm_priotracker *" .Ft void @@ -116,6 +124,7 @@ with the and .Fn pfil_remove_hook functions, respectively. +.I The head is looked up using the .Fn pfil_head_get function, which takes the key and data link type that the packet filter @@ -135,6 +144,10 @@ interface that the packet is traversing, and the direc or .Dv PFIL_OUT ) that the packet is traveling. +The +.Vt flags +argument will indicate if an outgoing packet is simply being forwarded with the +value PFIL_FWD. The filter may change which mbuf the .Vt "mbuf\ **" argument references. Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/net/if_bridge.c Fri Mar 23 16:56:44 2018 (r331436) @@ -3176,7 +3176,8 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, stru if (PFIL_HOOKED(&V_link_pfil_hook) && V_pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) { - error = pfil_run_hooks(&V_link_pfil_hook, mp, ifp, dir, NULL); + error = pfil_run_hooks(&V_link_pfil_hook, mp, ifp, dir, 0, + NULL); if (*mp == NULL || error != 0) /* packet consumed by filter */ return (error); @@ -3228,21 +3229,21 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, stru */ if (V_pfil_bridge && dir == PFIL_OUT && bifp != NULL) error = pfil_run_hooks(&V_inet_pfil_hook, mp, bifp, - dir, NULL); + dir, 0, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (V_pfil_member && ifp != NULL) error = pfil_run_hooks(&V_inet_pfil_hook, mp, ifp, - dir, NULL); + dir, 0, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (V_pfil_bridge && dir == PFIL_IN && bifp != NULL) error = pfil_run_hooks(&V_inet_pfil_hook, mp, bifp, - dir, NULL); + dir, 0, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; @@ -3282,21 +3283,21 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, stru case ETHERTYPE_IPV6: if (V_pfil_bridge && dir == PFIL_OUT && bifp != NULL) error = pfil_run_hooks(&V_inet6_pfil_hook, mp, bifp, - dir, NULL); + dir, 0, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (V_pfil_member && ifp != NULL) error = pfil_run_hooks(&V_inet6_pfil_hook, mp, ifp, - dir, NULL); + dir, 0, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (V_pfil_bridge && dir == PFIL_IN && bifp != NULL) error = pfil_run_hooks(&V_inet6_pfil_hook, mp, bifp, - dir, NULL); + dir, 0, NULL); break; #endif default: Modified: head/sys/net/if_enc.c ============================================================================== --- head/sys/net/if_enc.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/net/if_enc.c Fri Mar 23 16:56:44 2018 (r331436) @@ -301,7 +301,7 @@ enc_hhook(int32_t hhook_type, int32_t hhook_id, void * /* Make a packet looks like it was received on enc(4) */ rcvif = (*ctx->mp)->m_pkthdr.rcvif; (*ctx->mp)->m_pkthdr.rcvif = ifp; - if (pfil_run_hooks(ph, ctx->mp, ifp, pdir, ctx->inp) != 0 || + if (pfil_run_hooks(ph, ctx->mp, ifp, pdir, 0, ctx->inp) != 0 || *ctx->mp == NULL) { *ctx->mp = NULL; /* consumed by filter */ return (EACCES); Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/net/if_ethersubr.c Fri Mar 23 16:56:44 2018 (r331436) @@ -449,7 +449,8 @@ ether_output_frame(struct ifnet *ifp, struct mbuf *m) int i; if (PFIL_HOOKED(&V_link_pfil_hook)) { - i = pfil_run_hooks(&V_link_pfil_hook, &m, ifp, PFIL_OUT, NULL); + i = pfil_run_hooks(&V_link_pfil_hook, &m, ifp, PFIL_OUT, 0, + NULL); if (i != 0) return (EACCES); @@ -782,7 +783,8 @@ ether_demux(struct ifnet *ifp, struct mbuf *m) /* Do not grab PROMISC frames in case we are re-entered. */ if (PFIL_HOOKED(&V_link_pfil_hook) && !(m->m_flags & M_PROMISC)) { - i = pfil_run_hooks(&V_link_pfil_hook, &m, ifp, PFIL_IN, NULL); + i = pfil_run_hooks(&V_link_pfil_hook, &m, ifp, PFIL_IN, 0, + NULL); if (i != 0 || m == NULL) return; Modified: head/sys/net/pfil.c ============================================================================== --- head/sys/net/pfil.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/net/pfil.c Fri Mar 23 16:56:44 2018 (r331436) @@ -57,7 +57,8 @@ MTX_SYSINIT(pfil_heads_lock, &pfil_global_lock, "pfil_ static struct packet_filter_hook *pfil_chain_get(int, struct pfil_head *); static int pfil_chain_add(pfil_chain_t *, struct packet_filter_hook *, int); -static int pfil_chain_remove(pfil_chain_t *, pfil_func_t, void *); +static int pfil_chain_remove(pfil_chain_t *, void *, void *); +static int pfil_add_hook_priv(void *, void *, int, struct pfil_head *, bool); LIST_HEAD(pfilheadhead, pfil_head); VNET_DEFINE(struct pfilheadhead, pfil_head_list); @@ -95,7 +96,7 @@ VNET_DEFINE(struct rmlock, pfil_lock); */ int pfil_run_hooks(struct pfil_head *ph, struct mbuf **mp, struct ifnet *ifp, - int dir, struct inpcb *inp) + int dir, int flags, struct inpcb *inp) { struct rm_priotracker rmpt; struct packet_filter_hook *pfh; @@ -106,6 +107,12 @@ pfil_run_hooks(struct pfil_head *ph, struct mbuf **mp, KASSERT(ph->ph_nhooks >= 0, ("Pfil hook count dropped < 0")); for (pfh = pfil_chain_get(dir, ph); pfh != NULL; pfh = TAILQ_NEXT(pfh, pfil_chain)) { + if (pfh->pfil_func_flags != NULL) { + rv = (*pfh->pfil_func_flags)(pfh->pfil_arg, &m, ifp, + dir, flags, inp); + if (rv != 0 || m == NULL) + break; + } if (pfh->pfil_func != NULL) { rv = (*pfh->pfil_func)(pfh->pfil_arg, &m, ifp, dir, inp); @@ -256,6 +263,21 @@ pfil_head_get(int type, u_long val) } /* + * pfil_add_hook_flags() adds a function to the packet filter hook. the + * flags are: + * PFIL_IN call me on incoming packets + * PFIL_OUT call me on outgoing packets + * PFIL_ALL call me on all of the above + * PFIL_WAITOK OK to call malloc with M_WAITOK. + */ +int +pfil_add_hook_flags(pfil_func_flags_t func, void *arg, int flags, + struct pfil_head *ph) +{ + return (pfil_add_hook_priv(func, arg, flags, ph, true)); +} + +/* * pfil_add_hook() adds a function to the packet filter hook. the * flags are: * PFIL_IN call me on incoming packets @@ -266,6 +288,13 @@ pfil_head_get(int type, u_long val) int pfil_add_hook(pfil_func_t func, void *arg, int flags, struct pfil_head *ph) { + return (pfil_add_hook_priv(func, arg, flags, ph, false)); +} + +static int +pfil_add_hook_priv(void *func, void *arg, int flags, + struct pfil_head *ph, bool hasflags) +{ struct packet_filter_hook *pfh1 = NULL; struct packet_filter_hook *pfh2 = NULL; int err; @@ -288,7 +317,8 @@ pfil_add_hook(pfil_func_t func, void *arg, int flags, } PFIL_WLOCK(ph); if (flags & PFIL_IN) { - pfh1->pfil_func = func; + pfh1->pfil_func_flags = hasflags ? func : NULL; + pfh1->pfil_func = hasflags ? NULL : func; pfh1->pfil_arg = arg; err = pfil_chain_add(&ph->ph_in, pfh1, flags & ~PFIL_OUT); if (err) @@ -296,7 +326,8 @@ pfil_add_hook(pfil_func_t func, void *arg, int flags, ph->ph_nhooks++; } if (flags & PFIL_OUT) { - pfh2->pfil_func = func; + pfh2->pfil_func_flags = hasflags ? func : NULL; + pfh2->pfil_func = hasflags ? NULL : func; pfh2->pfil_arg = arg; err = pfil_chain_add(&ph->ph_out, pfh2, flags & ~PFIL_IN); if (err) { @@ -319,6 +350,17 @@ error: } /* + * pfil_remove_hook_flags removes a specific function from the packet filter hook + * chain. + */ +int +pfil_remove_hook_flags(pfil_func_flags_t func, void *arg, int flags, + struct pfil_head *ph) +{ + return (pfil_remove_hook((pfil_func_t)func, arg, flags, ph)); +} + +/* * pfil_remove_hook removes a specific function from the packet filter hook * chain. */ @@ -354,7 +396,9 @@ pfil_chain_add(pfil_chain_t *chain, struct packet_filt * First make sure the hook is not already there. */ TAILQ_FOREACH(pfh, chain, pfil_chain) - if (pfh->pfil_func == pfh1->pfil_func && + if (((pfh->pfil_func != NULL && pfh->pfil_func == pfh1->pfil_func) || + (pfh->pfil_func_flags != NULL && + pfh->pfil_func_flags == pfh1->pfil_func_flags)) && pfh->pfil_arg == pfh1->pfil_arg) return (EEXIST); @@ -373,12 +417,13 @@ pfil_chain_add(pfil_chain_t *chain, struct packet_filt * Internal: Remove a pfil hook from a hook chain. */ static int -pfil_chain_remove(pfil_chain_t *chain, pfil_func_t func, void *arg) +pfil_chain_remove(pfil_chain_t *chain, void *func, void *arg) { struct packet_filter_hook *pfh; TAILQ_FOREACH(pfh, chain, pfil_chain) - if (pfh->pfil_func == func && pfh->pfil_arg == arg) { + if ((pfh->pfil_func == func || pfh->pfil_func_flags == func) && + pfh->pfil_arg == arg) { TAILQ_REMOVE(chain, pfh, pfil_chain); free(pfh, M_IFADDR); return (0); Modified: head/sys/net/pfil.h ============================================================================== --- head/sys/net/pfil.h Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/net/pfil.h Fri Mar 23 16:56:44 2018 (r331436) @@ -48,6 +48,8 @@ struct inpcb; typedef int (*pfil_func_t)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *); +typedef int (*pfil_func_flags_t)(void *, struct mbuf **, struct ifnet *, + int, int, struct inpcb *); /* * The packet filter hooks are designed for anything to call them to @@ -56,13 +58,15 @@ typedef int (*pfil_func_t)(void *, struct mbuf **, str */ struct packet_filter_hook { TAILQ_ENTRY(packet_filter_hook) pfil_chain; - pfil_func_t pfil_func; - void *pfil_arg; + pfil_func_t pfil_func; + pfil_func_flags_t pfil_func_flags; + void *pfil_arg; }; #define PFIL_IN 0x00000001 #define PFIL_OUT 0x00000002 #define PFIL_WAITOK 0x00000004 +#define PFIL_FWD 0x00000008 #define PFIL_ALL (PFIL_IN|PFIL_OUT) typedef TAILQ_HEAD(pfil_chain, packet_filter_hook) pfil_chain_t; @@ -102,13 +106,15 @@ VNET_DECLARE(struct rmlock, pfil_lock); /* Public functions for pfil hook management by packet filters. */ struct pfil_head *pfil_head_get(int, u_long); +int pfil_add_hook_flags(pfil_func_flags_t, void *, int, struct pfil_head *); int pfil_add_hook(pfil_func_t, void *, int, struct pfil_head *); +int pfil_remove_hook_flags(pfil_func_flags_t, void *, int, struct pfil_head *); int pfil_remove_hook(pfil_func_t, void *, int, struct pfil_head *); #define PFIL_HOOKED(p) ((p)->ph_nhooks > 0) /* Public functions to run the packet inspection by protocols. */ -int pfil_run_hooks(struct pfil_head *, struct mbuf **, struct ifnet *, - int, struct inpcb *inp); +int pfil_run_hooks(struct pfil_head *, struct mbuf **, struct ifnet *, int, + int, struct inpcb *inp); /* Public functions for pfil head management by protocols. */ int pfil_head_register(struct pfil_head *); Modified: head/sys/net/pfvar.h ============================================================================== --- head/sys/net/pfvar.h Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/net/pfvar.h Fri Mar 23 16:56:44 2018 (r331436) @@ -1578,13 +1578,13 @@ extern void pf_addrcpy(struct pf_addr *, struct pf_ void pf_free_rule(struct pf_rule *); #ifdef INET -int pf_test(int, struct ifnet *, struct mbuf **, struct inpcb *); +int pf_test(int, int, struct ifnet *, struct mbuf **, struct inpcb *); int pf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *, struct pf_pdesc *); #endif /* INET */ #ifdef INET6 -int pf_test6(int, struct ifnet *, struct mbuf **, struct inpcb *); +int pf_test6(int, int, struct ifnet *, struct mbuf **, struct inpcb *); int pf_normalize_ip6(struct mbuf **, int, struct pfi_kif *, u_short *, struct pf_pdesc *); void pf_poolmask(struct pf_addr *, struct pf_addr*, Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netinet/ip_fastfwd.c Fri Mar 23 16:56:44 2018 (r331436) @@ -232,7 +232,7 @@ ip_tryforward(struct mbuf *m) goto passin; if (pfil_run_hooks( - &V_inet_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN, NULL) || + &V_inet_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN, 0, NULL) || m == NULL) goto drop; @@ -305,8 +305,8 @@ passin: if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passout; - if (pfil_run_hooks(&V_inet_pfil_hook, &m, nh.nh_ifp, PFIL_OUT, NULL) || - m == NULL) { + if (pfil_run_hooks(&V_inet_pfil_hook, &m, nh.nh_ifp, PFIL_OUT, PFIL_FWD, + NULL) || m == NULL) { goto drop; } Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netinet/ip_input.c Fri Mar 23 16:56:44 2018 (r331436) @@ -600,7 +600,7 @@ tooshort: goto passin; odst = ip->ip_dst; - if (pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_IN, NULL) != 0) + if (pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_IN, 0, NULL) != 0) return; if (m == NULL) /* consumed by filter */ return; Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netinet/ip_output.c Fri Mar 23 16:56:44 2018 (r331436) @@ -117,7 +117,7 @@ ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, st /* Run through list of hooks for output packets. */ odst.s_addr = ip->ip_dst.s_addr; - *error = pfil_run_hooks(&V_inet_pfil_hook, mp, ifp, PFIL_OUT, inp); + *error = pfil_run_hooks(&V_inet_pfil_hook, mp, ifp, PFIL_OUT, 0, inp); m = *mp; if ((*error) != 0 || m == NULL) return 1; /* Finished */ Modified: head/sys/netinet6/ip6_fastfwd.c ============================================================================== --- head/sys/netinet6/ip6_fastfwd.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netinet6/ip6_fastfwd.c Fri Mar 23 16:56:44 2018 (r331436) @@ -157,7 +157,7 @@ ip6_tryforward(struct mbuf *m) */ if (!PFIL_HOOKED(&V_inet6_pfil_hook)) goto passin; - if (pfil_run_hooks(&V_inet6_pfil_hook, &m, rcvif, PFIL_IN, + if (pfil_run_hooks(&V_inet6_pfil_hook, &m, rcvif, PFIL_IN, 0, NULL) != 0 || m == NULL) goto dropin; /* @@ -201,7 +201,7 @@ passin: if (!PFIL_HOOKED(&V_inet6_pfil_hook)) goto passout; if (pfil_run_hooks(&V_inet6_pfil_hook, &m, nh.nh_ifp, PFIL_OUT, - NULL) != 0 || m == NULL) + PFIL_FWD, NULL) != 0 || m == NULL) goto dropout; /* Modified: head/sys/netinet6/ip6_forward.c ============================================================================== --- head/sys/netinet6/ip6_forward.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netinet6/ip6_forward.c Fri Mar 23 16:56:44 2018 (r331436) @@ -324,8 +324,9 @@ again2: goto pass; odst = ip6->ip6_dst; - /* Run through list of hooks for output packets. */ - error = pfil_run_hooks(&V_inet6_pfil_hook, &m, rt->rt_ifp, PFIL_OUT, NULL); + /* Run through list of hooks for forwarded packets. */ + error = pfil_run_hooks(&V_inet6_pfil_hook, &m, rt->rt_ifp, PFIL_OUT, + PFIL_FWD, NULL); if (error != 0 || m == NULL) goto freecopy; /* consumed by filter */ ip6 = mtod(m, struct ip6_hdr *); Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netinet6/ip6_input.c Fri Mar 23 16:56:44 2018 (r331436) @@ -761,7 +761,7 @@ ip6_input(struct mbuf *m) odst = ip6->ip6_dst; if (pfil_run_hooks(&V_inet6_pfil_hook, &m, - m->m_pkthdr.rcvif, PFIL_IN, NULL)) + m->m_pkthdr.rcvif, PFIL_IN, 0, NULL)) return; if (m == NULL) /* consumed by filter */ return; Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netinet6/ip6_output.c Fri Mar 23 16:56:44 2018 (r331436) @@ -785,7 +785,7 @@ again: odst = ip6->ip6_dst; /* Run through list of hooks for output packets. */ - error = pfil_run_hooks(&V_inet6_pfil_hook, &m, ifp, PFIL_OUT, inp); + error = pfil_run_hooks(&V_inet6_pfil_hook, &m, ifp, PFIL_OUT, 0, inp); if (error != 0 || m == NULL) goto done; /* adjust pointer */ Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netpfil/pf/pf.c Fri Mar 23 16:56:44 2018 (r331436) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -5506,7 +5507,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, goto bad; if (oifp != ifp) { - if (pf_test(PF_OUT, ifp, &m0, NULL) != PF_PASS) + if (pf_test(PF_OUT, 0, ifp, &m0, NULL) != PF_PASS) goto bad; else if (m0 == NULL) goto done; @@ -5668,7 +5669,7 @@ pf_route6(struct mbuf **m, struct pf_rule *r, int dir, goto bad; if (oifp != ifp) { - if (pf_test6(PF_FWD, ifp, &m0, NULL) != PF_PASS) + if (pf_test6(PF_OUT, PFIL_FWD, ifp, &m0, NULL) != PF_PASS) goto bad; else if (m0 == NULL) goto done; @@ -5858,7 +5859,7 @@ pf_check_proto_cksum(struct mbuf *m, int off, int len, #ifdef INET int -pf_test(int dir, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) +pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) { struct pfi_kif *kif; u_short action, reason = 0, log = 0; @@ -6245,7 +6246,7 @@ done: #ifdef INET6 int -pf_test6(int dir, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) +pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) { struct pfi_kif *kif; u_short action, reason = 0, log = 0; @@ -6257,28 +6258,9 @@ pf_test6(int dir, struct ifnet *ifp, struct mbuf **m0, struct pf_ruleset *ruleset = NULL; struct pf_pdesc pd; int off, terminal = 0, dirndx, rh_cnt = 0, pqid = 0; - int fwdir = dir; M_ASSERTPKTHDR(m); - /* Detect packet forwarding. - * If the input interface is different from the output interface we're - * forwarding. - * We do need to be careful about bridges. If the - * net.link.bridge.pfil_bridge sysctl is set we can be filtering on a - * bridge, so if the input interface is a bridge member and the output - * interface is its bridge or a member of the same bridge we're not - * actually forwarding but bridging. - */ - if (dir == PF_OUT && m->m_pkthdr.rcvif && ifp != m->m_pkthdr.rcvif && - (m->m_pkthdr.rcvif->if_bridge == NULL || - (m->m_pkthdr.rcvif->if_bridge != ifp->if_softc && - m->m_pkthdr.rcvif->if_bridge != ifp->if_bridge))) - fwdir = PF_FWD; - - if (dir == PF_FWD) - dir = PF_OUT; - if (!V_pf_status.running) return (PF_PASS); @@ -6656,7 +6638,7 @@ done: PF_STATE_UNLOCK(s); /* If reassembled packet passed, create new fragments. */ - if (action == PF_PASS && *m0 && fwdir == PF_FWD && + if (action == PF_PASS && *m0 && (pflags & PFIL_FWD) && (mtag = m_tag_find(m, PF_REASSEMBLED, NULL)) != NULL) action = pf_refragment6(ifp, m0, mtag); Modified: head/sys/netpfil/pf/pf.h ============================================================================== --- head/sys/netpfil/pf/pf.h Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netpfil/pf/pf.h Fri Mar 23 16:56:44 2018 (r331436) @@ -45,7 +45,7 @@ #endif #endif -enum { PF_INOUT, PF_IN, PF_OUT, PF_FWD }; +enum { PF_INOUT, PF_IN, PF_OUT }; enum { PF_PASS, PF_DROP, PF_SCRUB, PF_NOSCRUB, PF_NAT, PF_NONAT, PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER }; enum { PF_RULESET_SCRUB, PF_RULESET_FILTER, PF_RULESET_NAT, Modified: head/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- head/sys/netpfil/pf/pf_ioctl.c Fri Mar 23 16:23:15 2018 (r331435) +++ head/sys/netpfil/pf/pf_ioctl.c Fri Mar 23 16:56:44 2018 (r331436) @@ -165,15 +165,15 @@ static void pf_tbladdr_copyout(struct pf_addr_wrap * */ #ifdef INET static int pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, - int dir, struct inpcb *inp); + int dir, int flags, struct inpcb *inp); static int pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, - int dir, struct inpcb *inp); + int dir, int flags, struct inpcb *inp); #endif #ifdef INET6 static int pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, - int dir, struct inpcb *inp); + int dir, int flags, struct inpcb *inp); static int pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, - int dir, struct inpcb *inp); + int dir, int flags, struct inpcb *inp); #endif static int hook_pf(void); @@ -3649,12 +3649,12 @@ shutdown_pf(void) #ifdef INET static int -pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, +pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, int flags, struct inpcb *inp) { int chk; - chk = pf_test(PF_IN, ifp, m, inp); + chk = pf_test(PF_IN, flags, ifp, m, inp); if (chk && *m) { m_freem(*m); *m = NULL; @@ -3666,12 +3666,12 @@ pf_check_in(void *arg, struct mbuf **m, struct ifnet * } static int -pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, +pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, int flags, struct inpcb *inp) { int chk; - chk = pf_test(PF_OUT, ifp, m, inp); + chk = pf_test(PF_OUT, flags, ifp, m, inp); if (chk && *m) { m_freem(*m); *m = NULL; @@ -3685,7 +3685,7 @@ pf_check_out(void *arg, struct mbuf **m, struct ifnet #ifdef INET6 static int -pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, +pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, int flags, struct inpcb *inp) { int chk; @@ -3696,7 +3696,7 @@ pf_check6_in(void *arg, struct mbuf **m, struct ifnet * filtering we have change this to lo0 as it is the case in IPv4. */ CURVNET_SET(ifp->if_vnet); - chk = pf_test6(PF_IN, (*m)->m_flags & M_LOOP ? V_loif : ifp, m, inp); + chk = pf_test6(PF_IN, flags, (*m)->m_flags & M_LOOP ? V_loif : ifp, m, inp); CURVNET_RESTORE(); if (chk && *m) { m_freem(*m); @@ -3708,13 +3708,13 @@ pf_check6_in(void *arg, struct mbuf **m, struct ifnet } static int -pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, +pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, int flags, struct inpcb *inp) { int chk; CURVNET_SET(ifp->if_vnet); - chk = pf_test6(PF_OUT, ifp, m, inp); + chk = pf_test6(PF_OUT, flags, ifp, m, inp); CURVNET_RESTORE(); if (chk && *m) { m_freem(*m); @@ -3743,22 +3743,22 @@ hook_pf(void) pfh_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET); if (pfh_inet == NULL) return (ESRCH); /* XXX */ - pfil_add_hook(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet); - pfil_add_hook(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet); + pfil_add_hook_flags(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet); + pfil_add_hook_flags(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet); #endif #ifdef INET6 pfh_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6); if (pfh_inet6 == NULL) { #ifdef INET - pfil_remove_hook(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, + pfil_remove_hook_flags(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet); - pfil_remove_hook(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, + pfil_remove_hook_flags(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet); #endif return (ESRCH); /* XXX */ } - pfil_add_hook(pf_check6_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet6); - pfil_add_hook(pf_check6_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet6); + pfil_add_hook_flags(pf_check6_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet6); + pfil_add_hook_flags(pf_check6_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet6); #endif V_pf_pfil_hooked = 1; @@ -3782,18 +3782,18 @@ dehook_pf(void) pfh_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET); if (pfh_inet == NULL) return (ESRCH); /* XXX */ - pfil_remove_hook(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, + pfil_remove_hook_flags(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet); - pfil_remove_hook(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, + pfil_remove_hook_flags(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet); #endif #ifdef INET6 pfh_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6); if (pfh_inet6 == NULL) return (ESRCH); /* XXX */ - pfil_remove_hook(pf_check6_in, NULL, PFIL_IN | PFIL_WAITOK, + pfil_remove_hook_flags(pf_check6_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet6); - pfil_remove_hook(pf_check6_out, NULL, PFIL_OUT | PFIL_WAITOK, + pfil_remove_hook_flags(pf_check6_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet6); #endif From owner-svn-src-head@freebsd.org Fri Mar 23 16:59:52 2018 Return-Path: Delivered-To: svn-src-head@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 374C5F59E7F; Fri, 23 Mar 2018 16:59:52 +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 DE4537F6D8; Fri, 23 Mar 2018 16:59:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4E50229AA; Fri, 23 Mar 2018 16:59:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NGxp8n015111; Fri, 23 Mar 2018 16:59:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NGxpwS015109; Fri, 23 Mar 2018 16:59:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231659.w2NGxpwS015109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 16:59:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331437 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 331437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 16:59:52 -0000 Author: hselasky Date: Fri Mar 23 16:59:51 2018 New Revision: 331437 URL: https://svnweb.freebsd.org/changeset/base/331437 Log: Create designated workqueue for each mlx5en(4) device instance. The mlx5e_destroy_ifp() function may be called from the system workqueue and in this case trying to flush all works will cause a dead lock. Instead of using the system workqueue, create a designated workqueue for each mlx5en(4) device instance. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Fri Mar 23 16:56:44 2018 (r331436) +++ head/sys/dev/mlx5/mlx5_en/en.h Fri Mar 23 16:59:51 2018 (r331437) @@ -769,6 +769,8 @@ struct mlx5e_priv { struct mlx5e_stats stats; int counter_set_id; + struct workqueue_struct *wq; + eventhandler_tag vlan_detach; eventhandler_tag vlan_attach; struct ifmedia media; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri Mar 23 16:56:44 2018 (r331436) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri Mar 23 16:59:51 2018 (r331437) @@ -642,7 +642,7 @@ mlx5e_update_stats(void *arg) { struct mlx5e_priv *priv = arg; - schedule_work(&priv->update_stats_work); + queue_work(priv->wq, &priv->update_stats_work); callout_reset(&priv->watchdog, hz, &mlx5e_update_stats, priv); } @@ -654,7 +654,7 @@ mlx5e_async_event_sub(struct mlx5e_priv *priv, switch (event) { case MLX5_DEV_EVENT_PORT_UP: case MLX5_DEV_EVENT_PORT_DOWN: - schedule_work(&priv->update_carrier_work); + queue_work(priv->wq, &priv->update_carrier_work); break; default: @@ -2686,7 +2686,7 @@ mlx5e_set_rx_mode(struct ifnet *ifp) { struct mlx5e_priv *priv = ifp->if_softc; - schedule_work(&priv->set_rx_mode_work); + queue_work(priv->wq, &priv->set_rx_mode_work); } static int @@ -3540,11 +3540,20 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) goto err_free_sysctl; } mlx5e_build_ifp_priv(mdev, priv, ncv); + + snprintf(unit, sizeof(unit), "mce%u_wq", + device_get_unit(mdev->pdev->dev.bsddev)); + priv->wq = alloc_workqueue(unit, 0, 1); + if (priv->wq == NULL) { + if_printf(ifp, "%s: alloc_workqueue failed\n", __func__); + goto err_free_sysctl; + } + err = mlx5_alloc_map_uar(mdev, &priv->cq_uar); if (err) { if_printf(ifp, "%s: mlx5_alloc_map_uar failed, %d\n", __func__, err); - goto err_free_sysctl; + goto err_free_wq; } err = mlx5_core_alloc_pd(mdev, &priv->pdn); if (err) { @@ -3666,6 +3675,9 @@ err_dealloc_pd: err_unmap_free_uar: mlx5_unmap_free_uar(mdev, &priv->cq_uar); +err_free_wq: + destroy_workqueue(priv->wq); + err_free_sysctl: sysctl_ctx_free(&priv->sysctl_ctx); @@ -3728,7 +3740,7 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp mlx5_core_dealloc_pd(priv->mdev, priv->pdn); mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar); mlx5e_disable_async_events(priv); - flush_scheduled_work(); + destroy_workqueue(priv->wq); mlx5e_priv_mtx_destroy(priv); free(priv, M_MLX5EN); } From owner-svn-src-head@freebsd.org Fri Mar 23 17:03:43 2018 Return-Path: Delivered-To: svn-src-head@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 9A5E2F5A5D6; Fri, 23 Mar 2018 17:03:43 +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 4CE467FD2E; Fri, 23 Mar 2018 17:03:43 +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 4618022B3C; Fri, 23 Mar 2018 17:03:43 +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 w2NH3h2W020020; Fri, 23 Mar 2018 17:03:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NH3hvr020019; Fri, 23 Mar 2018 17:03:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231703.w2NH3hvr020019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 17:03:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331438 - head/sys/contrib/rdma/krping X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/contrib/rdma/krping X-SVN-Commit-Revision: 331438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 17:03:43 -0000 Author: hselasky Date: Fri Mar 23 17:03:42 2018 New Revision: 331438 URL: https://svnweb.freebsd.org/changeset/base/331438 Log: Exit krping on device removal to avoid endless hang situation. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/contrib/rdma/krping/krping.c Modified: head/sys/contrib/rdma/krping/krping.c ============================================================================== --- head/sys/contrib/rdma/krping/krping.c Fri Mar 23 16:59:51 2018 (r331437) +++ head/sys/contrib/rdma/krping/krping.c Fri Mar 23 17:03:42 2018 (r331438) @@ -301,6 +301,8 @@ static int krping_cma_event_handler(struct rdma_cm_id case RDMA_CM_EVENT_DEVICE_REMOVAL: printk(KERN_ERR PFX "cma detected device removal!!!!\n"); + cb->state = ERROR; + wake_up_interruptible(&cb->sem); break; default: From owner-svn-src-head@freebsd.org Fri Mar 23 17:16:37 2018 Return-Path: Delivered-To: svn-src-head@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 2B5B5F5B6F5; Fri, 23 Mar 2018 17:16:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 D2E2D805E0; Fri, 23 Mar 2018 17:16:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9AF622CE6; Fri, 23 Mar 2018 17:16:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NHGac0025081; Fri, 23 Mar 2018 17:16:36 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NHGagt025060; Fri, 23 Mar 2018 17:16:36 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803231716.w2NHGagt025060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 17:16:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331439 - in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Commit-Revision: 331439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 17:16:37 -0000 Author: emaste Date: Fri Mar 23 17:16:36 2018 New Revision: 331439 URL: https://svnweb.freebsd.org/changeset/base/331439 Log: Sort headers in MD Linuxulator files Bring #includes closer to style(9) and reduce differences between the (three) MD versions of linux_machdep.c and linux_sysvec.c. Sponsored by: Turing Robotic Industries Inc. Modified: head/sys/amd64/linux/linux_machdep.c head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_machdep.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/i386/linux/linux_machdep.c Modified: head/sys/amd64/linux/linux_machdep.c ============================================================================== --- head/sys/amd64/linux/linux_machdep.c Fri Mar 23 17:03:42 2018 (r331438) +++ head/sys/amd64/linux/linux_machdep.c Fri Mar 23 17:16:36 2018 (r331439) @@ -33,15 +33,14 @@ __FBSDID("$FreeBSD$"); #include -#include -#include #include +#include #include -#include #include +#include #include -#include #include +#include #include #include #include @@ -55,8 +54,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include +#include #include #include @@ -72,21 +72,21 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include #include #include #include -#include +#include #include +#include #include #include #include #include -#include #include Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 17:03:42 2018 (r331438) +++ head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 17:16:36 2018 (r331439) @@ -53,8 +53,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include +#include #include #include #include Modified: head/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- head/sys/amd64/linux32/linux32_machdep.c Fri Mar 23 17:03:42 2018 (r331438) +++ head/sys/amd64/linux32/linux32_machdep.c Fri Mar 23 17:16:36 2018 (r331439) @@ -36,13 +36,12 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" #include -#include -#include #include -#include -#include #include +#include +#include #include +#include #include #include #include @@ -54,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -63,19 +63,19 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include #include #include +#include #include #include #include #include #include -#include static void bsd_to_linux_rusage(struct rusage *ru, struct l_rusage *lru); Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 17:03:42 2018 (r331438) +++ head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 17:16:36 2018 (r331439) @@ -56,8 +56,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include +#include #include #include #include Modified: head/sys/i386/linux/linux_machdep.c ============================================================================== --- head/sys/i386/linux/linux_machdep.c Fri Mar 23 17:03:42 2018 (r331438) +++ head/sys/i386/linux/linux_machdep.c Fri Mar 23 17:16:36 2018 (r331439) @@ -30,45 +30,45 @@ __FBSDID("$FreeBSD$"); #include -#include #include -#include #include +#include #include #include #include #include #include -#include #include #include #include #include #include +#include #include #include #include +#include +#include #include #include -#include #include #include #include #include -#include #include +#include #include #include #include +#include #include #include #include #include #include -#include #include /* needed for pcb definition in linux_set_thread_area */ From owner-svn-src-head@freebsd.org Fri Mar 23 17:22:28 2018 Return-Path: Delivered-To: svn-src-head@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 C7E01F5C091; Fri, 23 Mar 2018 17:22:28 +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 7A89580E37; Fri, 23 Mar 2018 17:22:28 +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 7583022E6D; Fri, 23 Mar 2018 17:22:28 +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 w2NHMSfO030139; Fri, 23 Mar 2018 17:22:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NHMS9W030138; Fri, 23 Mar 2018 17:22:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803231722.w2NHMS9W030138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Mar 2018 17:22:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331440 - head/stand/i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/i386/libi386 X-SVN-Commit-Revision: 331440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 17:22:29 -0000 Author: kevans Date: Fri Mar 23 17:22:28 2018 New Revision: 331440 URL: https://svnweb.freebsd.org/changeset/base/331440 Log: Match broken style of vidconsole.c This particular function uses a broken mix of indentation styles. Match it for the newly added SGR 22 bits. Reported by: jkim X-MFC-With: r331416 Modified: head/stand/i386/libi386/vidconsole.c Modified: head/stand/i386/libi386/vidconsole.c ============================================================================== --- head/stand/i386/libi386/vidconsole.c Fri Mar 23 17:16:36 2018 (r331439) +++ head/stand/i386/libi386/vidconsole.c Fri Mar 23 17:22:28 2018 (r331440) @@ -449,9 +449,9 @@ vidc_term_emu(int c) fg_c = bg_c; bg_c = t; break; - case 22: /* normal intensity */ - fg_c &= ~0x8; - break; + case 22: /* normal intensity */ + fg_c &= ~0x8; + break; case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: fg_c = ansi_col[args[i] - 30]; From owner-svn-src-head@freebsd.org Fri Mar 23 17:25:19 2018 Return-Path: Delivered-To: svn-src-head@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 C178CF5C3DC; Fri, 23 Mar 2018 17:25:19 +0000 (UTC) (envelope-from cognet@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 74ADF810DF; Fri, 23 Mar 2018 17:25:19 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6FB2922E7A; Fri, 23 Mar 2018 17:25:19 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NHPJwH030278; Fri, 23 Mar 2018 17:25:19 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NHPJ6V030277; Fri, 23 Mar 2018 17:25:19 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201803231725.w2NHPJ6V030277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Fri, 23 Mar 2018 17:25:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331441 - head/sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: cognet X-SVN-Commit-Paths: head/sys/mips/mips X-SVN-Commit-Revision: 331441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 17:25:19 -0000 Author: cognet Date: Fri Mar 23 17:25:19 2018 New Revision: 331441 URL: https://svnweb.freebsd.org/changeset/base/331441 Log: In __sync_bool_compare_and_swap(), return true if the returned value is the same as the expected one, not the desired one. Pointy hat to: cognet MFC after: 3 days Modified: head/sys/mips/mips/stdatomic.c Modified: head/sys/mips/mips/stdatomic.c ============================================================================== --- head/sys/mips/mips/stdatomic.c Fri Mar 23 17:22:28 2018 (r331440) +++ head/sys/mips/mips/stdatomic.c Fri Mar 23 17:25:19 2018 (r331441) @@ -327,7 +327,7 @@ __sync_bool_compare_and_swap_4(uint32_t *mem, uint32_t { return (do_compare_and_swap_4(mem, expected, desired) == - desired); + expected); } #define EMIT_FETCH_AND_OP_4(name, op) \ From owner-svn-src-head@freebsd.org Fri Mar 23 17:28:05 2018 Return-Path: Delivered-To: svn-src-head@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 01F3CF5C84E; Fri, 23 Mar 2018 17:28:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 A4CBC813F1; Fri, 23 Mar 2018 17:28:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B89722E7B; Fri, 23 Mar 2018 17:28:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NHS4po030411; Fri, 23 Mar 2018 17:28:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NHS4ck030409; Fri, 23 Mar 2018 17:28:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803231728.w2NHS4ck030409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 17:28:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331442 - in head/sys/amd64: linux linux32 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys/amd64: linux linux32 X-SVN-Commit-Revision: 331442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 17:28:05 -0000 Author: emaste Date: Fri Mar 23 17:28:04 2018 New Revision: 331442 URL: https://svnweb.freebsd.org/changeset/base/331442 Log: Fixup return style(9) in amd64 linux*_sysvec.c Sponsored by: Turing Robotic Industries Inc. Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 17:25:19 2018 (r331441) +++ head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 17:28:04 2018 (r331442) @@ -184,15 +184,15 @@ linux_translate_traps(int signal, int trap_code) { if (signal != SIGBUS) - return signal; + return (signal); switch (trap_code) { case T_PROTFLT: case T_TSSFLT: case T_DOUBLEFLT: case T_PAGEFLT: - return SIGSEGV; + return (SIGSEGV); default: - return signal; + return (signal); } } Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 17:25:19 2018 (r331441) +++ head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 17:28:04 2018 (r331442) @@ -193,15 +193,15 @@ static int linux_translate_traps(int signal, int trap_code) { if (signal != SIGBUS) - return signal; + return (signal); switch (trap_code) { case T_PROTFLT: case T_TSSFLT: case T_DOUBLEFLT: case T_PAGEFLT: - return SIGSEGV; + return (SIGSEGV); default: - return signal; + return (signal); } } From owner-svn-src-head@freebsd.org Fri Mar 23 17:33:15 2018 Return-Path: Delivered-To: svn-src-head@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 87F5CF5D0DE; Fri, 23 Mar 2018 17:33: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 3455081A60; Fri, 23 Mar 2018 17:33: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 2F28A2300C; Fri, 23 Mar 2018 17:33: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 w2NHXFbL035308; Fri, 23 Mar 2018 17:33:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NHXEo9035304; Fri, 23 Mar 2018 17:33:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231733.w2NHXEo9035304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 17:33:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331443 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 331443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 17:33:15 -0000 Author: hselasky Date: Fri Mar 23 17:33:14 2018 New Revision: 331443 URL: https://svnweb.freebsd.org/changeset/base/331443 Log: Improve support for health recovery in mlx5core. This patch accumulates the following Linux commits: - 04c0c1ab38e95105d950db5b84e727637e149ce7 net/mlx5: PCI error recovery health care simulation - 0179720d6be2096b8d0a4d143254ff9e77747daa net/mlx5: Introduce trigger_health_work function - 3fece5d676939f42f434c63dfe1bd42d7d94e6f0 net/mlx5: Continue health polling until it is explicitly stopped Submitted by: Matthew Finlay MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_core/mlx5_health.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Mar 23 17:28:04 2018 (r331442) +++ head/sys/dev/mlx5/driver.h Fri Mar 23 17:33:14 2018 (r331443) @@ -498,6 +498,7 @@ struct mlx5_core_health { struct workqueue_struct *wq; unsigned long flags; struct work_struct work; + struct delayed_work recover_work; }; #define MLX5_CQ_LINEAR_ARRAY_SIZE 1024 @@ -887,6 +888,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev); void mlx5_start_health_poll(struct mlx5_core_dev *dev); void mlx5_stop_health_poll(struct mlx5_core_dev *dev); void mlx5_drain_health_wq(struct mlx5_core_dev *dev); +void mlx5_trigger_health_work(struct mlx5_core_dev *dev); #define mlx5_buf_alloc_node(dev, size, direct, buf, node) \ mlx5_buf_alloc(dev, size, direct, buf) Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 17:28:04 2018 (r331442) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 17:33:14 2018 (r331443) @@ -74,6 +74,7 @@ void mlx5_core_event(struct mlx5_core_dev *dev, enum m unsigned long param); void mlx5_enter_error_state(struct mlx5_core_dev *dev); void mlx5_disable_device(struct mlx5_core_dev *dev); +void mlx5_recover_device(struct mlx5_core_dev *dev); void mlx5e_init(void); void mlx5e_cleanup(void); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 17:28:04 2018 (r331442) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 17:33:14 2018 (r331443) @@ -40,14 +40,15 @@ enum { MLX5_NIC_IFC_FULL = 0, MLX5_NIC_IFC_DISABLED = 1, - MLX5_NIC_IFC_NO_DRAM_NIC = 2 + MLX5_NIC_IFC_NO_DRAM_NIC = 2, + MLX5_NIC_IFC_INVALID = 3, }; enum { MLX5_DROP_NEW_HEALTH_WORK, }; -static u8 get_nic_interface(struct mlx5_core_dev *dev) +static u8 get_nic_state(struct mlx5_core_dev *dev) { return (ioread32be(&dev->iseg->cmdq_addr_l_sz) >> 8) & 3; } @@ -80,7 +81,7 @@ static int in_fatal(struct mlx5_core_dev *dev) struct mlx5_core_health *health = &dev->priv.health; struct mlx5_health_buffer __iomem *h = health->health; - if (get_nic_interface(dev) == MLX5_NIC_IFC_DISABLED) + if (get_nic_state(dev) == MLX5_NIC_IFC_DISABLED) return 1; if (ioread32be(&h->fw_ver) == 0xffffffff) @@ -112,9 +113,9 @@ unlock: static void mlx5_handle_bad_state(struct mlx5_core_dev *dev) { - u8 nic_interface = get_nic_interface(dev); + u8 nic_state = get_nic_state(dev); - switch (nic_interface) { + switch (nic_state) { case MLX5_NIC_IFC_FULL: mlx5_core_warn(dev, "Expected to see disabled NIC but it is full driver\n"); break; @@ -128,23 +129,58 @@ static void mlx5_handle_bad_state(struct mlx5_core_dev break; default: mlx5_core_warn(dev, "Expected to see disabled NIC but it is has invalid value %d\n", - nic_interface); + nic_state); } mlx5_disable_device(dev); } +static void health_recover(struct work_struct *work) +{ + struct mlx5_core_health *health; + struct delayed_work *dwork; + struct mlx5_core_dev *dev; + struct mlx5_priv *priv; + u8 nic_state; + + dwork = container_of(work, struct delayed_work, work); + health = container_of(dwork, struct mlx5_core_health, recover_work); + priv = container_of(health, struct mlx5_priv, health); + dev = container_of(priv, struct mlx5_core_dev, priv); + + nic_state = get_nic_state(dev); + if (nic_state == MLX5_NIC_IFC_INVALID) { + dev_err(&dev->pdev->dev, "health recovery flow aborted since the nic state is invalid\n"); + return; + } + + dev_err(&dev->pdev->dev, "starting health recovery flow\n"); + mlx5_recover_device(dev); +} + +/* How much time to wait until health resetting the driver (in msecs) */ +#define MLX5_RECOVERY_DELAY_MSECS 60000 static void health_care(struct work_struct *work) { + unsigned long recover_delay = msecs_to_jiffies(MLX5_RECOVERY_DELAY_MSECS); struct mlx5_core_health *health; struct mlx5_core_dev *dev; struct mlx5_priv *priv; + unsigned long flags; health = container_of(work, struct mlx5_core_health, work); priv = container_of(health, struct mlx5_priv, health); dev = container_of(priv, struct mlx5_core_dev, priv); mlx5_core_warn(dev, "handling bad device here\n"); mlx5_handle_bad_state(dev); + + spin_lock_irqsave(&health->wq_lock, flags); + if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) + schedule_delayed_work(&health->recover_work, recover_delay); + else + dev_err(&dev->pdev->dev, + "new health works are not permitted at this stage\n"); + spin_unlock_irqrestore(&health->wq_lock, flags); } static int get_next_poll_jiffies(void) @@ -158,6 +194,20 @@ static int get_next_poll_jiffies(void) return next; } +void mlx5_trigger_health_work(struct mlx5_core_dev *dev) +{ + struct mlx5_core_health *health = &dev->priv.health; + unsigned long flags; + + spin_lock_irqsave(&health->wq_lock, flags); + if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) + queue_work(health->wq, &health->work); + else + dev_err(&dev->pdev->dev, + "new health works are not permitted at this stage\n"); + spin_unlock_irqrestore(&health->wq_lock, flags); +} + static const char *hsynd_str(u8 synd) { switch (synd) { @@ -224,10 +274,8 @@ static void poll_health(unsigned long data) if (dev->state != MLX5_DEVICE_STATE_UP) return; - if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { - mod_timer(&health->timer, get_next_poll_jiffies()); - return; - } + if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) + goto out; count = ioread32be(health->health_counter); if (count == health->prev) @@ -239,21 +287,16 @@ static void poll_health(unsigned long data) if (health->miss_counter == MAX_MISSES) { mlx5_core_err(dev, "device's health compromised - reached miss count\n"); print_health_info(dev); - } else { - mod_timer(&health->timer, get_next_poll_jiffies()); } if (in_fatal(dev) && !health->sick) { health->sick = true; print_health_info(dev); - spin_lock(&health->wq_lock); - if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) - queue_work(health->wq, &health->work); - else - dev_err(&dev->pdev->dev, - "new health works are not permitted at this stage\n"); - spin_unlock(&health->wq_lock); + mlx5_trigger_health_work(dev); } + +out: + mod_timer(&health->timer, get_next_poll_jiffies()); } void mlx5_start_health_poll(struct mlx5_core_dev *dev) @@ -281,10 +324,12 @@ void mlx5_stop_health_poll(struct mlx5_core_dev *dev) void mlx5_drain_health_wq(struct mlx5_core_dev *dev) { struct mlx5_core_health *health = &dev->priv.health; + unsigned long flags; - spin_lock(&health->wq_lock); + spin_lock_irqsave(&health->wq_lock, flags); set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); - spin_unlock(&health->wq_lock); + spin_unlock_irqrestore(&health->wq_lock, flags); + cancel_delayed_work_sync(&health->recover_work); cancel_work_sync(&health->work); } @@ -316,6 +361,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev) spin_lock_init(&health->wq_lock); INIT_WORK(&health->work, health_care); + INIT_DELAYED_WORK(&health->recover_work, health_recover); return 0; } Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 17:28:04 2018 (r331442) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 17:33:14 2018 (r331443) @@ -1257,11 +1257,6 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci return err ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; } -void mlx5_disable_device(struct mlx5_core_dev *dev) -{ - mlx5_pci_err_detected(dev->pdev, 0); -} - /* wait for the device to show vital signs. For now we check * that we can read the device ID and that the health buffer * shows a non zero value which is different than 0xffffffff @@ -1376,6 +1371,18 @@ static const struct pci_device_id mlx5_core_pci_table[ }; MODULE_DEVICE_TABLE(pci, mlx5_core_pci_table); + +void mlx5_disable_device(struct mlx5_core_dev *dev) +{ + mlx5_pci_err_detected(dev->pdev, 0); +} + +void mlx5_recover_device(struct mlx5_core_dev *dev) +{ + mlx5_pci_disable_device(dev); + if (mlx5_pci_slot_reset(dev->pdev) == PCI_ERS_RESULT_RECOVERED) + mlx5_pci_resume(dev->pdev); +} struct pci_driver mlx5_core_driver = { .name = DRIVER_NAME, From owner-svn-src-head@freebsd.org Fri Mar 23 18:02:22 2018 Return-Path: Delivered-To: svn-src-head@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 E9DC2F5F6BD; Fri, 23 Mar 2018 18:02:21 +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 9FF9F82F98; Fri, 23 Mar 2018 18:02:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9ACA3234C2; Fri, 23 Mar 2018 18:02:21 +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 w2NI2Lvk047416; Fri, 23 Mar 2018 18:02:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NI2Kfm047409; Fri, 23 Mar 2018 18:02:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231802.w2NI2Kfm047409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:02:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331445 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 331445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:02:22 -0000 Author: hselasky Date: Fri Mar 23 18:02:20 2018 New Revision: 331445 URL: https://svnweb.freebsd.org/changeset/base/331445 Log: Add support for fast unload in shutdown flow in mlx5core. This patch accumulates the following Linux commits: - 8812c24d28f4972c4f2b9998bf30b1f2a1b62adf net/mlx5: Add fast unload support in shutdown flow - 59211bd3b6329c3e5f4a90ac3d7f87ffa7867073 net/mlx5: Split the load/unload flow into hardware and software flows - 4525abeaae54560254a1bb8970b3d4c225d32ef4 net/mlx5: Expose command polling interface Submitted by: Matthew Finlay MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_core/mlx5_fw.c head/sys/dev/mlx5/mlx5_core/mlx5_health.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_ifc.h Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Mar 23 17:58:33 2018 (r331444) +++ head/sys/dev/mlx5/driver.h Fri Mar 23 18:02:20 2018 (r331445) @@ -779,6 +779,7 @@ struct mlx5_cmd_work_ent { u64 ts2; u16 op; u8 busy; + bool polling; }; struct mlx5_pas { @@ -866,6 +867,7 @@ static inline u32 mlx5_base_mkey(const u32 key) return key & 0xffffff00u; } +void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force); int mlx5_cmd_init(struct mlx5_core_dev *dev); void mlx5_cmd_cleanup(struct mlx5_core_dev *dev); void mlx5_cmd_use_events(struct mlx5_core_dev *dev); @@ -877,6 +879,8 @@ int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size, void *out, int out_size, mlx5_cmd_cbk_t callback, void *context); +int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size, + void *out, int out_size); int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn); int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn); int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Fri Mar 23 17:58:33 2018 (r331444) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Fri Mar 23 18:02:20 2018 (r331445) @@ -859,6 +859,7 @@ static void cmd_work_handler(struct work_struct *work) unsigned long cb_timeout = msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC); struct mlx5_cmd_layout *lay; struct semaphore *sem; + bool poll_cmd = ent->polling; sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem; down(sem); @@ -897,7 +898,7 @@ static void cmd_work_handler(struct work_struct *work) iowrite32be(1 << ent->idx, &dev->iseg->cmd_dbell); mmiowb(); /* if not in polling don't use ent after this point*/ - if (cmd->mode == CMD_MODE_POLLING) { + if (cmd->mode == CMD_MODE_POLLING || poll_cmd) { poll_timeout(ent); /* make sure we read the descriptor after ownership is SW */ mlx5_cmd_comp_handler(dev, 1U << ent->idx); @@ -940,7 +941,7 @@ static int wait_func(struct mlx5_core_dev *dev, struct struct mlx5_cmd *cmd = &dev->cmd; int err; - if (cmd->mode == CMD_MODE_POLLING) { + if (cmd->mode == CMD_MODE_POLLING || ent->polling) { wait_for_completion(&ent->done); err = ent->ret; } else if (!wait_for_completion_timeout(&ent->done, timeout)) { @@ -969,7 +970,8 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, int uin_size, struct mlx5_cmd_msg *out, void *uout, int uout_size, mlx5_cmd_cbk_t callback, - void *context, int page_queue, u8 *status) + void *context, int page_queue, u8 *status, + bool force_polling) { struct mlx5_cmd *cmd = &dev->cmd; struct mlx5_cmd_work_ent *ent; @@ -986,6 +988,8 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, if (IS_ERR(ent)) return PTR_ERR(ent); + ent->polling = force_polling; + if (!callback) init_completion(&ent->done); @@ -1260,7 +1264,8 @@ static int is_manage_pages(void *in) static int cmd_exec_helper(struct mlx5_core_dev *dev, void *in, int in_size, void *out, int out_size, - mlx5_cmd_cbk_t callback, void *context) + mlx5_cmd_cbk_t callback, void *context, + bool force_polling) { struct mlx5_cmd_msg *inb; struct mlx5_cmd_msg *outb; @@ -1300,7 +1305,7 @@ static int cmd_exec_helper(struct mlx5_core_dev *dev, } err = mlx5_cmd_invoke(dev, inb, in_size, outb, out, out_size, callback, - context, pages_queue, &status); + context, pages_queue, &status, force_polling); if (err) { if (err == -ETIMEDOUT) return err; @@ -1331,7 +1336,7 @@ int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, { int err; - err = cmd_exec_helper(dev, in, in_size, out, out_size, NULL, NULL); + err = cmd_exec_helper(dev, in, in_size, out, out_size, NULL, NULL, false); return err ? : mlx5_cmd_check(dev, in, out); } EXPORT_SYMBOL(mlx5_cmd_exec); @@ -1340,9 +1345,19 @@ int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void * void *out, int out_size, mlx5_cmd_cbk_t callback, void *context) { - return cmd_exec_helper(dev, in, in_size, out, out_size, callback, context); + return cmd_exec_helper(dev, in, in_size, out, out_size, callback, context, false); } EXPORT_SYMBOL(mlx5_cmd_exec_cb); + +int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size, + void *out, int out_size) +{ + int err; + + err = cmd_exec_helper(dev, in, in_size, out, out_size, NULL, NULL, true); + return err ? : mlx5_cmd_check(dev, in, out); +} +EXPORT_SYMBOL(mlx5_cmd_exec_polling); static void destroy_msg_cache(struct mlx5_core_dev *dev) { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 17:58:33 2018 (r331444) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 18:02:20 2018 (r331445) @@ -70,9 +70,10 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev); int mlx5_query_board_id(struct mlx5_core_dev *dev); int mlx5_cmd_init_hca(struct mlx5_core_dev *dev); int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev); +int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev *dev); void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event, unsigned long param); -void mlx5_enter_error_state(struct mlx5_core_dev *dev); +void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force); void mlx5_disable_device(struct mlx5_core_dev *dev); void mlx5_recover_device(struct mlx5_core_dev *dev); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_fw.c Fri Mar 23 17:58:33 2018 (r331444) +++ head/sys/dev/mlx5/mlx5_core/mlx5_fw.c Fri Mar 23 18:02:20 2018 (r331445) @@ -218,6 +218,34 @@ int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev) return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); } +int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev *dev) +{ + u32 out[MLX5_ST_SZ_DW(teardown_hca_out)] = {0}; + u32 in[MLX5_ST_SZ_DW(teardown_hca_in)] = {0}; + int force_state; + int ret; + + if (!MLX5_CAP_GEN(dev, force_teardown)) { + mlx5_core_dbg(dev, "force teardown is not supported in the firmware\n"); + return -EOPNOTSUPP; + } + + MLX5_SET(teardown_hca_in, in, opcode, MLX5_CMD_OP_TEARDOWN_HCA); + MLX5_SET(teardown_hca_in, in, profile, MLX5_TEARDOWN_HCA_IN_PROFILE_FORCE_CLOSE); + + ret = mlx5_cmd_exec_polling(dev, in, sizeof(in), out, sizeof(out)); + if (ret) + return ret; + + force_state = MLX5_GET(teardown_hca_out, out, force_state); + if (force_state == MLX5_TEARDOWN_HCA_OUT_FORCE_STATE_FAIL) { + mlx5_core_err(dev, "teardown with force mode failed\n"); + return -EIO; + } + + return 0; +} + int mlx5_core_set_dc_cnak_trace(struct mlx5_core_dev *dev, int enable, u64 addr) { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 17:58:33 2018 (r331444) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:02:20 2018 (r331445) @@ -90,7 +90,7 @@ static int in_fatal(struct mlx5_core_dev *dev) return 0; } -void mlx5_enter_error_state(struct mlx5_core_dev *dev) +void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force) { mutex_lock(&dev->intf_state_mutex); if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { @@ -99,7 +99,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev) } mlx5_core_err(dev, "start\n"); - if (pci_channel_offline(dev->pdev) || in_fatal(dev)) { + if (pci_channel_offline(dev->pdev) || in_fatal(dev) || force) { dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; mlx5_trigger_cmd_completions(dev); } Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 17:58:33 2018 (r331444) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:02:20 2018 (r331445) @@ -868,11 +868,65 @@ static void mlx5_pci_close(struct mlx5_core_dev *dev, mlx5_pci_disable_device(dev); } -static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv) +static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv) { struct pci_dev *pdev = dev->pdev; int err; + err = mlx5_query_hca_caps(dev); + if (err) { + dev_err(&pdev->dev, "query hca failed\n"); + goto out; + } + + err = mlx5_query_board_id(dev); + if (err) { + dev_err(&pdev->dev, "query board id failed\n"); + goto out; + } + + err = mlx5_eq_init(dev); + if (err) { + dev_err(&pdev->dev, "failed to initialize eq\n"); + goto out; + } + + MLX5_INIT_DOORBELL_LOCK(&priv->cq_uar_lock); + + err = mlx5_init_cq_table(dev); + if (err) { + dev_err(&pdev->dev, "failed to initialize cq table\n"); + goto err_eq_cleanup; + } + + mlx5_init_qp_table(dev); + mlx5_init_srq_table(dev); + mlx5_init_mr_table(dev); + + return 0; + +err_eq_cleanup: + mlx5_eq_cleanup(dev); + +out: + return err; +} + +static void mlx5_cleanup_once(struct mlx5_core_dev *dev) +{ + mlx5_cleanup_mr_table(dev); + mlx5_cleanup_srq_table(dev); + mlx5_cleanup_qp_table(dev); + mlx5_cleanup_cq_table(dev); + mlx5_eq_cleanup(dev); +} + +static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, + bool boot) +{ + struct pci_dev *pdev = dev->pdev; + int err; + mutex_lock(&dev->intf_state_mutex); if (test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) { dev_warn(&dev->pdev->dev, "%s: interface is up, NOP\n", @@ -900,12 +954,10 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st goto err_cmd_cleanup; } - mlx5_pagealloc_init(dev); - err = mlx5_core_enable_hca(dev); if (err) { device_printf((&pdev->dev)->bsddev, "ERR: ""enable hca failed\n"); - goto err_pagealloc_cleanup; + goto err_cmd_cleanup; } err = mlx5_core_set_issi(dev); @@ -958,34 +1010,21 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st mlx5_start_health_poll(dev); - err = mlx5_query_hca_caps(dev); - if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""query hca failed\n"); + if (boot && mlx5_init_once(dev, priv)) { + dev_err(&pdev->dev, "sw objs init failed\n"); goto err_stop_poll; } - err = mlx5_query_board_id(dev); - if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""query board id failed\n"); - goto err_stop_poll; - } - err = mlx5_enable_msix(dev); if (err) { device_printf((&pdev->dev)->bsddev, "ERR: ""enable msix failed\n"); - goto err_stop_poll; + goto err_cleanup_once; } - err = mlx5_eq_init(dev); - if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""failed to initialize eq\n"); - goto disable_msix; - } - err = mlx5_alloc_uuars(dev, &priv->uuari); if (err) { device_printf((&pdev->dev)->bsddev, "ERR: ""Failed allocating uar, aborting\n"); - goto err_eq_cleanup; + goto err_disable_msix; } err = mlx5_start_eqs(dev); @@ -1003,23 +1042,16 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st if (map_bf_area(dev)) device_printf((&pdev->dev)->bsddev, "ERR: ""Failed to map blue flame area\n"); - MLX5_INIT_DOORBELL_LOCK(&priv->cq_uar_lock); - - mlx5_init_cq_table(dev); - mlx5_init_qp_table(dev); - mlx5_init_srq_table(dev); - mlx5_init_mr_table(dev); - err = mlx5_init_fs(dev); if (err) { mlx5_core_err(dev, "flow steering init %d\n", err); - goto err_init_tables; + goto err_free_comp_eqs; } err = mlx5_register_device(dev); if (err) { dev_err(&pdev->dev, "mlx5_register_device failed %d\n", err); - goto err_reg_dev; + goto err_fs; } mlx5_fwdump_prep(dev); @@ -1031,13 +1063,11 @@ out: mutex_unlock(&dev->intf_state_mutex); return 0; -err_reg_dev: +err_fs: mlx5_cleanup_fs(dev); -err_init_tables: - mlx5_cleanup_mr_table(dev); - mlx5_cleanup_srq_table(dev); - mlx5_cleanup_qp_table(dev); - mlx5_cleanup_cq_table(dev); + +err_free_comp_eqs: + free_comp_eqs(dev); unmap_bf_area(dev); err_stop_eqs: @@ -1046,12 +1076,13 @@ err_stop_eqs: err_free_uar: mlx5_free_uuars(dev, &priv->uuari); -err_eq_cleanup: - mlx5_eq_cleanup(dev); - -disable_msix: +err_disable_msix: mlx5_disable_msix(dev); +err_cleanup_once: + if (boot) + mlx5_cleanup_once(dev); + err_stop_poll: mlx5_stop_health_poll(dev); if (mlx5_cmd_teardown_hca(dev)) { @@ -1068,9 +1099,6 @@ err_pagealloc_stop: err_disable_hca: mlx5_core_disable_hca(dev); -err_pagealloc_cleanup: - mlx5_pagealloc_cleanup(dev); - err_cmd_cleanup: mlx5_cmd_cleanup(dev); @@ -1081,13 +1109,16 @@ out_err: return err; } -static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv) +static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, + bool cleanup) { int err = 0; mutex_lock(&dev->intf_state_mutex); if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) { dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", __func__); + if (cleanup) + mlx5_cleanup_once(dev); goto out; } @@ -1095,17 +1126,14 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, mlx5_unregister_device(dev); mlx5_cleanup_fs(dev); - mlx5_cleanup_mr_table(dev); - mlx5_cleanup_srq_table(dev); - mlx5_cleanup_qp_table(dev); - mlx5_cleanup_cq_table(dev); unmap_bf_area(dev); mlx5_wait_for_reclaim_vfs_pages(dev); free_comp_eqs(dev); mlx5_stop_eqs(dev); mlx5_free_uuars(dev, &priv->uuari); - mlx5_eq_cleanup(dev); mlx5_disable_msix(dev); + if (cleanup) + mlx5_cleanup_once(dev); mlx5_stop_health_poll(dev); err = mlx5_cmd_teardown_hca(dev); if (err) { @@ -1115,7 +1143,6 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, mlx5_pagealloc_stop(dev); mlx5_reclaim_startup_pages(dev); mlx5_core_disable_hca(dev); - mlx5_pagealloc_cleanup(dev); mlx5_cmd_cleanup(dev); out: @@ -1184,7 +1211,9 @@ static int init_one(struct pci_dev *pdev, goto close_pci; } - err = mlx5_load_one(dev, priv); + mlx5_pagealloc_init(dev); + + err = mlx5_load_one(dev, priv, true); if (err) { device_printf((&pdev->dev)->bsddev, "ERR: ""mlx5_register_device failed %d\n", err); goto clean_health; @@ -1193,6 +1222,7 @@ static int init_one(struct pci_dev *pdev, return 0; clean_health: + mlx5_pagealloc_cleanup(dev); mlx5_health_cleanup(dev); close_pci: mlx5_pci_close(dev, priv); @@ -1206,12 +1236,13 @@ static void remove_one(struct pci_dev *pdev) struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct mlx5_priv *priv = &dev->priv; - if (mlx5_unload_one(dev, priv)) { + if (mlx5_unload_one(dev, priv, true)) { dev_err(&dev->pdev->dev, "mlx5_unload_one failed\n"); mlx5_health_cleanup(dev); return; } + mlx5_pagealloc_cleanup(dev); mlx5_health_cleanup(dev); mlx5_pci_close(dev, priv); pci_set_drvdata(pdev, NULL); @@ -1225,8 +1256,8 @@ static pci_ers_result_t mlx5_pci_err_detected(struct p struct mlx5_priv *priv = &dev->priv; dev_info(&pdev->dev, "%s was called\n", __func__); - mlx5_enter_error_state(dev); - mlx5_unload_one(dev, priv); + mlx5_enter_error_state(dev, false); + mlx5_unload_one(dev, priv, false); if (state) { pci_save_state(pdev->dev.bsddev); mlx5_drain_health_wq(dev); @@ -1310,7 +1341,7 @@ static void mlx5_pci_resume(struct pci_dev *pdev) pci_save_state(pdev->dev.bsddev); wait_vital(pdev); - err = mlx5_load_one(dev, priv); + err = mlx5_load_one(dev, priv, false); if (err) dev_err(&pdev->dev, "%s: mlx5_load_one failed with error code: %d\n" , __func__, err); @@ -1324,13 +1355,41 @@ static const struct pci_error_handlers mlx5_err_handle .resume = mlx5_pci_resume }; +static int mlx5_try_fast_unload(struct mlx5_core_dev *dev) +{ + int err; + + if (!MLX5_CAP_GEN(dev, force_teardown)) { + mlx5_core_dbg(dev, "force teardown is not supported in the firmware\n"); + return -EOPNOTSUPP; + } + + if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { + mlx5_core_dbg(dev, "Device in internal error state, giving up\n"); + return -EAGAIN; + } + + err = mlx5_cmd_force_teardown_hca(dev); + if (err) { + mlx5_core_dbg(dev, "Firmware couldn't do fast unload error: %d\n", err); + return err; + } + + mlx5_enter_error_state(dev, true); + + return 0; +} + static void shutdown_one(struct pci_dev *pdev) { struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct mlx5_priv *priv = &dev->priv; + int err; set_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &dev->intf_state); - mlx5_unload_one(dev, priv); + err = mlx5_try_fast_unload(dev); + if (err) + mlx5_unload_one(dev, priv, false); mlx5_pci_disable_device(dev); } Modified: head/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- head/sys/dev/mlx5/mlx5_ifc.h Fri Mar 23 17:58:33 2018 (r331444) +++ head/sys/dev/mlx5/mlx5_ifc.h Fri Mar 23 18:02:20 2018 (r331445) @@ -941,7 +941,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 max_indirection[0x8]; u8 reserved_8[0x1]; u8 log_max_mrw_sz[0x7]; - u8 reserved_9[0x2]; + u8 force_teardown[0x1]; + u8 reserved_9[0x1]; u8 log_max_bsf_list_size[0x6]; u8 reserved_10[0x2]; u8 log_max_klm_list_size[0x6]; @@ -3149,18 +3150,25 @@ struct mlx5_ifc_icmd_access_reg_in_bits { u8 register_data[0][0x20]; }; +enum { + MLX5_TEARDOWN_HCA_OUT_FORCE_STATE_SUCCESS = 0x0, + MLX5_TEARDOWN_HCA_OUT_FORCE_STATE_FAIL = 0x1, +}; + struct mlx5_ifc_teardown_hca_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; u8 syndrome[0x20]; - u8 reserved_1[0x40]; + u8 reserved_1[0x3f]; + + u8 force_state[0x1]; }; enum { MLX5_TEARDOWN_HCA_IN_PROFILE_GRACEFUL_CLOSE = 0x0, - MLX5_TEARDOWN_HCA_IN_PROFILE_PANIC_CLOSE = 0x1, + MLX5_TEARDOWN_HCA_IN_PROFILE_FORCE_CLOSE = 0x1, }; struct mlx5_ifc_teardown_hca_in_bits { From owner-svn-src-head@freebsd.org Fri Mar 23 18:09:10 2018 Return-Path: Delivered-To: svn-src-head@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 4CD68F5FFCD; Fri, 23 Mar 2018 18:09:10 +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 02DCE83594; Fri, 23 Mar 2018 18:09:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED251234D6; Fri, 23 Mar 2018 18:09:09 +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 w2NI99Fo050850; Fri, 23 Mar 2018 18:09:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NI9916050847; Fri, 23 Mar 2018 18:09:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231809.w2NI9916050847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:09:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331446 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 331446 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:09:10 -0000 Author: hselasky Date: Fri Mar 23 18:09:09 2018 New Revision: 331446 URL: https://svnweb.freebsd.org/changeset/base/331446 Log: Cancel delayed recovery work when unloading the mlx5core driver. linux commit 2a0165a034ac024b60cca49c61e46f4afa2e4d98 Submitted by: Matthew Finlay MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_health.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Mar 23 18:02:20 2018 (r331445) +++ head/sys/dev/mlx5/driver.h Fri Mar 23 18:09:09 2018 (r331446) @@ -892,6 +892,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev); void mlx5_start_health_poll(struct mlx5_core_dev *dev); void mlx5_stop_health_poll(struct mlx5_core_dev *dev); void mlx5_drain_health_wq(struct mlx5_core_dev *dev); +void mlx5_drain_health_recovery(struct mlx5_core_dev *dev); void mlx5_trigger_health_work(struct mlx5_core_dev *dev); #define mlx5_buf_alloc_node(dev, size, direct, buf, node) \ Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:02:20 2018 (r331445) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:09:09 2018 (r331446) @@ -46,6 +46,7 @@ enum { enum { MLX5_DROP_NEW_HEALTH_WORK, + MLX5_DROP_NEW_RECOVERY_WORK, }; static u8 get_nic_state(struct mlx5_core_dev *dev) @@ -175,7 +176,7 @@ static void health_care(struct work_struct *work) mlx5_handle_bad_state(dev); spin_lock_irqsave(&health->wq_lock, flags); - if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) + if (!test_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags)) schedule_delayed_work(&health->recover_work, recover_delay); else dev_err(&dev->pdev->dev, @@ -306,6 +307,7 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev) init_timer(&health->timer); health->sick = 0; clear_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); + clear_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); health->health = &dev->iseg->health; health->health_counter = &dev->iseg->health_counter; @@ -328,9 +330,21 @@ void mlx5_drain_health_wq(struct mlx5_core_dev *dev) spin_lock_irqsave(&health->wq_lock, flags); set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); + set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); spin_unlock_irqrestore(&health->wq_lock, flags); cancel_delayed_work_sync(&health->recover_work); cancel_work_sync(&health->work); +} + +void mlx5_drain_health_recovery(struct mlx5_core_dev *dev) +{ + struct mlx5_core_health *health = &dev->priv.health; + unsigned long flags; + + spin_lock_irqsave(&health->wq_lock, flags); + set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); + spin_unlock_irqrestore(&health->wq_lock, flags); + cancel_delayed_work_sync(&dev->priv.health.recover_work); } void mlx5_health_cleanup(struct mlx5_core_dev *dev) Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:02:20 2018 (r331445) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:09:09 2018 (r331446) @@ -1114,6 +1114,9 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, { int err = 0; + if (cleanup) + mlx5_drain_health_recovery(dev); + mutex_lock(&dev->intf_state_mutex); if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) { dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", __func__); From owner-svn-src-head@freebsd.org Fri Mar 23 18:11:07 2018 Return-Path: Delivered-To: svn-src-head@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 029ECF60387; Fri, 23 Mar 2018 18:11: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 98FF983892; Fri, 23 Mar 2018 18:11:06 +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 940CA235FC; Fri, 23 Mar 2018 18:11:06 +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 w2NIB6Qx051700; Fri, 23 Mar 2018 18:11:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIB6o8051699; Fri, 23 Mar 2018 18:11:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231811.w2NIB6o8051699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:11:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331447 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331447 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:11:07 -0000 Author: hselasky Date: Fri Mar 23 18:11:06 2018 New Revision: 331447 URL: https://svnweb.freebsd.org/changeset/base/331447 Log: Hide verbose proclamation of error when forced in mlx5core. When mlx5_enter_error_state() operation is forced by shutdown, the messages surrounding setting the error state are not informational and confuse users. Submitted by: kib@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:09:09 2018 (r331446) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:11:06 2018 (r331447) @@ -99,14 +99,16 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, return; } - mlx5_core_err(dev, "start\n"); + if (!force) + mlx5_core_err(dev, "internal state error detected\n"); if (pci_channel_offline(dev->pdev) || in_fatal(dev) || force) { dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; mlx5_trigger_cmd_completions(dev); } mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0); - mlx5_core_err(dev, "end\n"); + if (!force) + mlx5_core_err(dev, "system error event triggered\n"); unlock: mutex_unlock(&dev->intf_state_mutex); From owner-svn-src-head@freebsd.org Fri Mar 23 18:20:43 2018 Return-Path: Delivered-To: svn-src-head@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 ADCADF6138A; Fri, 23 Mar 2018 18:20:43 +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 4D78684340; Fri, 23 Mar 2018 18:20:43 +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 485D523673; Fri, 23 Mar 2018 18:20:43 +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 w2NIKhuj056110; Fri, 23 Mar 2018 18:20:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIKhrD056107; Fri, 23 Mar 2018 18:20:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231820.w2NIKhrD056107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:20:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331449 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 331449 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:20:44 -0000 Author: hselasky Date: Fri Mar 23 18:20:42 2018 New Revision: 331449 URL: https://svnweb.freebsd.org/changeset/base/331449 Log: Handle software reset of firmware in error flow in mlx5core. Some mlx5 adapter firmware allows the driver to reset the firmware in the event of an error. When a software reset is issued on any physical function all PFs enter reset state. This is a recoverable condition. The existing recovery flow was designed to allow the recovery of a VF after a PF driver reload. This patch expands the scope of that flow to recover PFs or VFs after a SW reset has been issued. When a software reset is issued the following occurs: 1. The NIC interface mode is set to SW_RESET (7) while the reset is in progress. 2. Once the reset completes the NIC interface mode is set to NIC disabled (1). After the reset has been issued (added in a subsequent patch) the health poll for other functions will detect that the NIC interface state has been set to disabled. This will cause it to enter the existing recovery flow. If the PCI is still working (meaning it doesn't return 0xff on all reads) it means recovery can proceed immediately instead of waiting 60 seconds. The error detetion has also been refactored to avoid incorrect or misleading log messages. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_health.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Mar 23 18:15:01 2018 (r331448) +++ head/sys/dev/mlx5/driver.h Fri Mar 23 18:20:42 2018 (r331449) @@ -492,7 +492,7 @@ struct mlx5_core_health { struct timer_list timer; u32 prev; int miss_counter; - bool sick; + u32 fatal_error; /* wq spinlock to synchronize draining */ spinlock_t wq_lock; struct workqueue_struct *wq; Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:15:01 2018 (r331448) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:20:42 2018 (r331449) @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include "mlx5_core.h" @@ -41,7 +42,7 @@ enum { MLX5_NIC_IFC_FULL = 0, MLX5_NIC_IFC_DISABLED = 1, MLX5_NIC_IFC_NO_DRAM_NIC = 2, - MLX5_NIC_IFC_INVALID = 3, + MLX5_NIC_IFC_SW_RESET = 7, }; enum { @@ -49,9 +50,17 @@ enum { MLX5_DROP_NEW_RECOVERY_WORK, }; -static u8 get_nic_state(struct mlx5_core_dev *dev) +enum { + MLX5_SENSOR_NO_ERR = 0, + MLX5_SENSOR_PCI_COMM_ERR = 1, + MLX5_SENSOR_PCI_ERR = 2, + MLX5_SENSOR_NIC_DISABLED = 3, + MLX5_SENSOR_NIC_SW_RESET = 4, +}; + +static u8 get_nic_mode(struct mlx5_core_dev *dev) { - return (ioread32be(&dev->iseg->cmdq_addr_l_sz) >> 8) & 3; + return (ioread32be(&dev->iseg->cmdq_addr_l_sz) >> 8) & 7; } static void mlx5_trigger_cmd_completions(struct mlx5_core_dev *dev) @@ -77,20 +86,39 @@ no_trig: spin_unlock_irqrestore(&dev->cmd.alloc_lock, flags); } -static int in_fatal(struct mlx5_core_dev *dev) +static bool sensor_pci_no_comm(struct mlx5_core_dev *dev) { struct mlx5_core_health *health = &dev->priv.health; struct mlx5_health_buffer __iomem *h = health->health; + bool err = ioread32be(&h->fw_ver) == 0xffffffff; - if (get_nic_state(dev) == MLX5_NIC_IFC_DISABLED) - return 1; + return err; +} - if (ioread32be(&h->fw_ver) == 0xffffffff) - return 1; +static bool sensor_nic_disabled(struct mlx5_core_dev *dev) +{ + return get_nic_mode(dev) == MLX5_NIC_IFC_DISABLED; +} - return 0; +static bool sensor_nic_sw_reset(struct mlx5_core_dev *dev) +{ + return get_nic_mode(dev) == MLX5_NIC_IFC_SW_RESET; } +static u32 check_fatal_sensors(struct mlx5_core_dev *dev) +{ + if (sensor_pci_no_comm(dev)) + return MLX5_SENSOR_PCI_COMM_ERR; + if (pci_channel_offline(dev->pdev)) + return MLX5_SENSOR_PCI_ERR; + if (sensor_nic_disabled(dev)) + return MLX5_SENSOR_NIC_DISABLED; + if (sensor_nic_sw_reset(dev)) + return MLX5_SENSOR_NIC_SW_RESET; + + return MLX5_SENSOR_NO_ERR; +} + void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force) { mutex_lock(&dev->intf_state_mutex); @@ -101,7 +129,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, if (!force) mlx5_core_err(dev, "internal state error detected\n"); - if (pci_channel_offline(dev->pdev) || in_fatal(dev) || force) { + if (check_fatal_sensors(dev) || force) { dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; mlx5_trigger_cmd_completions(dev); } @@ -116,57 +144,80 @@ unlock: static void mlx5_handle_bad_state(struct mlx5_core_dev *dev) { - u8 nic_state = get_nic_state(dev); + u8 nic_mode = get_nic_mode(dev); - switch (nic_state) { - case MLX5_NIC_IFC_FULL: - mlx5_core_warn(dev, "Expected to see disabled NIC but it is full driver\n"); - break; - - case MLX5_NIC_IFC_DISABLED: - mlx5_core_warn(dev, "starting teardown\n"); - break; - - case MLX5_NIC_IFC_NO_DRAM_NIC: - mlx5_core_warn(dev, "Expected to see disabled NIC but it is no dram nic\n"); - break; - default: - mlx5_core_warn(dev, "Expected to see disabled NIC but it is has invalid value %d\n", - nic_state); + if (nic_mode == MLX5_NIC_IFC_SW_RESET) { + /* The IFC mode field is 3 bits, so it will read 0x7 in two cases: + * 1. PCI has been disabled (ie. PCI-AER, PF driver unloaded + * and this is a VF), this is not recoverable by SW reset. + * Logging of this is handled elsewhere. + * 2. FW reset has been issued by another function, driver can + * be reloaded to recover after the mode switches to + * MLX5_NIC_IFC_DISABLED. + */ + if (dev->priv.health.fatal_error != MLX5_SENSOR_PCI_COMM_ERR) + mlx5_core_warn(dev, "NIC SW reset is already progress\n"); + else + mlx5_core_warn(dev, "Communication with FW over the PCI link is down\n"); + } else { + mlx5_core_warn(dev, "NIC mode %d\n", nic_mode); } mlx5_disable_device(dev); } +#define MLX5_FW_RESET_WAIT_MS 1000 +#define MLX5_NIC_STATE_POLL_MS 5 static void health_recover(struct work_struct *work) { + unsigned long end = jiffies + msecs_to_jiffies(MLX5_FW_RESET_WAIT_MS); struct mlx5_core_health *health; struct delayed_work *dwork; struct mlx5_core_dev *dev; struct mlx5_priv *priv; - u8 nic_state; + u8 nic_mode; dwork = container_of(work, struct delayed_work, work); health = container_of(dwork, struct mlx5_core_health, recover_work); priv = container_of(health, struct mlx5_priv, health); dev = container_of(priv, struct mlx5_core_dev, priv); - nic_state = get_nic_state(dev); - if (nic_state == MLX5_NIC_IFC_INVALID) { - dev_err(&dev->pdev->dev, "health recovery flow aborted since the nic state is invalid\n"); + if (sensor_pci_no_comm(dev)) { + dev_err(&dev->pdev->dev, "health recovery flow aborted, PCI reads still not working\n"); return; } + nic_mode = get_nic_mode(dev); + while (nic_mode != MLX5_NIC_IFC_DISABLED && + !time_after(jiffies, end)) { + msleep(MLX5_NIC_STATE_POLL_MS); + nic_mode = get_nic_mode(dev); + } + + if (nic_mode != MLX5_NIC_IFC_DISABLED) { + dev_err(&dev->pdev->dev, "health recovery flow aborted, unexpected NIC IFC mode %d.\n", + nic_mode); + return; + } + dev_err(&dev->pdev->dev, "starting health recovery flow\n"); mlx5_recover_device(dev); } /* How much time to wait until health resetting the driver (in msecs) */ #define MLX5_RECOVERY_DELAY_MSECS 60000 +#define MLX5_RECOVERY_NO_DELAY 0 +static unsigned long get_recovery_delay(struct mlx5_core_dev *dev) +{ + return dev->priv.health.fatal_error == MLX5_SENSOR_PCI_ERR || + dev->priv.health.fatal_error == MLX5_SENSOR_PCI_COMM_ERR ? + MLX5_RECOVERY_DELAY_MSECS : MLX5_RECOVERY_NO_DELAY; +} + static void health_care(struct work_struct *work) { - unsigned long recover_delay = msecs_to_jiffies(MLX5_RECOVERY_DELAY_MSECS); struct mlx5_core_health *health; + unsigned long recover_delay; struct mlx5_core_dev *dev; struct mlx5_priv *priv; unsigned long flags; @@ -176,6 +227,7 @@ static void health_care(struct work_struct *work) dev = container_of(priv, struct mlx5_core_dev, priv); mlx5_core_warn(dev, "handling bad device here\n"); mlx5_handle_bad_state(dev); + recover_delay = msecs_to_jiffies(get_recovery_delay(dev)); spin_lock_irqsave(&health->wq_lock, flags); if (!test_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags)) @@ -272,6 +324,7 @@ static void poll_health(unsigned long data) { struct mlx5_core_dev *dev = (struct mlx5_core_dev *)data; struct mlx5_core_health *health = &dev->priv.health; + u32 fatal_error; u32 count; if (dev->state != MLX5_DEVICE_STATE_UP) @@ -292,8 +345,11 @@ static void poll_health(unsigned long data) print_health_info(dev); } - if (in_fatal(dev) && !health->sick) { - health->sick = true; + fatal_error = check_fatal_sensors(dev); + + if (fatal_error && !health->fatal_error) { + mlx5_core_err(dev, "Fatal error %u detected\n", fatal_error); + dev->priv.health.fatal_error = fatal_error; print_health_info(dev); mlx5_trigger_health_work(dev); } @@ -307,7 +363,7 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev) struct mlx5_core_health *health = &dev->priv.health; init_timer(&health->timer); - health->sick = 0; + health->fatal_error = MLX5_SENSOR_NO_ERR; clear_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); clear_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); health->health = &dev->iseg->health; From owner-svn-src-head@freebsd.org Fri Mar 23 18:24:03 2018 Return-Path: Delivered-To: svn-src-head@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 2BD9AF61A38; Fri, 23 Mar 2018 18:24:03 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 9BBB28473D; Fri, 23 Mar 2018 18:24:02 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 96950237FB; Fri, 23 Mar 2018 18:24:02 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NIO2KA060737; Fri, 23 Mar 2018 18:24:02 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIO2EF060735; Fri, 23 Mar 2018 18:24:02 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803231824.w2NIO2EF060735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Fri, 23 Mar 2018 18:24:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331450 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:24:03 -0000 Author: jeff Date: Fri Mar 23 18:24:02 2018 New Revision: 331450 URL: https://svnweb.freebsd.org/changeset/base/331450 Log: Fix two compliation problems on non-amd64 architectures. Modified: head/sys/vm/vm_page.c head/sys/vm/vm_reserv.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Mar 23 18:20:42 2018 (r331449) +++ head/sys/vm/vm_page.c Fri Mar 23 18:24:02 2018 (r331450) @@ -1783,7 +1783,9 @@ again: */ KASSERT(m != NULL, ("missing page")); +#if VM_NRESERVLEVEL > 0 found: +#endif vm_page_alloc_check(m); /* Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Fri Mar 23 18:20:42 2018 (r331449) +++ head/sys/vm/vm_reserv.c Fri Mar 23 18:24:02 2018 (r331450) @@ -419,7 +419,7 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) index)); KASSERT(rv->popcnt > 0, ("vm_reserv_depopulate: reserv %p's popcnt is corrupted", rv)); - KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, + KASSERT(rv->domain < vm_ndomains, ("vm_reserv_depopulate: reserv %p's domain is corrupted %d", rv, rv->domain)); if (rv->popcnt == VM_LEVEL_0_NPAGES) { @@ -531,7 +531,7 @@ vm_reserv_populate(vm_reserv_t rv, int index) ("vm_reserv_populate: reserv %p is already full", rv)); KASSERT(rv->pages->psind == 0, ("vm_reserv_populate: reserv %p is already promoted", rv)); - KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, + KASSERT(rv->domain < vm_ndomains, ("vm_reserv_populate: reserv %p's domain is corrupted %d", rv, rv->domain)); popmap_set(rv->popmap, index); @@ -1218,7 +1218,7 @@ vm_reserv_reclaim(vm_reserv_t rv) vm_reserv_domain_lock(rv->domain); KASSERT(rv->inpartpopq, ("vm_reserv_reclaim: reserv %p's inpartpopq is FALSE", rv)); - KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, + KASSERT(rv->domain < vm_ndomains, ("vm_reserv_reclaim: reserv %p's domain is corrupted %d", rv, rv->domain)); TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); From owner-svn-src-head@freebsd.org Fri Mar 23 18:24:10 2018 Return-Path: Delivered-To: svn-src-head@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 421E1F61A8A; Fri, 23 Mar 2018 18:24:10 +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 E56BA84823; Fri, 23 Mar 2018 18:24:09 +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 DE798237FC; Fri, 23 Mar 2018 18:24:09 +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 w2NIO9xH060788; Fri, 23 Mar 2018 18:24:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIO9uH060786; Fri, 23 Mar 2018 18:24:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231824.w2NIO9uH060786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:24:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331451 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 331451 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:24:10 -0000 Author: hselasky Date: Fri Mar 23 18:24:09 2018 New Revision: 331451 URL: https://svnweb.freebsd.org/changeset/base/331451 Log: Issue a software reset on firmware assert in mlx5core. If a FW assert is considered fatal, indicated by a new bit in the health buffer, reset the FW. After the reset, follow the normal recovery flow. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/device.h head/sys/dev/mlx5/mlx5_core/mlx5_health.c Modified: head/sys/dev/mlx5/device.h ============================================================================== --- head/sys/dev/mlx5/device.h Fri Mar 23 18:24:02 2018 (r331450) +++ head/sys/dev/mlx5/device.h Fri Mar 23 18:24:09 2018 (r331451) @@ -410,6 +410,10 @@ struct mlx5_cmd_layout { u8 status_own; }; +enum mlx5_fatal_assert_bit_offsets { + MLX5_RFR_OFFSET = 31, +}; + struct mlx5_health_buffer { __be32 assert_var[5]; __be32 rsvd0[3]; @@ -418,10 +422,18 @@ struct mlx5_health_buffer { __be32 rsvd1[2]; __be32 fw_ver; __be32 hw_id; - __be32 rsvd2; + __be32 rfr; u8 irisc_index; u8 synd; __be16 ext_synd; +}; + +enum mlx5_initializing_bit_offsets { + MLX5_FW_RESET_SUPPORTED_OFFSET = 30, +}; + +enum mlx5_cmd_addr_l_sz_offset { + MLX5_NIC_IFC_OFFSET = 8, }; struct mlx5_init_seg { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:24:02 2018 (r331450) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:24:09 2018 (r331451) @@ -56,6 +56,7 @@ enum { MLX5_SENSOR_PCI_ERR = 2, MLX5_SENSOR_NIC_DISABLED = 3, MLX5_SENSOR_NIC_SW_RESET = 4, + MLX5_SENSOR_FW_SYND_RFR = 5, }; static u8 get_nic_mode(struct mlx5_core_dev *dev) @@ -63,6 +64,18 @@ static u8 get_nic_mode(struct mlx5_core_dev *dev) return (ioread32be(&dev->iseg->cmdq_addr_l_sz) >> 8) & 7; } +static bool sensor_fw_synd_rfr(struct mlx5_core_dev *dev) +{ + struct mlx5_core_health *health = &dev->priv.health; + struct mlx5_health_buffer __iomem *h = health->health; + u32 rfr = ioread32be(&h->rfr) >> MLX5_RFR_OFFSET; + u8 synd = ioread8(&h->synd); + + if (rfr && synd) + mlx5_core_dbg(dev, "FW requests reset, synd: %d\n", synd); + return rfr && synd; +} + static void mlx5_trigger_cmd_completions(struct mlx5_core_dev *dev) { unsigned long flags; @@ -115,10 +128,44 @@ static u32 check_fatal_sensors(struct mlx5_core_dev *d return MLX5_SENSOR_NIC_DISABLED; if (sensor_nic_sw_reset(dev)) return MLX5_SENSOR_NIC_SW_RESET; + if (sensor_fw_synd_rfr(dev)) + return MLX5_SENSOR_FW_SYND_RFR; return MLX5_SENSOR_NO_ERR; } +static void reset_fw_if_needed(struct mlx5_core_dev *dev) +{ + bool supported = (ioread32be(&dev->iseg->initializing) >> + MLX5_FW_RESET_SUPPORTED_OFFSET) & 1; + u32 cmdq_addr, fatal_error; + + if (!supported) + return; + + /* The reset only needs to be issued by one PF. The health buffer is + * shared between all functions, and will be cleared during a reset. + * Check again to avoid a redundant 2nd reset. If the fatal erros was + * PCI related a reset won't help. + */ + fatal_error = check_fatal_sensors(dev); + if (fatal_error == MLX5_SENSOR_PCI_COMM_ERR || + fatal_error == MLX5_SENSOR_NIC_DISABLED || + fatal_error == MLX5_SENSOR_NIC_SW_RESET) { + mlx5_core_warn(dev, "Not issuing FW reset. Either it's already done or won't help."); + return; + } + + mlx5_core_warn(dev, "Issuing FW Reset\n"); + /* Write the NIC interface field to initiate the reset, the command + * interface address also resides here, don't overwrite it. + */ + cmdq_addr = ioread32be(&dev->iseg->cmdq_addr_l_sz); + iowrite32be((cmdq_addr & 0xFFFFF000) | + MLX5_NIC_IFC_SW_RESET << MLX5_NIC_IFC_OFFSET, + &dev->iseg->cmdq_addr_l_sz); +} + void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force) { mutex_lock(&dev->intf_state_mutex); @@ -130,6 +177,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, if (!force) mlx5_core_err(dev, "internal state error detected\n"); if (check_fatal_sensors(dev) || force) { + reset_fw_if_needed(dev); dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; mlx5_trigger_cmd_completions(dev); } @@ -230,11 +278,14 @@ static void health_care(struct work_struct *work) recover_delay = msecs_to_jiffies(get_recovery_delay(dev)); spin_lock_irqsave(&health->wq_lock, flags); - if (!test_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags)) + if (!test_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags)) { + mlx5_core_warn(dev, "Scheduling recovery work with %lums delay\n", + recover_delay); schedule_delayed_work(&health->recover_work, recover_delay); - else + } else { dev_err(&dev->pdev->dev, "new health works are not permitted at this stage\n"); + } spin_unlock_irqrestore(&health->wq_lock, flags); } From owner-svn-src-head@freebsd.org Fri Mar 23 18:32:04 2018 Return-Path: Delivered-To: svn-src-head@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 75C25F62627; Fri, 23 Mar 2018 18:32:04 +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 23CD684DF8; Fri, 23 Mar 2018 18:32:04 +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 1EC5823980; Fri, 23 Mar 2018 18:32:04 +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 w2NIW4Hc065877; Fri, 23 Mar 2018 18:32:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIW30D065870; Fri, 23 Mar 2018 18:32:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231832.w2NIW30D065870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:32:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331452 - in head/sys: conf dev/mlx5 dev/mlx5/mlx5_core modules/mlx5 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: conf dev/mlx5 dev/mlx5/mlx5_core modules/mlx5 X-SVN-Commit-Revision: 331452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:32:04 -0000 Author: hselasky Date: Fri Mar 23 18:32:03 2018 New Revision: 331452 URL: https://svnweb.freebsd.org/changeset/base/331452 Log: Add mutual exclusion mechanism for software reset of firmware in mlx5core. Since the FW can be shared between PCI functions it is common that more than one health poll will detected a failure, this can lead to multiple resets. The solution is to use a FW locking mechanism using semaphore space to provide a way to synchronize between functions. The FW semaphore is acquired via config cycle access. First the VSEC gateway must be acquired, then the semaphore can be locked by writing a value to it and confirmed it's locked by reading the same value back. The process in the same to free the semaphore, except the value written should be zero. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Added: head/sys/dev/mlx5/mlx5_core/mlx5_crspace.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_core/mlx5_health.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/modules/mlx5/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Mar 23 18:24:09 2018 (r331451) +++ head/sys/conf/files Fri Mar 23 18:32:03 2018 (r331452) @@ -4732,6 +4732,8 @@ dev/mlx5/mlx5_core/mlx5_cmd.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_cq.c optional mlx5 pci \ compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_crspace.c optional mlx5 pci \ + compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_diagnostics.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_eq.c optional mlx5 pci \ Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Mar 23 18:24:09 2018 (r331451) +++ head/sys/dev/mlx5/driver.h Fri Mar 23 18:32:03 2018 (r331452) @@ -651,6 +651,7 @@ struct mlx5_core_dev { struct mlx5_flow_root_namespace *sniffer_tx_root_ns; u32 num_q_counter_allocated[MLX5_INTERFACE_NUMBER]; struct mlx5_dump_data *dump_data; + u32 vsec_addr; }; enum { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 18:24:09 2018 (r331451) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 18:32:03 2018 (r331452) @@ -64,6 +64,16 @@ enum { MLX5_CMD_TIME, /* print command execution time */ }; +enum mlx5_semaphore_space_address { + MLX5_SEMAPHORE_SW_RESET = 0x20, +}; + +enum { + UNLOCK = 0, + LOCK = 1, + CAP_ID = 0x9, +}; + struct mlx5_core_dev; int mlx5_query_hca_caps(struct mlx5_core_dev *dev); @@ -95,4 +105,8 @@ struct mlx5_crspace_regmap { extern struct pci_driver mlx5_core_driver; +void mlx5_vsec_init(struct mlx5_core_dev *dev); +int mlx5_pciconf_cap9_sem(struct mlx5_core_dev *dev, int state); +int mlx5_pciconf_set_sem_addr_space(struct mlx5_core_dev *dev, + u32 sem_space_address, int state); #endif /* __MLX5_CORE_H__ */ Added: head/sys/dev/mlx5/mlx5_core/mlx5_crspace.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_core/mlx5_crspace.c Fri Mar 23 18:32:03 2018 (r331452) @@ -0,0 +1,248 @@ +/*- + * Copyright (c) 2013-2018, Mellanox Technologies, Ltd. 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 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include "mlx5_core.h" + +enum { + PCI_CTRL_OFFSET = 0x4, + PCI_COUNTER_OFFSET = 0x8, + PCI_SEMAPHORE_OFFSET = 0xc, + + PCI_ADDR_OFFSET = 0x10, + PCI_DATA_OFFSET = 0x14, + + PCI_FLAG_BIT_OFFS = 31, + PCI_SPACE_BIT_OFFS = 0, + PCI_SPACE_BIT_LEN = 16, + PCI_SIZE_VLD_BIT_OFFS = 28, + PCI_SIZE_VLD_BIT_LEN = 1, + PCI_STATUS_BIT_OFFS = 29, + PCI_STATUS_BIT_LEN = 3, +}; + +enum { + IFC_MAX_RETRIES = 2048 +}; + +#define MLX5_EXTRACT_C(source, offset, size) \ + ((((unsigned)(source)) >> (offset)) & MLX5_ONES32(size)) +#define MLX5_EXTRACT(src, start, len) \ + (((len) == 32) ? (src) : MLX5_EXTRACT_C(src, start, len)) +#define MLX5_ONES32(size) \ + ((size) ? (0xffffffff >> (32 - (size))) : 0) +#define MLX5_MASK32(offset, size) \ + (MLX5_ONES32(size) << (offset)) +#define MLX5_MERGE_C(rsrc1, rsrc2, start, len) \ + ((((rsrc2) << (start)) & (MLX5_MASK32((start), (len)))) | \ + ((rsrc1) & (~MLX5_MASK32((start), (len))))) +#define MLX5_MERGE(rsrc1, rsrc2, start, len) \ + (((len) == 32) ? (rsrc2) : MLX5_MERGE_C(rsrc1, rsrc2, start, len)) + +static int mlx5_pciconf_wait_on_flag(struct mlx5_core_dev *dev, + u8 expected_val) +{ + int retries = 0; + u32 flag; + + for(;;) { + pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_ADDR_OFFSET, &flag); + flag = MLX5_EXTRACT(flag, PCI_FLAG_BIT_OFFS, 1); + if (flag == expected_val) + return (0); + retries++; + if (retries > IFC_MAX_RETRIES) + return (-EBUSY); + if ((retries & 0xf) == 0) + usleep_range(1000, 2000); + } +} + +static int mlx5_pciconf_read(struct mlx5_core_dev *dev, + unsigned int offset, u32 *data) +{ + u32 address; + int ret; + + if (MLX5_EXTRACT(offset, 31, 1)) + return -EINVAL; + address = MLX5_MERGE(offset, 0, PCI_FLAG_BIT_OFFS, 1); + pci_write_config_dword(dev->pdev, dev->vsec_addr + + PCI_ADDR_OFFSET, address); + ret = mlx5_pciconf_wait_on_flag(dev, 1); + if (ret) + return (ret); + return pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_DATA_OFFSET, data); +} + +static int mlx5_pciconf_write(struct mlx5_core_dev *dev, + unsigned int offset, u32 data) +{ + u32 address; + + if (MLX5_EXTRACT(offset, 31, 1)) + return -EINVAL; + + /* Set flag to 0x1 */ + address = MLX5_MERGE(offset, 1, PCI_FLAG_BIT_OFFS, 1); + + pci_write_config_dword(dev->pdev, dev->vsec_addr + + PCI_DATA_OFFSET, data); + + pci_write_config_dword(dev->pdev, dev->vsec_addr + + PCI_ADDR_OFFSET, address); + + /* Wait for the flag to be cleared */ + return mlx5_pciconf_wait_on_flag(dev, 0); + +} + +int mlx5_pciconf_cap9_sem(struct mlx5_core_dev *dev, int state) +{ + u32 counter = 0; + int retries = 0; + u32 lock_val; + + if (state == UNLOCK) { + pci_write_config_dword(dev->pdev, dev->vsec_addr + + PCI_SEMAPHORE_OFFSET, 0); + return (0); + } + do { + if (retries > IFC_MAX_RETRIES * 10) + return -EBUSY; + pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_SEMAPHORE_OFFSET, &lock_val); + if (lock_val != 0) { + retries++; + if (retries > IFC_MAX_RETRIES * 10) + return -EBUSY; + usleep_range(1000, 2000); + continue; + } + pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_COUNTER_OFFSET, &counter); + pci_write_config_dword(dev->pdev, dev->vsec_addr + + PCI_SEMAPHORE_OFFSET, counter); + pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_SEMAPHORE_OFFSET, &lock_val); + retries++; + } while (counter != lock_val); + return 0; +} + +#define MLX5_PROTECTED_CR_SPACE_DOMAIN 0x6 +static int mlx5_pciconf_set_addr_space(struct mlx5_core_dev *dev, + u16 space) +{ + u32 val; + + pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_CTRL_OFFSET, &val); + + val = MLX5_MERGE(val, space, PCI_SPACE_BIT_OFFS, + PCI_SPACE_BIT_LEN); + pci_write_config_dword(dev->pdev, dev->vsec_addr + + PCI_CTRL_OFFSET, val); + + pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_CTRL_OFFSET, &val); + + if (MLX5_EXTRACT(val, PCI_STATUS_BIT_OFFS, + PCI_STATUS_BIT_LEN) == 0) + return -EINVAL; + + return 0; +} + +#define MLX5_CR_SPACE_DOMAIN 0x2 +static int mlx5_get_vendor_cap_addr(struct mlx5_core_dev *dev) +{ + int vend_cap; + int ret; + + vend_cap = pci_find_capability(dev->pdev, CAP_ID); + if (!vend_cap) + return 0; + dev->vsec_addr = vend_cap; + ret = mlx5_pciconf_cap9_sem(dev, LOCK); + if (ret) { + mlx5_core_warn(dev, + "pciconf_cap9_sem locking failure\n"); + return 0; + } + if (mlx5_pciconf_set_addr_space(dev, MLX5_CR_SPACE_DOMAIN)) + vend_cap = 0; + ret = mlx5_pciconf_cap9_sem(dev, UNLOCK); + if (ret) + mlx5_core_warn(dev, + "pciconf_cap9_sem unlocking failure\n"); + return vend_cap; +} + +#define MLX5_SEMAPHORE_SPACE_DOMAIN 0xA +int mlx5_pciconf_set_sem_addr_space(struct mlx5_core_dev *dev, + u32 sem_space_address, int state) +{ + u32 data, id = 0; + int ret; + + ret = mlx5_pciconf_set_addr_space(dev, + MLX5_SEMAPHORE_SPACE_DOMAIN); + if (ret) + return (ret); + + if (state == LOCK) + /* Get a unique ID based on the counter */ + pci_read_config_dword(dev->pdev, dev->vsec_addr + + PCI_COUNTER_OFFSET, &id); + + /* Try to modify lock */ + ret = mlx5_pciconf_write(dev, sem_space_address, id); + if (ret) + return (ret); + + /* Verify lock was modified */ + ret = mlx5_pciconf_read(dev, sem_space_address, &data); + if (ret) + return -EINVAL; + + if (data != id) + return -EBUSY; + + return 0; +} + +void mlx5_vsec_init(struct mlx5_core_dev *dev) +{ + dev->vsec_addr = mlx5_get_vendor_cap_addr(dev); +} + Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:24:09 2018 (r331451) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Mar 23 18:32:03 2018 (r331452) @@ -48,6 +48,8 @@ enum { enum { MLX5_DROP_NEW_HEALTH_WORK, MLX5_DROP_NEW_RECOVERY_WORK, + MLX5_SKIP_SW_RESET, + MLX5_SW_RESET_SEM_LOCKED, }; enum { @@ -59,6 +61,33 @@ enum { MLX5_SENSOR_FW_SYND_RFR = 5, }; +static int lock_sem_sw_reset(struct mlx5_core_dev *dev, int state) +{ + int ret, err; + + /* Lock GW access */ + ret = mlx5_pciconf_cap9_sem(dev, LOCK); + if (ret) { + mlx5_core_warn(dev, "Timed out locking gateway %d, %d\n", state, ret); + return ret; + } + + ret = mlx5_pciconf_set_sem_addr_space(dev, MLX5_SEMAPHORE_SW_RESET, state); + if (ret && state == LOCK) { + if (ret == -EBUSY) + mlx5_core_dbg(dev, "SW reset FW semaphore already locked, another function will handle the reset\n"); + else + mlx5_core_warn(dev, "SW reset semaphore lock return %d\n", ret); + } + + /* Unlock GW access */ + err = mlx5_pciconf_cap9_sem(dev, UNLOCK); + if (err) + mlx5_core_warn(dev, "Timed out unlocking gateway: state %d, err %d\n", state, err); + + return ret; +} + static u8 get_nic_mode(struct mlx5_core_dev *dev) { return (ioread32be(&dev->iseg->cmdq_addr_l_sz) >> 8) & 7; @@ -138,6 +167,7 @@ static void reset_fw_if_needed(struct mlx5_core_dev *d { bool supported = (ioread32be(&dev->iseg->initializing) >> MLX5_FW_RESET_SUPPORTED_OFFSET) & 1; + struct mlx5_core_health *health = &dev->priv.health; u32 cmdq_addr, fatal_error; if (!supported) @@ -151,7 +181,8 @@ static void reset_fw_if_needed(struct mlx5_core_dev *d fatal_error = check_fatal_sensors(dev); if (fatal_error == MLX5_SENSOR_PCI_COMM_ERR || fatal_error == MLX5_SENSOR_NIC_DISABLED || - fatal_error == MLX5_SENSOR_NIC_SW_RESET) { + fatal_error == MLX5_SENSOR_NIC_SW_RESET || + test_bit(MLX5_SKIP_SW_RESET, &health->flags)) { mlx5_core_warn(dev, "Not issuing FW reset. Either it's already done or won't help."); return; } @@ -223,6 +254,7 @@ static void health_recover(struct work_struct *work) struct delayed_work *dwork; struct mlx5_core_dev *dev; struct mlx5_priv *priv; + bool recover = true; u8 nic_mode; dwork = container_of(work, struct delayed_work, work); @@ -232,7 +264,8 @@ static void health_recover(struct work_struct *work) if (sensor_pci_no_comm(dev)) { dev_err(&dev->pdev->dev, "health recovery flow aborted, PCI reads still not working\n"); - return; + recover = false; + goto clear_sem; } nic_mode = get_nic_mode(dev); @@ -245,11 +278,21 @@ static void health_recover(struct work_struct *work) if (nic_mode != MLX5_NIC_IFC_DISABLED) { dev_err(&dev->pdev->dev, "health recovery flow aborted, unexpected NIC IFC mode %d.\n", nic_mode); - return; + recover = false; } - dev_err(&dev->pdev->dev, "starting health recovery flow\n"); - mlx5_recover_device(dev); +clear_sem: + if (test_and_clear_bit(MLX5_SW_RESET_SEM_LOCKED, &health->flags)) { + mlx5_core_dbg(dev, "Unlocking FW reset semaphore\n"); + lock_sem_sw_reset(dev, UNLOCK); + } + + test_and_clear_bit(MLX5_SKIP_SW_RESET, &health->flags); + + if (recover) { + dev_err(&dev->pdev->dev, "starting health recovery flow\n"); + mlx5_recover_device(dev); + } } /* How much time to wait until health resetting the driver (in msecs) */ @@ -269,10 +312,29 @@ static void health_care(struct work_struct *work) struct mlx5_core_dev *dev; struct mlx5_priv *priv; unsigned long flags; + int ret; health = container_of(work, struct mlx5_core_health, work); priv = container_of(health, struct mlx5_priv, health); dev = container_of(priv, struct mlx5_core_dev, priv); + + if (mlx5_core_is_pf(dev)) { + ret = lock_sem_sw_reset(dev, LOCK); + if (!ret) { + mlx5_core_warn(dev, "Locked FW reset semaphore\n"); + set_bit(MLX5_SW_RESET_SEM_LOCKED, &health->flags); + } + else if (ret == -EBUSY) { + /* sw reset will be skipped only in case we detect the + * semaphore was already taken. In case of an error + * while taking the semaphore we prefer to issue a + * reset since longer cr-dump time and multiple resets + * are better than a stuck fw. + */ + set_bit(MLX5_SKIP_SW_RESET, &health->flags); + } + } + mlx5_core_warn(dev, "handling bad device here\n"); mlx5_handle_bad_state(dev); recover_delay = msecs_to_jiffies(get_recovery_delay(dev)); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:24:09 2018 (r331451) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:32:03 2018 (r331452) @@ -873,6 +873,8 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, s struct pci_dev *pdev = dev->pdev; int err; + mlx5_vsec_init(dev); + err = mlx5_query_hca_caps(dev); if (err) { dev_err(&pdev->dev, "query hca failed\n"); Modified: head/sys/modules/mlx5/Makefile ============================================================================== --- head/sys/modules/mlx5/Makefile Fri Mar 23 18:24:09 2018 (r331451) +++ head/sys/modules/mlx5/Makefile Fri Mar 23 18:32:03 2018 (r331452) @@ -6,6 +6,7 @@ SRCS= \ mlx5_alloc.c \ mlx5_cmd.c \ mlx5_cq.c \ +mlx5_crspace.c \ mlx5_diagnostics.c \ mlx5_eq.c \ mlx5_fs_cmd.c \ From owner-svn-src-head@freebsd.org Fri Mar 23 18:34:36 2018 Return-Path: Delivered-To: svn-src-head@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 F3F14F62935; Fri, 23 Mar 2018 18:34: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 A254E8515F; Fri, 23 Mar 2018 18:34:35 +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 99287239A6; Fri, 23 Mar 2018 18:34:35 +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 w2NIYZKb066036; Fri, 23 Mar 2018 18:34:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIYZ5j066035; Fri, 23 Mar 2018 18:34:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231834.w2NIYZ5j066035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:34:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331453 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:34:36 -0000 Author: hselasky Date: Fri Mar 23 18:34:35 2018 New Revision: 331453 URL: https://svnweb.freebsd.org/changeset/base/331453 Log: Don't save PCI state when PCI error is detected in mlx5core. When a PCI error is detected the PCI state could be corrupt, don't save it in that flow. Save the state after initialization. After restoring the PCI state during slot reset save it again, restoring the state destroys the previously saved state info. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:32:03 2018 (r331452) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:34:35 2018 (r331453) @@ -1224,6 +1224,7 @@ static int init_one(struct pci_dev *pdev, goto clean_health; } + pci_save_state(pdev->dev.bsddev); return 0; clean_health: @@ -1264,7 +1265,6 @@ static pci_ers_result_t mlx5_pci_err_detected(struct p mlx5_enter_error_state(dev, false); mlx5_unload_one(dev, priv, false); if (state) { - pci_save_state(pdev->dev.bsddev); mlx5_drain_health_wq(dev); mlx5_pci_disable_device(dev); } @@ -1289,6 +1289,7 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci pci_set_master(pdev); pci_set_powerstate(pdev->dev.bsddev, PCI_POWERSTATE_D0); pci_restore_state(pdev->dev.bsddev); + pci_save_state(pdev->dev.bsddev); return err ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; } @@ -1343,7 +1344,6 @@ static void mlx5_pci_resume(struct pci_dev *pdev) dev_info(&pdev->dev, "%s was called\n", __func__); - pci_save_state(pdev->dev.bsddev); wait_vital(pdev); err = mlx5_load_one(dev, priv, false); From owner-svn-src-head@freebsd.org Fri Mar 23 18:34:39 2018 Return-Path: Delivered-To: svn-src-head@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 9A5DCF62965; Fri, 23 Mar 2018 18:34:39 +0000 (UTC) (envelope-from sbruno@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 118D285180; Fri, 23 Mar 2018 18:34:39 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEF0E239A7; Fri, 23 Mar 2018 18:34:38 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NIYcoc066085; Fri, 23 Mar 2018 18:34:38 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIYcm6066082; Fri, 23 Mar 2018 18:34:38 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201803231834.w2NIYcm6066082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Fri, 23 Mar 2018 18:34:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331454 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 331454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:34:39 -0000 Author: sbruno Date: Fri Mar 23 18:34:38 2018 New Revision: 331454 URL: https://svnweb.freebsd.org/changeset/base/331454 Log: Revert r331379 as the "simple" lock changes have revealed a deeper problem and need for a rethink. Submitted by: Jason Eggleston Sponsored by: Limelight Networks Modified: head/sys/netinet/ip_output.c head/sys/netinet/raw_ip.c head/sys/netinet6/ip6_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Fri Mar 23 18:34:35 2018 (r331453) +++ head/sys/netinet/ip_output.c Fri Mar 23 18:34:38 2018 (r331454) @@ -1314,14 +1314,12 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) break; case IP_PORTRANGE: - INP_RLOCK(inp); if (inp->inp_flags & INP_HIGHPORT) optval = IP_PORTRANGE_HIGH; else if (inp->inp_flags & INP_LOWPORT) optval = IP_PORTRANGE_LOW; else optval = 0; - INP_RUNLOCK(inp); break; case IP_ONESBCAST: @@ -1347,11 +1345,9 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) break; #ifdef RSS case IP_RSSBUCKETID: - INP_RLOCK(inp); retval = rss_hash2bucket(inp->inp_flowid, inp->inp_flowtype, &rss_bucket); - INP_RUNLOCK(inp); if (retval == 0) optval = rss_bucket; else Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Fri Mar 23 18:34:35 2018 (r331453) +++ head/sys/netinet/raw_ip.c Fri Mar 23 18:34:38 2018 (r331454) @@ -639,12 +639,10 @@ rip_ctloutput(struct socket *so, struct sockopt *sopt) sizeof optval); if (error) break; - INP_WLOCK(inp); if (optval) inp->inp_flags |= INP_HDRINCL; else inp->inp_flags &= ~INP_HDRINCL; - INP_WUNLOCK(inp); break; case IP_FW3: /* generic ipfw v.3 functions */ Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Fri Mar 23 18:34:35 2018 (r331453) +++ head/sys/netinet6/ip6_output.c Fri Mar 23 18:34:38 2018 (r331454) @@ -1498,10 +1498,8 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt) error = soopt_mcopyin(sopt, m); /* XXX */ if (error != 0) break; - INP_WLOCK(in6p); error = ip6_pcbopts(&in6p->in6p_outputopts, m, so, sopt); - INP_WUNLOCK(in6p); m_freem(m); /* XXX */ break; } @@ -1637,13 +1635,11 @@ do { \ error = EINVAL; break; } - INP_WLOCK(in6p); optp = &in6p->in6p_outputopts; error = ip6_pcbopt(IPV6_HOPLIMIT, (u_char *)&optval, sizeof(optval), optp, (td != NULL) ? td->td_ucred : NULL, uproto); - INP_WUNLOCK(in6p); break; } @@ -1694,10 +1690,8 @@ do { \ * available only prior to bind(2). * see ipng mailing list, Jun 22 2001. */ - INP_WLOCK(in6p); if (in6p->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) { - INP_WUNLOCK(in6p); error = EINVAL; break; } @@ -1706,7 +1700,6 @@ do { \ in6p->inp_vflag &= ~INP_IPV4; else in6p->inp_vflag |= INP_IPV4; - INP_WUNLOCK(in6p); break; case IPV6_RECVTCLASS: /* cannot mix with RFC2292 XXX */ @@ -1756,13 +1749,11 @@ do { \ break; { struct ip6_pktopts **optp; - INP_WLOCK(in6p); optp = &in6p->in6p_outputopts; error = ip6_pcbopt(optname, (u_char *)&optval, sizeof(optval), optp, (td != NULL) ? td->td_ucred : NULL, uproto); - INP_WUNLOCK(in6p); break; } @@ -1827,6 +1818,12 @@ do { \ int optlen; struct ip6_pktopts **optp; + /* cannot mix with RFC2292 */ + if (OPTBIT(IN6P_RFC2292)) { + error = EINVAL; + break; + } + /* * We only ensure valsize is not too large * here. Further validation will be done @@ -1836,21 +1833,12 @@ do { \ sizeof(optbuf_storage), 0); if (error) break; - - INP_WLOCK(in6p); - /* cannot mix with RFC2292 */ - if (OPTBIT(IN6P_RFC2292)) { - INP_WUNLOCK(in6p); - error = EINVAL; - break; - } optlen = sopt->sopt_valsize; optbuf = optbuf_storage; optp = &in6p->in6p_outputopts; error = ip6_pcbopt(optname, optbuf, optlen, optp, (td != NULL) ? td->td_ucred : NULL, uproto); - INP_WUNLOCK(in6p); break; } #undef OPTSET @@ -2035,12 +2023,10 @@ do { \ break; #ifdef RSS case IPV6_RSSBUCKETID: - INP_RLOCK(in6p); retval = rss_hash2bucket(in6p->inp_flowid, in6p->inp_flowtype, &rss_bucket); - INP_RUNLOCK(in6p); if (retval == 0) optval = rss_bucket; else @@ -2243,8 +2229,6 @@ ip6_pcbopts(struct ip6_pktopts **pktopt, struct mbuf * int error = 0; struct thread *td = sopt->sopt_td; - INP_WLOCK_ASSERT(sotoinpcb(so)); - /* turn off any old options. */ if (opt) { #ifdef DIAGNOSTIC @@ -3103,8 +3087,6 @@ int ip6_optlen(struct inpcb *in6p) { int len; - - INP_WLOCK_ASSERT(in6p); if (!in6p->in6p_outputopts) return 0; From owner-svn-src-head@freebsd.org Fri Mar 23 18:36:00 2018 Return-Path: Delivered-To: svn-src-head@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 0D231F62BFA; Fri, 23 Mar 2018 18:36:00 +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 AF589854B3; Fri, 23 Mar 2018 18:35: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 8FEB0239A9; Fri, 23 Mar 2018 18:35:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NIZxx2066190; Fri, 23 Mar 2018 18:35:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIZxI4066189; Fri, 23 Mar 2018 18:35:59 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231835.w2NIZxI4066189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:35:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331455 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:36:00 -0000 Author: hselasky Date: Fri Mar 23 18:35:59 2018 New Revision: 331455 URL: https://svnweb.freebsd.org/changeset/base/331455 Log: Fix incorrect page count when mlx5core is in internal error. Change page cleanup flow when in internal error to properly decrement the page counts when reclaiming pages. That prevents timing out waiting for extra pages that were actually cleaned up previously. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Fri Mar 23 18:34:38 2018 (r331454) +++ head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Fri Mar 23 18:35:59 2018 (r331455) @@ -380,6 +380,37 @@ out_free: return err; } +static int reclaim_pages_cmd(struct mlx5_core_dev *dev, + u32 *in, int in_size, u32 *out, int out_size) +{ + struct mlx5_fw_page *fwp; + struct rb_node *p; + u32 func_id; + u32 npages; + u32 i = 0; + + if (dev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) + return mlx5_cmd_exec(dev, in, in_size, out, out_size); + + /* No hard feelings, we want our pages back! */ + npages = MLX5_GET(manage_pages_in, in, input_num_entries); + func_id = MLX5_GET(manage_pages_in, in, function_id); + + p = rb_first(&dev->priv.page_root); + while (p && i < npages) { + fwp = rb_entry(p, struct mlx5_fw_page, rb_node); + p = rb_next(p); + if (fwp->func_id != func_id) + continue; + + MLX5_ARRAY_SET64(manage_pages_out, out, pas, i, fwp->dma_addr); + i++; + } + + MLX5_SET(manage_pages_out, out, output_num_entries, i); + return 0; +} + static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages, int *nclaimed) { @@ -404,7 +435,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u3 MLX5_SET(manage_pages_in, in, input_num_entries, npages); mlx5_core_dbg(dev, "npages %d, outlen %d\n", npages, outlen); - err = mlx5_cmd_exec(dev, in, sizeof(in), out, outlen); + err = reclaim_pages_cmd(dev, in, sizeof(in), out, outlen); if (err) { mlx5_core_err(dev, "failed reclaiming pages\n"); goto out_free; @@ -531,19 +562,13 @@ int mlx5_reclaim_startup_pages(struct mlx5_core_dev *d p = rb_first(&dev->priv.page_root); if (p) { fwp = rb_entry(p, struct mlx5_fw_page, rb_node); - if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { - --dev->priv.fw_pages; - free_4k(dev, fwp->dma_addr); - nclaimed = 1; - } else { - err = reclaim_pages(dev, fwp->func_id, - optimal_reclaimed_pages(), - &nclaimed); - if (err) { - mlx5_core_warn(dev, "failed reclaiming pages (%d)\n", - err); - return err; - } + err = reclaim_pages(dev, fwp->func_id, + optimal_reclaimed_pages(), + &nclaimed); + if (err) { + mlx5_core_warn(dev, "failed reclaiming pages (%d)\n", + err); + return err; } if (nclaimed) From owner-svn-src-head@freebsd.org Fri Mar 23 18:38:13 2018 Return-Path: Delivered-To: svn-src-head@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 5DE7AF62FAB; Fri, 23 Mar 2018 18:38:13 +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 0BDA385893; Fri, 23 Mar 2018 18:38:13 +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 06B69239AD; Fri, 23 Mar 2018 18:38:13 +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 w2NIcC4k066300; Fri, 23 Mar 2018 18:38:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIcCt9066299; Fri, 23 Mar 2018 18:38:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231838.w2NIcCt9066299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:38:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331456 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 331456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:38:13 -0000 Author: hselasky Date: Fri Mar 23 18:38:12 2018 New Revision: 331456 URL: https://svnweb.freebsd.org/changeset/base/331456 Log: Don't wait for completions when a mlx5en(4) device is in internal error state. If the device is in internal error state the hardware will not generate completions. Just move on to destroy the resources. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri Mar 23 18:35:59 2018 (r331455) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri Mar 23 18:38:12 2018 (r331456) @@ -907,8 +907,7 @@ mlx5e_destroy_rq(struct mlx5e_rq *rq) wq_sz = mlx5_wq_ll_get_size(&rq->wq); for (i = 0; i != wq_sz; i++) { if (rq->mbuf[i].mbuf != NULL) { - bus_dmamap_unload(rq->dma_tag, - rq->mbuf[i].dma_map); + bus_dmamap_unload(rq->dma_tag, rq->mbuf[i].dma_map); m_freem(rq->mbuf[i].mbuf); } bus_dmamap_destroy(rq->dma_tag, rq->mbuf[i].dma_map); @@ -1064,8 +1063,11 @@ mlx5e_close_rq(struct mlx5e_rq *rq) static void mlx5e_close_rq_wait(struct mlx5e_rq *rq) { + struct mlx5_core_dev *mdev = rq->channel->priv->mdev; + /* wait till RQ is empty */ - while (!mlx5_wq_ll_is_empty(&rq->wq)) { + while (!mlx5_wq_ll_is_empty(&rq->wq) && + (mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR)) { msleep(4); rq->cq.mcq.comp(&rq->cq.mcq); } @@ -1404,6 +1406,7 @@ void mlx5e_drain_sq(struct mlx5e_sq *sq) { int error; + struct mlx5_core_dev *mdev= sq->priv->mdev; /* * Check if already stopped. @@ -1436,7 +1439,8 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) /* wait till SQ is empty or link is down */ mtx_lock(&sq->lock); while (sq->cc != sq->pc && - (sq->priv->media_status_last & IFM_ACTIVE) != 0) { + (sq->priv->media_status_last & IFM_ACTIVE) != 0 && + mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) { mtx_unlock(&sq->lock); msleep(1); sq->cq.mcq.comp(&sq->cq.mcq); @@ -1453,7 +1457,8 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) /* wait till SQ is empty */ mtx_lock(&sq->lock); - while (sq->cc != sq->pc) { + while (sq->cc != sq->pc && + mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) { mtx_unlock(&sq->lock); msleep(1); sq->cq.mcq.comp(&sq->cq.mcq); From owner-svn-src-head@freebsd.org Fri Mar 23 19:31:53 2018 Return-Path: Delivered-To: svn-src-head@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 84AF9F679AB; Fri, 23 Mar 2018 19:31:53 +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 3AEBF88309; Fri, 23 Mar 2018 19:31:53 +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 35E0A2430A; Fri, 23 Mar 2018 19:31:53 +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 w2NJVqk5093626; Fri, 23 Mar 2018 19:31:52 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NJVqv5093624; Fri, 23 Mar 2018 19:31:52 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803231931.w2NJVqv5093624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Mar 2018 19:31:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331459 - in head/sys: mips/include sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: mips/include sys X-SVN-Commit-Revision: 331459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 19:31:53 -0000 Author: jhb Date: Fri Mar 23 19:31:52 2018 New Revision: 331459 URL: https://svnweb.freebsd.org/changeset/base/331459 Log: Move remaining EF_MIPS_* flags to . Reviewed by: brooks Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D14789 Modified: head/sys/mips/include/elf.h head/sys/sys/elf_common.h Modified: head/sys/mips/include/elf.h ============================================================================== --- head/sys/mips/include/elf.h Fri Mar 23 19:30:00 2018 (r331458) +++ head/sys/mips/include/elf.h Fri Mar 23 19:31:52 2018 (r331459) @@ -243,24 +243,4 @@ __ElfType(Auxinfo); #define R_MIPS_COPY 126 #define R_MIPS_JUMP_SLOT 127 -/* - * ELF Flags - */ - -#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code */ -#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code */ -#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code */ -#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code */ -#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code */ -#define EF_MIPS_ARCH_32 0x50000000 /* -mips32 code */ -#define EF_MIPS_ARCH_64 0x60000000 /* -mips64 code */ -#define EF_MIPS_ARCH_32R2 0x70000000 /* -mips32r2 code */ -#define EF_MIPS_ARCH_64R2 0x80000000 /* -mips64r2 code */ - -#define EF_MIPS_ABI 0x0000f000 -#define EF_MIPS_ABI_O32 0x00001000 -#define EF_MIPS_ABI_O64 0x00002000 -#define EF_MIPS_ABI_EABI32 0x00003000 -#define EF_MIPS_ABI_EABI64 0x00004000 - #endif /* __MIPS_ELF_H */ Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Fri Mar 23 19:30:00 2018 (r331458) +++ head/sys/sys/elf_common.h Fri Mar 23 19:31:52 2018 (r331459) @@ -344,10 +344,24 @@ typedef struct { #define EF_MIPS_UCODE 0x00000010 #define EF_MIPS_ABI2 0x00000020 /* N32 */ #define EF_MIPS_OPTIONS_FIRST 0x00000080 +#define EF_MIPS_ABI 0x0000F000 +#define EF_MIPS_ABI_O32 0x00001000 +#define EF_MIPS_ABI_O64 0x00002000 +#define EF_MIPS_ABI_EABI32 0x00003000 +#define EF_MIPS_ABI_EABI64 0x00004000 #define EF_MIPS_ARCH_ASE 0x0F000000 /* Architectural extensions */ #define EF_MIPS_ARCH_ASE_MDMX 0x08000000 /* MDMX multimedia extension */ #define EF_MIPS_ARCH_ASE_M16 0x04000000 /* MIPS-16 ISA extensions */ #define EF_MIPS_ARCH 0xF0000000 /* Architecture field */ +#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code */ +#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code */ +#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code */ +#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code */ +#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code */ +#define EF_MIPS_ARCH_32 0x50000000 /* -mips32 code */ +#define EF_MIPS_ARCH_64 0x60000000 /* -mips64 code */ +#define EF_MIPS_ARCH_32R2 0x70000000 /* -mips32r2 code */ +#define EF_MIPS_ARCH_64R2 0x80000000 /* -mips64r2 code */ #define EF_PPC_EMB 0x80000000 #define EF_PPC_RELOCATABLE 0x00010000 From owner-svn-src-head@freebsd.org Fri Mar 23 20:32:55 2018 Return-Path: Delivered-To: svn-src-head@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 8B086F6C629; Fri, 23 Mar 2018 20:32:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 409C68B2BC; Fri, 23 Mar 2018 20:32:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2119B24CEF; Fri, 23 Mar 2018 20:32:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NKWsaE027073; Fri, 23 Mar 2018 20:32:54 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NKWseV027069; Fri, 23 Mar 2018 20:32:54 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803232032.w2NKWseV027069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 20:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331462 - in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Commit-Revision: 331462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 20:32:55 -0000 Author: emaste Date: Fri Mar 23 20:32:54 2018 New Revision: 331462 URL: https://svnweb.freebsd.org/changeset/base/331462 Log: Remove redundant cast from Linuxulator SYSINITs Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 20:29:34 2018 (r331461) +++ head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 20:32:54 2018 (r331462) @@ -810,7 +810,7 @@ linux_vdso_install(void *param) (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, - (sysinit_cfunc_t)linux_vdso_install, NULL); + linux_vdso_install, NULL); static void linux_vdso_deinstall(void *param) @@ -819,7 +819,7 @@ linux_vdso_deinstall(void *param) __elfN(linux_shared_page_fini)(linux_shared_page_obj); } SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, - (sysinit_cfunc_t)linux_vdso_deinstall, NULL); + linux_vdso_deinstall, NULL); static char GNULINUX_ABI_VENDOR[] = "GNU"; static int GNULINUX_ABI_DESC = 0; Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 20:29:34 2018 (r331461) +++ head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 20:32:54 2018 (r331462) @@ -1008,7 +1008,7 @@ linux_vdso_install(void *param) (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, - (sysinit_cfunc_t)linux_vdso_install, NULL); + linux_vdso_install, NULL); static void linux_vdso_deinstall(void *param) @@ -1017,7 +1017,7 @@ linux_vdso_deinstall(void *param) __elfN(linux_shared_page_fini)(linux_shared_page_obj); } SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, - (sysinit_cfunc_t)linux_vdso_deinstall, NULL); + linux_vdso_deinstall, NULL); static char GNU_ABI_VENDOR[] = "GNU"; static int GNULINUX_ABI_DESC = 0; Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Fri Mar 23 20:29:34 2018 (r331461) +++ head/sys/i386/linux/linux_sysvec.c Fri Mar 23 20:32:54 2018 (r331462) @@ -983,7 +983,7 @@ linux_vdso_install(void *param) elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj; } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, - (sysinit_cfunc_t)linux_vdso_install, NULL); + linux_vdso_install, NULL); static void linux_vdso_deinstall(void *param) @@ -992,7 +992,7 @@ linux_vdso_deinstall(void *param) __elfN(linux_shared_page_fini)(linux_shared_page_obj); } SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, - (sysinit_cfunc_t)linux_vdso_deinstall, NULL); + linux_vdso_deinstall, NULL); static char GNU_ABI_VENDOR[] = "GNU"; static int GNULINUX_ABI_DESC = 0; From owner-svn-src-head@freebsd.org Fri Mar 23 20:56:20 2018 Return-Path: Delivered-To: svn-src-head@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 ED4E6F6E05B; Fri, 23 Mar 2018 20:56:19 +0000 (UTC) (envelope-from benno@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 9792D8C1ED; Fri, 23 Mar 2018 20:56:19 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 921D025043; Fri, 23 Mar 2018 20:56:19 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NKuJJ3037844; Fri, 23 Mar 2018 20:56:19 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NKuJr5037840; Fri, 23 Mar 2018 20:56:19 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201803232056.w2NKuJr5037840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Fri, 23 Mar 2018 20:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331463 - in head: release/amd64 usr.sbin/makefs/cd9660 X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: in head: release/amd64 usr.sbin/makefs/cd9660 X-SVN-Commit-Revision: 331463 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 20:56:20 -0000 Author: benno Date: Fri Mar 23 20:56:18 2018 New Revision: 331463 URL: https://svnweb.freebsd.org/changeset/base/331463 Log: Allow makefs to properly tag UEFI El Torito boot images. Use them in amd64 ISOs. UEFI booting requires an EFI System Partition (ESP). On most storage devices this will be in a specific partition type. To allow booting from CD/ISO filesystems, UEFI will look for an ESP in the form of a FAT filesystem image embedded in the image. Historically FreeBSD has added one of these to its amd64 ISO images but marked it as simply another i386 boot image. Luckily for us most UEFI implementations are rather forgiving and work this out for us. This change adds the ability to mark a boot image as being a UEFI image. It also modifies our ISO generation to use this marking for the UEFI image we embed. Reported by: Thomas Schmitt Reviewed by: emaste, imp MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D14809 Modified: head/release/amd64/mkisoimages.sh head/usr.sbin/makefs/cd9660/cd9660_eltorito.c head/usr.sbin/makefs/cd9660/cd9660_eltorito.h Modified: head/release/amd64/mkisoimages.sh ============================================================================== --- head/release/amd64/mkisoimages.sh Fri Mar 23 20:32:54 2018 (r331462) +++ head/release/amd64/mkisoimages.sh Fri Mar 23 20:56:18 2018 (r331463) @@ -38,7 +38,7 @@ if [ "$1" = "-b" ]; then umount efi rmdir efi mdconfig -d -u $device - bootable="-o bootimage=i386;efiboot.img -o no-emul-boot $bootable" + bootable="-o bootimage=efi;efiboot.img -o no-emul-boot $bootable" shift else Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c ============================================================================== --- head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Fri Mar 23 20:32:54 2018 (r331462) +++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Fri Mar 23 20:56:18 2018 (r331463) @@ -104,9 +104,12 @@ cd9660_add_boot_disk(iso9660_disk *diskStructure, cons else if (strcmp(sysname, "macppc") == 0 || strcmp(sysname, "mac68k") == 0) new_image->system = ET_SYS_MAC; + else if (strcmp(sysname, "efi") == 0 || + strcmp(sysname, "uefi") == 0) + new_image->system = ET_SYS_UEFI; else { warnx("boot disk system must be " - "i386, powerpc, macppc, or mac68k"); + "efi, i386, powerpc, macppc, mac68k"); free(temp); free(new_image); return 0; @@ -338,12 +341,12 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int fir int used_sectors; int num_entries = 0; int catalog_sectors; - struct boot_catalog_entry *x86_head, *mac_head, *ppc_head, + struct boot_catalog_entry *x86_head, *mac_head, *ppc_head, *uefi_head, *valid_entry, *default_entry, *temp, *head, **headp, *next; struct cd9660_boot_image *tmp_disk; headp = NULL; - x86_head = mac_head = ppc_head = NULL; + x86_head = mac_head = ppc_head = uefi_head = NULL; /* If there are no boot disks, don't bother building boot information */ if (TAILQ_EMPTY(&diskStructure->boot_images)) @@ -421,6 +424,9 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int fir break; case ET_SYS_MAC: headp = &mac_head; + break; + case ET_SYS_UEFI: + headp = &uefi_head; break; default: warnx("%s: internal error: unknown system type", Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.h ============================================================================== --- head/usr.sbin/makefs/cd9660/cd9660_eltorito.h Fri Mar 23 20:32:54 2018 (r331462) +++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.h Fri Mar 23 20:56:18 2018 (r331463) @@ -44,6 +44,7 @@ #define ET_SYS_X86 0 #define ET_SYS_PPC 1 #define ET_SYS_MAC 2 +#define ET_SYS_UEFI 0xef #define ET_BOOT_ENTRY_SIZE 0x20 From owner-svn-src-head@freebsd.org Fri Mar 23 21:02:47 2018 Return-Path: Delivered-To: svn-src-head@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 DD229F6E838; Fri, 23 Mar 2018 21:02:46 +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 9088B8C868; Fri, 23 Mar 2018 21:02:46 +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 8B8DB251E2; Fri, 23 Mar 2018 21:02:46 +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 w2NL2kKg042503; Fri, 23 Mar 2018 21:02:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NL2kNN042501; Fri, 23 Mar 2018 21:02:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803232102.w2NL2kNN042501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Mar 2018 21:02:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331464 - in head/stand: defaults efi/loader X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: defaults efi/loader X-SVN-Commit-Revision: 331464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 21:02:47 -0000 Author: kevans Date: Fri Mar 23 21:02:46 2018 New Revision: 331464 URL: https://svnweb.freebsd.org/changeset/base/331464 Log: efi loader: Respect efi_max_resolution in loader.conf(5) Default the max resolution to 1080p, we'll accept Width x Height specifications along with the following presets: - 480p - 720p - 1080p - 2160p or 4k - 5k PR: 224825 Differential Revision: https://reviews.freebsd.org/D14801 Modified: head/stand/defaults/loader.conf head/stand/efi/loader/framebuffer.c Modified: head/stand/defaults/loader.conf ============================================================================== --- head/stand/defaults/loader.conf Fri Mar 23 20:56:18 2018 (r331463) +++ head/stand/defaults/loader.conf Fri Mar 23 21:02:46 2018 (r331464) @@ -75,6 +75,9 @@ acpi_video_load="NO" # Load the ACPI video extension #geom_eli_passphrase_prompt="NO" # Prompt for geli(8) passphrase to mount root bootenv_autolist="YES" # Auto populate the list of ZFS Boot Environments #beastie_disable="NO" # Turn the beastie boot menu on and off +efi_max_resolution="1080p" # Set the max resolution for EFI loader to use: + # 480p, 720p, 1080p, 2160p/4k, 5k, or specify + # WidthxHeight (e.g. 1920x1080) #kernels="kernel kernel.old" # Kernels to display in the boot menu #loader_logo="orbbw" # Desired logo: orbbw, orb, fbsdbw, beastiebw, beastie, none #comconsole_speed="9600" # Set the current serial console speed Modified: head/stand/efi/loader/framebuffer.c ============================================================================== --- head/stand/efi/loader/framebuffer.c Fri Mar 23 20:56:18 2018 (r331463) +++ head/stand/efi/loader/framebuffer.c Fri Mar 23 21:02:46 2018 (r331464) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -45,6 +46,40 @@ static EFI_GUID gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCO static EFI_GUID pciio_guid = EFI_PCI_IO_PROTOCOL_GUID; static EFI_GUID uga_guid = EFI_UGA_DRAW_PROTOCOL_GUID; +static struct named_resolution { + const char *name; + const char *alias; + unsigned int width; + unsigned int height; +} resolutions[] = { + { + .name = "480p", + .width = 640, + .height = 480, + }, + { + .name = "720p", + .width = 1280, + .height = 720, + }, + { + .name = "1080p", + .width = 1920, + .height = 1080, + }, + { + .name = "2160p", + .alias = "4k", + .width = 3840, + .height = 2160, + }, + { + .name = "5k", + .width = 5120, + .height = 2880, + } +}; + static u_int efifb_color_depth(struct efi_fb *efifb) { @@ -462,6 +497,57 @@ print_efifb(int mode, struct efi_fb *efifb, int verbos } } +static bool +efi_resolution_compare(struct named_resolution *res, const char *cmp) +{ + + if (strcasecmp(res->name, cmp) == 0) + return (true); + if (res->alias != NULL && strcasecmp(res->alias, cmp) == 0) + return (true); + return (false); +} + + +static void +efi_get_max_resolution(int *width, int *height) +{ + struct named_resolution *res; + char *maxres; + char *height_start, *width_start; + int idx; + + *width = *height = 0; + maxres = getenv("efi_max_resolution"); + /* No max_resolution set? Bail out; choose highest resolution */ + if (maxres == NULL) + return; + /* See if it matches one of our known resolutions */ + for (idx = 0; idx < nitems(resolutions); ++idx) { + res = &resolutions[idx]; + if (efi_resolution_compare(res, maxres)) { + *width = res->width; + *height = res->height; + return; + } + } + /* Not a known resolution, try to parse it; make a copy we can modify */ + maxres = strdup(maxres); + if (maxres == NULL) + return; + height_start = strchr(maxres, 'x'); + if (height_start == NULL) { + free(maxres); + return; + } + width_start = maxres; + *height_start++ = 0; + /* Errors from this will effectively mean "no max" */ + *width = (int)strtol(width_start, NULL, 0); + *height = (int)strtol(height_start, NULL, 0); + free(maxres); +} + static int gop_autoresize(EFI_GRAPHICS_OUTPUT *gop) { @@ -470,16 +556,22 @@ gop_autoresize(EFI_GRAPHICS_OUTPUT *gop) EFI_STATUS status; UINTN infosz; UINT32 best_mode, currdim, maxdim, mode; + int height, max_height, max_width, width; best_mode = maxdim = 0; + efi_get_max_resolution(&max_width, &max_height); for (mode = 0; mode < gop->Mode->MaxMode; mode++) { status = gop->QueryMode(gop, mode, &infosz, &info); if (EFI_ERROR(status)) continue; efifb_from_gop(&efifb, gop->Mode, info); - currdim = info->HorizontalResolution * info->VerticalResolution; - /* XXX TODO: Allow tunable or something for max resolution */ + width = info->HorizontalResolution; + height = info->VerticalResolution; + currdim = width * height; if (currdim > maxdim) { + if ((max_width != 0 && width > max_width) || + (max_height != 0 && height > max_height)) + continue; maxdim = currdim; best_mode = mode; } From owner-svn-src-head@freebsd.org Fri Mar 23 22:36:25 2018 Return-Path: Delivered-To: svn-src-head@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 A4644F5133A; Fri, 23 Mar 2018 22:36:25 +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 5A2A6685F3; Fri, 23 Mar 2018 22:36:25 +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 50DEA260CC; Fri, 23 Mar 2018 22:36:25 +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 w2NMaPuJ088066; Fri, 23 Mar 2018 22:36:25 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NMaP8f088065; Fri, 23 Mar 2018 22:36:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803232236.w2NMaP8f088065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Mar 2018 22:36:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331466 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 331466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 22:36:25 -0000 Author: jhb Date: Fri Mar 23 22:36:24 2018 New Revision: 331466 URL: https://svnweb.freebsd.org/changeset/base/331466 Log: Add a workaround to the hypervisor detection for older versions of KVM. Originally KVM set %eax to 0 in the cpuid leaf 0x4000000 rather than to the highest supported leaf in the hypervisor "branch". Detect this case and fixup the %eax value so that the hypervisor is still detected. Reported by: jpaetzel Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14810 Modified: head/sys/x86/x86/identcpu.c Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Fri Mar 23 21:06:06 2018 (r331465) +++ head/sys/x86/x86/identcpu.c Fri Mar 23 22:36:24 2018 (r331466) @@ -1304,6 +1304,18 @@ identify_hypervisor(void) if (cpu_feature2 & CPUID2_HV) { vm_guest = VM_GUEST_VM; do_cpuid(0x40000000, regs); + + /* + * KVM from Linux kernels prior to commit + * 57c22e5f35aa4b9b2fe11f73f3e62bbf9ef36190 set %eax + * to 0 rather than a valid hv_high value. Check for + * the KVM signature bytes and fixup %eax to the + * highest supported leaf in that case. + */ + if (regs[0] == 0 && regs[1] == 0x4b4d564b && + regs[2] == 0x564b4d56 && regs[3] == 0x0000004d) + regs[0] = 0x40000001; + if (regs[0] >= 0x40000000) { hv_high = regs[0]; ((u_int *)&hv_vendor)[0] = regs[1]; From owner-svn-src-head@freebsd.org Fri Mar 23 22:52:27 2018 Return-Path: Delivered-To: svn-src-head@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 94296F52950; Fri, 23 Mar 2018 22:52:27 +0000 (UTC) (envelope-from benno@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 32B3169227; Fri, 23 Mar 2018 22:52:27 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 2DBF626406; Fri, 23 Mar 2018 22:52:27 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NMqRxb097699; Fri, 23 Mar 2018 22:52:27 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NMqRPk097698; Fri, 23 Mar 2018 22:52:27 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201803232252.w2NMqRPk097698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Fri, 23 Mar 2018 22:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331467 - head/usr.sbin/makefs/cd9660 X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/usr.sbin/makefs/cd9660 X-SVN-Commit-Revision: 331467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 22:52:27 -0000 Author: benno Date: Fri Mar 23 22:52:26 2018 New Revision: 331467 URL: https://svnweb.freebsd.org/changeset/base/331467 Log: Correctly mark the last El Torito section header. Reported by: Thomas Schmitt Reviewed by: emaste, imp MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D14812 Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c ============================================================================== --- head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Fri Mar 23 22:36:24 2018 (r331466) +++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Fri Mar 23 22:52:26 2018 (r331467) @@ -294,7 +294,10 @@ cd9660_boot_setup_section_head(char platform) return NULL; sh = &entry->entry_data.SH; - /* More by default. The last one will manually be set to 0x91 */ + /* + * More by default. + * The last one will manually be set to ET_SECTION_HEADER_LAST + */ sh->header_indicator[0] = ET_SECTION_HEADER_MORE; sh->platform_id[0] = platform; sh->num_section_entries[0] = 0; @@ -463,6 +466,13 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int fir LIST_INSERT_AFTER(head, temp, ll_struct); tmp_disk = TAILQ_NEXT(tmp_disk, image_list); } + + /* Find the last Section Header entry and mark it as the last. */ + LIST_FOREACH(next, &diskStructure->boot_entries, ll_struct) { + if (next->entry_type == ET_ENTRY_SH) + head = next; + } + head->entry_data.SH.header_indicator[0] = ET_SECTION_HEADER_LAST; /* TODO: Remaining boot disks when implemented */ From owner-svn-src-head@freebsd.org Fri Mar 23 22:59:45 2018 Return-Path: Delivered-To: svn-src-head@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 BE59EF5346D; Fri, 23 Mar 2018 22:59:45 +0000 (UTC) (envelope-from benno@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 6C25D6988B; Fri, 23 Mar 2018 22:59:45 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6661E26413; Fri, 23 Mar 2018 22:59:45 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NMxjHc098020; Fri, 23 Mar 2018 22:59:45 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NMxjrr098019; Fri, 23 Mar 2018 22:59:45 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201803232259.w2NMxjrr098019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Fri, 23 Mar 2018 22:59:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331468 - head/usr.sbin/makefs/cd9660 X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/usr.sbin/makefs/cd9660 X-SVN-Commit-Revision: 331468 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 22:59:45 -0000 Author: benno Date: Fri Mar 23 22:59:45 2018 New Revision: 331468 URL: https://svnweb.freebsd.org/changeset/base/331468 Log: Don't try to modify El Torito section headers if there aren't any. MFC after: 1 week Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c ============================================================================== --- head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Fri Mar 23 22:52:26 2018 (r331467) +++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Fri Mar 23 22:59:45 2018 (r331468) @@ -468,11 +468,14 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int fir } /* Find the last Section Header entry and mark it as the last. */ + head = NULL; LIST_FOREACH(next, &diskStructure->boot_entries, ll_struct) { if (next->entry_type == ET_ENTRY_SH) head = next; } - head->entry_data.SH.header_indicator[0] = ET_SECTION_HEADER_LAST; + if (head != NULL) + head->entry_data.SH.header_indicator[0] = + ET_SECTION_HEADER_LAST; /* TODO: Remaining boot disks when implemented */ From owner-svn-src-head@freebsd.org Fri Mar 23 23:02:51 2018 Return-Path: Delivered-To: svn-src-head@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 82134F53A25; Fri, 23 Mar 2018 23:02: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 33E4F69D2E; Fri, 23 Mar 2018 23:02:51 +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 2E6C0265AB; Fri, 23 Mar 2018 23:02:51 +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 w2NN2p4W002905; Fri, 23 Mar 2018 23:02:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NN2pHf002904; Fri, 23 Mar 2018 23:02:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803232302.w2NN2pHf002904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Mar 2018 23:02:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331469 - head/stand/defaults X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/defaults X-SVN-Commit-Revision: 331469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 23:02:51 -0000 Author: kevans Date: Fri Mar 23 23:02:50 2018 New Revision: 331469 URL: https://svnweb.freebsd.org/changeset/base/331469 Log: loader.conf(5): Document efi_max_resolution Modified: head/stand/defaults/loader.conf.5 Modified: head/stand/defaults/loader.conf.5 ============================================================================== --- head/stand/defaults/loader.conf.5 Fri Mar 23 22:59:45 2018 (r331468) +++ head/stand/defaults/loader.conf.5 Fri Mar 23 23:02:50 2018 (r331469) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd March 19, 2018 +.Dd March 23, 2018 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -220,6 +220,13 @@ selects the video console which prevents any input and replacing it with .Dq spinning character (useful for embedded products and such). +.It Va efi_max_resolution +Specify the maximum desired resolution for the EFI console. +The following pre-defined values are accepted: 480p, 720p, 1080p, 2160p or 4k, +5k. +The standard +.Va WidthxHeight +format is also accepted, e.g., 1920x1080. .It Va kernel .Pq Dq kernel .It Va kernels From owner-svn-src-head@freebsd.org Fri Mar 23 23:47:00 2018 Return-Path: Delivered-To: svn-src-head@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 135D2F5705D; Fri, 23 Mar 2018 23:47:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 AB28E6B94C; Fri, 23 Mar 2018 23:46:59 +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 A2CB026C39; Fri, 23 Mar 2018 23:46:59 +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 w2NNkx1e023095; Fri, 23 Mar 2018 23:46:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NNkx8E023094; Fri, 23 Mar 2018 23:46:59 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803232346.w2NNkx8E023094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Mar 2018 23:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331470 - head/stand/defaults X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/defaults X-SVN-Commit-Revision: 331470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 23:47:00 -0000 Author: kevans Date: Fri Mar 23 23:46:59 2018 New Revision: 331470 URL: https://svnweb.freebsd.org/changeset/base/331470 Log: loader.conf(5): Convert list of values to much better looking table format Discussed with: jhb, rpokala Modified: head/stand/defaults/loader.conf.5 Modified: head/stand/defaults/loader.conf.5 ============================================================================== --- head/stand/defaults/loader.conf.5 Fri Mar 23 23:02:50 2018 (r331469) +++ head/stand/defaults/loader.conf.5 Fri Mar 23 23:46:59 2018 (r331470) @@ -222,11 +222,17 @@ replacing it with character (useful for embedded products and such). .It Va efi_max_resolution Specify the maximum desired resolution for the EFI console. -The following pre-defined values are accepted: 480p, 720p, 1080p, 2160p or 4k, -5k. -The standard -.Va WidthxHeight -format is also accepted, e.g., 1920x1080. +The following values are accepted: +.Bl -column "WidthxHeight" +.It Sy Value Ta Sy Resolution +.It 480p Ta 640x480 +.It 720p Ta 1280x720 +.It 1080p Ta 1920x1080 +.It 2160p Ta 3840x2160 +.It 4k Ta 3840x2160 +.It 5k Ta 5120x2880 +.It Va Width Ns x Ns Va Height Ta Va Width Ns x Ns Va Height +.El .It Va kernel .Pq Dq kernel .It Va kernels From owner-svn-src-head@freebsd.org Sat Mar 24 01:07:58 2018 Return-Path: Delivered-To: svn-src-head@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 B7F2DF5D8E8; Sat, 24 Mar 2018 01:07:58 +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 69A626F293; Sat, 24 Mar 2018 01:07:58 +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 64A1A2794F; Sat, 24 Mar 2018 01:07:58 +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 w2O17wWO063874; Sat, 24 Mar 2018 01:07:58 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O17wqZ063873; Sat, 24 Mar 2018 01:07:58 GMT (envelope-from np@FreeBSD.org) Message-Id: <201803240107.w2O17wqZ063873@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sat, 24 Mar 2018 01:07:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331472 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 331472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 01:07:58 -0000 Author: np Date: Sat Mar 24 01:07:58 2018 New Revision: 331472 URL: https://svnweb.freebsd.org/changeset/base/331472 Log: cxgbe(4): Always initialize requested_speed to a valid value. This fixes an avoidable EINVAL when the user tries to disable AN after the port is initialized but l1cfg doesn't have a valid speed to use. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Sat Mar 24 00:26:42 2018 (r331471) +++ head/sys/dev/cxgbe/t4_main.c Sat Mar 24 01:07:58 2018 (r331472) @@ -3981,12 +3981,11 @@ init_l1cfg(struct port_info *pi) ASSERT_SYNCHRONIZED_OP(sc); + lc->requested_speed = port_top_speed(pi); /* in Gbps */ if (t4_autoneg != 0 && lc->supported & FW_PORT_CAP_ANEG) { lc->requested_aneg = AUTONEG_ENABLE; - lc->requested_speed = 0; } else { lc->requested_aneg = AUTONEG_DISABLE; - lc->requested_speed = port_top_speed(pi); /* in Gbps */ } lc->requested_fc = t4_pause_settings & (PAUSE_TX | PAUSE_RX); From owner-svn-src-head@freebsd.org Sat Mar 24 01:53:44 2018 Return-Path: Delivered-To: svn-src-head@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 352D7F606E2; Sat, 24 Mar 2018 01:53:44 +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 D52E270EAC; Sat, 24 Mar 2018 01:53:43 +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 CE6D025F; Sat, 24 Mar 2018 01:53:43 +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 w2O1rhnQ088235; Sat, 24 Mar 2018 01:53:43 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O1rhck088233; Sat, 24 Mar 2018 01:53:43 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803240153.w2O1rhck088233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Mar 2018 01:53:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331474 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 331474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 01:53:44 -0000 Author: kevans Date: Sat Mar 24 01:53:43 2018 New Revision: 331474 URL: https://svnweb.freebsd.org/changeset/base/331474 Log: efi loader: Choose a console mode instead if hw.vga.textmode is set Not all systems use efifb; pull hw.vga.textmode and choose a good console mode instead if it's set to something non-zero. This is basically a revival of the code that used to live in boot1, but instead rebased onto this different way of doing mode selection in loader.efi. Interestingly enough, the regression that was previously introduced where GOP would not reflect the console setting does not seem to exist when console mode selection is done here. I've not done any investigation as to why this is the case. Nevertheless, boot1.efi is still not the best place to do mode selection. Modified: head/stand/efi/loader/framebuffer.c Modified: head/stand/efi/loader/framebuffer.c ============================================================================== --- head/stand/efi/loader/framebuffer.c Sat Mar 24 01:15:38 2018 (r331473) +++ head/stand/efi/loader/framebuffer.c Sat Mar 24 01:53:43 2018 (r331474) @@ -588,6 +588,29 @@ gop_autoresize(EFI_GRAPHICS_OUTPUT *gop) } static int +text_autoresize() +{ + SIMPLE_TEXT_OUTPUT_INTERFACE *conout; + EFI_STATUS status; + UINTN i, max_dim, best_mode, cols, rows; + + conout = ST->ConOut; + max_dim = best_mode = 0; + for (i = 0; i < conout->Mode->MaxMode; i++) { + status = conout->QueryMode(conout, i, &cols, &rows); + if (EFI_ERROR(status)) + continue; + if (cols * rows > max_dim) { + max_dim = cols * rows; + best_mode = i; + } + } + if (max_dim > 0) + conout->SetMode(conout, best_mode); + return (CMD_OK); +} + +static int uga_autoresize(EFI_UGA_DRAW_PROTOCOL *gop) { @@ -601,8 +624,14 @@ command_autoresize(int argc, char *argv[]) { EFI_GRAPHICS_OUTPUT *gop; EFI_UGA_DRAW_PROTOCOL *uga; + char *textmode; EFI_STATUS status; u_int mode; + + textmode = getenv("hw.vga.textmode"); + /* If it's set and non-zero, we'll select a console mode instead */ + if (textmode != NULL && strcmp(textmode, "0") != 0) + return (text_autoresize()); gop = NULL; uga = NULL; From owner-svn-src-head@freebsd.org Sat Mar 24 02:01:26 2018 Return-Path: Delivered-To: svn-src-head@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 F41BAF60B10; Sat, 24 Mar 2018 02:01:25 +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 A2E9A71297; Sat, 24 Mar 2018 02:01:25 +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 9DE933B8; Sat, 24 Mar 2018 02:01:25 +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 w2O21PAL090794; Sat, 24 Mar 2018 02:01:25 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O21P1d090791; Sat, 24 Mar 2018 02:01:25 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803240201.w2O21P1d090791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Mar 2018 02:01:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331475 - in head/stand: efi/libefi i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: efi/libefi i386/libi386 X-SVN-Commit-Revision: 331475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 02:01:26 -0000 Author: kevans Date: Sat Mar 24 02:01:25 2018 New Revision: 331475 URL: https://svnweb.freebsd.org/changeset/base/331475 Log: loader consoles: Implement SGR 24, 25 Mostly for completeness sake- implement 24 (no underline) and 25 (no blink) MFC after: 3 days Modified: head/stand/efi/libefi/efi_console.c head/stand/i386/libi386/vidconsole.c Modified: head/stand/efi/libefi/efi_console.c ============================================================================== --- head/stand/efi/libefi/efi_console.c Sat Mar 24 01:53:43 2018 (r331474) +++ head/stand/efi/libefi/efi_console.c Sat Mar 24 02:01:25 2018 (r331475) @@ -386,6 +386,10 @@ efi_term_emu(int c) case 22: /* normal intensity */ fg_c &= ~0x8; break; + case 24: /* not underline */ + case 25: /* not blinking */ + bg_c &= ~0x8; + break; case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: fg_c = ansi_col[args[i] - 30]; Modified: head/stand/i386/libi386/vidconsole.c ============================================================================== --- head/stand/i386/libi386/vidconsole.c Sat Mar 24 01:53:43 2018 (r331474) +++ head/stand/i386/libi386/vidconsole.c Sat Mar 24 02:01:25 2018 (r331475) @@ -452,6 +452,10 @@ vidc_term_emu(int c) case 22: /* normal intensity */ fg_c &= ~0x8; break; + case 24: /* not underline */ + case 25: /* not blinking */ + bg_c &= ~0x8; + break; case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: fg_c = ansi_col[args[i] - 30]; From owner-svn-src-head@freebsd.org Sat Mar 24 04:03:56 2018 Return-Path: Delivered-To: svn-src-head@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 8EC25F682EE; Sat, 24 Mar 2018 04:03:56 +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 3C84F76431; Sat, 24 Mar 2018 04:03:56 +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 35C8219D2; Sat, 24 Mar 2018 04:03:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O43uCC053692; Sat, 24 Mar 2018 04:03:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O43uNT053691; Sat, 24 Mar 2018 04:03:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803240403.w2O43uNT053691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Mar 2018 04:03:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331477 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 04:03:56 -0000 Author: kevans Date: Sat Mar 24 04:03:55 2018 New Revision: 331477 URL: https://svnweb.freebsd.org/changeset/base/331477 Log: lualoader: Privatize some more config.lua bits These functions are also not quite suitable for a public API, so privatize them to config. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Mar 24 04:00:01 2018 (r331476) +++ head/stand/lua/config.lua Sat Mar 24 04:03:55 2018 (r331477) @@ -92,6 +92,16 @@ local function setEnv(key, value) return loader.setenv(key, value) end +-- name here is one of 'name', 'type', flags', 'before', 'after', or 'error.' +-- These are set from lines in loader.conf(5): ${key}_${name}="${value}" where +-- ${key} is a module name. +local function setKey(key, name, value) + if modules[key] == nil then + modules[key] = {} + end + modules[key][name] = value +end + local pattern_table = { { str = "^%s*(#.*)", @@ -111,42 +121,42 @@ local pattern_table = { { str = "^%s*([%w_]+)_name%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "name", v) + setKey(k, "name", v) end, }, -- module_type="value" { str = "^%s*([%w_]+)_type%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "type", v) + setKey(k, "type", v) end, }, -- module_flags="value" { str = "^%s*([%w_]+)_flags%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "flags", v) + setKey(k, "flags", v) end, }, -- module_before="value" { str = "^%s*([%w_]+)_before%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "before", v) + setKey(k, "before", v) end, }, -- module_after="value" { str = "^%s*([%w_]+)_after%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "after", v) + setKey(k, "after", v) end, }, -- module_error="value" { str = "^%s*([%w_]+)_error%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "error", v) + setKey(k, "error", v) end, }, -- exec="command" @@ -178,6 +188,73 @@ local pattern_table = { }, } +local function isValidComment(line) + if line ~= nil then + local s = line:match("^%s*#.*") + if s == nil then + s = line:match("^%s*$") + end + if s == nil then + return false + end + end + return true +end + +local function loadModule(mod, silent) + local status = true + local pstatus + for k, v in pairs(mod) do + if v.load == "YES" then + local str = "load " + if v.flags ~= nil then + str = str .. v.flags .. " " + end + if v.type ~= nil then + str = str .. "-t " .. v.type .. " " + end + if v.name ~= nil then + str = str .. v.name + else + str = str .. k + end + if v.before ~= nil then + pstatus = cli_execute_unparsed(v.before) == 0 + if not pstatus and not silent then + print(MSG_FAILEXBEF:format(v.before, k)) + end + status = status and pstatus + end + + if cli_execute_unparsed(str) ~= 0 then + if not silent then + print(MSG_FAILEXMOD:format(str)) + end + if v.error ~= nil then + cli_execute_unparsed(v.error) + end + status = false + end + + if 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 + status = status and pstatus + end + +-- else +-- if not silent then +-- print("Skipping module '". . k .. "'") +-- end + end + end + + return status +end + + local function readFile(name, silent) local f = io.open(name) if f == nil then @@ -252,82 +329,6 @@ function config.setCarouselIndex(id, idx) carousel_choices[id] = idx end --- name here is one of 'name', 'type', flags', 'before', 'after', or 'error.' --- These are set from lines in loader.conf(5): ${key}_${name}="${value}" where --- ${key} is a module name. -function config.setKey(key, name, value) - if modules[key] == nil then - modules[key] = {} - end - modules[key][name] = value -end - -function config.isValidComment(line) - if line ~= nil then - local s = line:match("^%s*#.*") - if s == nil then - s = line:match("^%s*$") - end - if s == nil then - return false - end - end - return true -end - -function config.loadmod(mod, silent) - local status = true - local pstatus - for k, v in pairs(mod) do - if v.load == "YES" then - local str = "load " - if v.flags ~= nil then - str = str .. v.flags .. " " - end - if v.type ~= nil then - str = str .. "-t " .. v.type .. " " - end - if v.name ~= nil then - str = str .. v.name - else - str = str .. k - end - if v.before ~= nil then - pstatus = cli_execute_unparsed(v.before) == 0 - if not pstatus and not silent then - print(MSG_FAILEXBEF:format(v.before, k)) - end - status = status and pstatus - end - - if cli_execute_unparsed(str) ~= 0 then - if not silent then - print(MSG_FAILEXMOD:format(str)) - end - if v.error ~= nil then - cli_execute_unparsed(v.error) - end - status = false - end - - if 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 - status = status and pstatus - end - --- else --- if not silent then --- print("Skipping module '". . k .. "'") --- end - end - end - - return status -end - -- Returns true if we processed the file successfully, false if we did not. -- If 'silent' is true, being unable to read the file is not considered a -- failure. @@ -358,7 +359,7 @@ function config.parse(text) if k ~= nil then found = true - if config.isValidComment(c) then + if isValidComment(c) then val.process(k, v) else print(MSG_MALFORMED:format(n, @@ -520,7 +521,7 @@ function config.loadelf() end print(MSG_MODLOADING) - if not config.loadmod(modules, not config.verbose) then + if not loadModule(modules, not config.verbose) then print(MSG_MODLOADFAIL) end end From owner-svn-src-head@freebsd.org Sat Mar 24 04:00:02 2018 Return-Path: Delivered-To: svn-src-head@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 6A8B8F67CBF; Sat, 24 Mar 2018 04:00:02 +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 1907475E63; Sat, 24 Mar 2018 04:00:02 +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 EE6441836; Sat, 24 Mar 2018 04:00:01 +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 w2O40115049007; Sat, 24 Mar 2018 04:00:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O4011C049006; Sat, 24 Mar 2018 04:00:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803240400.w2O4011C049006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Mar 2018 04:00:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331476 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 331476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 04:00:02 -0000 Author: kevans Date: Sat Mar 24 04:00:01 2018 New Revision: 331476 URL: https://svnweb.freebsd.org/changeset/base/331476 Log: lualoader: Make config env-related bits private API This pertains exclusively to the set/restore functionality that we offer, where any changes made by loader.conf previously will be effectively removed upon reload of the configuration. We don't currently have a need to export these, so don't bother. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Mar 24 02:01:25 2018 (r331475) +++ head/stand/lua/config.lua Sat Mar 24 04:00:01 2018 (r331476) @@ -34,6 +34,10 @@ local hook = require("hook") local config = {} local modules = {} local carousel_choices = {} +-- Which variables we changed +local env_changed = {} +-- Values to restore env to (nil to unset) +local env_restore = {} local MSG_FAILEXEC = "Failed to exec '%s'" local MSG_FAILSETENV = "Failed to '%s' with value: %s" @@ -50,6 +54,44 @@ local MSG_KERNLOADING = "Loading kernel..." local MSG_MODLOADING = "Loading configured modules..." local MSG_MODLOADFAIL = "Could not load one or more modules!" +local function restoreEnv() + -- Examine changed environment variables + for k, v in pairs(env_changed) do + local restore_value = env_restore[k] + if restore_value == nil then + -- This one doesn't need restored for some reason + goto continue + end + local current_value = loader.getenv(k) + if current_value ~= v then + -- This was overwritten by some action taken on the menu + -- most likely; we'll leave it be. + goto continue + end + restore_value = restore_value.value + if restore_value ~= nil then + loader.setenv(k, restore_value) + else + loader.unsetenv(k) + end + ::continue:: + end + + env_changed = {} + env_restore = {} +end + +local function setEnv(key, value) + -- Track the original value for this if we haven't already + if env_restore[key] == nil then + env_restore[key] = {value = loader.getenv(key)} + end + + env_changed[key] = value + + return loader.setenv(key, value) +end + local pattern_table = { { str = "^%s*(#.*)", @@ -120,7 +162,7 @@ local pattern_table = { { str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - if config.setenv(k, v) ~= 0 then + if setEnv(k, v) ~= 0 then print(MSG_FAILSETENV:format(k, v)) end end, @@ -129,7 +171,7 @@ local pattern_table = { { str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)", process = function(k, v) - if config.setenv(k, v) ~= 0 then + if setEnv(k, v) ~= 0 then print(MSG_FAILSETENV:format(k, tostring(v))) end end, @@ -195,10 +237,6 @@ local function checkNextboot() end -- Module exports --- Which variables we changed -config.env_changed = {} --- Values to restore env to (nil to unset) -config.env_restore = {} config.verbose = false -- The first item in every carousel is always the default item. @@ -214,44 +252,6 @@ function config.setCarouselIndex(id, idx) carousel_choices[id] = idx end -function config.restoreEnv() - -- Examine changed environment variables - for k, v in pairs(config.env_changed) do - local restore_value = config.env_restore[k] - if restore_value == nil then - -- This one doesn't need restored for some reason - goto continue - end - local current_value = loader.getenv(k) - if current_value ~= v then - -- This was overwritten by some action taken on the menu - -- most likely; we'll leave it be. - goto continue - end - restore_value = restore_value.value - if restore_value ~= nil then - loader.setenv(k, restore_value) - else - loader.unsetenv(k) - end - ::continue:: - end - - config.env_changed = {} - config.env_restore = {} -end - -function config.setenv(key, value) - -- Track the original value for this if we haven't already - if config.env_restore[key] == nil then - config.env_restore[key] = {value = loader.getenv(key)} - end - - config.env_changed[key] = value - - return loader.setenv(key, value) -end - -- name here is one of 'name', 'type', flags', 'before', 'after', or 'error.' -- These are set from lines in loader.conf(5): ${key}_${name}="${value}" where -- ${key} is a module name. @@ -503,7 +503,7 @@ end -- Reload configuration function config.reload(file) modules = {} - config.restoreEnv() + restoreEnv() config.load(file) hook.runAll("config.reloaded") end From owner-svn-src-head@freebsd.org Sat Mar 24 04:21:23 2018 Return-Path: Delivered-To: svn-src-head@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 38557F69642; Sat, 24 Mar 2018 04:21:23 +0000 (UTC) (envelope-from jmg@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 DD32B771FF; Sat, 24 Mar 2018 04:21:22 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 D80341C71; Sat, 24 Mar 2018 04:21:22 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O4LM6H062229; Sat, 24 Mar 2018 04:21:22 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O4LMgS062228; Sat, 24 Mar 2018 04:21:22 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201803240421.w2O4LMgS062228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Sat, 24 Mar 2018 04:21:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331478 - head/usr.sbin/ctld X-SVN-Group: head X-SVN-Commit-Author: jmg X-SVN-Commit-Paths: head/usr.sbin/ctld X-SVN-Commit-Revision: 331478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 04:21:23 -0000 Author: jmg Date: Sat Mar 24 04:21:22 2018 New Revision: 331478 URL: https://svnweb.freebsd.org/changeset/base/331478 Log: minor work smithing... Modified: head/usr.sbin/ctld/ctld.8 Modified: head/usr.sbin/ctld/ctld.8 ============================================================================== --- head/usr.sbin/ctld/ctld.8 Sat Mar 24 04:03:55 2018 (r331477) +++ head/usr.sbin/ctld/ctld.8 Sat Mar 24 04:21:22 2018 (r331478) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 28, 2017 +.Dd March 23, 2018 .Dt CTLD 8 .Os .Sh NAME @@ -47,8 +47,11 @@ passing connections to the kernel part of the native i .Pp Upon startup, the .Nm -daemon parses the configuration file and exits, if it encounters any errors. -Then it compares the configuration with the kernel list of LUNs managed +daemon parses the configuration file. +If it encounters any errors, +.Nm +exits. +It then compares the configuration with the kernel list of LUNs managed by previously running .Nm instances, removes LUNs no longer existing in the configuration file, From owner-svn-src-head@freebsd.org Sat Mar 24 04:52:31 2018 Return-Path: Delivered-To: svn-src-head@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 26CE7F6C03E; Sat, 24 Mar 2018 04:52: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 CBAA4788D4; Sat, 24 Mar 2018 04:52: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 C636D22D8; Sat, 24 Mar 2018 04:52: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 w2O4qUMH078724; Sat, 24 Mar 2018 04:52:30 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O4qUrH078716; Sat, 24 Mar 2018 04:52:30 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201803240452.w2O4qUrH078716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Sat, 24 Mar 2018 04:52:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331481 - head/contrib/tzdata X-SVN-Group: head X-SVN-Commit-Author: philip X-SVN-Commit-Paths: head/contrib/tzdata X-SVN-Commit-Revision: 331481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 04:52:31 -0000 Author: philip Date: Sat Mar 24 04:52:29 2018 New Revision: 331481 URL: https://svnweb.freebsd.org/changeset/base/331481 Log: Import tzdata 2018d Changes: https://github.com/eggert/tz/blob/2018d/NEWS MFC after: 3 days Added: head/contrib/tzdata/ziguard.awk - copied unchanged from r331479, vendor/tzdata/dist/ziguard.awk Modified: head/contrib/tzdata/CONTRIBUTING head/contrib/tzdata/Makefile head/contrib/tzdata/NEWS head/contrib/tzdata/africa head/contrib/tzdata/antarctica head/contrib/tzdata/asia head/contrib/tzdata/australasia head/contrib/tzdata/backzone head/contrib/tzdata/checktab.awk head/contrib/tzdata/europe head/contrib/tzdata/northamerica head/contrib/tzdata/southamerica head/contrib/tzdata/theory.html head/contrib/tzdata/version head/contrib/tzdata/zishrink.awk head/contrib/tzdata/zone.tab head/contrib/tzdata/zone1970.tab Directory Properties: head/contrib/tzdata/ (props changed) Modified: head/contrib/tzdata/CONTRIBUTING ============================================================================== --- head/contrib/tzdata/CONTRIBUTING Sat Mar 24 04:42:56 2018 (r331480) +++ head/contrib/tzdata/CONTRIBUTING Sat Mar 24 04:52:29 2018 (r331481) @@ -25,7 +25,8 @@ justification. Citations should use https: URLs if av Please submit changes against either the latest release in or the master branch of the development -repository. If you use Git the following workflow may be helpful: +repository. The latter is preferred. If you use Git the following +workflow may be helpful: * Copy the development repository. @@ -42,6 +43,12 @@ repository. If you use Git the following workflow may git checkout -b mybranch + * Sleuth by using 'git blame'. For example, when fixing data for + Africa/Sao_Tome, if the command 'git blame africa' outputs a line + '2951fa3b (Paul Eggert 2018-01-08 09:03:13 -0800 1068) Zone + Africa/Sao_Tome 0:26:56 - LMT 1884', commit 2951fa3b should + provide some justification for the 'Zone Africa/Sao_Tome' line. + * Edit source files. Include commentary that justifies the changes by citing reliable sources. @@ -66,6 +73,9 @@ repository. If you use Git the following workflow may for others to review. git send-email master + + For an archived example of such an email, see + . * Start anew by getting current with the master branch again (the second step above). Modified: head/contrib/tzdata/Makefile ============================================================================== --- head/contrib/tzdata/Makefile Sat Mar 24 04:42:56 2018 (r331480) +++ head/contrib/tzdata/Makefile Sat Mar 24 04:52:29 2018 (r331481) @@ -10,6 +10,15 @@ VERSION= unknown # Email address for bug reports. BUGEMAIL= tz@iana.org +# Choose source data features. To get new features right away, use: +# DATAFORM= vanguard +# To wait a while before using new features, to give downstream users +# time to upgrade zic (the default), use: +# DATAFORM= main +# To wait even longer for new features, use: +# DATAFORM= rearguard +DATAFORM= main + # Change the line below for your time zone (after finding the zone you want in # the time zone files, or adding it to a time zone file). # Alternately, if you discover you've got the wrong time zone, you can just @@ -25,10 +34,10 @@ LOCALTIME= GMT # for handling POSIX-style time zone environment variables, # change the line below (after finding the zone you want in the # time zone files, or adding it to a time zone file). -# (When a POSIX-style environment variable is handled, the rules in the +# When a POSIX-style environment variable is handled, the rules in the # template file are used to determine "spring forward" and "fall back" days and # times; the environment variable itself specifies UT offsets of standard and -# summer time.) +# daylight saving time. # Alternately, if you discover you've got the wrong time zone, you can just # zic -p rightzone # to correct things. @@ -189,13 +198,18 @@ LDLIBS= # -DHAVE_STDINT_H if you have a non-C99 compiler with # -DHAVE_STRFTIME_L if declares locale_t and strftime_l # -DHAVE_STRDUP=0 if your system lacks the strdup function +# -DHAVE_STRTOLL=0 if your system lacks the strtoll function # -DHAVE_SYMLINK=0 if your system lacks the symlink function # -DHAVE_SYS_STAT_H=0 if your compiler lacks a # -DHAVE_SYS_WAIT_H=0 if your compiler lacks a # -DHAVE_TZSET=0 if your system lacks a tzset function # -DHAVE_UNISTD_H=0 if your compiler lacks a # -Dlocale_t=XXX if your system uses XXX instead of locale_t +# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers +# with external linkage, e.g., applications cannot define 'localtime'. # -Dssize_t=long on hosts like MS-Windows that lack ssize_t +# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has +# security implications and is not recommended for general use # -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; # not needed by the main-program tz code, which is single-threaded. # Append other compiler flags as needed, e.g., -pthread on GNU/Linux. @@ -394,13 +408,19 @@ SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' +# Non-ASCII non-letters that OK_CHAR allows, as these characters are +# useful in commentary. XEmacs 21.5.34 displays them correctly, +# presumably because they are Latin-1. +UNUSUAL_OK_CHARSET= °±½¾× + # OK_CHAR matches any character allowed in the distributed files. -# This is the same as SAFE_CHAR, except that multibyte letters are -# also allowed so that commentary can contain people's names and quote -# non-English sources. For non-letters the sources are limited to -# ASCII renderings for the convenience of maintainers whose text editors -# mishandle UTF-8 by default (e.g., XEmacs 21.4.22). -OK_CHAR= '[][:alpha:]'$(SAFE_CHARSET)'-]' +# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and +# multibyte letters are also allowed so that commentary can contain a +# few safe symbols and people's names and can quote non-English sources. +# Other non-letters are limited to ASCII renderings for the +# convenience of maintainers using XEmacs 21.5.34, which by default +# mishandles Unicode characters U+0100 and greater. +OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' # SAFE_LINE matches a line of safe characters. # SAFE_SHARP_LINE is similar, except any OK character can follow '#'; @@ -462,10 +482,12 @@ TDATA= $(YDATA) $(NDATA) $(BACKWARD) ZONETABLES= zone1970.tab zone.tab TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) LEAP_DEPS= leapseconds.awk leap-seconds.list -TZDATA_ZI_DEPS= zishrink.awk version $(TDATA) $(PACKRATDATA) +TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) $(PACKRATDATA) +DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ leapseconds yearistype.sh $(ZONETABLES) -AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk zishrink.awk +AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \ + ziguard.awk zishrink.awk MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl TZS_YEAR= 2050 TZS= to$(TZS_YEAR).tzs @@ -499,7 +521,8 @@ VERSION_DEPS= \ SHELL= /bin/sh -all: tzselect yearistype zic zdump libtz.a $(TABDATA) +all: tzselect yearistype zic zdump libtz.a $(TABDATA) \ + vanguard.zi main.zi rearguard.zi ALL: all date $(ENCHILADA) @@ -534,11 +557,15 @@ version: $(VERSION_DEPS) printf '%s\n' "$$V" >$@.out mv $@.out $@ -# This file can be tailored by setting BACKWARD, PACKRATDATA, etc. -tzdata.zi: $(TZDATA_ZI_DEPS) +# These files can be tailored by setting BACKWARD, PACKRATDATA, etc. +vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) + $(AWK) -v outfile='$@' -f ziguard.awk $(TDATA) $(PACKRATDATA) \ + >$@.out + mv $@.out $@ +tzdata.zi: $(DATAFORM).zi version version=`sed 1q version` && \ LC_ALL=C $(AWK) -v version="$$version" -f zishrink.awk \ - $(TDATA) $(PACKRATDATA) >$@.out + $(DATAFORM).zi >$@.out mv $@.out $@ version.h: version @@ -614,19 +641,29 @@ posix_packrat: zones: $(REDO) +# dummy.zd is not a real file; it is mentioned here only so that the +# top-level 'make' does not have a syntax error. +ZDS = dummy.zd +# Rule used only by submakes invoked by the $(TZS_NEW) rule. +# It is separate so that GNU 'make -j' can run instances in parallel. +$(ZDS): zdump + ./zdump -i -c $(TZS_YEAR) '$(wd)/'$$(expr $@ : '\(.*\).zd') >$@ + $(TZS_NEW): tzdata.zi zdump zic - mkdir -p tzs.dir + rm -fr tzs.dir + mkdir tzs.dir $(zic) -d tzs.dir tzdata.zi $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ tzdata.zi | LC_ALL=C sort >$@.out wd=`pwd` && \ - zones=`$(AWK) -v wd="$$wd" \ - '/^Z/{print wd "/tzs.dir/" $$2}' tzdata.zi \ - | LC_ALL=C sort` && \ - ./zdump -i -c $(TZS_YEAR) $$zones >>$@.out - sed 's,^TZ=".*tzs\.dir/,TZ=",' $@.out >$@.sed.out - rm -fr tzs.dir $@.out - mv $@.sed.out $@ + set x `$(AWK) '/^Z/{print "tzs.dir/" $$2 ".zd"}' tzdata.zi \ + | LC_ALL=C sort -t . -k 2,2` && \ + shift && \ + ZDS=$$* && \ + $(MAKE) wd="$$wd" TZS_YEAR=$(TZS_YEAR) ZDS="$$ZDS" $$ZDS && \ + sed 's,^TZ=".*tzs\.dir/,TZ=",' $$ZDS >>$@.out + rm -fr tzs.dir + mv $@.out $@ # If $(TZS) does not already exist (e.g., old-format tarballs), create it. # If it exists but 'make check_tzs' fails, a maintainer should inspect the @@ -669,8 +706,10 @@ check_character_set: $(ENCHILADA) sharp='#' && \ ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ $(MISC) $(SOURCES) $(WEB_PAGES) \ - CONTRIBUTING LICENSE Makefile README \ + CONTRIBUTING LICENSE README \ version tzdata.zi && \ + ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_CHARSET='$(OK_CHAR)'*$$' \ + Makefile && \ ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ leapseconds yearistype.sh zone.tab && \ ! grep -Env $(OK_LINE) $(ENCHILADA); \ @@ -702,7 +741,7 @@ check_sorted: backward backzone iso3166.tab zone.tab z $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \ LC_ALL=C sort -cu -check_links: checklinks.awk $(TDATA_TO_CHECK) +check_links: checklinks.awk $(TDATA_TO_CHECK) tzdata.zi $(AWK) -f checklinks.awk $(TDATA_TO_CHECK) $(AWK) -f checklinks.awk tzdata.zi @@ -720,17 +759,26 @@ check_tzs: $(TZS) $(TZS_NEW) check_web: tz-how-to.html $(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) tz-how-to.html -# Check that tzdata.zi generates the same binary data that its sources do. -check_zishrink: tzdata.zi zic leapseconds $(PACKRATDATA) $(TDATA) +# Check that zishrink.awk does not alter the data, and that ziguard.awk +# preserves main-format data. +check_zishrink: zic leapseconds $(PACKRATDATA) $(TDATA) \ + $(DATAFORM).zi tzdata.zi for type in posix right; do \ - mkdir -p time_t.dir/$$type time_t.dir/$$type-shrunk && \ + mkdir -p time_t.dir/$$type time_t.dir/$$type-t \ + time_t.dir/$$type-shrunk && \ case $$type in \ right) leap='-L leapseconds';; \ *) leap=;; \ esac && \ - $(ZIC) $$leap -d time_t.dir/$$type $(TDATA) && \ - $(AWK) '/^Rule/' $(TDATA) | \ - $(ZIC) $$leap -d time_t.dir/$$type - $(PACKRATDATA) && \ + $(ZIC) $$leap -d time_t.dir/$$type $(DATAFORM).zi && \ + case $(DATAFORM) in \ + main) \ + $(ZIC) $$leap -d time_t.dir/$$type-t $(TDATA) && \ + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) $$leap -d time_t.dir/$$type-t - \ + $(PACKRATDATA) && \ + diff -r time_t.dir/$$type time_t.dir/$$type-t;; \ + esac && \ $(ZIC) $$leap -d time_t.dir/$$type-shrunk tzdata.zi && \ diff -r time_t.dir/$$type time_t.dir/$$type-shrunk || exit; \ done @@ -740,7 +788,7 @@ clean_misc: rm -f core *.o *.out \ date tzselect version.h zdump zic yearistype libtz.a clean: clean_misc - rm -fr *.dir tzdata.zi tzdb-*/ $(TZS_NEW) + rm -fr *.dir *.zi tzdb-*/ $(TZS_NEW) maintainer-clean: clean @echo 'This command is intended for maintainers to use; it' @@ -856,6 +904,9 @@ tarballs traditional_tarballs signatures traditional_s VERSION=`cat version` && \ $(MAKE) VERSION="$$VERSION" $@_version +# These *_version rules are intended for use if VERSION is set by some +# other means. Ordinarily these rules are used only by the above +# non-_version rules, which set VERSION on the 'make' command line. tarballs_version: traditional_tarballs_version tzdb-$(VERSION).tar.lz traditional_tarballs_version: \ tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz @@ -917,13 +968,17 @@ zic.o: private.h tzfile.h version.h .KEEP_STATE: .PHONY: ALL INSTALL all -.PHONY: check check_character_set check_links +.PHONY: check check_character_set check_links check_name_lengths .PHONY: check_public check_sorted check_tables .PHONY: check_time_t_alternatives check_tzs check_web check_white_space .PHONY: check_zishrink -.PHONY: clean clean_misc force_tzs +.PHONY: clean clean_misc dummy.zd force_tzs .PHONY: install install_data maintainer-clean names .PHONY: posix_only posix_packrat posix_right .PHONY: public right_only right_posix signatures signatures_version -.PHONY: tarballs tarballs_version typecheck +.PHONY: tarballs tarballs_version +.PHONY: traditional_signatures traditional_signatures_version +.PHONY: traditional_tarballs traditional_tarballs_version +.PHONY: typecheck .PHONY: zonenames zones +.PHONY: $(ZDS) Modified: head/contrib/tzdata/NEWS ============================================================================== --- head/contrib/tzdata/NEWS Sat Mar 24 04:42:56 2018 (r331480) +++ head/contrib/tzdata/NEWS Sat Mar 24 04:52:29 2018 (r331481) @@ -1,9 +1,146 @@ News for the tz database +Release 2018d - 2018-03-22 07:05:46 -0700 + + Briefly: + + Palestine starts DST a week earlier in 2018. + Add support for vanguard and rearguard data consumers. + Add subsecond precision to source data format, though not to data. + + Changes to future time stamps + + In 2018, Palestine starts DST on March 24, not March 31. + Adjust future predictions accordingly. (Thanks to Sharef Mustafa.) + + Changes to past and future time stamps + + Casey Station in Antarctica changed from +11 to +08 on 2018-03-11 + at 04:00. (Thanks to Steffen Thorsen.) + + Changes to past time stamps + + Historical transitions for Uruguay, represented by + America/Montevideo, have been updated per official legal documents, + replacing previous data mainly originating from the inventions of + Shanks & Pottenger. This has resulted in adjustments ranging from + 30 to 90 minutes in either direction over at least two dozen + distinct periods ranging from one day to several years in length. + A mere handful of pre-1991 transitions are unaffected; data since + then has come from more reliable contemporaneous reporting. These + changes affect various timestamps in 1920-1923, 1936, 1939, + 1942-1943, 1959, 1966-1970, 1972, 1974-1980, and 1988-1990. + Additionally, Uruguay's pre-standard-time UT offset has been + adjusted westward by 7 seconds, from UT-03:44:44 to UT-03:44:51, to + match the location of the Observatory of the National Meteorological + Institute in Montevideo. + (Thanks to Jeremie Bonjour, Tim Parenti, and Michael Deckers.) + + Enderbury and Kiritimati skipped New Year's Eve 1994, not + New Year's Day 1995. (Thanks to Kerry Shetline.) + + Fix the 1912-01-01 transition for Portugual and its colonies. + This transition was at 00:00 according to the new UT offset, not + according to the old one. Also assume that Cape Verde switched on + the same date as the rest, not in 1907. This affects + Africa/Bissau, Africa/Sao_Tome, Asia/Macau, Atlantic/Azores, + Atlantic/Cape_Verde, Atlantic/Madeira, and Europe/Lisbon. + (Thanks to Michael Deckers.) + + Fix an off-by-1 error for pre-1913 timestamps in Jamaica and in + Turks & Caicos. + + Changes to past time zone abbreviations + + MMT took effect in Uruguay from 1908-06-10, not 1898-06-28. There + is no clock change associated with the transition. + + Changes to build procedure + + The new DATAFORM macro in the Makefile lets the installer choose + among three source data formats. The idea is to lessen downstream + disruption when data formats are improved. + + * DATAFORM=vanguard installs from the latest, bleeding-edge + format. DATAFORM=main (the default) installs from the format + used in the 'africa' etc. files. DATAFORM=rearguard installs + from a trailing-edge format. Eventually, elements of today's + vanguard format should move to the main format, and similarly + the main format's features should eventually move to the + rearguard format. + + * In the current version, the main and rearguard formats are + identical and match that of 2018c, so this change does not + affect default behavior. The vanguard format currently contains + one feature not in the main format: negative SAVE values. This + improves support for Ireland, which uses Irish Standard Time + (IST, UTC+01) in summer and GMT (UTC) in winter. tzcode has + supported negative SAVE values for decades, and this feature + should move to the main format soon. However, it will not move + to the rearguard format for quite some time because some + downstream parsers do not support it. + + * The build procedure constructs three files vanguard.zi, main.zi, + and rearguard.zi, one for each format. The files represent the + same data as closely as the formats allow. These three files + are intended for downstream data consumers and are not + installed. Zoneinfo parsers that do not support negative SAVE values + should start using rearguard.zi, so that they will be unaffected + when the negative-DST feature moves from vanguard to main. + Bleeding-edge Zoneinfo parsers that support the new features + already can use vanguard.zi; in this respect, current tzcode is + bleeding-edge. + + The Makefile should now be safe for parallelized builds, and 'make + -j to2050new.tzs' is now much faster on a multiprocessor host + with GNU Make. + + When built with -DSUPPRESS_TZDIR, the tzcode library no longer + prepends TZDIR/ to file names that do not begin with '/'. This is + not recommended for general use, due to its security implications. + (From a suggestion by Manuela Friedrich.) + + Changes to code + + zic now accepts subsecond precision in expressions like + 00:19:32.13, which is approximately the legal time of the + Netherlands from 1835 to 1937. However, because it is + questionable whether the few recorded uses of non-integer offsets + had subsecond precision in practice, there are no plans for tzdata + to use this feature. (Thanks to Steve Allen for pointing out + the limitations of historical data in this area.) + + The code is a bit more portable to MS-Windows. Installers can + compile with -DRESERVE_STD_EXT_IDS on MS-Windows platforms that + reserve identifiers like 'localtime'. (Thanks to Manuela + Friedrich). + + Changes to documentation and commentary + + theory.html now outlines tzdb's extensions to POSIX's model for + civil time, and has a section "POSIX features no longer needed" + that lists POSIX API components that are now vestigial. + (From suggestions by Steve Summit.) It also better distinguishes + time zones from tz regions. (From a suggestion by Guy Harris.) + + Commentary is now more consistent about using the phrase "daylight + saving time", to match the C name tm_isdst. Daylight saving time + need not occur in summer, and need not have a positive offset from + standard time. + + Commentary about historical transitions in Uruguay has been expanded + with links to many relevant legal documents. + (Thanks to Tim Parenti.) + + Commentary now uses some non-ASCII characters with Unicode value + less than U+0100, as they can be useful and should work even with + older editors such as XEmacs. + + Release 2018c - 2018-01-22 23:00:44 -0800 Briefly: - Revert Irish changes that relied on negative DST offsets. + Revert Irish changes that relied on negative SAVE values. Changes to tm_isdst @@ -14,8 +151,8 @@ Release 2018c - 2018-01-22 23:00:44 -0800 struct tm type. This reversion is intended to be a temporary workaround for problems discovered with downstream uses of releases 2018a and 2018b, which implemented Irish time by using - negative DST offsets in the Eire rules of the 'europe' file. - Although negative DST offsets have been part of tzcode for many + negative SAVE values in the Eire rules of the 'europe' file. + Although negative SAVE values have been part of tzcode for many years and are supported by many platforms, they were not documented before 2018a and ICU and OpenJDK do not currently support them. A mechanism to export data to platforms lacking @@ -900,7 +1037,7 @@ Release 2016b - 2016-03-12 17:30:14 -0800 Comments in zone tables have been improved. (Thanks to J William Piggott.) tzselect again limits its menu comments so that menus fit on a - 24x80 alphanumeric display. + 24×80 alphanumeric display. A new web page tz-how-to.html. (Thanks to Bill Seymour.) Modified: head/contrib/tzdata/africa ============================================================================== --- head/contrib/tzdata/africa Sat Mar 24 04:42:56 2018 (r331480) +++ head/contrib/tzdata/africa Sat Mar 24 04:52:29 2018 (r331481) @@ -115,13 +115,13 @@ Zone Africa/Algiers 0:12:12 - LMT 1891 Mar 15 0:01 # Cape Verde / Cabo Verde # +# From Paul Eggert (2018-02-16): # Shanks gives 1907 for the transition to +02. -# Perhaps the 1911-05-26 Portuguese decree -# https://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf -# merely made it official? +# For now, ignore that and follow the 1911-05-26 Portuguese decree +# (see Europe/Lisbon). # # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Atlantic/Cape_Verde -1:34:04 - LMT 1907 # Praia +Zone Atlantic/Cape_Verde -1:34:04 - LMT 1912 Jan 01 2:00u # Praia -2:00 - -02 1942 Sep -2:00 1:00 -01 1945 Oct 15 -2:00 - -02 1975 Nov 25 2:00 @@ -370,15 +370,34 @@ Zone Africa/Cairo 2:05:09 - LMT 1900 Oct # See Africa/Abidjan. # Ghana -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S + +# From Paul Eggert (2018-01-30): # Whitman says DST was observed from 1931 to "the present"; -# Shanks & Pottenger say 1936 to 1942; -# and September 1 to January 1 is given by: -# Scott Keltie J, Epstein M (eds), The Statesman's Year-Book, -# 57th ed. Macmillan, London (1920), OCLC 609408015, pp xxviii. -# For lack of better info, assume DST was observed from 1920 to 1942. -Rule Ghana 1920 1942 - Sep 1 0:00 0:20 GHST -Rule Ghana 1920 1942 - Dec 31 0:00 0 GMT +# Shanks & Pottenger say 1936 to 1942 with 20 minutes of DST, +# with transitions on 09-01 and 12-31 at 00:00. +# Page 33 of Parish GCB, Colonial Reports - Annual. No. 1066. Gold +# Coast. Report for 1919. (March 1921), OCLC 784024077 +# http://libsysdigi.library.illinois.edu/ilharvest/africana/books2011-05/5530214/5530214_1919/5530214_1919_opt.pdf +# lists the Determination of the Time Ordinance, 1919, No. 18, +# "to advance the time observed locally by the space of twenty minutes +# during the last four months of each year; the object in view being +# to extend during those months the period of daylight-time available +# for evening recreation after office hours." +# Vanessa Ogle, The Global Transformation of Time, 1870-1950 (2015), p 33, +# writes "In 1919, the Gold Coast (Ghana as of 1957) made Greenwich +# time its legal time and simultaneously legalized a summer time of +# UTC - 00:20 minutes from March to October."; a footnote lists +# the ordinance as being dated 1919-11-24. +# The Crown Colonist, Volume 12 (1942), p 176, says "the Government +# intend advancing Gold Coast time half an hour ahead of G.M.T. +# The actual date of the alteration has not yet been announced." +# These sources are incomplete and contradictory. Possibly what is +# now Ghana observed different DST regimes in different years. For +# lack of better info, use Shanks except treat the minus sign as a +# typo, and assume DST started in 1920 not 1936. +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Ghana 1920 1942 - Sep 1 0:00 0:20 - +Rule Ghana 1920 1942 - Dec 31 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Accra -0:00:52 - LMT 1918 0:00 Ghana GMT/+0020 @@ -388,13 +407,13 @@ Zone Africa/Accra -0:00:52 - LMT 1918 # Guinea-Bissau # +# From Paul Eggert (2018-02-16): # Shanks gives 1911-05-26 for the transition to WAT, # evidently confusing the date of the Portuguese decree -# https://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf -# with the date that it took effect, namely 1912-01-01. +# (see Europe/Lisbon) with the date that it took effect. # # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Bissau -1:02:20 - LMT 1912 Jan 1 +Zone Africa/Bissau -1:02:20 - LMT 1912 Jan 1 1:00u -1:00 - -01 1975 0:00 - GMT @@ -590,9 +609,9 @@ Zone Africa/Tripoli 0:52:44 - LMT 1920 # at 2am (or 02:00) local time..." # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Mauritius 1982 only - Oct 10 0:00 1:00 S +Rule Mauritius 1982 only - Oct 10 0:00 1:00 - Rule Mauritius 1983 only - Mar 21 0:00 0 - -Rule Mauritius 2008 only - Oct lastSun 2:00 1:00 S +Rule Mauritius 2008 only - Oct lastSun 2:00 1:00 - Rule Mauritius 2009 only - Mar lastSun 2:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis @@ -1037,6 +1056,8 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Den # São Tomé and Príncipe +# See Europe/Lisbon for info about the 1912 transition. + # From Steffen Thorsen (2018-01-08): # Multiple sources tell that São Tomé changed from UTC to UTC+1 as # they entered the year 2018. @@ -1045,7 +1066,7 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Den # http://www.mnec.gov.st/index.php/publicacoes/documentos/file/90-decreto-lei-n-25-2017 Zone Africa/Sao_Tome 0:26:56 - LMT 1884 - -0:36:45 - LMT 1912 # Lisbon Mean Time + -0:36:45 - LMT 1912 Jan 1 00:00u # Lisbon MT 0:00 - GMT 2018 Jan 1 01:00 1:00 - WAT Modified: head/contrib/tzdata/antarctica ============================================================================== --- head/contrib/tzdata/antarctica Sat Mar 24 04:42:56 2018 (r331480) +++ head/contrib/tzdata/antarctica Sat Mar 24 04:52:29 2018 (r331481) @@ -75,7 +75,8 @@ Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2011 Oct 28 2:00 11:00 - +11 2012 Feb 21 17:00u 8:00 - +08 2016 Oct 22 - 11:00 - +11 + 11:00 - +11 2018 Mar 11 4:00 + 8:00 - +08 Zone Antarctica/Davis 0 - -00 1957 Jan 13 7:00 - +07 1964 Nov 0 - -00 1969 Feb Modified: head/contrib/tzdata/asia ============================================================================== --- head/contrib/tzdata/asia Sat Mar 24 04:42:56 2018 (r331480) +++ head/contrib/tzdata/asia Sat Mar 24 04:52:29 2018 (r331481) @@ -69,13 +69,13 @@ Rule EUAsia 1981 max - Mar lastSun 1:00u 1:00 S Rule EUAsia 1979 1995 - Sep lastSun 1:00u 0 - Rule EUAsia 1996 max - Oct lastSun 1:00u 0 - -Rule E-EurAsia 1981 max - Mar lastSun 0:00 1:00 S +Rule E-EurAsia 1981 max - Mar lastSun 0:00 1:00 - Rule E-EurAsia 1979 1995 - Sep lastSun 0:00 0 - Rule E-EurAsia 1996 max - Oct lastSun 0:00 0 - -Rule RussiaAsia 1981 1984 - Apr 1 0:00 1:00 S +Rule RussiaAsia 1981 1984 - Apr 1 0:00 1:00 - Rule RussiaAsia 1981 1983 - Oct 1 0:00 0 - Rule RussiaAsia 1984 1995 - Sep lastSun 2:00s 0 - -Rule RussiaAsia 1985 2010 - Mar lastSun 2:00s 1:00 S +Rule RussiaAsia 1985 2010 - Mar lastSun 2:00s 1:00 - Rule RussiaAsia 1996 2010 - Oct lastSun 2:00s 0 - # Afghanistan @@ -110,7 +110,7 @@ Zone Asia/Kabul 4:36:48 - LMT 1890 # (brief) # http://www.worldtimezone.com/dst_news/dst_news_armenia03.html # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Armenia 2011 only - Mar lastSun 2:00s 1:00 S +Rule Armenia 2011 only - Mar lastSun 2:00s 1:00 - Rule Armenia 2011 only - Oct lastSun 2:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Yerevan 2:58:00 - LMT 1924 May 2 @@ -136,7 +136,7 @@ Zone Asia/Yerevan 2:58:00 - LMT 1924 May 2 # http://en.apa.az/xeber_azerbaijan_abolishes_daylight_savings_ti_240862.html # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Azer 1997 2015 - Mar lastSun 4:00 1:00 S +Rule Azer 1997 2015 - Mar lastSun 4:00 1:00 - Rule Azer 1997 2015 - Oct lastSun 5:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Baku 3:19:24 - LMT 1924 May 2 @@ -223,7 +223,7 @@ Zone Asia/Baku 3:19:24 - LMT 1924 May 2 # http://www.worldtimezone.com/dst_news/dst_news_bangladesh06.html # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Dhaka 2009 only - Jun 19 23:00 1:00 S +Rule Dhaka 2009 only - Jun 19 23:00 1:00 - Rule Dhaka 2009 only - Dec 31 24:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -764,8 +764,9 @@ Rule Macau 1974 1977 - Oct Sun>=15 3:30 0 S Rule Macau 1975 1977 - Apr Sun>=15 3:30 1:00 D Rule Macau 1978 1980 - Apr Sun>=15 0:00 1:00 D Rule Macau 1978 1980 - Oct Sun>=15 0:00 0 S +# See Europe/Lisbon for info about the 1912 transition. # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Macau 7:34:20 - LMT 1912 Jan 1 +Zone Asia/Macau 7:34:20 - LMT 1911 Dec 31 16:00u 8:00 Macau C%sT @@ -1106,61 +1107,61 @@ Zone Asia/Jayapura 9:22:48 - LMT 1932 Nov # thirtieth day of Shahrivar. # # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Iran 1978 1980 - Mar 21 0:00 1:00 D -Rule Iran 1978 only - Oct 21 0:00 0 S -Rule Iran 1979 only - Sep 19 0:00 0 S -Rule Iran 1980 only - Sep 23 0:00 0 S -Rule Iran 1991 only - May 3 0:00 1:00 D -Rule Iran 1992 1995 - Mar 22 0:00 1:00 D -Rule Iran 1991 1995 - Sep 22 0:00 0 S -Rule Iran 1996 only - Mar 21 0:00 1:00 D -Rule Iran 1996 only - Sep 21 0:00 0 S -Rule Iran 1997 1999 - Mar 22 0:00 1:00 D -Rule Iran 1997 1999 - Sep 22 0:00 0 S -Rule Iran 2000 only - Mar 21 0:00 1:00 D -Rule Iran 2000 only - Sep 21 0:00 0 S -Rule Iran 2001 2003 - Mar 22 0:00 1:00 D -Rule Iran 2001 2003 - Sep 22 0:00 0 S -Rule Iran 2004 only - Mar 21 0:00 1:00 D -Rule Iran 2004 only - Sep 21 0:00 0 S -Rule Iran 2005 only - Mar 22 0:00 1:00 D -Rule Iran 2005 only - Sep 22 0:00 0 S -Rule Iran 2008 only - Mar 21 0:00 1:00 D -Rule Iran 2008 only - Sep 21 0:00 0 S -Rule Iran 2009 2011 - Mar 22 0:00 1:00 D -Rule Iran 2009 2011 - Sep 22 0:00 0 S -Rule Iran 2012 only - Mar 21 0:00 1:00 D -Rule Iran 2012 only - Sep 21 0:00 0 S -Rule Iran 2013 2015 - Mar 22 0:00 1:00 D -Rule Iran 2013 2015 - Sep 22 0:00 0 S -Rule Iran 2016 only - Mar 21 0:00 1:00 D -Rule Iran 2016 only - Sep 21 0:00 0 S -Rule Iran 2017 2019 - Mar 22 0:00 1:00 D -Rule Iran 2017 2019 - Sep 22 0:00 0 S -Rule Iran 2020 only - Mar 21 0:00 1:00 D -Rule Iran 2020 only - Sep 21 0:00 0 S -Rule Iran 2021 2023 - Mar 22 0:00 1:00 D -Rule Iran 2021 2023 - Sep 22 0:00 0 S -Rule Iran 2024 only - Mar 21 0:00 1:00 D -Rule Iran 2024 only - Sep 21 0:00 0 S -Rule Iran 2025 2027 - Mar 22 0:00 1:00 D -Rule Iran 2025 2027 - Sep 22 0:00 0 S -Rule Iran 2028 2029 - Mar 21 0:00 1:00 D -Rule Iran 2028 2029 - Sep 21 0:00 0 S -Rule Iran 2030 2031 - Mar 22 0:00 1:00 D -Rule Iran 2030 2031 - Sep 22 0:00 0 S -Rule Iran 2032 2033 - Mar 21 0:00 1:00 D -Rule Iran 2032 2033 - Sep 21 0:00 0 S -Rule Iran 2034 2035 - Mar 22 0:00 1:00 D -Rule Iran 2034 2035 - Sep 22 0:00 0 S +Rule Iran 1978 1980 - Mar 21 0:00 1:00 - +Rule Iran 1978 only - Oct 21 0:00 0 - +Rule Iran 1979 only - Sep 19 0:00 0 - +Rule Iran 1980 only - Sep 23 0:00 0 - +Rule Iran 1991 only - May 3 0:00 1:00 - +Rule Iran 1992 1995 - Mar 22 0:00 1:00 - +Rule Iran 1991 1995 - Sep 22 0:00 0 - +Rule Iran 1996 only - Mar 21 0:00 1:00 - +Rule Iran 1996 only - Sep 21 0:00 0 - +Rule Iran 1997 1999 - Mar 22 0:00 1:00 - +Rule Iran 1997 1999 - Sep 22 0:00 0 - +Rule Iran 2000 only - Mar 21 0:00 1:00 - +Rule Iran 2000 only - Sep 21 0:00 0 - +Rule Iran 2001 2003 - Mar 22 0:00 1:00 - +Rule Iran 2001 2003 - Sep 22 0:00 0 - +Rule Iran 2004 only - Mar 21 0:00 1:00 - +Rule Iran 2004 only - Sep 21 0:00 0 - +Rule Iran 2005 only - Mar 22 0:00 1:00 - +Rule Iran 2005 only - Sep 22 0:00 0 - +Rule Iran 2008 only - Mar 21 0:00 1:00 - +Rule Iran 2008 only - Sep 21 0:00 0 - +Rule Iran 2009 2011 - Mar 22 0:00 1:00 - +Rule Iran 2009 2011 - Sep 22 0:00 0 - +Rule Iran 2012 only - Mar 21 0:00 1:00 - +Rule Iran 2012 only - Sep 21 0:00 0 - +Rule Iran 2013 2015 - Mar 22 0:00 1:00 - +Rule Iran 2013 2015 - Sep 22 0:00 0 - +Rule Iran 2016 only - Mar 21 0:00 1:00 - +Rule Iran 2016 only - Sep 21 0:00 0 - +Rule Iran 2017 2019 - Mar 22 0:00 1:00 - +Rule Iran 2017 2019 - Sep 22 0:00 0 - +Rule Iran 2020 only - Mar 21 0:00 1:00 - +Rule Iran 2020 only - Sep 21 0:00 0 - +Rule Iran 2021 2023 - Mar 22 0:00 1:00 - +Rule Iran 2021 2023 - Sep 22 0:00 0 - +Rule Iran 2024 only - Mar 21 0:00 1:00 - +Rule Iran 2024 only - Sep 21 0:00 0 - +Rule Iran 2025 2027 - Mar 22 0:00 1:00 - +Rule Iran 2025 2027 - Sep 22 0:00 0 - +Rule Iran 2028 2029 - Mar 21 0:00 1:00 - +Rule Iran 2028 2029 - Sep 21 0:00 0 - +Rule Iran 2030 2031 - Mar 22 0:00 1:00 - +Rule Iran 2030 2031 - Sep 22 0:00 0 - +Rule Iran 2032 2033 - Mar 21 0:00 1:00 - +Rule Iran 2032 2033 - Sep 21 0:00 0 - +Rule Iran 2034 2035 - Mar 22 0:00 1:00 - +Rule Iran 2034 2035 - Sep 22 0:00 0 - # # The following rules are approximations starting in the year 2038. # These are the best post-2037 approximations available, given the # restrictions of a single rule using a Gregorian-based data format. # At some point this table will need to be extended, though quite # possibly Iran will change the rules first. -Rule Iran 2036 max - Mar 21 0:00 1:00 D -Rule Iran 2036 max - Sep 21 0:00 0 S +Rule Iran 2036 max - Mar 21 0:00 1:00 - +Rule Iran 2036 max - Sep 21 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Tehran 3:25:44 - LMT 1916 @@ -1196,17 +1197,17 @@ Zone Asia/Tehran 3:25:44 - LMT 1916 # https://www.timeanddate.com/news/time/iraq-dumps-daylight-saving.html # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Iraq 1982 only - May 1 0:00 1:00 D -Rule Iraq 1982 1984 - Oct 1 0:00 0 S -Rule Iraq 1983 only - Mar 31 0:00 1:00 D -Rule Iraq 1984 1985 - Apr 1 0:00 1:00 D -Rule Iraq 1985 1990 - Sep lastSun 1:00s 0 S -Rule Iraq 1986 1990 - Mar lastSun 1:00s 1:00 D +Rule Iraq 1982 only - May 1 0:00 1:00 - +Rule Iraq 1982 1984 - Oct 1 0:00 0 - +Rule Iraq 1983 only - Mar 31 0:00 1:00 - +Rule Iraq 1984 1985 - Apr 1 0:00 1:00 - +Rule Iraq 1985 1990 - Sep lastSun 1:00s 0 - +Rule Iraq 1986 1990 - Mar lastSun 1:00s 1:00 - # IATA SSIM (1991/1996) says Apr 1 12:01am UTC; guess the ':01' is a typo. # Shanks & Pottenger say Iraq did not observe DST 1992/1997; ignore this. # -Rule Iraq 1991 2007 - Apr 1 3:00s 1:00 D -Rule Iraq 1991 2007 - Oct 1 3:00s 0 S +Rule Iraq 1991 2007 - Apr 1 3:00s 1:00 - +Rule Iraq 1991 2007 - Oct 1 3:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Baghdad 2:57:40 - LMT 1890 2:57:36 - BMT 1918 # Baghdad Mean Time? @@ -1478,8 +1479,7 @@ Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D # From Hideyuki Suzuki (1998-11-09): # 'Tokyo' usually stands for the former location of Tokyo Astronomical -# Observatory: 139 degrees 44' 40.90" E (9h 18m 58.727s), -# 35 degrees 39' 16.0" N. +# Observatory: 139° 44' 40.90" E (9h 18m 58.727s), 35° 39' 16.0" N. # This data is from 'Rika Nenpyou (Chronological Scientific Tables) 1996' # edited by National Astronomical Observatory of Japan.... # JST (Japan Standard Time) has been used since 1888-01-01 00:00 (JST). @@ -1487,10 +1487,10 @@ Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D # From Hideyuki Suzuki (1998-11-16): # The ordinance No. 51 (1886) established "standard time" in Japan, -# which stands for the time on 135 degrees E. +# which stands for the time on 135° E. # In the ordinance No. 167 (1895), "standard time" was renamed to "central # standard time". And the same ordinance also established "western standard -# time", which stands for the time on 120 degrees E.... But "western standard +# time", which stands for the time on 120° E.... But "western standard # time" was abolished in the ordinance No. 529 (1937). In the ordinance No. # 167, there is no mention regarding for what place western standard time is # standard.... @@ -1903,9 +1903,9 @@ Zone Asia/Oral 3:25:24 - LMT 1924 May 2 # or Ural'sk # From 2005-08-12 our GMT-offset is +6, w/o any daylight saving. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Kyrgyz 1992 1996 - Apr Sun>=7 0:00s 1:00 S +Rule Kyrgyz 1992 1996 - Apr Sun>=7 0:00s 1:00 - Rule Kyrgyz 1992 1996 - Sep lastSun 0:00 0 - -Rule Kyrgyz 1997 2005 - Mar lastSun 2:30 1:00 S +Rule Kyrgyz 1997 2005 - Mar lastSun 2:30 1:00 - Rule Kyrgyz 1997 2004 - Oct lastSun 2:30 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Bishkek 4:58:24 - LMT 1924 May 2 @@ -2037,7 +2037,7 @@ Zone Asia/Beirut 2:22:00 - LMT 1880 # Malaysia # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule NBorneo 1935 1941 - Sep 14 0:00 0:20 TS # one-Third Summer +Rule NBorneo 1935 1941 - Sep 14 0:00 0:20 - Rule NBorneo 1935 1941 - Dec 14 0:00 0 - # # peninsular Malaysia @@ -2182,7 +2182,7 @@ Zone Indian/Maldives 4:54:00 - LMT 1880 # Malé # http://zasag.mn/news/view/8969 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Mongol 1983 1984 - Apr 1 0:00 1:00 S +Rule Mongol 1983 1984 - Apr 1 0:00 1:00 - Rule Mongol 1983 only - Oct 1 0:00 0 - # Shanks & Pottenger and IATA SSIM say 1990s switches occurred at 00:00, # but McDow says the 2001 switches occurred at 02:00. Also, IATA SSIM @@ -2199,13 +2199,13 @@ Rule Mongol 1983 only - Oct 1 0:00 0 - # Mongolian Government meeting has concluded today to cancel daylight # saving time adoption in Mongolia. Source: http://zasag.mn/news/view/16192 -Rule Mongol 1985 1998 - Mar lastSun 0:00 1:00 S +Rule Mongol 1985 1998 - Mar lastSun 0:00 1:00 - Rule Mongol 1984 1998 - Sep lastSun 0:00 0 - # IATA SSIM (1999-09) says Mongolia no longer observes DST. -Rule Mongol 2001 only - Apr lastSat 2:00 1:00 S +Rule Mongol 2001 only - Apr lastSat 2:00 1:00 - Rule Mongol 2001 2006 - Sep lastSat 2:00 0 - -Rule Mongol 2002 2006 - Mar lastSat 2:00 1:00 S -Rule Mongol 2015 2016 - Mar lastSat 2:00 1:00 S +Rule Mongol 2002 2006 - Mar lastSat 2:00 1:00 - +Rule Mongol 2015 2016 - Mar lastSat 2:00 1:00 - Rule Mongol 2015 2016 - Sep lastSat 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2639,9 +2639,6 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # [Google translation]: "The Council also decided to start daylight # saving in Palestine as of one o'clock on Saturday morning, # 2016-03-26, to provide the clock 60 minutes ahead." -# -# From Paul Eggert (2016-03-12): -# Predict spring transitions on March's last Saturday at 01:00 from now on. # From Sharef Mustafa (2016-10-19): # [T]he Palestinian cabinet decision (Mar 8th 2016) published on @@ -2658,6 +2655,16 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # https://www.timeanddate.com/time/change/gaza-strip/gaza # https://www.timeanddate.com/time/change/west-bank/hebron +# From Sharef Mustafa (2018-03-16): +# Palestine summer time will start on Mar 24th 2018 by advancing the +# clock by 60 minutes as per Palestinian cabinet decision published on +# the offical website, though the decree did not specify the exact +# time of the time shift. +# http://www.palestinecabinet.gov.ps/Website/AR/NDecrees/ViewFile.ashx?ID=e7a42ab7-ee23-435a-b9c8-a4f7e81f3817 +# +# From Paul Eggert (2018-03-16): +# For 2016 on, predict spring transitions on March's fourth Saturday at 01:00. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S Rule EgyptAsia 1957 1958 - Oct 1 0:00 0 - @@ -2687,7 +2694,7 @@ Rule Palestine 2012 only - Sep 21 1:00 0 - Rule Palestine 2013 only - Sep Fri>=21 0:00 0 - Rule Palestine 2014 2015 - Oct Fri>=21 0:00 0 - Rule Palestine 2015 only - Mar lastFri 24:00 1:00 S -Rule Palestine 2016 max - Mar lastSat 1:00 1:00 S +Rule Palestine 2016 max - Mar Sat>=22 1:00 1:00 S Rule Palestine 2016 max - Oct lastSat 1:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2737,11 +2744,11 @@ Zone Asia/Hebron 2:20:23 - LMT 1900 Oct # http://www.philstar.com/headlines/2014/08/05/1354152/pnoy-urged-declare-use-daylight-saving-time # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Phil 1936 only - Nov 1 0:00 1:00 S +Rule Phil 1936 only - Nov 1 0:00 1:00 - Rule Phil 1937 only - Feb 1 0:00 0 - -Rule Phil 1954 only - Apr 12 0:00 1:00 S +Rule Phil 1954 only - Apr 12 0:00 1:00 - Rule Phil 1954 only - Jul 1 0:00 0 - -Rule Phil 1978 only - Mar 22 0:00 1:00 S +Rule Phil 1978 only - Mar 22 0:00 1:00 - Rule Phil 1978 only - Sep 21 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Manila -15:56:00 - LMT 1844 Dec 31 @@ -3097,9 +3104,9 @@ Zone Asia/Tashkent 4:37:11 - LMT 1924 May 2 # and is the basis for the information below. # # The 1906 transition was effective July 1 and standardized Indochina to -# Phù Liá»…n Observatory, legally 104 deg. 17'17" east of Paris. +# Phù Liá»…n Observatory, legally 104° 17' 17" east of Paris. # It's unclear whether this meant legal Paris Mean Time (00:09:21) or -# the Paris Meridian (2 deg. 20'14.03" E); the former yields 07:06:30.1333... +# the Paris Meridian (2° 20' 14.03" E); the former yields 07:06:30.1333... # and the latter 07:06:29.333... so either way it rounds to 07:06:30, # which is used below even though the modern-day Phù Liá»…n Observatory # is closer to 07:06:31. Abbreviate Phù Liá»…n Mean Time as PLMT. Modified: head/contrib/tzdata/australasia ============================================================================== --- head/contrib/tzdata/australasia Sat Mar 24 04:42:56 2018 (r331480) +++ head/contrib/tzdata/australasia Sat Mar 24 04:52:29 2018 (r331481) @@ -196,20 +196,20 @@ Zone Australia/Broken_Hill 9:25:48 - LMT 1895 Feb # Lord Howe Island # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule LH 1981 1984 - Oct lastSun 2:00 1:00 D -Rule LH 1982 1985 - Mar Sun>=1 2:00 0 S -Rule LH 1985 only - Oct lastSun 2:00 0:30 D -Rule LH 1986 1989 - Mar Sun>=15 2:00 0 S -Rule LH 1986 only - Oct 19 2:00 0:30 D -Rule LH 1987 1999 - Oct lastSun 2:00 0:30 D -Rule LH 1990 1995 - Mar Sun>=1 2:00 0 S -Rule LH 1996 2005 - Mar lastSun 2:00 0 S -Rule LH 2000 only - Aug lastSun 2:00 0:30 D -Rule LH 2001 2007 - Oct lastSun 2:00 0:30 D -Rule LH 2006 only - Apr Sun>=1 2:00 0 S -Rule LH 2007 only - Mar lastSun 2:00 0 S -Rule LH 2008 max - Apr Sun>=1 2:00 0 S -Rule LH 2008 max - Oct Sun>=1 2:00 0:30 D +Rule LH 1981 1984 - Oct lastSun 2:00 1:00 - +Rule LH 1982 1985 - Mar Sun>=1 2:00 0 - +Rule LH 1985 only - Oct lastSun 2:00 0:30 - +Rule LH 1986 1989 - Mar Sun>=15 2:00 0 - +Rule LH 1986 only - Oct 19 2:00 0:30 - +Rule LH 1987 1999 - Oct lastSun 2:00 0:30 - +Rule LH 1990 1995 - Mar Sun>=1 2:00 0 - +Rule LH 1996 2005 - Mar lastSun 2:00 0 - +Rule LH 2000 only - Aug lastSun 2:00 0:30 - +Rule LH 2001 2007 - Oct lastSun 2:00 0:30 - +Rule LH 2006 only - Apr Sun>=1 2:00 0 - +Rule LH 2007 only - Mar lastSun 2:00 0 - +Rule LH 2008 max - Apr Sun>=1 2:00 0 - +Rule LH 2008 max - Oct Sun>=1 2:00 0:30 - Zone Australia/Lord_Howe 10:36:20 - LMT 1895 Feb 10:00 - AEST 1981 Mar 10:30 LH +1030/+1130 1985 Jul @@ -367,15 +367,15 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # practice than guessing no DST. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 S +Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 - Rule Fiji 1999 2000 - Feb lastSun 3:00 0 - -Rule Fiji 2009 only - Nov 29 2:00 1:00 S +Rule Fiji 2009 only - Nov 29 2:00 1:00 - Rule Fiji 2010 only - Mar lastSun 3:00 0 - -Rule Fiji 2010 2013 - Oct Sun>=21 2:00 1:00 S +Rule Fiji 2010 2013 - Oct Sun>=21 2:00 1:00 - Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - -Rule Fiji 2014 max - Nov Sun>=1 2:00 1:00 S +Rule Fiji 2014 max - Nov Sun>=1 2:00 1:00 - Rule Fiji 2015 max - Jan Sun>=14 3:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva @@ -406,11 +406,11 @@ Zone Pacific/Tarawa 11:32:04 - LMT 1901 # Bairiki 12:00 - +12 Zone Pacific/Enderbury -11:24:20 - LMT 1901 -12:00 - -12 1979 Oct - -11:00 - -11 1995 + -11:00 - -11 1994 Dec 31 13:00 - +13 Zone Pacific/Kiritimati -10:29:20 - LMT 1901 -10:40 - -1040 1979 Oct - -10:00 - -10 1995 + -10:00 - -10 1994 Dec 31 14:00 - +14 # N Mariana Is @@ -447,9 +447,9 @@ Zone Pacific/Nauru 11:07:40 - LMT 1921 Jan 15 # Uaobe # New Caledonia # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule NC 1977 1978 - Dec Sun>=1 0:00 1:00 S +Rule NC 1977 1978 - Dec Sun>=1 0:00 1:00 - Rule NC 1978 1979 - Feb 27 0:00 0 - -Rule NC 1996 only - Dec 1 2:00s 1:00 S +Rule NC 1996 only - Dec 1 2:00s 1:00 - # Shanks & Pottenger say the following was at 2:00; go with IATA. Rule NC 1997 only - Mar 2 2:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -469,27 +469,28 @@ Rule NZ 1929 1933 - Mar Sun>=15 2:00 0 M Rule NZ 1934 1940 - Apr lastSun 2:00 0 M Rule NZ 1934 1940 - Sep lastSun 2:00 0:30 S Rule NZ 1946 only - Jan 1 0:00 0 S -# Since 1957 Chatham has been 45 minutes ahead of NZ, but there's no -# convenient single notation for the date and time of this transition -# so we must duplicate the Rule lines. +# Since 1957 Chatham has been 45 minutes ahead of NZ, but until 2018a +# there was no documented single notation for the date and time of this +# transition. Duplicate the Rule lines for now, to give the 2018a change *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Mar 24 09:10:51 2018 Return-Path: Delivered-To: svn-src-head@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 6ED58F581AC; Sat, 24 Mar 2018 09:10:51 +0000 (UTC) (envelope-from mfechner@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 2582A81C34; Sat, 24 Mar 2018 09:10:51 +0000 (UTC) (envelope-from mfechner@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 2066050DF; Sat, 24 Mar 2018 09:10:51 +0000 (UTC) (envelope-from mfechner@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O9ApSn005562; Sat, 24 Mar 2018 09:10:51 GMT (envelope-from mfechner@FreeBSD.org) Received: (from mfechner@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O9ApMh005561; Sat, 24 Mar 2018 09:10:51 GMT (envelope-from mfechner@FreeBSD.org) Message-Id: <201803240910.w2O9ApMh005561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mfechner set sender to mfechner@FreeBSD.org using -f From: Matthias Fechner Date: Sat, 24 Mar 2018 09:10:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331482 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: mfechner X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 331482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 09:10:51 -0000 Author: mfechner (ports committer) Date: Sat Mar 24 09:10:50 2018 New Revision: 331482 URL: https://svnweb.freebsd.org/changeset/base/331482 Log: Added myself to committers-ports.dot. Reviewed by: tz (mentor) Approved by: tz (mentor) Differential Revision: https://reviews.freebsd.org/40631 Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Sat Mar 24 04:52:29 2018 (r331481) +++ head/share/misc/committers-ports.dot Sat Mar 24 09:10:50 2018 (r331482) @@ -176,6 +176,7 @@ martymac [label="Ganael Laplanche\nmartymac@FreeBSD.or mat [label="Mathieu Arnold\nmat@FreeBSD.org\n2003/08/15"] matthew [label="Matthew Seaman\nmatthew@FreeBSD.org\n2012/02/07"] mezz [label="Jeremy Messenger\nmezz@FreeBSD.org\n2004/04/30"] +mfechner [label="Matthias Fechner\nmfechner@FreeBSD.org\n2018/03/01"] mharo [label="Michael Haro\nmharo@FreeBSD.org\n1999/04/13"] milki [label="Jonathan Chu\nmilki@FreeBSD.org\n2013/12/15"] misha [label="Mikhail Pchelin\nmisha@FreeBSD.org\n2016/11/15"] @@ -641,6 +642,7 @@ swills -> dch swills -> feld swills -> jmd swills -> jrm +swills -> mfechner swills -> milki swills -> pclin swills -> rezny @@ -678,6 +680,7 @@ tmclaugh -> xride tz -> joneum tz -> fernape +tz -> mfechner vsevolod -> eugen From owner-svn-src-head@freebsd.org Sat Mar 24 09:37:58 2018 Return-Path: Delivered-To: svn-src-head@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 087E3F5A912; Sat, 24 Mar 2018 09:37:58 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72D0A83104; Sat, 24 Mar 2018 09:37:54 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w2O9bowJ035462; Sat, 24 Mar 2018 02:37:50 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w2O9boF2035461; Sat, 24 Mar 2018 02:37:50 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201803240937.w2O9boF2035461@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r331482 - head/share/misc In-Reply-To: <201803240910.w2O9ApMh005561@repo.freebsd.org> To: Matthias Fechner Date: Sat, 24 Mar 2018 02:37:50 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 09:37:58 -0000 > Author: mfechner (ports committer) > Date: Sat Mar 24 09:10:50 2018 > New Revision: 331482 > URL: https://svnweb.freebsd.org/changeset/base/331482 > > Log: > Added myself to committers-ports.dot. > > Reviewed by: tz (mentor) > Approved by: tz (mentor) > Differential Revision: https://reviews.freebsd.org/40631 Url not found? > Modified: > head/share/misc/committers-ports.dot > > Modified: head/share/misc/committers-ports.dot > ============================================================================== > --- head/share/misc/committers-ports.dot Sat Mar 24 04:52:29 2018 (r331481) > +++ head/share/misc/committers-ports.dot Sat Mar 24 09:10:50 2018 (r331482) > @@ -176,6 +176,7 @@ martymac [label="Ganael Laplanche\nmartymac@FreeBSD.or > mat [label="Mathieu Arnold\nmat@FreeBSD.org\n2003/08/15"] > matthew [label="Matthew Seaman\nmatthew@FreeBSD.org\n2012/02/07"] > mezz [label="Jeremy Messenger\nmezz@FreeBSD.org\n2004/04/30"] > +mfechner [label="Matthias Fechner\nmfechner@FreeBSD.org\n2018/03/01"] > mharo [label="Michael Haro\nmharo@FreeBSD.org\n1999/04/13"] > milki [label="Jonathan Chu\nmilki@FreeBSD.org\n2013/12/15"] > misha [label="Mikhail Pchelin\nmisha@FreeBSD.org\n2016/11/15"] > @@ -641,6 +642,7 @@ swills -> dch > swills -> feld > swills -> jmd > swills -> jrm > +swills -> mfechner > swills -> milki > swills -> pclin > swills -> rezny > @@ -678,6 +680,7 @@ tmclaugh -> xride > > tz -> joneum > tz -> fernape > +tz -> mfechner > > vsevolod -> eugen -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Mar 24 12:40:46 2018 Return-Path: Delivered-To: svn-src-head@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 99138F6A32E; Sat, 24 Mar 2018 12:40:46 +0000 (UTC) (envelope-from jtl@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 4D17A69E38; Sat, 24 Mar 2018 12:40:46 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 47FE8741E; Sat, 24 Mar 2018 12:40:46 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OCekiF008817; Sat, 24 Mar 2018 12:40:46 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OCekNe008816; Sat, 24 Mar 2018 12:40:46 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201803241240.w2OCekNe008816@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Sat, 24 Mar 2018 12:40:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331483 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 331483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 12:40:46 -0000 Author: jtl Date: Sat Mar 24 12:40:45 2018 New Revision: 331483 URL: https://svnweb.freebsd.org/changeset/base/331483 Log: Fix compilation for platforms that don't support atomic_fetchadd_64() after r331347. Reported by: avg, br, jhibbits Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_log_buf.c Modified: head/sys/netinet/tcp_log_buf.c ============================================================================== --- head/sys/netinet/tcp_log_buf.c Sat Mar 24 09:10:50 2018 (r331482) +++ head/sys/netinet/tcp_log_buf.c Sat Mar 24 12:40:45 2018 (r331483) @@ -72,8 +72,8 @@ static STAILQ_HEAD(, tcp_log_id_node) tcp_log_expireq_ STAILQ_HEAD_INITIALIZER(tcp_log_expireq_head); static struct mtx tcp_log_expireq_mtx; static struct callout tcp_log_expireq_callout; -static uint64_t tcp_log_auto_ratio = 0; -static uint64_t tcp_log_auto_ratio_cur = 0; +static u_long tcp_log_auto_ratio = 0; +static volatile u_long tcp_log_auto_ratio_cur = 0; static uint32_t tcp_log_auto_mode = TCP_LOG_STATE_TAIL; static bool tcp_log_auto_all = false; @@ -109,7 +109,7 @@ SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_tcpc SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_version, CTLFLAG_RD, &tcp_log_version, 0, "Version of log formats exported"); -SYSCTL_U64(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW, +SYSCTL_ULONG(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW, &tcp_log_auto_ratio, 0, "Do auto capturing for 1 out of N sessions"); SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_auto_mode, CTLFLAG_RW, @@ -283,7 +283,7 @@ tcp_log_selectauto(void) * this session. */ if (tcp_log_auto_ratio && - (atomic_fetchadd_64(&tcp_log_auto_ratio_cur, 1) % + (atomic_fetchadd_long(&tcp_log_auto_ratio_cur, 1) % tcp_log_auto_ratio) == 0) return (true); return (false); From owner-svn-src-head@freebsd.org Sat Mar 24 12:43:35 2018 Return-Path: Delivered-To: svn-src-head@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 9E449F6A776; Sat, 24 Mar 2018 12:43:35 +0000 (UTC) (envelope-from jtl@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 518F66A12C; Sat, 24 Mar 2018 12:43:35 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 4C77C75A4; Sat, 24 Mar 2018 12:43:35 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OChZk2013573; Sat, 24 Mar 2018 12:43:35 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OChY5f013569; Sat, 24 Mar 2018 12:43:34 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201803241243.w2OChY5f013569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Sat, 24 Mar 2018 12:43:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331484 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 331484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 12:43:36 -0000 Author: jtl Date: Sat Mar 24 12:43:34 2018 New Revision: 331484 URL: https://svnweb.freebsd.org/changeset/base/331484 Log: Remove some unneccessary variable sets in IPv6 code, as detected by clang's static analyzer. Reviewed by: bz MFC after: 2 weeks Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D10940 Modified: head/sys/netinet6/dest6.c head/sys/netinet6/icmp6.c head/sys/netinet6/ip6_output.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/dest6.c ============================================================================== --- head/sys/netinet6/dest6.c Sat Mar 24 12:40:45 2018 (r331483) +++ head/sys/netinet6/dest6.c Sat Mar 24 12:43:34 2018 (r331484) @@ -93,7 +93,7 @@ dest6_input(struct mbuf **mp, int *offp, int proto) opt = (u_int8_t *)dstopts + sizeof(struct ip6_dest); /* search header for all options. */ - for (optlen = 0; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) { + for (; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) { if (*opt != IP6OPT_PAD1 && (dstoptlen < IP6OPT_MINLEN || *(opt + 1) + 2 > dstoptlen)) { IP6STAT_INC(ip6s_toosmall); Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Sat Mar 24 12:40:45 2018 (r331483) +++ head/sys/netinet6/icmp6.c Sat Mar 24 12:43:34 2018 (r331484) @@ -594,7 +594,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) n->m_pkthdr.len = n0len + (noff - off); n->m_next = n0; } else { - nip6 = mtod(n, struct ip6_hdr *); IP6_EXTHDR_GET(nicmp6, struct icmp6_hdr *, n, off, sizeof(*nicmp6)); noff = off; Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Sat Mar 24 12:40:45 2018 (r331483) +++ head/sys/netinet6/ip6_output.c Sat Mar 24 12:43:34 2018 (r331484) @@ -1048,7 +1048,7 @@ sendorfree: m = m0->m_nextpkt; m0->m_nextpkt = 0; m_freem(m0); - for (m0 = m; m; m = m0) { + for (; m; m = m0) { m0 = m->m_nextpkt; m->m_nextpkt = 0; if (error == 0) { Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Sat Mar 24 12:40:45 2018 (r331483) +++ head/sys/netinet6/udp6_usrreq.c Sat Mar 24 12:43:34 2018 (r331484) @@ -220,7 +220,6 @@ udp6_input(struct mbuf **mp, int *offp, int proto) uint8_t nxt; ifp = m->m_pkthdr.rcvif; - ip6 = mtod(m, struct ip6_hdr *); #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, off, sizeof(struct udphdr), IPPROTO_DONE); @@ -230,6 +229,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) IP6_EXTHDR_GET(uh, struct udphdr *, m, off, sizeof(*uh)); if (!uh) return (IPPROTO_DONE); + ip6 = mtod(m, struct ip6_hdr *); #endif UDPSTAT_INC(udps_ipackets); From owner-svn-src-head@freebsd.org Sat Mar 24 12:48:11 2018 Return-Path: Delivered-To: svn-src-head@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 A0D5EF6AC4C; Sat, 24 Mar 2018 12:48:11 +0000 (UTC) (envelope-from jtl@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 4EECF6A330; Sat, 24 Mar 2018 12:48:11 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 4579975C9; Sat, 24 Mar 2018 12:48:11 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OCmBw8013787; Sat, 24 Mar 2018 12:48:11 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OCmAHi013779; Sat, 24 Mar 2018 12:48:10 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201803241248.w2OCmAHi013779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Sat, 24 Mar 2018 12:48:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331485 - in head/sys: amd64/conf conf dev/tcp_log netinet X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: in head/sys: amd64/conf conf dev/tcp_log netinet X-SVN-Commit-Revision: 331485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 12:48:11 -0000 Author: jtl Date: Sat Mar 24 12:48:10 2018 New Revision: 331485 URL: https://svnweb.freebsd.org/changeset/base/331485 Log: Make the TCP blackbox code committed in r331347 be an optional feature controlled by the TCP_BLACKBOX option. Enable this as part of amd64 GENERIC. For now, leave it disabled on other platforms. Sponsored by: Netflix, Inc. Modified: head/sys/amd64/conf/GENERIC head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/dev/tcp_log/tcp_log_dev.h head/sys/netinet/tcp_log_buf.h head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_usrreq.c Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/amd64/conf/GENERIC Sat Mar 24 12:48:10 2018 (r331485) @@ -32,6 +32,7 @@ options INET6 # IPv6 communications protocols options IPSEC # IP (v4/v6) security options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 options TCP_OFFLOAD # TCP offload +options TCP_BLACKBOX # Enhanced TCP event logging options TCP_HHOOK # hhook(9) framework for TCP options TCP_RFC7413 # TCP Fast Open options SCTP # Stream Control Transmission Protocol Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/conf/NOTES Sat Mar 24 12:48:10 2018 (r331485) @@ -979,6 +979,8 @@ device lagg # TCPPCAP enables code which keeps the last n packets sent and received # on a TCP socket. # +# TCP_BLACKBOX enables enhanced TCP event logging. +# # TCP_HHOOK enables the hhook(9) framework hooks for the TCP stack. # # RADIX_MPATH provides support for equal-cost multi-path routing. @@ -1000,6 +1002,7 @@ options IPSTEALTH #support for stealth forwarding options PF_DEFAULT_TO_DROP #drop everything by default options TCPDEBUG options TCPPCAP +options TCP_BLACKBOX options TCP_HHOOK options RADIX_MPATH Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/conf/files Sat Mar 24 12:48:10 2018 (r331485) @@ -3163,7 +3163,7 @@ dev/syscons/star/star_saver.c optional star_saver dev/syscons/syscons.c optional sc dev/syscons/sysmouse.c optional sc dev/syscons/warp/warp_saver.c optional warp_saver -dev/tcp_log/tcp_log_dev.c optional inet | inet6 +dev/tcp_log/tcp_log_dev.c optional tcp_blackbox inet | tcp_blackbox inet6 dev/tdfx/tdfx_linux.c optional tdfx_linux tdfx compat_linux dev/tdfx/tdfx_pci.c optional tdfx pci dev/ti/if_ti.c optional ti pci @@ -4312,7 +4312,7 @@ netinet/tcp_debug.c optional tcpdebug netinet/tcp_fastopen.c optional inet tcp_rfc7413 | inet6 tcp_rfc7413 netinet/tcp_hostcache.c optional inet | inet6 netinet/tcp_input.c optional inet | inet6 -netinet/tcp_log_buf.c optional inet | inet6 +netinet/tcp_log_buf.c optional tcp_blackbox inet | tcp_blackbox inet6 netinet/tcp_lro.c optional inet | inet6 netinet/tcp_output.c optional inet | inet6 netinet/tcp_offload.c optional tcp_offload inet | tcp_offload inet6 Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/conf/options Sat Mar 24 12:48:10 2018 (r331485) @@ -452,6 +452,7 @@ SLIP_IFF_OPTS opt_slip.h TCPDEBUG TCPPCAP opt_global.h SIFTR +TCP_BLACKBOX opt_global.h TCP_HHOOK opt_inet.h TCP_OFFLOAD opt_inet.h # Enable code to dispatch TCP offloading TCP_RFC7413 opt_inet.h Modified: head/sys/dev/tcp_log/tcp_log_dev.h ============================================================================== --- head/sys/dev/tcp_log/tcp_log_dev.h Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/dev/tcp_log/tcp_log_dev.h Sat Mar 24 12:48:10 2018 (r331485) @@ -81,8 +81,9 @@ struct tcp_log_dev_info { }; STAILQ_HEAD(log_infoh, tcp_log_dev_info); - +#ifdef TCP_BLACKBOX MALLOC_DECLARE(M_TCPLOGDEV); int tcp_log_dev_add_log(struct tcp_log_dev_queue *entry); +#endif /* TCP_BLACKBOX */ #endif /* _KERNEL */ #endif /* !__tcp_log_dev_h__ */ Modified: head/sys/netinet/tcp_log_buf.h ============================================================================== --- head/sys/netinet/tcp_log_buf.h Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/netinet/tcp_log_buf.h Sat Mar 24 12:48:10 2018 (r331485) @@ -331,6 +331,7 @@ struct tcp_log_dev_log_queue { } while (0) +#ifdef TCP_BLACKBOX extern bool tcp_log_verbose; void tcp_log_drain(struct tcpcb *tp); int tcp_log_dump_tp_logbuf(struct tcpcb *tp, char *reason, int how, bool force); @@ -348,6 +349,20 @@ int tcp_log_state_change(struct tcpcb *tp, int state); void tcp_log_tcpcbinit(struct tcpcb *tp); void tcp_log_tcpcbfini(struct tcpcb *tp); void tcp_log_flowend(struct tcpcb *tp); +#else /* !TCP_BLACKBOX */ +#define tcp_log_verbose (false) + +static inline struct tcp_log_buffer * +tcp_log_event_(struct tcpcb *tp, struct tcphdr *th, struct sockbuf *rxbuf, + struct sockbuf *txbuf, uint8_t eventid, int errornum, uint32_t len, + union tcp_log_stackspecific *stackinfo, int th_hostorder, + const char *output_caller, const char *func, int line, + const struct timeval *tv) +{ + + return (NULL); +} +#endif /* TCP_BLACKBOX */ #endif /* _KERNEL */ #endif /* __tcp_log_buf_h__ */ Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/netinet/tcp_subr.c Sat Mar 24 12:48:10 2018 (r331485) @@ -848,8 +848,10 @@ tcp_init(void) /* Setup the tcp function block list */ init_tcp_functions(); register_tcp_functions(&tcp_def_funcblk, M_WAITOK); +#ifdef TCP_BLACKBOX /* Initialize the TCP logging data. */ tcp_log_init(); +#endif if (tcp_soreceive_stream) { #ifdef INET @@ -1431,8 +1433,10 @@ tcp_newtcpcb(struct inpcb *inp) */ tcp_pcap_tcpcb_init(tp); #endif +#ifdef TCP_BLACKBOX /* Initialize the per-TCPCB log data. */ tcp_log_tcpcbinit(tp); +#endif if (tp->t_fb->tfb_tcp_fb_init) { (*tp->t_fb->tfb_tcp_fb_init)(tp); } @@ -1650,7 +1654,9 @@ tcp_discardcb(struct tcpcb *tp) inp->inp_ppcb = NULL; if (tp->t_timers->tt_draincnt == 0) { /* We own the last reference on tcpcb, let's free it. */ +#ifdef TCP_BLACKBOX tcp_log_tcpcbfini(tp); +#endif TCPSTATES_DEC(tp->t_state); if (tp->t_fb->tfb_tcp_fb_fini) (*tp->t_fb->tfb_tcp_fb_fini)(tp, 1); @@ -1681,7 +1687,9 @@ tcp_timer_discard(void *ptp) tp->t_timers->tt_draincnt--; if (tp->t_timers->tt_draincnt == 0) { /* We own the last reference on this tcpcb, let's free it. */ +#ifdef TCP_BLACKBOX tcp_log_tcpcbfini(tp); +#endif TCPSTATES_DEC(tp->t_state); if (tp->t_fb->tfb_tcp_fb_fini) (*tp->t_fb->tfb_tcp_fb_fini)(tp, 1); @@ -1775,7 +1783,9 @@ tcp_drain(void) if ((tcpb = intotcpcb(inpb)) != NULL) { tcp_reass_flush(tcpb); tcp_clean_sackreport(tcpb); +#ifdef TCP_BLACKBOX tcp_log_drain(tcpb); +#endif #ifdef TCPPCAP if (tcp_pcap_aggressive_free) { /* Free the TCP PCAP queues. */ @@ -2957,7 +2967,9 @@ tcp_inptoxtp(const struct inpcb *inp, struct xtcpcb *x bcopy(tp->t_fb->tfb_tcp_block_name, xt->xt_stack, TCP_FUNCTION_NAME_LEN_MAX); bzero(xt->xt_logid, TCP_LOG_ID_LEN); +#ifdef TCP_BLACKBOX (void)tcp_log_get_id(tp, xt->xt_logid); +#endif } xt->xt_len = sizeof(struct xtcpcb); Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Sat Mar 24 12:43:34 2018 (r331484) +++ head/sys/netinet/tcp_usrreq.c Sat Mar 24 12:48:10 2018 (r331485) @@ -1837,6 +1837,7 @@ unlock_and_done: goto unlock_and_done; } +#ifdef TCP_BLACKBOX case TCP_LOG: INP_WUNLOCK(inp); error = sooptcopyin(sopt, &optval, sizeof optval, @@ -1885,6 +1886,7 @@ unlock_and_done: */ } break; +#endif default: INP_WUNLOCK(inp); @@ -1971,6 +1973,7 @@ unlock_and_done: INP_WUNLOCK(inp); error = sooptcopyout(sopt, &optval, sizeof optval); break; +#ifdef TCP_BLACKBOX case TCP_LOG: optval = tp->t_logstate; INP_WUNLOCK(inp); @@ -1990,6 +1993,7 @@ unlock_and_done: INP_WUNLOCK(inp); error = EINVAL; break; +#endif default: INP_WUNLOCK(inp); error = ENOPROTOOPT; From owner-svn-src-head@freebsd.org Sat Mar 24 12:51:22 2018 Return-Path: Delivered-To: svn-src-head@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 E86F5F6B097; Sat, 24 Mar 2018 12:51:21 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: from mail-wr0-x22c.google.com (mail-wr0-x22c.google.com [IPv6:2a00:1450:400c:c0c::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C6026A54F; Sat, 24 Mar 2018 12:51:21 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: by mail-wr0-x22c.google.com with SMTP id d10so14607295wrf.3; Sat, 24 Mar 2018 05:51:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0SEQ3RsZF7YuEqvq6G3LlHfNeBrCDew44CCDXX+t754=; b=rB9K+L16EufaSgHPe0bC9Ff5Ikty2N24585c6EkIy990A08upmlIc0S07f0ek/vYPn sKmBzy5rWFM4E3Bvk18S/22KD3F2V9CaihEkWmzOKDKpAE4pI3+9VZdHD+/Wahb5hY3F Qx/qlSOqUwVyvWUmHJYgYyYlKuJe0Ipzeph5uzI8V5PJ5zxfye6cbYw1dT3IGdIVbEwx WaFfyjlyJcsghQBynXA/rtXieNfRoCK2wd9GDmTjE07kOAW0jC/WPz3DvROqhTIv41Jy /NCAQjrGInmWu1N1gn+KhvxHjB7++FUtY2/npV+WugLjCJpbNXh6LQVBL9SFUj4Lj0ED 0e6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0SEQ3RsZF7YuEqvq6G3LlHfNeBrCDew44CCDXX+t754=; b=p2MntvCj1ytUwmi4rK3v8Fb64afDXvLjHi6OWfY4cS+zBaOnBSnA7KGzJIkUHIizU3 wgt1Ov4b9p5gHNbzHYaDaSAVGdTD9hm7Yint+8exxJS+9UPcGCOQqDBEt5e6gPzgQtsT OBElD+WZ2jKGPMlEGfjnNg0rO0WdxE8LRFI3hx6J+PhflO6NX8+jE4cKdNMWWdX3FO+U 8saWvEcpYBlXYVmeLeVubDghKyMu+BYYqUOOOgHE1OzXbWx3xKwitTWb8xQOazYd8N1h 9sr3Ld/CZazy4IBkl2OHUFqtNO7hKrEccTivp3oWI94obqPCgGrPxNPYlgl1vG+YQS7U 6Bkw== X-Gm-Message-State: AElRT7HcujgMj+noAmqLURV29vwxnc4036hkdbZqZzxGmfITwGEuBTbd 3bZvfW2chzUTgDMIAb7goaHJ63CLNzpGiPBJoEE= X-Google-Smtp-Source: AG47ELvAmsn+/S9uQRRviTKzRmP15yqRTEdrDQbwJOqggOuxJjFZwVwYVduGDJbCCtVC7uqmDS1QkuEGwicaKIFGJqA= X-Received: by 10.223.184.219 with SMTP id c27mr27873955wrg.30.1521895880264; Sat, 24 Mar 2018 05:51:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.192.2 with HTTP; Sat, 24 Mar 2018 05:51:19 -0700 (PDT) In-Reply-To: References: <201803220940.w2M9e8T4067719@repo.freebsd.org> <20180322141606.GA4972@bsdpad.com> <20180322142225.GA5139@bsdpad.com> <27fbc131-990b-0b4b-1a90-ab84c2162e0e@FreeBSD.org> From: Jonathan Looney Date: Sat, 24 Mar 2018 12:51:19 +0000 Message-ID: Subject: Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat To: Justin Hibbits Cc: Andriy Gapon , Ruslan Bukin , "Jonathan T. Looney" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 12:51:22 -0000 Compilation should be fixed as of r331483. I also made this an optional feature in r331485. If you find more problems, please let me know. Jonathan From owner-svn-src-head@freebsd.org Sat Mar 24 12:57:59 2018 Return-Path: Delivered-To: svn-src-head@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 4577BF6B662; Sat, 24 Mar 2018 12:57:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 E6C446A96D; Sat, 24 Mar 2018 12:57:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD4AC7770; Sat, 24 Mar 2018 12:57:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OCvwKu018534; Sat, 24 Mar 2018 12:57:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OCvwwT018532; Sat, 24 Mar 2018 12:57:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803241257.w2OCvwwT018532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Mar 2018 12:57:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331486 - head/sys/amd64/ia32 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/ia32 X-SVN-Commit-Revision: 331486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 12:57:59 -0000 Author: kib Date: Sat Mar 24 12:57:58 2018 New Revision: 331486 URL: https://svnweb.freebsd.org/changeset/base/331486 Log: Improve the lcall $7,$0 syscall emulation on amd64. Current code, which copies the potential syscall arguments into the current frame, puts an arbitrary limit on the number of syscall arguments. Apparently, mmap(2) and lseek(2) (?) require larger number. But there is an issue that stack is only need to be mapped to contain the number of arguments required by the syscall, so copying arbitrary large number of words from the stack is not completely safe. Use different approach to convert lcall frame into int $0x80 frame in place, by doing the retl in kernel. This also allows to stop proceed vfork case specially, and stop making assumptions about %cs at the syscall time. Also, improve comments with the formulations provided by bde. Reviewed and tested by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/ia32/ia32_sigtramp.S head/sys/amd64/ia32/ia32_syscall.c Modified: head/sys/amd64/ia32/ia32_sigtramp.S ============================================================================== --- head/sys/amd64/ia32/ia32_sigtramp.S Sat Mar 24 12:48:10 2018 (r331485) +++ head/sys/amd64/ia32/ia32_sigtramp.S Sat Mar 24 12:57:58 2018 (r331486) @@ -78,44 +78,23 @@ ia32_osigcode: 1: jmp 1b - /* - * The lcall $7,$0 emulator cannot use the call gate that does an - * inter-privilege transition. The reason is that the call gate - * does not disable interrupts, and, before the swapgs is - * executed, we would have a window where the ring 0 code is - * executed with the wrong gsbase. + * Our lcall $7,$0 handler remains in user mode (ring 3), since lcalls + * don't change the interrupt mask, so if this one went directly to the + * kernel then there would be a window with interrupts enabled in kernel + * mode, and all interrupt handlers would have to be almost as complicated + * as the NMI handler to support this. * - * Instead, set LDT descriptor 0 as code segment, which reflects - * the lcall $7,$0 back to ring 3 trampoline. The trampoline sets up - * the frame for int $0x80. + * Instead, convert the lcall to an int0x80 call. The kernel does most + * of the conversion by popping the lcall return values off the user + * stack and returning to them instead of to here, except when the + * conversion itself fails. Adjusting the stack here is impossible for + * vfork() and harder for other syscalls. */ ALIGN_TEXT lcall_tramp: - cmpl $SYS_vfork,%eax - je 1f - pushl %ebp - movl %esp,%ebp - pushl 0x24(%ebp) /* arg 6 */ - pushl 0x20(%ebp) - pushl 0x1c(%ebp) - pushl 0x18(%ebp) - pushl 0x14(%ebp) - pushl 0x10(%ebp) /* arg 1 */ - subl $4,%esp /* gap */ int $0x80 - leavel - lretl -1: - /* - * vfork handling is special and relies on the libc stub saving - * the return ip in %ecx. Also, we assume that the call was done - * with ucode32 selector in %cs. - */ - int $0x80 - movl $0x33,4(%esp) /* GUCODE32_SEL | SEL_UPL */ - movl %ecx,(%esp) - lretl +1: jmp 1b #endif ALIGN_TEXT Modified: head/sys/amd64/ia32/ia32_syscall.c ============================================================================== --- head/sys/amd64/ia32/ia32_syscall.c Sat Mar 24 12:48:10 2018 (r331485) +++ head/sys/amd64/ia32/ia32_syscall.c Sat Mar 24 12:57:58 2018 (r331486) @@ -116,10 +116,38 @@ ia32_fetch_syscall_args(struct thread *td) caddr_t params; u_int32_t args[8], tmp; int error, i; +#ifdef COMPAT_43 + u_int32_t eip; + int cs; +#endif p = td->td_proc; frame = td->td_frame; sa = &td->td_sa; + +#ifdef COMPAT_43 + if (__predict_false(frame->tf_cs == 7 && frame->tf_rip == 2)) { + /* + * In lcall $7,$0 after int $0x80. Convert the user + * frame to what it would be for a direct int 0x80 instead + * of lcall $7,$0, by popping the lcall return address. + */ + error = fueword32((void *)frame->tf_rsp, &eip); + if (error == -1) + return (EFAULT); + cs = fuword16((void *)(frame->tf_rsp + sizeof(u_int32_t))); + if (cs == -1) + return (EFAULT); + + /* + * Unwind in-kernel frame after all stack frame pieces + * were successfully read. + */ + frame->tf_rip = eip; + frame->tf_cs = cs; + frame->tf_rsp += 2 * sizeof(u_int32_t); + } +#endif params = (caddr_t)frame->tf_rsp + sizeof(u_int32_t); sa->code = frame->tf_rax; From owner-svn-src-head@freebsd.org Sat Mar 24 13:13:53 2018 Return-Path: Delivered-To: svn-src-head@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 2B6D2F6C97D; Sat, 24 Mar 2018 13:13:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 D39946B439; Sat, 24 Mar 2018 13:13:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3E037AC2; Sat, 24 Mar 2018 13:13:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2ODDq8D028460; Sat, 24 Mar 2018 13:13:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ODDq3a028459; Sat, 24 Mar 2018 13:13:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803241313.w2ODDq3a028459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Mar 2018 13:13:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331487 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 331487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 13:13:53 -0000 Author: kib Date: Sat Mar 24 13:13:52 2018 New Revision: 331487 URL: https://svnweb.freebsd.org/changeset/base/331487 Log: In vn_io_fault1(), reduce the scope where pagefaults are disabled. Most important for the future use, do not call vm_fault_quick_hold_pages() with disabled pagefaults. Reported and tested by: pho (as part of the larger patch) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sat Mar 24 12:57:58 2018 (r331486) +++ head/sys/kern/vfs_vnops.c Sat Mar 24 13:13:52 2018 (r331487) @@ -956,23 +956,30 @@ static int vn_io_fault_doio(struct vn_io_fault_args *args, struct uio *uio, struct thread *td) { + int error, save; + error = 0; + save = vm_fault_disable_pagefaults(); switch (args->kind) { case VN_IO_FAULT_FOP: - return ((args->args.fop_args.doio)(args->args.fop_args.fp, - uio, args->cred, args->flags, td)); + error = (args->args.fop_args.doio)(args->args.fop_args.fp, + uio, args->cred, args->flags, td); + break; case VN_IO_FAULT_VOP: if (uio->uio_rw == UIO_READ) { - return (VOP_READ(args->args.vop_args.vp, uio, - args->flags, args->cred)); + error = VOP_READ(args->args.vop_args.vp, uio, + args->flags, args->cred); } else if (uio->uio_rw == UIO_WRITE) { - return (VOP_WRITE(args->args.vop_args.vp, uio, - args->flags, args->cred)); + error = VOP_WRITE(args->args.vop_args.vp, uio, + args->flags, args->cred); } break; + default: + panic("vn_io_fault_doio: unknown kind of io %d %d", + args->kind, uio->uio_rw); } - panic("vn_io_fault_doio: unknown kind of io %d %d", args->kind, - uio->uio_rw); + vm_fault_enable_pagefaults(save); + return (error); } static int @@ -1047,7 +1054,7 @@ vn_io_fault1(struct vnode *vp, struct uio *uio, struct vm_offset_t addr, end; size_t len, resid; ssize_t adv; - int error, cnt, save, saveheld, prev_td_ma_cnt; + int error, cnt, saveheld, prev_td_ma_cnt; if (vn_io_fault_prefault) { error = vn_io_fault_prefault_user(uio); @@ -1073,7 +1080,6 @@ vn_io_fault1(struct vnode *vp, struct uio *uio, struct short_uio.uio_rw = uio->uio_rw; short_uio.uio_td = uio->uio_td; - save = vm_fault_disable_pagefaults(); error = vn_io_fault_doio(args, uio, td); if (error != EFAULT) goto out; @@ -1144,7 +1150,6 @@ vn_io_fault1(struct vnode *vp, struct uio *uio, struct td->td_ma_cnt = prev_td_ma_cnt; curthread_pflags_restore(saveheld); out: - vm_fault_enable_pagefaults(save); free(uio_clone, M_IOV); return (error); } From owner-svn-src-head@freebsd.org Sat Mar 24 13:18:09 2018 Return-Path: Delivered-To: svn-src-head@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 C3E05F6CF44; Sat, 24 Mar 2018 13:18:09 +0000 (UTC) (envelope-from jtl@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 748766B7F0; Sat, 24 Mar 2018 13:18:09 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6F5C37AD7; Sat, 24 Mar 2018 13:18:09 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2ODI9J3028765; Sat, 24 Mar 2018 13:18:09 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ODI9qT028764; Sat, 24 Mar 2018 13:18:09 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201803241318.w2ODI9qT028764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Sat, 24 Mar 2018 13:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331488 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 331488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 13:18:10 -0000 Author: jtl Date: Sat Mar 24 13:18:09 2018 New Revision: 331488 URL: https://svnweb.freebsd.org/changeset/base/331488 Log: This change adds a flag to the DAD entry to indicate whether it is currently on the queue. This prevents accidentally doubly-removing a DAD entry from the queue, while also simplifying some of the logic in nd6_dad_stop(). Reviewed by: ae, hrs, vangyzen MFC after: 2 weeks Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D10943 Modified: head/sys/netinet6/nd6_nbr.c Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Sat Mar 24 13:13:52 2018 (r331487) +++ head/sys/netinet6/nd6_nbr.c Sat Mar 24 13:18:09 2018 (r331488) @@ -1120,6 +1120,7 @@ struct dadq { #define ND_OPT_NONCE_LEN32 \ ((ND_OPT_NONCE_LEN + sizeof(uint32_t) - 1)/sizeof(uint32_t)) uint32_t dad_nonce[ND_OPT_NONCE_LEN32]; + bool dad_ondadq; /* on dadq? Protected by DADQ_WLOCK. */ }; static VNET_DEFINE(TAILQ_HEAD(, dadq), dadq); @@ -1138,6 +1139,7 @@ nd6_dad_add(struct dadq *dp) DADQ_WLOCK(); TAILQ_INSERT_TAIL(&V_dadq, dp, dad_list); + dp->dad_ondadq = true; DADQ_WUNLOCK(); } @@ -1146,9 +1148,17 @@ nd6_dad_del(struct dadq *dp) { DADQ_WLOCK(); - TAILQ_REMOVE(&V_dadq, dp, dad_list); - DADQ_WUNLOCK(); - nd6_dad_rele(dp); + if (dp->dad_ondadq) { + /* + * Remove dp from the dadq and release the dadq's + * reference. + */ + TAILQ_REMOVE(&V_dadq, dp, dad_list); + dp->dad_ondadq = false; + DADQ_WUNLOCK(); + nd6_dad_rele(dp); + } else + DADQ_WUNLOCK(); } static struct dadq * @@ -1281,6 +1291,8 @@ nd6_dad_start(struct ifaddr *ifa, int delay) dp->dad_ns_icount = dp->dad_na_icount = 0; dp->dad_ns_ocount = dp->dad_ns_tcount = 0; dp->dad_ns_lcount = dp->dad_loopbackprobe = 0; + + /* Add this to the dadq and add a reference for the dadq. */ refcount_init(&dp->dad_refcnt, 1); nd6_dad_add(dp); nd6_dad_starttimer(dp, delay, 0); @@ -1301,17 +1313,9 @@ nd6_dad_stop(struct ifaddr *ifa) } nd6_dad_stoptimer(dp); - - /* - * The DAD queue entry may have been removed by nd6_dad_timer() while - * we were waiting for it to stop, so re-do the lookup. - */ - nd6_dad_rele(dp); - dp = nd6_dad_find(ifa, NULL); - if (dp == NULL) - return; - nd6_dad_del(dp); + + /* Release this function's reference, acquired by nd6_dad_find(). */ nd6_dad_rele(dp); } From owner-svn-src-head@freebsd.org Sat Mar 24 13:48:54 2018 Return-Path: Delivered-To: svn-src-head@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 5CBFDF6EF9D; Sat, 24 Mar 2018 13:48:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 0B2476C81E; Sat, 24 Mar 2018 13:48:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E021F7FD4; Sat, 24 Mar 2018 13:48:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2ODmrmX043384; Sat, 24 Mar 2018 13:48:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ODmrcC043383; Sat, 24 Mar 2018 13:48:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803241348.w2ODmrcC043383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Mar 2018 13:48:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331489 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 331489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 13:48:54 -0000 Author: kib Date: Sat Mar 24 13:48:53 2018 New Revision: 331489 URL: https://svnweb.freebsd.org/changeset/base/331489 Log: For vm_zone_stats() sysctl handler, do not drain sbuf calling copyout(9) while owning zone lock. Despite old value sysctl buffer is wired, spurious faults might still occur. Note that we still own the uma_rwlock there, but this lock does not participate in sensitive lock orders. Reported and tested by: pho (as part of the larger patch) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sat Mar 24 13:18:09 2018 (r331488) +++ head/sys/vm/uma_core.c Sat Mar 24 13:48:53 2018 (r331489) @@ -3692,7 +3692,7 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) { struct uma_stream_header ush; struct uma_type_header uth; - struct uma_percpu_stat ups; + struct uma_percpu_stat *ups; uma_bucket_t bucket; uma_zone_domain_t zdom; struct sbuf sbuf; @@ -3708,6 +3708,7 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) return (error); sbuf_new_for_sysctl(&sbuf, NULL, 128, req); sbuf_clear_flags(&sbuf, SBUF_INCLUDENUL); + ups = malloc((mp_maxid + 1) * sizeof(*ups), M_TEMP, M_WAITOK); count = 0; rw_rlock(&uma_rwlock); @@ -3760,7 +3761,6 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) uth.uth_frees = z->uz_frees; uth.uth_fails = z->uz_fails; uth.uth_sleeps = z->uz_sleeps; - (void)sbuf_bcat(&sbuf, &uth, sizeof(uth)); /* * While it is not normally safe to access the cache * bucket pointers while not on the CPU that owns the @@ -3769,30 +3769,31 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) * accept the possible race associated with bucket * exchange during monitoring. */ - for (i = 0; i < (mp_maxid + 1); i++) { - bzero(&ups, sizeof(ups)); - if (kz->uk_flags & UMA_ZFLAG_INTERNAL) - goto skip; - if (CPU_ABSENT(i)) - goto skip; + for (i = 0; i < mp_maxid + 1; i++) { + bzero(&ups[i], sizeof(*ups)); + if (kz->uk_flags & UMA_ZFLAG_INTERNAL || + CPU_ABSENT(i)) + continue; cache = &z->uz_cpu[i]; if (cache->uc_allocbucket != NULL) - ups.ups_cache_free += + ups[i].ups_cache_free += cache->uc_allocbucket->ub_cnt; if (cache->uc_freebucket != NULL) - ups.ups_cache_free += + ups[i].ups_cache_free += cache->uc_freebucket->ub_cnt; - ups.ups_allocs = cache->uc_allocs; - ups.ups_frees = cache->uc_frees; -skip: - (void)sbuf_bcat(&sbuf, &ups, sizeof(ups)); + ups[i].ups_allocs = cache->uc_allocs; + ups[i].ups_frees = cache->uc_frees; } ZONE_UNLOCK(z); + (void)sbuf_bcat(&sbuf, &uth, sizeof(uth)); + for (i = 0; i < mp_maxid + 1; i++) + (void)sbuf_bcat(&sbuf, &ups[i], sizeof(ups[i])); } } rw_runlock(&uma_rwlock); error = sbuf_finish(&sbuf); sbuf_delete(&sbuf); + free(ups, M_TEMP); return (error); } From owner-svn-src-head@freebsd.org Sat Mar 24 13:51:28 2018 Return-Path: Delivered-To: svn-src-head@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 36DC6F6F32A; Sat, 24 Mar 2018 13:51:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 E15316CA7A; Sat, 24 Mar 2018 13:51:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC1691001A; Sat, 24 Mar 2018 13:51:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2ODpRBt045220; Sat, 24 Mar 2018 13:51:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ODpRdw045216; Sat, 24 Mar 2018 13:51:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803241351.w2ODpRdw045216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Mar 2018 13:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331490 - in head/sys: kern sys vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: kern sys vm X-SVN-Commit-Revision: 331490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 13:51:28 -0000 Author: kib Date: Sat Mar 24 13:51:27 2018 New Revision: 331490 URL: https://svnweb.freebsd.org/changeset/base/331490 Log: Account the size of the vslock-ed memory by the thread. Assert that all such memory is unwired on return to usermode. The count of the wired memory will be used to detect the copyout mode. Tested by: pho (as part of the larger patch) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_thread.c head/sys/kern/subr_trap.c head/sys/sys/proc.h head/sys/vm/vm_glue.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Sat Mar 24 13:48:53 2018 (r331489) +++ head/sys/kern/kern_thread.c Sat Mar 24 13:51:27 2018 (r331490) @@ -81,9 +81,9 @@ _Static_assert(offsetof(struct thread, td_flags) == 0x "struct thread KBI td_flags"); _Static_assert(offsetof(struct thread, td_pflags) == 0x104, "struct thread KBI td_pflags"); -_Static_assert(offsetof(struct thread, td_frame) == 0x468, +_Static_assert(offsetof(struct thread, td_frame) == 0x470, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x510, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x518, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0xb0, "struct proc KBI p_flag"); @@ -101,9 +101,9 @@ _Static_assert(offsetof(struct thread, td_flags) == 0x "struct thread KBI td_flags"); _Static_assert(offsetof(struct thread, td_pflags) == 0xa0, "struct thread KBI td_pflags"); -_Static_assert(offsetof(struct thread, td_frame) == 0x2e4, +_Static_assert(offsetof(struct thread, td_frame) == 0x2e8, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x330, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x334, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0x68, "struct proc KBI p_flag"); Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Sat Mar 24 13:48:53 2018 (r331489) +++ head/sys/kern/subr_trap.c Sat Mar 24 13:51:27 2018 (r331490) @@ -178,6 +178,8 @@ userret(struct thread *td, struct trapframe *frame) ("userret: Returning with stop signals deferred")); KASSERT(td->td_su == NULL, ("userret: Returning with SU cleanup request not handled")); + KASSERT(td->td_vslock_sz == 0, + ("userret: Returning with vslock-wired space")); #ifdef VIMAGE /* Unfortunately td_vnet_lpush needs VNET_DEBUG. */ VNET_ASSERT(curvnet == NULL, Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Sat Mar 24 13:48:53 2018 (r331489) +++ head/sys/sys/proc.h Sat Mar 24 13:51:27 2018 (r331490) @@ -297,6 +297,7 @@ struct thread { void *td_su; /* (k) FFS SU private */ sbintime_t td_sleeptimo; /* (t) Sleep timeout. */ int td_rtcgen; /* (s) rtc_generation of abs. sleep */ + size_t td_vslock_sz; /* (k) amount of vslock-ed space */ #define td_endzero td_sigmask /* Copied during fork1() or create_thread(). */ Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Sat Mar 24 13:48:53 2018 (r331489) +++ head/sys/vm/vm_glue.c Sat Mar 24 13:51:27 2018 (r331490) @@ -196,11 +196,16 @@ vslock(void *addr, size_t len) #endif error = vm_map_wire(&curproc->p_vmspace->vm_map, start, end, VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); + if (error == KERN_SUCCESS) { + curthread->td_vslock_sz += len; + return (0); + } + /* * Return EFAULT on error to match copy{in,out}() behaviour * rather than returning ENOMEM like mlock() would. */ - return (error == KERN_SUCCESS ? 0 : EFAULT); + return (EFAULT); } void @@ -208,6 +213,8 @@ vsunlock(void *addr, size_t len) { /* Rely on the parameter sanity checks performed by vslock(). */ + MPASS(curthread->td_vslock_sz >= len); + curthread->td_vslock_sz -= len; (void)vm_map_unwire(&curproc->p_vmspace->vm_map, trunc_page((vm_offset_t)addr), round_page((vm_offset_t)addr + len), VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); From owner-svn-src-head@freebsd.org Sat Mar 24 14:43:49 2018 Return-Path: Delivered-To: svn-src-head@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 0D8F5F4FF15; Sat, 24 Mar 2018 14:43:49 +0000 (UTC) (envelope-from idefix@fechner.net) Received: from anny.lostinspace.de (anny.lostinspace.de [195.30.95.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 984EA6FB44; Sat, 24 Mar 2018 14:43:48 +0000 (UTC) (envelope-from idefix@fechner.net) Received: from server.idefix.lan (unknown [IPv6:2a01:5c0:1b:2d41:21b:21ff:fe7b:3468]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: idefix@fechner.net) by anny.lostinspace.de (Postfix) with ESMTPSA id 45D4310DDDFE; Sat, 24 Mar 2018 15:43:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fechner.net; s=default; t=1521902620; bh=dC70Gx2lRLy8SLLLcp9ZSQq8h4tBZQPyq82Aa9A73PI=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=aqrg2a04C19dsyYuiM9wqWt+uDFIxUHRKQTWj5qKhl2Ei7jrtbBWHwJww9+txAFmD tKOgusaQQjltDhkqrUWPnxlI1G9+rKjrviIVTJRSLfyCcGtRFbLU9V3sd6rO2JxZo2 ctGjG8V7mkB5ylh8DsaYc9aIYlfyq/weRGn5UByE= Received: from [192.168.0.151] (070-139-067-156.ip-addr.inexio.net [156.67.139.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by server.idefix.lan (Postfix) with ESMTPSA id 702BA1492FB0; Sat, 24 Mar 2018 15:43:39 +0100 (CET) Subject: Re: svn commit: r331482 - head/share/misc To: rgrimes@freebsd.org, Matthias Fechner Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803240937.w2O9boF2035461@pdx.rh.CN85.dnsmgr.net> From: Matthias Fechner Message-ID: <3ed9375d-bc97-0aad-c8a9-91bcb4f7d1e4@fechner.net> Date: Sat, 24 Mar 2018 15:43:27 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <201803240937.w2O9boF2035461@pdx.rh.CN85.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 14:43:49 -0000 Dear Rodney, Am 24.03.2018 um 10:37 schrieb Rodney W. Grimes: >> Author: mfechner (ports committer) >> Date: Sat Mar 24 09:10:50 2018 >> New Revision: 331482 >> URL: https://svnweb.freebsd.org/changeset/base/331482 >> >> Log: >> Added myself to committers-ports.dot. >> >> Reviewed by: tz (mentor) >> Approved by: tz (mentor) >> Differential Revision: https://reviews.freebsd.org/40631 > Url not found? sry, I think I copied out a wrong id here, here is the correct URL: https://reviews.freebsd.org/D14806 Gruß Matthias -- "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning." -- Rich Cook From owner-svn-src-head@freebsd.org Sat Mar 24 14:53:49 2018 Return-Path: Delivered-To: svn-src-head@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 291D6F50FEA; Sat, 24 Mar 2018 14:53:49 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A92C70344; Sat, 24 Mar 2018 14:53:48 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w2OErXXi036849; Sat, 24 Mar 2018 07:53:33 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w2OErX3x036848; Sat, 24 Mar 2018 07:53:33 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201803241453.w2OErX3x036848@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r331482 - head/share/misc In-Reply-To: <3ed9375d-bc97-0aad-c8a9-91bcb4f7d1e4@fechner.net> To: Matthias Fechner Date: Sat, 24 Mar 2018 07:53:33 -0700 (PDT) CC: rgrimes@freebsd.org, Matthias Fechner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 14:53:49 -0000 [ Charset UTF-8 unsupported, converting... ] > Dear Rodney, > > Am 24.03.2018 um 10:37 schrieb Rodney W. Grimes: > >> Author: mfechner (ports committer) > >> Date: Sat Mar 24 09:10:50 2018 > >> New Revision: 331482 > >> URL: https://svnweb.freebsd.org/changeset/base/331482 > >> > >> Log: > >> Added myself to committers-ports.dot. > >> > >> Reviewed by: tz (mentor) > >> Approved by: tz (mentor) > >> Differential Revision: https://reviews.freebsd.org/40631 > > Url not found? > > sry, I think I copied out a wrong id here, here is the correct URL: > https://reviews.freebsd.org/D14806 Thank you. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Mar 24 15:36:26 2018 Return-Path: Delivered-To: svn-src-head@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 3601CF5491D; Sat, 24 Mar 2018 15:36:26 +0000 (UTC) (envelope-from mckusick@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 DFFE571D61; Sat, 24 Mar 2018 15:36:25 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 DA6141121A; Sat, 24 Mar 2018 15:36:25 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OFaP9Q098075; Sat, 24 Mar 2018 15:36:25 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OFaPkw098073; Sat, 24 Mar 2018 15:36:25 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201803241536.w2OFaPkw098073@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sat, 24 Mar 2018 15:36:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331491 - in head/sys/geom: journal label X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in head/sys/geom: journal label X-SVN-Commit-Revision: 331491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 15:36:26 -0000 Author: mckusick Date: Sat Mar 24 15:36:25 2018 New Revision: 331491 URL: https://svnweb.freebsd.org/changeset/base/331491 Log: When freeing a superblock returned by ffs_sbget, be sure to also free the superblock summary information. Reported by: Peter Holm (pho@) Tested by: Peter Holm (pho@) Modified: head/sys/geom/journal/g_journal_ufs.c head/sys/geom/label/g_label_ufs.c Modified: head/sys/geom/journal/g_journal_ufs.c ============================================================================== --- head/sys/geom/journal/g_journal_ufs.c Sat Mar 24 13:51:27 2018 (r331490) +++ head/sys/geom/journal/g_journal_ufs.c Sat Mar 24 15:36:25 2018 (r331491) @@ -83,6 +83,7 @@ g_journal_ufs_dirty(struct g_consumer *cp) fs->fs_clean = 0; fs->fs_flags |= FS_NEEDSFSCK | FS_UNCLEAN; error = ffs_sbput(cp, fs, fs->fs_sblockloc, g_use_g_write_data); + g_free(fs->fs_csp); g_free(fs); if (error != 0) { GJ_DEBUG(0, "Cannot mark file system %s as dirty " Modified: head/sys/geom/label/g_label_ufs.c ============================================================================== --- head/sys/geom/label/g_label_ufs.c Sat Mar 24 13:51:27 2018 (r331490) +++ head/sys/geom/label/g_label_ufs.c Sat Mar 24 15:36:25 2018 (r331491) @@ -103,8 +103,7 @@ g_label_ufs_taste_common(struct g_consumer *cp, char * || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { /* Valid UFS2. */ } else { - g_free(fs); - return; + goto out; } G_LABEL_DEBUG(1, "%s file system detected on %s.", fs->fs_magic == FS_UFS1_MAGIC ? "UFS1" : "UFS2", pp->name); @@ -120,6 +119,8 @@ g_label_ufs_taste_common(struct g_consumer *cp, char * fs->fs_id[1]); break; } +out: + g_free(fs->fs_csp); g_free(fs); } From owner-svn-src-head@freebsd.org Sat Mar 24 21:30:26 2018 Return-Path: Delivered-To: svn-src-head@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 BA4C5F4AE47; Sat, 24 Mar 2018 21:30:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 5F64380B46; Sat, 24 Mar 2018 21:30:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58BDB14C3C; Sat, 24 Mar 2018 21:30:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OLUPZV076715; Sat, 24 Mar 2018 21:30:25 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OLUOx0076707; Sat, 24 Mar 2018 21:30:24 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201803242130.w2OLUOx0076707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 24 Mar 2018 21:30:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331499 - in head: share/mk sys/arm/conf sys/conf sys/dts sys/dts/arm/overlays sys/modules/dtb/overlays sys/tools/fdt X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head: share/mk sys/arm/conf sys/conf sys/dts sys/dts/arm/overlays sys/modules/dtb/overlays sys/tools/fdt X-SVN-Commit-Revision: 331499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 21:30:26 -0000 Author: manu Date: Sat Mar 24 21:30:24 2018 New Revision: 331499 URL: https://svnweb.freebsd.org/changeset/base/331499 Log: Add dtb overlays support DTB Overlays are useful to change/add nodes to a dtb without the need to modify it. Add support for building dtbo during buildkernel. The goal of DTBO present in the FreeBSD source tree is to fill a gap in time when we submit changes upstream (Linux). Instead of waiting 2 to 4 months we can add a DTBO in tree in the meantime. This is not for adding DTBO for capes/hat/addon boards, those will be better to put in a ports. This is also not for enabling a i2c/spi/pwm controller on certain pins, each user have a different use case for those (which pins to use etc ...) and we cannot have all possible configuration. Add a dtbo for sun8i-h3-sid which add the SID node missing in upstream dts. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D14782 Added: head/sys/dts/arm/overlays/ head/sys/dts/arm/overlays/Makefile (contents, props changed) head/sys/dts/arm/overlays/sun8i-h3-sid.dtso (contents, props changed) head/sys/modules/dtb/overlays/ head/sys/modules/dtb/overlays/Makefile (contents, props changed) head/sys/tools/fdt/make_dtbo.sh (contents, props changed) Modified: head/share/mk/bsd.own.mk head/sys/arm/conf/GENERIC head/sys/conf/dtb.mk head/sys/dts/Makefile.inc Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Sat Mar 24 21:27:10 2018 (r331498) +++ head/share/mk/bsd.own.mk Sat Mar 24 21:30:24 2018 (r331499) @@ -146,6 +146,7 @@ KMODOWN?= ${BINOWN} KMODGRP?= ${BINGRP} KMODMODE?= ${BINMODE} DTBDIR?= /boot/dtb +DTBODIR?= /boot/dtb/overlays DTBOWN?= root DTBGRP?= wheel DTBMODE?= 444 Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Sat Mar 24 21:27:10 2018 (r331498) +++ head/sys/arm/conf/GENERIC Sat Mar 24 21:30:24 2018 (r331499) @@ -246,4 +246,4 @@ options EFI # Flattened Device Tree options FDT # Configure using FDT/DTB data -makeoptions MODULES_EXTRA="dtb/allwinner dtb/am335x dtb/imx6 dtb/nvidia dtb/rpi dtb/zynq dtb/omap4" +makeoptions MODULES_EXTRA="dtb/allwinner dtb/am335x dtb/imx6 dtb/nvidia dtb/rpi dtb/zynq dtb/omap4 dtb/overlays" Modified: head/sys/conf/dtb.mk ============================================================================== --- head/sys/conf/dtb.mk Sat Mar 24 21:27:10 2018 (r331498) +++ head/sys/conf/dtb.mk Sat Mar 24 21:30:24 2018 (r331499) @@ -45,13 +45,14 @@ SYSDIR= ${_dir:tA} .error "can't find kernel source tree" .endif -.SUFFIXES: .dtb .dts +.SUFFIXES: .dtb .dts .dtbo .dtso -.PATH: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE} +.PATH: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE}/overlays DTB=${DTS:R:S/$/.dtb/} +DTBO=${DTSO:R:S/$/.dtbo/} -all: ${DTB} +all: ${DTB} ${DTBO} .if defined(DTS) .export DTC @@ -63,6 +64,16 @@ CLEANFILES+=${_dts:R:S/$/.dtb/} .endfor .endif +.if defined(DTSO) +.export DTC +.for _dtso in ${DTSO} +${_dtso:R:S/$/.dtbo/}: ${_dtso} ${OP_META} + @echo Generating ${.TARGET} from ${_dtso} + @${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} overlays/${_dtso} ${.OBJDIR} +CLEANFILES+=${_dtso:R:S/$/.dtbo/} +.endfor +.endif + .if !target(install) .if !target(realinstall) realinstall: _dtbinstall @@ -75,6 +86,11 @@ _dtbinstall: .for _dtb in ${DTB} ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/ +.endfor + test -d ${DESTDIR}${DTBODIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} ${DESTDIR}${DTBODIR} +.for _dtbo in ${DTBO} + ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ + ${_INSTALLFLAGS} ${_dtbo} ${DESTDIR}${DTBODIR}/ .endfor .endif # !target(realinstall) .endif # !target(install) Modified: head/sys/dts/Makefile.inc ============================================================================== --- head/sys/dts/Makefile.inc Sat Mar 24 21:27:10 2018 (r331498) +++ head/sys/dts/Makefile.inc Sat Mar 24 21:30:24 2018 (r331499) @@ -6,5 +6,8 @@ test-dts: .for dts in ${DTS} @env MACHINE=`basename ${.CURDIR}` ${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${dts} /tmp -.endfor +test-dtso: +.for dtso in ${DTSO} + @env MACHINE=`basename ${.CURDIR}` ${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} ${dtso} /tmp +.endfor Added: head/sys/dts/arm/overlays/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dts/arm/overlays/Makefile Sat Mar 24 21:30:24 2018 (r331499) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +DTSO!=ls *.dtso + +all: test-dtso + +.include Added: head/sys/dts/arm/overlays/sun8i-h3-sid.dtso ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dts/arm/overlays/sun8i-h3-sid.dtso Sat Mar 24 21:30:24 2018 (r331499) @@ -0,0 +1,18 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "allwinner,sun8i-h3"; + + fragment@0 { + target-path = "/soc"; + + __overlay__ { + sid: eeprom@1c14000 { + compatible = "allwinner,sun8i-h3-sid"; + reg = <0x1c14000 0x400>; + status = "okay"; + }; + }; + }; +}; Added: head/sys/modules/dtb/overlays/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/dtb/overlays/Makefile Sat Mar 24 21:30:24 2018 (r331499) @@ -0,0 +1,5 @@ +# $FreeBSD$ +# All the dtso files +DTSO= sun8i-h3-sid.dtso + +.include Added: head/sys/tools/fdt/make_dtbo.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/tools/fdt/make_dtbo.sh Sat Mar 24 21:30:24 2018 (r331499) @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $FreeBSD$ + +# Script generates dtbo file ($3) from dtso source ($2) in build tree S ($1) +S=$1 +dtso="$2" +dtbo_path=$3 + +if [ -z "$dtso" ]; then + echo "No DTS overlays specified" + exit 1 +fi + +if [ -z "${MACHINE}" ]; then + MACHINE=$(uname -m) +fi + +: ${DTC:=dtc} + +for d in ${dtso}; do + dtb=${dtbo_path}/`basename $d .dtso`.dtbo + echo "converting $d -> $dtb" + cpp -P -x assembler-with-cpp -I $S/gnu/dts/include -I $S/dts/${MACHINE} -I $S/gnu/dts/${MACHINE} -include $d /dev/null | + ${DTC} -@ -O dtb -o $dtb -i $S/dts/${MACHINE} -i $S/gnu/dts/${MACHINE} +done From owner-svn-src-head@freebsd.org Sat Mar 24 23:58:45 2018 Return-Path: Delivered-To: svn-src-head@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 A1510F58883; Sat, 24 Mar 2018 23:58:45 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 4ECEF86EA1; Sat, 24 Mar 2018 23:58:45 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 499AC164D7; Sat, 24 Mar 2018 23:58:45 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2ONwjpk051362; Sat, 24 Mar 2018 23:58:45 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ONwiuu051354; Sat, 24 Mar 2018 23:58:44 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803242358.w2ONwiuu051354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sat, 24 Mar 2018 23:58:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331508 - in head: lib/libc/sys share/man/man9 usr.bin/cpuset X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head: lib/libc/sys share/man/man9 usr.bin/cpuset X-SVN-Commit-Revision: 331508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 23:58:45 -0000 Author: jeff Date: Sat Mar 24 23:58:44 2018 New Revision: 331508 URL: https://svnweb.freebsd.org/changeset/base/331508 Log: Document new NUMA related syscalls and utility options. Sponsored by: Netflix, Dell/EMC Isilon Modified: head/lib/libc/sys/Makefile.inc head/lib/libc/sys/cpuset.2 head/lib/libc/sys/cpuset_getaffinity.2 head/share/man/man9/Makefile head/share/man/man9/malloc.9 head/share/man/man9/zone.9 head/usr.bin/cpuset/cpuset.1 Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Sat Mar 24 23:26:54 2018 (r331507) +++ head/lib/libc/sys/Makefile.inc Sat Mar 24 23:58:44 2018 (r331508) @@ -174,6 +174,7 @@ MAN+= abort2.2 \ connectat.2 \ cpuset.2 \ cpuset_getaffinity.2 \ + cpuset_getdomain.2 \ dup.2 \ execve.2 \ _exit.2 \ @@ -371,6 +372,7 @@ MLINKS+=nanosleep.2 clock_nanosleep.2 MLINKS+=cpuset.2 cpuset_getid.2 \ cpuset.2 cpuset_setid.2 MLINKS+=cpuset_getaffinity.2 cpuset_setaffinity.2 +MLINKS+=cpuset_getdomain.2 cpuset_setdomain.2 MLINKS+=dup.2 dup2.2 MLINKS+=execve.2 fexecve.2 MLINKS+=extattr_get_file.2 extattr.2 \ Modified: head/lib/libc/sys/cpuset.2 ============================================================================== --- head/lib/libc/sys/cpuset.2 Sat Mar 24 23:26:54 2018 (r331507) +++ head/lib/libc/sys/cpuset.2 Sat Mar 24 23:58:44 2018 (r331508) @@ -48,21 +48,21 @@ The .Nm family of system calls allow applications to control sets of processors and -assign processes and threads to these sets. -Processor sets contain lists of CPUs that members may run on and exist only -as long as some process is a member of the set. +memory domains and assign processes and threads to these sets. +Processor sets contain lists of CPUs and domains that members may run on +and exist only as long as some process is a member of the set. All processes in the system have an assigned set. The default set for all processes in the system is the set numbered 1. Threads belong to the same set as the process which contains them, however, they may further restrict their set with the anonymous -per-thread mask. +per-thread mask to bind to a specific CPU or subset of CPUs and memory domains. .Pp Sets are referenced by a number of type .Ft cpuset_id_t . Each thread has a root set, an assigned set, and an anonymous mask. Only the root and assigned sets are numbered. -The root set is the set of all CPUs available in the system or in the -system partition the thread is running in. +The root set is the set of all CPUs and memory domains available in the system +or in the system partition the thread is running in. The assigned set is a subset of the root set and is administratively assignable on a per-process basis. Many processes and threads may be members of a numbered set. @@ -72,7 +72,8 @@ set. It is intended that administrators will manipulate numbered sets using .Xr cpuset 1 while application developers will manipulate anonymous sets using -.Xr cpuset_setaffinity 2 . +.Xr cpuset_setaffinity 2 and +.Xr cpuset_setdomain 2 . .Pp To select the correct set a value of type .Ft cpulevel_t @@ -175,9 +176,10 @@ with a process or thread is unsupported since this references the unnumbered anonymous mask. .Pp The actual contents of the sets may be retrieved or manipulated using -.Xr cpuset_getaffinity 2 -and -.Xr cpuset_setaffinity 2 . +.Xr cpuset_getaffinity 2 , +.Xr cpuset_setaffinity 2 , +.Xr cpuset_getdomain 2 , and +.Xr cpuset_setdomain 2 . See those manual pages for more detail. .Sh RETURN VALUES .Rv -std @@ -220,6 +222,8 @@ for allocation. .Xr cpuset 1 , .Xr cpuset_getaffinity 2 , .Xr cpuset_setaffinity 2 , +.Xr cpuset_getdomain 2 , +.Xr cpuset_setdomain 2 , .Xr pthread_affinity_np 3 , .Xr pthread_attr_affinity_np 3 , .Xr cpuset 9 Modified: head/lib/libc/sys/cpuset_getaffinity.2 ============================================================================== --- head/lib/libc/sys/cpuset_getaffinity.2 Sat Mar 24 23:26:54 2018 (r331507) +++ head/lib/libc/sys/cpuset_getaffinity.2 Sat Mar 24 23:58:44 2018 (r331508) @@ -160,6 +160,8 @@ See .Xr cpuset 2 , .Xr cpuset_getid 2 , .Xr cpuset_setid 2 , +.Xr cpuset_getdomain 2 , +.Xr cpuset_setdomain 2 , .Xr pthread_affinity_np 3 , .Xr pthread_attr_affinity_np 3 , .Xr cpuset 9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sat Mar 24 23:26:54 2018 (r331507) +++ head/share/man/man9/Makefile Sat Mar 24 23:58:44 2018 (r331508) @@ -1271,6 +1271,8 @@ MLINKS+=make_dev.9 destroy_dev.9 \ make_dev.9 make_dev_p.9 \ make_dev.9 make_dev_s.9 MLINKS+=malloc.9 free.9 \ + malloc.9 malloc_domain.9 \ + malloc.9 free_domain.9 \ malloc.9 mallocarray.9 \ malloc.9 MALLOC_DECLARE.9 \ malloc.9 MALLOC_DEFINE.9 \ @@ -2213,10 +2215,12 @@ MLINKS+=vslock.9 vsunlock.9 MLINKS+=zone.9 uma.9 \ zone.9 uma_zalloc.9 \ zone.9 uma_zalloc_arg.9 \ + zone.9 uma_zalloc_domain.9 \ zone.9 uma_zcreate.9 \ zone.9 uma_zdestroy.9 \ zone.9 uma_zfree.9 \ zone.9 uma_zfree_arg.9 \ + zone.9 uma_zfree_domain.9 \ zone.9 uma_zone_get_cur.9 \ zone.9 uma_zone_get_max.9 \ zone.9 uma_zone_set_max.9 \ Modified: head/share/man/man9/malloc.9 ============================================================================== --- head/share/man/man9/malloc.9 Sat Mar 24 23:26:54 2018 (r331507) +++ head/share/man/man9/malloc.9 Sat Mar 24 23:58:44 2018 (r331508) @@ -46,9 +46,13 @@ .Ft void * .Fn malloc "size_t size" "struct malloc_type *type" "int flags" .Ft void * +.Fn malloc_domain "size_t size" "struct malloc_type *type" "int domain" "int flags" +.Ft void * .Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags" .Ft void .Fn free "void *addr" "struct malloc_type *type" +.Ft void +.Fn free_domain "void *addr" "struct malloc_type *type" .Ft void * .Fn realloc "void *addr" "size_t size" "struct malloc_type *type" "int flags" .Ft void * @@ -64,6 +68,14 @@ The function allocates uninitialized memory in kernel address space for an object whose size is specified by .Fa size . +.Pp +The +.Fn malloc_domain +variant allocates the object from the specified memory domain. Memory allocated +with this function should be returned with +.Fn free_domain . +See +.Xr numa 9 for more details. .Pp The .Fn mallocarray Modified: head/share/man/man9/zone.9 ============================================================================== --- head/share/man/man9/zone.9 Sat Mar 24 23:26:54 2018 (r331507) +++ head/share/man/man9/zone.9 Sat Mar 24 23:58:44 2018 (r331508) @@ -32,8 +32,10 @@ .Nm uma_zcreate , .Nm uma_zalloc , .Nm uma_zalloc_arg , +.Nm uma_zalloc_domain , .Nm uma_zfree , .Nm uma_zfree_arg , +.Nm uma_zfree_domain , .Nm uma_zdestroy , .Nm uma_zone_set_max , .Nm uma_zone_get_max , @@ -55,11 +57,15 @@ .Fn uma_zalloc "uma_zone_t zone" "int flags" .Ft "void *" .Fn uma_zalloc_arg "uma_zone_t zone" "void *arg" "int flags" +.Ft "void *" +.Fn uma_zalloc_domain "uma_zone_t zone" "void *arg" "int domain" "int flags" .Ft void .Fn uma_zfree "uma_zone_t zone" "void *item" .Ft void .Fn uma_zfree_arg "uma_zone_t zone" "void *item" "void *arg" .Ft void +.Fn uma_zfree_domain "uma_zone_t zone" "void *item" "void *arg" +.Ft void .Fn uma_zdestroy "uma_zone_t zone" .Ft int .Fn uma_zone_set_max "uma_zone_t zone" "int nitems" @@ -78,10 +84,13 @@ .Fn SYSCTL_ADD_UMA_CUR ctx parent nbr name access zone descr .Sh DESCRIPTION The zone allocator provides an efficient interface for managing -dynamically-sized collections of items of similar size. +dynamically-sized collections of items of identical size. The zone allocator can work with preallocated zones as well as with runtime-allocated ones, and is therefore available much earlier in the -boot process than other memory management routines. +boot process than other memory management routines. The zone allocator +provides per-cpu allocation caches with linear scalability on SMP +systems as well as round-robin and first-touch policies for NUMA +systems. .Pp A zone is an extensible collection of items of identical size. The zone allocator keeps track of which items are in use and which @@ -209,6 +218,11 @@ The zone is for the subsystem. .It Dv UMA_ZONE_VM The zone is for the VM subsystem. +.It Dv UMA_ZONE_NUMA +The zone should use a first-touch NUMA policy rather than the round-robin +default. Callers that do not free memory on the same domain it is allocated +from will cause mixing in per-cpu caches. See +.Xr numa 9 for more details. .El .Pp To allocate an item from a zone, simply call @@ -243,12 +257,21 @@ The variations .Fn uma_zalloc_arg and .Fn uma_zfree_arg -allow to +allow callers to specify an argument for the .Dv ctor and .Dv dtor functions, respectively. +The +.Fn uma_zalloc_domain +function allows callers to specify a fixed +.Xr numa 9 domain to allocate from. This uses a guaranteed but slow path in +the allocator which reduces concurrency. The +.Fn uma_zfree_domain +function should be used to return memory allocated in this fashion. This +function infers the domain from the pointer and does not require it as an +argument. .Pp Created zones, which are empty, Modified: head/usr.bin/cpuset/cpuset.1 ============================================================================== --- head/usr.bin/cpuset/cpuset.1 Sat Mar 24 23:26:54 2018 (r331507) +++ head/usr.bin/cpuset/cpuset.1 Sat Mar 24 23:58:44 2018 (r331508) @@ -34,20 +34,24 @@ .Sh SYNOPSIS .Nm .Op Fl l Ar cpu-list +.Op Fl n Ar policy:domain-list .Op Fl s Ar setid .Ar cmd ... .Nm .Op Fl l Ar cpu-list +.Op Fl n Ar policy:domain-list .Op Fl s Ar setid .Fl p Ar pid .Nm .Op Fl c .Op Fl l Ar cpu-list +.Op Fl n Ar policy:domain-list .Fl C .Fl p Ar pid .Nm .Op Fl c .Op Fl l Ar cpu-list +.Op Fl n Ar policy:domain-list .Op Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq .Nm .Fl g @@ -57,8 +61,9 @@ The .Nm command can be used to assign processor sets to processes, run commands -constrained to a given set or list of processors, and query information -about processor binding, sets, and available processors in the system. +constrained to a given set or list of processors and memory domains, and query +information about processor binding, memory binding and policy, sets, and +available processors and memory domains in the system. .Pp .Nm requires a target to modify or query. @@ -92,6 +97,15 @@ This last set is the list of all possible CPUs in the queried using .Fl r . .Pp +Most sets include NUMA memory domain and policy information. This can be +inspected with +.Fl g +and set with +.Fl n . +This will specify which NUMA domains are visible to the process and +affect where anonymous memory and file pages will be stored on first access. +Files accessed first by other processes may specify conflicting policy. +.Pp When running a command it may join a set specified with .Fl s otherwise a new set is created. @@ -110,7 +124,8 @@ Create a new cpuset and assign the target process to t The requested operation should reference the cpuset available via the target specifier. .It Fl d Ar domain -Specifies a NUMA domain id as the target of the operation. +Specifies a NUMA domain id as the target of the operation. This can only +be used to query the cpus visible in each numberd domain. .It Fl g Causes .Nm @@ -130,6 +145,13 @@ numbers separated by '-' for ranges and commas separat A special list of .Dq all may be specified in which case the list includes all CPUs from the root set. +.It Fl n Ar domain-list:policy +Specifies a list of domains and allocation policy to apply to a target. Ranges +may be specified as in +.Fl l . +Valid policies include first-touch, ft, round-robin, rr, and prefer. The prefer +policy accepts only a single domain in the set. The parent of the set is +consulted if the preferred domain is unavailable. .It Fl p Ar pid Specifies a pid as the target of the operation. .It Fl s Ar setid