From owner-svn-src-head@freebsd.org Sun Jun 23 00:16:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB6F415BE5DF; Sun, 23 Jun 2019 00:16:20 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F1CE6C3A2; Sun, 23 Jun 2019 00:16:18 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f43.google.com with SMTP id e3so592712ioc.12; Sat, 22 Jun 2019 17:16:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=HuSoddGLS1i4kPG2LBRYp2pxleDet6LQhX5axlGnyrg=; b=uSvb1KPzIJG74Jixx74mFmmkdkY4uKPbwrnp5TO9QRP8vGslM7O6P/W8I6P1nv98lv zcGGru2Li0F3jQGp05O4YD5OXhwOY0FWB2BP2NIL4d71LupcHjR/EC0Ghy0rZhD14lhZ o8/dWbbid9dyTgnWoyTKR7cWm1qEUNrPP4Ic/lQtZDOEh9fVbPfo9sHDy7fi75jGWZ8p eXMyGHXxl4S+gx8bY1vREAQxtDbGsvhseK/gh5BVAX3EqjUSc9QThEMn3uTvBO+LAckJ 05UKjjEknLRigxeXedev7pd2ACwV2mkhMYJHa8Mk5VZkmYg4vFb3HEEr4ODsnmxVEUSs FYYQ== X-Gm-Message-State: APjAAAWpdpktXQzyuDeqHnnV/URh11CAIN371bhHBeq6kyMY7l0HvUR3 LsZU9Ce0uewMeoNxOhW9d0Vw5YuP X-Google-Smtp-Source: APXvYqz0tOg39O2vRwuhiPNgh/AGLl2rm3LwJaUsqAL1d3wYZ4aODcWAzCU5wPHb74EvYuYgoLb3rA== X-Received: by 2002:a5e:9241:: with SMTP id z1mr8905765iop.39.1561248970222; Sat, 22 Jun 2019 17:16:10 -0700 (PDT) Received: from mail-io1-f52.google.com (mail-io1-f52.google.com. [209.85.166.52]) by smtp.gmail.com with ESMTPSA id y18sm8345348iob.64.2019.06.22.17.16.09 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Sat, 22 Jun 2019 17:16:09 -0700 (PDT) Received: by mail-io1-f52.google.com with SMTP id k8so349963iot.1; Sat, 22 Jun 2019 17:16:09 -0700 (PDT) X-Received: by 2002:a6b:6409:: with SMTP id t9mr32603194iog.270.1561248969777; Sat, 22 Jun 2019 17:16:09 -0700 (PDT) MIME-Version: 1.0 References: <201906171949.x5HJn9Ed091108@repo.freebsd.org> In-Reply-To: <201906171949.x5HJn9Ed091108@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Sat, 22 Jun 2019 17:15:59 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r349151 - in head: lib/libufs stand/libsa sys/conf sys/dev/iscsi sys/dev/iscsi_initiator sys/dev/liquidio sys/dev/usb/net sys/fs/ext2fs sys/fs/nandfs sys/geom/part sys/geom/raid sys/ker... To: Xin LI Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 8F1CE6C3A2 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.166.43 as permitted sender) smtp.mailfrom=csecem@gmail.com X-Spamd-Result: default: False [-5.43 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[cem@freebsd.org]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.99)[-0.987,0]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; RCVD_TLS_LAST(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[43.166.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.43)[ip: (-6.34), ipnet: 209.85.128.0/17(-3.44), asn: 15169(-2.33), country: US(-0.06)] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 00:16:20 -0000 Hi Xin Li, On Mon, Jun 17, 2019 at 12:49 PM Xin LI wrote: > > Author: delphij > Date: Mon Jun 17 19:49:08 2019 > New Revision: 349151 > URL: https://svnweb.freebsd.org/changeset/base/349151 > > Log: > Separate kernel crc32() implementation to its own header (gsb_crc32.h) = and > rename the source to gsb_crc32.c. > > This is a prerequisite of unifying kernel zlib instances. > >... > Modified: head/sys/libkern/x86/crc32_sse42.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/libkern/x86/crc32_sse42.c Mon Jun 17 17:35:55 2019 (= r349150) > +++ head/sys/libkern/x86/crc32_sse42.c Mon Jun 17 19:49:08 2019 (= r349151) > @@ -29,14 +29,14 @@ __FBSDID("$FreeBSD$"); > /* > * This file is compiled in userspace in order to run ATF unit tests. > */ > -#ifdef USERSPACE_TESTING > +#ifndef _KERNEL This change and following identical changes revert a request by kib@ in https://reviews.freebsd.org/D9342 . (When this revision was initially proposed in , it was '#ifndef _KERNEL' =E2=80=94 kib@ requested = the use of a different preprocessor macro.) Cheers, Conrad From owner-svn-src-head@freebsd.org Sun Jun 23 04:13:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACB1C15C4D39; Sun, 23 Jun 2019 04:13:15 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A0BB724A0; Sun, 23 Jun 2019 04:13:15 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from odin.corp.delphij.net (c-24-6-173-228.hsd1.ca.comcast.net [24.6.173.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: delphij/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 7F9DC17999; Sun, 23 Jun 2019 04:13:14 +0000 (UTC) (envelope-from delphij@FreeBSD.org) To: cem@freebsd.org Cc: src-committers , svn-src-all , svn-src-head , kib@freebsd.org References: <201906171949.x5HJn9Ed091108@repo.freebsd.org> From: Xin Li Openpgp: preference=signencrypt Autocrypt: addr=delphij@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFuSR4oBEACvvEgwRIHs6IcSP/yaDtySF78Ji3rP29qdiQsxhMsOtvtffdbS56VApIWO UFb3/iN2gA8HwLvrmjijN0HEoLVX7na1WARmxRYzQMtApsZIUTtx7hnUYlsi2F5odZa6CDW9 a954DLRzYxiUwYDcu5Zjl9bglK1H8e/N9uC0Vuigr4teWfh86brzOyf819QzwFVYfMIK4ihw QGwMvTzbyVuCFy+LENkmcVYni70oQy6rZ5ktSuYbuOFvu7inRRfhSWPHziV7k+bW88sJ7xhv lBlegcnhkSudWX2M8tZ3MO1PJOcyys0CJlsBY5Weiog2lIPi05h/E9pZ9mc1Vud17iqDaL6w RaggOUhuPfDGCdO5ro82W4BZGeQMRnRF5Ntk+t2ShIH4nn3xRLV0E5nziCiKlgiMqOrz/ZTL QTVbHrCuiwD+fSK14y0oHbkOLYTYLlgh1JbwfY2Ty7elOYiWzyeJ7sJh2dF91NSEneWIOys3 mBpuvtU3nSzzTvAB48VV+Nbg1CpIOgNlPjj7uhIum/Z/VjUaJEyaLpTIRh0MVJVcbP7hXSqZ NA35EEZZVnWEOYdycm4CmEdeNPWkrAf2Ya77iR5VLGypwMlsUMQPh+sKVWDD38M8stFGBBNm d01Hi74Bsq5hKan654dOqMt5eYklrVj0ucMzFQtus7oE502UswARAQABtBxYaW4gTEkgPGRl bHBoaWpARnJlZUJTRC5vcmc+iQJXBBMBCgBBAhsDBQkJroQABQsJCAcDBRUKCQgLBRYCAwEA Ah4BAheAFiEEceNg5NEMZIki80nQQHl/fJX0g08FAluSUkoCGQEACgkQQHl/fJX0g08OIxAA pcCm2QCi6IM0o5N5ro5rTodh2rlMuf31TTYBjdf9laZvpnA8a80XBLgx7bxASxH0EOaxcJZk Hl6D0Ex8jcrwOoe9kmbzJ1ZrqBBJBup+mTrf4SwRceSqo6OGHrun8C6kOnq4X62RsvJ9j9nU PqowhXJ4zZHNk9ZXLDzWbrNvYNXxhb+GgK5SniIKMM5Jw/qlMYvxaiIwnS5So+UzIbNsycnk CLbzZxE0d9pe97G3zDvCCwUYoo6LmSx7R20yRnGgO0BlvTPHeWn5WtK1ku3aiarHJW7mRMbD 617GLdc2vuT3bDSd3XwQztgZdiOZkYCdNZVQvuOqMdTtg+phCoQyvEB0+OWoIc/9Cam826nG lazUzURU/FNKJMcxP+1eFI+D/Kl8lpLTtmcjZNbmxeYR2OG6gz7fkyX2D3Is7GEcxuAi6j8f 3OpyFxb9IX4ZsP54/C41bzbcZtQgsU30Ptp/AhJpThHzYHrskfIcLNdmu2ngD5GvrBNX/x4W dO0SgI8tsdY7UQqU9IMWYdkVP8smIUDypMS5x/VZe47afq+VxACOhL0hSixWJDt6Rbl/4iyM EE6Cgu3/YAWQhAK7B97wJj5vPxqdAtPQjkUZGtlTOJWm/NIf4MCYjoHlfan07zatzJ2XF6y6 XcRiCQXULUYpshhY7mXOTSHXZ8n6HB+Z1ri5Ag0EW5JHigEQANiBmIFAfRNH3nzYNWC0yC+t fx3zsUwAsH1VaBM/cTib+yKtbBOSIlXWjJZWX3MHwoI/1LeGghB2mxkkX1L0pJ/vj1eXNR+s FZ320pYcl61Fxg/5fioG4QDTM4i3i7NR5PxDnc6UVaynSlII93DedRhZ1ROtdn4vyMgzsDiq hbL7BthDOt5KxjqdRk4qRPSw7BovEqZLOcG5IJtf/zZUzRbM7SBljEbOAfekDGx1Br+RrYSD 7/EfPwwzou9T8315IpBpIHyQF/dZNk3iFiB9Ed5CA71ZRYV5YoLWE9lL0j9kxOLQ5vHnX3mV q7QZBc7nzwZ6UhQgYmrG5+RWvuiPpGwvDRIsugJUGXucYkAQh5kuNblmkwpv6u9rNMjCNbzA ylOaqdogra5EW+RUSbRz0b4iIr8nnZeAlh7BihCe7JjOwbDjoBEEEtSfVc4hD/LENqpcYVrC hphfaOLB9YIXhnVDTVvMc9OklWT/81HzAaDQqOQCzEfY92199Ct9/CwRoQ2OpO8TO5+8A7b9 Nb33nmxMn09mb48ruRacMrfHxCWbgU4w9SEfbip4GcS5wGG6yTC+hw55Iwnnwus40NrJ0GEr 8a4rcdsLbkvlyoNHB8ZGgyJ4aFCQ1V4qE1BnlTk7Z8BYBUkJM1odPSkVvHpCnMUjVpJ3hEOC +73ZYH1dh7lZABEBAAGJAjwEGAEKACYWIQRx42Dk0QxkiSLzSdBAeX98lfSDTwUCW5JHigIb DAUJCa6EAAAKCRBAeX98lfSDTz8DEACMh3poeUb+gWNF4RWFZuLteZVo0+E1JLYXQkmtrRBL XviP+Qy0pXyFAVxLM4hNIBoIDYfK9BcwrBYf7AwSKrH0GiNwFpgHCkbZd6qoZy2gB+adTnCp VCTJKJetsH/8awkrChJWMK0ckGf3EeWMPvawG7kW7FBz70NYEZ0pOMiaEZNVtzD3wwbYWUiD FYth83XGglOExg+1ShTW5XjQPRrdyJAO+aUW4o3lVjfyUJXMgI4rmhMiLVm06GuNrbpKIF0s +4VdjQAjhrDQjfoXi9CkfsA/cONseuHNv1JGj3RqHiqHJq1dbrpodXp925zGDAnUGxCOBPoF opAHgVzR89GTut059GpwqsddZmU6y7rqifuam/ekJ+QRwc16vgt7pHqCrTY8WPxRZr2UpFU1 wlToCOdeiFep1gq1F9jzFjJnoMaAdmC6k7bgAA+RQusOgIhJL0jIej7DoAHxmxFFCfRy+lDt pXwFgQ8HMvzHI65QWmQnMo7s6SQH/ZH5s1yR6SJq8+3lDz+dCuT42qJVqIPVvxd10LW0FNN+ t7HFeLadU6ekSgD13/EYMYXlvNHkw7dAItSDxIzgRyykLz0bCU9xwNWoS4Z43+ifF9anJ+uR 0ltWEl1j++h6ZrD3LLuCgJIt1so0m49GzdcSpOI7LCwMlacyvafiEyjUn+tSNDsnfw== Organization: The FreeBSD Project Subject: Re: svn commit: r349151 - in head: lib/libufs stand/libsa sys/conf sys/dev/iscsi sys/dev/iscsi_initiator sys/dev/liquidio sys/dev/usb/net sys/fs/ext2fs sys/fs/nandfs sys/geom/part sys/geom/raid sys/ker... Message-ID: <58af4bc5-0097-1540-be64-e9bceab6d4f8@FreeBSD.org> Date: Sat, 22 Jun 2019 21:13:05 -0700 User-Agent: Thunderbird MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="El5xSSqvJdctsskaVtUROdjjySJWxQGZi" X-Rspamd-Queue-Id: 4A0BB724A0 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.94)[-0.938,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 04:13:16 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --El5xSSqvJdctsskaVtUROdjjySJWxQGZi Content-Type: multipart/mixed; boundary="sHl1TCSPVBIEDsBcTLotjbMNyEdGRZhjy"; protected-headers="v1" From: Xin Li To: cem@freebsd.org Cc: src-committers , svn-src-all , svn-src-head , kib@freebsd.org Message-ID: <58af4bc5-0097-1540-be64-e9bceab6d4f8@FreeBSD.org> Subject: Re: svn commit: r349151 - in head: lib/libufs stand/libsa sys/conf sys/dev/iscsi sys/dev/iscsi_initiator sys/dev/liquidio sys/dev/usb/net sys/fs/ext2fs sys/fs/nandfs sys/geom/part sys/geom/raid sys/ker... References: <201906171949.x5HJn9Ed091108@repo.freebsd.org> In-Reply-To: --sHl1TCSPVBIEDsBcTLotjbMNyEdGRZhjy Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 6/22/19 17:15, Conrad Meyer wrote: > Hi Xin Li, >=20 > On Mon, Jun 17, 2019 at 12:49 PM Xin LI wrote: >> >> Author: delphij >> Date: Mon Jun 17 19:49:08 2019 >> New Revision: 349151 >> URL: https://svnweb.freebsd.org/changeset/base/349151 >> >> Log: >> Separate kernel crc32() implementation to its own header (gsb_crc32.= h) and >> rename the source to gsb_crc32.c. >> >> This is a prerequisite of unifying kernel zlib instances. >> >> ... >> Modified: head/sys/libkern/x86/crc32_sse42.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/libkern/x86/crc32_sse42.c Mon Jun 17 17:35:55 2019 = (r349150) >> +++ head/sys/libkern/x86/crc32_sse42.c Mon Jun 17 19:49:08 2019 = (r349151) >> @@ -29,14 +29,14 @@ __FBSDID("$FreeBSD$"); >> /* >> * This file is compiled in userspace in order to run ATF unit tests.= >> */ >> -#ifdef USERSPACE_TESTING >> +#ifndef _KERNEL >=20 > This change and following identical changes revert a request by kib@ > in https://reviews.freebsd.org/D9342 . (When this revision was > initially proposed in , it was '#ifndef _KERNEL' =E2=80=94 kib@ reques= ted the > use of a different preprocessor macro.) Thanks for pointing this out -- admittedly, I haven't read the reasoning before. But after reading more about the original review context, I don't quite agree with Kostik's reasoning because the code actually works in userland regardless of the original intention. It's true that the code is at the time only used in the test program, but they do enabled usage in userland, and they by themselves do not serve purely test purposed task (these are not mock interfaces, nor test cases, etc.), and the common practice in sys/libkern is to wrap these with #if[n]def _KERNEL. I don't insist but I still think it's more reasonable to use _KERNEL because it's more consistent with the surrounding code. Cheers, --sHl1TCSPVBIEDsBcTLotjbMNyEdGRZhjy-- --El5xSSqvJdctsskaVtUROdjjySJWxQGZi Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJdDvxYAAoJEEB5f3yV9INPvW4P/2dsu9GGnDtrKVyrGY75Y+vx jLuxdPJc9kYRWK6gblM/G8/23R7svJMn5l/Gotj2YA/boV4hCtOvvY9wq4S2+BPT I04pnhSGt6YP/6y2XNfzptQ4M0zAaXJh4XYjmS0wmMTUdRCI6uKcRSRkebDvMs3F S/tdHWIOSTU3wuVyGSRWgxrWSVcuSLe1JXVrvWWX5s/gkJoZuQTXje4E5/l/A9KP b5flSdLZi69vDISXCp6Q22pJRTU64fTIf12OUYwkXRBF82VRyXADBCEGPsravCCy flR+qmdZkh9m6fCpSCsMFKswZTNQvf/20T0hjhmr8M+DWUpjcxFbfZQTkbmskd4S q8lQQ56cO8DxvhiWBKP8ToGeQzTcZaw9wVw6FyPt9ZN9ZhUigUbEYhtcK+fmikb2 XQfUT4N1XL/+LbGQXsTpdbMkzGIlt9ZxOsRb9WLlcE/ScUXEbsuarjKM4nxsv0zZ 9Lp+E2ECmJd1hMhlx70e/8ZFhuQt8veKcDcE1k9ykuPQT224UEV9CNBNc/+LAWD1 HNiXczHNtxCn+D9Bllap3Dk3ibU4TOAqGSJUK/76ZtBsGXEIBXMPGCrSoom0TI3o +X5r0YHqpf9zRgv0lyKwKd0nyoM5y9q58r04OXkLEQdxqiFXoCV85Ah+izIKUILh v09ZvimTPls1EODpConL =Da5+ -----END PGP SIGNATURE----- --El5xSSqvJdctsskaVtUROdjjySJWxQGZi-- From owner-svn-src-head@freebsd.org Sun Jun 23 10:45:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AF9815CCCFD; Sun, 23 Jun 2019 10:45:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B42D484F19; Sun, 23 Jun 2019 10:45: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 53A1920A08; Sun, 23 Jun 2019 10:45: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 x5NAjpfR088177; Sun, 23 Jun 2019 10:45:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5NAjpw4088176; Sun, 23 Jun 2019 10:45:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201906231045.x5NAjpw4088176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 23 Jun 2019 10:45:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349297 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 349297 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B42D484F19 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 10:45:52 -0000 Author: kib Date: Sun Jun 23 10:45:50 2019 New Revision: 349297 URL: https://svnweb.freebsd.org/changeset/base/349297 Log: Remove redundand 'else' and 'return'. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/lib/libc/gen/libc_dlopen.c Modified: head/lib/libc/gen/libc_dlopen.c ============================================================================== --- head/lib/libc/gen/libc_dlopen.c Sat Jun 22 23:36:28 2019 (r349296) +++ head/lib/libc/gen/libc_dlopen.c Sun Jun 23 10:45:50 2019 (r349297) @@ -48,8 +48,8 @@ libc_dlopen(const char *path, int mode) if (__libc_restricted_mode) { _rtld_error("Service unavailable -- libc in restricted mode"); return (NULL); - } else - return (dlopen(path, mode)); + } + return (dlopen(path, mode)); } void @@ -57,6 +57,5 @@ __FreeBSD_libc_enter_restricted_mode(void) { __libc_restricted_mode = 1; - return; } From owner-svn-src-head@freebsd.org Sun Jun 23 10:47:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2C5815CCD8B; Sun, 23 Jun 2019 10:47:08 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48EAF8507D; Sun, 23 Jun 2019 10:47:08 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2023E20A09; Sun, 23 Jun 2019 10:47:08 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5NAl87e088294; Sun, 23 Jun 2019 10:47:08 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5NAl7OC088291; Sun, 23 Jun 2019 10:47:07 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201906231047.x5NAl7OC088291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Sun, 23 Jun 2019 10:47:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349298 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 349298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 48EAF8507D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 10:47:08 -0000 Author: arichardson Date: Sun Jun 23 10:47:07 2019 New Revision: 349298 URL: https://svnweb.freebsd.org/changeset/base/349298 Log: Fix two WARNS=6 warnings in opendir.c and telldir.c This is in preparation for compiling these files as part of rtld (which is built with WARNS=6). See https://reviews.freebsd.org/D20663 for more details. Modified: head/lib/libc/gen/opendir.c head/lib/libc/gen/telldir.c Modified: head/lib/libc/gen/opendir.c ============================================================================== --- head/lib/libc/gen/opendir.c Sun Jun 23 10:45:50 2019 (r349297) +++ head/lib/libc/gen/opendir.c Sun Jun 23 10:47:07 2019 (r349298) @@ -99,8 +99,8 @@ static int opendir_compar(const void *p1, const void *p2) { - return (strcmp((*(const struct dirent **)p1)->d_name, - (*(const struct dirent **)p2)->d_name)); + return (strcmp((*(const struct dirent * const *)p1)->d_name, + (*(const struct dirent * const *)p2)->d_name)); } /* Modified: head/lib/libc/gen/telldir.c ============================================================================== --- head/lib/libc/gen/telldir.c Sun Jun 23 10:45:50 2019 (r349297) +++ head/lib/libc/gen/telldir.c Sun Jun 23 10:47:07 2019 (r349298) @@ -63,8 +63,8 @@ telldir(DIR *dirp) * 2) Otherwise, see if it's already been recorded in the linked list * 3) Otherwise, malloc a new one */ - if (dirp->dd_seek < (1ul << DD_SEEK_BITS) && - dirp->dd_loc < (1ul << DD_LOC_BITS)) { + if (dirp->dd_seek < (off_t)(1l << DD_SEEK_BITS) && + dirp->dd_loc < (1l << DD_LOC_BITS)) { ddloc.s.is_packed = 1; ddloc.s.loc = dirp->dd_loc; ddloc.s.seek = dirp->dd_seek; From owner-svn-src-head@freebsd.org Sun Jun 23 10:50:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1961A15CCF37; Sun, 23 Jun 2019 10:50:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B039A853AE; Sun, 23 Jun 2019 10:50: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 6BD1820A13; Sun, 23 Jun 2019 10:50: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 x5NAoR4Y088509; Sun, 23 Jun 2019 10:50:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5NAoQjE088504; Sun, 23 Jun 2019 10:50:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201906231050.x5NAoQjE088504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 23 Jun 2019 10:50:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349299 - in head/lib: libc/gen libc/include libthr/thread X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/lib: libc/gen libc/include libthr/thread X-SVN-Commit-Revision: 349299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B039A853AE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 10:50:28 -0000 Author: kib Date: Sun Jun 23 10:50:26 2019 New Revision: 349299 URL: https://svnweb.freebsd.org/changeset/base/349299 Log: Add libc stub for pthread_getthreadid_np(3). Requested by: jbeich PR: 238650 Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/lib/libc/gen/Symbol.map head/lib/libc/gen/_pthread_stubs.c head/lib/libc/include/libc_private.h head/lib/libthr/thread/thr_init.c Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Sun Jun 23 10:47:07 2019 (r349298) +++ head/lib/libc/gen/Symbol.map Sun Jun 23 10:50:26 2019 (r349299) @@ -338,6 +338,7 @@ FBSD_1.2 { getutxid; getutxline; getutxuser; + pthread_getthreadid_np; pututxline; sem_close; sem_destroy; Modified: head/lib/libc/gen/_pthread_stubs.c ============================================================================== --- head/lib/libc/gen/_pthread_stubs.c Sun Jun 23 10:47:07 2019 (r349298) +++ head/lib/libc/gen/_pthread_stubs.c Sun Jun 23 10:50:26 2019 (r349299) @@ -130,6 +130,7 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = { {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_CONSISTENT */ {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_GETROBUST */ {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_SETROBUST */ + {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_GETTHREADID_NP */ }; /* @@ -248,6 +249,7 @@ STUB_FUNC1(pthread_rwlock_trywrlock, PJT_RWLOCK_TRYWRL STUB_FUNC1(pthread_rwlock_unlock, PJT_RWLOCK_UNLOCK, int, void *) STUB_FUNC1(pthread_rwlock_wrlock, PJT_RWLOCK_WRLOCK, int, void *) STUB_FUNC(pthread_self, PJT_SELF, pthread_t) +STUB_FUNC(pthread_getthreadid_np, PJT_GETTHREADID_NP, int) STUB_FUNC2(pthread_setspecific, PJT_SETSPECIFIC, int, pthread_key_t, void *) STUB_FUNC3(pthread_sigmask, PJT_SIGMASK, int, int, void *, void *) STUB_FUNC3(pthread_atfork, PJT_ATFORK, int, void *, void *, void*) Modified: head/lib/libc/include/libc_private.h ============================================================================== --- head/lib/libc/include/libc_private.h Sun Jun 23 10:47:07 2019 (r349298) +++ head/lib/libc/include/libc_private.h Sun Jun 23 10:50:26 2019 (r349299) @@ -176,6 +176,7 @@ typedef enum { PJT_MUTEX_CONSISTENT, PJT_MUTEXATTR_GETROBUST, PJT_MUTEXATTR_SETROBUST, + PJT_GETTHREADID_NP, PJT_MAX } pjt_index_t; Modified: head/lib/libthr/thread/thr_init.c ============================================================================== --- head/lib/libthr/thread/thr_init.c Sun Jun 23 10:47:07 2019 (r349298) +++ head/lib/libthr/thread/thr_init.c Sun Jun 23 10:50:26 2019 (r349299) @@ -272,6 +272,7 @@ static pthread_func_t jmp_table[][2] = { {DUAL_ENTRY(_pthread_mutex_consistent)},/* PJT_MUTEX_CONSISTENT */ {DUAL_ENTRY(_pthread_mutexattr_getrobust)},/* PJT_MUTEXATTR_GETROBUST */ {DUAL_ENTRY(_pthread_mutexattr_setrobust)},/* PJT_MUTEXATTR_SETROBUST */ + {DUAL_ENTRY(_pthread_getthreadid_np)}, /* PJT_GETTHREADID_NP */ }; static int init_once = 0; From owner-svn-src-head@freebsd.org Sun Jun 23 11:23:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7514515CDFB9; Sun, 23 Jun 2019 11:23:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A48A486CF4; Sun, 23 Jun 2019 11:23:22 +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 x5NBNFPr087905 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 23 Jun 2019 14:23:18 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x5NBNFPr087905 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x5NBNF45087900; Sun, 23 Jun 2019 14:23:15 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 23 Jun 2019 14:23:15 +0300 From: Konstantin Belousov To: Xin Li Cc: cem@freebsd.org, src-committers , svn-src-all , svn-src-head , kib@freebsd.org Subject: Re: svn commit: r349151 - in head: lib/libufs stand/libsa sys/conf sys/dev/iscsi sys/dev/iscsi_initiator sys/dev/liquidio sys/dev/usb/net sys/fs/ext2fs sys/fs/nandfs sys/geom/part sys/geom/raid sys/ker... Message-ID: <20190623112315.GS8697@kib.kiev.ua> References: <201906171949.x5HJn9Ed091108@repo.freebsd.org> <58af4bc5-0097-1540-be64-e9bceab6d4f8@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <58af4bc5-0097-1540-be64-e9bceab6d4f8@FreeBSD.org> User-Agent: Mutt/1.12.0 (2019-05-25) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 11:23:23 -0000 On Sat, Jun 22, 2019 at 09:13:05PM -0700, Xin Li wrote: > On 6/22/19 17:15, Conrad Meyer wrote: > > Hi Xin Li, > > > > On Mon, Jun 17, 2019 at 12:49 PM Xin LI wrote: > >> > >> Author: delphij > >> Date: Mon Jun 17 19:49:08 2019 > >> New Revision: 349151 > >> URL: https://svnweb.freebsd.org/changeset/base/349151 > >> > >> Log: > >> Separate kernel crc32() implementation to its own header (gsb_crc32.h) and > >> rename the source to gsb_crc32.c. > >> > >> This is a prerequisite of unifying kernel zlib instances. > >> > >> ... > >> Modified: head/sys/libkern/x86/crc32_sse42.c > >> ============================================================================== > >> --- head/sys/libkern/x86/crc32_sse42.c Mon Jun 17 17:35:55 2019 (r349150) > >> +++ head/sys/libkern/x86/crc32_sse42.c Mon Jun 17 19:49:08 2019 (r349151) > >> @@ -29,14 +29,14 @@ __FBSDID("$FreeBSD$"); > >> /* > >> * This file is compiled in userspace in order to run ATF unit tests. > >> */ > >> -#ifdef USERSPACE_TESTING > >> +#ifndef _KERNEL > > > > This change and following identical changes revert a request by kib@ > > in https://reviews.freebsd.org/D9342 . (When this revision was > > initially proposed in , it was '#ifndef _KERNEL' — kib@ requested the > > use of a different preprocessor macro.) > > Thanks for pointing this out -- admittedly, I haven't read the reasoning > before. > > But after reading more about the original review context, I don't quite > agree with Kostik's reasoning because the code actually works in > userland regardless of the original intention. It's true that the code > is at the time only used in the test program, but they do enabled usage > in userland, and they by themselves do not serve purely test purposed > task (these are not mock interfaces, nor test cases, etc.), and the > common practice in sys/libkern is to wrap these with #if[n]def _KERNEL. > > I don't insist but I still think it's more reasonable to use _KERNEL > because it's more consistent with the surrounding code. #ifndef _KERNEL is used when you provide generally useful code which must be limited to userspace. There, the conditionally compiled code is very specific, it is only for testing. Being explicit would allow to avoid questions, e.g. why userspace requires constructors. And still see my confusion in the referenced review. From owner-svn-src-head@freebsd.org Sun Jun 23 17:20:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8619015D5ABF; Sun, 23 Jun 2019 17:20:40 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 26A05947C7; Sun, 23 Jun 2019 17:20:40 +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 1821924BB2; Sun, 23 Jun 2019 17:20:40 +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 x5NHKdoi097602; Sun, 23 Jun 2019 17:20:39 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5NHKdSD097601; Sun, 23 Jun 2019 17:20:39 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201906231720.x5NHKdSD097601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 23 Jun 2019 17:20:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349316 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 349316 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 26A05947C7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 17:20:40 -0000 Author: ian Date: Sun Jun 23 17:20:39 2019 New Revision: 349316 URL: https://svnweb.freebsd.org/changeset/base/349316 Log: Remove some unused header files from the ad7418 driver. Modified: head/sys/dev/iicbus/ad7418.c Modified: head/sys/dev/iicbus/ad7418.c ============================================================================== --- head/sys/dev/iicbus/ad7418.c Sun Jun 23 16:59:06 2019 (r349315) +++ head/sys/dev/iicbus/ad7418.c Sun Jun 23 17:20:39 2019 (r349316) @@ -35,17 +35,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include - -#include -#include -#include -#include -#include -#include #include From owner-svn-src-head@freebsd.org Sun Jun 23 17:23:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5554A15D5CB3; Sun, 23 Jun 2019 17:23:57 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EC2BB94D2B; Sun, 23 Jun 2019 17:23:56 +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 C3B9F24D47; Sun, 23 Jun 2019 17:23:56 +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 x5NHNuhf002525; Sun, 23 Jun 2019 17:23:56 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5NHNuAf002523; Sun, 23 Jun 2019 17:23:56 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201906231723.x5NHNuAf002523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 23 Jun 2019 17:23:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349317 - in head/sys: arm/allwinner conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: arm/allwinner conf X-SVN-Commit-Revision: 349317 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EC2BB94D2B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 17:23:57 -0000 Author: ian Date: Sun Jun 23 17:23:56 2019 New Revision: 349317 URL: https://svnweb.freebsd.org/changeset/base/349317 Log: Add the rtc8583 driver to conf/files. Also, move sy8106a from file.allwinner to conf/files... it's not allwinner-specific, some day other platforms could use the same regulator chip. Modified: head/sys/arm/allwinner/files.allwinner head/sys/conf/files Modified: head/sys/arm/allwinner/files.allwinner ============================================================================== --- head/sys/arm/allwinner/files.allwinner Sun Jun 23 17:20:39 2019 (r349316) +++ head/sys/arm/allwinner/files.allwinner Sun Jun 23 17:23:56 2019 (r349317) @@ -28,7 +28,6 @@ dev/usb/controller/generic_ohci.c optional ohci dev/usb/controller/generic_usb_if.m optional ohci arm/allwinner/aw_sid.c optional aw_sid arm/allwinner/aw_thermal.c optional aw_thermal -dev/iicbus/sy8106a.c optional sy8106a arm/allwinner/aw_cir.c optional aw_cir evdev arm/allwinner/aw_reset.c standard Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Jun 23 17:20:39 2019 (r349316) +++ head/sys/conf/files Sun Jun 23 17:23:56 2019 (r349317) @@ -1792,7 +1792,9 @@ dev/iicbus/isl12xx.c optional isl12xx dev/iicbus/lm75.c optional lm75 dev/iicbus/nxprtc.c optional nxprtc | pcf8563 dev/iicbus/ofw_iicbus.c optional fdt iicbus +dev/iicbus/rtc8583.c optional rtc8583 dev/iicbus/s35390a.c optional s35390a +dev/iicbus/sy8106a.c optional sy8106a dev/iir/iir.c optional iir dev/iir/iir_ctrl.c optional iir dev/iir/iir_pci.c optional iir pci From owner-svn-src-head@freebsd.org Sun Jun 23 17:38:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6770E15D5F54; Sun, 23 Jun 2019 17:38:31 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 08903953E9; Sun, 23 Jun 2019 17:38: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 CBA7D24F3D; Sun, 23 Jun 2019 17:38:30 +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 x5NHcU21007905; Sun, 23 Jun 2019 17:38:30 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5NHcUcb007904; Sun, 23 Jun 2019 17:38:30 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201906231738.x5NHcUcb007904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 23 Jun 2019 17:38:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349318 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 349318 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 08903953E9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 17:38:31 -0000 Author: ian Date: Sun Jun 23 17:38:30 2019 New Revision: 349318 URL: https://svnweb.freebsd.org/changeset/base/349318 Log: The sy8106a and syr827 drviers require FDT and the ext_resources subsystem. Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Jun 23 17:23:56 2019 (r349317) +++ head/sys/conf/files Sun Jun 23 17:38:30 2019 (r349318) @@ -1775,7 +1775,7 @@ dev/iicbus/ds13rtc.c optional ds13rtc | ds133x | ds13 dev/iicbus/ds1672.c optional ds1672 dev/iicbus/ds3231.c optional ds3231 dev/iicbus/rtc8583.c optional rtc8583 -dev/iicbus/syr827.c optional ext_resources syr827 +dev/iicbus/syr827.c optional syr827 ext_resources fdt dev/iicbus/icee.c optional icee dev/iicbus/if_ic.c optional ic dev/iicbus/iic.c optional iic @@ -1794,7 +1794,7 @@ dev/iicbus/nxprtc.c optional nxprtc | pcf8563 dev/iicbus/ofw_iicbus.c optional fdt iicbus dev/iicbus/rtc8583.c optional rtc8583 dev/iicbus/s35390a.c optional s35390a -dev/iicbus/sy8106a.c optional sy8106a +dev/iicbus/sy8106a.c optional sy8106a ext_resources fdt dev/iir/iir.c optional iir dev/iir/iir_ctrl.c optional iir dev/iir/iir_pci.c optional iir pci From owner-svn-src-head@freebsd.org Sun Jun 23 17:39:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C4B315D5FB4; Sun, 23 Jun 2019 17:39:14 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A509B95539; Sun, 23 Jun 2019 17:39:13 +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 7EF8F24F3E; Sun, 23 Jun 2019 17:39:13 +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 x5NHdDcR007974; Sun, 23 Jun 2019 17:39:13 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5NHdD2u007973; Sun, 23 Jun 2019 17:39:13 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201906231739.x5NHdD2u007973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 23 Jun 2019 17:39:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349319 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 349319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A509B95539 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 17:39:14 -0000 Author: ian Date: Sun Jun 23 17:39:13 2019 New Revision: 349319 URL: https://svnweb.freebsd.org/changeset/base/349319 Log: Add some i2c slave-device drivers that were missing from NOTES. Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sun Jun 23 17:38:30 2019 (r349318) +++ head/sys/conf/NOTES Sun Jun 23 17:39:13 2019 (r349319) @@ -2421,14 +2421,19 @@ device iicoc # OpenCores I2C controller support # I2C peripheral devices # +device ad7418 # Analog Devices temp and voltage sensor device ds1307 # Dallas DS1307 RTC and compatible device ds13rtc # All Dallas/Maxim ds13xx chips device ds1672 # Dallas DS1672 RTC device ds3231 # Dallas DS3231 RTC + temperature device icee # AT24Cxxx and compatible EEPROMs +device isl12xx # Intersil ISL12xx RTC device lm75 # LM75 compatible temperature sensor device nxprtc # NXP RTCs: PCA/PFC212x PCA/PCF85xx +device rtc8583 # Epson RTC-8583 device s35390a # Seiko Instruments S-35390A RTC +device sy8106a # Silergy Corp. SY8106A buck regulator +device syr827 # Silergy Corp. DC/DC regulator # Parallel-Port Bus # From owner-svn-src-head@freebsd.org Sun Jun 23 18:35:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C7CB15D70D2; Sun, 23 Jun 2019 18:35:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EAD4997279; Sun, 23 Jun 2019 18:35:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94F8625971; Sun, 23 Jun 2019 18:35:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5NIZBtY038781; Sun, 23 Jun 2019 18:35:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5NIZBYb038780; Sun, 23 Jun 2019 18:35:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201906231835.x5NIZBYb038780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 23 Jun 2019 18:35:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349320 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EAD4997279 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 18:35:20 -0000 Author: kib Date: Sun Jun 23 18:35:11 2019 New Revision: 349320 URL: https://svnweb.freebsd.org/changeset/base/349320 Log: coredump: avoid writing to core files not owned by the real user. Reported by: blake frantz PR: 68905 admbugs: 358 Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Sun Jun 23 17:39:13 2019 (r349319) +++ head/sys/kern/kern_sig.c Sun Jun 23 18:35:11 2019 (r349320) @@ -3597,10 +3597,11 @@ coredump(struct thread *td) /* * Don't dump to non-regular files or files with links. - * Do not dump into system files. + * Do not dump into system files. Real user must own the corefile. */ if (vp->v_type != VREG || VOP_GETATTR(vp, &vattr, cred) != 0 || - vattr.va_nlink != 1 || (vp->v_vflag & VV_SYSTEM) != 0) { + vattr.va_nlink != 1 || (vp->v_vflag & VV_SYSTEM) != 0 || + vattr.va_uid != cred->cr_ruid) { VOP_UNLOCK(vp, 0); error = EFAULT; goto out; From owner-svn-src-head@freebsd.org Sun Jun 23 19:05:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46C9215D7868; Sun, 23 Jun 2019 19:05:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EC17B6843F; Sun, 23 Jun 2019 19:05:03 +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 C147C25E71; Sun, 23 Jun 2019 19:05:03 +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 x5NJ53rI054406; Sun, 23 Jun 2019 19:05:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5NJ51Fl054396; Sun, 23 Jun 2019 19:05:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201906231905.x5NJ51Fl054396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 23 Jun 2019 19:05:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349321 - in head/sys: cam/scsi dev/ahci X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys: cam/scsi dev/ahci X-SVN-Commit-Revision: 349321 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EC17B6843F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 19:05:04 -0000 Author: mav Date: Sun Jun 23 19:05:01 2019 New Revision: 349321 URL: https://svnweb.freebsd.org/changeset/base/349321 Log: Improve AHCI Enclosure Management and SES interoperation. Since SES specs do not define mechanism to map enclosure slots to SATA disks, AHCI EM code I written many years ago appeared quite useless, that always bugged me. I was thinking whether it was a good idea, but if LSI HBAs do that, why I shouldn't? This change introduces simple non-standard mechanism for the mapping into both AHCI EM and SES code, that makes AHCI EM on capable controllers (most of Intel's) a first-class SES citizen, allowing it to report disk physical path to GEOM, show devices inserted into each enclosure slot in `sesutil map` and `getencstat`, control locate and fault LEDs for specific devices with `sesutil locate adaX on` and `sesutil fault adaX on`, etc. I've successfully tested this on Supermicro X10DRH-i motherboard connected with sideband cable of its S-SATA Mini-SAS connector to SAS815TQ backplane. It can indicate with LEDs Locate, Fault and Rebuild/Remap SES statuses for each disk identical to real SES of Supermicro SAS2 backplanes. MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_enc.c head/sys/cam/scsi/scsi_enc.h head/sys/cam/scsi/scsi_enc_internal.h head/sys/cam/scsi/scsi_enc_safte.c head/sys/cam/scsi/scsi_enc_ses.c head/sys/cam/scsi/scsi_ses.h head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci.h head/sys/dev/ahci/ahciem.c Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Sun Jun 23 18:35:11 2019 (r349320) +++ head/sys/cam/scsi/scsi_all.c Sun Jun 23 19:05:01 2019 (r349321) @@ -5574,6 +5574,7 @@ scsi_devid_is_naa_ieee_reg(uint8_t *bufp) { struct scsi_vpd_id_descriptor *descr; struct scsi_vpd_id_naa_basic *naa; + int n; descr = (struct scsi_vpd_id_descriptor *)bufp; naa = (struct scsi_vpd_id_naa_basic *)descr->identifier; @@ -5581,7 +5582,8 @@ scsi_devid_is_naa_ieee_reg(uint8_t *bufp) return 0; if (descr->length < sizeof(struct scsi_vpd_id_naa_ieee_reg)) return 0; - if ((naa->naa >> SVPD_ID_NAA_NAA_SHIFT) != SVPD_ID_NAA_IEEE_REG) + n = naa->naa >> SVPD_ID_NAA_NAA_SHIFT; + if (n != SVPD_ID_NAA_LOCAL_REG && n != SVPD_ID_NAA_IEEE_REG) return 0; return 1; } Modified: head/sys/cam/scsi/scsi_enc.c ============================================================================== --- head/sys/cam/scsi/scsi_enc.c Sun Jun 23 18:35:11 2019 (r349320) +++ head/sys/cam/scsi/scsi_enc.c Sun Jun 23 19:05:01 2019 (r349321) @@ -89,6 +89,9 @@ int enc_verbose = 0; SYSCTL_INT(_kern_cam_enc, OID_AUTO, verbose, CTLFLAG_RWTUN, &enc_verbose, 0, "Enable verbose logging"); +const char *elm_type_names[] = ELM_TYPE_NAMES; +CTASSERT(nitems(elm_type_names) - 1 == ELMTYP_LAST); + static struct periph_driver encdriver = { enc_init, "ses", TAILQ_HEAD_INITIALIZER(encdriver.units), /* generation */ 0 @@ -240,13 +243,19 @@ enc_async(void *callback_arg, uint32_t code, struct ca struct enc_softc *softc; softc = (struct enc_softc *)periph->softc; - if (xpt_path_path_id(periph->path) != path_id - || softc == NULL - || (softc->enc_flags & ENC_FLAG_INITIALIZED) - == 0 - || softc->enc_vec.device_found == NULL) + + /* Check this SEP is ready. */ + if (softc == NULL || (softc->enc_flags & + ENC_FLAG_INITIALIZED) == 0 || + softc->enc_vec.device_found == NULL) continue; + /* Check this SEP may manage this device. */ + if (xpt_path_path_id(periph->path) != path_id && + (softc->enc_type != ENC_SEMB_SES || + cgd->protocol != PROTO_ATA)) + continue; + softc->enc_vec.device_found(softc); } xpt_unlock_buses(); @@ -440,7 +449,7 @@ enc_ioctl(struct cdev *dev, u_long cmd, caddr_t arg_ad encioc_element_t kelm; kelm.elm_idx = i; kelm.elm_subenc_id = cache->elm_map[i].subenclosure; - kelm.elm_type = cache->elm_map[i].enctype; + kelm.elm_type = cache->elm_map[i].elm_type; error = copyout(&kelm, &uelm[i], sizeof(kelm)); if (error) break; Modified: head/sys/cam/scsi/scsi_enc.h ============================================================================== --- head/sys/cam/scsi/scsi_enc.h Sun Jun 23 18:35:11 2019 (r349320) +++ head/sys/cam/scsi/scsi_enc.h Sun Jun 23 19:05:01 2019 (r349321) @@ -120,9 +120,41 @@ typedef enum { ELMTYP_SCSI_INI = 0x15, ELMTYP_SUBENC = 0x16, ELMTYP_ARRAY_DEV = 0x17, - ELMTYP_SAS_EXP = 0x18, /* SAS expander */ - ELMTYP_SAS_CONN = 0x19 /* SAS connector */ + ELMTYP_SAS_EXP = 0x18, /* SAS Expander */ + ELMTYP_SAS_CONN = 0x19, /* SAS Connector */ + ELMTYP_LAST = ELMTYP_SAS_CONN } elm_type_t; + +#define ELM_TYPE_NAMES { \ + "Unspecified", \ + "Device Slot", \ + "Power Supply", \ + "Cooling", \ + "Temperature Sensors", \ + "Door", \ + "Audible alarm", \ + "Enclosure Services Controller Electronics", \ + "SCC Controller Electronics", \ + "Nonvolatile Cache", \ + "Invalid Operation Reason", \ + "Uninterruptible Power Supply", \ + "Display", \ + "Key Pad Entry", \ + "Enclosure", \ + "SCSI Port/Transceiver", \ + "Language", \ + "Communication Port", \ + "Voltage Sensor", \ + "Current Sensor", \ + "SCSI Target Port", \ + "SCSI Initiator Port", \ + "Simple Subenclosure", \ + "Array Device Slot", \ + "SAS Expander", \ + "SAS Connector" \ +} + +extern const char *elm_type_names[]; typedef struct encioc_element { /* Element Index */ Modified: head/sys/cam/scsi/scsi_enc_internal.h ============================================================================== --- head/sys/cam/scsi/scsi_enc_internal.h Sun Jun 23 18:35:11 2019 (r349320) +++ head/sys/cam/scsi/scsi_enc_internal.h Sun Jun 23 19:05:01 2019 (r349321) @@ -39,16 +39,12 @@ #include typedef struct enc_element { - uint32_t - enctype : 8, /* enclosure type */ - subenclosure : 8, /* subenclosure id */ - svalid : 1, /* enclosure information valid */ - overall_status_elem: 1,/* - * This object represents generic - * status about all objects of this - * type. - */ - priv : 14; /* private data, per object */ + uint8_t elm_idx; /* index of element */ + uint8_t elm_type; /* element type */ + uint8_t subenclosure; /* subenclosure id */ + uint8_t type_elm_idx; /* index of element within type */ + uint8_t svalid; /* enclosure information valid */ + uint16_t priv; /* private data, per object */ uint8_t encstat[4]; /* state && stats */ uint8_t *physical_path; /* Device physical path data. */ u_int physical_path_len; /* Length of device path data. */ Modified: head/sys/cam/scsi/scsi_enc_safte.c ============================================================================== --- head/sys/cam/scsi/scsi_enc_safte.c Sun Jun 23 18:35:11 2019 (r349320) +++ head/sys/cam/scsi/scsi_enc_safte.c Sun Jun 23 19:05:01 2019 (r349321) @@ -301,21 +301,21 @@ safte_process_config(enc_softc_t *enc, struct enc_fsm_ * in later fetches of status. */ for (i = 0; i < cfg->Nfans; i++) - enc->enc_cache.elm_map[r++].enctype = ELMTYP_FAN; + enc->enc_cache.elm_map[r++].elm_type = ELMTYP_FAN; cfg->pwroff = (uint8_t) r; for (i = 0; i < cfg->Npwr; i++) - enc->enc_cache.elm_map[r++].enctype = ELMTYP_POWER; + enc->enc_cache.elm_map[r++].elm_type = ELMTYP_POWER; for (i = 0; i < cfg->DoorLock; i++) - enc->enc_cache.elm_map[r++].enctype = ELMTYP_DOORLOCK; + enc->enc_cache.elm_map[r++].elm_type = ELMTYP_DOORLOCK; if (cfg->Nspkrs > 0) - enc->enc_cache.elm_map[r++].enctype = ELMTYP_ALARM; + enc->enc_cache.elm_map[r++].elm_type = ELMTYP_ALARM; for (i = 0; i < cfg->Ntherm; i++) - enc->enc_cache.elm_map[r++].enctype = ELMTYP_THERM; + enc->enc_cache.elm_map[r++].elm_type = ELMTYP_THERM; for (i = 0; i <= cfg->Ntstats; i++) - enc->enc_cache.elm_map[r++].enctype = ELMTYP_THERM; + enc->enc_cache.elm_map[r++].elm_type = ELMTYP_THERM; cfg->slotoff = (uint8_t) r; for (i = 0; i < cfg->Nslots; i++) - enc->enc_cache.elm_map[r++].enctype = + enc->enc_cache.elm_map[r++].elm_type = emulate_array_devices ? ELMTYP_ARRAY_DEV : ELMTYP_DEVICE; @@ -505,7 +505,7 @@ safte_process_status(enc_softc_t *enc, struct enc_fsm_ */ for (i = 0; i < cfg->Nslots; i++) { SAFT_BAIL(r, xfer_len); - if (cache->elm_map[cfg->slotoff + i].enctype == ELMTYP_DEVICE) + if (cache->elm_map[cfg->slotoff + i].elm_type == ELMTYP_DEVICE) cache->elm_map[cfg->slotoff + i].encstat[1] = buf[r]; r++; } @@ -678,7 +678,7 @@ safte_process_slotstatus(enc_softc_t *enc, struct enc_ oid = cfg->slotoff; for (r = i = 0; i < cfg->Nslots; i++, r += 4) { SAFT_BAIL(r+3, xfer_len); - if (cache->elm_map[oid].enctype == ELMTYP_ARRAY_DEV) + if (cache->elm_map[oid].elm_type == ELMTYP_ARRAY_DEV) cache->elm_map[oid].encstat[1] = 0; cache->elm_map[oid].encstat[2] &= SESCTL_RQSID; cache->elm_map[oid].encstat[3] = 0; @@ -705,7 +705,7 @@ safte_process_slotstatus(enc_softc_t *enc, struct enc_ cache->elm_map[oid].encstat[3] |= SESCTL_RQSFLT; if (buf[r+0] & 0x40) cache->elm_map[oid].encstat[0] |= SESCTL_PRDFAIL; - if (cache->elm_map[oid].enctype == ELMTYP_ARRAY_DEV) { + if (cache->elm_map[oid].elm_type == ELMTYP_ARRAY_DEV) { if (buf[r+0] & 0x01) cache->elm_map[oid].encstat[1] |= 0x80; if (buf[r+0] & 0x04) @@ -771,7 +771,7 @@ safte_fill_control_request(enc_softc_t *enc, struct en } else { ep = &enc->enc_cache.elm_map[idx]; - switch (ep->enctype) { + switch (ep->elm_type) { case ELMTYP_DEVICE: case ELMTYP_ARRAY_DEV: switch (cfg->current_request_stage) { @@ -781,7 +781,7 @@ safte_fill_control_request(enc_softc_t *enc, struct en ep->priv |= 0x40; if (req->elm_stat[3] & SESCTL_RQSFLT) ep->priv |= 0x02; - if (ep->enctype == ELMTYP_ARRAY_DEV) { + if (ep->elm_type == ELMTYP_ARRAY_DEV) { if (req->elm_stat[1] & 0x01) ep->priv |= 0x200; if (req->elm_stat[1] & 0x02) @@ -970,7 +970,7 @@ safte_process_control_request(enc_softc_t *enc, struct if (idx == SES_SETSTATUS_ENC_IDX) type = -1; else - type = enc->enc_cache.elm_map[idx].enctype; + type = enc->enc_cache.elm_map[idx].elm_type; if (type == ELMTYP_DEVICE || type == ELMTYP_ARRAY_DEV) enc_update_request(enc, SAFTE_UPDATE_READSLOTSTATUS); else Modified: head/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- head/sys/cam/scsi/scsi_enc_ses.c Sun Jun 23 18:35:11 2019 (r349320) +++ head/sys/cam/scsi/scsi_enc_ses.c Sun Jun 23 19:05:01 2019 (r349321) @@ -102,6 +102,7 @@ typedef struct ses_addl_status { union { union ses_fcobj_hdr *fc; union ses_elm_sas_hdr *sas; + struct ses_elm_ata_hdr *ata; } proto_hdr; union ses_addl_data proto_data; /* array sizes stored in header */ } ses_add_status_t; @@ -825,14 +826,6 @@ ses_devids_iter(enc_softc_t *enc, enc_element_t *elm, elmpriv = elm->elm_private; addl = &(elmpriv->addl); - /* - * Don't assume this object has additional status information, or - * that it is a SAS device, or that it is a device slot device. - */ - if (addl->hdr == NULL || addl->proto_hdr.sas == NULL - || addl->proto_data.sasdev_phys == NULL) - return; - devid_record_size = SVPD_DEVICE_ID_DESC_HDR_LEN + sizeof(struct scsi_vpd_id_naa_ieee_reg); for (i = 0; i < addl->proto_hdr.sas->base_hdr.num_phys; i++) { @@ -950,11 +943,40 @@ static void ses_paths_iter(enc_softc_t *enc, enc_element_t *elm, ses_path_callback_t *callback, void *callback_arg) { - ses_path_iter_args_t args; + ses_element_t *elmpriv; + struct ses_addl_status *addl; - args.callback = callback; - args.callback_arg = callback_arg; - ses_devids_iter(enc, elm, ses_path_iter_devid_callback, &args); + elmpriv = elm->elm_private; + addl = &(elmpriv->addl); + + if (addl->hdr == NULL) + return; + + if (addl->proto_hdr.sas != NULL && + addl->proto_data.sasdev_phys != NULL) { + ses_path_iter_args_t args; + + args.callback = callback; + args.callback_arg = callback_arg; + ses_devids_iter(enc, elm, ses_path_iter_devid_callback, &args); + } else if (addl->proto_hdr.ata != NULL) { + struct cam_path *path; + struct ccb_getdev cgd; + + if (xpt_create_path(&path, /*periph*/NULL, + scsi_4btoul(addl->proto_hdr.ata->bus), + scsi_4btoul(addl->proto_hdr.ata->target), 0) + != CAM_REQ_CMP) + return; + + xpt_setup_ccb(&cgd.ccb_h, path, CAM_PRIORITY_NORMAL); + cgd.ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action((union ccb *)&cgd); + if (cgd.ccb_h.status == CAM_REQ_CMP) + callback(enc, elm, path, callback_arg); + + xpt_free_path(path); + } } /** @@ -1059,6 +1081,10 @@ ses_set_physpath(enc_softc_t *enc, enc_element_t *elm, ret = EIO; devid = NULL; + elmpriv = elm->elm_private; + if (elmpriv->addl.hdr == NULL) + goto out; + /* * Assemble the components of the physical path starting with * the device ID of the enclosure itself. @@ -1091,7 +1117,6 @@ ses_set_physpath(enc_softc_t *enc, enc_element_t *elm, scsi_8btou64(idd->identifier), iter->type_index, iter->type_element_index); /* Append the element descriptor if one exists */ - elmpriv = elm->elm_private; if (elmpriv->descr != NULL && elmpriv->descr_len > 0) { sbuf_cat(&sb, "/elmdesc@"); for (i = 0, c = elmpriv->descr; i < elmpriv->descr_len; @@ -1457,9 +1482,10 @@ ses_process_config(enc_softc_t *enc, struct enc_fsm_st iter.global_element_index, iter.type_index, nelm, iter.type_element_index); thdr = ses_cache->ses_types[iter.type_index].hdr; + element->elm_idx = iter.global_element_index; + element->elm_type = thdr->etype_elm_type; element->subenclosure = thdr->etype_subenc; - element->enctype = thdr->etype_elm_type; - element->overall_status_elem = iter.type_element_index == 0; + element->type_elm_idx = iter.type_element_index; element->elm_private = malloc(sizeof(ses_element_t), M_SCSIENC, M_WAITOK|M_ZERO); ENC_DLOG(enc, "%s: creating elmpriv %d(%d,%d) subenc %d " @@ -1663,6 +1689,8 @@ static int ses_get_elm_addlstatus_fc(enc_softc_t *, en uint8_t *, int); static int ses_get_elm_addlstatus_sas(enc_softc_t *, enc_cache_t *, uint8_t *, int, int, int, int); +static int ses_get_elm_addlstatus_ata(enc_softc_t *, enc_cache_t *, uint8_t *, + int, int, int, int); /** * \brief Parse the additional status element data for each object. @@ -1818,7 +1846,6 @@ badindex: } } elmpriv = element->elm_private; - elmpriv->addl.hdr = elm_hdr; ENC_DLOG(enc, "%s: global element index=%d, type index=%d " "type element index=%d, offset=0x%x, " "byte0=0x%x, length=0x%x\n", __func__, @@ -1842,6 +1869,7 @@ badindex: offset += elm_hdr->length; continue; } + elmpriv->addl.hdr = elm_hdr; /* Advance to the protocol data, skipping eip bytes if needed */ offset += (eip * SES_EIP_HDR_EXTRA_LEN); @@ -1865,6 +1893,13 @@ badindex: eip, iter.type_index, iter.global_element_index); break; + case SPSP_PROTO_ATA: + ses_get_elm_addlstatus_ata(enc, enc_cache, + &buf[offset], + proto_info_len, + eip, iter.type_index, + iter.global_element_index); + break; default: ENC_VLOG(enc, "Element %d: Unknown Additional Element " "Protocol 0x%x\n", iter.global_element_index, @@ -2193,18 +2228,16 @@ ses_get_elm_addlstatus_fc(enc_softc_t *enc, enc_cache_ } #define SES_PRINT_PORTS(p, type) do { \ - sbuf_printf(sbp, " %s(", type); \ - if (((p) & SES_SASOBJ_DEV_PHY_PROTOMASK) == 0) \ - sbuf_printf(sbp, " None"); \ - else { \ + if (((p) & SES_SASOBJ_DEV_PHY_PROTOMASK) != 0) { \ + sbuf_printf(sbp, " %s (", type); \ if ((p) & SES_SASOBJ_DEV_PHY_SMP) \ sbuf_printf(sbp, " SMP"); \ if ((p) & SES_SASOBJ_DEV_PHY_STP) \ sbuf_printf(sbp, " STP"); \ if ((p) & SES_SASOBJ_DEV_PHY_SSP) \ sbuf_printf(sbp, " SSP"); \ + sbuf_printf(sbp, " )"); \ } \ - sbuf_printf(sbp, " )"); \ } while(0) /** @@ -2214,11 +2247,10 @@ ses_get_elm_addlstatus_fc(enc_softc_t *enc, enc_cache_ * \param sesname SES device name associated with the object. * \param sbp Sbuf to print to. * \param obj The object to print the data for. - * \param periph_name Peripheral string associated with the object. */ static void ses_print_addl_data_sas_type0(char *sesname, struct sbuf *sbp, - enc_element_t *obj, char *periph_name) + enc_element_t *obj) { int i; ses_element_t *elmpriv; @@ -2227,16 +2259,12 @@ ses_print_addl_data_sas_type0(char *sesname, struct sb elmpriv = obj->elm_private; addl = &(elmpriv->addl); - if (addl->proto_hdr.sas == NULL) - return; - sbuf_printf(sbp, "%s: %s: SAS Device Slot Element:", - sesname, periph_name); - sbuf_printf(sbp, " %d Phys", addl->proto_hdr.sas->base_hdr.num_phys); + sbuf_printf(sbp, ", SAS Slot: %d%s phys", + addl->proto_hdr.sas->base_hdr.num_phys, + ses_elm_sas_type0_not_all_phys(addl->proto_hdr.sas) ? "+" : ""); if (ses_elm_addlstatus_eip(addl->hdr)) - sbuf_printf(sbp, " at Slot %d", + sbuf_printf(sbp, " at slot %d", addl->proto_hdr.sas->type0_eip.dev_slot_num); - if (ses_elm_sas_type0_not_all_phys(addl->proto_hdr.sas)) - sbuf_printf(sbp, ", Not All Phys"); sbuf_printf(sbp, "\n"); if (addl->proto_data.sasdev_phys == NULL) return; @@ -2247,9 +2275,8 @@ ses_print_addl_data_sas_type0(char *sesname, struct sb /* Spec says all other fields are specific values */ sbuf_printf(sbp, " SATA device\n"); else { - sbuf_printf(sbp, " SAS device type %d id %d\n", + sbuf_printf(sbp, " SAS device type %d phy %d", ses_elm_sas_dev_phy_dev_type(phy), phy->phy_id); - sbuf_printf(sbp, "%s: phy %d: protocols:", sesname, i); SES_PRINT_PORTS(phy->initiator_ports, "Initiator"); SES_PRINT_PORTS(phy->target_ports, "Target"); sbuf_printf(sbp, "\n"); @@ -2263,32 +2290,16 @@ ses_print_addl_data_sas_type0(char *sesname, struct sb #undef SES_PRINT_PORTS /** - * \brief Report whether a given enclosure object is an expander. - * - * \param enc SES softc associated with object. - * \param obj Enclosure object to report for. - * - * \return 1 if true, 0 otherwise. - */ -static int -ses_obj_is_expander(enc_softc_t *enc, enc_element_t *obj) -{ - return (obj->enctype == ELMTYP_SAS_EXP); -} - -/** * \brief Print the additional element status data for this object, for SAS * type 1 objects. See SES2 r20 Sections 6.1.13.3.3 and 6.1.13.3.4. * - * \param enc SES enclosure, needed for type identification. * \param sesname SES device name associated with the object. * \param sbp Sbuf to print to. * \param obj The object to print the data for. - * \param periph_name Peripheral string associated with the object. */ static void -ses_print_addl_data_sas_type1(enc_softc_t *enc, char *sesname, - struct sbuf *sbp, enc_element_t *obj, char *periph_name) +ses_print_addl_data_sas_type1(char *sesname, struct sbuf *sbp, + enc_element_t *obj) { int i, num_phys; ses_element_t *elmpriv; @@ -2298,12 +2309,10 @@ ses_print_addl_data_sas_type1(enc_softc_t *enc, char * elmpriv = obj->elm_private; addl = &(elmpriv->addl); - if (addl->proto_hdr.sas == NULL) - return; - sbuf_printf(sbp, "%s: %s: SAS ", sesname, periph_name); - if (ses_obj_is_expander(enc, obj)) { + sbuf_printf(sbp, ", SAS "); + if (obj->elm_type == ELMTYP_SAS_EXP) { num_phys = addl->proto_hdr.sas->base_hdr.num_phys; - sbuf_printf(sbp, "Expander: %d Phys", num_phys); + sbuf_printf(sbp, "Expander: %d phys", num_phys); if (addl->proto_data.sasexp_phys == NULL) return; for (i = 0;i < num_phys;i++) { @@ -2314,7 +2323,7 @@ ses_print_addl_data_sas_type1(enc_softc_t *enc, char * } } else { num_phys = addl->proto_hdr.sas->base_hdr.num_phys; - sbuf_printf(sbp, "Port: %d Phys", num_phys); + sbuf_printf(sbp, "Port: %d phys", num_phys); if (addl->proto_data.sasport_phys == NULL) return; for (i = 0;i < num_phys;i++) { @@ -2330,6 +2339,24 @@ ses_print_addl_data_sas_type1(enc_softc_t *enc, char * } /** + * \brief Print the additional element status data for this object, for + * ATA objects. + * + * \param sbp Sbuf to print to. + * \param obj The object to print the data for. + */ +static void +ses_print_addl_data_ata(struct sbuf *sbp, enc_element_t *obj) +{ + ses_element_t *elmpriv = obj->elm_private; + struct ses_addl_status *addl = &elmpriv->addl; + struct ses_elm_ata_hdr *ata = addl->proto_hdr.ata; + + sbuf_printf(sbp, ", SATA Slot: scbus%d target %d\n", + scsi_4btoul(ata->bus), scsi_4btoul(ata->target)); +} + +/** * \brief Print the additional element status data for this object. * * \param enc SES softc associated with the object. @@ -2360,27 +2387,45 @@ ses_print_addl_data(enc_softc_t *enc, enc_element_t *o sbuf_printf(&sesname, "%s%d", enc->periph->periph_name, enc->periph->unit_number); sbuf_finish(&sesname); + sbuf_printf(&out, "%s: %s in ", sbuf_data(&sesname), sbuf_data(&name)); if (elmpriv->descr != NULL) - sbuf_printf(&out, "%s: %s: Element descriptor: '%s'\n", - sbuf_data(&sesname), sbuf_data(&name), elmpriv->descr); + sbuf_printf(&out, "'%s'", elmpriv->descr); + else { + if (obj->elm_type <= ELMTYP_LAST) + sbuf_cat(&out, elm_type_names[obj->elm_type]); + else + sbuf_printf(&out, "", obj->elm_type); + sbuf_printf(&out, " %d", obj->type_elm_idx); + if (obj->subenclosure != 0) + sbuf_printf(&out, " of subenc %d", obj->subenclosure); + } switch(ses_elm_addlstatus_proto(addl->hdr)) { + case SPSP_PROTO_FC: + goto noaddl; /* stubbed for now */ case SPSP_PROTO_SAS: + if (addl->proto_hdr.sas == NULL) + goto noaddl; switch(ses_elm_sas_descr_type(addl->proto_hdr.sas)) { case SES_SASOBJ_TYPE_SLOT: ses_print_addl_data_sas_type0(sbuf_data(&sesname), - &out, obj, sbuf_data(&name)); + &out, obj); break; case SES_SASOBJ_TYPE_OTHER: - ses_print_addl_data_sas_type1(enc, sbuf_data(&sesname), - &out, obj, sbuf_data(&name)); + ses_print_addl_data_sas_type1(sbuf_data(&sesname), + &out, obj); break; default: - break; + goto noaddl; } break; - case SPSP_PROTO_FC: /* stubbed for now */ + case SPSP_PROTO_ATA: + if (addl->proto_hdr.ata == NULL) + goto noaddl; + ses_print_addl_data_ata(&out, obj); break; default: +noaddl: + sbuf_cat(&out, "\n"); break; } sbuf_finish(&out); @@ -2485,7 +2530,7 @@ ses_get_elm_addlstatus_sas_type1(enc_softc_t *enc, enc goto out; /* Process expanders differently from other type1 cases */ - if (ses_obj_is_expander(enc, obj)) { + if (obj->elm_type == ELMTYP_SAS_EXP) { offset += sizeof(struct ses_elm_sas_type1_expander_hdr); physz = addl->proto_hdr.sas->base_hdr.num_phys * sizeof(struct ses_elm_sas_expander_phy); @@ -2588,6 +2633,53 @@ ses_get_elm_addlstatus_sas(enc_softc_t *enc, enc_cache err = ENODEV; break; } + +out: + return (err); +} + +/** + * \brief Update the softc with the additional element status data for this + * object, for ATA objects. + * + * \param enc SES softc to be updated. + * \param buf The additional element status response buffer. + * \param bufsiz Size of the response buffer. + * \param eip The EIP bit value. + * \param tidx Type index for this object. + * \param nobj Number of objects attached to the SES softc. + * + * \return 0 on success, errno otherwise. + */ +static int +ses_get_elm_addlstatus_ata(enc_softc_t *enc, enc_cache_t *enc_cache, + uint8_t *buf, int bufsiz, int eip, int tidx, + int nobj) +{ + int err; + ses_cache_t *ses_cache; + + if (bufsiz < sizeof(struct ses_elm_ata_hdr)) { + err = EIO; + goto out; + } + + ses_cache = enc_cache->private; + switch(ses_cache->ses_types[tidx].hdr->etype_elm_type) { + case ELMTYP_DEVICE: + case ELMTYP_ARRAY_DEV: + break; + default: + ENC_VLOG(enc, "Element %d has Additional Status, " + "invalid for SES element type 0x%x\n", nobj, + ses_cache->ses_types[tidx].hdr->etype_elm_type); + err = ENODEV; + goto out; + } + + ((ses_element_t *)enc_cache->elm_map[nobj].elm_private) + ->addl.proto_hdr.ata = (struct ses_elm_ata_hdr *)buf; + err = 0; out: return (err); Modified: head/sys/cam/scsi/scsi_ses.h ============================================================================== --- head/sys/cam/scsi/scsi_ses.h Sun Jun 23 18:35:11 2019 (r349320) +++ head/sys/cam/scsi/scsi_ses.h Sun Jun 23 19:05:01 2019 (r349321) @@ -2181,15 +2181,27 @@ struct ses_status_page_hdr { #define SESCTL_DISABLE 0x20 #define SESCTL_RSTSWAP 0x10 - -/* Control bits, Device Elements, byte 2 */ -#define SESCTL_DRVLCK 0x40 /* "DO NOT REMOVE" */ +/* Control bits, Array Device Slot Elements, byte 1 */ +#define SESCTL_RQSOK 0x80 /* RQST OK */ +#define SESCTL_RQSRSV 0x40 /* RQST RSVD DEVICE */ +#define SESCTL_RQSSPR 0x20 /* RQST HOT SPARE */ +#define SESCTL_RQSCCH 0x10 /* RQST CONS CHECK */ +#define SESCTL_RQSCRA 0x08 /* RQST IN CRIT ARRAY */ +#define SESCTL_RQSFAA 0x04 /* RQST IN FAILED ARRAY */ +#define SESCTL_RQSRR 0x02 /* RQST REBUI/REMAP */ +#define SESCTL_RQSRRA 0x01 /* RQST R/R ABORT */ +/* Control bits, [Array] Device Slot Elements, byte 2 */ +#define SESCTL_RQSACT 0x80 /* RQST ACTIVE */ +#define SESCTL_DRVLCK 0x40 /* DO NOT REMOVE */ +#define SESCTL_RQSMSN 0x10 /* RQST MISSING */ #define SESCTL_RQSINS 0x08 /* RQST INSERT */ #define SESCTL_RQSRMV 0x04 /* RQST REMOVE */ #define SESCTL_RQSID 0x02 /* RQST IDENT */ -/* Control bits, Device Elements, byte 3 */ +/* Control bits, [Array] Device Slot Elements, byte 3 */ #define SESCTL_RQSFLT 0x20 /* RQST FAULT */ #define SESCTL_DEVOFF 0x10 /* DEVICE OFF */ +#define SESCTL_ENBYPA 0x08 /* ENABLE BYP A */ +#define SESCTL_ENBYPB 0x04 /* ENABLE BYP B */ /* Control bits, Generic, byte 3 */ #define SESCTL_RQSTFAIL 0x40 @@ -2398,6 +2410,17 @@ union ses_elm_sas_hdr { }; int ses_elm_sas_type0_not_all_phys(union ses_elm_sas_hdr *); int ses_elm_sas_descr_type(union ses_elm_sas_hdr *); + +/* + * This structure for SPSP_PROTO_ATA is not defined by SES specs, + * but purely my own design to make AHCI EM interoperate with SES. + * Since no other software I know can talk to SEMB, and we do not + * expose this this outside, it should be safe to do what we want. + */ +struct ses_elm_ata_hdr { + uint8_t bus[4]; + uint8_t target[4]; +}; struct ses_elm_addlstatus_base_hdr { uint8_t byte0; Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Sun Jun 23 18:35:11 2019 (r349320) +++ head/sys/dev/ahci/ahci.c Sun Jun 23 19:05:01 2019 (r349321) @@ -186,6 +186,7 @@ ahci_attach(device_t dev) ctlr->ccc = 0; resource_int_value(device_get_name(dev), device_get_unit(dev), "ccc", &ctlr->ccc); + mtx_init(&ctlr->ch_mtx, "AHCI channels lock", NULL, MTX_DEF); /* Setup our own memory management for channels. */ ctlr->sc_iomem.rm_start = rman_get_start(ctlr->r_mem); @@ -379,6 +380,7 @@ ahci_detach(device_t dev) /* Free memory. */ rman_fini(&ctlr->sc_iomem); ahci_free_mem(dev); + mtx_destroy(&ctlr->ch_mtx); return (0); } @@ -666,6 +668,50 @@ ahci_get_dma_tag(device_t dev, device_t child) return (ctlr->dma_tag); } +void +ahci_attached(device_t dev, struct ahci_channel *ch) +{ + struct ahci_controller *ctlr = device_get_softc(dev); + + mtx_lock(&ctlr->ch_mtx); + ctlr->ch[ch->unit] = ch; + mtx_unlock(&ctlr->ch_mtx); +} + +void +ahci_detached(device_t dev, struct ahci_channel *ch) +{ + struct ahci_controller *ctlr = device_get_softc(dev); + + mtx_lock(&ctlr->ch_mtx); + mtx_lock(&ch->mtx); + ctlr->ch[ch->unit] = NULL; + mtx_unlock(&ch->mtx); + mtx_unlock(&ctlr->ch_mtx); +} + +struct ahci_channel * +ahci_getch(device_t dev, int n) +{ + struct ahci_controller *ctlr = device_get_softc(dev); + struct ahci_channel *ch; + + KASSERT(n >= 0 && n < AHCI_MAX_PORTS, ("Bad channel number %d", n)); + mtx_lock(&ctlr->ch_mtx); + ch = ctlr->ch[n]; + if (ch != NULL) + mtx_lock(&ch->mtx); + mtx_unlock(&ctlr->ch_mtx); + return (ch); +} + +void +ahci_putch(struct ahci_channel *ch) +{ + + mtx_unlock(&ch->mtx); +} + static int ahci_ch_probe(device_t dev) { @@ -824,6 +870,7 @@ ahci_ch_attach(device_t dev) ahci_ch_pm, ch); } mtx_unlock(&ch->mtx); + ahci_attached(device_get_parent(dev), ch); ctx = device_get_sysctl_ctx(dev); tree = device_get_sysctl_tree(dev); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "disable_phy", @@ -849,6 +896,7 @@ ahci_ch_detach(device_t dev) { struct ahci_channel *ch = device_get_softc(dev); + ahci_detached(device_get_parent(dev), ch); mtx_lock(&ch->mtx); xpt_async(AC_LOST_DEVICE, ch->path, NULL); /* Forget about reset. */ Modified: head/sys/dev/ahci/ahci.h ============================================================================== --- head/sys/dev/ahci/ahci.h Sun Jun 23 18:35:11 2019 (r349320) +++ head/sys/dev/ahci/ahci.h Sun Jun 23 19:05:01 2019 (r349321) @@ -524,6 +524,8 @@ struct ahci_controller { } interrupt[AHCI_MAX_PORTS]; void (*ch_start)(struct ahci_channel *); int dma_coherent; /* DMA is cache-coherent */ + struct mtx ch_mtx; /* Lock for attached channels */ + struct ahci_channel *ch[AHCI_MAX_PORTS]; /* Attached channels */ }; enum ahci_err_type { @@ -653,6 +655,12 @@ bus_dma_tag_t ahci_get_dma_tag(device_t dev, device_t int ahci_ctlr_reset(device_t dev); int ahci_ctlr_setup(device_t dev); void ahci_free_mem(device_t dev); + +/* Functions to allow AHCI EM to access other channels. */ +void ahci_attached(device_t dev, struct ahci_channel *ch); +void ahci_detached(device_t dev, struct ahci_channel *ch); +struct ahci_channel * ahci_getch(device_t dev, int n); +void ahci_putch(struct ahci_channel *ch); extern devclass_t ahci_devclass; Modified: head/sys/dev/ahci/ahciem.c ============================================================================== --- head/sys/dev/ahci/ahciem.c Sun Jun 23 18:35:11 2019 (r349320) +++ head/sys/dev/ahci/ahciem.c Sun Jun 23 19:05:01 2019 (r349321) @@ -294,14 +294,14 @@ ahci_em_setleds(device_t dev, int c) enc = device_get_softc(dev); val = 0; - if (enc->status[c][2] & 0x80) /* Activity */ + if (enc->status[c][2] & SESCTL_RQSACT) /* Activity */ val |= (1 << 0); - if (enc->status[c][2] & SESCTL_RQSID) /* Identification */ + if (enc->status[c][1] & SESCTL_RQSRR) /* Rebuild */ + val |= (1 << 6) | (1 << 3); + else if (enc->status[c][2] & SESCTL_RQSID) /* Identification */ val |= (1 << 3); else if (enc->status[c][3] & SESCTL_RQSFLT) /* Fault */ val |= (1 << 6); - else if (enc->status[c][1] & 0x02) /* Rebuild */ - val |= (1 << 6) | (1 << 3); timeout = 10000; while (ATA_INL(enc->r_memc, 0) & (AHCI_EM_TM | AHCI_EM_RST) && @@ -366,9 +366,12 @@ static void ahci_em_emulate_ses_on_led(device_t dev, union ccb *ccb) { struct ahci_enclosure *enc; + struct ahci_channel *ch; struct ses_status_page *page; struct ses_status_array_dev_slot *ads, *ads0; struct ses_elm_desc_hdr *elmd; + struct ses_elm_addlstatus_eip_hdr *elma; + struct ses_elm_ata_hdr *elmb; uint8_t *buf; int i; @@ -391,7 +394,7 @@ ahci_em_emulate_ses_on_led(device_t dev, union ccb *cc strncpy(&buf[3], device_get_nameunit(dev), 7); strncpy(&buf[10], "AHCI ", SID_VENDOR_SIZE); strncpy(&buf[18], "SGPIO Enclosure ", SID_PRODUCT_SIZE); - strncpy(&buf[34], "1.00", SID_REVISION_SIZE); + strncpy(&buf[34], "2.00", SID_REVISION_SIZE); strncpy(&buf[39], "0001", 4); strncpy(&buf[43], "S-E-S ", 6); strncpy(&buf[49], "2.00", 4); @@ -403,14 +406,15 @@ ahci_em_emulate_ses_on_led(device_t dev, union ccb *cc page = (struct ses_status_page *)buf; if (ccb->ataio.cmd.lba_low == 0x02 && ccb->ataio.cmd.features == 0x00 && - ccb->ataio.cmd.sector_count >= 2) { + ccb->ataio.cmd.sector_count >= 3) { bzero(buf, ccb->ataio.dxfer_len); page->hdr.page_code = 0; - scsi_ulto2b(4, page->hdr.length); - buf[4] = 0; - buf[5] = 1; - buf[6] = 2; - buf[7] = 7; + scsi_ulto2b(5, page->hdr.length); + buf[4] = 0x00; + buf[5] = 0x01; + buf[6] = 0x02; + buf[7] = 0x07; + buf[8] = 0x0a; ccb->ccb_h.status = CAM_REQ_CMP; goto out; } @@ -418,26 +422,30 @@ ahci_em_emulate_ses_on_led(device_t dev, union ccb *cc /* SEMB RECEIVE DIAGNOSTIC RESULT (1) */ if (ccb->ataio.cmd.lba_low == 0x02 && ccb->ataio.cmd.features == 0x01 && - ccb->ataio.cmd.sector_count >= 13) { + ccb->ataio.cmd.sector_count >= 16) { struct ses_enc_desc *ed; struct ses_elm_type_desc *td; bzero(buf, ccb->ataio.dxfer_len); page->hdr.page_code = 0x01; - scsi_ulto2b(4 + 4 + 36 + 4, page->hdr.length); + scsi_ulto2b(4 + sizeof(*ed) + sizeof(*td) + 11, + page->hdr.length); ed = (struct ses_enc_desc *)&buf[8]; ed->byte0 = 0x11; ed->subenc_id = 0; ed->num_types = 1; ed->length = 36; + ed->logical_id[0] = 0x30; /* NAA Locally Assigned. */ + strncpy(&ed->logical_id[1], device_get_nameunit(dev), 7); strncpy(ed->vendor_id, "AHCI ", SID_VENDOR_SIZE); strncpy(ed->product_id, "SGPIO Enclosure ", SID_PRODUCT_SIZE); - strncpy(ed->product_rev, " ", SID_REVISION_SIZE); + strncpy(ed->product_rev, "2.00", SID_REVISION_SIZE); td = (struct ses_elm_type_desc *)ses_enc_desc_next(ed); td->etype_elm_type = 0x17; td->etype_maxelt = enc->channels; td->etype_subenc = 0; - td->etype_txt_len = 0; + td->etype_txt_len = 11; + snprintf((char *)(td + 1), 12, "Drive Slots"); ccb->ccb_h.status = CAM_REQ_CMP; goto out; } @@ -453,10 +461,22 @@ ahci_em_emulate_ses_on_led(device_t dev, union ccb *cc for (i = 0; i < enc->channels; i++) { ads = &page->elements[i + 1].array_dev_slot; memcpy(ads, enc->status[i], 4); - ads->common.bytes[0] |= - (enc->ichannels & (1 << i)) ? - SES_OBJSTAT_UNKNOWN : - SES_OBJSTAT_NOTINSTALLED; + ch = ahci_getch(device_get_parent(dev), i); + if (ch == NULL) { + ads->common.bytes[0] |= SES_OBJSTAT_UNKNOWN; + continue; + } + if (ch->pm_present) + ads->common.bytes[0] |= SES_OBJSTAT_UNKNOWN; + else if (ch->devices) + ads->common.bytes[0] |= SES_OBJSTAT_OK; + else if (ch->disablephy) + ads->common.bytes[0] |= SES_OBJSTAT_NOTAVAIL; + else + ads->common.bytes[0] |= SES_OBJSTAT_NOTINSTALLED; + if (ch->disablephy) + ads->common.bytes[3] |= SESCTL_DEVOFF; + ahci_putch(ch); } ccb->ccb_h.status = CAM_REQ_CMP; goto out; @@ -471,21 +491,21 @@ ahci_em_emulate_ses_on_led(device_t dev, union ccb *cc ads = &page->elements[i + 1].array_dev_slot; if (ads->common.bytes[0] & SESCTL_CSEL) { enc->status[i][0] = 0; - enc->status[i][1] = - ads->bytes[0] & 0x02; - enc->status[i][2] = - ads->bytes[1] & (0x80 | SESCTL_RQSID); - enc->status[i][3] = - ads->bytes[2] & SESCTL_RQSFLT; + enc->status[i][1] = ads->bytes[0] & + SESCTL_RQSRR; + enc->status[i][2] = ads->bytes[1] & + (SESCTL_RQSACT | SESCTL_RQSID); + enc->status[i][3] = ads->bytes[2] & + SESCTL_RQSFLT; ahci_em_setleds(dev, i); } else if (ads0->common.bytes[0] & SESCTL_CSEL) { enc->status[i][0] = 0; - enc->status[i][1] = - ads0->bytes[0] & 0x02; - enc->status[i][2] = - ads0->bytes[1] & (0x80 | SESCTL_RQSID); - enc->status[i][3] = - ads0->bytes[2] & SESCTL_RQSFLT; + enc->status[i][1] = ads0->bytes[0] & + SESCTL_RQSRR; + enc->status[i][2] = ads0->bytes[1] & + (SESCTL_RQSACT | SESCTL_RQSID); + enc->status[i][3] = ads0->bytes[2] & + SESCTL_RQSFLT; ahci_em_setleds(dev, i); } } @@ -496,15 +516,48 @@ ahci_em_emulate_ses_on_led(device_t dev, union ccb *cc /* SEMB RECEIVE DIAGNOSTIC RESULT (7) */ if (ccb->ataio.cmd.lba_low == 0x02 && ccb->ataio.cmd.features == 0x07 && - ccb->ataio.cmd.sector_count >= (3 + 3 * enc->channels)) { + ccb->ataio.cmd.sector_count >= (6 + 3 * enc->channels)) { bzero(buf, ccb->ataio.dxfer_len); page->hdr.page_code = 0x07; - scsi_ulto2b(4 + 4 + 12 * enc->channels, + scsi_ulto2b(4 + 15 + 11 * enc->channels, page->hdr.length); + elmd = (struct ses_elm_desc_hdr *)&buf[8]; + scsi_ulto2b(11, elmd->length); + snprintf((char *)(elmd + 1), 12, "Drive Slots"); + for (i = 0; i < enc->channels; i++) { + elmd = (struct ses_elm_desc_hdr *)&buf[8 + 15 + 11 * i]; + scsi_ulto2b(7, elmd->length); + snprintf((char *)(elmd + 1), 8, "Slot %02d", i); + } + ccb->ccb_h.status = CAM_REQ_CMP; + goto out; + } + + /* SEMB RECEIVE DIAGNOSTIC RESULT (a) */ + if (ccb->ataio.cmd.lba_low == 0x02 && + ccb->ataio.cmd.features == 0x0a && + ccb->ataio.cmd.sector_count >= (2 + 3 * enc->channels)) { + bzero(buf, ccb->ataio.dxfer_len); + page->hdr.page_code = 0x0a; + scsi_ulto2b(4 + (sizeof(*elma) + sizeof(*elmb)) * enc->channels, page->hdr.length); for (i = 0; i < enc->channels; i++) { - elmd = (struct ses_elm_desc_hdr *)&buf[8 + 4 + 12 * i]; - scsi_ulto2b(8, elmd->length); - snprintf((char *)(elmd + 1), 9, "SLOT %03d", i); + elma = (struct ses_elm_addlstatus_eip_hdr *)&buf[ + 8 + (sizeof(*elma) + sizeof(*elmb)) * i]; + elma->base.byte0 = 0x10 | SPSP_PROTO_ATA; + elma->base.length = 2 + sizeof(*elmb); + elma->byte2 = 0x01; + elma->element_index = 1 + i; + ch = ahci_getch(device_get_parent(dev), i); + if (ch == NULL) { + elma->base.byte0 |= 0x80; + continue; + } + if (ch->devices == 0 || ch->pm_present) + elma->base.byte0 |= 0x80; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Jun 23 19:37:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8519515D8CD5; Sun, 23 Jun 2019 19:37:13 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DED2C6C4B0; Sun, 23 Jun 2019 19:37:12 +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 BA972263C6; Sun, 23 Jun 2019 19:37:12 +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 x5NJbCC0073338; Sun, 23 Jun 2019 19:37:12 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5NJbCb7073337; Sun, 23 Jun 2019 19:37:12 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201906231937.x5NJbCb7073337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sun, 23 Jun 2019 19:37:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349322 - head/tests/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/tests/sys/netinet X-SVN-Commit-Revision: 349322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DED2C6C4B0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 19:37:13 -0000 Author: lwhsu Date: Sun Jun 23 19:37:12 2019 New Revision: 349322 URL: https://svnweb.freebsd.org/changeset/base/349322 Log: Skip sys.netinet.socket_afinet.socket_afinet_bind_zero temporarily because it doesn't work when mac_portacl(4) loaded PR: 238781 Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/netinet/socket_afinet.c Modified: head/tests/sys/netinet/socket_afinet.c ============================================================================== --- head/tests/sys/netinet/socket_afinet.c Sun Jun 23 19:05:01 2019 (r349321) +++ head/tests/sys/netinet/socket_afinet.c Sun Jun 23 19:37:12 2019 (r349322) @@ -51,6 +51,8 @@ ATF_TC_BODY(socket_afinet_bind_zero, tc) int sd, rc; struct sockaddr_in sin; + atf_tc_skip("doesn't work when mac_portacl(4) loaded (bug238781)"); + sd = socket(PF_INET, SOCK_DGRAM, 0); ATF_CHECK(sd >= 0); From owner-svn-src-head@freebsd.org Sun Jun 23 21:06:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D42115DB366; Sun, 23 Jun 2019 21:06:57 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A70186FD8F; Sun, 23 Jun 2019 21:06:56 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 954AA27386; Sun, 23 Jun 2019 21:06:56 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5NL6u6m020225; Sun, 23 Jun 2019 21:06:56 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5NL6u1i020224; Sun, 23 Jun 2019 21:06:56 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201906232106.x5NL6u1i020224@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 23 Jun 2019 21:06:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349323 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349323 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A70186FD8F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 21:06:57 -0000 Author: alc Date: Sun Jun 23 21:06:56 2019 New Revision: 349323 URL: https://svnweb.freebsd.org/changeset/base/349323 Log: pmap_enter_quick_locked() never replaces a valid mapping, so it need not perform a TLB invalidation. A barrier suffices. (See r343876.) Add a comment to pmap_enter_quick_locked() in order to highlight the fact that it does not replace valid mappings. Correct a typo in one of pmap_enter()'s comments. MFC after: 1 week Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sun Jun 23 19:37:12 2019 (r349322) +++ head/sys/arm64/arm64/pmap.c Sun Jun 23 21:06:56 2019 (r349323) @@ -3408,7 +3408,7 @@ validate: __func__, pmap, va, new_l3); } } else { - /* New mappig */ + /* New mapping */ pmap_load_store(l3, new_l3); dsb(ishst); } @@ -3706,6 +3706,9 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v l3 = pmap_l2_to_l3(pde, va); } + /* + * Abort if a mapping already exists. + */ if (pmap_load(l3) != 0) { if (mpte != NULL) { mpte->wire_count--; @@ -3755,7 +3758,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v cpu_icache_sync_range(PHYS_TO_DMAP(pa), PAGE_SIZE); pmap_load_store(l3, l3_val); - pmap_invalidate_page(pmap, va); + dsb(ishst); return (mpte); } From owner-svn-src-head@freebsd.org Sun Jun 23 21:15:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65D9215DB955; Sun, 23 Jun 2019 21:15:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0C5F5704FB; Sun, 23 Jun 2019 21:15: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 D814027524; Sun, 23 Jun 2019 21:15:31 +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 x5NLFVMC025390; Sun, 23 Jun 2019 21:15:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5NLFVJG025389; Sun, 23 Jun 2019 21:15:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201906232115.x5NLFVJG025389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 23 Jun 2019 21:15:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349324 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349324 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0C5F5704FB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 21:15:32 -0000 Author: kib Date: Sun Jun 23 21:15:31 2019 New Revision: 349324 URL: https://svnweb.freebsd.org/changeset/base/349324 Log: Switch to check for effective user id in r349320, and disable dumping into existing files for sugid processes. Despite using real user id pronounces the intent, it actually breaks suid coredumps, while not making any difference for non-sugid processes. The reason for the breakage is that non-existent core file is created with the effective uid (unless weird hacks like SUIDDIR are configured). Then, if user enabled kern.sugid_coredump, core dumping should not overwrite core files owned by effective uid, but we cannot pretend to use real uid for dumping. PR: 68905 admbugs: 358 Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Sun Jun 23 21:06:56 2019 (r349323) +++ head/sys/kern/kern_sig.c Sun Jun 23 21:15:31 2019 (r349324) @@ -3398,10 +3398,16 @@ corefile_open_last(struct thread *td, char *name, int } if (oldvp != NULL) { - if (nextvp == NULL) - nextvp = oldvp; - else + if (nextvp == NULL) { + if ((td->td_proc->p_flag & P_SUGID) != 0) { + error = EFAULT; + vnode_close_locked(td, oldvp); + } else { + nextvp = oldvp; + } + } else { vnode_close_locked(td, oldvp); + } } if (error != 0) { if (nextvp != NULL) @@ -3521,6 +3527,8 @@ corefile_open(const char *comm, uid_t uid, pid_t pid, oflags = VN_OPEN_NOAUDIT | VN_OPEN_NAMECACHE | (capmode_coredump ? VN_OPEN_NOCAPCHECK : 0); flags = O_CREAT | FWRITE | O_NOFOLLOW; + if ((td->td_proc->p_flag & P_SUGID) != 0) + flags |= O_EXCL; NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td); error = vn_open_cred(&nd, &flags, cmode, oflags, td->td_ucred, @@ -3597,11 +3605,11 @@ coredump(struct thread *td) /* * Don't dump to non-regular files or files with links. - * Do not dump into system files. Real user must own the corefile. + * Do not dump into system files. Effective user must own the corefile. */ if (vp->v_type != VREG || VOP_GETATTR(vp, &vattr, cred) != 0 || vattr.va_nlink != 1 || (vp->v_vflag & VV_SYSTEM) != 0 || - vattr.va_uid != cred->cr_ruid) { + vattr.va_uid != cred->cr_uid) { VOP_UNLOCK(vp, 0); error = EFAULT; goto out; From owner-svn-src-head@freebsd.org Sun Jun 23 21:17:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1097015DBA1E; Sun, 23 Jun 2019 21:17:43 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A856A7068E; Sun, 23 Jun 2019 21:17:42 +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 7535827529; Sun, 23 Jun 2019 21:17:42 +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 x5NLHgPv025541; Sun, 23 Jun 2019 21:17:42 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5NLHgLU025540; Sun, 23 Jun 2019 21:17:42 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201906232117.x5NLHgLU025540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 23 Jun 2019 21:17:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349325 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 349325 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A856A7068E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 21:17:43 -0000 Author: ian Date: Sun Jun 23 21:17:41 2019 New Revision: 349325 URL: https://svnweb.freebsd.org/changeset/base/349325 Log: Allow compiling ukbdmap.h on arm, since it appears to work fine. Modified: head/sys/conf/files.arm Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Sun Jun 23 21:15:31 2019 (r349324) +++ head/sys/conf/files.arm Sun Jun 23 21:17:41 2019 (r349325) @@ -166,6 +166,12 @@ cloudabi32_vdso_blob.o optional compat_cloudabi32 \ clean "cloudabi32_vdso_blob.o" # +# +ukbdmap.h optional ukbd_dflt_keymap \ + compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ + no-obj no-implicit-rule before-depend \ + clean "ukbdmap.h" + # Annapurna support arm/annapurna/alpine/alpine_ccu.c optional al_ccu fdt arm/annapurna/alpine/alpine_nb_service.c optional al_nb_service fdt From owner-svn-src-head@freebsd.org Sun Jun 23 21:21:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 222BE15DBB5B; Sun, 23 Jun 2019 21:21:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B980F70BBA; Sun, 23 Jun 2019 21:21:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95DAE27563; Sun, 23 Jun 2019 21:21:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5NLLBLm028823; Sun, 23 Jun 2019 21:21:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5NLLBDP028822; Sun, 23 Jun 2019 21:21:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201906232121.x5NLLBDP028822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 23 Jun 2019 21:21:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349326 - 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: 349326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B980F70BBA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.950,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2019 21:21:12 -0000 Author: kib Date: Sun Jun 23 21:21:11 2019 New Revision: 349326 URL: https://svnweb.freebsd.org/changeset/base/349326 Log: amd64 pmap: block on turnstile for lock-less DI. Port the code to block on turnstile instead of yielding, to lock-less delayed invalidation. The yield might cause tight loop due to priority inversion. Since it is impossible to avoid race between block and wake-up, arm 1-tick callout to wakeup when thread blocks itself. Reported and tested by: mjg Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 2 months Differential revision: https://reviews.freebsd.org/D20636 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sun Jun 23 21:17:41 2019 (r349325) +++ head/sys/amd64/amd64/pmap.c Sun Jun 23 21:21:11 2019 (r349326) @@ -484,6 +484,9 @@ static struct pmap_invl_gen pmap_invl_gen_head = { .next = NULL, }; static u_long pmap_invl_gen = 1; +static int pmap_invl_waiters; +static struct callout pmap_invl_callout; +static bool pmap_invl_callout_inited; #define PMAP_ASSERT_NOT_IN_DI() \ KASSERT(pmap_not_in_di(), ("DI already started")) @@ -538,6 +541,34 @@ pmap_thread_init_invl_gen_l(struct thread *td) invl_gen->gen = 0; } +static void +pmap_delayed_invl_wait_block(u_long *m_gen, u_long *invl_gen) +{ + struct turnstile *ts; + + ts = turnstile_trywait(&invl_gen_ts); + if (*m_gen > atomic_load_long(invl_gen)) + turnstile_wait(ts, NULL, TS_SHARED_QUEUE); + else + turnstile_cancel(ts); +} + +static void +pmap_delayed_invl_finish_unblock(u_long new_gen) +{ + struct turnstile *ts; + + turnstile_chain_lock(&invl_gen_ts); + ts = turnstile_lookup(&invl_gen_ts); + if (new_gen != 0) + pmap_invl_gen = new_gen; + if (ts != NULL) { + turnstile_broadcast(ts, TS_SHARED_QUEUE); + turnstile_unpend(ts); + } + turnstile_chain_unlock(&invl_gen_ts); +} + /* * Start a new Delayed Invalidation (DI) block of code, executed by * the current thread. Within a DI block, the current thread may @@ -582,24 +613,15 @@ static void pmap_delayed_invl_finish_l(void) { struct pmap_invl_gen *invl_gen, *next; - struct turnstile *ts; invl_gen = &curthread->td_md.md_invl_gen; KASSERT(invl_gen->gen != 0, ("missed invl_start")); mtx_lock(&invl_gen_mtx); next = LIST_NEXT(invl_gen, link); - if (next == NULL) { - turnstile_chain_lock(&invl_gen_ts); - ts = turnstile_lookup(&invl_gen_ts); - pmap_invl_gen = invl_gen->gen; - if (ts != NULL) { - turnstile_broadcast(ts, TS_SHARED_QUEUE); - turnstile_unpend(ts); - } - turnstile_chain_unlock(&invl_gen_ts); - } else { + if (next == NULL) + pmap_delayed_invl_finish_unblock(invl_gen->gen); + else next->gen = invl_gen->gen; - } LIST_REMOVE(invl_gen, link); mtx_unlock(&invl_gen_mtx); invl_gen->gen = 0; @@ -856,6 +878,8 @@ again: goto again; } critical_exit(); + if (atomic_load_int(&pmap_invl_waiters) > 0) + pmap_delayed_invl_finish_unblock(0); if (invl_gen->saved_pri != 0) { thread_lock(td); sched_prio(td, invl_gen->saved_pri); @@ -888,6 +912,9 @@ DB_SHOW_COMMAND(di_queue, pmap_di_queue) static long invl_wait; SYSCTL_LONG(_vm_pmap, OID_AUTO, invl_wait, CTLFLAG_RD, &invl_wait, 0, "Number of times DI invalidation blocked pmap_remove_all/write"); +static long invl_wait_slow; +SYSCTL_LONG(_vm_pmap, OID_AUTO, invl_wait_slow, CTLFLAG_RD, &invl_wait_slow, 0, + "Number of slow invalidation waits for lockless DI"); #endif static u_long * @@ -897,6 +924,27 @@ pmap_delayed_invl_genp(vm_page_t m) return (&pv_invl_gen[pa_index(VM_PAGE_TO_PHYS(m)) % NPV_LIST_LOCKS]); } +static void +pmap_delayed_invl_callout_func(void *arg __unused) +{ + + if (atomic_load_int(&pmap_invl_waiters) == 0) + return; + pmap_delayed_invl_finish_unblock(0); +} + +static void +pmap_delayed_invl_callout_init(void *arg __unused) +{ + + if (pmap_di_locked()) + return; + callout_init(&pmap_invl_callout, 1); + pmap_invl_callout_inited = true; +} +SYSINIT(pmap_di_callout, SI_SUB_CPU + 1, SI_ORDER_ANY, + pmap_delayed_invl_callout_init, NULL); + /* * Ensure that all currently executing DI blocks, that need to flush * TLB for the given page m, actually flushed the TLB at the time the @@ -914,7 +962,6 @@ pmap_delayed_invl_genp(vm_page_t m) static void pmap_delayed_invl_wait_l(vm_page_t m) { - struct turnstile *ts; u_long *m_gen; #ifdef PV_STATS bool accounted = false; @@ -928,11 +975,7 @@ pmap_delayed_invl_wait_l(vm_page_t m) accounted = true; } #endif - ts = turnstile_trywait(&invl_gen_ts); - if (*m_gen > pmap_invl_gen) - turnstile_wait(ts, NULL, TS_SHARED_QUEUE); - else - turnstile_cancel(ts); + pmap_delayed_invl_wait_block(m_gen, &pmap_invl_gen); } } @@ -940,19 +983,53 @@ static void pmap_delayed_invl_wait_u(vm_page_t m) { u_long *m_gen; -#ifdef PV_STATS - bool accounted = false; -#endif + struct lock_delay_arg lda; + bool fast; + fast = true; m_gen = pmap_delayed_invl_genp(m); + lock_delay_arg_init(&lda, &di_delay); while (*m_gen > atomic_load_long(&pmap_invl_gen_head.gen)) { -#ifdef PV_STATS - if (!accounted) { - atomic_add_long(&invl_wait, 1); - accounted = true; + if (fast || !pmap_invl_callout_inited) { + PV_STAT(atomic_add_long(&invl_wait, 1)); + lock_delay(&lda); + fast = false; + } else { + /* + * The page's invalidation generation number + * is still below the current thread's number. + * Prepare to block so that we do not waste + * CPU cycles or worse, suffer livelock. + * + * Since it is impossible to block without + * racing with pmap_delayed_invl_finish_u(), + * prepare for the race by incrementing + * pmap_invl_waiters and arming a 1-tick + * callout which will unblock us if we lose + * the race. + */ + atomic_add_int(&pmap_invl_waiters, 1); + + /* + * Re-check the current thread's invalidation + * generation after incrementing + * pmap_invl_waiters, so that there is no race + * with pmap_delayed_invl_finish_u() setting + * the page generation and checking + * pmap_invl_waiters. The only race allowed + * is for a missed unblock, which is handled + * by the callout. + */ + if (*m_gen > + atomic_load_long(&pmap_invl_gen_head.gen)) { + callout_reset(&pmap_invl_callout, 1, + pmap_delayed_invl_callout_func, NULL); + PV_STAT(atomic_add_long(&invl_wait_slow, 1)); + pmap_delayed_invl_wait_block(m_gen, + &pmap_invl_gen_head.gen); + } + atomic_add_int(&pmap_invl_waiters, -1); } -#endif - kern_yield(PRI_USER); } } From owner-svn-src-head@freebsd.org Mon Jun 24 01:42:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01A6F15BB340; Mon, 24 Jun 2019 01:42:11 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 994E3802B5; Mon, 24 Jun 2019 01:42: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 7FDF52A0D7; Mon, 24 Jun 2019 01:42: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 x5O1gA07062385; Mon, 24 Jun 2019 01:42:10 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5O1g9LA062382; Mon, 24 Jun 2019 01:42:09 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201906240142.x5O1g9LA062382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 24 Jun 2019 01:42:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349327 - in head/sys: arm/conf conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: arm/conf conf X-SVN-Commit-Revision: 349327 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 994E3802B5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 01:42:11 -0000 Author: ian Date: Mon Jun 24 01:42:09 2019 New Revision: 349327 URL: https://svnweb.freebsd.org/changeset/base/349327 Log: Build an armv7 LINT kernel in addition to armv5 LINT. You might think this had been done years ago. I did. All this time we've only compiled a LINT kernel for TARGET_ARCH=arm. Now separate LINT-V5 and LINT-V7 configs are generated and built. There are two new files in arm/conf, NOTES.armv5 and NOTES.armv7, containing some of what used to be in the arm NOTES file. That file now contains only the bits that are common to v5 and v7. The makeLINT.mk file now creates the LINT-V5 and LINT-V7 files by concatening sys/conf/NOTES, arm/conf/NOTES, and arm/conf/NOTES.armv{5,7} in that order. Added: head/sys/arm/conf/NOTES.armv5 (contents, props changed) head/sys/arm/conf/NOTES.armv7 (contents, props changed) Modified: head/sys/arm/conf/NOTES head/sys/conf/makeLINT.mk Modified: head/sys/arm/conf/NOTES ============================================================================== --- head/sys/arm/conf/NOTES Sun Jun 23 21:21:11 2019 (r349326) +++ head/sys/arm/conf/NOTES Mon Jun 24 01:42:09 2019 (r349327) @@ -1,44 +1,22 @@ # $FreeBSD$ -machine arm - -cpu CPU_ARM9E - -files "../mv/files.mv" -files "../mv/discovery/files.db78xxx" -files "../mv/kirkwood/files.kirkwood" -files "../mv/orion/files.db88f5xxx" -files "../mv/orion/files.ts7800" - -makeoptions CONF_CFLAGS+="-march=armv5te" -makeoptions LDFLAGS="-zmuldefs" -makeoptions KERNPHYSADDR=0x00000000 - options FDT -options SOC_MV_DISCOVERY -options SOC_MV_KIRKWOOD -options SOC_MV_ORION +# Undo options from sys/conf/NOTES that we do not want... -options ARM_MANY_BOARD -device nand - -# IIC -device twsi - -nooptions SMP -nooptions MAXCPU - nooptions COMPAT_FREEBSD4 nooptions COMPAT_FREEBSD5 nooptions COMPAT_FREEBSD6 nooptions COMPAT_FREEBSD7 nooptions COMPAT_FREEBSD9 -nooption PPC_PROBE_CHIPSET +nooptions PPC_PROBE_CHIPSET +nooptions MAXCPU # value is set in machine/param.h +# Devices in sys/conf/NOTES for which no such hardware exists on arm, +# or the drivers don't compile... + nodevice fdc nodevice sym -nodevice ukbd nodevice sc nodevice blank_saver @@ -58,28 +36,9 @@ nodevice cxgbe nodevice cxgbev nodevice snd_cmi -# -# Enable the kernel DTrace hooks which are required to load the DTrace -# kernel modules. -# -options KDTRACE_HOOKS - -# DTrace core -# NOTE: introduces CDDL-licensed components into the kernel -#device dtrace - -# DTrace modules -#device dtrace_profile -#device dtrace_sdt -#device dtrace_fbt -#device dtrace_systrace -#device dtrace_prototype -#device dtnfscl -#device dtmalloc - -# Alternatively include all the DTrace modules -#device dtraceall - -# These aren't known to work on arm and/or don't compile nodevice mpr nodevice mps + +# Add devices which are specific to various arm platforms... + +device twsi # i2c controller on Marvel and Allwinner Added: head/sys/arm/conf/NOTES.armv5 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/NOTES.armv5 Mon Jun 24 01:42:09 2019 (r349327) @@ -0,0 +1,38 @@ +# armv5-specific changes for doing a LINT build. +# +# The contents of sys/conf/NOTES, sys/arm/conf/NOTES, and this file are +# concatenated (in that order) to create the LINT-V5 kernel config file. +# +# $FreeBSD$ + +#NO_UNIVERSE + +machine arm arm +cpu CPU_ARM9E + +files "../mv/files.mv" +files "../mv/discovery/files.db78xxx" +files "../mv/kirkwood/files.kirkwood" +files "../mv/orion/files.db88f5xxx" +files "../mv/orion/files.ts7800" + +makeoptions CONF_CFLAGS+="-march=armv5te" +makeoptions LDFLAGS="-zmuldefs" +makeoptions KERNPHYSADDR=0x00000000 + +# Undo options from sys/conf/NOTES that we do not want... + +nooptions SMP # All armv5 are single-core + +# Add options for armv5 that are not in sys/conf/NOTES... + +options ARM_MANY_BOARD + +options SOC_MV_DISCOVERY +options SOC_MV_KIRKWOOD +options SOC_MV_ORION + +# Add devices which are specific to various arm platforms... + +device nand + Added: head/sys/arm/conf/NOTES.armv7 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/NOTES.armv7 Mon Jun 24 01:42:09 2019 (r349327) @@ -0,0 +1,64 @@ +# armv7-specific changes for doing a LINT build. +# +# The contents of sys/conf/NOTES, sys/arm/conf/NOTES, and this file are +# concatenated (in that order) to create the LINT-V7 kernel config file. +# +# $FreeBSD$ + + +#NO_UNIVERSE + +machine arm armv7 +cpu CPU_CORTEXA +cpu CPU_MV_PJ4B +makeoptions CONF_CFLAGS+="-march=armv7a" + +# Add options for armv7 that are not in sys/conf/NOTES... + +options ARM_L2_PIPT # Only L2 PIPT is supported +options FREEBSD_BOOT_LOADER # Process metadata passed from loader(8) +options INTRNG # Include INTRNG framework +options LINUX_BOOT_ABI # Process metadata passed from U-Boot +options PLATFORM # Include platform_if support +options SMP # Most v7 SoCs are multicore +options VFP # Enable floating point hardware support + +# NOTE: dtrace introduces CDDL-licensed components into the kernel +device dtrace # dtrace core +device dtraceall # include all dtrace modules +options KDTRACE_HOOKS + +# Add misc devices which are specific to various arm platforms... + +device generic_timer # ARM Generic Timer +device gic # Interrupt controller +device gpio # gpio interface and bus +device mpcore_timer # ARM MPCore Timer +device pl310 # PL310 L2 cache controller +device pmu # PMU support (for CCNT). + +# Add EXT_RESOURCES pseudo devices... + +options EXT_RESOURCES +device clk +device phy +device hwreset +device nvmem +device regulator +device syscon + +# Build SOC-specific modules... + +makeoptions MODULES_EXTRA+="allwinner" +makeoptions MODULES_EXTRA+="arm_ti" +makeoptions MODULES_EXTRA+="imx" + +# Build dtb files... + +makeoptions MODULES_EXTRA+="dtb/allwinner" +makeoptions MODULES_EXTRA+="dtb/am335x" +makeoptions MODULES_EXTRA+="dtb/imx6" +makeoptions MODULES_EXTRA+="dtb/nvidia" +makeoptions MODULES_EXTRA+="dtb/omap4" +makeoptions MODULES_EXTRA+="dtb/rpi" +makeoptions MODULES_EXTRA+="dtb/zynq" Modified: head/sys/conf/makeLINT.mk ============================================================================== --- head/sys/conf/makeLINT.mk Sun Jun 23 21:21:11 2019 (r349326) +++ head/sys/conf/makeLINT.mk Mon Jun 24 01:42:09 2019 (r349327) @@ -47,6 +47,11 @@ LINT: ${NOTES} ${MAKELINT_SED} echo "nodevice txp" >> ${.TARGET}-NOIP echo "nodevice netmap" >> ${.TARGET}-NOIP .endif +.if ${TARGET} == "arm" + cat ${.TARGET} ${.CURDIR}/NOTES.armv5 > ${.TARGET}-V5 + cat ${.TARGET} ${.CURDIR}/NOTES.armv7 > ${.TARGET}-V7 + rm ${.TARGET} +.endif .if ${TARGET} == "mips" echo "machine ${TARGET} ${TARGET_ARCH}" >> ${.TARGET} .endif From owner-svn-src-head@freebsd.org Mon Jun 24 02:27:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51CA115BC279; Mon, 24 Jun 2019 02:27:18 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E8C1E815C3; Mon, 24 Jun 2019 02:27:17 +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 BF0422A8B1; Mon, 24 Jun 2019 02:27:17 +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 x5O2RHHN086248; Mon, 24 Jun 2019 02:27:17 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5O2RHKO086247; Mon, 24 Jun 2019 02:27:17 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201906240227.x5O2RHKO086247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 24 Jun 2019 02:27:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349328 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 349328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E8C1E815C3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 02:27:18 -0000 Author: ian Date: Mon Jun 24 02:27:17 2019 New Revision: 349328 URL: https://svnweb.freebsd.org/changeset/base/349328 Log: The gpiopps(4) driver currently has probe and attach code only for FDT based systems, so conditionalize it accordingly in conf/files. Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Jun 24 01:42:09 2019 (r349327) +++ head/sys/conf/files Mon Jun 24 02:27:17 2019 (r349328) @@ -1751,7 +1751,7 @@ dev/gpio/gpiospi.c optional gpiospi dev/gpio/gpioths.c optional gpioths dev/gpio/gpio_if.m optional gpio dev/gpio/gpiobus_if.m optional gpio -dev/gpio/gpiopps.c optional gpiopps +dev/gpio/gpiopps.c optional gpiopps fdt dev/gpio/ofw_gpiobus.c optional fdt gpio dev/hifn/hifn7751.c optional hifn dev/hme/if_hme.c optional hme From owner-svn-src-head@freebsd.org Mon Jun 24 02:30:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D4C915BC369; Mon, 24 Jun 2019 02:30:06 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B31418175B; Mon, 24 Jun 2019 02:30:05 +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 890442A8B6; Mon, 24 Jun 2019 02:30:05 +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 x5O2U5DJ086416; Mon, 24 Jun 2019 02:30:05 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5O2U5o3086415; Mon, 24 Jun 2019 02:30:05 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201906240230.x5O2U5o3086415@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 24 Jun 2019 02:30:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349329 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 349329 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B31418175B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 02:30:06 -0000 Author: ian Date: Mon Jun 24 02:30:05 2019 New Revision: 349329 URL: https://svnweb.freebsd.org/changeset/base/349329 Log: Add gpio(4) and related drivers to NOTES. Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Mon Jun 24 02:27:17 2019 (r349328) +++ head/sys/conf/NOTES Mon Jun 24 02:30:05 2019 (r349329) @@ -2481,6 +2481,18 @@ device pps device lpbb device pcfclock +# General Purpose I/O pins +device gpio # gpio interfaces and bus support +device gpiobacklight # sysctl control of gpio-based backlight +device gpioiic # i2c via gpio bitbang +device gpiokeys # kbd(4) glue for gpio-based key input +device gpioled # led(4) gpio glue +device gpiopower # event handler for gpio-based powerdown +device gpiopps # Pulse per second input from gpio pin +device gpioregulator # extres/regulator glue for gpio pin +device gpiospi # SPI via gpio bitbang +device gpioths # 1-wire temp/humidity sensor on gpio pin + # # Etherswitch framework and drivers # From owner-svn-src-head@freebsd.org Mon Jun 24 02:39:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 364CE15BC6C9; Mon, 24 Jun 2019 02:39:57 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D2E8D81D8C; Mon, 24 Jun 2019 02:39:56 +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 A99762AA57; Mon, 24 Jun 2019 02:39:56 +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 x5O2duI7091358; Mon, 24 Jun 2019 02:39:56 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5O2duDX091357; Mon, 24 Jun 2019 02:39:56 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201906240239.x5O2duDX091357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 24 Jun 2019 02:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349330 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 349330 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D2E8D81D8C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 02:39:57 -0000 Author: ian Date: Mon Jun 24 02:39:56 2019 New Revision: 349330 URL: https://svnweb.freebsd.org/changeset/base/349330 Log: Add pwm devices to NOTES. Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Mon Jun 24 02:30:05 2019 (r349329) +++ head/sys/conf/NOTES Mon Jun 24 02:39:56 2019 (r349330) @@ -2493,6 +2493,10 @@ device gpioregulator # extres/regulator glue for gpi device gpiospi # SPI via gpio bitbang device gpioths # 1-wire temp/humidity sensor on gpio pin +# Pulse width modulation +device pwmbus # pwm interface and bus support +device pwmc # userland control access to pwm outputs + # # Etherswitch framework and drivers # From owner-svn-src-head@freebsd.org Mon Jun 24 02:58:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EB0615BCCE8; Mon, 24 Jun 2019 02:58:03 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E07582786; Mon, 24 Jun 2019 02:58:03 +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 DACAC2ADAE; Mon, 24 Jun 2019 02:58:02 +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 x5O2w2oO002078; Mon, 24 Jun 2019 02:58:02 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5O2w2iE002077; Mon, 24 Jun 2019 02:58:02 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201906240258.x5O2w2iE002077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 24 Jun 2019 02:58:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349331 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0E07582786 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 02:58:03 -0000 Author: cy Date: Mon Jun 24 02:58:02 2019 New Revision: 349331 URL: https://svnweb.freebsd.org/changeset/base/349331 Log: Clean out duplicate definitions of TCP macros also found in netinet/tcp.h. MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/ip_compat.h Modified: head/sys/contrib/ipfilter/netinet/ip_compat.h ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_compat.h Mon Jun 24 02:39:56 2019 (r349330) +++ head/sys/contrib/ipfilter/netinet/ip_compat.h Mon Jun 24 02:58:02 2019 (r349331) @@ -829,37 +829,6 @@ typedef struct tcpiphdr tcpiphdr_t; #undef IPOPT_AH #define IPOPT_AH 256+IPPROTO_AH -#ifndef TCPOPT_EOL -# define TCPOPT_EOL 0 -#endif -#ifndef TCPOPT_NOP -# define TCPOPT_NOP 1 -#endif -#ifndef TCPOPT_MAXSEG -# define TCPOPT_MAXSEG 2 -#endif -#ifndef TCPOLEN_MAXSEG -# define TCPOLEN_MAXSEG 4 -#endif -#ifndef TCPOPT_WINDOW -# define TCPOPT_WINDOW 3 -#endif -#ifndef TCPOLEN_WINDOW -# define TCPOLEN_WINDOW 3 -#endif -#ifndef TCPOPT_SACK_PERMITTED -# define TCPOPT_SACK_PERMITTED 4 -#endif -#ifndef TCPOLEN_SACK_PERMITTED -# define TCPOLEN_SACK_PERMITTED 2 -#endif -#ifndef TCPOPT_SACK -# define TCPOPT_SACK 5 -#endif -#ifndef TCPOPT_TIMESTAMP -# define TCPOPT_TIMESTAMP 8 -#endif - #ifndef ICMP_MINLEN # define ICMP_MINLEN 8 #endif From owner-svn-src-head@freebsd.org Mon Jun 24 02:59:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E25C15BCDB6; Mon, 24 Jun 2019 02:59:24 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vtr.rulingia.com (vtr.rulingia.com [IPv6:2001:19f0:5801:ebe:5400:1ff:fe53:30fd]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vtr.rulingia.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7DD61828EC; Mon, 24 Jun 2019 02:59:23 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (ppp59-167-167-3.static.internode.on.net [59.167.167.3]) by vtr.rulingia.com (8.15.2/8.15.2) with ESMTPS id x5O2xDEX088048 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jun 2019 12:59:19 +1000 (AEST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.15.2/8.15.2) with ESMTPS id x5O2x8iZ087966 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 24 Jun 2019 12:59:08 +1000 (AEST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.15.2/8.15.2/Submit) id x5O2x8t8087965; Mon, 24 Jun 2019 12:59:08 +1000 (AEST) (envelope-from peter) Date: Mon, 24 Jun 2019 12:59:08 +1000 From: Peter Jeremy To: Xin LI Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349151 - in head: lib/libufs stand/libsa sys/conf sys/dev/iscsi sys/dev/iscsi_initiator sys/dev/liquidio sys/dev/usb/net sys/fs/ext2fs sys/fs/nandfs sys/geom/part sys/geom/raid sys/ker... Message-ID: <20190624025908.GA87860@server.rulingia.com> References: <201906171949.x5HJn9Ed091108@repo.freebsd.org> <20190622071703.GA71146@server.rulingia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="BOKacYhQ+x31HxR3" Content-Disposition: inline In-Reply-To: <20190622071703.GA71146@server.rulingia.com> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.12.0 (2019-05-25) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 02:59:24 -0000 --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2019-Jun-22 17:17:03 +1000, Peter Jeremy wro= te: >On 2019-Jun-17 19:49:09 +0000, Xin LI wrote: >>Author: delphij >>Date: Mon Jun 17 19:49:08 2019 >>New Revision: 349151 >>URL: https://svnweb.freebsd.org/changeset/base/349151 >> >>Log: >> Separate kernel crc32() implementation to its own header (gsb_crc32.h) = and >> rename the source to gsb_crc32.c. > >I'm not sure how but this breaks my Rock64. r349150 boots without problem >but r349151 panics during the probe: >... And the problem went away somewhere between r349269 and r349288. Since the= re's nothing obvious there either, I presume this is something more subtle like a race condition that has been provoked by the code changes. --=20 Peter Jeremy --BOKacYhQ+x31HxR3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAl0QPGtfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi CzQPyhAAmU38utmmqCxwiN+yNYib5hOThLLMIoJTe14iJamxa0Ubrcw5c1FSxZlG 1XgOxR40vNIx7QNiGIZGd0L0rdIf7znmNRj/idqX2o/ZnKk9d6YHbNkr4SQghdu2 YGE1cSNIH6yVhpEAUw9AdGAgAfZmMAj212igWilyO+UdXLzwT4knyBF65+Ud1cuT yt6rHGfRv/i7EgObLAbJpOxbzMmbq3il/GLC/Egp7j+Ujkr5WUj69hDtljuOn4oh FFNriIAUlSZDrWyp5i7Tepl2Qv6RvlSaZBxq8xW8whWVMU41yN2MO0QMmXtceOMQ Ie45W5I8l1+MXQ+BzzLYoVyw28bJVFAIxhCLJpdaHNtsG+L8/cFiOpp6iQ2Dr9jr h9eiBHcbdz6d/aFoSez5TTLzNLEXy0eJ8XQ56x6nWpKSSWGk7gcvemaalchtDUZR c4iFsmVZRajZIFyarWuUaf70cKjP4Fl6yHxrD+Q8j1vbzgozRRy8gDaHlI3ZvzkK GesE538jGf4Tzl9AIIfG/mjREWAdw7iJIUynNLRwZBchXL7majFr6GSLdS331aOq Iar59CpwpXj3jVXjuURWmiQ8RXrvBF1ImGBZkPFIpa3CqzRs1MAioWgVn8L443nm hnFvy2hKpUnGxbdiMN9zvc5xeGbrN6Hg2MuadC3EZP9WW01FOZ0= =rkFC -----END PGP SIGNATURE----- --BOKacYhQ+x31HxR3-- From owner-svn-src-head@freebsd.org Mon Jun 24 17:25:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C40415D38C3; Mon, 24 Jun 2019 17:25:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C197977664; Mon, 24 Jun 2019 17:25: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 986E3434F; Mon, 24 Jun 2019 17:25: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 x5OHPEfW057349; Mon, 24 Jun 2019 17:25:14 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5OHPE3f057348; Mon, 24 Jun 2019 17:25:14 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201906241725.x5OHPE3f057348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 24 Jun 2019 17:25:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349333 - head/usr.bin/vtfontcvt X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.bin/vtfontcvt X-SVN-Commit-Revision: 349333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C197977664 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 17:25:15 -0000 Author: emaste Date: Mon Jun 24 17:25:14 2019 New Revision: 349333 URL: https://svnweb.freebsd.org/changeset/base/349333 Log: vtfontcvt: improve .bdf validation Previously if we had a FONTBOUNDINGBOX or DWIDTH entry that had missing or invalid values and and failed sscanf, we would proceeded with partially initialized bounding box / device width variables. Reported by: afl (FONTBOUNDINGBOX) MFC with: r349100 Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/vtfontcvt/vtfontcvt.c Modified: head/usr.bin/vtfontcvt/vtfontcvt.c ============================================================================== --- head/usr.bin/vtfontcvt/vtfontcvt.c Mon Jun 24 17:05:31 2019 (r349332) +++ head/usr.bin/vtfontcvt/vtfontcvt.c Mon Jun 24 17:25:14 2019 (r349333) @@ -335,9 +335,11 @@ parse_bdf(FILE *fp, unsigned int map_idx) break; } } - } else if (strncmp(ln, "FONTBOUNDINGBOX ", 16) == 0 && - sscanf(ln + 16, "%d %d %d %d", &fbbw, &fbbh, &fbbox, - &fbboy) == 4) { + } else if (strncmp(ln, "FONTBOUNDINGBOX ", 16) == 0) { + if (sscanf(ln + 16, "%d %d %d %d", &fbbw, &fbbh, &fbbox, + &fbboy) != 4) + errx(1, "invalid FONTBOUNDINGBOX at line %u", + linenum); set_width(fbbw); set_height(fbbh); break; @@ -353,8 +355,9 @@ parse_bdf(FILE *fp, unsigned int map_idx) linenum++; ln[length - 1] = '\0'; - if (strncmp(ln, "DWIDTH ", 7) == 0 && - sscanf(ln + 7, "%d %d", &dwidth, &dwy) == 2) { + if (strncmp(ln, "DWIDTH ", 7) == 0) { + if (sscanf(ln + 7, "%d %d", &dwidth, &dwy) != 2) + errx(1, "invalid DWIDTH at line %u", linenum); if (dwy != 0 || (dwidth != fbbw && dwidth * 2 != fbbw)) errx(1, "bitmap with unsupported DWIDTH %d %d at line %u", dwidth, dwy, linenum); From owner-svn-src-head@freebsd.org Mon Jun 24 19:19:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7386615D6CDB; Mon, 24 Jun 2019 19:19:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1978A8405E; Mon, 24 Jun 2019 19:19:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E33655622; Mon, 24 Jun 2019 19:19:37 +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 x5OJJbq8016464; Mon, 24 Jun 2019 19:19:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5OJJbKv016463; Mon, 24 Jun 2019 19:19:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201906241919.x5OJJbKv016463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 24 Jun 2019 19:19:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349334 - head/sys/fs/smbfs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/fs/smbfs X-SVN-Commit-Revision: 349334 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1978A8405E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 19:19:38 -0000 Author: markj Date: Mon Jun 24 19:19:37 2019 New Revision: 349334 URL: https://svnweb.freebsd.org/changeset/base/349334 Log: Remove a lingering use of splbio(). The buffer must be locked by the caller. No functional change intended. Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/smbfs/smbfs_io.c Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Mon Jun 24 17:25:14 2019 (r349333) +++ head/sys/fs/smbfs/smbfs_io.c Mon Jun 24 19:19:37 2019 (r349334) @@ -375,9 +375,6 @@ smbfs_doio(struct vnode *vp, struct buf *bp, struct uc */ if (error == EINTR || (!error && (bp->b_flags & B_NEEDCOMMIT))) { - int s; - - s = splbio(); bp->b_flags &= ~(B_INVAL|B_NOCACHE); if ((bp->b_flags & B_ASYNC) == 0) bp->b_flags |= B_EINTR; @@ -387,7 +384,6 @@ smbfs_doio(struct vnode *vp, struct buf *bp, struct uc } if ((bp->b_flags & B_ASYNC) == 0) bp->b_flags |= B_EINTR; - splx(s); } else { if (error) { bp->b_ioflags |= BIO_ERROR; From owner-svn-src-head@freebsd.org Mon Jun 24 19:31:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D02B15D7245; Mon, 24 Jun 2019 19:31:33 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E94B84AA0; Mon, 24 Jun 2019 19:31:33 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17ADF5820; Mon, 24 Jun 2019 19:31:33 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5OJVXvk025288; Mon, 24 Jun 2019 19:31:33 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5OJVWVs025283; Mon, 24 Jun 2019 19:31:32 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201906241931.x5OJVWVs025283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Mon, 24 Jun 2019 19:31:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349335 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349335 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3E94B84AA0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 19:31:33 -0000 Author: scottl Date: Mon Jun 24 19:31:32 2019 New Revision: 349335 URL: https://svnweb.freebsd.org/changeset/base/349335 Log: Add the PCI HDAudio device model from the 2016 GSoC. Detailed information can be found at https://wiki.freebsd.org/SummerOfCode2016/HDAudioEmulationForBhyve This commit has evolved from the original work to include Capsicum integration. As part of that, it only opens the host audio devices once and leaves them open, instead of opening and closing them on each guest access. Thanks to Peter Grehan and Marcelo Araujo for their help in bringing the work forward and providing some of the final techncial push. Submitted by: Alex Teaca Differential Revision: D7840, D12419 Added: head/usr.sbin/bhyve/audio.c (contents, props changed) head/usr.sbin/bhyve/audio.h (contents, props changed) head/usr.sbin/bhyve/hda_codec.c (contents, props changed) head/usr.sbin/bhyve/hda_reg.h (contents, props changed) head/usr.sbin/bhyve/hdac_reg.h (contents, props changed) head/usr.sbin/bhyve/pci_hda.c (contents, props changed) head/usr.sbin/bhyve/pci_hda.h (contents, props changed) Modified: head/usr.sbin/bhyve/Makefile Modified: head/usr.sbin/bhyve/Makefile ============================================================================== --- head/usr.sbin/bhyve/Makefile Mon Jun 24 19:19:37 2019 (r349334) +++ head/usr.sbin/bhyve/Makefile Mon Jun 24 19:31:32 2019 (r349335) @@ -16,6 +16,7 @@ BHYVE_SYSDIR?=${SRCTOP} SRCS= \ atkbdc.c \ acpi.c \ + audio.c \ bhyvegc.c \ bhyverun.c \ block_if.c \ @@ -27,6 +28,7 @@ SRCS= \ dbgport.c \ fwctl.c \ gdb.c \ + hda_codec.c \ inout.c \ ioapic.c \ mem.c \ @@ -36,6 +38,7 @@ SRCS= \ pci_ahci.c \ pci_e82545.c \ pci_emul.c \ + pci_hda.c \ pci_fbuf.c \ pci_hostbridge.c \ pci_irq.c \ Added: head/usr.sbin/bhyve/audio.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/audio.c Mon Jun 24 19:31:32 2019 (r349335) @@ -0,0 +1,282 @@ +/*- + * Copyright (c) 2016 Alex Teaca + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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$"); + +#ifndef WITHOUT_CAPSICUM +#include +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "audio.h" +#include "pci_hda.h" + +/* + * Audio Player internal data structures + */ + +struct audio { + int fd; + uint8_t dir; + uint8_t inited; + char dev_name[64]; +}; + +/* + * Audio Player module function definitions + */ + +/* + * audio_init - initialize an instance of audio player + * @dev_name - the backend sound device used to play / capture + * @dir - dir = 1 for write mode, dir = 0 for read mode + */ +struct audio * +audio_init(const char *dev_name, uint8_t dir) +{ + struct audio *aud = NULL; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; + cap_ioctl_t cmds[] = { + SNDCTL_DSP_RESET, SNDCTL_DSP_SETFMT, SNDCTL_DSP_CHANNELS, + SNDCTL_DSP_SPEED, +#ifdef DEBUG_HDA + SNDCTL_DSP_GETOSPACE, SNDCTL_DSP_GETISPACE, +#endif + }; +#endif + + assert(dev_name); + + aud = calloc(1, sizeof(*aud)); + if (!aud) + return NULL; + + if (strlen(dev_name) < sizeof(aud->dev_name)) + memcpy(aud->dev_name, dev_name, strlen(dev_name) + 1); + else { + DPRINTF("dev_name too big\n"); + free(aud); + return NULL; + } + + aud->dir = dir; + + aud->fd = open(aud->dev_name, aud->dir ? O_WRONLY : O_RDONLY, 0); + if (aud->fd == -1) { + DPRINTF("Failed to open dev: %s, errno: %d\n", + aud->dev_name, errno); + return (NULL); + } + +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_IOCTL, CAP_READ, CAP_WRITE); + if (caph_rights_limit(aud->fd, &rights) == -1) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + if (caph_ioctls_limit(aud->fd, cmds, nitems(cmds)) == -1) + errx(EX_OSERR, "Unable to limit ioctl rights for sandbox"); +#endif + + return aud; +} + +/* + * audio_set_params - reset the sound device and set the audio params + * @aud - the audio player to be configured + * @params - the audio parameters to be set + */ +int +audio_set_params(struct audio *aud, struct audio_params *params) +{ + int audio_fd; + int format, channels, rate; + int err; +#if DEBUG_HDA == 1 + audio_buf_info info; +#endif + + assert(aud); + assert(params); + + if ((audio_fd = aud->fd) < 0) { + DPRINTF("Incorrect audio device descriptor for %s\n", + aud->dev_name); + return (-1); + } + + /* Reset the device if it was previously opened */ + if (aud->inited) { + err = ioctl(audio_fd, SNDCTL_DSP_RESET, NULL); + if (err == -1) { + DPRINTF("Failed to reset fd: %d, errno: %d\n", + aud->fd, errno); + return (-1); + } + } else + aud->inited = 1; + + /* Set the Format (Bits per Sample) */ + format = params->format; + err = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format); + if (err == -1) { + DPRINTF("Fail to set fmt: 0x%x errno: %d\n", + params->format, errno); + return -1; + } + + /* The device does not support the requested audio format */ + if (format != params->format) { + DPRINTF("Mismatch format: 0x%x params->format: 0x%x\n", + format, params->format); + return -1; + } + + /* Set the Number of Channels */ + channels = params->channels; + err = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &channels); + if (err == -1) { + DPRINTF("Fail to set channels: %d errno: %d\n", + params->channels, errno); + return -1; + } + + /* The device does not support the requested no. of channels */ + if (channels != params->channels) { + DPRINTF("Mismatch channels: %d params->channels: %d\n", + channels, params->channels); + return -1; + } + + /* Set the Sample Rate / Speed */ + rate = params->rate; + err = ioctl(audio_fd, SNDCTL_DSP_SPEED, &rate); + if (err == -1) { + DPRINTF("Fail to set speed: %d errno: %d\n", + params->rate, errno); + return -1; + } + + /* The device does not support the requested rate / speed */ + if (rate != params->rate) { + DPRINTF("Mismatch rate: %d params->rate: %d\n", + rate, params->rate); + return -1; + } + +#if DEBUG_HDA == 1 + err = ioctl(audio_fd, aud->dir ? SNDCTL_DSP_GETOSPACE : + SNDCTL_DSP_GETISPACE, &info); + if (err == -1) { + DPRINTF("Fail to get audio buf info errno: %d\n", errno); + return -1; + } + DPRINTF("fragstotal: 0x%x fragsize: 0x%x\n", + info.fragstotal, info.fragsize); +#endif + return 0; +} + +/* + * audio_playback - plays samples to the sound device using blocking operations + * @aud - the audio player used to play the samples + * @buf - the buffer containing the samples + * @count - the number of bytes in buffer + */ +int +audio_playback(struct audio *aud, const void *buf, size_t count) +{ + int audio_fd = -1; + ssize_t len = 0, total = 0; + + assert(aud); + assert(aud->dir); + assert(buf); + + audio_fd = aud->fd; + assert(audio_fd != -1); + + total = 0; + while (total < count) { + len = write(audio_fd, buf + total, count - total); + if (len == -1) { + DPRINTF("Fail to write to fd: %d, errno: %d\n", + audio_fd, errno); + return -1; + } + + total += len; + } + + return 0; +} + +/* + * audio_record - records samples from the sound device using + * blocking operations. + * @aud - the audio player used to capture the samples + * @buf - the buffer to receive the samples + * @count - the number of bytes to capture in buffer + * Returns -1 on error and 0 on success + */ +int +audio_record(struct audio *aud, void *buf, size_t count) +{ + int audio_fd = -1; + ssize_t len = 0, total = 0; + + assert(aud); + assert(!aud->dir); + assert(buf); + + audio_fd = aud->fd; + assert(audio_fd != -1); + + total = 0; + while (total < count) { + len = read(audio_fd, buf + total, count - total); + if (len == -1) { + DPRINTF("Fail to write to fd: %d, errno: %d\n", + audio_fd, errno); + return -1; + } + + total += len; + } + + return 0; +} Added: head/usr.sbin/bhyve/audio.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/audio.h Mon Jun 24 19:31:32 2019 (r349335) @@ -0,0 +1,86 @@ +/*- + * Copyright (c) 2016 Alex Teaca + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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 _AUDIO_EMUL_H_ +#define _AUDIO_EMUL_H_ + +#include +#include + +/* + * Audio Player data structures + */ + +struct audio; + +struct audio_params { + int channels; + int format; + int rate; +}; + +/* + * Audio Player API + */ + +/* + * audio_init - initialize an instance of audio player + * @dev_name - the backend sound device used to play / capture + * @dir - dir = 1 for write mode, dir = 0 for read mode + * Returns NULL on error and the address of the audio player instance + */ +struct audio *audio_init(const char *dev_name, uint8_t dir); + +/* + * audio_set_params - reset the sound device and set the audio params + * @aud - the audio player to be configured + * @params - the audio parameters to be set + * Returns -1 on error and 0 on success + */ +int audio_set_params(struct audio *aud, struct audio_params *params); + +/* + * audio_playback - plays samples to the sound device using blocking operations + * @aud - the audio player used to play the samples + * @buf - the buffer containing the samples + * @count - the number of bytes in buffer + * Returns -1 on error and 0 on success + */ +int audio_playback(struct audio *aud, const void *buf, size_t count); + +/* + * audio_record - records samples from the sound device using blocking + * operations. + * @aud - the audio player used to capture the samples + * @buf - the buffer to receive the samples + * @count - the number of bytes to capture in buffer + * Returns -1 on error and 0 on success + */ +int audio_record(struct audio *aud, void *buf, size_t count); + +#endif /* _AUDIO_EMUL_H_ */ Added: head/usr.sbin/bhyve/hda_codec.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/hda_codec.c Mon Jun 24 19:31:32 2019 (r349335) @@ -0,0 +1,950 @@ +/*- + * Copyright (c) 2016 Alex Teaca + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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 "pci_hda.h" +#include "audio.h" + +/* + * HDA Codec defines + */ +#define INTEL_VENDORID 0x8086 + +#define HDA_CODEC_SUBSYSTEM_ID ((INTEL_VENDORID << 16) | 0x01) +#define HDA_CODEC_ROOT_NID 0x00 +#define HDA_CODEC_FG_NID 0x01 +#define HDA_CODEC_AUDIO_OUTPUT_NID 0x02 +#define HDA_CODEC_PIN_OUTPUT_NID 0x03 +#define HDA_CODEC_AUDIO_INPUT_NID 0x04 +#define HDA_CODEC_PIN_INPUT_NID 0x05 + +#define HDA_CODEC_STREAMS_COUNT 0x02 +#define HDA_CODEC_STREAM_OUTPUT 0x00 +#define HDA_CODEC_STREAM_INPUT 0x01 + +#define HDA_CODEC_PARAMS_COUNT 0x14 +#define HDA_CODEC_CONN_LIST_COUNT 0x01 +#define HDA_CODEC_RESPONSE_EX_UNSOL 0x10 +#define HDA_CODEC_RESPONSE_EX_SOL 0x00 +#define HDA_CODEC_AMP_NUMSTEPS 0x4a + +#define HDA_CODEC_SUPP_STREAM_FORMATS_PCM \ + (1 << HDA_PARAM_SUPP_STREAM_FORMATS_PCM_SHIFT) + +#define HDA_CODEC_FMT_BASE_MASK (0x01 << 14) + +#define HDA_CODEC_FMT_MULT_MASK (0x07 << 11) +#define HDA_CODEC_FMT_MULT_2 (0x01 << 11) +#define HDA_CODEC_FMT_MULT_3 (0x02 << 11) +#define HDA_CODEC_FMT_MULT_4 (0x03 << 11) + +#define HDA_CODEC_FMT_DIV_MASK 0x07 +#define HDA_CODEC_FMT_DIV_SHIFT 8 + +#define HDA_CODEC_FMT_BITS_MASK (0x07 << 4) +#define HDA_CODEC_FMT_BITS_8 (0x00 << 4) +#define HDA_CODEC_FMT_BITS_16 (0x01 << 4) +#define HDA_CODEC_FMT_BITS_24 (0x03 << 4) +#define HDA_CODEC_FMT_BITS_32 (0x04 << 4) + +#define HDA_CODEC_FMT_CHAN_MASK (0x0f << 0) + +#define HDA_CODEC_AUDIO_WCAP_OUTPUT \ + (0x00 << HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_INPUT \ + (0x01 << HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_PIN \ + (0x04 << HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_CONN_LIST \ + (1 << HDA_PARAM_AUDIO_WIDGET_CAP_CONN_LIST_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_FORMAT_OVR \ + (1 << HDA_PARAM_AUDIO_WIDGET_CAP_FORMAT_OVR_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_AMP_OVR \ + (1 << HDA_PARAM_AUDIO_WIDGET_CAP_AMP_OVR_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_OUT_AMP \ + (1 << HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_IN_AMP \ + (1 << HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_STEREO \ + (1 << HDA_PARAM_AUDIO_WIDGET_CAP_STEREO_SHIFT) + +#define HDA_CODEC_PIN_CAP_OUTPUT \ + (1 << HDA_PARAM_PIN_CAP_OUTPUT_CAP_SHIFT) +#define HDA_CODEC_PIN_CAP_INPUT \ + (1 << HDA_PARAM_PIN_CAP_INPUT_CAP_SHIFT) +#define HDA_CODEC_PIN_CAP_PRESENCE_DETECT \ + (1 << HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP_SHIFT) + +#define HDA_CODEC_OUTPUT_AMP_CAP_MUTE_CAP \ + (1 << HDA_PARAM_OUTPUT_AMP_CAP_MUTE_CAP_SHIFT) +#define HDA_CODEC_OUTPUT_AMP_CAP_STEPSIZE \ + (0x03 << HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE_SHIFT) +#define HDA_CODEC_OUTPUT_AMP_CAP_NUMSTEPS \ + (HDA_CODEC_AMP_NUMSTEPS << HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS_SHIFT) +#define HDA_CODEC_OUTPUT_AMP_CAP_OFFSET \ + (HDA_CODEC_AMP_NUMSTEPS << HDA_PARAM_OUTPUT_AMP_CAP_OFFSET_SHIFT) + +#define HDA_CODEC_SET_AMP_GAIN_MUTE_MUTE 0x80 +#define HDA_CODEC_SET_AMP_GAIN_MUTE_GAIN_MASK 0x7f + +#define HDA_CODEC_PIN_SENSE_PRESENCE_PLUGGED (1 << 31) +#define HDA_CODEC_PIN_WIDGET_CTRL_OUT_ENABLE \ + (1 << HDA_CMD_GET_PIN_WIDGET_CTRL_OUT_ENABLE_SHIFT) +#define HDA_CODEC_PIN_WIDGET_CTRL_IN_ENABLE \ + (1 << HDA_CMD_GET_PIN_WIDGET_CTRL_IN_ENABLE_SHIFT) + +#define HDA_CONFIG_DEFAULTCONF_COLOR_BLACK \ + (0x01 << HDA_CONFIG_DEFAULTCONF_COLOR_SHIFT) +#define HDA_CONFIG_DEFAULTCONF_COLOR_RED \ + (0x05 << HDA_CONFIG_DEFAULTCONF_COLOR_SHIFT) + +#define HDA_CODEC_BUF_SIZE HDA_FIFO_SIZE + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + + +/* + * HDA Audio Context data structures + */ + +typedef void (*transfer_func_t)(void *arg); +typedef int (*setup_func_t)(void *arg); + +struct hda_audio_ctxt { + char name[64]; + uint8_t run; + uint8_t started; + void *priv; + pthread_t tid; + pthread_mutex_t mtx; + pthread_cond_t cond; + setup_func_t do_setup; + transfer_func_t do_transfer; +}; + +/* + * HDA Audio Context module function declarations + */ + +static void *hda_audio_ctxt_thr(void *arg); +static int hda_audio_ctxt_init(struct hda_audio_ctxt *actx, const char *tname, + transfer_func_t do_transfer, setup_func_t do_setup, void *priv); +static int hda_audio_ctxt_start(struct hda_audio_ctxt *actx); +static int hda_audio_ctxt_stop(struct hda_audio_ctxt *actx); + +/* + * HDA Codec data structures + */ + +struct hda_codec_softc; + +typedef uint32_t (*verb_func_t)(struct hda_codec_softc *sc, uint16_t verb, + uint16_t payload); + +struct hda_codec_stream { + uint8_t buf[HDA_CODEC_BUF_SIZE]; + uint8_t channel; + uint16_t fmt; + uint8_t stream; + + uint8_t left_gain; + uint8_t right_gain; + uint8_t left_mute; + uint8_t right_mute; + + struct audio *aud; + struct hda_audio_ctxt actx; +}; + +struct hda_codec_softc { + uint32_t no_nodes; + uint32_t subsystem_id; + const uint32_t (*get_parameters)[HDA_CODEC_PARAMS_COUNT]; + const uint8_t (*conn_list)[HDA_CODEC_CONN_LIST_COUNT]; + const uint32_t *conf_default; + const uint8_t *pin_ctrl_default; + const verb_func_t *verb_handlers; + + struct hda_codec_inst *hci; + struct hda_codec_stream streams[HDA_CODEC_STREAMS_COUNT]; +}; + +/* + * HDA Codec module function declarations + */ +static int hda_codec_init(struct hda_codec_inst *hci, const char *play, + const char *rec, const char *opts); +static int hda_codec_reset(struct hda_codec_inst *hci); +static int hda_codec_command(struct hda_codec_inst *hci, uint32_t cmd_data); +static int hda_codec_notify(struct hda_codec_inst *hci, uint8_t run, + uint8_t stream, uint8_t dir); + +static int hda_codec_parse_format(uint16_t fmt, struct audio_params *params); + +static uint32_t hda_codec_audio_output_nid(struct hda_codec_softc *sc, + uint16_t verb, uint16_t payload); +static void hda_codec_audio_output_do_transfer(void *arg); +static int hda_codec_audio_output_do_setup(void *arg); +static uint32_t hda_codec_audio_input_nid(struct hda_codec_softc *sc, + uint16_t verb, uint16_t payload); +static void hda_codec_audio_input_do_transfer(void *arg); +static int hda_codec_audio_input_do_setup(void *arg); + +static uint32_t hda_codec_audio_inout_nid(struct hda_codec_stream *st, + uint16_t verb, uint16_t payload); + +/* + * HDA Codec global data + */ + +#define HDA_CODEC_ROOT_DESC \ + [HDA_CODEC_ROOT_NID] = { \ + [HDA_PARAM_VENDOR_ID] = INTEL_VENDORID, \ + [HDA_PARAM_REVISION_ID] = 0xffff, \ + /* 1 Subnode, StartNid = 1 */ \ + [HDA_PARAM_SUB_NODE_COUNT] = 0x00010001, \ + }, \ + +#define HDA_CODEC_FG_COMMON_DESC \ + [HDA_PARAM_FCT_GRP_TYPE] = HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_AUDIO,\ + /* B8 - B32, 8.0 - 192.0kHz */ \ + [HDA_PARAM_SUPP_PCM_SIZE_RATE] = (0x1f << 16) | 0x7ff, \ + [HDA_PARAM_SUPP_STREAM_FORMATS] = HDA_CODEC_SUPP_STREAM_FORMATS_PCM,\ + [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */ \ + [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */ \ + [HDA_PARAM_GPIO_COUNT] = 0x00, \ + +#define HDA_CODEC_FG_OUTPUT_DESC \ + [HDA_CODEC_FG_NID] = { \ + /* 2 Subnodes, StartNid = 2 */ \ + [HDA_PARAM_SUB_NODE_COUNT] = 0x00020002, \ + HDA_CODEC_FG_COMMON_DESC \ + }, \ + +#define HDA_CODEC_FG_INPUT_DESC \ + [HDA_CODEC_FG_NID] = { \ + /* 2 Subnodes, StartNid = 4 */ \ + [HDA_PARAM_SUB_NODE_COUNT] = 0x00040002, \ + HDA_CODEC_FG_COMMON_DESC \ + }, \ + +#define HDA_CODEC_FG_DUPLEX_DESC \ + [HDA_CODEC_FG_NID] = { \ + /* 4 Subnodes, StartNid = 2 */ \ + [HDA_PARAM_SUB_NODE_COUNT] = 0x00020004, \ + HDA_CODEC_FG_COMMON_DESC \ + }, \ + +#define HDA_CODEC_OUTPUT_DESC \ + [HDA_CODEC_AUDIO_OUTPUT_NID] = { \ + [HDA_PARAM_AUDIO_WIDGET_CAP] = \ + HDA_CODEC_AUDIO_WCAP_OUTPUT | \ + HDA_CODEC_AUDIO_WCAP_FORMAT_OVR | \ + HDA_CODEC_AUDIO_WCAP_AMP_OVR | \ + HDA_CODEC_AUDIO_WCAP_OUT_AMP | \ + HDA_CODEC_AUDIO_WCAP_STEREO, \ + /* B16, 16.0 - 192.0kHz */ \ + [HDA_PARAM_SUPP_PCM_SIZE_RATE] = (0x02 << 16) | 0x7fc, \ + [HDA_PARAM_SUPP_STREAM_FORMATS] = \ + HDA_CODEC_SUPP_STREAM_FORMATS_PCM, \ + [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */ \ + [HDA_PARAM_CONN_LIST_LENGTH] = 0x00, \ + [HDA_PARAM_OUTPUT_AMP_CAP] = \ + HDA_CODEC_OUTPUT_AMP_CAP_MUTE_CAP | \ + HDA_CODEC_OUTPUT_AMP_CAP_STEPSIZE | \ + HDA_CODEC_OUTPUT_AMP_CAP_NUMSTEPS | \ + HDA_CODEC_OUTPUT_AMP_CAP_OFFSET, \ + }, \ + [HDA_CODEC_PIN_OUTPUT_NID] = { \ + [HDA_PARAM_AUDIO_WIDGET_CAP] = \ + HDA_CODEC_AUDIO_WCAP_PIN | \ + HDA_CODEC_AUDIO_WCAP_CONN_LIST | \ + HDA_CODEC_AUDIO_WCAP_STEREO, \ + [HDA_PARAM_PIN_CAP] = HDA_CODEC_PIN_CAP_OUTPUT | \ + HDA_CODEC_PIN_CAP_PRESENCE_DETECT,\ + [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */ \ + [HDA_PARAM_CONN_LIST_LENGTH] = 0x01, \ + [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */ \ + }, \ + +#define HDA_CODEC_INPUT_DESC \ + [HDA_CODEC_AUDIO_INPUT_NID] = { \ + [HDA_PARAM_AUDIO_WIDGET_CAP] = \ + HDA_CODEC_AUDIO_WCAP_INPUT | \ + HDA_CODEC_AUDIO_WCAP_CONN_LIST | \ + HDA_CODEC_AUDIO_WCAP_FORMAT_OVR | \ + HDA_CODEC_AUDIO_WCAP_AMP_OVR | \ + HDA_CODEC_AUDIO_WCAP_IN_AMP | \ + HDA_CODEC_AUDIO_WCAP_STEREO, \ + /* B16, 16.0 - 192.0kHz */ \ + [HDA_PARAM_SUPP_PCM_SIZE_RATE] = (0x02 << 16) | 0x7fc, \ + [HDA_PARAM_SUPP_STREAM_FORMATS] = \ + HDA_CODEC_SUPP_STREAM_FORMATS_PCM, \ + [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */ \ + [HDA_PARAM_CONN_LIST_LENGTH] = 0x01, \ + [HDA_PARAM_INPUT_AMP_CAP] = \ + HDA_CODEC_OUTPUT_AMP_CAP_MUTE_CAP | \ + HDA_CODEC_OUTPUT_AMP_CAP_STEPSIZE | \ + HDA_CODEC_OUTPUT_AMP_CAP_NUMSTEPS | \ + HDA_CODEC_OUTPUT_AMP_CAP_OFFSET, \ + }, \ + [HDA_CODEC_PIN_INPUT_NID] = { \ + [HDA_PARAM_AUDIO_WIDGET_CAP] = \ + HDA_CODEC_AUDIO_WCAP_PIN | \ + HDA_CODEC_AUDIO_WCAP_STEREO, \ + [HDA_PARAM_PIN_CAP] = HDA_CODEC_PIN_CAP_INPUT | \ + HDA_CODEC_PIN_CAP_PRESENCE_DETECT, \ + [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */ \ + [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */ \ + }, \ + +static const uint32_t +hda_codec_output_parameters[][HDA_CODEC_PARAMS_COUNT] = { + HDA_CODEC_ROOT_DESC + HDA_CODEC_FG_OUTPUT_DESC + HDA_CODEC_OUTPUT_DESC +}; + +static const uint32_t +hda_codec_input_parameters[][HDA_CODEC_PARAMS_COUNT] = { + HDA_CODEC_ROOT_DESC + HDA_CODEC_FG_INPUT_DESC + HDA_CODEC_INPUT_DESC +}; + +static const uint32_t +hda_codec_duplex_parameters[][HDA_CODEC_PARAMS_COUNT] = { + HDA_CODEC_ROOT_DESC + HDA_CODEC_FG_DUPLEX_DESC + HDA_CODEC_OUTPUT_DESC + HDA_CODEC_INPUT_DESC +}; + +#define HDA_CODEC_NODES_COUNT (ARRAY_SIZE(hda_codec_duplex_parameters)) + +static const uint8_t +hda_codec_conn_list[HDA_CODEC_NODES_COUNT][HDA_CODEC_CONN_LIST_COUNT] = { + [HDA_CODEC_PIN_OUTPUT_NID] = {HDA_CODEC_AUDIO_OUTPUT_NID}, + [HDA_CODEC_AUDIO_INPUT_NID] = {HDA_CODEC_PIN_INPUT_NID}, +}; + +static const uint32_t +hda_codec_conf_default[HDA_CODEC_NODES_COUNT] = { + [HDA_CODEC_PIN_OUTPUT_NID] = \ + HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_JACK | + HDA_CONFIG_DEFAULTCONF_DEVICE_LINE_OUT | + HDA_CONFIG_DEFAULTCONF_COLOR_BLACK | + (0x01 << HDA_CONFIG_DEFAULTCONF_ASSOCIATION_SHIFT), + [HDA_CODEC_PIN_INPUT_NID] = HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_JACK | + HDA_CONFIG_DEFAULTCONF_DEVICE_LINE_IN | + HDA_CONFIG_DEFAULTCONF_COLOR_RED | + (0x02 << HDA_CONFIG_DEFAULTCONF_ASSOCIATION_SHIFT), +}; + +static const uint8_t +hda_codec_pin_ctrl_default[HDA_CODEC_NODES_COUNT] = { + [HDA_CODEC_PIN_OUTPUT_NID] = HDA_CODEC_PIN_WIDGET_CTRL_OUT_ENABLE, + [HDA_CODEC_PIN_INPUT_NID] = HDA_CODEC_PIN_WIDGET_CTRL_IN_ENABLE, +}; + +static const +verb_func_t hda_codec_verb_handlers[HDA_CODEC_NODES_COUNT] = { + [HDA_CODEC_AUDIO_OUTPUT_NID] = hda_codec_audio_output_nid, + [HDA_CODEC_AUDIO_INPUT_NID] = hda_codec_audio_input_nid, +}; + +/* + * HDA Codec module function definitions + */ + +static int +hda_codec_init(struct hda_codec_inst *hci, const char *play, + const char *rec, const char *opts) +{ + struct hda_codec_softc *sc = NULL; + struct hda_codec_stream *st = NULL; + int err; + + if (!(play || rec)) + return (-1); + + DPRINTF("cad: 0x%x opts: %s\n", hci->cad, opts); + + sc = calloc(1, sizeof(*sc)); + if (!sc) + return (-1); + + if (play && rec) + sc->get_parameters = hda_codec_duplex_parameters; + else { + if (play) + sc->get_parameters = hda_codec_output_parameters; + else + sc->get_parameters = hda_codec_input_parameters; + } + sc->subsystem_id = HDA_CODEC_SUBSYSTEM_ID; + sc->no_nodes = HDA_CODEC_NODES_COUNT; + sc->conn_list = hda_codec_conn_list; + sc->conf_default = hda_codec_conf_default; + sc->pin_ctrl_default = hda_codec_pin_ctrl_default; + sc->verb_handlers = hda_codec_verb_handlers; + DPRINTF("HDA Codec nodes: %d\n", sc->no_nodes); + + /* + * Initialize the Audio Output stream + */ + if (play) { + st = &sc->streams[HDA_CODEC_STREAM_OUTPUT]; + + err = hda_audio_ctxt_init(&st->actx, "hda-audio-output", + hda_codec_audio_output_do_transfer, + hda_codec_audio_output_do_setup, sc); + assert(!err); + + st->aud = audio_init(play, 1); + if (!st->aud) { + DPRINTF("Fail to init the output audio player\n"); + return (-1); + } + } + + /* + * Initialize the Audio Input stream + */ + if (rec) { + st = &sc->streams[HDA_CODEC_STREAM_INPUT]; + + err = hda_audio_ctxt_init(&st->actx, "hda-audio-input", + hda_codec_audio_input_do_transfer, + hda_codec_audio_input_do_setup, sc); + assert(!err); + + st->aud = audio_init(rec, 0); + if (!st->aud) { + DPRINTF("Fail to init the input audio player\n"); + return (-1); + } + } + + sc->hci = hci; + hci->priv = sc; + + return (0); +} + +static int +hda_codec_reset(struct hda_codec_inst *hci) +{ + struct hda_ops *hops = NULL; + struct hda_codec_softc *sc = NULL; + struct hda_codec_stream *st = NULL; + int i; + + assert(hci); + + hops = hci->hops; + assert(hops); + + sc = (struct hda_codec_softc *)hci->priv; + assert(sc); + + for (i = 0; i < HDA_CODEC_STREAMS_COUNT; i++) { + st = &sc->streams[i]; + st->left_gain = HDA_CODEC_AMP_NUMSTEPS; + st->right_gain = HDA_CODEC_AMP_NUMSTEPS; + st->left_mute = HDA_CODEC_SET_AMP_GAIN_MUTE_MUTE; + st->right_mute = HDA_CODEC_SET_AMP_GAIN_MUTE_MUTE; + } + + DPRINTF("cad: 0x%x\n", hci->cad); + + if (!hops->signal) { + DPRINTF("The controller ops does not implement \ + the signal function\n"); + return (-1); + } + + return (hops->signal(hci)); +} + +static int +hda_codec_command(struct hda_codec_inst *hci, uint32_t cmd_data) +{ + struct hda_codec_softc *sc = NULL; + struct hda_ops *hops = NULL; + uint8_t cad = 0, nid = 0; + uint16_t verb = 0, payload = 0; + uint32_t res = 0; + + /* 4 bits */ + cad = (cmd_data >> HDA_CMD_CAD_SHIFT) & 0x0f; + /* 8 bits */ + nid = (cmd_data >> HDA_CMD_NID_SHIFT) & 0xff; + + if ((cmd_data & 0x70000) == 0x70000) { + /* 12 bits */ + verb = (cmd_data >> HDA_CMD_VERB_12BIT_SHIFT) & 0x0fff; + /* 8 bits */ + payload = cmd_data & 0xff; + } else { + /* 4 bits */ + verb = (cmd_data >> HDA_CMD_VERB_4BIT_SHIFT) & 0x0f; + /* 16 bits */ + payload = cmd_data & 0xffff; + } + + assert(cad == hci->cad); + assert(hci); + + hops = hci->hops; + assert(hops); + + sc = (struct hda_codec_softc *)hci->priv; + assert(sc); + + assert(nid < sc->no_nodes); + + if (!hops->response) { + DPRINTF("The controller ops does not implement \ + the response function\n"); + return (-1); + } + + switch (verb) { + case HDA_CMD_VERB_GET_PARAMETER: + res = sc->get_parameters[nid][payload]; + break; + case HDA_CMD_VERB_GET_CONN_LIST_ENTRY: + res = sc->conn_list[nid][0]; + break; + case HDA_CMD_VERB_GET_PIN_WIDGET_CTRL: + res = sc->pin_ctrl_default[nid]; + break; + case HDA_CMD_VERB_GET_PIN_SENSE: + res = HDA_CODEC_PIN_SENSE_PRESENCE_PLUGGED; + break; + case HDA_CMD_VERB_GET_CONFIGURATION_DEFAULT: + res = sc->conf_default[nid]; + break; + case HDA_CMD_VERB_GET_SUBSYSTEM_ID: + res = sc->subsystem_id; + break; + default: + assert(sc->verb_handlers); + if (sc->verb_handlers[nid]) + res = sc->verb_handlers[nid](sc, verb, payload); + else + DPRINTF("Unknown VERB: 0x%x\n", verb); + break; + } + + DPRINTF("cad: 0x%x nid: 0x%x verb: 0x%x payload: 0x%x response: 0x%x\n", + cad, nid, verb, payload, res); + + return (hops->response(hci, res, HDA_CODEC_RESPONSE_EX_SOL)); +} + +static int +hda_codec_notify(struct hda_codec_inst *hci, uint8_t run, + uint8_t stream, uint8_t dir) +{ + struct hda_codec_softc *sc = NULL; + struct hda_codec_stream *st = NULL; + struct hda_audio_ctxt *actx = NULL; + int i; + int err; + + assert(hci); + assert(stream); + + sc = (struct hda_codec_softc *)hci->priv; + assert(sc); + + i = dir ? HDA_CODEC_STREAM_OUTPUT : HDA_CODEC_STREAM_INPUT; + st = &sc->streams[i]; + + DPRINTF("run: %d, stream: 0x%x, st->stream: 0x%x dir: %d\n", + run, stream, st->stream, dir); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Jun 24 19:42:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 912C815D76C3; Mon, 24 Jun 2019 19:42:33 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 32D79851FD; Mon, 24 Jun 2019 19:42:33 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 218F15B34; Mon, 24 Jun 2019 19:42:33 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5OJgXam032280; Mon, 24 Jun 2019 19:42:33 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5OJgX5B032279; Mon, 24 Jun 2019 19:42:33 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201906241942.x5OJgX5B032279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Mon, 24 Jun 2019 19:42:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349336 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349336 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 32D79851FD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 19:42:33 -0000 Author: scottl Date: Mon Jun 24 19:42:32 2019 New Revision: 349336 URL: https://svnweb.freebsd.org/changeset/base/349336 Log: Add a section about the HD Audio module support Modified: head/usr.sbin/bhyve/bhyve.8 Modified: head/usr.sbin/bhyve/bhyve.8 ============================================================================== --- head/usr.sbin/bhyve/bhyve.8 Mon Jun 24 19:31:32 2019 (r349335) +++ head/usr.sbin/bhyve/bhyve.8 Mon Jun 24 19:42:32 2019 (r349336) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 11, 2018 +.Dd June 24, 2019 .Dt BHYVE 8 .Os .Sh NAME @@ -248,6 +248,8 @@ Raw framebuffer device attached to VNC server. eXtensible Host Controller Interface (xHCI) USB controller. .It Li nvme NVM Express (NVMe) controller. +.It Li hda +High Definition Audio Controller. .El .It Op Ar conf This optional parameter describes the backend for device emulations. @@ -474,6 +476,16 @@ Max number of concurrent I/O requests. Sector size (defaults to blockif sector size). .It Li ser Serial number with maximum 20 characters. +.El +.Pp +HD Audio devices: +.Bl -tag -width 10n +.It Li play +Playback device, typically +.Ar /dev/dsp0 . +.It Li rec +Recording device, typically +.Ar /dev/dsp0 . .El .El .It Fl S From owner-svn-src-head@freebsd.org Mon Jun 24 20:18:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B479415D853A; Mon, 24 Jun 2019 20:18:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5B8C186B33; Mon, 24 Jun 2019 20:18:50 +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 35B976073; Mon, 24 Jun 2019 20:18:50 +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 x5OKIo6N048558; Mon, 24 Jun 2019 20:18:50 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5OKIoCw048557; Mon, 24 Jun 2019 20:18:50 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906242018.x5OKIoCw048557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 24 Jun 2019 20:18:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349339 - head/sys/cam/ata X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/ata X-SVN-Commit-Revision: 349339 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5B8C186B33 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 20:18:51 -0000 Author: imp Date: Mon Jun 24 20:18:49 2019 New Revision: 349339 URL: https://svnweb.freebsd.org/changeset/base/349339 Log: Go ahead and completely fix the ata_params before calling the veto function. This breaks nothing that uses it in the tree since ata_params is ignored in storvsc_ada_probe_veto which is the only in-tree consumer. Modified: head/sys/cam/ata/ata_xpt.c Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Mon Jun 24 20:08:28 2019 (r349338) +++ head/sys/cam/ata/ata_xpt.c Mon Jun 24 20:18:49 2019 (r349339) @@ -896,22 +896,14 @@ noerror: int16_t *ptr; int veto = 0; + /* + * Convert to host byte order, and fix the strings. + */ ident_buf = &softc->ident_data; for (ptr = (int16_t *)ident_buf; ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) { *ptr = le16toh(*ptr); } - - /* - * Allow others to veto this ATA disk attachment. This - * is mainly used by VMs, whose disk controllers may - * share the disks with the simulated ATA controllers. - */ - EVENTHANDLER_INVOKE(ada_probe_veto, path, ident_buf, &veto); - if (veto) { - goto device_fail; - } - if (strncmp(ident_buf->model, "FX", 2) && strncmp(ident_buf->model, "NEC", 3) && strncmp(ident_buf->model, "Pioneer", 7) && @@ -926,6 +918,17 @@ noerror: ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision)); ata_btrim(ident_buf->serial, sizeof(ident_buf->serial)); ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial)); + + /* + * Allow others to veto this ATA disk attachment. This + * is mainly used by VMs, whose disk controllers may + * share the disks with the simulated ATA controllers. + */ + EVENTHANDLER_INVOKE(ada_probe_veto, path, ident_buf, &veto); + if (veto) { + goto device_fail; + } + /* Device may need spin-up before IDENTIFY become valid. */ if ((ident_buf->specconf == 0x37c8 || ident_buf->specconf == 0x738c) && From owner-svn-src-head@freebsd.org Mon Jun 24 20:19:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B863C15D8580; Mon, 24 Jun 2019 20:19:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1FCFA86C16; Mon, 24 Jun 2019 20:19: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 378626074; Mon, 24 Jun 2019 20:18: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 x5OKIx0u048616; Mon, 24 Jun 2019 20:18:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5OKIwEL048611; Mon, 24 Jun 2019 20:18:58 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906242018.x5OKIwEL048611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 24 Jun 2019 20:18:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349340 - in head/sys/cam: ata scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/cam: ata scsi X-SVN-Commit-Revision: 349340 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1FCFA86C16 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 20:19:02 -0000 Author: imp Date: Mon Jun 24 20:18:58 2019 New Revision: 349340 URL: https://svnweb.freebsd.org/changeset/base/349340 Log: Create ata_param_fixup Create a common fixup routine to do the canonical fixup of the ata_param fixup. Call it from both the ATA and the ATA over SCSI paths. Modified: head/sys/cam/ata/ata_all.c head/sys/cam/ata/ata_all.h head/sys/cam/ata/ata_xpt.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/ata/ata_all.c ============================================================================== --- head/sys/cam/ata/ata_all.c Mon Jun 24 20:18:49 2019 (r349339) +++ head/sys/cam/ata/ata_all.c Mon Jun 24 20:18:58 2019 (r349340) @@ -1238,3 +1238,28 @@ ata_zac_mgmt_in(struct ccb_ataio *ataio, uint32_t retr ataio->aux = auxiliary; } } + +void +ata_param_fixup(struct ata_params *ident_buf) +{ + int16_t *ptr; + + for (ptr = (int16_t *)ident_buf; + ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) { + *ptr = le16toh(*ptr); + } + if (strncmp(ident_buf->model, "FX", 2) && + strncmp(ident_buf->model, "NEC", 3) && + strncmp(ident_buf->model, "Pioneer", 7) && + strncmp(ident_buf->model, "SHARP", 5)) { + ata_bswap(ident_buf->model, sizeof(ident_buf->model)); + ata_bswap(ident_buf->revision, sizeof(ident_buf->revision)); + ata_bswap(ident_buf->serial, sizeof(ident_buf->serial)); + } + ata_btrim(ident_buf->model, sizeof(ident_buf->model)); + ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model)); + ata_btrim(ident_buf->revision, sizeof(ident_buf->revision)); + ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision)); + ata_btrim(ident_buf->serial, sizeof(ident_buf->serial)); + ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial)); +} Modified: head/sys/cam/ata/ata_all.h ============================================================================== --- head/sys/cam/ata/ata_all.h Mon Jun 24 20:18:49 2019 (r349339) +++ head/sys/cam/ata/ata_all.h Mon Jun 24 20:18:58 2019 (r349340) @@ -135,6 +135,7 @@ void ata_read_log(struct ccb_ataio *ataio, uint32_t re uint16_t block_count, uint32_t protocol, uint8_t *data_ptr, uint32_t dxfer_len, uint32_t timeout); +void ata_param_fixup(struct ata_params *ident_buf); void ata_bswap(int8_t *buf, int len); void ata_btrim(int8_t *buf, int len); void ata_bpack(int8_t *src, int8_t *dst, int len); Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Mon Jun 24 20:18:49 2019 (r349339) +++ head/sys/cam/ata/ata_xpt.c Mon Jun 24 20:18:58 2019 (r349340) @@ -893,31 +893,13 @@ noerror: case PROBE_IDENTIFY: { struct ccb_pathinq cpi; - int16_t *ptr; int veto = 0; /* * Convert to host byte order, and fix the strings. */ ident_buf = &softc->ident_data; - for (ptr = (int16_t *)ident_buf; - ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) { - *ptr = le16toh(*ptr); - } - if (strncmp(ident_buf->model, "FX", 2) && - strncmp(ident_buf->model, "NEC", 3) && - strncmp(ident_buf->model, "Pioneer", 7) && - strncmp(ident_buf->model, "SHARP", 5)) { - ata_bswap(ident_buf->model, sizeof(ident_buf->model)); - ata_bswap(ident_buf->revision, sizeof(ident_buf->revision)); - ata_bswap(ident_buf->serial, sizeof(ident_buf->serial)); - } - ata_btrim(ident_buf->model, sizeof(ident_buf->model)); - ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model)); - ata_btrim(ident_buf->revision, sizeof(ident_buf->revision)); - ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision)); - ata_btrim(ident_buf->serial, sizeof(ident_buf->serial)); - ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial)); + ata_param_fixup(ident_buf); /* * Allow others to veto this ATA disk attachment. This Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Jun 24 20:18:49 2019 (r349339) +++ head/sys/cam/scsi/scsi_da.c Mon Jun 24 20:18:58 2019 (r349340) @@ -5192,7 +5192,7 @@ dadone_probeata(struct cam_periph *periph, union ccb * struct da_softc *softc; u_int32_t priority; int continue_probe; - int error, i; + int error; int16_t *ptr; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dadone_probeata\n")); @@ -5210,8 +5210,7 @@ dadone_probeata(struct cam_periph *periph, union ccb * if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { uint16_t old_rate; - for (i = 0; i < sizeof(*ata_params) / 2; i++) - ptr[i] = le16toh(ptr[i]); + ata_param_fixup(ata_params); if (ata_params->support_dsm & ATA_SUPPORT_DSM_TRIM && (softc->quirks & DA_Q_NO_UNMAP) == 0) { dadeleteflag(softc, DA_DELETE_ATA_TRIM, 1); From owner-svn-src-head@freebsd.org Mon Jun 24 20:19:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F2C715D85AB; Mon, 24 Jun 2019 20:19: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45F3886C39; Mon, 24 Jun 2019 20:19: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 15ADB6075; Mon, 24 Jun 2019 20:19: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 x5OKJ3VL048673; Mon, 24 Jun 2019 20:19:03 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5OKJ3Rl048672; Mon, 24 Jun 2019 20:19:03 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906242019.x5OKJ3Rl048672@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 24 Jun 2019 20:19:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349341 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 349341 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 45F3886C39 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 20:19:05 -0000 Author: imp Date: Mon Jun 24 20:19:03 2019 New Revision: 349341 URL: https://svnweb.freebsd.org/changeset/base/349341 Log: Use ata_param_fixup instead of a custom copy here Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Mon Jun 24 20:18:58 2019 (r349340) +++ head/sbin/camcontrol/camcontrol.c Mon Jun 24 20:19:03 2019 (r349341) @@ -2326,9 +2326,11 @@ ata_do_identify(struct cam_device *device, int retry_c } } + ident_buf = (struct ata_params *)ptr; + ata_param_fixup(ident_buf); + error = 1; for (i = 0; i < sizeof(struct ata_params) / 2; i++) { - ptr[i] = le16toh(ptr[i]); if (ptr[i] != 0) error = 0; } @@ -2345,26 +2347,6 @@ ata_do_identify(struct cam_device *device, int retry_c free(ptr); return (error); } - - ident_buf = (struct ata_params *)ptr; - if (strncmp(ident_buf->model, "FX", 2) && - strncmp(ident_buf->model, "NEC", 3) && - strncmp(ident_buf->model, "Pioneer", 7) && - strncmp(ident_buf->model, "SHARP", 5)) { - ata_bswap(ident_buf->model, sizeof(ident_buf->model)); - ata_bswap(ident_buf->revision, sizeof(ident_buf->revision)); - ata_bswap(ident_buf->serial, sizeof(ident_buf->serial)); - ata_bswap(ident_buf->media_serial, sizeof(ident_buf->media_serial)); - } - ata_btrim(ident_buf->model, sizeof(ident_buf->model)); - ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model)); - ata_btrim(ident_buf->revision, sizeof(ident_buf->revision)); - ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision)); - ata_btrim(ident_buf->serial, sizeof(ident_buf->serial)); - ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial)); - ata_btrim(ident_buf->media_serial, sizeof(ident_buf->media_serial)); - ata_bpack(ident_buf->media_serial, ident_buf->media_serial, - sizeof(ident_buf->media_serial)); *ident_bufp = ident_buf; From owner-svn-src-head@freebsd.org Mon Jun 24 20:23:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B24315D88A5; Mon, 24 Jun 2019 20:23:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F1C787254; Mon, 24 Jun 2019 20:23:20 +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 E40806212; Mon, 24 Jun 2019 20:23: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 x5OKNJ2h053553; Mon, 24 Jun 2019 20:23:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5OKNJJ2053552; Mon, 24 Jun 2019 20:23:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906242023.x5OKNJJ2053552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 24 Jun 2019 20:23:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349342 - 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: 349342 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3F1C787254 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 20:23:20 -0000 Author: imp Date: Mon Jun 24 20:23:19 2019 New Revision: 349342 URL: https://svnweb.freebsd.org/changeset/base/349342 Log: Use the cam_ed copy of ata_params rather than malloc and freeing memory for it. This reaches into internal bits of xpt a little, and I'll clean that up later. Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Jun 24 20:19:03 2019 (r349341) +++ head/sys/cam/scsi/scsi_da.c Mon Jun 24 20:23:19 2019 (r349342) @@ -64,6 +64,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef _KERNEL +#include +#endif /* _KERNEL */ #include #include @@ -3613,16 +3616,8 @@ out: break; } - ata_params = (struct ata_params*) - malloc(sizeof(*ata_params), M_SCSIDA,M_NOWAIT|M_ZERO); + ata_params = &periph->path->device->ident_data; - if (ata_params == NULL) { - xpt_print(periph->path, "Couldn't malloc ata_params " - "data\n"); - /* da_free_periph??? */ - break; - } - scsi_ata_identify(&start_ccb->csio, /*retries*/da_retry_count, /*cbfcnp*/dadone_probeata, @@ -5294,7 +5289,6 @@ dadone_probeata(struct cam_periph *periph, union ccb * } } - free(ata_params, M_SCSIDA); if ((softc->zone_mode == DA_ZONE_HOST_AWARE) || (softc->zone_mode == DA_ZONE_HOST_MANAGED)) { /* From owner-svn-src-head@freebsd.org Mon Jun 24 20:34:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9C9515D8D79; Mon, 24 Jun 2019 20:34: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5FB0887A2E; Mon, 24 Jun 2019 20:34: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 1B64D63B6; Mon, 24 Jun 2019 20:34: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 x5OKYs8R058612; Mon, 24 Jun 2019 20:34:54 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5OKYshA058608; Mon, 24 Jun 2019 20:34:54 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906242034.x5OKYshA058608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 24 Jun 2019 20:34:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349343 - in head: stand/common stand/efi/loader sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: stand/common stand/efi/loader sys/kern sys/sys X-SVN-Commit-Revision: 349343 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5FB0887A2E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 20:34:56 -0000 Author: imp Date: Mon Jun 24 20:34:53 2019 New Revision: 349343 URL: https://svnweb.freebsd.org/changeset/base/349343 Log: Move to using a common kernel path between the boot / laoder bits and the kernel. Modified: head/stand/common/paths.h head/stand/efi/loader/main.c head/sys/kern/kern_mib.c head/sys/sys/boot.h Modified: head/stand/common/paths.h ============================================================================== --- head/stand/common/paths.h Mon Jun 24 20:23:19 2019 (r349342) +++ head/stand/common/paths.h Mon Jun 24 20:34:53 2019 (r349343) @@ -29,11 +29,14 @@ #ifndef _PATHS_H_ #define _PATHS_H_ +#include /* To get kernel path */ + #define PATH_DOTCONFIG "/boot.config" #define PATH_CONFIG "/boot/config" #define PATH_LOADER "/boot/loader" #define PATH_LOADER_EFI "/boot/loader.efi" #define PATH_LOADER_ZFS "/boot/zfsloader" -#define PATH_KERNEL "/boot/kernel/kernel" +#define PATH_LOADER_CONF "/boot/loader.conf" +#define PATH_DEFAULTS_LOADER_CONF "/boot/defaults/loader.conf" #endif /* _PATHS_H_ */ Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Mon Jun 24 20:23:19 2019 (r349342) +++ head/stand/efi/loader/main.c Mon Jun 24 20:34:53 2019 (r349343) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -237,8 +238,8 @@ sanity_check_currdev(void) { struct stat st; - return (stat("/boot/defaults/loader.conf", &st) == 0 || - stat("/boot/kernel/kernel", &st) == 0); + return (stat(PATH_DEFAULTS_LOADER_CONF, &st) == 0 || + stat(PATH_KERNEL, &st) == 0); } #ifdef EFI_ZFS_BOOT Modified: head/sys/kern/kern_mib.c ============================================================================== --- head/sys/kern/kern_mib.c Mon Jun 24 20:23:19 2019 (r349342) +++ head/sys/kern/kern_mib.c Mon Jun 24 20:34:53 2019 (r349343) @@ -136,7 +136,7 @@ SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_R SYSCTL_NULL_INT_PTR, 0, "Whether saved set-group/user ID is available"); #endif -char kernelname[MAXPATHLEN] = "/boot/kernel/kernel"; /* XXX bloat */ +char kernelname[MAXPATHLEN] = PATH_KERNEL; /* XXX bloat */ SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW | CTLFLAG_MPSAFE, kernelname, sizeof kernelname, "Name of kernel file booted"); Modified: head/sys/sys/boot.h ============================================================================== --- head/sys/sys/boot.h Mon Jun 24 20:23:19 2019 (r349342) +++ head/sys/sys/boot.h Mon Jun 24 20:34:53 2019 (r349343) @@ -32,6 +32,8 @@ #ifndef _SYS_BOOT_H_ #define _SYS_BOOT_H_ +#define PATH_KERNEL "/boot/kernel/kernel" + int boot_env_to_howto(void); void boot_howto_to_env(int howto); int boot_parse_arg(char *v); From owner-svn-src-head@freebsd.org Mon Jun 24 20:44:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6CDA15D929D for ; Mon, 24 Jun 2019 20:44:21 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8390E88195 for ; Mon, 24 Jun 2019 20:44:21 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x72b.google.com with SMTP id d15so10854570qkl.4 for ; Mon, 24 Jun 2019 13:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jZI1WbodNi0p3e1efnWDEt2m2239z+KkGue9gDQ8WTM=; b=TzS+R5u/vhRC6uGTswn3TI7V8YrpldBkKlShmyHXbfB7LDSY+9yWCXBx1E8XcI624p p7gH2Pdf73PixmyHvyoUQUw/5HtF3irlT5erU7K4wFyrOFbrRKZ7aKyEBcZBc40b4YUJ lUyjwLqEALRBN7F4YUkdu+wm9eA0KIDb7JPSp6n63+Pm1phwkP4u7ECfI2+wOPutCnVH UGFUblVtKUnil1HugUwuzXpzw0Wtn7S9hKfgWiNSJGLmJebE7tka+8X2GTMHYI/sRk4J QcBJyffkLUASZ4uupt/rRpb+Ra/IRkjIh0SiW6/VpunVYENqv4YiOy77pioaXUvMnmn1 A9Bw== 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:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jZI1WbodNi0p3e1efnWDEt2m2239z+KkGue9gDQ8WTM=; b=ta4cBgYTTHIwkXZkWuD3L3/uCy3zG9UL5y2mHxEgDWZwAwzg4755rz9xwYAwZaVZ2+ 6BVCKI/WHy85h+ayy6W1INRvKv0gvOT780mJYHRkO/zhrEoXr7IygYqLZagHPSnLWAF7 utP/ygJdrfQEhySidZ8cxs2Gn8bsDkwh5gU7Vc4ARfOIh9FGRzEPfmmq3gRBwbAnEWe/ eRLpbHhcrCWVR0uJGa+j9JQbwPDZkOnnbgvUq+BgW6+YLcX7jU49EQ7f8xqiuFzntoQ4 b7kOzgnoAvKxupIBtcVOiVZKiCIEWskU3RzefnZi96/5+nkXFPm6IKT0Pt6/AuIAmDsf SkuA== X-Gm-Message-State: APjAAAW4wEmtO6x9bj6cTU+pStwcmejnHrj0qqhzpGeStj5z1Agl/dyS X8etQ5VX6rTnh1bMq4xD7nTENw== X-Google-Smtp-Source: APXvYqz548AxRsjfr7kk+XRX4491xfYtQa89F8KFjhqPzU8jNvWzBUodbaevbTOJtHB7nee3CiXW+A== X-Received: by 2002:a37:9144:: with SMTP id t65mr19580033qkd.367.1561409060942; Mon, 24 Jun 2019 13:44:20 -0700 (PDT) Received: from mutt-hbsd ([151.196.118.239]) by smtp.gmail.com with ESMTPSA id c23sm5692319qke.111.2019.06.24.13.44.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 24 Jun 2019 13:44:20 -0700 (PDT) Date: Mon, 24 Jun 2019 16:44:19 -0400 From: Shawn Webb To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349343 - in head: stand/common stand/efi/loader sys/kern sys/sys Message-ID: <20190624204419.lawtrrobvi4fs2ft@mutt-hbsd> References: <201906242034.x5OKYshA058608@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="okxixvphn4tlnukw" Content-Disposition: inline In-Reply-To: <201906242034.x5OKYshA058608@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 8390E88195 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.992,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 20:44:22 -0000 --okxixvphn4tlnukw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 24, 2019 at 08:34:54PM +0000, Warner Losh wrote: > Author: imp > Date: Mon Jun 24 20:34:53 2019 > New Revision: 349343 > URL: https://svnweb.freebsd.org/changeset/base/349343 >=20 > Log: > Move to using a common kernel path between the boot / laoder bits and > the kernel. I wonder if there'd be any advantage to wrapping these macros in #ifdef and providing the plumbing such that users could overwrite these defaults in their kernel configuration files. I'm just thinking out loud. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --okxixvphn4tlnukw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl0RNh4ACgkQ/y5nonf4 4foiEQ//U6cGPjt+z7g+fQMuNQbwgnzjOvBeXQrwomBPFXPubgd0xWvRw7fqmd6J mkTQCVNL69gYrbpJS46mrWrfAGHWHBRAMTPzAPvgfcccFYUpbUFkPGXwkZQ9e7Nb VH0suIdwoxtKo9MQ1Kpm/PVheQqNMnRu/pBqGxD4QCkjx4JblS8nCY64TbDgdYUq gF3mxxk39yfBMbyeq6TXdAFC8DWUXsIGc7YeNzX88biTeJqIfxZK2X4izcoFHdq6 J6/krXlFB+IkxFifKIbcWoZu0vCSqotJmGVaHoJDrF4e7aDTUZtiWxA9459sRLZ3 +XZwVRrBI7I9uAE1J+Kz7Z772ifeVFzq/AVbJV6oTeg3jI4HR8ERVjU56oAxWWps GdvNGBgW60ikwvaGpyk+xo6OtUrD46v7bSVIMxibFQN3Sqm50BI80IMOb+fPwKPe vOOJGjWkk+dVZzNzk5wjriaiSb/2fLIepvMY4DOfLoyoHjxuoBel37rDB7s+kZdT gsLclG5Nsgpy3H4tTYnmT17Xn56pwgiNeJvHhxWTjwZMwwbsHsKge+cFDQ3d52m3 GBXzOswuV8k+5UbtrUl6HRMOBvkTicqhtffU4PDmPxSrUl+4OrRWbCsVk4huyAac 6iNgRB5FO/BOUuFBJHYQ2owQ10g23KZdlE1uViRuw9RNVDEfNtM= =cPmM -----END PGP SIGNATURE----- --okxixvphn4tlnukw-- From owner-svn-src-head@freebsd.org Mon Jun 24 20:52:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16F4815D9543; Mon, 24 Jun 2019 20:52:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ADA32886A8; Mon, 24 Jun 2019 20:52: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 A30FC672E; Mon, 24 Jun 2019 20:52:21 +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 x5OKqLaH069127; Mon, 24 Jun 2019 20:52:21 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5OKqLRW069126; Mon, 24 Jun 2019 20:52:21 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906242052.x5OKqLRW069126@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 24 Jun 2019 20:52:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349344 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349344 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ADA32886A8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 20:52:22 -0000 Author: imp Date: Mon Jun 24 20:52:21 2019 New Revision: 349344 URL: https://svnweb.freebsd.org/changeset/base/349344 Log: Add missing include of sys/boot.h This change was dropped out in a rebase and I didn't catch that before I committed. Modified: head/sys/kern/kern_mib.c Modified: head/sys/kern/kern_mib.c ============================================================================== --- head/sys/kern/kern_mib.c Mon Jun 24 20:34:53 2019 (r349343) +++ head/sys/kern/kern_mib.c Mon Jun 24 20:52:21 2019 (r349344) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include "opt_config.h" #include +#include #include #include #include From owner-svn-src-head@freebsd.org Mon Jun 24 21:00:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31D1B15D969B; Mon, 24 Jun 2019 21:00:29 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CB4DB88969; Mon, 24 Jun 2019 21:00:28 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A62B86753; Mon, 24 Jun 2019 21:00:28 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5OL0S4G069553; Mon, 24 Jun 2019 21:00:28 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5OL0SCN069551; Mon, 24 Jun 2019 21:00:28 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201906242100.x5OL0SCN069551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Mon, 24 Jun 2019 21:00:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349345 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CB4DB88969 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 21:00:29 -0000 Author: jchandra Date: Mon Jun 24 21:00:28 2019 New Revision: 349345 URL: https://svnweb.freebsd.org/changeset/base/349345 Log: arm64 gic: Drop unused GICV3_IVAR_REDIST_VADDR Now that GICV3_IVAR_REDIST is available, GICV3_IVAR_REDIST_VADDR is unused and can be removed. Drop the define and add a comment. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D20454 Modified: head/sys/arm64/arm64/gic_v3.c head/sys/arm64/arm64/gic_v3_var.h Modified: head/sys/arm64/arm64/gic_v3.c ============================================================================== --- head/sys/arm64/arm64/gic_v3.c Mon Jun 24 20:52:21 2019 (r349344) +++ head/sys/arm64/arm64/gic_v3.c Mon Jun 24 21:00:28 2019 (r349345) @@ -390,10 +390,6 @@ gic_v3_read_ivar(device_t dev, device_t child, int whi case GICV3_IVAR_NIRQS: *result = (NIRQ - sc->gic_nirqs) / sc->gic_nchildren; return (0); - case GICV3_IVAR_REDIST_VADDR: - *result = (uintptr_t)rman_get_virtual( - &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res); - return (0); case GICV3_IVAR_REDIST: *result = (uintptr_t)sc->gic_redists.pcpu[PCPU_GET(cpuid)]; return (0); Modified: head/sys/arm64/arm64/gic_v3_var.h ============================================================================== --- head/sys/arm64/arm64/gic_v3_var.h Mon Jun 24 20:52:21 2019 (r349344) +++ head/sys/arm64/arm64/gic_v3_var.h Mon Jun 24 21:00:28 2019 (r349345) @@ -94,11 +94,10 @@ MALLOC_DECLARE(M_GIC_V3); /* ivars */ #define GICV3_IVAR_NIRQS 1000 -#define GICV3_IVAR_REDIST_VADDR 1001 +/* 1001 was GICV3_IVAR_REDIST_VADDR */ #define GICV3_IVAR_REDIST 1002 __BUS_ACCESSOR(gicv3, nirqs, GICV3, NIRQS, u_int); -__BUS_ACCESSOR(gicv3, redist_vaddr, GICV3, REDIST_VADDR, void *); __BUS_ACCESSOR(gicv3, redist, GICV3, REDIST, void *); /* Device methods */ From owner-svn-src-head@freebsd.org Mon Jun 24 21:05:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B22BD15D9975; Mon, 24 Jun 2019 21:05: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A66488FC5; Mon, 24 Jun 2019 21:05: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 003AF68FD; Mon, 24 Jun 2019 21:05: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 x5OL5EYI074615; Mon, 24 Jun 2019 21:05:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5OL5Erv074614; Mon, 24 Jun 2019 21:05:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906242105.x5OL5Erv074614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 24 Jun 2019 21:05:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349346 - head/usr.sbin/kbdcontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.sbin/kbdcontrol X-SVN-Commit-Revision: 349346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5A66488FC5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 21:05:15 -0000 Author: imp Date: Mon Jun 24 21:05:14 2019 New Revision: 349346 URL: https://svnweb.freebsd.org/changeset/base/349346 Log: kbdcontrol -h prints two error messages. We loop through getopt(3) twice. Once for -P args and once for the rest. Catch '?' and print usage when that happens. Modified: head/usr.sbin/kbdcontrol/kbdcontrol.c Modified: head/usr.sbin/kbdcontrol/kbdcontrol.c ============================================================================== --- head/usr.sbin/kbdcontrol/kbdcontrol.c Mon Jun 24 21:00:28 2019 (r349345) +++ head/usr.sbin/kbdcontrol/kbdcontrol.c Mon Jun 24 21:05:14 2019 (r349346) @@ -1220,9 +1220,12 @@ main(int argc, char **argv) int opt; /* Collect any -P arguments, regardless of where they appear. */ - while ((opt = getopt(argc, argv, optstring)) != -1) + while ((opt = getopt(argc, argv, optstring)) != -1) { if (opt == 'P') add_keymap_path(optarg); + if (opt == '?') + usage(); + } optind = optreset = 1; while ((opt = getopt(argc, argv, optstring)) != -1) From owner-svn-src-head@freebsd.org Mon Jun 24 21:13:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B06BC15D9BA0; Mon, 24 Jun 2019 21:13:46 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2139B8944F; Mon, 24 Jun 2019 21:13:46 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F02FA6AAA; Mon, 24 Jun 2019 21:13:45 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5OLDjQJ079776; Mon, 24 Jun 2019 21:13:45 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5OLDjTh079775; Mon, 24 Jun 2019 21:13:45 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201906242113.x5OLDjTh079775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Mon, 24 Jun 2019 21:13:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349347 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349347 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2139B8944F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 21:13:46 -0000 Author: jchandra Date: Mon Jun 24 21:13:45 2019 New Revision: 349347 URL: https://svnweb.freebsd.org/changeset/base/349347 Log: arm64 gicv3_its: enable all ITS blocks for a CPU We now support multiple ITS blocks raising interrupts to a CPU. Add all available CPUs to the ITS when no NUMA information is available. This reverts the check added in r340602, at that tim we did not suppport multiple ITS blocks for a CPU. Differential Revision: https://reviews.freebsd.org/D20417 Modified: head/sys/arm64/arm64/gicv3_its.c Modified: head/sys/arm64/arm64/gicv3_its.c ============================================================================== --- head/sys/arm64/arm64/gicv3_its.c Mon Jun 24 21:05:14 2019 (r349346) +++ head/sys/arm64/arm64/gicv3_its.c Mon Jun 24 21:13:45 2019 (r349347) @@ -747,9 +747,7 @@ gicv3_its_attach(device_t dev) if (domain < MAXMEMDOM) CPU_COPY(&cpuset_domain[domain], &sc->sc_cpus); } else { - /* XXX : cannot handle more than one ITS per cpu */ - if (device_get_unit(dev) == 0) - CPU_COPY(&all_cpus, &sc->sc_cpus); + CPU_COPY(&all_cpus, &sc->sc_cpus); } /* Allocate the command circular buffer */ From owner-svn-src-head@freebsd.org Mon Jun 24 21:24:56 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4E0A15D9EB5; Mon, 24 Jun 2019 21:24:56 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4288089A29; Mon, 24 Jun 2019 21:24:56 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0291C6C55; Mon, 24 Jun 2019 21:24:56 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5OLOtO6085320; Mon, 24 Jun 2019 21:24:55 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5OLOtUl085319; Mon, 24 Jun 2019 21:24:55 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201906242124.x5OLOtUl085319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Mon, 24 Jun 2019 21:24:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349348 - head/sys/arm64/acpica X-SVN-Group: head X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: head/sys/arm64/acpica X-SVN-Commit-Revision: 349348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4288089A29 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 21:24:57 -0000 Author: jchandra Date: Mon Jun 24 21:24:55 2019 New Revision: 349348 URL: https://svnweb.freebsd.org/changeset/base/349348 Log: arm64 acpi_iort: add some error handling Print warnings for some bad kernel configurations (like NUMA disabled with multiple domains). Check and report some firmware errors (like incorrect proximity domain entries). Differential Revision: https://reviews.freebsd.org/D20416 Modified: head/sys/arm64/acpica/acpi_iort.c Modified: head/sys/arm64/acpica/acpi_iort.c ============================================================================== --- head/sys/arm64/acpica/acpi_iort.c Mon Jun 24 21:13:45 2019 (r349347) +++ head/sys/arm64/acpica/acpi_iort.c Mon Jun 24 21:24:55 2019 (r349348) @@ -370,19 +370,44 @@ srat_resolve_its_pxm(ACPI_SUBTABLE_HEADER *entry, void ACPI_SRAT_GIC_ITS_AFFINITY *gicits; struct iort_node *its_node; struct iort_its_entry *its_entry; - int i, matches; + int *map_counts; + int i, matches, dom; if (entry->Type != ACPI_SRAT_TYPE_GIC_ITS_AFFINITY) return; matches = 0; + map_counts = arg; gicits = (ACPI_SRAT_GIC_ITS_AFFINITY *)entry; + dom = acpi_map_pxm_to_vm_domainid(gicits->ProximityDomain); + + /* + * Catch firmware and config errors. map_counts keeps a + * count of ProximityDomain values mapping to a domain ID + */ +#if MAXMEMDOM > 1 + if (dom == -1) + printf("Firmware Error: Proximity Domain %d could not be" + " mapped for GIC ITS ID %d!\n", + gicits->ProximityDomain, gicits->ItsId); +#endif + /* use dom + 1 as index to handle the case where dom == -1 */ + i = ++map_counts[dom + 1]; + if (i > 1) { +#ifdef NUMA + if (dom != -1) + printf("ERROR: Multiple Proximity Domains map to the" + " same NUMA domain %d!\n", dom); +#else + printf("WARNING: multiple Proximity Domains in SRAT but NUMA" + " NOT enabled!\n"); +#endif + } TAILQ_FOREACH(its_node, &its_groups, next) { its_entry = its_node->entries.its; for (i = 0; i < its_node->nentries; i++, its_entry++) { if (its_entry->its_id == gicits->ItsId) { - its_entry->pxm = acpi_map_pxm_to_vm_domainid( - gicits->ProximityDomain); + its_entry->pxm = dom; matches++; } } @@ -401,6 +426,7 @@ iort_post_process_its(void) ACPI_TABLE_MADT *madt; ACPI_TABLE_SRAT *srat; vm_paddr_t madt_pa, srat_pa; + int map_counts[MAXMEMDOM + 1] = { 0 }; /* Check ITS block in MADT */ madt_pa = acpi_find_table(ACPI_SIG_MADT); @@ -417,7 +443,7 @@ iort_post_process_its(void) srat = acpi_map_table(srat_pa, ACPI_SIG_SRAT); KASSERT(srat != NULL, ("can't map SRAT!")); acpi_walk_subtables(srat + 1, (char *)srat + srat->Header.Length, - srat_resolve_its_pxm, NULL); + srat_resolve_its_pxm, map_counts); acpi_unmap_table(srat); } return (0); From owner-svn-src-head@freebsd.org Mon Jun 24 23:18:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89EE215DBBD6; Mon, 24 Jun 2019 23:18:44 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3B0578CF38; Mon, 24 Jun 2019 23:18:44 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF9837EBB; Mon, 24 Jun 2019 23:18:43 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5ONIh0G043529; Mon, 24 Jun 2019 23:18:43 GMT (envelope-from bcran@FreeBSD.org) Received: (from bcran@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5ONIhlS043523; Mon, 24 Jun 2019 23:18:43 GMT (envelope-from bcran@FreeBSD.org) Message-Id: <201906242318.x5ONIhlS043523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcran set sender to bcran@FreeBSD.org using -f From: Rebecca Cran Date: Mon, 24 Jun 2019 23:18:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349349 - in head/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa X-SVN-Group: head X-SVN-Commit-Author: bcran X-SVN-Commit-Paths: in head/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa X-SVN-Commit-Revision: 349349 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3B0578CF38 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2019 23:18:45 -0000 Author: bcran Date: Mon Jun 24 23:18:42 2019 New Revision: 349349 URL: https://svnweb.freebsd.org/changeset/base/349349 Log: loader: add HTTP support using UEFI Add support for an HTTP "network filesystem" using the UEFI's HTTP stack. This also supports HTTPS, but TianoCore EDK2 implementations currently crash while fetching loader files. Only IPv4 is supported at the moment. IPv6 support is planned for a follow-up changeset. Note that we include some headers from the TianoCore EDK II project in stand/efi/include/Protocol verbatim, including links to the license instead of including the full text because that's their preferred way of communicating it, despite not being normal FreeBSD project practice. Submitted by: scottph Reviewed by: imp, bcran Differential Revision: https://reviews.freebsd.org/D20643 Added: head/stand/efi/include/Protocol/Http.h (contents, props changed) head/stand/efi/include/Protocol/Ip4Config2.h (contents, props changed) head/stand/efi/include/Protocol/ServiceBinding.h (contents, props changed) head/stand/efi/libefi/efihttp.c (contents, props changed) Modified: head/stand/efi/include/efidevp.h head/stand/efi/include/efilib.h head/stand/efi/libefi/Makefile head/stand/efi/loader/conf.c head/stand/libsa/stand.h Added: head/stand/efi/include/Protocol/Http.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/efi/include/Protocol/Http.h Mon Jun 24 23:18:42 2019 (r349349) @@ -0,0 +1,523 @@ +/* $FreeBSD$ */ +/** @file + This file defines the EFI HTTP Protocol interface. It is split into + the following two main sections: + HTTP Service Binding Protocol (HTTPSB) + HTTP Protocol (HTTP) + + Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
+ (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + @par Revision Reference: + This Protocol is introduced in UEFI Specification 2.5 + +**/ + +#ifndef __EFI_HTTP_PROTOCOL_H__ +#define __EFI_HTTP_PROTOCOL_H__ + +#define EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID \ + { \ + 0xbdc8e6af, 0xd9bc, 0x4379, {0xa7, 0x2a, 0xe0, 0xc4, 0xe7, 0x5d, 0xae, 0x1c } \ + } + +#define EFI_HTTP_PROTOCOL_GUID \ + { \ + 0x7a59b29b, 0x910b, 0x4171, {0x82, 0x42, 0xa8, 0x5a, 0x0d, 0xf2, 0x5b, 0x5b } \ + } + +typedef struct _EFI_HTTP_PROTOCOL EFI_HTTP_PROTOCOL; + +/// +/// EFI_HTTP_VERSION +/// +typedef enum { + HttpVersion10, + HttpVersion11, + HttpVersionUnsupported +} EFI_HTTP_VERSION; + +/// +/// EFI_HTTP_METHOD +/// +typedef enum { + HttpMethodGet, + HttpMethodPost, + HttpMethodPatch, + HttpMethodOptions, + HttpMethodConnect, + HttpMethodHead, + HttpMethodPut, + HttpMethodDelete, + HttpMethodTrace, + HttpMethodMax +} EFI_HTTP_METHOD; + +/// +/// EFI_HTTP_STATUS_CODE +/// +typedef enum { + HTTP_STATUS_UNSUPPORTED_STATUS = 0, + HTTP_STATUS_100_CONTINUE, + HTTP_STATUS_101_SWITCHING_PROTOCOLS, + HTTP_STATUS_200_OK, + HTTP_STATUS_201_CREATED, + HTTP_STATUS_202_ACCEPTED, + HTTP_STATUS_203_NON_AUTHORITATIVE_INFORMATION, + HTTP_STATUS_204_NO_CONTENT, + HTTP_STATUS_205_RESET_CONTENT, + HTTP_STATUS_206_PARTIAL_CONTENT, + HTTP_STATUS_300_MULTIPLE_CHOICES, + HTTP_STATUS_301_MOVED_PERMANENTLY, + HTTP_STATUS_302_FOUND, + HTTP_STATUS_303_SEE_OTHER, + HTTP_STATUS_304_NOT_MODIFIED, + HTTP_STATUS_305_USE_PROXY, + HTTP_STATUS_307_TEMPORARY_REDIRECT, + HTTP_STATUS_400_BAD_REQUEST, + HTTP_STATUS_401_UNAUTHORIZED, + HTTP_STATUS_402_PAYMENT_REQUIRED, + HTTP_STATUS_403_FORBIDDEN, + HTTP_STATUS_404_NOT_FOUND, + HTTP_STATUS_405_METHOD_NOT_ALLOWED, + HTTP_STATUS_406_NOT_ACCEPTABLE, + HTTP_STATUS_407_PROXY_AUTHENTICATION_REQUIRED, + HTTP_STATUS_408_REQUEST_TIME_OUT, + HTTP_STATUS_409_CONFLICT, + HTTP_STATUS_410_GONE, + HTTP_STATUS_411_LENGTH_REQUIRED, + HTTP_STATUS_412_PRECONDITION_FAILED, + HTTP_STATUS_413_REQUEST_ENTITY_TOO_LARGE, + HTTP_STATUS_414_REQUEST_URI_TOO_LARGE, + HTTP_STATUS_415_UNSUPPORTED_MEDIA_TYPE, + HTTP_STATUS_416_REQUESTED_RANGE_NOT_SATISFIED, + HTTP_STATUS_417_EXPECTATION_FAILED, + HTTP_STATUS_500_INTERNAL_SERVER_ERROR, + HTTP_STATUS_501_NOT_IMPLEMENTED, + HTTP_STATUS_502_BAD_GATEWAY, + HTTP_STATUS_503_SERVICE_UNAVAILABLE, + HTTP_STATUS_504_GATEWAY_TIME_OUT, + HTTP_STATUS_505_HTTP_VERSION_NOT_SUPPORTED, + HTTP_STATUS_308_PERMANENT_REDIRECT +} EFI_HTTP_STATUS_CODE; + +/// +/// EFI_HTTPv4_ACCESS_POINT +/// +typedef struct { + /// + /// Set to TRUE to instruct the EFI HTTP instance to use the default address + /// information in every TCP connection made by this instance. In addition, when set + /// to TRUE, LocalAddress and LocalSubnet are ignored. + /// + BOOLEAN UseDefaultAddress; + /// + /// If UseDefaultAddress is set to FALSE, this defines the local IP address to be + /// used in every TCP connection opened by this instance. + /// + EFI_IPv4_ADDRESS LocalAddress; + /// + /// If UseDefaultAddress is set to FALSE, this defines the local subnet to be used + /// in every TCP connection opened by this instance. + /// + EFI_IPv4_ADDRESS LocalSubnet; + /// + /// This defines the local port to be used in + /// every TCP connection opened by this instance. + /// + UINT16 LocalPort; +} EFI_HTTPv4_ACCESS_POINT; + +/// +/// EFI_HTTPv6_ACCESS_POINT +/// +typedef struct { + /// + /// Local IP address to be used in every TCP connection opened by this instance. + /// + EFI_IPv6_ADDRESS LocalAddress; + /// + /// Local port to be used in every TCP connection opened by this instance. + /// + UINT16 LocalPort; +} EFI_HTTPv6_ACCESS_POINT; + +/// +/// EFI_HTTP_CONFIG_DATA_ACCESS_POINT +/// + + +typedef struct { + /// + /// HTTP version that this instance will support. + /// + EFI_HTTP_VERSION HttpVersion; + /// + /// Time out (in milliseconds) when blocking for requests. + /// + UINT32 TimeOutMillisec; + /// + /// Defines behavior of EFI DNS and TCP protocols consumed by this instance. If + /// FALSE, this instance will use EFI_DNS4_PROTOCOL and EFI_TCP4_PROTOCOL. If TRUE, + /// this instance will use EFI_DNS6_PROTOCOL and EFI_TCP6_PROTOCOL. + /// + BOOLEAN LocalAddressIsIPv6; + + union { + /// + /// When LocalAddressIsIPv6 is FALSE, this points to the local address, subnet, and + /// port used by the underlying TCP protocol. + /// + EFI_HTTPv4_ACCESS_POINT *IPv4Node; + /// + /// When LocalAddressIsIPv6 is TRUE, this points to the local IPv6 address and port + /// used by the underlying TCP protocol. + /// + EFI_HTTPv6_ACCESS_POINT *IPv6Node; + } AccessPoint; +} EFI_HTTP_CONFIG_DATA; + +/// +/// EFI_HTTP_REQUEST_DATA +/// +typedef struct { + /// + /// The HTTP method (e.g. GET, POST) for this HTTP Request. + /// + EFI_HTTP_METHOD Method; + /// + /// The URI of a remote host. From the information in this field, the HTTP instance + /// will be able to determine whether to use HTTP or HTTPS and will also be able to + /// determine the port number to use. If no port number is specified, port 80 (HTTP) + /// is assumed. See RFC 3986 for more details on URI syntax. + /// + CHAR16 *Url; +} EFI_HTTP_REQUEST_DATA; + +/// +/// EFI_HTTP_RESPONSE_DATA +/// +typedef struct { + /// + /// Response status code returned by the remote host. + /// + EFI_HTTP_STATUS_CODE StatusCode; +} EFI_HTTP_RESPONSE_DATA; + +/// +/// EFI_HTTP_HEADER +/// +typedef struct { + /// + /// Null terminated string which describes a field name. See RFC 2616 Section 14 for + /// detailed information about field names. + /// + CHAR8 *FieldName; + /// + /// Null terminated string which describes the corresponding field value. See RFC 2616 + /// Section 14 for detailed information about field values. + /// + CHAR8 *FieldValue; +} EFI_HTTP_HEADER; + +/// +/// EFI_HTTP_MESSAGE +/// +typedef struct { + /// + /// HTTP message data. + /// + union { + /// + /// When the token is used to send a HTTP request, Request is a pointer to storage that + /// contains such data as URL and HTTP method. + /// + EFI_HTTP_REQUEST_DATA *Request; + /// + /// When used to await a response, Response points to storage containing HTTP response + /// status code. + /// + EFI_HTTP_RESPONSE_DATA *Response; + } Data; + /// + /// Number of HTTP header structures in Headers list. On request, this count is + /// provided by the caller. On response, this count is provided by the HTTP driver. + /// + UINTN HeaderCount; + /// + /// Array containing list of HTTP headers. On request, this array is populated by the + /// caller. On response, this array is allocated and populated by the HTTP driver. It + /// is the responsibility of the caller to free this memory on both request and + /// response. + /// + EFI_HTTP_HEADER *Headers; + /// + /// Length in bytes of the HTTP body. This can be zero depending on the HttpMethod type. + /// + UINTN BodyLength; + /// + /// Body associated with the HTTP request or response. This can be NULL depending on + /// the HttpMethod type. + /// + VOID *Body; +} EFI_HTTP_MESSAGE; + + +/// +/// EFI_HTTP_TOKEN +/// +typedef struct { + /// + /// This Event will be signaled after the Status field is updated by the EFI HTTP + /// Protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL. The Task Priority + /// Level (TPL) of Event must be lower than or equal to TPL_CALLBACK. + /// + EFI_EVENT Event; + /// + /// Status will be set to one of the following value if the HTTP request is + /// successfully sent or if an unexpected error occurs: + /// EFI_SUCCESS: The HTTP request was successfully sent to the remote host. + /// EFI_HTTP_ERROR: The response message was successfully received but contains a + /// HTTP error. The response status code is returned in token. + /// EFI_ABORTED: The HTTP request was cancelled by the caller and removed from + /// the transmit queue. + /// EFI_TIMEOUT: The HTTP request timed out before reaching the remote host. + /// EFI_DEVICE_ERROR: An unexpected system or network error occurred. + /// + EFI_STATUS Status; + /// + /// Pointer to storage containing HTTP message data. + /// + EFI_HTTP_MESSAGE *Message; +} EFI_HTTP_TOKEN; + +/** + Returns the operational parameters for the current HTTP child instance. + + The GetModeData() function is used to read the current mode data (operational + parameters) for this HTTP protocol instance. + + @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. + @param[out] HttpConfigData Point to buffer for operational parameters of this + HTTP instance. It is the responsibility of the caller + to allocate the memory for HttpConfigData and + HttpConfigData->AccessPoint.IPv6Node/IPv4Node. In fact, + it is recommended to allocate sufficient memory to record + IPv6Node since it is big enough for all possibilities. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER This is NULL. + HttpConfigData is NULL. + HttpConfigData->AccessPoint.IPv4Node or + HttpConfigData->AccessPoint.IPv6Node is NULL. + @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HTTP_GET_MODE_DATA)( + IN EFI_HTTP_PROTOCOL *This, + OUT EFI_HTTP_CONFIG_DATA *HttpConfigData + ); + +/** + Initialize or brutally reset the operational parameters for this EFI HTTP instance. + + The Configure() function does the following: + When HttpConfigData is not NULL Initialize this EFI HTTP instance by configuring + timeout, local address, port, etc. + When HttpConfigData is NULL, reset this EFI HTTP instance by closing all active + connections with remote hosts, canceling all asynchronous tokens, and flush request + and response buffers without informing the appropriate hosts. + + No other EFI HTTP function can be executed by this instance until the Configure() + function is executed and returns successfully. + + @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. + @param[in] HttpConfigData Pointer to the configure data to configure the instance. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + This is NULL. + HttpConfigData->LocalAddressIsIPv6 is FALSE and + HttpConfigData->AccessPoint.IPv4Node is NULL. + HttpConfigData->LocalAddressIsIPv6 is TRUE and + HttpConfigData->AccessPoint.IPv6Node is NULL. + @retval EFI_ALREADY_STARTED Reinitialize this HTTP instance without calling + Configure() with NULL to reset it. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when + executing Configure(). + @retval EFI_UNSUPPORTED One or more options in ConfigData are not supported + in the implementation. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HTTP_CONFIGURE)( + IN EFI_HTTP_PROTOCOL *This, + IN EFI_HTTP_CONFIG_DATA *HttpConfigData OPTIONAL + ); + +/** + The Request() function queues an HTTP request to this HTTP instance, + similar to Transmit() function in the EFI TCP driver. When the HTTP request is sent + successfully, or if there is an error, Status in token will be updated and Event will + be signaled. + + @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. + @param[in] Token Pointer to storage containing HTTP request token. + + @retval EFI_SUCCESS Outgoing data was processed. + @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + @retval EFI_TIMEOUT Data was dropped out of the transmit or receive queue. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + This is NULL. + Token is NULL. + Token->Message is NULL. + Token->Message->Body is not NULL, + Token->Message->BodyLength is non-zero, and + Token->Message->Data is NULL, but a previous call to + Request()has not been completed successfully. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources. + @retval EFI_UNSUPPORTED The HTTP method is not supported in current implementation. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HTTP_REQUEST) ( + IN EFI_HTTP_PROTOCOL *This, + IN EFI_HTTP_TOKEN *Token + ); + +/** + Abort an asynchronous HTTP request or response token. + + The Cancel() function aborts a pending HTTP request or response transaction. If + Token is not NULL and the token is in transmit or receive queues when it is being + cancelled, its Token->Status will be set to EFI_ABORTED and then Token->Event will + be signaled. If the token is not in one of the queues, which usually means that the + asynchronous operation has completed, EFI_NOT_FOUND is returned. If Token is NULL, + all asynchronous tokens issued by Request() or Response() will be aborted. + + @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. + @param[in] Token Point to storage containing HTTP request or response + token. + + @retval EFI_SUCCESS Request and Response queues are successfully flushed. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_NOT_STARTED This instance hasn't been configured. + @retval EFI_NOT_FOUND The asynchronous request or response token is not + found. + @retval EFI_UNSUPPORTED The implementation does not support this function. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HTTP_CANCEL)( + IN EFI_HTTP_PROTOCOL *This, + IN EFI_HTTP_TOKEN *Token + ); + +/** + The Response() function queues an HTTP response to this HTTP instance, similar to + Receive() function in the EFI TCP driver. When the HTTP Response is received successfully, + or if there is an error, Status in token will be updated and Event will be signaled. + + The HTTP driver will queue a receive token to the underlying TCP instance. When data + is received in the underlying TCP instance, the data will be parsed and Token will + be populated with the response data. If the data received from the remote host + contains an incomplete or invalid HTTP header, the HTTP driver will continue waiting + (asynchronously) for more data to be sent from the remote host before signaling + Event in Token. + + It is the responsibility of the caller to allocate a buffer for Body and specify the + size in BodyLength. If the remote host provides a response that contains a content + body, up to BodyLength bytes will be copied from the receive buffer into Body and + BodyLength will be updated with the amount of bytes received and copied to Body. This + allows the client to download a large file in chunks instead of into one contiguous + block of memory. Similar to HTTP request, if Body is not NULL and BodyLength is + non-zero and all other fields are NULL or 0, the HTTP driver will queue a receive + token to underlying TCP instance. If data arrives in the receive buffer, up to + BodyLength bytes of data will be copied to Body. The HTTP driver will then update + BodyLength with the amount of bytes received and copied to Body. + + If the HTTP driver does not have an open underlying TCP connection with the host + specified in the response URL, Request() will return EFI_ACCESS_DENIED. This is + consistent with RFC 2616 recommendation that HTTP clients should attempt to maintain + an open TCP connection between client and host. + + @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. + @param[in] Token Pointer to storage containing HTTP response token. + + @retval EFI_SUCCESS Allocation succeeded. + @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been + initialized. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + This is NULL. + Token is NULL. + Token->Message->Headers is NULL. + Token->Message is NULL. + Token->Message->Body is not NULL, + Token->Message->BodyLength is non-zero, and + Token->Message->Data is NULL, but a previous call to + Response() has not been completed successfully. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources. + @retval EFI_ACCESS_DENIED An open TCP connection is not present with the host + specified by response URL. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HTTP_RESPONSE) ( + IN EFI_HTTP_PROTOCOL *This, + IN EFI_HTTP_TOKEN *Token + ); + +/** + The Poll() function can be used by network drivers and applications to increase the + rate that data packets are moved between the communication devices and the transmit + and receive queues. + + In some systems, the periodic timer event in the managed network driver may not poll + the underlying communications device fast enough to transmit and/or receive all data + packets without missing incoming packets or dropping outgoing packets. Drivers and + applications that are experiencing packet loss should try calling the Poll() function + more often. + + @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. + + @retval EFI_SUCCESS Incoming or outgoing data was processed.. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_NOT_READY No incoming or outgoing data is processed. + @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HTTP_POLL) ( + IN EFI_HTTP_PROTOCOL *This + ); + +/// +/// The EFI HTTP protocol is designed to be used by EFI drivers and applications to +/// create and transmit HTTP Requests, as well as handle HTTP responses that are +/// returned by a remote host. This EFI protocol uses and relies on an underlying EFI +/// TCP protocol. +/// +struct _EFI_HTTP_PROTOCOL { + EFI_HTTP_GET_MODE_DATA GetModeData; + EFI_HTTP_CONFIGURE Configure; + EFI_HTTP_REQUEST Request; + EFI_HTTP_CANCEL Cancel; + EFI_HTTP_RESPONSE Response; + EFI_HTTP_POLL Poll; +}; + +extern EFI_GUID gEfiHttpServiceBindingProtocolGuid; +extern EFI_GUID gEfiHttpProtocolGuid; + +#endif Added: head/stand/efi/include/Protocol/Ip4Config2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/efi/include/Protocol/Ip4Config2.h Mon Jun 24 23:18:42 2019 (r349349) @@ -0,0 +1,324 @@ +/* $FreeBSD$ */ +/** @file + This file provides a definition of the EFI IPv4 Configuration II + Protocol. + +Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +@par Revision Reference: +This Protocol is introduced in UEFI Specification 2.5 + +**/ +#ifndef __EFI_IP4CONFIG2_PROTOCOL_H__ +#define __EFI_IP4CONFIG2_PROTOCOL_H__ + +/* #include */ + +#define EFI_IP4_CONFIG2_PROTOCOL_GUID \ + { \ + 0x5b446ed1, 0xe30b, 0x4faa, {0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \ + } + +typedef struct _EFI_IP4_CONFIG2_PROTOCOL EFI_IP4_CONFIG2_PROTOCOL; + + +/// +/// EFI_IP4_CONFIG2_DATA_TYPE +/// +typedef enum { + /// + /// The interface information of the communication device this EFI + /// IPv4 Configuration II Protocol instance manages. This type of + /// data is read only. The corresponding Data is of type + /// EFI_IP4_CONFIG2_INTERFACE_INFO. + /// + Ip4Config2DataTypeInterfaceInfo, + /// + /// The general configuration policy for the EFI IPv4 network stack + /// running on the communication device this EFI IPv4 + /// Configuration II Protocol instance manages. The policy will + /// affect other configuration settings. The corresponding Data is of + /// type EFI_IP4_CONFIG2_POLICY. + /// + Ip4Config2DataTypePolicy, + /// + /// The station addresses set manually for the EFI IPv4 network + /// stack. It is only configurable when the policy is + /// Ip4Config2PolicyStatic. The corresponding Data is of + /// type EFI_IP4_CONFIG2_MANUAL_ADDRESS. When DataSize + /// is 0 and Data is NULL, the existing configuration is cleared + /// from the EFI IPv4 Configuration II Protocol instance. + /// + Ip4Config2DataTypeManualAddress, + /// + /// The gateway addresses set manually for the EFI IPv4 network + /// stack running on the communication device this EFI IPv4 + /// Configuration II Protocol manages. It is not configurable when + /// the policy is Ip4Config2PolicyDhcp. The gateway + /// addresses must be unicast IPv4 addresses. The corresponding + /// Data is a pointer to an array of EFI_IPv4_ADDRESS instances. + /// When DataSize is 0 and Data is NULL, the existing configuration + /// is cleared from the EFI IPv4 Configuration II Protocol instance. + /// + Ip4Config2DataTypeGateway, + /// + /// The DNS server list for the EFI IPv4 network stack running on + /// the communication device this EFI IPv4 Configuration II + /// Protocol manages. It is not configurable when the policy is + /// Ip4Config2PolicyDhcp. The DNS server addresses must be + /// unicast IPv4 addresses. The corresponding Data is a pointer to + /// an array of EFI_IPv4_ADDRESS instances. When DataSize + /// is 0 and Data is NULL, the existing configuration is cleared + /// from the EFI IPv4 Configuration II Protocol instance. + /// + Ip4Config2DataTypeDnsServer, + Ip4Config2DataTypeMaximum +} EFI_IP4_CONFIG2_DATA_TYPE; + +/// +/// EFI_IP4_CONFIG2_INTERFACE_INFO related definitions +/// +#define EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE 32 + +/// +/// EFI_IP4_CONFIG2_INTERFACE_INFO +/// +typedef struct { + /// + /// The name of the interface. It is a NULL-terminated Unicode string. + /// + CHAR16 Name[EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE]; + /// + /// The interface type of the network interface. See RFC 1700, + /// section "Number Hardware Type". + /// + UINT8 IfType; + /// + /// The size, in bytes, of the network interface's hardware address. + /// + UINT32 HwAddressSize; + /// + /// The hardware address for the network interface. + /// + EFI_MAC_ADDRESS HwAddress; + /// + /// The station IPv4 address of this EFI IPv4 network stack. + /// + EFI_IPv4_ADDRESS StationAddress; + /// + /// The subnet address mask that is associated with the station address. + /// + EFI_IPv4_ADDRESS SubnetMask; + /// + /// Size of the following RouteTable, in bytes. May be zero. + /// + UINT32 RouteTableSize; + /// + /// The route table of the IPv4 network stack runs on this interface. + /// Set to NULL if RouteTableSize is zero. Type EFI_IP4_ROUTE_TABLE is defined in + /// EFI_IP4_PROTOCOL.GetModeData(). + /// + EFI_IP4_ROUTE_TABLE *RouteTable OPTIONAL; +} EFI_IP4_CONFIG2_INTERFACE_INFO; + +/// +/// EFI_IP4_CONFIG2_POLICY +/// +typedef enum { + /// + /// Under this policy, the Ip4Config2DataTypeManualAddress, + /// Ip4Config2DataTypeGateway and Ip4Config2DataTypeDnsServer configuration + /// data are required to be set manually. The EFI IPv4 Protocol will get all + /// required configuration such as IPv4 address, subnet mask and + /// gateway settings from the EFI IPv4 Configuration II protocol. + /// + Ip4Config2PolicyStatic, + /// + /// Under this policy, the Ip4Config2DataTypeManualAddress, + /// Ip4Config2DataTypeGateway and Ip4Config2DataTypeDnsServer configuration data are + /// not allowed to set via SetData(). All of these configurations are retrieved from DHCP + /// server or other auto-configuration mechanism. + /// + Ip4Config2PolicyDhcp, + Ip4Config2PolicyMax +} EFI_IP4_CONFIG2_POLICY; + +/// +/// EFI_IP4_CONFIG2_MANUAL_ADDRESS +/// +typedef struct { + /// + /// The IPv4 unicast address. + /// + EFI_IPv4_ADDRESS Address; + /// + /// The subnet mask. + /// + EFI_IPv4_ADDRESS SubnetMask; +} EFI_IP4_CONFIG2_MANUAL_ADDRESS; + +/** + Set the configuration for the EFI IPv4 network stack running on the communication device this EFI + IPv4 Configuration II Protocol instance manages. + + This function is used to set the configuration data of type DataType for the EFI IPv4 network stack + running on the communication device this EFI IPv4 Configuration II Protocol instance manages. + The successfully configured data is valid after system reset or power-off. + The DataSize is used to calculate the count of structure instances in the Data for some + DataType that multiple structure instances are allowed. + This function is always non-blocking. When setting some typeof configuration data, an + asynchronous process is invoked to check the correctness of the data, such as doing address conflict + detection on the manually set local IPv4 address. EFI_NOT_READY is returned immediately to + indicate that such an asynchronous process is invoked and the process is not finished yet. The caller + willing to get the result of the asynchronous process is required to call RegisterDataNotify() + to register an event on the specified configuration data. Once the event is signaled, the caller can call + GetData()to get back the configuration data in order to know the result. For other types of + configuration data that do not require an asynchronous configuration process, the result of the + operation is immediately returned. + + @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. + @param[in] DataType The type of data to set. + @param[in] DataSize Size of the buffer pointed to by Data in bytes. + @param[in] Data The data buffer to set. The type ofthe data buffer is associated + with the DataType. + + @retval EFI_SUCCESS The specified configuration data for the EFI IPv4 network stack is set + successfully. + @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: + This is NULL. + One or more fields in Data and DataSize do not match the + requirement of the data type indicated by DataType. + @retval EFI_WRITE_PROTECTED The specified configuration data is read-only or the specified configuration + data can not be set under the current policy. + @retval EFI_ACCESS_DENIED Another set operation on the specified configuration data is already in process. + @retval EFI_NOT_READY An asynchronous process is invoked to set the specified configuration data and + the process is not finished yet. + @retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type indicated by DataType. + @retval EFI_UNSUPPORTED This DataType is not supported. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_DEVICE_ERROR An unexpected system error or network error occurred. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CONFIG2_SET_DATA) ( + IN EFI_IP4_CONFIG2_PROTOCOL *This, + IN EFI_IP4_CONFIG2_DATA_TYPE DataType, + IN UINTN DataSize, + IN VOID *Data + ); + +/** + Get the configuration data for the EFI IPv4 network stack running on the communication device this + EFI IPv4 Configuration II Protocol instance manages. + + This function returns the configuration data of type DataType for the EFI IPv4 network stack + running on the communication device this EFI IPv4 Configuration II Protocol instance manages. + The caller is responsible for allocating the buffer usedto return the specified configuration data and + the required size will be returned to the caller if the size of the buffer is too small. + EFI_NOT_READY is returned if the specified configuration data is not ready due to an already in + progress asynchronous configuration process. The caller can call RegisterDataNotify() to + register an event on the specified configuration data. Once the asynchronous configuration process is + finished, the event will be signaled and a subsequent GetData() call will return the specified + configuration data. + + @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. + @param[in] DataType The type of data to get. + @param[out] DataSize On input, in bytes, the size of Data. On output, in bytes, the size + of buffer required to store the specified configuration data. + @param[in] Data The data buffer in which the configuration data is returned. The + type of the data buffer is associated with the DataType. Ignored + if DataSize is 0. + + @retval EFI_SUCCESS The specified configuration data is got successfully. + @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE: + This is NULL. + DataSize is NULL. + Data is NULL if *DataSizeis not zero. + @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified configuration data + and the required size is returned in DataSize. + @retval EFI_NOT_READY The specified configuration data is not ready due to an already in + progress asynchronous configuration process. + @retval EFI_NOT_FOUND The specified configuration data is not found. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CONFIG2_GET_DATA) ( + IN EFI_IP4_CONFIG2_PROTOCOL *This, + IN EFI_IP4_CONFIG2_DATA_TYPE DataType, + IN OUT UINTN *DataSize, + IN VOID *Data OPTIONAL + ); + +/** + Register an event that is to be signaled whenever a configuration process on the specified + configuration data is done. + + This function registers an event that is to be signaled whenever a configuration process on the + specified configuration data is done. An event can be registered for different DataType + simultaneously and the caller is responsible for determining which type of configuration data causes + the signaling of the event in such case. + + @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. + @param[in] DataType The type of data to unregister the event for. + @param[in] Event The event to register. + + @retval EFI_SUCCESS The notification event for the specified configuration data is + registered. + @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL. + @retval EFI_UNSUPPORTED The configuration data type specified by DataType is not supported. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_ACCESS_DENIED The Event is already registered for the DataType. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CONFIG2_REGISTER_NOTIFY) ( + IN EFI_IP4_CONFIG2_PROTOCOL *This, + IN EFI_IP4_CONFIG2_DATA_TYPE DataType, + IN EFI_EVENT Event + ); + +/** + Remove a previously registered event for the specified configuration data. + + This function removes a previously registeredevent for the specified configuration data. + + @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. + @param[in] DataType The type of data to remove the previously registered event for. + @param[in] Event The event to unregister. + + @retval EFI_SUCCESS The event registered for the specified configuration data is removed. + @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL. + @retval EFI_NOT_FOUND The Eventhas not been registered for the specified DataType. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CONFIG2_UNREGISTER_NOTIFY) ( + IN EFI_IP4_CONFIG2_PROTOCOL *This, + IN EFI_IP4_CONFIG2_DATA_TYPE DataType, + IN EFI_EVENT Event + ); + +/// +/// The EFI_IP4_CONFIG2_PROTOCOL is designed to be the central repository for the common +/// configurations and the administrator configurable settings for the EFI IPv4 network stack. +/// An EFI IPv4 Configuration II Protocol instance will be installed on each communication device that +/// the EFI IPv4 network stack runs on. +/// +struct _EFI_IP4_CONFIG2_PROTOCOL { + EFI_IP4_CONFIG2_SET_DATA SetData; + EFI_IP4_CONFIG2_GET_DATA GetData; + EFI_IP4_CONFIG2_REGISTER_NOTIFY RegisterDataNotify; + EFI_IP4_CONFIG2_UNREGISTER_NOTIFY UnregisterDataNotify; +}; + +extern EFI_GUID gEfiIp4Config2ProtocolGuid; + +#endif + Added: head/stand/efi/include/Protocol/ServiceBinding.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/efi/include/Protocol/ServiceBinding.h Mon Jun 24 23:18:42 2019 (r349349) @@ -0,0 +1,95 @@ +/* $FreeBSD$ */ +/** @file + UEFI Service Binding Protocol is defined in UEFI specification. + + The file defines the generic Service Binding Protocol functions. + It provides services that are required to create and destroy child + handles that support a given set of protocols. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __EFI_SERVICE_BINDING_H__ +#define __EFI_SERVICE_BINDING_H__ + +/// +/// Forward reference for pure ANSI compatibility +/// +typedef struct _EFI_SERVICE_BINDING_PROTOCOL EFI_SERVICE_BINDING_PROTOCOL; + +/** + Creates a child handle and installs a protocol. + + The CreateChild() function installs a protocol on ChildHandle. + If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle. + If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle. + + @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance. + @param ChildHandle Pointer to the handle of the child to create. If it is NULL, + then a new handle is created. If it is a pointer to an existing UEFI handle, + then the protocol is added to the existing UEFI handle. + + @retval EFI_SUCCES The protocol was added to ChildHandle. + @retval EFI_INVALID_PARAMETER ChildHandle is NULL. + @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create + the child + @retval other The child handle was not created + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SERVICE_BINDING_CREATE_CHILD)( + IN EFI_SERVICE_BINDING_PROTOCOL *This, + IN OUT EFI_HANDLE *ChildHandle + ); + +/** + Destroys a child handle with a protocol installed on it. + + The DestroyChild() function does the opposite of CreateChild(). It removes a protocol + that was installed by CreateChild() from ChildHandle. If the removed protocol is the + last protocol on ChildHandle, then ChildHandle is destroyed. + + @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance. + @param ChildHandle Handle of the child to destroy + + @retval EFI_SUCCES The protocol was removed from ChildHandle. + @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed. + @retval EFI_INVALID_PARAMETER Child handle is NULL. + @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle + because its services are being used. + @retval other The child handle was not destroyed + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SERVICE_BINDING_DESTROY_CHILD)( + IN EFI_SERVICE_BINDING_PROTOCOL *This, + IN EFI_HANDLE ChildHandle + ); + +/// +/// The EFI_SERVICE_BINDING_PROTOCOL provides member functions to create and destroy +/// child handles. A driver is responsible for adding protocols to the child handle +/// in CreateChild() and removing protocols in DestroyChild(). It is also required +/// that the CreateChild() function opens the parent protocol BY_CHILD_CONTROLLER +/// to establish the parent-child relationship, and closes the protocol in DestroyChild(). +/// The pseudo code for CreateChild() and DestroyChild() is provided to specify the +/// required behavior, not to specify the required implementation. Each consumer of +/// a software protocol is responsible for calling CreateChild() when it requires the +/// protocol and calling DestroyChild() when it is finished with that protocol. +/// +struct _EFI_SERVICE_BINDING_PROTOCOL { + EFI_SERVICE_BINDING_CREATE_CHILD CreateChild; + EFI_SERVICE_BINDING_DESTROY_CHILD DestroyChild; +}; + +#endif Modified: head/stand/efi/include/efidevp.h ============================================================================== --- head/stand/efi/include/efidevp.h Mon Jun 24 21:24:55 2019 (r349348) +++ head/stand/efi/include/efidevp.h Mon Jun 24 23:18:42 2019 (r349349) @@ -232,6 +232,8 @@ typedef struct _IPv4_DEVICE_PATH { UINT16 RemotePort; UINT16 Protocol; BOOLEAN StaticIpAddress; + EFI_IPv4_ADDRESS GatewayIpAddress; + EFI_IPv4_ADDRESS SubnetMask; } IPv4_DEVICE_PATH; #define MSG_IPv6_DP 0x0d @@ -293,6 +295,26 @@ typedef struct _SATA_DEVICE_PATH { UINT16 PortMultiplierPortNumber; UINT16 Lun; } SATA_DEVICE_PATH; + + +/* DNS Device Path SubType */ +#define MSG_DNS_DP 0x1F +typedef struct { + EFI_DEVICE_PATH Header; + /* Indicates the DNS server address is IPv4 or IPv6 address. */ + UINT8 IsIPv6; + /* Instance of the DNS server address. */ + /* XXX: actually EFI_IP_ADDRESS */ + EFI_IPv4_ADDRESS DnsServerIp[]; +} DNS_DEVICE_PATH; + +/* Uniform Resource Identifiers (URI) Device Path SubType */ +#define MSG_URI_DP 0x18 +typedef struct { + EFI_DEVICE_PATH Header; + /* Instance of the URI pursuant to RFC 3986. */ + CHAR8 Uri[]; +} URI_DEVICE_PATH; #define MEDIA_DEVICE_PATH 0x04 Modified: head/stand/efi/include/efilib.h ============================================================================== --- head/stand/efi/include/efilib.h Mon Jun 24 21:24:55 2019 (r349348) +++ head/stand/efi/include/efilib.h Mon Jun 24 23:18:42 2019 (r349349) @@ -42,6 +42,7 @@ extern EFI_RUNTIME_SERVICES *RS; extern struct devsw efipart_fddev; extern struct devsw efipart_cddev; extern struct devsw efipart_hddev; +extern struct devsw efihttp_dev; extern struct devsw efinet_dev; extern struct netif_driver efinetif; Modified: head/stand/efi/libefi/Makefile ============================================================================== --- head/stand/efi/libefi/Makefile Mon Jun 24 21:24:55 2019 (r349348) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Jun 25 00:40:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DBAA15DD969; Tue, 25 Jun 2019 00:40:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 30FE88F4BB; Tue, 25 Jun 2019 00:40:47 +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 D94C28C38; Tue, 25 Jun 2019 00:40:46 +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 x5P0ek9s087300; Tue, 25 Jun 2019 00:40:46 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P0ejJP086572; Tue, 25 Jun 2019 00:40:45 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201906250040.x5P0ejJP086572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 25 Jun 2019 00:40:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349350 - in head: contrib/gcc/config/rs6000 lib/libc/powerpc lib/libc/powerpc/gen lib/libc/powerpc/sys libexec/rtld-elf libexec/rtld-elf/powerpc sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head: contrib/gcc/config/rs6000 lib/libc/powerpc lib/libc/powerpc/gen lib/libc/powerpc/sys libexec/rtld-elf libexec/rtld-elf/powerpc sys/powerpc/powerpc X-SVN-Commit-Revision: 349350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 30FE88F4BB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.950,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 00:40:47 -0000 Author: jhibbits Date: Tue Jun 25 00:40:44 2019 New Revision: 349350 URL: https://svnweb.freebsd.org/changeset/base/349350 Log: powerpc: Transition to Secure-PLT, like most other OSs Summary: PowerPC has two PLT models: BSS-PLT and Secure-PLT. BSS-PLT uses runtime code generation to generate the PLT stubs. Secure-PLT was introduced with GCC 4.1 and Binutils 2.17 (base has GCC 4.2.1 and Binutils 2.17), and is a more secure PLT format, using a read-only linkage table, with the dynamic linker populating a non-executable index table. This is the libc, rtld, and kernel support only. The toolchain and build parts will be updated separately. Reviewed By: nwhitehorn, bdragon, pfg Differential Revision: https://reviews.freebsd.org/D20598 MFC after: 1 month Modified: head/contrib/gcc/config/rs6000/tramp.asm head/lib/libc/powerpc/SYS.h head/lib/libc/powerpc/gen/_ctx_start.S head/lib/libc/powerpc/sys/cerror.S head/libexec/rtld-elf/powerpc/reloc.c head/libexec/rtld-elf/powerpc/rtld_start.S head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld.h head/sys/powerpc/powerpc/machdep.c Modified: head/contrib/gcc/config/rs6000/tramp.asm ============================================================================== --- head/contrib/gcc/config/rs6000/tramp.asm Mon Jun 24 23:18:42 2019 (r349349) +++ head/contrib/gcc/config/rs6000/tramp.asm Tue Jun 25 00:40:44 2019 (r349350) @@ -38,6 +38,7 @@ .file "tramp.asm" .section ".text" #include "ppc-asm.h" + #include "auto-host.h" #ifndef __powerpc64__ .type trampoline_initial,@object @@ -105,7 +106,7 @@ FUNC_START(__trampoline_setup) blr .Labort: -#if defined SHARED && defined HAVE_AS_REL16 +#if (defined(__PIC__) || defined(__pic__)) && defined HAVE_AS_REL16 bcl 20,31,1f 1: mflr r30 addis r30,r30,_GLOBAL_OFFSET_TABLE_-1b@ha Modified: head/lib/libc/powerpc/SYS.h ============================================================================== --- head/lib/libc/powerpc/SYS.h Mon Jun 24 23:18:42 2019 (r349349) +++ head/lib/libc/powerpc/SYS.h Tue Jun 25 00:40:44 2019 (r349350) @@ -44,7 +44,7 @@ #define SYSCALL(name) \ .text; \ .align 2; \ -2: b PIC_PLT(CNAME(HIDENAME(cerror))); \ +2: b CNAME(HIDENAME(cerror)); \ ENTRY(__sys_##name); \ WEAK_REFERENCE(__sys_##name, name); \ WEAK_REFERENCE(__sys_##name, _##name); \ @@ -58,15 +58,14 @@ ENTRY(__sys_##name); \ WEAK_REFERENCE(__sys_##name, _##name); \ _SYSCALL(name); \ bnslr; \ - b PIC_PLT(CNAME(HIDENAME(cerror))) + b CNAME(HIDENAME(cerror)) #define RSYSCALL(name) \ .text; \ .align 2; \ -2: b PIC_PLT(CNAME(HIDENAME(cerror))); \ ENTRY(__sys_##name); \ WEAK_REFERENCE(__sys_##name, name); \ WEAK_REFERENCE(__sys_##name, _##name); \ _SYSCALL(name); \ bnslr; \ - b PIC_PLT(CNAME(HIDENAME(cerror))) + b CNAME(HIDENAME(cerror)) Modified: head/lib/libc/powerpc/gen/_ctx_start.S ============================================================================== --- head/lib/libc/powerpc/gen/_ctx_start.S Mon Jun 24 23:18:42 2019 (r349349) +++ head/lib/libc/powerpc/gen/_ctx_start.S Tue Jun 25 00:40:44 2019 (r349350) @@ -35,11 +35,18 @@ mtlr %r14 blrl /* branch to start function */ mr %r3,%r15 /* pass pointer to ucontext as argument */ - bl PIC_PLT(CNAME(_ctx_done)) /* branch to ctxt completion func */ + bl CNAME(_ctx_done) /* branch to ctxt completion func */ + /* * we should never return from the * above branch. */ + /* Don't bother saving off %r30, we're already in a bad state. */ + bcl 20,31,1f +1: mflr %r30 + mr %r3,%r30 # save for _DYNAMIC + addis %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@ha + addi %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@l bl PIC_PLT(CNAME(abort)) /* abort */ END(_cts_start) Modified: head/lib/libc/powerpc/sys/cerror.S ============================================================================== --- head/lib/libc/powerpc/sys/cerror.S Mon Jun 24 23:18:42 2019 (r349349) +++ head/lib/libc/powerpc/sys/cerror.S Tue Jun 25 00:40:44 2019 (r349350) @@ -40,16 +40,27 @@ __FBSDID("$FreeBSD$"); */ HIDENAME(cerror): mflr %r0 - stwu %r1,-16(%r1) /* allocate new stack frame */ - stw %r0,20(%r1) /* and save lr, r31 */ - stw %r31,8(%r1) + stwu %r1,-20(%r1) /* allocate new stack frame */ + stw %r0,24(%r1) /* and save lr, r31 */ + stw %r31,12(%r1) +#ifdef __PIC__ + stw %r30,8(%r1) + bcl 20,31,1f +1: + mflr %r30 + addis %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@ha + addi %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@l +#endif mr %r31,%r3 /* stash errval in callee-saved register */ bl PIC_PLT(CNAME(__error)) stw %r31,0(%r3) /* store errval into &errno */ - lwz %r0,20(%r1) - lwz %r31,8(%r1) + lwz %r0,24(%r1) + lwz %r31,12(%r1) +#ifdef __PIC__ + lwz %r30,8(%r1) +#endif mtlr %r0 - la %r1,16(%r1) + la %r1,20(%r1) li %r3,-1 li %r4,-1 blr /* return to callers caller */ Modified: head/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc/reloc.c Mon Jun 24 23:18:42 2019 (r349349) +++ head/libexec/rtld-elf/powerpc/reloc.c Tue Jun 25 00:40:44 2019 (r349350) @@ -57,6 +57,8 @@ #define JMPTAB_BASE(N) (18 + N*2 + ((N > PLT_EXTENDED_BEGIN) ? \ (N - PLT_EXTENDED_BEGIN)*2 : 0)) +void _rtld_bind_secureplt_start(void); + /* * Process the R_PPC_COPY relocations */ @@ -361,6 +363,11 @@ reloc_plt_object(Obj_Entry *obj, const Elf_Rela *rela) if (reloff < 0) return (-1); + if (obj->gotptr != NULL) { + *where += (Elf_Addr)obj->relocbase; + return (0); + } + pltlongresolve = obj->pltgot + 5; pltresolve = pltlongresolve + 5; @@ -425,7 +432,7 @@ reloc_plt(Obj_Entry *obj, int flags __unused, RtldLock * Sync the icache for the byte range represented by the * trampoline routines and call slots. */ - if (obj->pltgot != NULL) + if (obj->pltgot != NULL && obj->gotptr == NULL) __syncicache(obj->pltgot, JMPTAB_BASE(N)*4); return (0); @@ -501,6 +508,14 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, */ offset = target - (Elf_Addr)wherep; + if (obj->gotptr != NULL) { + assert(wherep >= (Elf_Word *)obj->pltgot); + assert(wherep < + (Elf_Word *)obj->pltgot + obj->pltrelasize); + *wherep = target; + goto out; + } + if (abs((int)offset) < 32*1024*1024) { /* inside 32MB? */ /* b value # branch directly */ *wherep = 0x48000000 | (offset & 0x03fffffc); @@ -576,6 +591,16 @@ init_pltgot(Obj_Entry *obj) pltcall = obj->pltgot; if (pltcall == NULL) { + return; + } + + /* Handle Secure-PLT first, if applicable. */ + if (obj->gotptr != NULL) { + obj->gotptr[1] = (Elf_Addr)_rtld_bind_secureplt_start; + obj->gotptr[2] = (Elf_Addr)obj; + dbg("obj %s secure-plt gotptr=%p start=%p obj=%p", + obj->path, obj->gotptr, + (void *)obj->gotptr[1], (void *)obj->gotptr[2]); return; } Modified: head/libexec/rtld-elf/powerpc/rtld_start.S ============================================================================== --- head/libexec/rtld-elf/powerpc/rtld_start.S Mon Jun 24 23:18:42 2019 (r349349) +++ head/libexec/rtld-elf/powerpc/rtld_start.S Tue Jun 25 00:40:44 2019 (r349350) @@ -52,36 +52,23 @@ _ENTRY(.rtld_start) * - use link-time constants to determine offset to the * _DYNAMIC section and the GOT. Add these to the PC to * convert to absolute addresses. - * - sync icache to allow execution of the SVR4 ABI-specified - * blrl instruction preceding the GOT - * - Use this instruction to determine the GOT absolute address * - read GOT[0], which is the SVR4 ABI-specified link-time * value of _DYNAMIC. Subtract this value from the absolute * value to determine the load address * - call reloc_non_plt_self() to fix up ld-elf.so's relocations */ - bl 1f - .long _DYNAMIC-. - .long _GLOBAL_OFFSET_TABLE_-. /* branch lr + 4 */ -1: - mflr %r3 /* PC value at .long */ - lwz %r4,4(%r3) - add %r4,%r4,%r3 /* &_GLOBAL_OFFSET_TABLE-4, blrl insn. */ - dcbst %r0,%r4 /* sync i-cache with d-cache */ - sync - icbi %r0,%r4 - isync + bcl 20,31,1f +1: mflr %r30 + mr %r3,%r30 # save for _DYNAMIC + addis %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@ha + addi %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@l + addis %r3,%r3,_DYNAMIC-1b@ha # get _DYNAMIC actual address + addi %r3,%r3,_DYNAMIC-1b@l + lwz %r28,0(%r30) # get base-relative &_DYNAMIC + sub %r28,%r3,%r28 # r28 = relocbase + mr %r4,%r28 # r4 = relocbase + bl reloc_non_plt_self /* reloc_non_plt_self(&_DYNAMIC,base) */ - lwz %r4,0(%r3) /* offset to _DYNAMIC */ - add %r3,%r4,%r3 /* r3 = &_DYNAMIC, absolute value */ - - bl _GLOBAL_OFFSET_TABLE_@local-4 - mflr %r4 /* &_GLOBAL_OFFSET_TABLE_, absolute value */ - lwz %r4,0(%r4) /* linker &_DYNAMIC, from got[0] */ - subf %r4,%r4,%r3 /* subtract to calculate relocbase */ - - bl reloc_non_plt_self@plt /* reloc_non_plt_self(&_DYNAMIC,base) */ - /* * The _rtld() function likes to see a stack layout containing * { argc, argv[0], argv[1] ... argv[N], 0, env[0], ... , env[N] } @@ -95,7 +82,7 @@ _ENTRY(.rtld_start) addi %r4,%r1,8 /* &exit_proc on stack */ addi %r5,%r1,12 /* &obj_main on stack */ - bl _rtld@plt /* &_start = _rtld(sp, &exit_proc, &obj_main)*/ + bl _rtld /* &_start = _rtld(sp, &exit_proc, &obj_main)*/ mtlr %r3 /* @@ -115,6 +102,29 @@ _ENTRY(.rtld_start) sc /* + * _rtld_bind_secureplt_start() + * + * Call into the MI binder (Secure-PLT stub). + * secure-plt expects %r11 to be the offset to the rela entry. + * bss-plt expects %r11 to be index of the rela entry. + * So for bss-plt, we multiply the index by 12 to get the offset. + */ +_ENTRY(_rtld_bind_secureplt_start) + stwu %r1,-160(%r1) # stack space for 29 regs + r0/lr/cr + stw %r0,20(%r1) # save r0 + + /* + * Instead of division which is costly we will use multiplicative + * inverse. a / n = ((a * inv(n)) >> 32) + * where inv(n) = (0x100000000 + n - 1) / n + */ + mr %r0,%r11 + lis %r11,0x15555556@h # load multiplicative inverse of 12 + ori %r11,%r11,0x15555556@l + mulhwu %r11,%r11,%r0 # get high half of multiplication + b 1f + +/* * _rtld_bind_start() * * Call into the MI binder. This routine is reached via the PLT call cell, @@ -129,6 +139,7 @@ _ENTRY(.rtld_start) _ENTRY(_rtld_bind_start) stwu %r1,-160(%r1) # stack space for 29 regs + r0/lr/cr stw %r0,20(%r1) # save r0 +1: mflr %r0 stw %r0,16(%r1) # save lr mfcr %r0 @@ -137,7 +148,7 @@ _ENTRY(_rtld_bind_start) mr %r3,%r12 # obj mulli %r4,%r11,12 # rela index * sizeof(Elf_Rela) - bl _rtld_bind@PLT # target addr = _rtld_bind(obj, reloff) + bl _rtld_bind # target addr = _rtld_bind(obj, reloff) mtctr %r3 # move absolute target addr into ctr lmw %r3,24(%r1) # restore r3-r31 Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Mon Jun 24 23:18:42 2019 (r349349) +++ head/libexec/rtld-elf/rtld.c Tue Jun 25 00:40:44 2019 (r349350) @@ -1286,10 +1286,16 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_D #endif +#ifdef __powerpc__ #ifdef __powerpc64__ case DT_PPC64_GLINK: obj->glink = (Elf_Addr)(obj->relocbase + dynp->d_un.d_ptr); break; +#else + case DT_PPC_GOT: + obj->gotptr = (Elf_Addr *)(obj->relocbase + dynp->d_un.d_ptr); + break; +#endif #endif case DT_FLAGS_1: Modified: head/libexec/rtld-elf/rtld.h ============================================================================== --- head/libexec/rtld-elf/rtld.h Mon Jun 24 23:18:42 2019 (r349349) +++ head/libexec/rtld-elf/rtld.h Tue Jun 25 00:40:44 2019 (r349350) @@ -190,8 +190,12 @@ typedef struct Struct_Obj_Entry { Elf_Word gotsym; /* First dynamic symbol in GOT */ Elf_Addr *mips_pltgot; /* Second PLT GOT */ #endif +#ifdef __powerpc__ #ifdef __powerpc64__ Elf_Addr glink; /* GLINK PLT call stub section */ +#else + Elf_Addr *gotptr; /* GOT pointer (secure-plt only) */ +#endif #endif const Elf_Verneed *verneed; /* Required versions. */ Modified: head/sys/powerpc/powerpc/machdep.c ============================================================================== --- head/sys/powerpc/powerpc/machdep.c Mon Jun 24 23:18:42 2019 (r349349) +++ head/sys/powerpc/powerpc/machdep.c Tue Jun 25 00:40:44 2019 (r349350) @@ -595,3 +595,16 @@ bzero(void *buf, size_t len) len--; } } + +/* __stack_chk_fail_local() is called in secure-plt (32-bit). */ +#if !defined(__powerpc64__) +extern void __stack_chk_fail(void); +void __stack_chk_fail_local(void); + +void +__stack_chk_fail_local(void) +{ + + __stack_chk_fail(); +} +#endif From owner-svn-src-head@freebsd.org Tue Jun 25 00:45:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12B8715DDC03; Tue, 25 Jun 2019 00:45:55 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.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 8C5EE8FAF2; Tue, 25 Jun 2019 00:45:54 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x5P0jqHv046648; Mon, 24 Jun 2019 17:45:52 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x5P0jqiw046647; Mon, 24 Jun 2019 17:45:52 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201906250045.x5P0jqiw046647@gndrsh.dnsmgr.net> Subject: Re: svn commit: r349349 - in head/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa In-Reply-To: <201906242318.x5ONIhlS043523@repo.freebsd.org> To: Rebecca Cran Date: Mon, 24 Jun 2019 17:45:52 -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-Rspamd-Queue-Id: 8C5EE8FAF2 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 00:45:55 -0000 > Author: bcran > Date: Mon Jun 24 23:18:42 2019 > New Revision: 349349 > URL: https://svnweb.freebsd.org/changeset/base/349349 > > Log: > loader: add HTTP support using UEFI > > Add support for an HTTP "network filesystem" using the UEFI's HTTP > stack. > > This also supports HTTPS, but TianoCore EDK2 implementations currently > crash while fetching loader files. > Only IPv4 is supported at the moment. IPv6 support is planned for a > follow-up changeset. > > Note that we include some headers from the TianoCore EDK II project in > stand/efi/include/Protocol verbatim, including links to the license instead > of including the full text because that's their preferred way of > communicating it, despite not being normal FreeBSD project practice. Please read the license text below and understand why I might have a conflict with the above statement when infact the text included says "which accompanies this distribution." > Submitted by: scottph > Reviewed by: imp, bcran > Differential Revision: https://reviews.freebsd.org/D20643 > > Added: > head/stand/efi/include/Protocol/Http.h (contents, props changed) > head/stand/efi/include/Protocol/Ip4Config2.h (contents, props changed) > head/stand/efi/include/Protocol/ServiceBinding.h (contents, props changed) > head/stand/efi/libefi/efihttp.c (contents, props changed) > Modified: > head/stand/efi/include/efidevp.h > head/stand/efi/include/efilib.h > head/stand/efi/libefi/Makefile > head/stand/efi/loader/conf.c > head/stand/libsa/stand.h > > Added: head/stand/efi/include/Protocol/Http.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/stand/efi/include/Protocol/Http.h Mon Jun 24 23:18:42 2019 (r349349) > @@ -0,0 +1,523 @@ > +/* $FreeBSD$ */ > +/** @file > + This file defines the EFI HTTP Protocol interface. It is split into > + the following two main sections: > + HTTP Service Binding Protocol (HTTPSB) > + HTTP Protocol (HTTP) > + > + Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
> + (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
> + This program and the accompanying materials > + are licensed and made available under the terms and conditions of the BSD License > + which accompanies this distribution. The full text of the license may be found at It sys accompanies, that means not a pointer to... > + http://opensource.org/licenses/bsd-license.php Also shouldn't it say 2 clause license, as that is what is pointed at? Is the above text exactly as it appeared in the file from Tianocore or has it been edited in any way? > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Hum oh my, what has happend to the disclaimer? > + > + @par Revision Reference: > + This Protocol is introduced in UEFI Specification 2.5 > + > +**/ > + > +#ifndef __EFI_HTTP_PROTOCOL_H__ > +#define __EFI_HTTP_PROTOCOL_H__ ... -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Tue Jun 25 00:53:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7103015DDFBE; Tue, 25 Jun 2019 00:53:29 +0000 (UTC) (envelope-from bcran@freebsd.org) Received: from muon.bluestop.org (muon.bluestop.org [65.103.231.193]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCFF1680E7; Tue, 25 Jun 2019 00:53:28 +0000 (UTC) (envelope-from bcran@freebsd.org) Received: from muon.bluestop.org (localhost [127.0.0.1]) by muon.bluestop.org (Postfix) with ESMTP id 65A915ACC7; Mon, 24 Jun 2019 18:57:45 -0600 (MDT) Received: from muon.bluestop.org ([127.0.0.1]) by muon.bluestop.org (muon.bluestop.org [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id yqa0TERhG2CE; Mon, 24 Jun 2019 18:57:45 -0600 (MDT) Received: from photon.int.bluestop.org (unknown [10.0.10.170]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by muon.bluestop.org (Postfix) with ESMTPSA; Mon, 24 Jun 2019 18:57:44 -0600 (MDT) Subject: Re: svn commit: r349349 - in head/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201906250045.x5P0jqiw046647@gndrsh.dnsmgr.net> From: Rebecca Cran Openpgp: preference=signencrypt Autocrypt: addr=bcran@freebsd.org; keydata= mQINBFrUMZ4BEADI1yUEGeZeXeTCPay1ZpTBdDEpGPAw1dq2VCSTc1VhsnrEBa1iZxAfaeSv Uu5Ti7jlhQ/3sQMl0bJMKGB/RtmIW7k8h2w476oZmG8gChk8su5ZEx/pV1gdqInyFmmJKTYc gabJz8pL+m82w07qPv+oalepZ4dbj+HF++RAK/iEju+q9UHlsjj8e3mMNsvtrOz1K6bnpveO jZ+ms/2H3Hs5a4k8y6buwe2RvwhJQaXa13cR3LhzL+nwj4B9PHZZEa2WpEyYpw/bI0V9YSQN QgC1CYRzDyakZge6BCM6wHOgZSUzRPufGilrNKUwIVbRoIBR9/85+0wR+PlFUOUOfOc6ox7T dWcIx6PuPhek48rh4uwmmwsPtPiH4Z3T5p+GmWQ9NLFZKA1YnEdaSkWtYZsDxwVZZeYG2plt MfhXP0Hj4rf9Y3eoUenCaGioxAbUOBCtXdTGNAhNjz1g5NGDBVyhjKkzwJQvt9UrYTseERit 5dX2CMTy8hYLvSXd/Ivy+HylUS5IslfZxW5z9LgWX7Z97kILgkH3N0ewtLkygkG+Y+x7uaAV dFqp9ASOyzaiwKbJdeOI+WxRSh+AqeCR0S+bpkcLudLmbjrPmaFwjKycy1H85Z5R2J3YHyXY oT6OYjD8vLbUU2GWp6Onkcy1Pu8EMbRuzKil6HnpYg3BexbPFwARAQABtCBSZWJlY2NhIENy YW4gPGJjcmFuQGZyZWVic2Qub3JnPokCVAQTAQgAPhYhBB+5fZtkTdO940Yr4g0CK1MRvhAg BQJa2B8pAhsjBQkJZgGABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEA0CK1MRvhAgAe0P /R65umdPBVFCYKPZ91HMqlZtn0EWOGwycWEK/feWI+jaYOa+8+VVxFau4gwnBmgCdf5XOAJW QugUlPte9T+dP9QXmgm8z3KMLCj2PATYlmqmQfvIleJPf8w7BFBw/kkd6ZxoEQXaEyZwWuJc vY58uFYizZ8s1gMjD7uV3eg2UuGYd4loBZ3MSanWrhE6mmxAjzcYYb0KTsaTH9ON4uctcTYG 4FN0KzRx5d4nAhnS/yaL+3OI23vUDt+XnOCx8tIOczScOEN5NFChgyvTxzwi7hTVNB7uUCha mN6vcjtrrzi03zHXooldE4gRJ5G+SzuH9yHKrrwYXUeKi8sG8uXVoWwzsLbCxHRe7T9Ow7Im 92Aep3DEIE9whG6Fg3hRQ4/d/9OVCGrV3XwRMEstCvamJQc69ZsULo1ssGmPvcLn8fNaLNeP ICCLQj4JLcYvKKfLIQ/Cm0Orsy8rJGhwF4W1mBUbTdR6pk2azEkrhE7KZDylgikpNNqshKV3 1nD/5SNrTDl0P8rTnu0OKT0IbozIsaz9FD2xMPHPUMPnVSTB96+PhgoBIQlHcys19gftotuN 1tlLs4Ny93xWLSjKWoW5l9E9LbIh+M8gD3A7JyyV9DRZkHdbOt3pGjpaozchDPCpRkcsFXp4 9zSbXtxnbAWfZwoSYQTvznmXpzHMzoLMWf/guQINBFrUMZ4BEADkc4mvMcMcDF1tdNxNQuIB E1F243oZamG3LACCKfc1Yur3CPzHwIk5LXCUmbq23iE5bowxMWw3mlVT0p5xM0WnUidIBwCK u4kRyy/fY4NyWWBuwy9srpTdmUcKRBRNB8zEZE8xIlidD1ijjgqLBfeM7n9ylawAxHLxwU96 sdpdHFzb7Z0yKY2e/bzDaHiG0fUvcCmkgLf+uwKKZid1j8zR5PzKpgPqfy/PF01eKyGV3MNu 8Y90xMoiEMWfCI2IB1m+hTuzZoboFvGV54SiMuvfWK/VMQjhsL6K2ddOqwVuy2nIMI4G3xDQ W/v8KVyn43OSIAyW1eaklhzu0Ir2sO60PXRkvbTUrouvmSvpJfIQS49rU0M/X6FSDgXQLKrZ 3my94+g8ptz9KoVml6s4OAwYVz+sb49nuSxipFKkU5FwhKOLmzbsBxCtytcUJoLmjuJPJPDQ ue6YJiIXyc86GVY2pH3DjemKdbB4dSgqAJIp+lCzKSJzz7bgueh2Ox8vzx1tSxKj7V8Nal+U TKKbkxPmMh+e20YZ4esAVifO3bS6IJP/aDnfagghB71vA7+aWGXPbjPlc2UHpCBiRSsl+Igo QXvdvZBsKRyfBx8neODa2C6JIE5vcaCjilSeKF8SzsFXvimnndhQNhAPU/DwQwSXdCl4gTsF Vi5d8Oxq1sce+wARAQABiQI8BBgBCAAmFiEEH7l9m2RN073jRiviDQIrUxG+ECAFAlrUMZ4C GwwFCQlmAYAACgkQDQIrUxG+ECAWnRAAsmZX+KgNxW3v7R/76Tz4Wjmh4AGeE+Ji3p5QsdTY ny1B6vYBL9vCzPJ/AK8pgKMDRaweUP5eZQpfrdWC8Q7SNGgi4Q+97KEs+i2xZLQ+WJb8a+WE EIc716u0y4ITiHfOgM5jWcFO4MXQATbJgv0drLLesa+LQCvZgPBqupt307EsCubQs+Sxt+RV jf6rOUolp1GJXEQYwGsKklVd6yqLC8M1BSG53/WE5tSv5GzBZ8fp6EtmjT7leuidFtEvKYHQ z4DqG9ELpHUF0X0UUCBK/MgXe3kCVLKE060UrJ4M6uPSx57rmVFA2MvwQR8M7GsWC5UsSM4P YwPWBhwxE7vcx0691YKAHT/5q8LxRVBdUyzPSprMhSQFttsBt+ygm6wRi3Pi3TuCEARNubPk QefyeC34yr40SAUCkOl3eWxSXPF4NfXFQb4AAzZSE5hv3qbDuwo3lrL0LqpIpEQPAz+JZ1QZ 6mMFQ5/JD9Gukj54kZc0X8w3sQt0a8vyE/qrJg8vKgv2rCHrPc5MeDkEUEFiiJiCEDdkJtMy oRlU3S4NrnbyLOLEcHE8fGe3hStPX8hY62id2ecdQ5WZ7vLZW5SFeLarbUciuHIkVL6MHnUj bV7XlY50N7ebeFCIdlCWhdum2FJs/Ni+SSxbZC564vrokwlBBGSo6WTPQTa8IWx1DtU= Message-ID: <9046989b-f45a-12a9-954f-799ade5b08a2@freebsd.org> Date: Mon, 24 Jun 2019 18:53:13 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <201906250045.x5P0jqiw046647@gndrsh.dnsmgr.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LpRjN50aGs9nR7wDkGN1wBsnJhxV4BX8k" X-Rspamd-Queue-Id: DCFF1680E7 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.97)[-0.970,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 00:53:29 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LpRjN50aGs9nR7wDkGN1wBsnJhxV4BX8k Content-Type: multipart/mixed; boundary="niyZcG6eKMvkdIqT1vNXpAcYlpJEpY7ZN"; protected-headers="v1" From: Rebecca Cran To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <9046989b-f45a-12a9-954f-799ade5b08a2@freebsd.org> Subject: Re: svn commit: r349349 - in head/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa References: <201906250045.x5P0jqiw046647@gndrsh.dnsmgr.net> In-Reply-To: <201906250045.x5P0jqiw046647@gndrsh.dnsmgr.net> --niyZcG6eKMvkdIqT1vNXpAcYlpJEpY7ZN Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 2019-06-24 18:45, Rodney W. Grimes wrote: > It sys accompanies, that means not a pointer to.... > Hum oh my, what has happend to the disclaimer? Huh. It turns out the _latest_ version of that file just contains: /** @file This file defines the EFI HTTP Protocol interface. It is split into the following two main sections: HTTP Service Binding Protocol (HTTPSB) HTTP Protocol (HTTP) Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent @par Revision Reference: This Protocol is introduced in UEFI Specification 2.5 **/ I think I should update the copy in the tree with this version, which makes more sense. Do you agree? --=20 Rebecca Cran --niyZcG6eKMvkdIqT1vNXpAcYlpJEpY7ZN-- --LpRjN50aGs9nR7wDkGN1wBsnJhxV4BX8k Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEH7l9m2RN073jRiviDQIrUxG+ECAFAl0RcIAACgkQDQIrUxG+ ECCBGRAAtO1oS6GeUozlL/ZdCJpiV8y6ZgkvDdzqM+nDVXV0eFfbzCVR5DAPtIKi qRGna9PIAu/zbSCEOvHtIkzYuuj5JcJ3R09O6t923l7h3g/JGh1Z7A/c4PHlmQ8h aQNfUT/FLTN3WsM0bG5uphp+MBv2B6JJjhD7qhrgL9pm1AXNLGd/CEfbfp5a4w7v jYqxbKLs8zoGziyk1xYXppcbD6wmnBBoU8U6gufge1fmWSvhlW13mZNv2stwIRiw A/g+vHWdVgiHhq2okAvkRwCHTyZUFNj4/VCqicvOTezfALaV1KMBenwEXJohE0kL dTIQVheKlEnjc3FWcIDWMnWPNNyKph85Q5fv4jiuKdd87Y6wFP3ILkVbZTLaEkVx aFSJBinXa4dwELSQFTl3uI9vQt8sIIYCzWcUM2mCBJFiBVkt51VsxY/42hCD0cCz VBGsv3FLlyedCbWu16m+BUlNtVR1KX7vo7CIc74XqzRy0TEbfXM+1ZY+wsuuQyJX +sTGCwqmH1ccZ4HwL7H6P6Ux1mYbQZDRVt5VdQMcBHZi4JKgAr1VLE95t8Iefksq TGaUqdRnyd11dtnBdgOkaww5lNbP93KpnsDA8tnCqxyozrpZSXnw5tj7LWa9Dtg6 RH2vJGD5dGFeqvV66KsId5k5uSVeHqMC5BHvmtf6ikmiakzel+E= =BLg4 -----END PGP SIGNATURE----- --LpRjN50aGs9nR7wDkGN1wBsnJhxV4BX8k-- From owner-svn-src-head@freebsd.org Tue Jun 25 01:11:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7466A15B36EF; Tue, 25 Jun 2019 01:11:41 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.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 EB4F969D5E; Tue, 25 Jun 2019 01:11:40 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x5P1Bc0k046754; Mon, 24 Jun 2019 18:11:38 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x5P1Bc9I046753; Mon, 24 Jun 2019 18:11:38 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201906250111.x5P1Bc9I046753@gndrsh.dnsmgr.net> Subject: Re: svn commit: r349349 - in head/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa In-Reply-To: <9046989b-f45a-12a9-954f-799ade5b08a2@freebsd.org> To: Rebecca Cran Date: Mon, 24 Jun 2019 18:11:38 -0700 (PDT) CC: rgrimes@freebsd.org, 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-Rspamd-Queue-Id: EB4F969D5E X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 01:11:41 -0000 -- Start of PGP signed section. [ Charset UTF-8 unsupported, converting... ] > On 2019-06-24 18:45, Rodney W. Grimes wrote: > > > It sys accompanies, that means not a pointer to.... > > Hum oh my, what has happend to the disclaimer? > > Huh. It turns out the _latest_ version of that file just contains: > > /** @file > This file defines the EFI HTTP Protocol interface. It is split into > the following two main sections: > HTTP Service Binding Protocol (HTTPSB) > HTTP Protocol (HTTP) > > Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
> (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
> SPDX-License-Identifier: BSD-2-Clause-Patent > > @par Revision Reference: > This Protocol is introduced in UEFI Specification 2.5 > > **/ > > > I think I should update the copy in the tree with this version, which > makes more sense. Do you agree? If that is how the vendor is distributing it now, yes, that would be safer as the above removes the conflict between what the file says and what was done. Please note that -Patent has not been addressed by core@ to my knowledge, and that may or may not be an issue. I shringe when I see these clauses being blanket added to software though. > Rebecca Cran -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Tue Jun 25 01:51:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8613215B4409 for ; Tue, 25 Jun 2019 01:51:32 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 24C1F6ADC7 for ; Tue, 25 Jun 2019 01:51:32 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x730.google.com with SMTP id l128so11354079qke.2 for ; Mon, 24 Jun 2019 18:51:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OgSPO8SK7DQ2XMKh6EoaprmD8nOC94xfFVIxQIeCIIg=; b=HfxUH3VZy4sBQTfspmnYrgv458fASKMfl+DSP6gfUQz6KiEvuYN1iUZ+Zafde8hGux sDw5wizWScHWBYlygGxXNTauEqLaJJY7oC/obHxsH1OUoaqhiB/9fhlhu5q+aV/DLY6G 3j1SrLUAmTE2jedpeqXsUuxEGBeGuCZ6NqfIP+YY7wbyXwbvDEAcsQIdKFD5GDNh8EPt sDvStFuWqlo2nRnhjLriKpcQsJa1/D4uLdE1TmkP3MhTFvzubWWEnCvobw+gb/O0C5Fp qXlGb3ossOK+R/N9JD5BGWKbxo+Fk4QtdUmz9WALOsgL+REAU6wJY9jAD4YbcXtGWH/B icyQ== 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=OgSPO8SK7DQ2XMKh6EoaprmD8nOC94xfFVIxQIeCIIg=; b=hy4Du0fHOEOaaBxgjjEs1AwdAd0lKUGTxTL291umlHrJ/yXpbjHVyHp6RFwkP/E8Di dWaGFmKT7vcw3J6XABm18kMg1lCrcH96mGPLCmjJYG7SaIdV/cKmHOcNwgCWFls+Vyis FSFnAHvCkw5vTrwQ5cwd/xuFGJrZ1JBZsXhiMjZKmXpUBz/hQrA83KaiQ6rjx735SlxQ lmGC01BceV+lwSq080pG2Fwp4T+6EdW+IA/fpIMRMTsvIU77UGCUh2M7KTxXTDUa37mr 65R4XOOkVFa1yMrKfE16w0oxtBA3frfH78gwAGJftZP/rQ99z0hX79OdoKwr+D6zNLqD zWBQ== X-Gm-Message-State: APjAAAVvofIhYODr73qTqaw7q52y94GYqi5dzS1VnRRyRkz4jM+KOwIq X6TFtSPC0SjGEmpIvDbVVJ/cZpBn6KmtEWYO5BVgrPGCEys= X-Google-Smtp-Source: APXvYqwey3xGVcdttZM26xmned+Lr4GjyBVRKHVHa8HSWdNiKEX3zq2FyKN510RhFPR3M5UDete81oaBLCJ3fgfOT5Y= X-Received: by 2002:a37:83c4:: with SMTP id f187mr19331830qkd.380.1561427491267; Mon, 24 Jun 2019 18:51:31 -0700 (PDT) MIME-Version: 1.0 References: <9046989b-f45a-12a9-954f-799ade5b08a2@freebsd.org> <201906250111.x5P1Bc9I046753@gndrsh.dnsmgr.net> In-Reply-To: <201906250111.x5P1Bc9I046753@gndrsh.dnsmgr.net> From: Warner Losh Date: Mon, 24 Jun 2019 19:51:19 -0600 Message-ID: Subject: Re: svn commit: r349349 - in head/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa To: "Rodney W. Grimes" Cc: Rebecca Cran , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 24C1F6ADC7 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.992,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 01:51:32 -0000 Hey Rod, On Mon, Jun 24, 2019 at 7:11 PM Rodney W. Grimes wrote: > -- Start of PGP signed section. > [ Charset UTF-8 unsupported, converting... ] > > On 2019-06-24 18:45, Rodney W. Grimes wrote: > > > > > It sys accompanies, that means not a pointer to.... > > > Hum oh my, what has happend to the disclaimer? > > > > Huh. It turns out the _latest_ version of that file just contains: > > > > /** @file > > This file defines the EFI HTTP Protocol interface. It is split into > > the following two main sections: > > HTTP Service Binding Protocol (HTTPSB) > > HTTP Protocol (HTTP) > > > > Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
> > (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > @par Revision Reference: > > This Protocol is introduced in UEFI Specification 2.5 > > > > **/ > > > > > > I think I should update the copy in the tree with this version, which > > makes more sense. Do you agree? > Rebecca: I think it frankly doesn't matter. There's no need to go fetch a stone just to keep Rod happy. The version you committed is fine: it is a verbatim copy of the vendor source at some point in the past. I looked at and approved that license. This newer one, I'm less sure about, so please hold off on that. > If that is how the vendor is distributing it now, yes, that would > be safer as the above removes the conflict between what the file says > and what was done. > > Please note that -Patent has not been addressed by core@ to my > knowledge, and that may or may not be an issue. I shringe when > I see these clauses being blanket added to software though. > > Again with the scolding? Rebecca doesn't deserve this level of nit-picking. It is demotivating. She did a great job getting this code into the tree and you wag your finger at her for committing code verbatim from the vendor? It's totally not cool. Please stop this sort of nonsense. The rest of the project stopped this level of nit-picking back in the 90's when we all agreed it was counter productive. Warner From owner-svn-src-head@freebsd.org Tue Jun 25 02:35:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEEE215B8477; Tue, 25 Jun 2019 02:35: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 667E46C5C7; Tue, 25 Jun 2019 02:35:23 +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 3E90BA046; Tue, 25 Jun 2019 02:35:23 +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 x5P2ZNoL047081; Tue, 25 Jun 2019 02:35:23 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P2ZMgg047077; Tue, 25 Jun 2019 02:35:22 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201906250235.x5P2ZMgg047077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 25 Jun 2019 02:35:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349351 - in head: contrib/llvm/lib/Target/PowerPC contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch gnu/usr.bin/cc/cc_tools share/mk X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head: contrib/llvm/lib/Target/PowerPC contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch gnu/usr.bin/cc/cc_tools share/mk X-SVN-Commit-Revision: 349351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 667E46C5C7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 02:35:24 -0000 Author: jhibbits Date: Tue Jun 25 02:35:22 2019 New Revision: 349351 URL: https://svnweb.freebsd.org/changeset/base/349351 Log: powerpc: Transition to Secure-PLT, like most other OSs (Toolchain part) Summary: Toolchain follow-up to r349350. LLVM patches will be submitted upstream for 9.0 as well. The bsd.cpu.mk change is required because GNU ld assumes BSS-PLT if it cannot determine for certain that it needs Secure-PLT, and some binaries do not compile in such a way to make it know to use Secure-PLT. Reviewed By: nwhitehorn, bdragon, pfg Differential Revision: https://reviews.freebsd.org/D20598 Modified: head/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/PPC.cpp head/gnu/usr.bin/cc/cc_tools/Makefile.hdrs head/share/mk/bsd.cpu.mk Modified: head/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.cpp ============================================================================== --- head/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.cpp Tue Jun 25 00:40:44 2019 (r349350) +++ head/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.cpp Tue Jun 25 02:35:22 2019 (r349351) @@ -138,7 +138,8 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU if (isDarwin()) HasLazyResolverStubs = true; - if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD()) + if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) + || TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD()) SecurePlt = true; if (HasSPE && IsPPC64) Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/PPC.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/PPC.cpp Tue Jun 25 00:40:44 2019 (r349350) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/PPC.cpp Tue Jun 25 02:35:22 2019 (r349351) @@ -116,7 +116,8 @@ ppc::ReadGOTPtrMode ppc::getPPCReadGOTPtrMode(const Dr const ArgList &Args) { if (Args.getLastArg(options::OPT_msecure_plt)) return ppc::ReadGOTPtrMode::SecurePlt; - if (Triple.isOSOpenBSD()) + if ((Triple.isOSFreeBSD() && Triple.getOSMajorVersion() >= 13) || + Triple.isOSOpenBSD()) return ppc::ReadGOTPtrMode::SecurePlt; else return ppc::ReadGOTPtrMode::Bss; Modified: head/gnu/usr.bin/cc/cc_tools/Makefile.hdrs ============================================================================== --- head/gnu/usr.bin/cc/cc_tools/Makefile.hdrs Tue Jun 25 00:40:44 2019 (r349350) +++ head/gnu/usr.bin/cc/cc_tools/Makefile.hdrs Tue Jun 25 02:35:22 2019 (r349351) @@ -21,6 +21,9 @@ TARGET_INC+= ${GCC_CPU}/${GCC_CPU}.h TARGET_INC+= ${GCC_CPU}/unix.h TARGET_INC+= ${GCC_CPU}/att.h .endif +.if ${TARGET_CPUARCH} == "powerpc" +TARGET_INC+= ${GCC_CPU}/secureplt.h +.endif TARGET_INC+= dbxelf.h TARGET_INC+= elfos-undef.h TARGET_INC+= elfos.h Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Tue Jun 25 00:40:44 2019 (r349350) +++ head/share/mk/bsd.cpu.mk Tue Jun 25 02:35:22 2019 (r349351) @@ -369,6 +369,10 @@ CFLAGS += -mfloat-abi=softfp .endif .endif +.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe" +LDFLAGS+= -Wl,--secure-plt +.endif + .if ${MACHINE_ARCH} == "powerpcspe" CFLAGS += -mcpu=8548 -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double .endif From owner-svn-src-head@freebsd.org Tue Jun 25 04:50:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6D0715BC56B; Tue, 25 Jun 2019 04:50:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 85E667029D; Tue, 25 Jun 2019 04:50:20 +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 5A135B656; Tue, 25 Jun 2019 04:50: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 x5P4oKmF015994; Tue, 25 Jun 2019 04:50:20 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P4o9oR015946; Tue, 25 Jun 2019 04:50:09 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906250450.x5P4o9oR015946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Jun 2019 04:50:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349352 - in head: etc/mtree include lib lib/libnandfs sbin sbin/camcontrol sbin/nandfs sbin/newfs_nandfs share/man/man4 share/man/man5 share/mk stand stand/arm/uboot stand/common stand... X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: etc/mtree include lib lib/libnandfs sbin sbin/camcontrol sbin/nandfs sbin/newfs_nandfs share/man/man4 share/man/man5 share/mk stand stand/arm/uboot stand/common stand/i386/loader stand/libsa ... X-SVN-Commit-Revision: 349352 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 85E667029D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 04:50:21 -0000 Author: imp Date: Tue Jun 25 04:50:09 2019 New Revision: 349352 URL: https://svnweb.freebsd.org/changeset/base/349352 Log: Remove NAND and NANDFS support NANDFS has been broken for years. Remove it. The NAND drivers that remain are for ancient parts that are no longer relevant. They are polled, have terrible performance and just for ancient arm hardware. NAND parts have evolved significantly from this early work and little to none of it would be relevant should someone need to update to support raw nand. This code has been off by default for years and has violated the vnode protocol leading to panics since it was committed. Numerous posts to arch@ and other locations have found no actual users for this software. Relnotes: Yes No Objection From: arch@ Differential Revision: https://reviews.freebsd.org/D20745 Deleted: head/lib/libnandfs/Makefile head/lib/libnandfs/Makefile.depend head/lib/libnandfs/libnandfs.h head/lib/libnandfs/nandfs.c head/sbin/nandfs/Makefile head/sbin/nandfs/Makefile.depend head/sbin/nandfs/lssnap.c head/sbin/nandfs/mksnap.c head/sbin/nandfs/nandfs.8 head/sbin/nandfs/nandfs.c head/sbin/nandfs/nandfs.h head/sbin/nandfs/rmsnap.c head/sbin/newfs_nandfs/Makefile head/sbin/newfs_nandfs/Makefile.depend head/sbin/newfs_nandfs/newfs_nandfs.8 head/sbin/newfs_nandfs/newfs_nandfs.c head/share/man/man4/nand.4 head/share/man/man4/nandsim.4 head/share/man/man5/nandfs.5 head/stand/libsa/nandfs.c head/sys/arm/freescale/vybrid/vf_nfc.c head/sys/dev/nand/nand.c head/sys/dev/nand/nand.h head/sys/dev/nand/nand_bbt.c head/sys/dev/nand/nand_cdev.c head/sys/dev/nand/nand_dev.h head/sys/dev/nand/nand_ecc_pos.h head/sys/dev/nand/nand_generic.c head/sys/dev/nand/nand_geom.c head/sys/dev/nand/nand_id.c head/sys/dev/nand/nand_if.m head/sys/dev/nand/nandbus.c head/sys/dev/nand/nandbus.h head/sys/dev/nand/nandbus_if.m head/sys/dev/nand/nandsim.c head/sys/dev/nand/nandsim.h head/sys/dev/nand/nandsim_chip.c head/sys/dev/nand/nandsim_chip.h head/sys/dev/nand/nandsim_ctrl.c head/sys/dev/nand/nandsim_log.c head/sys/dev/nand/nandsim_log.h head/sys/dev/nand/nandsim_swap.c head/sys/dev/nand/nandsim_swap.h head/sys/dev/nand/nfc_fsl.c head/sys/dev/nand/nfc_fsl.h head/sys/dev/nand/nfc_if.m head/sys/dev/nand/nfc_mv.c head/sys/dev/nand/nfc_rb.c head/sys/fs/nandfs/bmap.c head/sys/fs/nandfs/bmap.h head/sys/fs/nandfs/nandfs.h head/sys/fs/nandfs/nandfs_alloc.c head/sys/fs/nandfs/nandfs_bmap.c head/sys/fs/nandfs/nandfs_buffer.c head/sys/fs/nandfs/nandfs_cleaner.c head/sys/fs/nandfs/nandfs_cpfile.c head/sys/fs/nandfs/nandfs_dat.c head/sys/fs/nandfs/nandfs_dir.c head/sys/fs/nandfs/nandfs_fs.h head/sys/fs/nandfs/nandfs_ifile.c head/sys/fs/nandfs/nandfs_mount.h head/sys/fs/nandfs/nandfs_segment.c head/sys/fs/nandfs/nandfs_subr.c head/sys/fs/nandfs/nandfs_subr.h head/sys/fs/nandfs/nandfs_sufile.c head/sys/fs/nandfs/nandfs_vfsops.c head/sys/fs/nandfs/nandfs_vnops.c head/sys/modules/nand/Makefile head/sys/modules/nandfs/Makefile head/sys/modules/nandsim/Makefile head/usr.sbin/bhyve/audio.c head/usr.sbin/bhyve/audio.h head/usr.sbin/bhyve/hda_codec.c head/usr.sbin/bhyve/hda_reg.h head/usr.sbin/bhyve/hdac_reg.h head/usr.sbin/bhyve/pci_hda.c head/usr.sbin/bhyve/pci_hda.h head/usr.sbin/nandsim/Makefile head/usr.sbin/nandsim/Makefile.depend head/usr.sbin/nandsim/nandsim.8 head/usr.sbin/nandsim/nandsim.c head/usr.sbin/nandsim/nandsim_cfgparse.c head/usr.sbin/nandsim/nandsim_cfgparse.h head/usr.sbin/nandsim/nandsim_rcfile.c head/usr.sbin/nandsim/nandsim_rcfile.h head/usr.sbin/nandsim/sample.conf head/usr.sbin/nandtool/Makefile head/usr.sbin/nandtool/Makefile.depend head/usr.sbin/nandtool/nand_erase.c head/usr.sbin/nandtool/nand_info.c head/usr.sbin/nandtool/nand_read.c head/usr.sbin/nandtool/nand_readoob.c head/usr.sbin/nandtool/nand_write.c head/usr.sbin/nandtool/nand_writeoob.c head/usr.sbin/nandtool/nandtool.8 head/usr.sbin/nandtool/nandtool.c head/usr.sbin/nandtool/nandtool.h head/usr.sbin/nandtool/usage.h Modified: head/etc/mtree/BSD.include.dist head/include/Makefile head/lib/Makefile head/sbin/Makefile head/sbin/camcontrol/camcontrol.c head/share/man/man4/Makefile head/share/man/man5/Makefile head/share/mk/bsd.libnames.mk head/share/mk/src.libnames.mk head/share/mk/src.opts.mk head/stand/arm/uboot/conf.c head/stand/arm/uboot/version head/stand/common/part.c head/stand/common/part.h head/stand/i386/loader/conf.c head/stand/libsa/Makefile head/stand/libsa/stand.h head/stand/loader.mk head/stand/mips/uboot/conf.c head/stand/mips/uboot/version head/sys/arm/conf/DB-78XXX head/sys/arm/conf/DB-88F6XXX head/sys/arm/conf/DREAMPLUG-1001 head/sys/arm/conf/NOTES.armv5 head/sys/arm/conf/SHEEVAPLUG head/sys/arm/conf/VYBRID head/sys/arm/mv/files.arm7 head/sys/arm/mv/files.mv head/sys/cam/ata/ata_all.c head/sys/cam/ata/ata_all.h head/sys/cam/ata/ata_xpt.c head/sys/cam/scsi/scsi_da.c head/sys/conf/files head/sys/conf/files.powerpc head/sys/conf/kern.opts.mk head/sys/fs/smbfs/smbfs_io.c head/sys/geom/geom_flashmap.c head/sys/modules/Makefile head/sys/sys/param.h head/targets/pseudo/userland/Makefile.depend head/targets/pseudo/userland/lib/Makefile.depend head/usr.bin/vtfontcvt/vtfontcvt.c head/usr.sbin/Makefile head/usr.sbin/bhyve/Makefile head/usr.sbin/bhyve/bhyve.8 Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Tue Jun 25 02:35:22 2019 (r349351) +++ head/etc/mtree/BSD.include.dist Tue Jun 25 04:50:09 2019 (r349352) @@ -138,8 +138,6 @@ mpilib .. .. - nand - .. nvme .. ofw @@ -183,8 +181,6 @@ fdescfs .. msdosfs - .. - nandfs .. nfs .. Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Tue Jun 25 02:35:22 2019 (r349351) +++ head/include/Makefile Tue Jun 25 04:50:09 2019 (r349352) @@ -48,7 +48,7 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd dev/wi \ - fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ + fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ fs/procfs fs/smbfs fs/udf fs/unionfs \ geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ geom/mirror geom/mountver geom/multipath geom/nop \ @@ -158,7 +158,7 @@ copies: .PHONY .META done; \ fi .endfor -.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/hyperv:Ndev/nand:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} +.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} cd ${SRCTOP}/sys; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${SDESTDIR}${INCLUDEDIR}/$i @@ -174,13 +174,6 @@ copies: .PHONY .META cd ${SRCTOP}/sys/dev/bktr; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \ ${SDESTDIR}${INCLUDEDIR}/dev/bktr -.if ${MK_NAND} != "no" - cd ${SRCTOP}/sys/dev/nand; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/nand; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/nand -.endif cd ${SRCTOP}/sys/dev/evdev; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 input.h \ ${SDESTDIR}${INCLUDEDIR}/dev/evdev; \ @@ -268,7 +261,7 @@ symlinks: .PHONY .META ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ done .endfor -.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/hyperv:Ndev/nand:Ndev/pci:Ndev/veriexec} +.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/hyperv:Ndev/pci:Ndev/veriexec} cd ${SRCTOP}/sys/$i; \ for h in *.h; do \ ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ @@ -289,13 +282,6 @@ symlinks: .PHONY .META ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/bktr/$$h \ ${SDESTDIR}${INCLUDEDIR}/dev/bktr; \ done -.if ${MK_NAND} != "no" - cd ${SRCTOP}/sys/dev/nand; \ - for h in nandsim.h nand_dev.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/nand/$$h \ - ${SDESTDIR}${INCLUDEDIR}/dev/nand; \ - done -.endif cd ${SRCTOP}/sys/dev/evdev; \ for h in input.h input-event-codes.h uinput.h; do \ ln -fs ../../../../sys/dev/evdev/$$h \ Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Tue Jun 25 02:35:22 2019 (r349351) +++ head/lib/Makefile Tue Jun 25 04:50:09 2019 (r349352) @@ -174,7 +174,6 @@ SUBDIR.${MK_GOOGLETEST}+= googletest SUBDIR.${MK_LIBTHR}+= libthr SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_eh SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_s -SUBDIR.${MK_NAND}+= libnandfs SUBDIR.${MK_NETGRAPH}+= libnetgraph SUBDIR.${MK_NIS}+= libypclnt Modified: head/sbin/Makefile ============================================================================== --- head/sbin/Makefile Tue Jun 25 02:35:22 2019 (r349351) +++ head/sbin/Makefile Tue Jun 25 04:50:09 2019 (r349352) @@ -79,8 +79,6 @@ SUBDIR.${MK_IPFILTER}+= ipf SUBDIR.${MK_IPFW}+= ipfw SUBDIR.${MK_IPFW}+= natd SUBDIR.${MK_ISCSI}+= iscontrol -SUBDIR.${MK_NAND}+= nandfs -SUBDIR.${MK_NAND}+= newfs_nandfs SUBDIR.${MK_NVME}+= nvmecontrol SUBDIR.${MK_OPENSSL}+= decryptcore SUBDIR.${MK_PF}+= pfctl Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Tue Jun 25 02:35:22 2019 (r349351) +++ head/sbin/camcontrol/camcontrol.c Tue Jun 25 04:50:09 2019 (r349352) @@ -2326,11 +2326,9 @@ ata_do_identify(struct cam_device *device, int retry_c } } - ident_buf = (struct ata_params *)ptr; - ata_param_fixup(ident_buf); - error = 1; for (i = 0; i < sizeof(struct ata_params) / 2; i++) { + ptr[i] = le16toh(ptr[i]); if (ptr[i] != 0) error = 0; } @@ -2347,6 +2345,26 @@ ata_do_identify(struct cam_device *device, int retry_c free(ptr); return (error); } + + ident_buf = (struct ata_params *)ptr; + if (strncmp(ident_buf->model, "FX", 2) && + strncmp(ident_buf->model, "NEC", 3) && + strncmp(ident_buf->model, "Pioneer", 7) && + strncmp(ident_buf->model, "SHARP", 5)) { + ata_bswap(ident_buf->model, sizeof(ident_buf->model)); + ata_bswap(ident_buf->revision, sizeof(ident_buf->revision)); + ata_bswap(ident_buf->serial, sizeof(ident_buf->serial)); + ata_bswap(ident_buf->media_serial, sizeof(ident_buf->media_serial)); + } + ata_btrim(ident_buf->model, sizeof(ident_buf->model)); + ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model)); + ata_btrim(ident_buf->revision, sizeof(ident_buf->revision)); + ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision)); + ata_btrim(ident_buf->serial, sizeof(ident_buf->serial)); + ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial)); + ata_btrim(ident_buf->media_serial, sizeof(ident_buf->media_serial)); + ata_bpack(ident_buf->media_serial, ident_buf->media_serial, + sizeof(ident_buf->media_serial)); *ident_bufp = ident_buf; Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Tue Jun 25 02:35:22 2019 (r349351) +++ head/share/man/man4/Makefile Tue Jun 25 04:50:09 2019 (r349352) @@ -303,8 +303,6 @@ MAN= aac.4 \ mx25l.4 \ mxge.4 \ my.4 \ - nand.4 \ - nandsim.4 \ ${_ndis.4} \ net80211.4 \ netdump.4 \ Modified: head/share/man/man5/Makefile ============================================================================== --- head/share/man/man5/Makefile Tue Jun 25 02:35:22 2019 (r349351) +++ head/share/man/man5/Makefile Tue Jun 25 04:50:09 2019 (r349352) @@ -101,10 +101,6 @@ MAN+= freebsd-update.conf.5 MAN+= hesiod.conf.5 .endif -.if ${MK_NAND} != "no" -MAN+= nandfs.5 -.endif - .if ${MK_PF} != "no" MAN+= pf.conf.5 \ pf.os.5 Modified: head/share/mk/bsd.libnames.mk ============================================================================== --- head/share/mk/bsd.libnames.mk Tue Jun 25 02:35:22 2019 (r349351) +++ head/share/mk/bsd.libnames.mk Tue Jun 25 04:50:09 2019 (r349352) @@ -104,7 +104,6 @@ LIBMLX4?= ${LIBDESTDIR}${LIBDIR_BASE}/libmlx4.a LIBMLX5?= ${LIBDESTDIR}${LIBDIR_BASE}/libmlx5.a LIBMP?= ${LIBDESTDIR}${LIBDIR_BASE}/libmp.a LIBMT?= ${LIBDESTDIR}${LIBDIR_BASE}/libmt.a -LIBNANDFS?= ${LIBDESTDIR}${LIBDIR_BASE}/libnandfs.a LIBNCURSES?= ${LIBDESTDIR}${LIBDIR_BASE}/libncurses.a LIBNCURSESW?= ${LIBDESTDIR}${LIBDIR_BASE}/libncursesw.a LIBNETGRAPH?= ${LIBDESTDIR}${LIBDIR_BASE}/libnetgraph.a Modified: head/share/mk/src.libnames.mk ============================================================================== --- head/share/mk/src.libnames.mk Tue Jun 25 02:35:22 2019 (r349351) +++ head/share/mk/src.libnames.mk Tue Jun 25 04:50:09 2019 (r349352) @@ -135,7 +135,6 @@ _LIBRARIES= \ memstat \ mp \ mt \ - nandfs \ ncurses \ ncursesw \ netgraph \ Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Tue Jun 25 02:35:22 2019 (r349351) +++ head/share/mk/src.opts.mk Tue Jun 25 04:50:09 2019 (r349352) @@ -206,7 +206,6 @@ __DEFAULT_NO_OPTIONS = \ LOADER_FORCE_LE \ LOADER_VERBOSE \ LOADER_VERIEXEC_PASS_MANIFEST \ - NAND \ OFED_EXTRA \ OPENLDAP \ RPCBIND_WARMSTART_SUPPORT \ Modified: head/stand/arm/uboot/conf.c ============================================================================== --- head/stand/arm/uboot/conf.c Tue Jun 25 02:35:22 2019 (r349351) +++ head/stand/arm/uboot/conf.c Tue Jun 25 04:50:09 2019 (r349352) @@ -59,9 +59,6 @@ struct fs_ops *file_system[] = { #if defined(LOADER_EXT2FS_SUPPORT) &ext2fs_fsops, #endif -#if defined(LOADER_NANDFS_SUPPORT) - &nandfs_fsops, -#endif #if defined(LOADER_NFS_SUPPORT) &nfs_fsops, #endif Modified: head/stand/arm/uboot/version ============================================================================== --- head/stand/arm/uboot/version Tue Jun 25 02:35:22 2019 (r349351) +++ head/stand/arm/uboot/version Tue Jun 25 04:50:09 2019 (r349352) @@ -3,6 +3,7 @@ $FreeBSD$ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this file is important. Make sure the current version number is on line 6. +1.3: Remove NAND FS support. 1.2: Extended with NAND FS support. 1.1: Flattened Device Tree blob support. 1.0: Added storage support. Booting from HDD, USB, etc. is now possible. Modified: head/stand/common/part.c ============================================================================== --- head/stand/common/part.c Tue Jun 25 02:35:22 2019 (r349351) +++ head/stand/common/part.c Tue Jun 25 04:50:09 2019 (r349352) @@ -57,7 +57,6 @@ static const uuid_t gpt_uuid_freebsd_ufs = GPT_ENT_TYP static const uuid_t gpt_uuid_efi = GPT_ENT_TYPE_EFI; static const uuid_t gpt_uuid_freebsd = GPT_ENT_TYPE_FREEBSD; static const uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; -static const uuid_t gpt_uuid_freebsd_nandfs = GPT_ENT_TYPE_FREEBSD_NANDFS; static const uuid_t gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP; static const uuid_t gpt_uuid_freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS; static const uuid_t gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM; @@ -91,7 +90,6 @@ static struct parttypes { { PART_EFI, "EFI" }, { PART_FREEBSD, "FreeBSD" }, { PART_FREEBSD_BOOT, "FreeBSD boot" }, - { PART_FREEBSD_NANDFS, "FreeBSD nandfs" }, { PART_FREEBSD_UFS, "FreeBSD UFS" }, { PART_FREEBSD_ZFS, "FreeBSD ZFS" }, { PART_FREEBSD_SWAP, "FreeBSD swap" }, @@ -141,8 +139,6 @@ gpt_parttype(uuid_t type) return (PART_FREEBSD_SWAP); else if (uuid_equal(&type, &gpt_uuid_freebsd_vinum, NULL)) return (PART_FREEBSD_VINUM); - else if (uuid_equal(&type, &gpt_uuid_freebsd_nandfs, NULL)) - return (PART_FREEBSD_NANDFS); else if (uuid_equal(&type, &gpt_uuid_freebsd, NULL)) return (PART_FREEBSD); return (PART_UNKNOWN); @@ -445,8 +441,6 @@ bsd_parttype(uint8_t type) { switch (type) { - case FS_NANDFS: - return (PART_FREEBSD_NANDFS); case FS_SWAP: return (PART_FREEBSD_SWAP); case FS_BSDFFS: @@ -527,8 +521,6 @@ vtoc8_parttype(uint16_t type) { switch (type) { - case VTOC_TAG_FREEBSD_NANDFS: - return (PART_FREEBSD_NANDFS); case VTOC_TAG_FREEBSD_SWAP: return (PART_FREEBSD_SWAP); case VTOC_TAG_FREEBSD_UFS: Modified: head/stand/common/part.h ============================================================================== --- head/stand/common/part.h Tue Jun 25 02:35:22 2019 (r349351) +++ head/stand/common/part.h Tue Jun 25 04:50:09 2019 (r349352) @@ -45,7 +45,6 @@ enum partition_type { PART_EFI, PART_FREEBSD, PART_FREEBSD_BOOT, - PART_FREEBSD_NANDFS, PART_FREEBSD_UFS, PART_FREEBSD_ZFS, PART_FREEBSD_SWAP, Modified: head/stand/i386/loader/conf.c ============================================================================== --- head/stand/i386/loader/conf.c Tue Jun 25 02:35:22 2019 (r349351) +++ head/stand/i386/loader/conf.c Tue Jun 25 04:50:09 2019 (r349352) @@ -84,9 +84,6 @@ struct fs_ops *file_system[] = { #if defined(LOADER_CD9660_SUPPORT) &cd9660_fsops, #endif -#if defined(LOADER_NANDFS_SUPPORT) - &nandfs_fsops, -#endif #ifdef LOADER_NFS_SUPPORT &nfs_fsops, #endif Modified: head/stand/libsa/Makefile ============================================================================== --- head/stand/libsa/Makefile Tue Jun 25 02:35:22 2019 (r349351) +++ head/stand/libsa/Makefile Tue Jun 25 04:50:09 2019 (r349352) @@ -145,9 +145,6 @@ SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c SRCS+= dosfs.c ext2fs.c SRCS+= splitfs.c SRCS+= pkgfs.c -.if ${MK_NAND} != "no" -SRCS+= nandfs.c -.endif # kernel ufs support .PATH: ${SRCTOP}/sys/ufs/ffs Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Tue Jun 25 02:35:22 2019 (r349351) +++ head/stand/libsa/stand.h Tue Jun 25 04:50:09 2019 (r349352) @@ -119,7 +119,6 @@ extern struct fs_ops ufs_fsops; extern struct fs_ops tftp_fsops; extern struct fs_ops nfs_fsops; extern struct fs_ops cd9660_fsops; -extern struct fs_ops nandfs_fsops; extern struct fs_ops gzipfs_fsops; extern struct fs_ops bzipfs_fsops; extern struct fs_ops dosfs_fsops; Modified: head/stand/loader.mk ============================================================================== --- head/stand/loader.mk Tue Jun 25 02:35:22 2019 (r349351) +++ head/stand/loader.mk Tue Jun 25 04:50:09 2019 (r349352) @@ -99,9 +99,6 @@ CFLAGS+= -DLOADER_EXT2FS_SUPPORT .if ${LOADER_MSDOS_SUPPORT:Uno} == "yes" CFLAGS+= -DLOADER_MSDOS_SUPPORT .endif -.if ${LOADER_NANDFS_SUPPORT:U${MK_NAND}} == "yes" -CFLAGS+= -DLOADER_NANDFS_SUPPORT -.endif .if ${LOADER_UFS_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_UFS_SUPPORT .endif Modified: head/stand/mips/uboot/conf.c ============================================================================== --- head/stand/mips/uboot/conf.c Tue Jun 25 02:35:22 2019 (r349351) +++ head/stand/mips/uboot/conf.c Tue Jun 25 04:50:09 2019 (r349352) @@ -62,9 +62,6 @@ struct fs_ops *file_system[] = { #if defined(LOADER_EXT2FS_SUPPORT) &ext2fs_fsops, #endif -#if defined(LOADER_NANDFS_SUPPORT) - &nandfs_fsops, -#endif #if defined(LOADER_NFS_SUPPORT) &nfs_fsops, #endif Modified: head/stand/mips/uboot/version ============================================================================== --- head/stand/mips/uboot/version Tue Jun 25 02:35:22 2019 (r349351) +++ head/stand/mips/uboot/version Tue Jun 25 04:50:09 2019 (r349352) @@ -3,6 +3,7 @@ $FreeBSD$ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this file is important. Make sure the current version number is on line 6. +1.3: Remove NAND FS support. 1.2: Extended with NAND FS support. 1.1: Flattened Device Tree blob support. 1.0: Added storage support. Booting from HDD, USB, etc. is now possible. Modified: head/sys/arm/conf/DB-78XXX ============================================================================== --- head/sys/arm/conf/DB-78XXX Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/arm/conf/DB-78XXX Tue Jun 25 04:50:09 2019 (r349352) @@ -74,9 +74,6 @@ device ds133x # SATA device mvs -# NAND -device nand - # GPIO device gpio Modified: head/sys/arm/conf/DB-88F6XXX ============================================================================== --- head/sys/arm/conf/DB-88F6XXX Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/arm/conf/DB-88F6XXX Tue Jun 25 04:50:09 2019 (r349352) @@ -78,9 +78,6 @@ device twsi # SATA device mvs -# NAND -device nand - # GPIO device gpio Modified: head/sys/arm/conf/DREAMPLUG-1001 ============================================================================== --- head/sys/arm/conf/DREAMPLUG-1001 Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/arm/conf/DREAMPLUG-1001 Tue Jun 25 04:50:09 2019 (r349352) @@ -157,14 +157,6 @@ options ALTQ_PRIQ # Priority Queueing options ALTQ_NOPCC # Required if the TSC is unusable #options ALTQ_DEBUG -# To use this configuration with the (rare) model 1001N (nand flash), -# create a kernel config file that looks like this: -# -# include DREAMPLUG-1001 -# nomakeoptions FDT_DTS_FILE -# makeoptions FDT_DTS_FILE=dreamplug-1001N.dts -# device nand - # Flattened Device Tree options FDT # Configure using FDT/DTB data options FDT_DTB_STATIC Modified: head/sys/arm/conf/NOTES.armv5 ============================================================================== --- head/sys/arm/conf/NOTES.armv5 Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/arm/conf/NOTES.armv5 Tue Jun 25 04:50:09 2019 (r349352) @@ -31,8 +31,3 @@ options ARM_MANY_BOARD options SOC_MV_DISCOVERY options SOC_MV_KIRKWOOD options SOC_MV_ORION - -# Add devices which are specific to various arm platforms... - -device nand - Modified: head/sys/arm/conf/SHEEVAPLUG ============================================================================== --- head/sys/arm/conf/SHEEVAPLUG Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/arm/conf/SHEEVAPLUG Tue Jun 25 04:50:09 2019 (r349352) @@ -72,9 +72,6 @@ device scbus device pass device da -# NAND -device nand - # GPIO device gpio Modified: head/sys/arm/conf/VYBRID ============================================================================== --- head/sys/arm/conf/VYBRID Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/arm/conf/VYBRID Tue Jun 25 04:50:09 2019 (r349352) @@ -37,7 +37,6 @@ options PLATFORM # Platform based SoC #options BOOTP_WIRED_TO=ffec0 #options ROOTDEVNAME=\"nfs:10.5.0.1:/tftpboot/cosmic\" -#options ROOTDEVNAME=\"nandfs:/dev/gnand0s.root\" options ROOTDEVNAME=\"ufs:/dev/da0\" options MUTEX_NOINLINE @@ -79,8 +78,6 @@ device pass #device ata #device atadisk #device mvs - -device nand # Serial ports device uart Modified: head/sys/arm/mv/files.arm7 ============================================================================== --- head/sys/arm/mv/files.arm7 Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/arm/mv/files.arm7 Tue Jun 25 04:50:09 2019 (r349352) @@ -29,7 +29,6 @@ dev/iicbus/twsi/mv_twsi.c optional twsi dev/mge/if_mge.c optional mge dev/neta/if_mvneta_fdt.c optional neta fdt dev/neta/if_mvneta.c optional neta mdio mii -dev/nand/nfc_mv.c optional nand dev/mvs/mvs_soc.c optional mvs dev/uart/uart_dev_ns8250.c optional uart dev/uart/uart_dev_snps.c optional uart Modified: head/sys/arm/mv/files.mv ============================================================================== --- head/sys/arm/mv/files.mv Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/arm/mv/files.mv Tue Jun 25 04:50:09 2019 (r349352) @@ -26,7 +26,6 @@ dev/iicbus/twsi/mv_twsi.c optional twsi dev/mge/if_mge.c optional mge dev/neta/if_mvneta_fdt.c optional neta fdt dev/neta/if_mvneta.c optional neta mdio mii -dev/nand/nfc_mv.c optional nand dev/mvs/mvs_soc.c optional mvs dev/uart/uart_dev_ns8250.c optional uart dev/uart/uart_dev_snps.c optional uart Modified: head/sys/cam/ata/ata_all.c ============================================================================== --- head/sys/cam/ata/ata_all.c Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/cam/ata/ata_all.c Tue Jun 25 04:50:09 2019 (r349352) @@ -1238,28 +1238,3 @@ ata_zac_mgmt_in(struct ccb_ataio *ataio, uint32_t retr ataio->aux = auxiliary; } } - -void -ata_param_fixup(struct ata_params *ident_buf) -{ - int16_t *ptr; - - for (ptr = (int16_t *)ident_buf; - ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) { - *ptr = le16toh(*ptr); - } - if (strncmp(ident_buf->model, "FX", 2) && - strncmp(ident_buf->model, "NEC", 3) && - strncmp(ident_buf->model, "Pioneer", 7) && - strncmp(ident_buf->model, "SHARP", 5)) { - ata_bswap(ident_buf->model, sizeof(ident_buf->model)); - ata_bswap(ident_buf->revision, sizeof(ident_buf->revision)); - ata_bswap(ident_buf->serial, sizeof(ident_buf->serial)); - } - ata_btrim(ident_buf->model, sizeof(ident_buf->model)); - ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model)); - ata_btrim(ident_buf->revision, sizeof(ident_buf->revision)); - ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision)); - ata_btrim(ident_buf->serial, sizeof(ident_buf->serial)); - ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial)); -} Modified: head/sys/cam/ata/ata_all.h ============================================================================== --- head/sys/cam/ata/ata_all.h Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/cam/ata/ata_all.h Tue Jun 25 04:50:09 2019 (r349352) @@ -135,7 +135,6 @@ void ata_read_log(struct ccb_ataio *ataio, uint32_t re uint16_t block_count, uint32_t protocol, uint8_t *data_ptr, uint32_t dxfer_len, uint32_t timeout); -void ata_param_fixup(struct ata_params *ident_buf); void ata_bswap(int8_t *buf, int len); void ata_btrim(int8_t *buf, int len); void ata_bpack(int8_t *src, int8_t *dst, int len); Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/cam/ata/ata_xpt.c Tue Jun 25 04:50:09 2019 (r349352) @@ -893,13 +893,14 @@ noerror: case PROBE_IDENTIFY: { struct ccb_pathinq cpi; + int16_t *ptr; int veto = 0; - /* - * Convert to host byte order, and fix the strings. - */ ident_buf = &softc->ident_data; - ata_param_fixup(ident_buf); + for (ptr = (int16_t *)ident_buf; + ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) { + *ptr = le16toh(*ptr); + } /* * Allow others to veto this ATA disk attachment. This @@ -911,6 +912,20 @@ noerror: goto device_fail; } + if (strncmp(ident_buf->model, "FX", 2) && + strncmp(ident_buf->model, "NEC", 3) && + strncmp(ident_buf->model, "Pioneer", 7) && + strncmp(ident_buf->model, "SHARP", 5)) { + ata_bswap(ident_buf->model, sizeof(ident_buf->model)); + ata_bswap(ident_buf->revision, sizeof(ident_buf->revision)); + ata_bswap(ident_buf->serial, sizeof(ident_buf->serial)); + } + ata_btrim(ident_buf->model, sizeof(ident_buf->model)); + ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model)); + ata_btrim(ident_buf->revision, sizeof(ident_buf->revision)); + ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision)); + ata_btrim(ident_buf->serial, sizeof(ident_buf->serial)); + ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial)); /* Device may need spin-up before IDENTIFY become valid. */ if ((ident_buf->specconf == 0x37c8 || ident_buf->specconf == 0x738c) && Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/cam/scsi/scsi_da.c Tue Jun 25 04:50:09 2019 (r349352) @@ -64,9 +64,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef _KERNEL -#include -#endif /* _KERNEL */ #include #include @@ -3616,8 +3613,16 @@ out: break; } - ata_params = &periph->path->device->ident_data; + ata_params = (struct ata_params*) + malloc(sizeof(*ata_params), M_SCSIDA,M_NOWAIT|M_ZERO); + if (ata_params == NULL) { + xpt_print(periph->path, "Couldn't malloc ata_params " + "data\n"); + /* da_free_periph??? */ + break; + } + scsi_ata_identify(&start_ccb->csio, /*retries*/da_retry_count, /*cbfcnp*/dadone_probeata, @@ -5187,7 +5192,7 @@ dadone_probeata(struct cam_periph *periph, union ccb * struct da_softc *softc; u_int32_t priority; int continue_probe; - int error; + int error, i; int16_t *ptr; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dadone_probeata\n")); @@ -5205,7 +5210,8 @@ dadone_probeata(struct cam_periph *periph, union ccb * if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { uint16_t old_rate; - ata_param_fixup(ata_params); + for (i = 0; i < sizeof(*ata_params) / 2; i++) + ptr[i] = le16toh(ptr[i]); if (ata_params->support_dsm & ATA_SUPPORT_DSM_TRIM && (softc->quirks & DA_Q_NO_UNMAP) == 0) { dadeleteflag(softc, DA_DELETE_ATA_TRIM, 1); @@ -5289,6 +5295,7 @@ dadone_probeata(struct cam_periph *periph, union ccb * } } + free(ata_params, M_SCSIDA); if ((softc->zone_mode == DA_ZONE_HOST_AWARE) || (softc->zone_mode == DA_ZONE_HOST_MANAGED)) { /* Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/conf/files Tue Jun 25 04:50:09 2019 (r349352) @@ -1708,7 +1708,7 @@ dev/fdt/fdt_clock_if.m optional fdt fdt_clock dev/fdt/fdt_common.c optional fdt dev/fdt/fdt_pinctrl.c optional fdt fdt_pinctrl dev/fdt/fdt_pinctrl_if.m optional fdt fdt_pinctrl -dev/fdt/fdt_slicer.c optional fdt cfi | fdt nand | fdt mx25l | fdt n25q | fdt at45d +dev/fdt/fdt_slicer.c optional fdt cfi | fdt mx25l | fdt n25q | fdt at45d dev/fdt/fdt_static_dtb.S optional fdt fdt_dtb_static \ dependency "${FDT_DTS_FILE:T:R}.dtb" dev/fdt/simplebus.c optional fdt @@ -2457,21 +2457,6 @@ dev/mxge/mxge_ethp_z8e.c optional mxge pci dev/mxge/mxge_rss_eth_z8e.c optional mxge pci dev/mxge/mxge_rss_ethp_z8e.c optional mxge pci dev/my/if_my.c optional my -dev/nand/nand.c optional nand -dev/nand/nand_bbt.c optional nand -dev/nand/nand_cdev.c optional nand -dev/nand/nand_generic.c optional nand -dev/nand/nand_geom.c optional nand -dev/nand/nand_id.c optional nand -dev/nand/nandbus.c optional nand -dev/nand/nandbus_if.m optional nand -dev/nand/nand_if.m optional nand -dev/nand/nandsim.c optional nandsim nand -dev/nand/nandsim_chip.c optional nandsim nand -dev/nand/nandsim_ctrl.c optional nandsim nand -dev/nand/nandsim_log.c optional nandsim nand -dev/nand/nandsim_swap.c optional nandsim nand -dev/nand/nfc_if.m optional nand dev/netmap/if_ptnet.c optional netmap inet dev/netmap/netmap.c optional netmap dev/netmap/netmap_bdg.c optional netmap @@ -3499,20 +3484,6 @@ fs/msdosfs/msdosfs_iconv.c optional msdosfs_iconv fs/msdosfs/msdosfs_lookup.c optional msdosfs fs/msdosfs/msdosfs_vfsops.c optional msdosfs fs/msdosfs/msdosfs_vnops.c optional msdosfs -fs/nandfs/bmap.c optional nandfs -fs/nandfs/nandfs_alloc.c optional nandfs -fs/nandfs/nandfs_bmap.c optional nandfs -fs/nandfs/nandfs_buffer.c optional nandfs -fs/nandfs/nandfs_cleaner.c optional nandfs -fs/nandfs/nandfs_cpfile.c optional nandfs -fs/nandfs/nandfs_dat.c optional nandfs -fs/nandfs/nandfs_dir.c optional nandfs -fs/nandfs/nandfs_ifile.c optional nandfs -fs/nandfs/nandfs_segment.c optional nandfs -fs/nandfs/nandfs_subr.c optional nandfs -fs/nandfs/nandfs_sufile.c optional nandfs -fs/nandfs/nandfs_vfsops.c optional nandfs -fs/nandfs/nandfs_vnops.c optional nandfs fs/nfs/nfs_commonkrpc.c optional nfscl | nfsd fs/nfs/nfs_commonsubs.c optional nfscl | nfsd fs/nfs/nfs_commonport.c optional nfscl | nfsd @@ -3600,7 +3571,7 @@ geom/geom_disk.c standard geom/geom_dump.c standard geom/geom_event.c standard geom/geom_fox.c optional geom_fox -geom/geom_flashmap.c optional fdt cfi | fdt nand | fdt mx25l | mmcsd | fdt n25q | fdt at45d +geom/geom_flashmap.c optional fdt cfi | fdt mx25l | mmcsd | fdt n25q | fdt at45d geom/geom_io.c standard geom/geom_kern.c standard geom/geom_map.c optional geom_map Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/conf/files.powerpc Tue Jun 25 04:50:09 2019 (r349352) @@ -43,8 +43,6 @@ dev/iicbus/max6690.c optional max6690 powermac dev/iicbus/ofw_iicbus.c optional iicbus aim dev/ipmi/ipmi.c optional ipmi dev/ipmi/ipmi_opal.c optional powernv ipmi -dev/nand/nfc_fsl.c optional nand mpc85xx -dev/nand/nfc_rb.c optional nand mpc85xx # Most ofw stuff below is brought in by conf/files for options FDT, but # we always want it, even on non-FDT platforms. dev/fdt/simplebus.c standard Modified: head/sys/conf/kern.opts.mk ============================================================================== --- head/sys/conf/kern.opts.mk Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/conf/kern.opts.mk Tue Jun 25 04:50:09 2019 (r349352) @@ -52,7 +52,6 @@ __DEFAULT_YES_OPTIONS = \ __DEFAULT_NO_OPTIONS = \ EXTRA_TCP_STACKS \ KERNEL_RETPOLINE \ - NAND \ OFED \ RATELIMIT Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/fs/smbfs/smbfs_io.c Tue Jun 25 04:50:09 2019 (r349352) @@ -375,6 +375,9 @@ smbfs_doio(struct vnode *vp, struct buf *bp, struct uc */ if (error == EINTR || (!error && (bp->b_flags & B_NEEDCOMMIT))) { + int s; + + s = splbio(); bp->b_flags &= ~(B_INVAL|B_NOCACHE); if ((bp->b_flags & B_ASYNC) == 0) bp->b_flags |= B_EINTR; @@ -384,6 +387,7 @@ smbfs_doio(struct vnode *vp, struct buf *bp, struct uc } if ((bp->b_flags & B_ASYNC) == 0) bp->b_flags |= B_EINTR; + splx(s); } else { if (error) { bp->b_ioflags |= BIO_ERROR; Modified: head/sys/geom/geom_flashmap.c ============================================================================== --- head/sys/geom/geom_flashmap.c Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/geom/geom_flashmap.c Tue Jun 25 04:50:09 2019 (r349352) @@ -43,8 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - struct g_flashmap_slice { off_t sl_start; off_t sl_end; @@ -65,7 +63,6 @@ static struct { { "MMC::device", NULL } }; -static g_ioctl_t g_flashmap_ioctl; static g_taste_t g_flashmap_taste; static int g_flashmap_load(device_t dev, struct g_provider *pp, @@ -127,26 +124,6 @@ g_flashmap_modify(struct g_flashmap *gfp, struct g_geo return (0); } -static int -g_flashmap_ioctl(struct g_provider *pp, u_long cmd, void *data, int fflag, - struct thread *td) -{ - struct g_consumer *cp; - struct g_geom *gp; - - if (cmd != NAND_IO_GET_CHIP_PARAM) - return (ENOIOCTL); - - cp = LIST_FIRST(&pp->geom->consumer); - if (cp == NULL) - return (ENOIOCTL); - gp = cp->provider->geom; - if (gp->ioctl == NULL) - return (ENOIOCTL); - - return (gp->ioctl(cp->provider, cmd, data, fflag, td)); -} - static struct g_geom * g_flashmap_taste(struct g_class *mp, struct g_provider *pp, int flags) { @@ -245,7 +222,6 @@ static struct g_class g_flashmap_class = { .name = FLASHMAP_CLASS_NAME, .version = G_VERSION, .taste = g_flashmap_taste, - .ioctl = g_flashmap_ioctl, }; DECLARE_GEOM_CLASS(g_flashmap_class, g_flashmap); Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/modules/Makefile Tue Jun 25 04:50:09 2019 (r349352) @@ -255,8 +255,6 @@ SUBDIR= \ ${_mwlfw} \ mxge \ my \ - ${_nandfs} \ - ${_nandsim} \ ${_nctgpio} \ ${_ndis} \ ${_netgraph} \ @@ -487,11 +485,6 @@ _mthca= mthca _mlx4ib= mlx4ib _mlx5ib= mlx5ib .endif -.endif - -.if ${MK_NAND} != "no" || defined(ALL_MODULES) -_nandfs= nandfs -_nandsim= nandsim .endif .if ${MK_NETGRAPH} != "no" || defined(ALL_MODULES) Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Jun 25 02:35:22 2019 (r349351) +++ head/sys/sys/param.h Tue Jun 25 04:50:09 2019 (r349352) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300033 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300034 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/targets/pseudo/userland/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/Makefile.depend Tue Jun 25 02:35:22 2019 (r349351) +++ head/targets/pseudo/userland/Makefile.depend Tue Jun 25 04:50:09 2019 (r349352) @@ -772,15 +772,6 @@ DIRDEPS+= \ DIRDEPS+= usr.sbin/efidp .endif -.if ${MK_NAND} != "no" -DIRDEPS+= \ - sbin/nandfs \ - sbin/newfs_nandfs \ - usr.sbin/nandsim \ - usr.sbin/nandtool \ - -.endif - DIRDEPS.amd64= \ sbin/bsdlabel \ sbin/fdisk \ Modified: head/targets/pseudo/userland/lib/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/lib/Makefile.depend Tue Jun 25 02:35:22 2019 (r349351) +++ head/targets/pseudo/userland/lib/Makefile.depend Tue Jun 25 04:50:09 2019 (r349352) @@ -215,10 +215,6 @@ DIRDEPS+= \ DIRDEPS+= stand/libsa32 .endif -.if ${MK_NAND} != "no" -DIRDEPS+= lib/libnandfs -.endif - .if ${MK_CASPER} != "no" DIRDEPS+= \ lib/libcasper/libcasper \ Modified: head/usr.bin/vtfontcvt/vtfontcvt.c ============================================================================== --- head/usr.bin/vtfontcvt/vtfontcvt.c Tue Jun 25 02:35:22 2019 (r349351) +++ head/usr.bin/vtfontcvt/vtfontcvt.c Tue Jun 25 04:50:09 2019 (r349352) @@ -335,11 +335,9 @@ parse_bdf(FILE *fp, unsigned int map_idx) break; } } - } else if (strncmp(ln, "FONTBOUNDINGBOX ", 16) == 0) { - if (sscanf(ln + 16, "%d %d %d %d", &fbbw, &fbbh, &fbbox, - &fbboy) != 4) - errx(1, "invalid FONTBOUNDINGBOX at line %u", - linenum); + } else if (strncmp(ln, "FONTBOUNDINGBOX ", 16) == 0 && + sscanf(ln + 16, "%d %d %d %d", &fbbw, &fbbh, &fbbox, + &fbboy) == 4) { set_width(fbbw); set_height(fbbh); break; @@ -355,9 +353,8 @@ parse_bdf(FILE *fp, unsigned int map_idx) linenum++; ln[length - 1] = '\0'; - if (strncmp(ln, "DWIDTH ", 7) == 0) { - if (sscanf(ln + 7, "%d %d", &dwidth, &dwy) != 2) - errx(1, "invalid DWIDTH at line %u", linenum); + if (strncmp(ln, "DWIDTH ", 7) == 0 && + sscanf(ln + 7, "%d %d", &dwidth, &dwy) == 2) { if (dwy != 0 || (dwidth != fbbw && dwidth * 2 != fbbw)) errx(1, "bitmap with unsupported DWIDTH %d %d at line %u", dwidth, dwy, linenum); Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Tue Jun 25 02:35:22 2019 (r349351) +++ head/usr.sbin/Makefile Tue Jun 25 04:50:09 2019 (r349352) @@ -166,8 +166,6 @@ SUBDIR.${MK_NS_CACHING}+= nscd SUBDIR.${MK_LPR}+= lpr SUBDIR.${MK_MAN_UTILS}+= manctl SUBDIR.${MK_MLX5TOOL}+= mlx5tool -SUBDIR.${MK_NAND}+= nandsim -SUBDIR.${MK_NAND}+= nandtool SUBDIR.${MK_NETGRAPH}+= flowctl SUBDIR.${MK_NETGRAPH}+= ngctl SUBDIR.${MK_NETGRAPH}+= nghook Modified: head/usr.sbin/bhyve/Makefile ============================================================================== --- head/usr.sbin/bhyve/Makefile Tue Jun 25 02:35:22 2019 (r349351) +++ head/usr.sbin/bhyve/Makefile Tue Jun 25 04:50:09 2019 (r349352) @@ -16,7 +16,6 @@ BHYVE_SYSDIR?=${SRCTOP} SRCS= \ atkbdc.c \ acpi.c \ - audio.c \ bhyvegc.c \ bhyverun.c \ block_if.c \ @@ -28,7 +27,6 @@ SRCS= \ dbgport.c \ fwctl.c \ gdb.c \ - hda_codec.c \ inout.c \ ioapic.c \ mem.c \ @@ -38,7 +36,6 @@ SRCS= \ pci_ahci.c \ pci_e82545.c \ pci_emul.c \ - pci_hda.c \ pci_fbuf.c \ pci_hostbridge.c \ pci_irq.c \ Modified: head/usr.sbin/bhyve/bhyve.8 ============================================================================== --- head/usr.sbin/bhyve/bhyve.8 Tue Jun 25 02:35:22 2019 (r349351) +++ head/usr.sbin/bhyve/bhyve.8 Tue Jun 25 04:50:09 2019 (r349352) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 24, 2019 +.Dd December 11, 2018 .Dt BHYVE 8 .Os .Sh NAME @@ -248,8 +248,6 @@ Raw framebuffer device attached to VNC server. eXtensible Host Controller Interface (xHCI) USB controller. .It Li nvme NVM Express (NVMe) controller. -.It Li hda -High Definition Audio Controller. .El .It Op Ar conf This optional parameter describes the backend for device emulations. @@ -476,16 +474,6 @@ Max number of concurrent I/O requests. Sector size (defaults to blockif sector size). .It Li ser Serial number with maximum 20 characters. -.El -.Pp -HD Audio devices: -.Bl -tag -width 10n -.It Li play -Playback device, typically -.Ar /dev/dsp0 . -.It Li rec -Recording device, typically -.Ar /dev/dsp0 . .El .El .It Fl S From owner-svn-src-head@freebsd.org Tue Jun 25 06:13:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BDFA15C158E; Tue, 25 Jun 2019 06:13:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CF5D372868; Tue, 25 Jun 2019 06:13:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC997C70D; Tue, 25 Jun 2019 06:13:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5P6Du3g062133; Tue, 25 Jun 2019 06:13:56 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P6DuHS062132; Tue, 25 Jun 2019 06:13:56 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906250613.x5P6DuHS062132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Jun 2019 06:13:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349353 - head/usr.bin/vtfontcvt X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.bin/vtfontcvt X-SVN-Commit-Revision: 349353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CF5D372868 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 06:13:57 -0000 Author: imp Date: Tue Jun 25 06:13:56 2019 New Revision: 349353 URL: https://svnweb.freebsd.org/changeset/base/349353 Log: Replay r349333 by emaste accidentally reverted by r349352 vtfontcvt: improve .bdf validation Previously if we had a FONTBOUNDINGBOX or DWIDTH entry that had missing or invalid values and and failed sscanf, we would proceeded with partially initialized bounding box / device width variables. Reported by: afl (FONTBOUNDINGBOX) MFC with: r349100 Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/vtfontcvt/vtfontcvt.c Modified: head/usr.bin/vtfontcvt/vtfontcvt.c ============================================================================== --- head/usr.bin/vtfontcvt/vtfontcvt.c Tue Jun 25 04:50:09 2019 (r349352) +++ head/usr.bin/vtfontcvt/vtfontcvt.c Tue Jun 25 06:13:56 2019 (r349353) @@ -335,9 +335,11 @@ parse_bdf(FILE *fp, unsigned int map_idx) break; } } - } else if (strncmp(ln, "FONTBOUNDINGBOX ", 16) == 0 && - sscanf(ln + 16, "%d %d %d %d", &fbbw, &fbbh, &fbbox, - &fbboy) == 4) { + } else if (strncmp(ln, "FONTBOUNDINGBOX ", 16) == 0) { + if (sscanf(ln + 16, "%d %d %d %d", &fbbw, &fbbh, &fbbox, + &fbboy) != 4) + errx(1, "invalid FONTBOUNDINGBOX at line %u", + linenum); set_width(fbbw); set_height(fbbh); break; @@ -353,8 +355,9 @@ parse_bdf(FILE *fp, unsigned int map_idx) linenum++; ln[length - 1] = '\0'; - if (strncmp(ln, "DWIDTH ", 7) == 0 && - sscanf(ln + 7, "%d %d", &dwidth, &dwy) == 2) { + if (strncmp(ln, "DWIDTH ", 7) == 0) { + if (sscanf(ln + 7, "%d %d", &dwidth, &dwy) != 2) + errx(1, "invalid DWIDTH at line %u", linenum); if (dwy != 0 || (dwidth != fbbw && dwidth * 2 != fbbw)) errx(1, "bitmap with unsupported DWIDTH %d %d at line %u", dwidth, dwy, linenum); From owner-svn-src-head@freebsd.org Tue Jun 25 06:14:02 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A70415C15CA; Tue, 25 Jun 2019 06:14: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 987F172895; Tue, 25 Jun 2019 06:14: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 50BB0C70E; Tue, 25 Jun 2019 06:14:01 +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 x5P6E1W9062191; Tue, 25 Jun 2019 06:14:01 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P6E1Dh062190; Tue, 25 Jun 2019 06:14:01 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906250614.x5P6E1Dh062190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Jun 2019 06:14:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349354 - head/sys/fs/smbfs X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/fs/smbfs X-SVN-Commit-Revision: 349354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 987F172895 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 06:14:02 -0000 Author: imp Date: Tue Jun 25 06:14:00 2019 New Revision: 349354 URL: https://svnweb.freebsd.org/changeset/base/349354 Log: Replay r349334 by markj accidentally reverted by r349352 Remove a lingering use of splbio(). The buffer must be locked by the caller. No functional change intended. Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/smbfs/smbfs_io.c Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Tue Jun 25 06:13:56 2019 (r349353) +++ head/sys/fs/smbfs/smbfs_io.c Tue Jun 25 06:14:00 2019 (r349354) @@ -375,9 +375,6 @@ smbfs_doio(struct vnode *vp, struct buf *bp, struct uc */ if (error == EINTR || (!error && (bp->b_flags & B_NEEDCOMMIT))) { - int s; - - s = splbio(); bp->b_flags &= ~(B_INVAL|B_NOCACHE); if ((bp->b_flags & B_ASYNC) == 0) bp->b_flags |= B_EINTR; @@ -387,7 +384,6 @@ smbfs_doio(struct vnode *vp, struct buf *bp, struct uc } if ((bp->b_flags & B_ASYNC) == 0) bp->b_flags |= B_EINTR; - splx(s); } else { if (error) { bp->b_ioflags |= BIO_ERROR; From owner-svn-src-head@freebsd.org Tue Jun 25 06:14:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35F2815C1609; Tue, 25 Jun 2019 06:14:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0C66372958; Tue, 25 Jun 2019 06:14: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 0AC1AC70F; Tue, 25 Jun 2019 06:14: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 x5P6E6wC062249; Tue, 25 Jun 2019 06:14:06 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P6E6N4062242; Tue, 25 Jun 2019 06:14:06 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906250614.x5P6E6N4062242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Jun 2019 06:14:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349355 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0C66372958 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 06:14:09 -0000 Author: imp Date: Tue Jun 25 06:14:05 2019 New Revision: 349355 URL: https://svnweb.freebsd.org/changeset/base/349355 Log: Replay r349335 by scottl accidentally reverted by r349352 Add the PCI HDAudio device model from the 2016 GSoC. Detailed information can be found at https://wiki.freebsd.org/SummerOfCode2016/HDAudioEmulationForBhyve This commit has evolved from the original work to include Capsicum integration. As part of that, it only opens the host audio devices once and leaves them open, instead of opening and closing them on each guest access. Thanks to Peter Grehan and Marcelo Araujo for their help in bringing the work forward and providing some of the final techncial push. Submitted by: Alex Teaca Differential Revision: D7840, D12419 Added: head/usr.sbin/bhyve/audio.c (contents, props changed) head/usr.sbin/bhyve/audio.h (contents, props changed) head/usr.sbin/bhyve/hda_codec.c (contents, props changed) head/usr.sbin/bhyve/hda_reg.h (contents, props changed) head/usr.sbin/bhyve/hdac_reg.h (contents, props changed) head/usr.sbin/bhyve/pci_hda.c (contents, props changed) head/usr.sbin/bhyve/pci_hda.h (contents, props changed) Modified: head/usr.sbin/bhyve/Makefile Modified: head/usr.sbin/bhyve/Makefile ============================================================================== --- head/usr.sbin/bhyve/Makefile Tue Jun 25 06:14:00 2019 (r349354) +++ head/usr.sbin/bhyve/Makefile Tue Jun 25 06:14:05 2019 (r349355) @@ -16,6 +16,7 @@ BHYVE_SYSDIR?=${SRCTOP} SRCS= \ atkbdc.c \ acpi.c \ + audio.c \ bhyvegc.c \ bhyverun.c \ block_if.c \ @@ -27,6 +28,7 @@ SRCS= \ dbgport.c \ fwctl.c \ gdb.c \ + hda_codec.c \ inout.c \ ioapic.c \ mem.c \ @@ -36,6 +38,7 @@ SRCS= \ pci_ahci.c \ pci_e82545.c \ pci_emul.c \ + pci_hda.c \ pci_fbuf.c \ pci_hostbridge.c \ pci_irq.c \ Added: head/usr.sbin/bhyve/audio.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/audio.c Tue Jun 25 06:14:05 2019 (r349355) @@ -0,0 +1,282 @@ +/*- + * Copyright (c) 2016 Alex Teaca + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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$"); + +#ifndef WITHOUT_CAPSICUM +#include +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "audio.h" +#include "pci_hda.h" + +/* + * Audio Player internal data structures + */ + +struct audio { + int fd; + uint8_t dir; + uint8_t inited; + char dev_name[64]; +}; + +/* + * Audio Player module function definitions + */ + +/* + * audio_init - initialize an instance of audio player + * @dev_name - the backend sound device used to play / capture + * @dir - dir = 1 for write mode, dir = 0 for read mode + */ +struct audio * +audio_init(const char *dev_name, uint8_t dir) +{ + struct audio *aud = NULL; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; + cap_ioctl_t cmds[] = { + SNDCTL_DSP_RESET, SNDCTL_DSP_SETFMT, SNDCTL_DSP_CHANNELS, + SNDCTL_DSP_SPEED, +#ifdef DEBUG_HDA + SNDCTL_DSP_GETOSPACE, SNDCTL_DSP_GETISPACE, +#endif + }; +#endif + + assert(dev_name); + + aud = calloc(1, sizeof(*aud)); + if (!aud) + return NULL; + + if (strlen(dev_name) < sizeof(aud->dev_name)) + memcpy(aud->dev_name, dev_name, strlen(dev_name) + 1); + else { + DPRINTF("dev_name too big\n"); + free(aud); + return NULL; + } + + aud->dir = dir; + + aud->fd = open(aud->dev_name, aud->dir ? O_WRONLY : O_RDONLY, 0); + if (aud->fd == -1) { + DPRINTF("Failed to open dev: %s, errno: %d\n", + aud->dev_name, errno); + return (NULL); + } + +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_IOCTL, CAP_READ, CAP_WRITE); + if (caph_rights_limit(aud->fd, &rights) == -1) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + if (caph_ioctls_limit(aud->fd, cmds, nitems(cmds)) == -1) + errx(EX_OSERR, "Unable to limit ioctl rights for sandbox"); +#endif + + return aud; +} + +/* + * audio_set_params - reset the sound device and set the audio params + * @aud - the audio player to be configured + * @params - the audio parameters to be set + */ +int +audio_set_params(struct audio *aud, struct audio_params *params) +{ + int audio_fd; + int format, channels, rate; + int err; +#if DEBUG_HDA == 1 + audio_buf_info info; +#endif + + assert(aud); + assert(params); + + if ((audio_fd = aud->fd) < 0) { + DPRINTF("Incorrect audio device descriptor for %s\n", + aud->dev_name); + return (-1); + } + + /* Reset the device if it was previously opened */ + if (aud->inited) { + err = ioctl(audio_fd, SNDCTL_DSP_RESET, NULL); + if (err == -1) { + DPRINTF("Failed to reset fd: %d, errno: %d\n", + aud->fd, errno); + return (-1); + } + } else + aud->inited = 1; + + /* Set the Format (Bits per Sample) */ + format = params->format; + err = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format); + if (err == -1) { + DPRINTF("Fail to set fmt: 0x%x errno: %d\n", + params->format, errno); + return -1; + } + + /* The device does not support the requested audio format */ + if (format != params->format) { + DPRINTF("Mismatch format: 0x%x params->format: 0x%x\n", + format, params->format); + return -1; + } + + /* Set the Number of Channels */ + channels = params->channels; + err = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &channels); + if (err == -1) { + DPRINTF("Fail to set channels: %d errno: %d\n", + params->channels, errno); + return -1; + } + + /* The device does not support the requested no. of channels */ + if (channels != params->channels) { + DPRINTF("Mismatch channels: %d params->channels: %d\n", + channels, params->channels); + return -1; + } + + /* Set the Sample Rate / Speed */ + rate = params->rate; + err = ioctl(audio_fd, SNDCTL_DSP_SPEED, &rate); + if (err == -1) { + DPRINTF("Fail to set speed: %d errno: %d\n", + params->rate, errno); + return -1; + } + + /* The device does not support the requested rate / speed */ + if (rate != params->rate) { + DPRINTF("Mismatch rate: %d params->rate: %d\n", + rate, params->rate); + return -1; + } + +#if DEBUG_HDA == 1 + err = ioctl(audio_fd, aud->dir ? SNDCTL_DSP_GETOSPACE : + SNDCTL_DSP_GETISPACE, &info); + if (err == -1) { + DPRINTF("Fail to get audio buf info errno: %d\n", errno); + return -1; + } + DPRINTF("fragstotal: 0x%x fragsize: 0x%x\n", + info.fragstotal, info.fragsize); +#endif + return 0; +} + +/* + * audio_playback - plays samples to the sound device using blocking operations + * @aud - the audio player used to play the samples + * @buf - the buffer containing the samples + * @count - the number of bytes in buffer + */ +int +audio_playback(struct audio *aud, const void *buf, size_t count) +{ + int audio_fd = -1; + ssize_t len = 0, total = 0; + + assert(aud); + assert(aud->dir); + assert(buf); + + audio_fd = aud->fd; + assert(audio_fd != -1); + + total = 0; + while (total < count) { + len = write(audio_fd, buf + total, count - total); + if (len == -1) { + DPRINTF("Fail to write to fd: %d, errno: %d\n", + audio_fd, errno); + return -1; + } + + total += len; + } + + return 0; +} + +/* + * audio_record - records samples from the sound device using + * blocking operations. + * @aud - the audio player used to capture the samples + * @buf - the buffer to receive the samples + * @count - the number of bytes to capture in buffer + * Returns -1 on error and 0 on success + */ +int +audio_record(struct audio *aud, void *buf, size_t count) +{ + int audio_fd = -1; + ssize_t len = 0, total = 0; + + assert(aud); + assert(!aud->dir); + assert(buf); + + audio_fd = aud->fd; + assert(audio_fd != -1); + + total = 0; + while (total < count) { + len = read(audio_fd, buf + total, count - total); + if (len == -1) { + DPRINTF("Fail to write to fd: %d, errno: %d\n", + audio_fd, errno); + return -1; + } + + total += len; + } + + return 0; +} Added: head/usr.sbin/bhyve/audio.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/audio.h Tue Jun 25 06:14:05 2019 (r349355) @@ -0,0 +1,86 @@ +/*- + * Copyright (c) 2016 Alex Teaca + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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 _AUDIO_EMUL_H_ +#define _AUDIO_EMUL_H_ + +#include +#include + +/* + * Audio Player data structures + */ + +struct audio; + +struct audio_params { + int channels; + int format; + int rate; +}; + +/* + * Audio Player API + */ + +/* + * audio_init - initialize an instance of audio player + * @dev_name - the backend sound device used to play / capture + * @dir - dir = 1 for write mode, dir = 0 for read mode + * Returns NULL on error and the address of the audio player instance + */ +struct audio *audio_init(const char *dev_name, uint8_t dir); + +/* + * audio_set_params - reset the sound device and set the audio params + * @aud - the audio player to be configured + * @params - the audio parameters to be set + * Returns -1 on error and 0 on success + */ +int audio_set_params(struct audio *aud, struct audio_params *params); + +/* + * audio_playback - plays samples to the sound device using blocking operations + * @aud - the audio player used to play the samples + * @buf - the buffer containing the samples + * @count - the number of bytes in buffer + * Returns -1 on error and 0 on success + */ +int audio_playback(struct audio *aud, const void *buf, size_t count); + +/* + * audio_record - records samples from the sound device using blocking + * operations. + * @aud - the audio player used to capture the samples + * @buf - the buffer to receive the samples + * @count - the number of bytes to capture in buffer + * Returns -1 on error and 0 on success + */ +int audio_record(struct audio *aud, void *buf, size_t count); + +#endif /* _AUDIO_EMUL_H_ */ Added: head/usr.sbin/bhyve/hda_codec.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/hda_codec.c Tue Jun 25 06:14:05 2019 (r349355) @@ -0,0 +1,950 @@ +/*- + * Copyright (c) 2016 Alex Teaca + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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 "pci_hda.h" +#include "audio.h" + +/* + * HDA Codec defines + */ +#define INTEL_VENDORID 0x8086 + +#define HDA_CODEC_SUBSYSTEM_ID ((INTEL_VENDORID << 16) | 0x01) +#define HDA_CODEC_ROOT_NID 0x00 +#define HDA_CODEC_FG_NID 0x01 +#define HDA_CODEC_AUDIO_OUTPUT_NID 0x02 +#define HDA_CODEC_PIN_OUTPUT_NID 0x03 +#define HDA_CODEC_AUDIO_INPUT_NID 0x04 +#define HDA_CODEC_PIN_INPUT_NID 0x05 + +#define HDA_CODEC_STREAMS_COUNT 0x02 +#define HDA_CODEC_STREAM_OUTPUT 0x00 +#define HDA_CODEC_STREAM_INPUT 0x01 + +#define HDA_CODEC_PARAMS_COUNT 0x14 +#define HDA_CODEC_CONN_LIST_COUNT 0x01 +#define HDA_CODEC_RESPONSE_EX_UNSOL 0x10 +#define HDA_CODEC_RESPONSE_EX_SOL 0x00 +#define HDA_CODEC_AMP_NUMSTEPS 0x4a + +#define HDA_CODEC_SUPP_STREAM_FORMATS_PCM \ + (1 << HDA_PARAM_SUPP_STREAM_FORMATS_PCM_SHIFT) + +#define HDA_CODEC_FMT_BASE_MASK (0x01 << 14) + +#define HDA_CODEC_FMT_MULT_MASK (0x07 << 11) +#define HDA_CODEC_FMT_MULT_2 (0x01 << 11) +#define HDA_CODEC_FMT_MULT_3 (0x02 << 11) +#define HDA_CODEC_FMT_MULT_4 (0x03 << 11) + +#define HDA_CODEC_FMT_DIV_MASK 0x07 +#define HDA_CODEC_FMT_DIV_SHIFT 8 + +#define HDA_CODEC_FMT_BITS_MASK (0x07 << 4) +#define HDA_CODEC_FMT_BITS_8 (0x00 << 4) +#define HDA_CODEC_FMT_BITS_16 (0x01 << 4) +#define HDA_CODEC_FMT_BITS_24 (0x03 << 4) +#define HDA_CODEC_FMT_BITS_32 (0x04 << 4) + +#define HDA_CODEC_FMT_CHAN_MASK (0x0f << 0) + +#define HDA_CODEC_AUDIO_WCAP_OUTPUT \ + (0x00 << HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_INPUT \ + (0x01 << HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_PIN \ + (0x04 << HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_CONN_LIST \ + (1 << HDA_PARAM_AUDIO_WIDGET_CAP_CONN_LIST_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_FORMAT_OVR \ + (1 << HDA_PARAM_AUDIO_WIDGET_CAP_FORMAT_OVR_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_AMP_OVR \ + (1 << HDA_PARAM_AUDIO_WIDGET_CAP_AMP_OVR_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_OUT_AMP \ + (1 << HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_IN_AMP \ + (1 << HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP_SHIFT) +#define HDA_CODEC_AUDIO_WCAP_STEREO \ + (1 << HDA_PARAM_AUDIO_WIDGET_CAP_STEREO_SHIFT) + +#define HDA_CODEC_PIN_CAP_OUTPUT \ + (1 << HDA_PARAM_PIN_CAP_OUTPUT_CAP_SHIFT) +#define HDA_CODEC_PIN_CAP_INPUT \ + (1 << HDA_PARAM_PIN_CAP_INPUT_CAP_SHIFT) +#define HDA_CODEC_PIN_CAP_PRESENCE_DETECT \ + (1 << HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP_SHIFT) + +#define HDA_CODEC_OUTPUT_AMP_CAP_MUTE_CAP \ + (1 << HDA_PARAM_OUTPUT_AMP_CAP_MUTE_CAP_SHIFT) +#define HDA_CODEC_OUTPUT_AMP_CAP_STEPSIZE \ + (0x03 << HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE_SHIFT) +#define HDA_CODEC_OUTPUT_AMP_CAP_NUMSTEPS \ + (HDA_CODEC_AMP_NUMSTEPS << HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS_SHIFT) +#define HDA_CODEC_OUTPUT_AMP_CAP_OFFSET \ + (HDA_CODEC_AMP_NUMSTEPS << HDA_PARAM_OUTPUT_AMP_CAP_OFFSET_SHIFT) + +#define HDA_CODEC_SET_AMP_GAIN_MUTE_MUTE 0x80 +#define HDA_CODEC_SET_AMP_GAIN_MUTE_GAIN_MASK 0x7f + +#define HDA_CODEC_PIN_SENSE_PRESENCE_PLUGGED (1 << 31) +#define HDA_CODEC_PIN_WIDGET_CTRL_OUT_ENABLE \ + (1 << HDA_CMD_GET_PIN_WIDGET_CTRL_OUT_ENABLE_SHIFT) +#define HDA_CODEC_PIN_WIDGET_CTRL_IN_ENABLE \ + (1 << HDA_CMD_GET_PIN_WIDGET_CTRL_IN_ENABLE_SHIFT) + +#define HDA_CONFIG_DEFAULTCONF_COLOR_BLACK \ + (0x01 << HDA_CONFIG_DEFAULTCONF_COLOR_SHIFT) +#define HDA_CONFIG_DEFAULTCONF_COLOR_RED \ + (0x05 << HDA_CONFIG_DEFAULTCONF_COLOR_SHIFT) + +#define HDA_CODEC_BUF_SIZE HDA_FIFO_SIZE + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + + +/* + * HDA Audio Context data structures + */ + +typedef void (*transfer_func_t)(void *arg); +typedef int (*setup_func_t)(void *arg); + +struct hda_audio_ctxt { + char name[64]; + uint8_t run; + uint8_t started; + void *priv; + pthread_t tid; + pthread_mutex_t mtx; + pthread_cond_t cond; + setup_func_t do_setup; + transfer_func_t do_transfer; +}; + +/* + * HDA Audio Context module function declarations + */ + +static void *hda_audio_ctxt_thr(void *arg); +static int hda_audio_ctxt_init(struct hda_audio_ctxt *actx, const char *tname, + transfer_func_t do_transfer, setup_func_t do_setup, void *priv); +static int hda_audio_ctxt_start(struct hda_audio_ctxt *actx); +static int hda_audio_ctxt_stop(struct hda_audio_ctxt *actx); + +/* + * HDA Codec data structures + */ + +struct hda_codec_softc; + +typedef uint32_t (*verb_func_t)(struct hda_codec_softc *sc, uint16_t verb, + uint16_t payload); + +struct hda_codec_stream { + uint8_t buf[HDA_CODEC_BUF_SIZE]; + uint8_t channel; + uint16_t fmt; + uint8_t stream; + + uint8_t left_gain; + uint8_t right_gain; + uint8_t left_mute; + uint8_t right_mute; + + struct audio *aud; + struct hda_audio_ctxt actx; +}; + +struct hda_codec_softc { + uint32_t no_nodes; + uint32_t subsystem_id; + const uint32_t (*get_parameters)[HDA_CODEC_PARAMS_COUNT]; + const uint8_t (*conn_list)[HDA_CODEC_CONN_LIST_COUNT]; + const uint32_t *conf_default; + const uint8_t *pin_ctrl_default; + const verb_func_t *verb_handlers; + + struct hda_codec_inst *hci; + struct hda_codec_stream streams[HDA_CODEC_STREAMS_COUNT]; +}; + +/* + * HDA Codec module function declarations + */ +static int hda_codec_init(struct hda_codec_inst *hci, const char *play, + const char *rec, const char *opts); +static int hda_codec_reset(struct hda_codec_inst *hci); +static int hda_codec_command(struct hda_codec_inst *hci, uint32_t cmd_data); +static int hda_codec_notify(struct hda_codec_inst *hci, uint8_t run, + uint8_t stream, uint8_t dir); + +static int hda_codec_parse_format(uint16_t fmt, struct audio_params *params); + +static uint32_t hda_codec_audio_output_nid(struct hda_codec_softc *sc, + uint16_t verb, uint16_t payload); +static void hda_codec_audio_output_do_transfer(void *arg); +static int hda_codec_audio_output_do_setup(void *arg); +static uint32_t hda_codec_audio_input_nid(struct hda_codec_softc *sc, + uint16_t verb, uint16_t payload); +static void hda_codec_audio_input_do_transfer(void *arg); +static int hda_codec_audio_input_do_setup(void *arg); + +static uint32_t hda_codec_audio_inout_nid(struct hda_codec_stream *st, + uint16_t verb, uint16_t payload); + +/* + * HDA Codec global data + */ + +#define HDA_CODEC_ROOT_DESC \ + [HDA_CODEC_ROOT_NID] = { \ + [HDA_PARAM_VENDOR_ID] = INTEL_VENDORID, \ + [HDA_PARAM_REVISION_ID] = 0xffff, \ + /* 1 Subnode, StartNid = 1 */ \ + [HDA_PARAM_SUB_NODE_COUNT] = 0x00010001, \ + }, \ + +#define HDA_CODEC_FG_COMMON_DESC \ + [HDA_PARAM_FCT_GRP_TYPE] = HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_AUDIO,\ + /* B8 - B32, 8.0 - 192.0kHz */ \ + [HDA_PARAM_SUPP_PCM_SIZE_RATE] = (0x1f << 16) | 0x7ff, \ + [HDA_PARAM_SUPP_STREAM_FORMATS] = HDA_CODEC_SUPP_STREAM_FORMATS_PCM,\ + [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */ \ + [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */ \ + [HDA_PARAM_GPIO_COUNT] = 0x00, \ + +#define HDA_CODEC_FG_OUTPUT_DESC \ + [HDA_CODEC_FG_NID] = { \ + /* 2 Subnodes, StartNid = 2 */ \ + [HDA_PARAM_SUB_NODE_COUNT] = 0x00020002, \ + HDA_CODEC_FG_COMMON_DESC \ + }, \ + +#define HDA_CODEC_FG_INPUT_DESC \ + [HDA_CODEC_FG_NID] = { \ + /* 2 Subnodes, StartNid = 4 */ \ + [HDA_PARAM_SUB_NODE_COUNT] = 0x00040002, \ + HDA_CODEC_FG_COMMON_DESC \ + }, \ + +#define HDA_CODEC_FG_DUPLEX_DESC \ + [HDA_CODEC_FG_NID] = { \ + /* 4 Subnodes, StartNid = 2 */ \ + [HDA_PARAM_SUB_NODE_COUNT] = 0x00020004, \ + HDA_CODEC_FG_COMMON_DESC \ + }, \ + +#define HDA_CODEC_OUTPUT_DESC \ + [HDA_CODEC_AUDIO_OUTPUT_NID] = { \ + [HDA_PARAM_AUDIO_WIDGET_CAP] = \ + HDA_CODEC_AUDIO_WCAP_OUTPUT | \ + HDA_CODEC_AUDIO_WCAP_FORMAT_OVR | \ + HDA_CODEC_AUDIO_WCAP_AMP_OVR | \ + HDA_CODEC_AUDIO_WCAP_OUT_AMP | \ + HDA_CODEC_AUDIO_WCAP_STEREO, \ + /* B16, 16.0 - 192.0kHz */ \ + [HDA_PARAM_SUPP_PCM_SIZE_RATE] = (0x02 << 16) | 0x7fc, \ + [HDA_PARAM_SUPP_STREAM_FORMATS] = \ + HDA_CODEC_SUPP_STREAM_FORMATS_PCM, \ + [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */ \ + [HDA_PARAM_CONN_LIST_LENGTH] = 0x00, \ + [HDA_PARAM_OUTPUT_AMP_CAP] = \ + HDA_CODEC_OUTPUT_AMP_CAP_MUTE_CAP | \ + HDA_CODEC_OUTPUT_AMP_CAP_STEPSIZE | \ + HDA_CODEC_OUTPUT_AMP_CAP_NUMSTEPS | \ + HDA_CODEC_OUTPUT_AMP_CAP_OFFSET, \ + }, \ + [HDA_CODEC_PIN_OUTPUT_NID] = { \ + [HDA_PARAM_AUDIO_WIDGET_CAP] = \ + HDA_CODEC_AUDIO_WCAP_PIN | \ + HDA_CODEC_AUDIO_WCAP_CONN_LIST | \ + HDA_CODEC_AUDIO_WCAP_STEREO, \ + [HDA_PARAM_PIN_CAP] = HDA_CODEC_PIN_CAP_OUTPUT | \ + HDA_CODEC_PIN_CAP_PRESENCE_DETECT,\ + [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */ \ + [HDA_PARAM_CONN_LIST_LENGTH] = 0x01, \ + [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */ \ + }, \ + +#define HDA_CODEC_INPUT_DESC \ + [HDA_CODEC_AUDIO_INPUT_NID] = { \ + [HDA_PARAM_AUDIO_WIDGET_CAP] = \ + HDA_CODEC_AUDIO_WCAP_INPUT | \ + HDA_CODEC_AUDIO_WCAP_CONN_LIST | \ + HDA_CODEC_AUDIO_WCAP_FORMAT_OVR | \ + HDA_CODEC_AUDIO_WCAP_AMP_OVR | \ + HDA_CODEC_AUDIO_WCAP_IN_AMP | \ + HDA_CODEC_AUDIO_WCAP_STEREO, \ + /* B16, 16.0 - 192.0kHz */ \ + [HDA_PARAM_SUPP_PCM_SIZE_RATE] = (0x02 << 16) | 0x7fc, \ + [HDA_PARAM_SUPP_STREAM_FORMATS] = \ + HDA_CODEC_SUPP_STREAM_FORMATS_PCM, \ + [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */ \ + [HDA_PARAM_CONN_LIST_LENGTH] = 0x01, \ + [HDA_PARAM_INPUT_AMP_CAP] = \ + HDA_CODEC_OUTPUT_AMP_CAP_MUTE_CAP | \ + HDA_CODEC_OUTPUT_AMP_CAP_STEPSIZE | \ + HDA_CODEC_OUTPUT_AMP_CAP_NUMSTEPS | \ + HDA_CODEC_OUTPUT_AMP_CAP_OFFSET, \ + }, \ + [HDA_CODEC_PIN_INPUT_NID] = { \ + [HDA_PARAM_AUDIO_WIDGET_CAP] = \ + HDA_CODEC_AUDIO_WCAP_PIN | \ + HDA_CODEC_AUDIO_WCAP_STEREO, \ + [HDA_PARAM_PIN_CAP] = HDA_CODEC_PIN_CAP_INPUT | \ + HDA_CODEC_PIN_CAP_PRESENCE_DETECT, \ + [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */ \ + [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */ \ + }, \ + +static const uint32_t +hda_codec_output_parameters[][HDA_CODEC_PARAMS_COUNT] = { + HDA_CODEC_ROOT_DESC + HDA_CODEC_FG_OUTPUT_DESC + HDA_CODEC_OUTPUT_DESC +}; + +static const uint32_t +hda_codec_input_parameters[][HDA_CODEC_PARAMS_COUNT] = { + HDA_CODEC_ROOT_DESC + HDA_CODEC_FG_INPUT_DESC + HDA_CODEC_INPUT_DESC +}; + +static const uint32_t +hda_codec_duplex_parameters[][HDA_CODEC_PARAMS_COUNT] = { + HDA_CODEC_ROOT_DESC + HDA_CODEC_FG_DUPLEX_DESC + HDA_CODEC_OUTPUT_DESC + HDA_CODEC_INPUT_DESC +}; + +#define HDA_CODEC_NODES_COUNT (ARRAY_SIZE(hda_codec_duplex_parameters)) + +static const uint8_t +hda_codec_conn_list[HDA_CODEC_NODES_COUNT][HDA_CODEC_CONN_LIST_COUNT] = { + [HDA_CODEC_PIN_OUTPUT_NID] = {HDA_CODEC_AUDIO_OUTPUT_NID}, + [HDA_CODEC_AUDIO_INPUT_NID] = {HDA_CODEC_PIN_INPUT_NID}, +}; + +static const uint32_t +hda_codec_conf_default[HDA_CODEC_NODES_COUNT] = { + [HDA_CODEC_PIN_OUTPUT_NID] = \ + HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_JACK | + HDA_CONFIG_DEFAULTCONF_DEVICE_LINE_OUT | + HDA_CONFIG_DEFAULTCONF_COLOR_BLACK | + (0x01 << HDA_CONFIG_DEFAULTCONF_ASSOCIATION_SHIFT), + [HDA_CODEC_PIN_INPUT_NID] = HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_JACK | + HDA_CONFIG_DEFAULTCONF_DEVICE_LINE_IN | + HDA_CONFIG_DEFAULTCONF_COLOR_RED | + (0x02 << HDA_CONFIG_DEFAULTCONF_ASSOCIATION_SHIFT), +}; + +static const uint8_t +hda_codec_pin_ctrl_default[HDA_CODEC_NODES_COUNT] = { + [HDA_CODEC_PIN_OUTPUT_NID] = HDA_CODEC_PIN_WIDGET_CTRL_OUT_ENABLE, + [HDA_CODEC_PIN_INPUT_NID] = HDA_CODEC_PIN_WIDGET_CTRL_IN_ENABLE, +}; + +static const +verb_func_t hda_codec_verb_handlers[HDA_CODEC_NODES_COUNT] = { + [HDA_CODEC_AUDIO_OUTPUT_NID] = hda_codec_audio_output_nid, + [HDA_CODEC_AUDIO_INPUT_NID] = hda_codec_audio_input_nid, +}; + +/* + * HDA Codec module function definitions + */ + +static int +hda_codec_init(struct hda_codec_inst *hci, const char *play, + const char *rec, const char *opts) +{ + struct hda_codec_softc *sc = NULL; + struct hda_codec_stream *st = NULL; + int err; + + if (!(play || rec)) + return (-1); + + DPRINTF("cad: 0x%x opts: %s\n", hci->cad, opts); + + sc = calloc(1, sizeof(*sc)); + if (!sc) + return (-1); + + if (play && rec) + sc->get_parameters = hda_codec_duplex_parameters; + else { + if (play) + sc->get_parameters = hda_codec_output_parameters; + else + sc->get_parameters = hda_codec_input_parameters; + } + sc->subsystem_id = HDA_CODEC_SUBSYSTEM_ID; + sc->no_nodes = HDA_CODEC_NODES_COUNT; + sc->conn_list = hda_codec_conn_list; + sc->conf_default = hda_codec_conf_default; + sc->pin_ctrl_default = hda_codec_pin_ctrl_default; + sc->verb_handlers = hda_codec_verb_handlers; + DPRINTF("HDA Codec nodes: %d\n", sc->no_nodes); + + /* + * Initialize the Audio Output stream + */ + if (play) { + st = &sc->streams[HDA_CODEC_STREAM_OUTPUT]; + + err = hda_audio_ctxt_init(&st->actx, "hda-audio-output", + hda_codec_audio_output_do_transfer, + hda_codec_audio_output_do_setup, sc); + assert(!err); + + st->aud = audio_init(play, 1); + if (!st->aud) { + DPRINTF("Fail to init the output audio player\n"); + return (-1); + } + } + + /* + * Initialize the Audio Input stream + */ + if (rec) { + st = &sc->streams[HDA_CODEC_STREAM_INPUT]; + + err = hda_audio_ctxt_init(&st->actx, "hda-audio-input", + hda_codec_audio_input_do_transfer, + hda_codec_audio_input_do_setup, sc); + assert(!err); + + st->aud = audio_init(rec, 0); + if (!st->aud) { + DPRINTF("Fail to init the input audio player\n"); + return (-1); + } + } + + sc->hci = hci; + hci->priv = sc; + + return (0); +} + +static int +hda_codec_reset(struct hda_codec_inst *hci) +{ + struct hda_ops *hops = NULL; + struct hda_codec_softc *sc = NULL; + struct hda_codec_stream *st = NULL; + int i; + + assert(hci); + + hops = hci->hops; + assert(hops); + + sc = (struct hda_codec_softc *)hci->priv; + assert(sc); + + for (i = 0; i < HDA_CODEC_STREAMS_COUNT; i++) { + st = &sc->streams[i]; + st->left_gain = HDA_CODEC_AMP_NUMSTEPS; + st->right_gain = HDA_CODEC_AMP_NUMSTEPS; + st->left_mute = HDA_CODEC_SET_AMP_GAIN_MUTE_MUTE; + st->right_mute = HDA_CODEC_SET_AMP_GAIN_MUTE_MUTE; + } + + DPRINTF("cad: 0x%x\n", hci->cad); + + if (!hops->signal) { + DPRINTF("The controller ops does not implement \ + the signal function\n"); + return (-1); + } + + return (hops->signal(hci)); +} + +static int +hda_codec_command(struct hda_codec_inst *hci, uint32_t cmd_data) +{ + struct hda_codec_softc *sc = NULL; + struct hda_ops *hops = NULL; + uint8_t cad = 0, nid = 0; + uint16_t verb = 0, payload = 0; + uint32_t res = 0; + + /* 4 bits */ + cad = (cmd_data >> HDA_CMD_CAD_SHIFT) & 0x0f; + /* 8 bits */ + nid = (cmd_data >> HDA_CMD_NID_SHIFT) & 0xff; + + if ((cmd_data & 0x70000) == 0x70000) { + /* 12 bits */ + verb = (cmd_data >> HDA_CMD_VERB_12BIT_SHIFT) & 0x0fff; + /* 8 bits */ + payload = cmd_data & 0xff; + } else { + /* 4 bits */ + verb = (cmd_data >> HDA_CMD_VERB_4BIT_SHIFT) & 0x0f; + /* 16 bits */ + payload = cmd_data & 0xffff; + } + + assert(cad == hci->cad); + assert(hci); + + hops = hci->hops; + assert(hops); + + sc = (struct hda_codec_softc *)hci->priv; + assert(sc); + + assert(nid < sc->no_nodes); + + if (!hops->response) { + DPRINTF("The controller ops does not implement \ + the response function\n"); + return (-1); + } + + switch (verb) { + case HDA_CMD_VERB_GET_PARAMETER: + res = sc->get_parameters[nid][payload]; + break; + case HDA_CMD_VERB_GET_CONN_LIST_ENTRY: + res = sc->conn_list[nid][0]; + break; + case HDA_CMD_VERB_GET_PIN_WIDGET_CTRL: + res = sc->pin_ctrl_default[nid]; + break; + case HDA_CMD_VERB_GET_PIN_SENSE: + res = HDA_CODEC_PIN_SENSE_PRESENCE_PLUGGED; + break; + case HDA_CMD_VERB_GET_CONFIGURATION_DEFAULT: + res = sc->conf_default[nid]; + break; + case HDA_CMD_VERB_GET_SUBSYSTEM_ID: + res = sc->subsystem_id; + break; + default: + assert(sc->verb_handlers); + if (sc->verb_handlers[nid]) + res = sc->verb_handlers[nid](sc, verb, payload); + else + DPRINTF("Unknown VERB: 0x%x\n", verb); + break; + } + + DPRINTF("cad: 0x%x nid: 0x%x verb: 0x%x payload: 0x%x response: 0x%x\n", + cad, nid, verb, payload, res); + + return (hops->response(hci, res, HDA_CODEC_RESPONSE_EX_SOL)); +} + +static int +hda_codec_notify(struct hda_codec_inst *hci, uint8_t run, + uint8_t stream, uint8_t dir) +{ + struct hda_codec_softc *sc = NULL; + struct hda_codec_stream *st = NULL; + struct hda_audio_ctxt *actx = NULL; + int i; + int err; + + assert(hci); + assert(stream); + + sc = (struct hda_codec_softc *)hci->priv; + assert(sc); + + i = dir ? HDA_CODEC_STREAM_OUTPUT : HDA_CODEC_STREAM_INPUT; + st = &sc->streams[i]; + + DPRINTF("run: %d, stream: 0x%x, st->stream: 0x%x dir: %d\n", + run, stream, st->stream, dir); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Jun 25 06:14:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47A9115C1655; Tue, 25 Jun 2019 06:14: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CEA1972A26; Tue, 25 Jun 2019 06:14: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 0339DC710; Tue, 25 Jun 2019 06:14:12 +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 x5P6EBBb062300; Tue, 25 Jun 2019 06:14:11 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P6EBOY062299; Tue, 25 Jun 2019 06:14:11 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906250614.x5P6EBOY062299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Jun 2019 06:14:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349356 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349356 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CEA1972A26 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 06:14:19 -0000 Author: imp Date: Tue Jun 25 06:14:11 2019 New Revision: 349356 URL: https://svnweb.freebsd.org/changeset/base/349356 Log: Replay r349336 by scottl accidentally reverted by r349352 Add a section about the HD Audio module support Modified: head/usr.sbin/bhyve/bhyve.8 Modified: head/usr.sbin/bhyve/bhyve.8 ============================================================================== --- head/usr.sbin/bhyve/bhyve.8 Tue Jun 25 06:14:05 2019 (r349355) +++ head/usr.sbin/bhyve/bhyve.8 Tue Jun 25 06:14:11 2019 (r349356) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 11, 2018 +.Dd June 24, 2019 .Dt BHYVE 8 .Os .Sh NAME @@ -248,6 +248,8 @@ Raw framebuffer device attached to VNC server. eXtensible Host Controller Interface (xHCI) USB controller. .It Li nvme NVM Express (NVMe) controller. +.It Li hda +High Definition Audio Controller. .El .It Op Ar conf This optional parameter describes the backend for device emulations. @@ -474,6 +476,16 @@ Max number of concurrent I/O requests. Sector size (defaults to blockif sector size). .It Li ser Serial number with maximum 20 characters. +.El +.Pp +HD Audio devices: +.Bl -tag -width 10n +.It Li play +Playback device, typically +.Ar /dev/dsp0 . +.It Li rec +Recording device, typically +.Ar /dev/dsp0 . .El .El .It Fl S From owner-svn-src-head@freebsd.org Tue Jun 25 06:14:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B06E415C165B; Tue, 25 Jun 2019 06:14: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D82672A74; Tue, 25 Jun 2019 06:14: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 1007DC712; Tue, 25 Jun 2019 06:14: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 x5P6EGKB062354; Tue, 25 Jun 2019 06:14:16 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P6EGjR062353; Tue, 25 Jun 2019 06:14:16 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906250614.x5P6EGjR062353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Jun 2019 06:14:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349357 - head/sys/cam/ata X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/ata X-SVN-Commit-Revision: 349357 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3D82672A74 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 06:14:20 -0000 Author: imp Date: Tue Jun 25 06:14:16 2019 New Revision: 349357 URL: https://svnweb.freebsd.org/changeset/base/349357 Log: Replay r349339 by imp accidentally reverted by r349352 Go ahead and completely fix the ata_params before calling the veto function. This breaks nothing that uses it in the tree since ata_params is ignored in storvsc_ada_probe_veto which is the only in-tree consumer. Modified: head/sys/cam/ata/ata_xpt.c Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Tue Jun 25 06:14:11 2019 (r349356) +++ head/sys/cam/ata/ata_xpt.c Tue Jun 25 06:14:16 2019 (r349357) @@ -896,22 +896,14 @@ noerror: int16_t *ptr; int veto = 0; + /* + * Convert to host byte order, and fix the strings. + */ ident_buf = &softc->ident_data; for (ptr = (int16_t *)ident_buf; ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) { *ptr = le16toh(*ptr); } - - /* - * Allow others to veto this ATA disk attachment. This - * is mainly used by VMs, whose disk controllers may - * share the disks with the simulated ATA controllers. - */ - EVENTHANDLER_INVOKE(ada_probe_veto, path, ident_buf, &veto); - if (veto) { - goto device_fail; - } - if (strncmp(ident_buf->model, "FX", 2) && strncmp(ident_buf->model, "NEC", 3) && strncmp(ident_buf->model, "Pioneer", 7) && @@ -926,6 +918,17 @@ noerror: ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision)); ata_btrim(ident_buf->serial, sizeof(ident_buf->serial)); ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial)); + + /* + * Allow others to veto this ATA disk attachment. This + * is mainly used by VMs, whose disk controllers may + * share the disks with the simulated ATA controllers. + */ + EVENTHANDLER_INVOKE(ada_probe_veto, path, ident_buf, &veto); + if (veto) { + goto device_fail; + } + /* Device may need spin-up before IDENTIFY become valid. */ if ((ident_buf->specconf == 0x37c8 || ident_buf->specconf == 0x738c) && From owner-svn-src-head@freebsd.org Tue Jun 25 06:14:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 956D715C16C9; Tue, 25 Jun 2019 06:14:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19DF772B00; Tue, 25 Jun 2019 06:14:24 +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 8C318C714; Tue, 25 Jun 2019 06:14:22 +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 x5P6EMXV062412; Tue, 25 Jun 2019 06:14:22 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P6ELXa062408; Tue, 25 Jun 2019 06:14:21 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906250614.x5P6ELXa062408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Jun 2019 06:14:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349358 - in head/sys/cam: ata scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/cam: ata scsi X-SVN-Commit-Revision: 349358 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 19DF772B00 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 06:14:24 -0000 Author: imp Date: Tue Jun 25 06:14:21 2019 New Revision: 349358 URL: https://svnweb.freebsd.org/changeset/base/349358 Log: Replay r349340 by imp accidentally reverted by r349352 Create ata_param_fixup Create a common fixup routine to do the canonical fixup of the ata_param fixup. Call it from both the ATA and the ATA over SCSI paths. Modified: head/sys/cam/ata/ata_all.c head/sys/cam/ata/ata_all.h head/sys/cam/ata/ata_xpt.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/ata/ata_all.c ============================================================================== --- head/sys/cam/ata/ata_all.c Tue Jun 25 06:14:16 2019 (r349357) +++ head/sys/cam/ata/ata_all.c Tue Jun 25 06:14:21 2019 (r349358) @@ -1238,3 +1238,28 @@ ata_zac_mgmt_in(struct ccb_ataio *ataio, uint32_t retr ataio->aux = auxiliary; } } + +void +ata_param_fixup(struct ata_params *ident_buf) +{ + int16_t *ptr; + + for (ptr = (int16_t *)ident_buf; + ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) { + *ptr = le16toh(*ptr); + } + if (strncmp(ident_buf->model, "FX", 2) && + strncmp(ident_buf->model, "NEC", 3) && + strncmp(ident_buf->model, "Pioneer", 7) && + strncmp(ident_buf->model, "SHARP", 5)) { + ata_bswap(ident_buf->model, sizeof(ident_buf->model)); + ata_bswap(ident_buf->revision, sizeof(ident_buf->revision)); + ata_bswap(ident_buf->serial, sizeof(ident_buf->serial)); + } + ata_btrim(ident_buf->model, sizeof(ident_buf->model)); + ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model)); + ata_btrim(ident_buf->revision, sizeof(ident_buf->revision)); + ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision)); + ata_btrim(ident_buf->serial, sizeof(ident_buf->serial)); + ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial)); +} Modified: head/sys/cam/ata/ata_all.h ============================================================================== --- head/sys/cam/ata/ata_all.h Tue Jun 25 06:14:16 2019 (r349357) +++ head/sys/cam/ata/ata_all.h Tue Jun 25 06:14:21 2019 (r349358) @@ -135,6 +135,7 @@ void ata_read_log(struct ccb_ataio *ataio, uint32_t re uint16_t block_count, uint32_t protocol, uint8_t *data_ptr, uint32_t dxfer_len, uint32_t timeout); +void ata_param_fixup(struct ata_params *ident_buf); void ata_bswap(int8_t *buf, int len); void ata_btrim(int8_t *buf, int len); void ata_bpack(int8_t *src, int8_t *dst, int len); Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Tue Jun 25 06:14:16 2019 (r349357) +++ head/sys/cam/ata/ata_xpt.c Tue Jun 25 06:14:21 2019 (r349358) @@ -893,31 +893,13 @@ noerror: case PROBE_IDENTIFY: { struct ccb_pathinq cpi; - int16_t *ptr; int veto = 0; /* * Convert to host byte order, and fix the strings. */ ident_buf = &softc->ident_data; - for (ptr = (int16_t *)ident_buf; - ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) { - *ptr = le16toh(*ptr); - } - if (strncmp(ident_buf->model, "FX", 2) && - strncmp(ident_buf->model, "NEC", 3) && - strncmp(ident_buf->model, "Pioneer", 7) && - strncmp(ident_buf->model, "SHARP", 5)) { - ata_bswap(ident_buf->model, sizeof(ident_buf->model)); - ata_bswap(ident_buf->revision, sizeof(ident_buf->revision)); - ata_bswap(ident_buf->serial, sizeof(ident_buf->serial)); - } - ata_btrim(ident_buf->model, sizeof(ident_buf->model)); - ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model)); - ata_btrim(ident_buf->revision, sizeof(ident_buf->revision)); - ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision)); - ata_btrim(ident_buf->serial, sizeof(ident_buf->serial)); - ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial)); + ata_param_fixup(ident_buf); /* * Allow others to veto this ATA disk attachment. This Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Tue Jun 25 06:14:16 2019 (r349357) +++ head/sys/cam/scsi/scsi_da.c Tue Jun 25 06:14:21 2019 (r349358) @@ -5192,7 +5192,7 @@ dadone_probeata(struct cam_periph *periph, union ccb * struct da_softc *softc; u_int32_t priority; int continue_probe; - int error, i; + int error; int16_t *ptr; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dadone_probeata\n")); @@ -5210,8 +5210,7 @@ dadone_probeata(struct cam_periph *periph, union ccb * if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { uint16_t old_rate; - for (i = 0; i < sizeof(*ata_params) / 2; i++) - ptr[i] = le16toh(ptr[i]); + ata_param_fixup(ata_params); if (ata_params->support_dsm & ATA_SUPPORT_DSM_TRIM && (softc->quirks & DA_Q_NO_UNMAP) == 0) { dadeleteflag(softc, DA_DELETE_ATA_TRIM, 1); From owner-svn-src-head@freebsd.org Tue Jun 25 06:14:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A57A15C1712; Tue, 25 Jun 2019 06:14:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CC4872BA2; Tue, 25 Jun 2019 06:14:30 +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 7328EC715; Tue, 25 Jun 2019 06:14:27 +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 x5P6ERdw062466; Tue, 25 Jun 2019 06:14:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P6ERHA062465; Tue, 25 Jun 2019 06:14:27 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906250614.x5P6ERHA062465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Jun 2019 06:14:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349359 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 349359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1CC4872BA2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 06:14:30 -0000 Author: imp Date: Tue Jun 25 06:14:26 2019 New Revision: 349359 URL: https://svnweb.freebsd.org/changeset/base/349359 Log: Replay r349341 by imp accidentally reverted by r349352 Use ata_param_fixup instead of a custom copy here Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Tue Jun 25 06:14:21 2019 (r349358) +++ head/sbin/camcontrol/camcontrol.c Tue Jun 25 06:14:26 2019 (r349359) @@ -2326,9 +2326,11 @@ ata_do_identify(struct cam_device *device, int retry_c } } + ident_buf = (struct ata_params *)ptr; + ata_param_fixup(ident_buf); + error = 1; for (i = 0; i < sizeof(struct ata_params) / 2; i++) { - ptr[i] = le16toh(ptr[i]); if (ptr[i] != 0) error = 0; } @@ -2345,26 +2347,6 @@ ata_do_identify(struct cam_device *device, int retry_c free(ptr); return (error); } - - ident_buf = (struct ata_params *)ptr; - if (strncmp(ident_buf->model, "FX", 2) && - strncmp(ident_buf->model, "NEC", 3) && - strncmp(ident_buf->model, "Pioneer", 7) && - strncmp(ident_buf->model, "SHARP", 5)) { - ata_bswap(ident_buf->model, sizeof(ident_buf->model)); - ata_bswap(ident_buf->revision, sizeof(ident_buf->revision)); - ata_bswap(ident_buf->serial, sizeof(ident_buf->serial)); - ata_bswap(ident_buf->media_serial, sizeof(ident_buf->media_serial)); - } - ata_btrim(ident_buf->model, sizeof(ident_buf->model)); - ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model)); - ata_btrim(ident_buf->revision, sizeof(ident_buf->revision)); - ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision)); - ata_btrim(ident_buf->serial, sizeof(ident_buf->serial)); - ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial)); - ata_btrim(ident_buf->media_serial, sizeof(ident_buf->media_serial)); - ata_bpack(ident_buf->media_serial, ident_buf->media_serial, - sizeof(ident_buf->media_serial)); *ident_bufp = ident_buf; From owner-svn-src-head@freebsd.org Tue Jun 25 06:14:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 039E315C1757; Tue, 25 Jun 2019 06:14:36 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9929A72C44; Tue, 25 Jun 2019 06:14:35 +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 023F9C716; Tue, 25 Jun 2019 06:14:32 +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 x5P6EVRQ062520; Tue, 25 Jun 2019 06:14:31 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P6EVrN062519; Tue, 25 Jun 2019 06:14:31 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906250614.x5P6EVrN062519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Jun 2019 06:14:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349360 - 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: 349360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9929A72C44 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 06:14:36 -0000 Author: imp Date: Tue Jun 25 06:14:31 2019 New Revision: 349360 URL: https://svnweb.freebsd.org/changeset/base/349360 Log: Replay r349342 by imp accidentally reverted by r349352 Use the cam_ed copy of ata_params rather than malloc and freeing memory for it. This reaches into internal bits of xpt a little, and I'll clean that up later. Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Tue Jun 25 06:14:26 2019 (r349359) +++ head/sys/cam/scsi/scsi_da.c Tue Jun 25 06:14:31 2019 (r349360) @@ -64,6 +64,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef _KERNEL +#include +#endif /* _KERNEL */ #include #include @@ -3613,16 +3616,8 @@ out: break; } - ata_params = (struct ata_params*) - malloc(sizeof(*ata_params), M_SCSIDA,M_NOWAIT|M_ZERO); + ata_params = &periph->path->device->ident_data; - if (ata_params == NULL) { - xpt_print(periph->path, "Couldn't malloc ata_params " - "data\n"); - /* da_free_periph??? */ - break; - } - scsi_ata_identify(&start_ccb->csio, /*retries*/da_retry_count, /*cbfcnp*/dadone_probeata, @@ -5294,7 +5289,6 @@ dadone_probeata(struct cam_periph *periph, union ccb * } } - free(ata_params, M_SCSIDA); if ((softc->zone_mode == DA_ZONE_HOST_AWARE) || (softc->zone_mode == DA_ZONE_HOST_MANAGED)) { /* From owner-svn-src-head@freebsd.org Tue Jun 25 06:21:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D5A615C1D61 for ; Tue, 25 Jun 2019 06:21:37 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D6040735C0 for ; Tue, 25 Jun 2019 06:21:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x733.google.com with SMTP id l128so11693573qke.2 for ; Mon, 24 Jun 2019 23:21:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vsLhbqy7eJX8FP/iZsR2j3KazmUDFMQz6SarA0qgVIY=; b=0jNp4WMPZ99Kp4AwMpWTvXhOTjc7eN/3XESzruGBmNP2YtsTwdF8JVLo/kW3SRe0RA Ug7AZJfaONscyyvy0+8Nn4azB7Bu1jqreJjthcjUKEcsnsxjdI1tps6D4HS/dHJ202WH qtwd0PLflwLItwDD2IhCmfCmiFW0EzijjPPwWK/ND1NWF0nc//NVcEJFuBQ/xK4eHuME c+9wL0RfryQYWHX0y0FeIYh7gzTcCC+aJdwWHk7+YeXQ6/lxTrE4o3Z5f4dZayNemBIq j3VdyI4SafAGMsdNnamPbvk5Gy5mXJpAuoP1/KJ8VDryfh6f0w8j9K8oqKh8RjekRV5t ttLw== 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=vsLhbqy7eJX8FP/iZsR2j3KazmUDFMQz6SarA0qgVIY=; b=sUPrzOvTgTZDj+plJH79k/2JAarx5DXgXCMROU8yElbNZDnjxKpV7uPGSetoRIln6r uHqVs2hYyajTtFy8+EdFBMXFhIVXV7/Xs9nKxtvH7B+xJZKwrMUY5Xi5LcekG3/FMD1z brMIGmKqx09gcftcA91MyQjEKFjRXuRpwc2I57/ZJtjHZV1JNbQEVXYwPwBeOkn7SiOc 2mjV07BQvKIl23Bwc7RnSA4+iRjQZl1/byDJ3U9pKpjcns2zexcOTFKXbo407EjBld4J BIHekV5x+5bHmXFFQQ/hGVf100nnGkOYLfhwTglQ29fujos7eHttCo82U7KAsyU7OTgR lPWQ== X-Gm-Message-State: APjAAAWyar1F4neav8K55hL7kcPEbo39yuojFHBAyab0ZKHQotqEdcdS LRAMO9b7ZjvtD/WTSZ1DO/wbTv6eYJfw6I1FgSrFQw== X-Google-Smtp-Source: APXvYqyMWeoYtcbouuAjPBRnow9L5ynJoDkYDb9T1Fv8Zup8wh1EsMyq9+430b/nueLIYnJPaDuZJ3eV7mR378b/U5c= X-Received: by 2002:a37:9307:: with SMTP id v7mr20323348qkd.495.1561443696209; Mon, 24 Jun 2019 23:21:36 -0700 (PDT) MIME-Version: 1.0 References: <201906250450.x5P4o9oR015946@repo.freebsd.org> In-Reply-To: <201906250450.x5P4o9oR015946@repo.freebsd.org> From: Warner Losh Date: Tue, 25 Jun 2019 00:21:25 -0600 Message-ID: Subject: Re: svn commit: r349352 - in head: etc/mtree include lib lib/libnandfs sbin sbin/camcontrol sbin/nandfs sbin/newfs_nandfs share/man/man4 share/man/man5 share/mk stand stand/arm/uboot stand/common stand... To: Warner Losh Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: D6040735C0 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-7.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-1.00)[-0.996,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 06:21:37 -0000 This commit accidentally reverted r349333, r349334, r349335, r349336, r349339, r349340, r349341 and r349342. I rebased after one of the make universes I did to proof this set and something must have gone wrong and I lost these changes. I noticed while committing, but didn't hit ^C fast enough to prevent the damage it seems. I've reapplied those changes rather than revert this commit for two reasons: first, reverting commits that delete things has caused me trouble in the past. Second, I judge that to be less repo-churn than doing the revert, then redoing the nand* removal. Time was of the essence, so I hope my snap-judgement was sound. My apologies both for the 'oops' and for any other fallout. Warner On Mon, Jun 24, 2019 at 10:50 PM Warner Losh wrote: > Author: imp > Date: Tue Jun 25 04:50:09 2019 > New Revision: 349352 > URL: https://svnweb.freebsd.org/changeset/base/349352 > > Log: > Remove NAND and NANDFS support > > NANDFS has been broken for years. Remove it. The NAND drivers that > remain are for ancient parts that are no longer relevant. They are > polled, have terrible performance and just for ancient arm > hardware. NAND parts have evolved significantly from this early work > and little to none of it would be relevant should someone need to > update to support raw nand. This code has been off by default for > years and has violated the vnode protocol leading to panics since it > was committed. > > Numerous posts to arch@ and other locations have found no actual users > for this software. > > Relnotes: Yes > No Objection From: arch@ > Differential Revision: https://reviews.freebsd.org/D20745 > ... From owner-svn-src-head@freebsd.org Tue Jun 25 06:24:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24C8515C1E31; Tue, 25 Jun 2019 06:24:59 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB985737DA; Tue, 25 Jun 2019 06:24:58 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B059C8B4; Tue, 25 Jun 2019 06:24:58 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5P6Owo7068104; Tue, 25 Jun 2019 06:24:58 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P6OvB3068098; Tue, 25 Jun 2019 06:24:57 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201906250624.x5P6OvB3068098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Tue, 25 Jun 2019 06:24:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349361 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: araujo X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349361 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BB985737DA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 06:24:59 -0000 Author: araujo Date: Tue Jun 25 06:24:56 2019 New Revision: 349361 URL: https://svnweb.freebsd.org/changeset/base/349361 Log: Add SPDX tags to bhyve(8) HD Audio device. Reviewed by: bcran Differential Revision: https://reviews.freebsd.org/D20750 Replaced: head/usr.sbin/bhyve/audio.c - copied, changed from r349351, head/usr.sbin/bhyve/audio.c head/usr.sbin/bhyve/audio.h - copied, changed from r349351, head/usr.sbin/bhyve/audio.h head/usr.sbin/bhyve/hda_codec.c - copied, changed from r349351, head/usr.sbin/bhyve/hda_codec.c head/usr.sbin/bhyve/hda_reg.h - copied, changed from r349351, head/usr.sbin/bhyve/hda_reg.h head/usr.sbin/bhyve/hdac_reg.h - copied, changed from r349351, head/usr.sbin/bhyve/hdac_reg.h head/usr.sbin/bhyve/pci_hda.c - copied, changed from r349351, head/usr.sbin/bhyve/pci_hda.c head/usr.sbin/bhyve/pci_hda.h - copied, changed from r349351, head/usr.sbin/bhyve/pci_hda.h Copied and modified: head/usr.sbin/bhyve/audio.c (from r349351, head/usr.sbin/bhyve/audio.c) ============================================================================== --- head/usr.sbin/bhyve/audio.c Tue Jun 25 02:35:22 2019 (r349351, copy source) +++ head/usr.sbin/bhyve/audio.c Tue Jun 25 06:24:56 2019 (r349361) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016 Alex Teaca * All rights reserved. * Copied and modified: head/usr.sbin/bhyve/audio.h (from r349351, head/usr.sbin/bhyve/audio.h) ============================================================================== --- head/usr.sbin/bhyve/audio.h Tue Jun 25 02:35:22 2019 (r349351, copy source) +++ head/usr.sbin/bhyve/audio.h Tue Jun 25 06:24:56 2019 (r349361) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016 Alex Teaca * All rights reserved. * Copied and modified: head/usr.sbin/bhyve/hda_codec.c (from r349351, head/usr.sbin/bhyve/hda_codec.c) ============================================================================== --- head/usr.sbin/bhyve/hda_codec.c Tue Jun 25 02:35:22 2019 (r349351, copy source) +++ head/usr.sbin/bhyve/hda_codec.c Tue Jun 25 06:24:56 2019 (r349361) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016 Alex Teaca * All rights reserved. * Copied and modified: head/usr.sbin/bhyve/hda_reg.h (from r349351, head/usr.sbin/bhyve/hda_reg.h) ============================================================================== --- head/usr.sbin/bhyve/hda_reg.h Tue Jun 25 02:35:22 2019 (r349351, copy source) +++ head/usr.sbin/bhyve/hda_reg.h Tue Jun 25 06:24:56 2019 (r349361) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 Stephane E. Potvin * All rights reserved. * Copied and modified: head/usr.sbin/bhyve/hdac_reg.h (from r349351, head/usr.sbin/bhyve/hdac_reg.h) ============================================================================== --- head/usr.sbin/bhyve/hdac_reg.h Tue Jun 25 02:35:22 2019 (r349351, copy source) +++ head/usr.sbin/bhyve/hdac_reg.h Tue Jun 25 06:24:56 2019 (r349361) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006 Stephane E. Potvin * All rights reserved. * Copied and modified: head/usr.sbin/bhyve/pci_hda.c (from r349351, head/usr.sbin/bhyve/pci_hda.c) ============================================================================== --- head/usr.sbin/bhyve/pci_hda.c Tue Jun 25 02:35:22 2019 (r349351, copy source) +++ head/usr.sbin/bhyve/pci_hda.c Tue Jun 25 06:24:56 2019 (r349361) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016 Alex Teaca * All rights reserved. * Copied and modified: head/usr.sbin/bhyve/pci_hda.h (from r349351, head/usr.sbin/bhyve/pci_hda.h) ============================================================================== --- head/usr.sbin/bhyve/pci_hda.h Tue Jun 25 02:35:22 2019 (r349351, copy source) +++ head/usr.sbin/bhyve/pci_hda.h Tue Jun 25 06:24:56 2019 (r349361) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016 Alex Teaca * All rights reserved. * From owner-svn-src-head@freebsd.org Tue Jun 25 07:04:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1409215C2BC8; Tue, 25 Jun 2019 07:04:49 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A11B274F0A; Tue, 25 Jun 2019 07:04:48 +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 6D332CF60; Tue, 25 Jun 2019 07:04:48 +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 x5P74mUg089035; Tue, 25 Jun 2019 07:04:48 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P74mT4089034; Tue, 25 Jun 2019 07:04:48 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201906250704.x5P74mT4089034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 25 Jun 2019 07:04:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349362 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349362 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A11B274F0A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 07:04:49 -0000 Author: cy Date: Tue Jun 25 07:04:47 2019 New Revision: 349362 URL: https://svnweb.freebsd.org/changeset/base/349362 Log: The definition of icmptypes in ip_compt.h is dead code as it already use the icmptypes in ip_icmp.h. MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/ip_compat.h Modified: head/sys/contrib/ipfilter/netinet/ip_compat.h ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_compat.h Tue Jun 25 06:24:56 2019 (r349361) +++ head/sys/contrib/ipfilter/netinet/ip_compat.h Tue Jun 25 07:04:47 2019 (r349362) @@ -829,159 +829,9 @@ typedef struct tcpiphdr tcpiphdr_t; #undef IPOPT_AH #define IPOPT_AH 256+IPPROTO_AH -#ifndef ICMP_MINLEN -# define ICMP_MINLEN 8 -#endif -#ifndef ICMP_ECHOREPLY -# define ICMP_ECHOREPLY 0 -#endif -#ifndef ICMP_UNREACH -# define ICMP_UNREACH 3 -#endif -#ifndef ICMP_UNREACH_NET -# define ICMP_UNREACH_NET 0 -#endif -#ifndef ICMP_UNREACH_HOST -# define ICMP_UNREACH_HOST 1 -#endif -#ifndef ICMP_UNREACH_PROTOCOL -# define ICMP_UNREACH_PROTOCOL 2 -#endif -#ifndef ICMP_UNREACH_PORT -# define ICMP_UNREACH_PORT 3 -#endif -#ifndef ICMP_UNREACH_NEEDFRAG -# define ICMP_UNREACH_NEEDFRAG 4 -#endif -#ifndef ICMP_UNREACH_SRCFAIL -# define ICMP_UNREACH_SRCFAIL 5 -#endif -#ifndef ICMP_UNREACH_NET_UNKNOWN -# define ICMP_UNREACH_NET_UNKNOWN 6 -#endif -#ifndef ICMP_UNREACH_HOST_UNKNOWN -# define ICMP_UNREACH_HOST_UNKNOWN 7 -#endif -#ifndef ICMP_UNREACH_ISOLATED -# define ICMP_UNREACH_ISOLATED 8 -#endif -#ifndef ICMP_UNREACH_NET_PROHIB -# define ICMP_UNREACH_NET_PROHIB 9 -#endif -#ifndef ICMP_UNREACH_HOST_PROHIB -# define ICMP_UNREACH_HOST_PROHIB 10 -#endif -#ifndef ICMP_UNREACH_TOSNET -# define ICMP_UNREACH_TOSNET 11 -#endif -#ifndef ICMP_UNREACH_TOSHOST -# define ICMP_UNREACH_TOSHOST 12 -#endif -#ifndef ICMP_UNREACH_ADMIN_PROHIBIT -# define ICMP_UNREACH_ADMIN_PROHIBIT 13 -#endif -#ifndef ICMP_UNREACH_FILTER -# define ICMP_UNREACH_FILTER 13 -#endif -#ifndef ICMP_UNREACH_HOST_PRECEDENCE -# define ICMP_UNREACH_HOST_PRECEDENCE 14 -#endif -#ifndef ICMP_UNREACH_PRECEDENCE_CUTOFF -# define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 -#endif -#ifndef ICMP_SOURCEQUENCH -# define ICMP_SOURCEQUENCH 4 -#endif -#ifndef ICMP_REDIRECT_NET -# define ICMP_REDIRECT_NET 0 -#endif -#ifndef ICMP_REDIRECT_HOST -# define ICMP_REDIRECT_HOST 1 -#endif -#ifndef ICMP_REDIRECT_TOSNET -# define ICMP_REDIRECT_TOSNET 2 -#endif -#ifndef ICMP_REDIRECT_TOSHOST -# define ICMP_REDIRECT_TOSHOST 3 -#endif -#ifndef ICMP_ALTHOSTADDR -# define ICMP_ALTHOSTADDR 6 -#endif -#ifndef ICMP_TIMXCEED -# define ICMP_TIMXCEED 11 -#endif -#ifndef ICMP_TIMXCEED_INTRANS -# define ICMP_TIMXCEED_INTRANS 0 -#endif -#ifndef ICMP_TIMXCEED_REASS -# define ICMP_TIMXCEED_REASS 1 -#endif -#ifndef ICMP_PARAMPROB -# define ICMP_PARAMPROB 12 -#endif -#ifndef ICMP_PARAMPROB_ERRATPTR -# define ICMP_PARAMPROB_ERRATPTR 0 -#endif -#ifndef ICMP_PARAMPROB_OPTABSENT -# define ICMP_PARAMPROB_OPTABSENT 1 -#endif -#ifndef ICMP_PARAMPROB_LENGTH -# define ICMP_PARAMPROB_LENGTH 2 -#endif -#ifndef ICMP_TSTAMP -# define ICMP_TSTAMP 13 -#endif -#ifndef ICMP_TSTAMPREPLY -# define ICMP_TSTAMPREPLY 14 -#endif -#ifndef ICMP_IREQ -# define ICMP_IREQ 15 -#endif -#ifndef ICMP_IREQREPLY -# define ICMP_IREQREPLY 16 -#endif -#ifndef ICMP_MASKREQ -# define ICMP_MASKREQ 17 -#endif -#ifndef ICMP_MASKREPLY -# define ICMP_MASKREPLY 18 -#endif -#ifndef ICMP_TRACEROUTE -# define ICMP_TRACEROUTE 30 -#endif -#ifndef ICMP_DATACONVERR -# define ICMP_DATACONVERR 31 -#endif -#ifndef ICMP_MOBILE_REDIRECT -# define ICMP_MOBILE_REDIRECT 32 -#endif -#ifndef ICMP_IPV6_WHEREAREYOU -# define ICMP_IPV6_WHEREAREYOU 33 -#endif -#ifndef ICMP_IPV6_IAMHERE -# define ICMP_IPV6_IAMHERE 34 -#endif -#ifndef ICMP_MOBILE_REGREQUEST -# define ICMP_MOBILE_REGREQUEST 35 -#endif -#ifndef ICMP_MOBILE_REGREPLY -# define ICMP_MOBILE_REGREPLY 36 -#endif -#ifndef ICMP_SKIP -# define ICMP_SKIP 39 -#endif -#ifndef ICMP_PHOTURIS -# define ICMP_PHOTURIS 40 -#endif -#ifndef ICMP_PHOTURIS_UNKNOWN_INDEX -# define ICMP_PHOTURIS_UNKNOWN_INDEX 1 -#endif -#ifndef ICMP_PHOTURIS_AUTH_FAILED -# define ICMP_PHOTURIS_AUTH_FAILED 2 -#endif -#ifndef ICMP_PHOTURIS_DECRYPT_FAILED -# define ICMP_PHOTURIS_DECRYPT_FAILED 3 -#endif +# define ICMP_UNREACH_ADMIN_PROHIBIT ICMP_UNREACH_FILTER_PROHIB +# define ICMP_UNREACH_FILTER ICMP_UNREACH_FILTER_PROHIB + #ifndef IPVERSION # define IPVERSION 4 #endif From owner-svn-src-head@freebsd.org Tue Jun 25 07:44:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A9C715C3A9B; Tue, 25 Jun 2019 07:44:38 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B50FB76459; Tue, 25 Jun 2019 07:44:37 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EDFCD5F8; Tue, 25 Jun 2019 07:44:37 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5P7ibG0009950; Tue, 25 Jun 2019 07:44:37 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P7ibLv009949; Tue, 25 Jun 2019 07:44:37 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201906250744.x5P7ibLv009949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Tue, 25 Jun 2019 07:44:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349363 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 349363 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B50FB76459 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 07:44:38 -0000 Author: dougm Date: Tue Jun 25 07:44:37 2019 New Revision: 349363 URL: https://svnweb.freebsd.org/changeset/base/349363 Log: vm_map_protect may return an INVALID_ARGUMENT or PROTECTION_FAILURE error response after clipping the first map entry in the region to be reserved. This creates a pair of matching entries that should have been "simplified" back into one, or never created. This change defers the clipping of that entry until those two vm_map_protect failure cases have been ruled out. Reviewed by: alc Approved by: markj (mentor) Differential Revision: https://reviews.freebsd.org/D20711 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Tue Jun 25 07:04:47 2019 (r349362) +++ head/sys/vm/vm_map.c Tue Jun 25 07:44:37 2019 (r349363) @@ -2472,11 +2472,8 @@ again: VM_MAP_RANGE_CHECK(map, start, end); - if (vm_map_lookup_entry(map, start, &entry)) { - vm_map_clip_start(map, entry, start); - } else { + if (!vm_map_lookup_entry(map, start, &entry)) entry = entry->next; - } /* * Make a first pass to check for protection violations. @@ -2515,6 +2512,7 @@ again: * now will do cow due to allowed write (e.g. debugger sets * breakpoint on text segment) */ + vm_map_clip_start(map, entry, start); for (current = entry; current->start < end; current = current->next) { vm_map_clip_end(map, current, end); From owner-svn-src-head@freebsd.org Tue Jun 25 08:01:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8ECBE15C4199; Tue, 25 Jun 2019 08:01:36 +0000 (UTC) (envelope-from dougm@rice.edu) Received: from mx0a-0010f301.pphosted.com (mx0a-0010f301.pphosted.com [148.163.149.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.pphosted.com", Issuer "Thawte RSA CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 124A676BA6; Tue, 25 Jun 2019 08:01:35 +0000 (UTC) (envelope-from dougm@rice.edu) Received: from pps.filterd (m0102856.ppops.net [127.0.0.1]) by mx0b-0010f301.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5P7l8Y5010970; Tue, 25 Jun 2019 02:47:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rice.edu; h=subject : to : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=ricemail; bh=W+2qOlHxWsb2SGPdAYVz5w42hNFlPcciWxfezAHaXsc=; b=JgUs86n6MHnTQBX38K2ezKbl31au6328G5Y8scudqHwu4UFY5fqp0Tf0jbU/K8ys9fYK uZIY7MjLlYZ/BTLKpywTI5o3npNx7ogzRLXWiKh9xvOl657u7IJayluKQQifWf8aPHuV /iOWTQFookzQduqT253j7Sr5Q3BrmOBlJHJWfRLiP8qhSe9qYHv5m/lzAVLcjwAGOtL+ o2jCFfoeJRqRqWI2vHEEiK47Upb467+Mrfar+5GtlEUxSlm6L9AkB7XnUsoHkU60i4K0 EUNI6MYUffukI9fbC2Nm7B8H3KGS+yWorkxj8MKhpQKQKngo7eBEs8jo0zUk2RQVgBr2 Jw== Received: from mh1.mail.rice.edu (mh1.mail.rice.edu [128.42.201.20]) by mx0b-0010f301.pphosted.com with ESMTP id 2t9hf32wkf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Jun 2019 02:47:07 -0500 Received-X: from mh1.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh1.mail.rice.edu (Postfix) with ESMTP id 0C72F460D77; Tue, 25 Jun 2019 02:47:07 -0500 (CDT) Received-X: from mh1.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh1.mail.rice.edu (Postfix) with ESMTP id 0ADC2460D6E; Tue, 25 Jun 2019 02:47:07 -0500 (CDT) X-Virus-Scanned: by amavis-2.7.0 at mh1.mail.rice.edu, auth channel Received-X: from mh1.mail.rice.edu ([127.0.0.1]) by mh1.mail.rice.edu (mh1.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id iI9RUYSdNTHe; Tue, 25 Jun 2019 02:47:06 -0500 (CDT) Received: from 108-254-203-202.lightspeed.hstntx.sbcglobal.net (108-254-203-202.lightspeed.hstntx.sbcglobal.net [108.254.203.202]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: dougm) by mh1.mail.rice.edu (Postfix) with ESMTPSA id AC313460D6A; Tue, 25 Jun 2019 02:47:06 -0500 (CDT) Subject: Re: svn commit: r349363 - head/sys/vm To: Doug Moore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201906250744.x5P7ibLv009949@repo.freebsd.org> From: Doug Moore Openpgp: preference=signencrypt Autocrypt: addr=dougm@rice.edu; keydata= mQENBFy53VQBCAD2UiGSouAAMcSIax5Sp9JtRSd9dYVuAmSraY7x5yOylq8yJ5IDvHZy5q3a FamaCHMpXxieiD/8yTnHIeHP4bg02oDD3ALs0hMAEz00pZlLdxeXRfDzAlMTqFF6USPjDUI8 J/WH+pciNT68bFVXFYVg+bgp4GIdi2Md8X8zQQnHY0xLyKE9FjVN1MlCk+62B6fFhMQIEvd5 RQdbGd+ljuoORD1ajljwP1waXKBfAN5RnIbAXppokgQvnwNRf1eZ7GnqSiwu0eaTHGBatPgr y2v5N19R5WxP2kiN95xdlJEwdUikAhWO1UncDxvXQoM1e68L/J85JSLLIgzuywKpBBtdABEB AAG0IERvdWdsYXMgVyBNb29yZSA8ZG91Z21AcmljZS5lZHU+iQFUBBMBCAA+FiEEeV41MZJW A65Cl96D6I8hU9O51W4FAly53VQCGwMFCQWjmoAFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AA CgkQ6I8hU9O51W58mgf8D9xOhD9/nqtHKUBDJz/m5DLzLyQVci6RrRFK9hSyQ1QdkG4VvvRL G1MpjsM16f42N41lf9Zhln7ydwpeUVNeGwwZu2S4EiSPOEhGpNOYC1lRjsD5ai9aZwzHcrAz 2PnyWxNJNEawrVdPUOaVlE+uzYe1048FaaB5tmYtooWZm5RZx6YBKSbWyWI8OvEO9BRlcwjr ErOlVlW3TNLpBGyvXYMAseWEozzsdaVbsekw6+7atIUYh6z9oBZXmClVdcpLF5/rtYhjwIIE 7AlWyt9tEJjRhA+2ujfbm96IrL5J8Da557IhjfslB8KcWGT+ynA5QzIrwidqllHMGsed4MAo RLkBDQRcud1UAQgA2xw6CEAjLMhRWjY86mW63fJ7WjMKUOoQS+0Z2yyUh2vI3oWWMgHbVlm2 7bclX+uidxABeh8gVxMcPX68ri1PsmXwDSNA93Jpm+dYwhugbvDZ5EEzn9ze3MNbGEEhx9j0 JYVmHOeSW7v2ia8H1ZxHIS3WzfKdsuFl0S34St9ojmkMzDNsRzZNvLF5wFeQ0cUI712OyBu3 E+T369rgIV6jwwwmbDI/YIWd2kMr6+6u40tbs70j7IpjluB3/XyaolcRdpDER9YUDXtSOL+/ UmhbQ10UrmIrxD1enqYn1gE8GOuv1P4zueU6qg8hc/wYPtggqR8smRjPQPn/OlcSxBnO4QAR AQABiQE8BBgBCAAmFiEEeV41MZJWA65Cl96D6I8hU9O51W4FAly53VQCGwwFCQWjmoAACgkQ 6I8hU9O51W5IYgf9ElaumHGMK89Y9ZQVJOwwlD1QC6DUoluIjYmudu6VkHRxrbE1VQohHAeu amaNA0qzLAL7RgkUs1HmyEOqJg0g51pm73l8pK97ztPqXEarCT0CnAE0atl43AY2TCjg+ANl zktrd4QDPqGOBfYbUCGPYJ7yukXU7cmnyaJx6XnjZDAuyhMDxkuocxVNJa32cV0NYqY9EDjo GfGaJjF20leX/BsGElCzDzlZgfWpNGQjqGuOdYdKNx43J654MO6HxSRT25j09s26VzpvT6rI c0wNdJ4CBE5tseI+YlbwhxGziQh/FEMnTSqxhWt1Ac6o9TqMQIIKoQhcekvT7EX5uvvOnLkB DQRcusvzAQgAvlC3Q5iWVbOxhZ6QXSiZ0p1SG19XZBo7tY5L4Pu6QPNsl/tIWbyDodMdz8vG rG36sRZXlcLOfZhhAHuWKUcoPpJ9H3deHrYZSK7H9LBvNm+0C8n/acRrkAZYch74A4HXlBpc +pMm1SfXufXm7TWII7hAvxpX/2+eaZppEl8eRf+JfNhK+34aYjoONp+wi6Jz/gMS7EfC+gIw jg3ncionUqKXHR/HR+kUzfQpiGEj0KvL0YgEawyzb1UB+D0Jb97OAiqj+s0jd4THS5S7b4He lDHcrlisUZNMtFoRmuG2fKCjwqOQ6+qNdjkhL8flHtkAUOu51WOR+kqAqKKRx6JnkQARAQAB iQLSBBgBCgAmFiEEeV41MZJWA65Cl96D6I8hU9O51W4FAly6y/MCGwIFCQWjmoABoAkQ6I8h U9O51W7A1CAEGQEKAH0WIQR+kHbQAKIFA/vka1CjtHtWP6FLrAUCXLrL818UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0N0U5MDc2RDAw MEEyMDUwM0ZCRTQ2QjUwQTNCNDdCNTYzRkExNEJBQwAKCRCjtHtWP6FLrKfwB/9JJhuW8pYI egq4N9O416AkIGb7U4WgfSxpn+e8qVL5368LdZ9BMe3CnEJ70gPtdvNPStdkJkeQ+tQHVPBw WkHaCxY9Kw4t+K2sYAGOeePmIhro/V2oDxCjHm/orr6r4XrQur+yvHl6qWliKMyKRSQphJcR jEp4AI/1epzp5ulw0sn4Gjgpp4zkEanuPblPukeu4G+1AeCflyR4D1pWvdQU6rL9zS3MFyDa j/ooh7YDC5qx9Y9HjYcTpPfkSzX9GG2XBmR3+3lo3CW1nAdd3tIBepkdEXEMQpZvPRFb9qfg jyE6V0wC6yG9fxF/TuG8/Trs3WZORa1gFDR0rQROvjHCc/UH/R7Pmbw4s7r/DTl9mGXikXQa VkrCkS99g5D67qerzA1S9SyH7d0iVy3PqFr8vNnwJtB7hjFx6uO2XG75h1CX50q3YYx0gd+U dwcM2GeP5SDQ0fdFoCsPjSTRK5oiD96D85VTbS7EJgF14wHcrBbqulUltE3JSVSIgYy4Jyr4 dF82pM8XWeaVaYAh8yoIDvud5UYRJECIC00VNG1W/wUJKmvIhsFIQXRneEoMvbMpDvP9QvAK WK7E+dYhu/eemFhteDTgbh16AbHcpwkwFWMEke/u393pzSsxKVCrYACxv7aY186fILDrQUpQ qJr40I2R31nvfny8tsCffMIvKtJ98Rw= Message-ID: <7a398e1a-4bd3-f18c-2b64-1f8987a63cd1@rice.edu> Date: Tue, 25 Jun 2019 02:47:06 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <201906250744.x5P7ibLv009949@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-25_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=405 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906250064 X-Rspamd-Queue-Id: 124A676BA6 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 08:01:36 -0000 I regret that I omitted the following from the commit message below: Tested by: pho Doug Moore On 6/25/19 2:44 AM, Doug Moore wrote: > Author: dougm > Date: Tue Jun 25 07:44:37 2019 > New Revision: 349363 > URL: https://svnweb.freebsd.org/changeset/base/349363 > > Log: > vm_map_protect may return an INVALID_ARGUMENT or PROTECTION_FAILURE > error response after clipping the first map entry in the region to be > reserved. This creates a pair of matching entries that should have > been "simplified" back into one, or never created. This change defers > the clipping of that entry until those two vm_map_protect failure > cases have been ruled out. > > Reviewed by: alc > Approved by: markj (mentor) > Differential Revision: https://reviews.freebsd.org/D20711 > > Modified: > head/sys/vm/vm_map.c > > Modified: head/sys/vm/vm_map.c > ============================================================================== > --- head/sys/vm/vm_map.c Tue Jun 25 07:04:47 2019 (r349362) > +++ head/sys/vm/vm_map.c Tue Jun 25 07:44:37 2019 (r349363) > @@ -2472,11 +2472,8 @@ again: > > VM_MAP_RANGE_CHECK(map, start, end); > > - if (vm_map_lookup_entry(map, start, &entry)) { > - vm_map_clip_start(map, entry, start); > - } else { > + if (!vm_map_lookup_entry(map, start, &entry)) > entry = entry->next; > - } > > /* > * Make a first pass to check for protection violations. > @@ -2515,6 +2512,7 @@ again: > * now will do cow due to allowed write (e.g. debugger sets > * breakpoint on text segment) > */ > + vm_map_clip_start(map, entry, start); > for (current = entry; current->start < end; current = current->next) { > > vm_map_clip_end(map, current, end); > From owner-svn-src-head@freebsd.org Tue Jun 25 09:08:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8168B15C57CC; Tue, 25 Jun 2019 09:08:25 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 289BE80EE5; Tue, 25 Jun 2019 09:08:25 +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 F2821E327; Tue, 25 Jun 2019 09:08:24 +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 x5P98ORe052108; Tue, 25 Jun 2019 09:08:24 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P98O3p052107; Tue, 25 Jun 2019 09:08:24 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201906250908.x5P98O3p052107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 25 Jun 2019 09:08:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349364 - head/sbin/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sbin/ipfw X-SVN-Commit-Revision: 349364 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 289BE80EE5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 09:08:25 -0000 Author: ae Date: Tue Jun 25 09:08:24 2019 New Revision: 349364 URL: https://svnweb.freebsd.org/changeset/base/349364 Log: Restore ipfw(8)'s compact output support broken after r331668. Also modify it a bit. Now -c option omits only 'from any to any' part and works for different protocols (not just for ip). Reported by: Dmitry Selivanov MFC after: 1 week Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Jun 25 07:44:37 2019 (r349363) +++ head/sbin/ipfw/ipfw2.c Tue Jun 25 09:08:24 2019 (r349364) @@ -2223,6 +2223,8 @@ show_static_rule(struct cmdline_opts *co, struct forma } print_proto(bp, fo, &state); + if (co->do_compact != 0 && (rule->flags & IPFW_RULE_NOOPT)) + goto justopts; /* Print source */ bprintf(bp, " from"); @@ -4395,6 +4397,8 @@ chkarg: } OR_BLOCK(get_proto); + first_cmd = cmd; /* update pointer to use in compact form */ + /* * "from", mandatory */ @@ -4466,6 +4470,8 @@ chkarg: cmd = next_cmd(cmd, &cblen); } } + if (first_cmd == cmd) + rule->flags |= IPFW_RULE_NOOPT; read_options: prev = NULL; From owner-svn-src-head@freebsd.org Tue Jun 25 09:11:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A77C215C588A; Tue, 25 Jun 2019 09:11:23 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C0CC81130; Tue, 25 Jun 2019 09:11:23 +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 27009E361; Tue, 25 Jun 2019 09:11:23 +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 x5P9BNqD052333; Tue, 25 Jun 2019 09:11:23 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5P9BNGr052332; Tue, 25 Jun 2019 09:11:23 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201906250911.x5P9BNGr052332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 25 Jun 2019 09:11:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349365 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 349365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4C0CC81130 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 09:11:23 -0000 Author: ae Date: Tue Jun 25 09:11:22 2019 New Revision: 349365 URL: https://svnweb.freebsd.org/changeset/base/349365 Log: Mark default rule with IPFW_RULE_NOOPT flag, so it can be showed in compact form. MFC after: 1 week Modified: head/sys/netpfil/ipfw/ip_fw2.c Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Tue Jun 25 09:08:24 2019 (r349364) +++ head/sys/netpfil/ipfw/ip_fw2.c Tue Jun 25 09:11:22 2019 (r349365) @@ -3364,6 +3364,7 @@ vnet_ipfw_init(const void *unused) /* fill and insert the default rule */ rule = ipfw_alloc_rule(chain, sizeof(struct ip_fw)); + rule->flags |= IPFW_RULE_NOOPT; rule->cmd_len = 1; rule->cmd[0].len = 1; rule->cmd[0].opcode = default_to_accept ? O_ACCEPT : O_DENY; From owner-svn-src-head@freebsd.org Tue Jun 25 11:40:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 028E415C9332; Tue, 25 Jun 2019 11:40:39 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9CBA2862A4; Tue, 25 Jun 2019 11:40:38 +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 77359FC94; Tue, 25 Jun 2019 11:40:38 +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 x5PBecsX030417; Tue, 25 Jun 2019 11:40:38 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PBectm030416; Tue, 25 Jun 2019 11:40:38 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201906251140.x5PBectm030416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 25 Jun 2019 11:40:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349366 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 349366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9CBA2862A4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 11:40:39 -0000 Author: ae Date: Tue Jun 25 11:40:37 2019 New Revision: 349366 URL: https://svnweb.freebsd.org/changeset/base/349366 Log: Follow the RFC 3128 and drop short TCP fragments with offset = 1. Reported by: emaste MFC after: 1 week Modified: head/sys/netpfil/ipfw/ip_fw2.c Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Tue Jun 25 09:11:22 2019 (r349365) +++ head/sys/netpfil/ipfw/ip_fw2.c Tue Jun 25 11:40:37 2019 (r349366) @@ -1719,6 +1719,11 @@ do { \ default: break; } + } else { + if (offset == 1 && proto == IPPROTO_TCP) { + /* RFC 3128 */ + goto pullup_failed; + } } UPDATE_POINTERS(); From owner-svn-src-head@freebsd.org Tue Jun 25 11:42:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0809315C95E0; Tue, 25 Jun 2019 11:42:55 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A4B7F866EB; Tue, 25 Jun 2019 11:42:54 +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 7F45FFE28; Tue, 25 Jun 2019 11:42:54 +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 x5PBgsSk035283; Tue, 25 Jun 2019 11:42:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PBgsdC035282; Tue, 25 Jun 2019 11:42:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201906251142.x5PBgsdC035282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 25 Jun 2019 11:42:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349367 - head/sys/fs/cuse X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/fs/cuse X-SVN-Commit-Revision: 349367 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A4B7F866EB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 11:42:55 -0000 Author: hselasky Date: Tue Jun 25 11:42:53 2019 New Revision: 349367 URL: https://svnweb.freebsd.org/changeset/base/349367 Log: Fix for deadlock situation in cuse(3) The final server unref should be done by the server thread to prevent deadlock in the client cdevpriv destructor, which cannot destroy itself. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/fs/cuse/cuse.c Modified: head/sys/fs/cuse/cuse.c ============================================================================== --- head/sys/fs/cuse/cuse.c Tue Jun 25 11:40:37 2019 (r349366) +++ head/sys/fs/cuse/cuse.c Tue Jun 25 11:42:53 2019 (r349367) @@ -699,12 +699,38 @@ cuse_server_unref(struct cuse_server *pcs) free(pcs, M_CUSE); } +static int +cuse_server_do_close(struct cuse_server *pcs) +{ + int retval; + + cuse_lock(); + cuse_server_is_closing(pcs); + /* final client wakeup, if any */ + cuse_server_wakeup_all_client_locked(pcs); + + knlist_clear(&pcs->selinfo.si_note, 1); + + retval = pcs->refs; + cuse_unlock(); + + return (retval); +} + static void cuse_server_free(void *arg) { struct cuse_server *pcs = arg; - /* drop refcount */ + /* + * The final server unref should be done by the server thread + * to prevent deadlock in the client cdevpriv destructor, + * which cannot destroy itself. + */ + while (cuse_server_do_close(pcs) != 1) + pause("W", hz); + + /* drop final refcount */ cuse_server_unref(pcs); } @@ -746,21 +772,10 @@ static int cuse_server_close(struct cdev *dev, int fflag, int devtype, struct thread *td) { struct cuse_server *pcs; - int error; - error = cuse_server_get(&pcs); - if (error != 0) - goto done; + if (cuse_server_get(&pcs) == 0) + cuse_server_do_close(pcs); - cuse_lock(); - cuse_server_is_closing(pcs); - /* final client wakeup, if any */ - cuse_server_wakeup_all_client_locked(pcs); - - knlist_clear(&pcs->selinfo.si_note, 1); - cuse_unlock(); - -done: return (0); } From owner-svn-src-head@freebsd.org Tue Jun 25 11:46:02 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A859D15C974D; Tue, 25 Jun 2019 11:46:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D509868C9; Tue, 25 Jun 2019 11:46:02 +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 1B591FE2A; Tue, 25 Jun 2019 11:46:02 +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 x5PBk16s035475; Tue, 25 Jun 2019 11:46:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PBk1fM035474; Tue, 25 Jun 2019 11:46:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201906251146.x5PBk1fM035474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 25 Jun 2019 11:46:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349368 - head/sys/fs/cuse X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/fs/cuse X-SVN-Commit-Revision: 349368 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4D509868C9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 11:46:02 -0000 Author: hselasky Date: Tue Jun 25 11:46:01 2019 New Revision: 349368 URL: https://svnweb.freebsd.org/changeset/base/349368 Log: Free all allocated unit IDs in cuse(3) after the client character devices have been destroyed to avoid creating character devices with identical name. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/fs/cuse/cuse.c Modified: head/sys/fs/cuse/cuse.c ============================================================================== --- head/sys/fs/cuse/cuse.c Tue Jun 25 11:42:53 2019 (r349367) +++ head/sys/fs/cuse/cuse.c Tue Jun 25 11:46:01 2019 (r349368) @@ -671,14 +671,14 @@ cuse_server_unref(struct cuse_server *pcs) TAILQ_REMOVE(&cuse_server_head, pcs, entry); - cuse_free_unit_by_id_locked(pcs, -1); - while ((pcsd = TAILQ_FIRST(&pcs->hdev)) != NULL) { TAILQ_REMOVE(&pcs->hdev, pcsd, entry); cuse_unlock(); cuse_server_free_dev(pcsd); cuse_lock(); } + + cuse_free_unit_by_id_locked(pcs, -1); while ((mem = TAILQ_FIRST(&pcs->hmem)) != NULL) { TAILQ_REMOVE(&pcs->hmem, mem, entry); From owner-svn-src-head@freebsd.org Tue Jun 25 11:54:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7D1115C9A2F; Tue, 25 Jun 2019 11:54: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9178586D84; Tue, 25 Jun 2019 11:54: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 5D460FFC8; Tue, 25 Jun 2019 11:54: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 x5PBshJb040364; Tue, 25 Jun 2019 11:54:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PBsg0I040358; Tue, 25 Jun 2019 11:54:42 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201906251154.x5PBsg0I040358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 25 Jun 2019 11:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349369 - in head/sys: net netinet netinet6 netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: net netinet netinet6 netpfil/pf X-SVN-Commit-Revision: 349369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9178586D84 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 11:54:44 -0000 Author: hselasky Date: Tue Jun 25 11:54:41 2019 New Revision: 349369 URL: https://svnweb.freebsd.org/changeset/base/349369 Log: Convert all IPv4 and IPv6 multicast memberships into using a STAILQ instead of a linear array. The multicast memberships for the inpcb structure are protected by a non-sleepable lock, INP_WLOCK(), which needs to be dropped when calling the underlying possibly sleeping if_ioctl() method. When using a linear array to keep track of multicast memberships, the computed memory location of the multicast filter may suddenly change, due to concurrent insertion or removal of elements in the linear array. This in turn leads to various invalid memory access issues and kernel panics. To avoid this problem, put all multicast memberships on a STAILQ based list. Then the memory location of the IPv4 and IPv6 multicast filters become fixed during their lifetime and use after free and memory leak issues are easier to track, for example by: vmstat -m | grep multi All list manipulation has been factored into inline functions including some macros, to easily allow for a future hash-list implementation, if needed. This patch has been tested by pho@ . Differential Revision: https://reviews.freebsd.org/D20080 Reviewed by: markj @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/net/if_vxlan.c head/sys/netinet/in.h head/sys/netinet/in_mcast.c head/sys/netinet/in_pcb.c head/sys/netinet/in_var.h head/sys/netinet/ip_carp.c head/sys/netinet/ip_mroute.c head/sys/netinet/ip_var.h head/sys/netinet6/in6.h head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_mcast.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_var.h head/sys/netinet6/ip6_var.h head/sys/netpfil/pf/if_pfsync.c Modified: head/sys/net/if_vxlan.c ============================================================================== --- head/sys/net/if_vxlan.c Tue Jun 25 11:46:01 2019 (r349368) +++ head/sys/net/if_vxlan.c Tue Jun 25 11:54:41 2019 (r349369) @@ -1134,7 +1134,7 @@ vxlan_socket_mc_join_group(struct vxlan_socket *vso, * If we really need to, we can of course look in the INP's * membership list: * sotoinpcb(vso->vxlso_sock)->inp_moptions-> - * imo_membership[]->inm_ifp + * imo_head[]->imf_inm->inm_ifp * similarly to imo_match_group(). */ source->in4.sin_addr = local->in4.sin_addr; Modified: head/sys/netinet/in.h ============================================================================== --- head/sys/netinet/in.h Tue Jun 25 11:46:01 2019 (r349368) +++ head/sys/netinet/in.h Tue Jun 25 11:54:41 2019 (r349369) @@ -505,13 +505,9 @@ __END_DECLS #define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ /* - * The imo_membership vector for each socket is now dynamically allocated at - * run-time, bounded by USHRT_MAX, and is reallocated when needed, sized - * according to a power-of-two increment. + * Limit for IPv4 multicast memberships */ -#define IP_MIN_MEMBERSHIPS 31 #define IP_MAX_MEMBERSHIPS 4095 -#define IP_MAX_SOURCE_FILTER 1024 /* XXX to be unused */ /* * Default resource limits for IPv4 multicast source filtering. Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Tue Jun 25 11:46:01 2019 (r349368) +++ head/sys/netinet/in_mcast.c Tue Jun 25 11:54:41 2019 (r349369) @@ -94,7 +94,9 @@ static MALLOC_DEFINE(M_IPMSOURCE, "ip_msource", /* * Locking: - * - Lock order is: Giant, INP_WLOCK, IN_MULTI_LIST_LOCK, IGMP_LOCK, IF_ADDR_LOCK. + * + * - Lock order is: Giant, IN_MULTI_LOCK, INP_WLOCK, + * IN_MULTI_LIST_LOCK, IGMP_LOCK, IF_ADDR_LOCK. * - The IF_ADDR_LOCK is implicitly taken by inm_lookup() earlier, however * it can be taken by code in net/if.c also. * - ip_moptions and in_mfilter are covered by the INP_WLOCK. @@ -144,12 +146,11 @@ static int imf_prune(struct in_mfilter *, const struct static void imf_purge(struct in_mfilter *); static void imf_rollback(struct in_mfilter *); static void imf_reap(struct in_mfilter *); -static int imo_grow(struct ip_moptions *); -static size_t imo_match_group(const struct ip_moptions *, +static struct in_mfilter * + imo_match_group(const struct ip_moptions *, const struct ifnet *, const struct sockaddr *); static struct in_msource * - imo_match_source(const struct ip_moptions *, const size_t, - const struct sockaddr *); + imo_match_source(struct in_mfilter *, const struct sockaddr *); static void ims_merge(struct ip_msource *ims, const struct in_msource *lims, const int rollback); static int in_getmulti(struct ifnet *, const struct in_addr *, @@ -333,6 +334,26 @@ imf_init(struct in_mfilter *imf, const int st0, const imf->imf_st[1] = st1; } +struct in_mfilter * +ip_mfilter_alloc(const int mflags, const int st0, const int st1) +{ + struct in_mfilter *imf; + + imf = malloc(sizeof(*imf), M_INMFILTER, mflags); + if (imf != NULL) + imf_init(imf, st0, st1); + + return (imf); +} + +void +ip_mfilter_free(struct in_mfilter *imf) +{ + + imf_purge(imf); + free(imf, M_INMFILTER); +} + /* * Function for looking up an in_multi record for an IPv4 multicast address * on a given interface. ifp must be valid. If no record found, return NULL. @@ -379,89 +400,30 @@ inm_lookup(struct ifnet *ifp, const struct in_addr ina } /* - * Resize the ip_moptions vector to the next power-of-two minus 1. - * May be called with locks held; do not sleep. - */ -static int -imo_grow(struct ip_moptions *imo) -{ - struct in_multi **nmships; - struct in_multi **omships; - struct in_mfilter *nmfilters; - struct in_mfilter *omfilters; - size_t idx; - size_t newmax; - size_t oldmax; - - nmships = NULL; - nmfilters = NULL; - omships = imo->imo_membership; - omfilters = imo->imo_mfilters; - oldmax = imo->imo_max_memberships; - newmax = ((oldmax + 1) * 2) - 1; - - if (newmax <= IP_MAX_MEMBERSHIPS) { - nmships = (struct in_multi **)realloc(omships, - sizeof(struct in_multi *) * newmax, M_IPMOPTS, M_NOWAIT); - nmfilters = (struct in_mfilter *)realloc(omfilters, - sizeof(struct in_mfilter) * newmax, M_INMFILTER, M_NOWAIT); - if (nmships != NULL && nmfilters != NULL) { - /* Initialize newly allocated source filter heads. */ - for (idx = oldmax; idx < newmax; idx++) { - imf_init(&nmfilters[idx], MCAST_UNDEFINED, - MCAST_EXCLUDE); - } - imo->imo_max_memberships = newmax; - imo->imo_membership = nmships; - imo->imo_mfilters = nmfilters; - } - } - - if (nmships == NULL || nmfilters == NULL) { - if (nmships != NULL) - free(nmships, M_IPMOPTS); - if (nmfilters != NULL) - free(nmfilters, M_INMFILTER); - return (ETOOMANYREFS); - } - - return (0); -} - -/* * Find an IPv4 multicast group entry for this ip_moptions instance * which matches the specified group, and optionally an interface. * Return its index into the array, or -1 if not found. */ -static size_t +static struct in_mfilter * imo_match_group(const struct ip_moptions *imo, const struct ifnet *ifp, const struct sockaddr *group) { const struct sockaddr_in *gsin; - struct in_multi **pinm; - int idx; - int nmships; + struct in_mfilter *imf; + struct in_multi *inm; gsin = (const struct sockaddr_in *)group; - /* The imo_membership array may be lazy allocated. */ - if (imo->imo_membership == NULL || imo->imo_num_memberships == 0) - return (-1); - - nmships = imo->imo_num_memberships; - pinm = &imo->imo_membership[0]; - for (idx = 0; idx < nmships; idx++, pinm++) { - if (*pinm == NULL) + IP_MFILTER_FOREACH(imf, &imo->imo_head) { + inm = imf->imf_inm; + if (inm == NULL) continue; - if ((ifp == NULL || ((*pinm)->inm_ifp == ifp)) && - in_hosteq((*pinm)->inm_addr, gsin->sin_addr)) { + if ((ifp == NULL || (inm->inm_ifp == ifp)) && + in_hosteq(inm->inm_addr, gsin->sin_addr)) { break; } } - if (idx >= nmships) - idx = -1; - - return (idx); + return (imf); } /* @@ -472,23 +434,14 @@ imo_match_group(const struct ip_moptions *imo, const s * it exists, which may not be the desired behaviour. */ static struct in_msource * -imo_match_source(const struct ip_moptions *imo, const size_t gidx, - const struct sockaddr *src) +imo_match_source(struct in_mfilter *imf, const struct sockaddr *src) { struct ip_msource find; - struct in_mfilter *imf; struct ip_msource *ims; const sockunion_t *psa; KASSERT(src->sa_family == AF_INET, ("%s: !AF_INET", __func__)); - KASSERT(gidx != -1 && gidx < imo->imo_num_memberships, - ("%s: invalid index %d\n", __func__, (int)gidx)); - /* The imo_mfilters array may be lazy allocated. */ - if (imo->imo_mfilters == NULL) - return (NULL); - imf = &imo->imo_mfilters[gidx]; - /* Source trees are keyed in host byte order. */ psa = (const sockunion_t *)src; find.ims_haddr = ntohl(psa->sin.sin_addr.s_addr); @@ -507,14 +460,14 @@ int imo_multi_filter(const struct ip_moptions *imo, const struct ifnet *ifp, const struct sockaddr *group, const struct sockaddr *src) { - size_t gidx; + struct in_mfilter *imf; struct in_msource *ims; int mode; KASSERT(ifp != NULL, ("%s: null ifp", __func__)); - gidx = imo_match_group(imo, ifp, group); - if (gidx == -1) + imf = imo_match_group(imo, ifp, group); + if (imf == NULL) return (MCAST_NOTGMEMBER); /* @@ -526,8 +479,8 @@ imo_multi_filter(const struct ip_moptions *imo, const * NOTE: We are comparing group state here at IGMP t1 (now) * with socket-layer t0 (since last downcall). */ - mode = imo->imo_mfilters[gidx].imf_st[1]; - ims = imo_match_source(imo, gidx, src); + mode = imf->imf_st[1]; + ims = imo_match_source(imf, src); if ((ims == NULL && mode == MCAST_INCLUDE) || (ims != NULL && ims->imsl_st[0] != mode)) @@ -1452,7 +1405,6 @@ inp_block_unblock_source(struct inpcb *inp, struct soc struct ip_moptions *imo; struct in_msource *ims; struct in_multi *inm; - size_t idx; uint16_t fmode; int error, doblock; @@ -1531,21 +1483,19 @@ inp_block_unblock_source(struct inpcb *inp, struct soc if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr))) return (EINVAL); + IN_MULTI_LOCK(); + /* * Check if we are actually a member of this group. */ imo = inp_findmoptions(inp); - idx = imo_match_group(imo, ifp, &gsa->sa); - if (idx == -1 || imo->imo_mfilters == NULL) { + imf = imo_match_group(imo, ifp, &gsa->sa); + if (imf == NULL) { error = EADDRNOTAVAIL; goto out_inp_locked; } + inm = imf->imf_inm; - KASSERT(imo->imo_mfilters != NULL, - ("%s: imo_mfilters not allocated", __func__)); - imf = &imo->imo_mfilters[idx]; - inm = imo->imo_membership[idx]; - /* * Attempting to use the delta-based API on an * non exclusive-mode membership is an error. @@ -1562,7 +1512,7 @@ inp_block_unblock_source(struct inpcb *inp, struct soc * Asked to unblock, but nothing to unblock. * If adding a new block entry, allocate it. */ - ims = imo_match_source(imo, idx, &ssa->sa); + ims = imo_match_source(imf, &ssa->sa); if ((ims != NULL && doblock) || (ims == NULL && !doblock)) { CTR3(KTR_IGMPV3, "%s: source 0x%08x %spresent", __func__, ntohl(ssa->sin.sin_addr.s_addr), doblock ? "" : "not "); @@ -1593,14 +1543,13 @@ inp_block_unblock_source(struct inpcb *inp, struct soc /* * Begin state merge transaction at IGMP layer. */ - IN_MULTI_LOCK(); CTR1(KTR_IGMPV3, "%s: merge inm state", __func__); IN_MULTI_LIST_LOCK(); error = inm_merge(inm, imf); if (error) { CTR1(KTR_IGMPV3, "%s: failed to merge inm state", __func__); IN_MULTI_LIST_UNLOCK(); - goto out_in_multi_locked; + goto out_imf_rollback; } CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__); @@ -1609,9 +1558,6 @@ inp_block_unblock_source(struct inpcb *inp, struct soc if (error) CTR1(KTR_IGMPV3, "%s: failed igmp downcall", __func__); -out_in_multi_locked: - - IN_MULTI_UNLOCK(); out_imf_rollback: if (error) imf_rollback(imf); @@ -1622,6 +1568,7 @@ out_imf_rollback: out_inp_locked: INP_WUNLOCK(inp); + IN_MULTI_UNLOCK(); return (error); } @@ -1636,9 +1583,6 @@ static struct ip_moptions * inp_findmoptions(struct inpcb *inp) { struct ip_moptions *imo; - struct in_multi **immp; - struct in_mfilter *imfp; - size_t idx; INP_WLOCK(inp); if (inp->inp_moptions != NULL) @@ -1647,29 +1591,16 @@ inp_findmoptions(struct inpcb *inp) INP_WUNLOCK(inp); imo = malloc(sizeof(*imo), M_IPMOPTS, M_WAITOK); - immp = malloc(sizeof(*immp) * IP_MIN_MEMBERSHIPS, M_IPMOPTS, - M_WAITOK | M_ZERO); - imfp = malloc(sizeof(struct in_mfilter) * IP_MIN_MEMBERSHIPS, - M_INMFILTER, M_WAITOK); imo->imo_multicast_ifp = NULL; imo->imo_multicast_addr.s_addr = INADDR_ANY; imo->imo_multicast_vif = -1; imo->imo_multicast_ttl = IP_DEFAULT_MULTICAST_TTL; imo->imo_multicast_loop = in_mcast_loop; - imo->imo_num_memberships = 0; - imo->imo_max_memberships = IP_MIN_MEMBERSHIPS; - imo->imo_membership = immp; + STAILQ_INIT(&imo->imo_head); - /* Initialize per-group source filters. */ - for (idx = 0; idx < IP_MIN_MEMBERSHIPS; idx++) - imf_init(&imfp[idx], MCAST_UNDEFINED, MCAST_EXCLUDE); - imo->imo_mfilters = imfp; - INP_WLOCK(inp); if (inp->inp_moptions != NULL) { - free(imfp, M_INMFILTER); - free(immp, M_IPMOPTS); free(imo, M_IPMOPTS); return (inp->inp_moptions); } @@ -1680,32 +1611,25 @@ inp_findmoptions(struct inpcb *inp) static void inp_gcmoptions(struct ip_moptions *imo) { - struct in_mfilter *imf; + struct in_mfilter *imf; struct in_multi *inm; struct ifnet *ifp; - size_t idx, nmships; - nmships = imo->imo_num_memberships; - for (idx = 0; idx < nmships; ++idx) { - imf = imo->imo_mfilters ? &imo->imo_mfilters[idx] : NULL; - if (imf) - imf_leave(imf); - inm = imo->imo_membership[idx]; - ifp = inm->inm_ifp; - if (ifp != NULL) { - CURVNET_SET(ifp->if_vnet); - (void)in_leavegroup(inm, imf); - CURVNET_RESTORE(); - } else { - (void)in_leavegroup(inm, imf); + while ((imf = ip_mfilter_first(&imo->imo_head)) != NULL) { + ip_mfilter_remove(&imo->imo_head, imf); + + imf_leave(imf); + if ((inm = imf->imf_inm) != NULL) { + if ((ifp = inm->inm_ifp) != NULL) { + CURVNET_SET(ifp->if_vnet); + (void)in_leavegroup(inm, imf); + CURVNET_RESTORE(); + } else { + (void)in_leavegroup(inm, imf); + } } - if (imf) - imf_purge(imf); + ip_mfilter_free(imf); } - - if (imo->imo_mfilters) - free(imo->imo_mfilters, M_INMFILTER); - free(imo->imo_membership, M_IPMOPTS); free(imo, M_IPMOPTS); } @@ -1741,7 +1665,7 @@ inp_get_source_filters(struct inpcb *inp, struct socko struct sockaddr_storage *ptss; struct sockaddr_storage *tss; int error; - size_t idx, nsrcs, ncsrcs; + size_t nsrcs, ncsrcs; INP_WLOCK_ASSERT(inp); @@ -1768,12 +1692,11 @@ inp_get_source_filters(struct inpcb *inp, struct socko * Lookup group on the socket. */ gsa = (sockunion_t *)&msfr.msfr_group; - idx = imo_match_group(imo, ifp, &gsa->sa); - if (idx == -1 || imo->imo_mfilters == NULL) { + imf = imo_match_group(imo, ifp, &gsa->sa); + if (imf == NULL) { INP_WUNLOCK(inp); return (EADDRNOTAVAIL); } - imf = &imo->imo_mfilters[idx]; /* * Ignore memberships which are in limbo. @@ -2033,14 +1956,11 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt struct ip_moptions *imo; struct in_multi *inm; struct in_msource *lims; - size_t idx; int error, is_new; ifp = NULL; - imf = NULL; lims = NULL; error = 0; - is_new = 0; memset(&gsr, 0, sizeof(struct group_source_req)); gsa = (sockunion_t *)&gsr.gsr_group; @@ -2148,13 +2068,25 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) return (EADDRNOTAVAIL); + IN_MULTI_LOCK(); + + /* + * Find the membership in the membership list. + */ imo = inp_findmoptions(inp); - idx = imo_match_group(imo, ifp, &gsa->sa); - if (idx == -1) { + imf = imo_match_group(imo, ifp, &gsa->sa); + if (imf == NULL) { is_new = 1; + inm = NULL; + + if (ip_mfilter_count(&imo->imo_head) >= IP_MAX_MEMBERSHIPS) { + error = ENOMEM; + goto out_inp_locked; + } } else { - inm = imo->imo_membership[idx]; - imf = &imo->imo_mfilters[idx]; + is_new = 0; + inm = imf->imf_inm; + if (ssa->ss.ss_family != AF_UNSPEC) { /* * MCAST_JOIN_SOURCE_GROUP on an exclusive membership @@ -2181,7 +2113,7 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt * full-state SSM API with the delta-based API, * which is discouraged in the relevant RFCs. */ - lims = imo_match_source(imo, idx, &ssa->sa); + lims = imo_match_source(imf, &ssa->sa); if (lims != NULL /*&& lims->imsl_st[1] == MCAST_INCLUDE*/) { error = EADDRNOTAVAIL; @@ -2214,27 +2146,6 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt */ INP_WLOCK_ASSERT(inp); - if (is_new) { - if (imo->imo_num_memberships == imo->imo_max_memberships) { - error = imo_grow(imo); - if (error) - goto out_inp_locked; - } - /* - * Allocate the new slot upfront so we can deal with - * grafting the new source filter in same code path - * as for join-source on existing membership. - */ - idx = imo->imo_num_memberships; - imo->imo_membership[idx] = NULL; - imo->imo_num_memberships++; - KASSERT(imo->imo_mfilters != NULL, - ("%s: imf_mfilters vector was not allocated", __func__)); - imf = &imo->imo_mfilters[idx]; - KASSERT(RB_EMPTY(&imf->imf_sources), - ("%s: imf_sources not empty", __func__)); - } - /* * Graft new source into filter list for this inpcb's * membership of the group. The in_multi may not have @@ -2250,7 +2161,11 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt /* Membership starts in IN mode */ if (is_new) { CTR1(KTR_IGMPV3, "%s: new join w/source", __func__); - imf_init(imf, MCAST_UNDEFINED, MCAST_INCLUDE); + imf = ip_mfilter_alloc(M_NOWAIT, MCAST_UNDEFINED, MCAST_INCLUDE); + if (imf == NULL) { + error = ENOMEM; + goto out_inp_locked; + } } else { CTR2(KTR_IGMPV3, "%s: %s source", __func__, "allow"); } @@ -2259,34 +2174,41 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt CTR1(KTR_IGMPV3, "%s: merge imf state failed", __func__); error = ENOMEM; - goto out_imo_free; + goto out_inp_locked; } } else { /* No address specified; Membership starts in EX mode */ if (is_new) { CTR1(KTR_IGMPV3, "%s: new join w/o source", __func__); - imf_init(imf, MCAST_UNDEFINED, MCAST_EXCLUDE); + imf = ip_mfilter_alloc(M_NOWAIT, MCAST_UNDEFINED, MCAST_EXCLUDE); + if (imf == NULL) { + error = ENOMEM; + goto out_inp_locked; + } } } /* * Begin state merge transaction at IGMP layer. */ - in_pcbref(inp); - INP_WUNLOCK(inp); - IN_MULTI_LOCK(); - if (is_new) { + in_pcbref(inp); + INP_WUNLOCK(inp); + error = in_joingroup_locked(ifp, &gsa->sin.sin_addr, imf, - &inm); + &imf->imf_inm); + + INP_WLOCK(inp); + if (in_pcbrele_wlocked(inp)) { + error = ENXIO; + goto out_inp_unlocked; + } if (error) { CTR1(KTR_IGMPV3, "%s: in_joingroup_locked failed", __func__); - IN_MULTI_LIST_UNLOCK(); - goto out_imo_free; + goto out_inp_locked; } - inm_acquire(inm); - imo->imo_membership[idx] = inm; + inm_acquire(imf->imf_inm); } else { CTR1(KTR_IGMPV3, "%s: merge inm state", __func__); IN_MULTI_LIST_LOCK(); @@ -2295,7 +2217,9 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt CTR1(KTR_IGMPV3, "%s: failed to merge inm state", __func__); IN_MULTI_LIST_UNLOCK(); - goto out_in_multi_locked; + imf_rollback(imf); + imf_reap(imf); + goto out_inp_locked; } CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__); error = igmp_change_state(inm); @@ -2303,40 +2227,30 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt if (error) { CTR1(KTR_IGMPV3, "%s: failed igmp downcall", __func__); - goto out_in_multi_locked; + imf_rollback(imf); + imf_reap(imf); + goto out_inp_locked; } } + if (is_new) + ip_mfilter_insert(&imo->imo_head, imf); -out_in_multi_locked: + imf_commit(imf); + imf = NULL; +out_inp_locked: + INP_WUNLOCK(inp); +out_inp_unlocked: IN_MULTI_UNLOCK(); - INP_WLOCK(inp); - if (in_pcbrele_wlocked(inp)) - return (ENXIO); - if (error) { - imf_rollback(imf); - if (is_new) - imf_purge(imf); - else - imf_reap(imf); - } else { - imf_commit(imf); - } -out_imo_free: - if (error && is_new) { - inm = imo->imo_membership[idx]; - if (inm != NULL) { + if (is_new && imf) { + if (imf->imf_inm != NULL) { IN_MULTI_LIST_LOCK(); - inm_release_deferred(inm); + inm_release_deferred(imf->imf_inm); IN_MULTI_LIST_UNLOCK(); } - imo->imo_membership[idx] = NULL; - --imo->imo_num_memberships; + ip_mfilter_free(imf); } - -out_inp_locked: - INP_WUNLOCK(inp); return (error); } @@ -2355,12 +2269,12 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop struct ip_moptions *imo; struct in_msource *ims; struct in_multi *inm; - size_t idx; - int error, is_final; + int error; + bool is_final; ifp = NULL; error = 0; - is_final = 1; + is_final = true; memset(&gsr, 0, sizeof(struct group_source_req)); gsa = (sockunion_t *)&gsr.gsr_group; @@ -2460,20 +2374,21 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr))) return (EINVAL); + IN_MULTI_LOCK(); + /* - * Find the membership in the membership array. + * Find the membership in the membership list. */ imo = inp_findmoptions(inp); - idx = imo_match_group(imo, ifp, &gsa->sa); - if (idx == -1) { + imf = imo_match_group(imo, ifp, &gsa->sa); + if (imf == NULL) { error = EADDRNOTAVAIL; goto out_inp_locked; } - inm = imo->imo_membership[idx]; - imf = &imo->imo_mfilters[idx]; + inm = imf->imf_inm; if (ssa->ss.ss_family != AF_UNSPEC) - is_final = 0; + is_final = false; /* * Begin state merge transaction at socket layer. @@ -2485,13 +2400,14 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop * MCAST_LEAVE_SOURCE_GROUP is only valid for inclusive memberships. */ if (is_final) { + ip_mfilter_remove(&imo->imo_head, imf); imf_leave(imf); } else { if (imf->imf_st[0] == MCAST_EXCLUDE) { error = EADDRNOTAVAIL; goto out_inp_locked; } - ims = imo_match_source(imo, idx, &ssa->sa); + ims = imo_match_source(imf, &ssa->sa); if (ims == NULL) { CTR3(KTR_IGMPV3, "%s: source 0x%08x %spresent", __func__, ntohl(ssa->sin.sin_addr.s_addr), "not "); @@ -2510,17 +2426,7 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop /* * Begin state merge transaction at IGMP layer. */ - in_pcbref(inp); - INP_WUNLOCK(inp); - IN_MULTI_LOCK(); - - if (is_final) { - /* - * Give up the multicast address record to which - * the membership points. - */ - (void)in_leavegroup_locked(inm, imf); - } else { + if (!is_final) { CTR1(KTR_IGMPV3, "%s: merge inm state", __func__); IN_MULTI_LIST_LOCK(); error = inm_merge(inm, imf); @@ -2528,7 +2434,9 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop CTR1(KTR_IGMPV3, "%s: failed to merge inm state", __func__); IN_MULTI_LIST_UNLOCK(); - goto out_in_multi_locked; + imf_rollback(imf); + imf_reap(imf); + goto out_inp_locked; } CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__); @@ -2537,38 +2445,27 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop if (error) { CTR1(KTR_IGMPV3, "%s: failed igmp downcall", __func__); + imf_rollback(imf); + imf_reap(imf); + goto out_inp_locked; } } - -out_in_multi_locked: - - IN_MULTI_UNLOCK(); - INP_WLOCK(inp); - if (in_pcbrele_wlocked(inp)) - return (ENXIO); - - if (error) - imf_rollback(imf); - else - imf_commit(imf); - + imf_commit(imf); imf_reap(imf); - if (is_final) { - /* Remove the gap in the membership and filter array. */ - KASSERT(RB_EMPTY(&imf->imf_sources), - ("%s: imf_sources not empty", __func__)); - for (++idx; idx < imo->imo_num_memberships; ++idx) { - imo->imo_membership[idx - 1] = imo->imo_membership[idx]; - imo->imo_mfilters[idx - 1] = imo->imo_mfilters[idx]; - } - imf_init(&imo->imo_mfilters[idx - 1], MCAST_UNDEFINED, - MCAST_EXCLUDE); - imo->imo_num_memberships--; - } - out_inp_locked: INP_WUNLOCK(inp); + + if (is_final && imf) { + /* + * Give up the multicast address record to which + * the membership points. + */ + (void) in_leavegroup_locked(imf->imf_inm, imf); + ip_mfilter_free(imf); + } + + IN_MULTI_UNLOCK(); return (error); } @@ -2658,7 +2555,6 @@ inp_set_source_filters(struct inpcb *inp, struct socko struct in_mfilter *imf; struct ip_moptions *imo; struct in_multi *inm; - size_t idx; int error; error = sooptcopyin(sopt, &msfr, sizeof(struct __msfilterreq), @@ -2690,18 +2586,19 @@ inp_set_source_filters(struct inpcb *inp, struct socko if (ifp == NULL) return (EADDRNOTAVAIL); + IN_MULTI_LOCK(); + /* * Take the INP write lock. * Check if this socket is a member of this group. */ imo = inp_findmoptions(inp); - idx = imo_match_group(imo, ifp, &gsa->sa); - if (idx == -1 || imo->imo_mfilters == NULL) { + imf = imo_match_group(imo, ifp, &gsa->sa); + if (imf == NULL) { error = EADDRNOTAVAIL; goto out_inp_locked; } - inm = imo->imo_membership[idx]; - imf = &imo->imo_mfilters[idx]; + inm = imf->imf_inm; /* * Begin state merge transaction at socket layer. @@ -2778,7 +2675,6 @@ inp_set_source_filters(struct inpcb *inp, struct socko goto out_imf_rollback; INP_WLOCK_ASSERT(inp); - IN_MULTI_LOCK(); /* * Begin state merge transaction at IGMP layer. @@ -2789,7 +2685,7 @@ inp_set_source_filters(struct inpcb *inp, struct socko if (error) { CTR1(KTR_IGMPV3, "%s: failed to merge inm state", __func__); IN_MULTI_LIST_UNLOCK(); - goto out_in_multi_locked; + goto out_imf_rollback; } CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__); @@ -2798,10 +2694,6 @@ inp_set_source_filters(struct inpcb *inp, struct socko if (error) CTR1(KTR_IGMPV3, "%s: failed igmp downcall", __func__); -out_in_multi_locked: - - IN_MULTI_UNLOCK(); - out_imf_rollback: if (error) imf_rollback(imf); @@ -2812,6 +2704,7 @@ out_imf_rollback: out_inp_locked: INP_WUNLOCK(inp); + IN_MULTI_UNLOCK(); return (error); } Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Tue Jun 25 11:46:01 2019 (r349368) +++ head/sys/netinet/in_pcb.c Tue Jun 25 11:54:41 2019 (r349369) @@ -86,6 +86,9 @@ __FBSDID("$FreeBSD$"); #if defined(INET) || defined(INET6) #include #include +#ifdef INET +#include +#endif #include #include #ifdef TCPHPTS @@ -93,16 +96,13 @@ __FBSDID("$FreeBSD$"); #endif #include #include -#endif -#ifdef INET -#include -#endif #ifdef INET6 #include #include #include #include #endif /* INET6 */ +#endif #include @@ -1779,8 +1779,9 @@ void in_pcbpurgeif0(struct inpcbinfo *pcbinfo, struct ifnet *ifp) { struct inpcb *inp; + struct in_multi *inm; + struct in_mfilter *imf; struct ip_moptions *imo; - int i, gap; INP_INFO_WLOCK(pcbinfo); CK_LIST_FOREACH(inp, pcbinfo->ipi_listhead, inp_list) { @@ -1801,17 +1802,18 @@ in_pcbpurgeif0(struct inpcbinfo *pcbinfo, struct ifnet * * XXX This can all be deferred to an epoch_call */ - for (i = 0, gap = 0; i < imo->imo_num_memberships; - i++) { - if (imo->imo_membership[i]->inm_ifp == ifp) { - IN_MULTI_LOCK_ASSERT(); - in_leavegroup_locked(imo->imo_membership[i], NULL); - gap++; - } else if (gap != 0) - imo->imo_membership[i - gap] = - imo->imo_membership[i]; +restart: + IP_MFILTER_FOREACH(imf, &imo->imo_head) { + if ((inm = imf->imf_inm) == NULL) + continue; + if (inm->inm_ifp != ifp) + continue; + ip_mfilter_remove(&imo->imo_head, imf); + IN_MULTI_LOCK_ASSERT(); + in_leavegroup_locked(inm, NULL); + ip_mfilter_free(imf); + goto restart; } - imo->imo_num_memberships -= gap; } INP_WUNLOCK(inp); } Modified: head/sys/netinet/in_var.h ============================================================================== --- head/sys/netinet/in_var.h Tue Jun 25 11:46:01 2019 (r349368) +++ head/sys/netinet/in_var.h Tue Jun 25 11:54:41 2019 (r349369) @@ -232,7 +232,59 @@ struct in_mfilter { struct ip_msource_tree imf_sources; /* source list for (S,G) */ u_long imf_nsrc; /* # of source entries */ uint8_t imf_st[2]; /* state before/at commit */ + struct in_multi *imf_inm; /* associated multicast address */ + STAILQ_ENTRY(in_mfilter) imf_entry; /* list entry */ }; + +/* + * Helper types and functions for IPv4 multicast filters. + */ +STAILQ_HEAD(ip_mfilter_head, in_mfilter); + +struct in_mfilter *ip_mfilter_alloc(int mflags, int st0, int st1); +void ip_mfilter_free(struct in_mfilter *); + +static inline void +ip_mfilter_init(struct ip_mfilter_head *head) +{ + + STAILQ_INIT(head); +} + +static inline struct in_mfilter * +ip_mfilter_first(const struct ip_mfilter_head *head) +{ + + return (STAILQ_FIRST(head)); +} + +static inline void +ip_mfilter_insert(struct ip_mfilter_head *head, struct in_mfilter *imf) +{ + + STAILQ_INSERT_TAIL(head, imf, imf_entry); +} + +static inline void +ip_mfilter_remove(struct ip_mfilter_head *head, struct in_mfilter *imf) +{ + + STAILQ_REMOVE(head, imf, in_mfilter, imf_entry); +} + +#define IP_MFILTER_FOREACH(imf, head) \ + STAILQ_FOREACH(imf, head, imf_entry) + +static inline size_t +ip_mfilter_count(struct ip_mfilter_head *head) +{ + struct in_mfilter *imf; + size_t num = 0; + + STAILQ_FOREACH(imf, head, imf_entry) + num++; + return (num); +} /* * IPv4 group descriptor. Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Tue Jun 25 11:46:01 2019 (r349368) +++ head/sys/netinet/ip_carp.c Tue Jun 25 11:54:41 2019 (r349369) @@ -1371,25 +1371,24 @@ carp_multicast_setup(struct carp_if *cif, sa_family_t case AF_INET: { struct ip_moptions *imo = &cif->cif_imo; + struct in_mfilter *imf; struct in_addr addr; - if (imo->imo_membership) + if (ip_mfilter_first(&imo->imo_head) != NULL) return (0); - imo->imo_membership = (struct in_multi **)malloc( - (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_CARP, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Jun 25 13:15:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D54DB15CC56A; Tue, 25 Jun 2019 13:15:30 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 77D2A8A88D; Tue, 25 Jun 2019 13:15:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E6A118D5E; Tue, 25 Jun 2019 13:15:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5PDFUrK082926; Tue, 25 Jun 2019 13:15:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PDFUXd082925; Tue, 25 Jun 2019 13:15:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201906251315.x5PDFUXd082925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 25 Jun 2019 13:15:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349370 - head/usr.sbin/usbdump X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/usr.sbin/usbdump X-SVN-Commit-Revision: 349370 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 77D2A8A88D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 13:15:31 -0000 Author: hselasky Date: Tue Jun 25 13:15:29 2019 New Revision: 349370 URL: https://svnweb.freebsd.org/changeset/base/349370 Log: Fix parsing of corrupt data in usbdump(8). Check that the transfer type array lookup is within bounds to avoid segfault. PR: 238801 MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/usr.sbin/usbdump/usbdump.c Modified: head/usr.sbin/usbdump/usbdump.c ============================================================================== --- head/usr.sbin/usbdump/usbdump.c Tue Jun 25 11:54:41 2019 (r349369) +++ head/usr.sbin/usbdump/usbdump.c Tue Jun 25 13:15:29 2019 (r349370) @@ -149,7 +149,9 @@ static const char *errstr_table[USB_ERR_MAX] = { [USB_ERR_NOT_LOCKED] = "NOT_LOCKED", }; -static const char *xfertype_table[4] = { +#define USB_XFERTYPE_MAX 4 + +static const char *xfertype_table[USB_XFERTYPE_MAX] = { [UE_CONTROL] = "CTRL", [UE_ISOCHRONOUS] = "ISOC", [UE_BULK] = "BULK", @@ -320,6 +322,15 @@ usb_speedstr(uint8_t speed) return (speed_table[speed]); } +static const char * +usb_xferstr(uint8_t type) +{ + if (type >= USB_XFERTYPE_MAX || xfertype_table[type] == NULL) + return ("UNKN"); + else + return (xfertype_table[type]); +} + static void print_flags(uint32_t flags) { @@ -496,7 +507,7 @@ print_apacket(const struct header_32 *hdr, const uint8 (int)len, buf, tv.tv_usec, (int)up->up_busunit, (int)up->up_address, (up->up_type == USBPF_XFERTAP_SUBMIT) ? "SUBM" : "DONE", - xfertype_table[up->up_xfertype], + usb_xferstr(up->up_xfertype), (unsigned int)up->up_endpoint, usb_speedstr(up->up_speed), (int)up->up_frames, From owner-svn-src-head@freebsd.org Tue Jun 25 13:24:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C1F415CC8E6; Tue, 25 Jun 2019 13:24:29 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.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 933E28B02B; Tue, 25 Jun 2019 13:24:28 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x5PDONt2049601; Tue, 25 Jun 2019 06:24:23 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x5PDONUQ049600; Tue, 25 Jun 2019 06:24:23 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201906251324.x5PDONUQ049600@gndrsh.dnsmgr.net> Subject: Re: svn commit: r349352 - in head: etc/mtree include lib lib/libnandfs sbin sbin/camcontrol sbin/nandfs sbin/newfs_nandfs share/man/man4 share/man/man5 share/mk stand stand/arm/uboot stand/common stand... In-Reply-To: To: Warner Losh Date: Tue, 25 Jun 2019 06:24:23 -0700 (PDT) CC: Warner Losh , src-committers , svn-src-all , svn-src-head 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-Rspamd-Queue-Id: 933E28B02B X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.93 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.93)[-0.929,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 13:24:29 -0000 > This commit accidentally reverted r349333, r349334, r349335, r349336, > r349339, r349340, r349341 and r349342. I rebased after one of the make > universes I did to proof this set and something must have gone wrong and I > lost these changes. I noticed while committing, but didn't hit ^C fast > enough to prevent the damage it seems. > > I've reapplied those changes rather than revert this commit for two > reasons: first, reverting commits that delete things has caused me trouble > in the past. Second, I judge that to be less repo-churn than doing the > revert, then redoing the nand* removal. > > Time was of the essence, so I hope my snap-judgement was sound. My > apologies both for the 'oops' and for any other fallout. Though this may of reduced repo churn it also broke any MFC that may of been marked in those sets. I am not even sure how one would untwist that maze. MFC original commit is going to leave your second commit as wrongly avaliable commit, so that needs dealt with. MFC your reapply commit, which they have to get by noting these commits as the new merge number. Again, leaving a danglying merge avaliable commit MFC the original commit, your mangle commit, but only the part that applies to there original commit, and the reapply commit. This marks the mangle as merged, but does infact leave the merge avail list for head correct. None of that is very pretty. There are some other options... Anyway my main reason for writting is somehow we need to get out of this "repo churn is expensive I must not revert!" mode of operations. Reverts are almost always the correct way to clean up a mistake, and it almost always leeds to other issues to not revert and instead try to do some magic like what was done here. It is also often a mistake to not exactly revert the original commit, commit that, then commit any additional fix. Reverting and making other changes in the same commit leads to problems more often than it solves them. I do understand the tree might not be in a buildable or correct state for a commit or two. Regards, Rod > Warner > > On Mon, Jun 24, 2019 at 10:50 PM Warner Losh wrote: > > > Author: imp > > Date: Tue Jun 25 04:50:09 2019 > > New Revision: 349352 > > URL: https://svnweb.freebsd.org/changeset/base/349352 > > > > Log: > > Remove NAND and NANDFS support > > > > NANDFS has been broken for years. Remove it. The NAND drivers that > > remain are for ancient parts that are no longer relevant. They are > > polled, have terrible performance and just for ancient arm > > hardware. NAND parts have evolved significantly from this early work > > and little to none of it would be relevant should someone need to > > update to support raw nand. This code has been off by default for > > years and has violated the vnode protocol leading to panics since it > > was committed. > > > > Numerous posts to arch@ and other locations have found no actual users > > for this software. > > > > Relnotes: Yes > > No Objection From: arch@ > > Differential Revision: https://reviews.freebsd.org/D20745 > > ... -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Tue Jun 25 13:28:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E82115CCA65; Tue, 25 Jun 2019 13:28:20 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.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 EFA738B304; Tue, 25 Jun 2019 13:28:19 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x5PDSIEb049621; Tue, 25 Jun 2019 06:28:18 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x5PDSIZV049620; Tue, 25 Jun 2019 06:28:18 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201906251328.x5PDSIZV049620@gndrsh.dnsmgr.net> Subject: Re: svn commit: r349366 - head/sys/netpfil/ipfw In-Reply-To: <201906251140.x5PBectm030416@repo.freebsd.org> To: "Andrey V. Elsukov" Date: Tue, 25 Jun 2019 06:28:18 -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-Rspamd-Queue-Id: EFA738B304 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.93 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 13:28:20 -0000 > Author: ae > Date: Tue Jun 25 11:40:37 2019 > New Revision: 349366 > URL: https://svnweb.freebsd.org/changeset/base/349366 > > Log: > Follow the RFC 3128 and drop short TCP fragments with offset = 1. > > Reported by: emaste > MFC after: 1 week Can we get a counter or something so that the dropping of these is not totally silent and invisible? Thanks, Rod > Modified: > head/sys/netpfil/ipfw/ip_fw2.c > > Modified: head/sys/netpfil/ipfw/ip_fw2.c > ============================================================================== > --- head/sys/netpfil/ipfw/ip_fw2.c Tue Jun 25 09:11:22 2019 (r349365) > +++ head/sys/netpfil/ipfw/ip_fw2.c Tue Jun 25 11:40:37 2019 (r349366) > @@ -1719,6 +1719,11 @@ do { \ > default: > break; > } > + } else { > + if (offset == 1 && proto == IPPROTO_TCP) { > + /* RFC 3128 */ > + goto pullup_failed; > + } > } > > UPDATE_POINTERS(); > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Tue Jun 25 13:30:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66A0115CCB1B; Tue, 25 Jun 2019 13:30:26 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from butcher-nb.yandex.net (unknown [IPv6:2a02:6b8:b080:7503::1:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "butcher-nb.yandex.net", Issuer "butcher-nb.yandex.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D033B8B480; Tue, 25 Jun 2019 13:30:25 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from butcher-nb.yandex.net (localhost [127.0.0.1]) by butcher-nb.yandex.net (8.15.2/8.15.2) with ESMTP id x5PDRnR7039760; Tue, 25 Jun 2019 16:27:49 +0300 (MSK) (envelope-from ae@FreeBSD.org) Subject: Re: svn commit: r349366 - head/sys/netpfil/ipfw To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201906251328.x5PDSIZV049620@gndrsh.dnsmgr.net> From: "Andrey V. Elsukov" Openpgp: id=E6591E1B41DA1516F0C9BC0001C5EA0410C8A17A Autocrypt: addr=ae@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBEwBF1kBCADB9sXFhBEUy8qQ4X63Y8eBatYMHGEFWN9ypS5lI3RE6qQW2EYbxNk7qUC5 21YIIS1mMFVBEfvR7J9uc7yaYgFCEb6Sce1RSO4ULN2mRKGHP3/Sl0ijZEjWHV91hY1YTHEF ZW/0GYinDf56sYpDDehaBF5wkWIo1+QK5nmj3vl0DIDCMNd7QEiWpyLVwECgLX2eOAXByT8B bCqVhJGcG6iFP7/B9Ll6uX5gb8thM9LM+ibwErDBVDGiOgvfxqidab7fdkh893IBCXa82H9N CNwnEtcgzh+BSKK5BgvPohFMgRwjti37TSxwLu63QejRGbZWSz3OK3jMOoF63tCgn7FvABEB AAG0IkFuZHJleSBWLiBFbHN1a292IDxhZUBmcmVlYnNkLm9yZz6JATsEEwECACUCGwMGCwkI BwMCBhUIAgkKCwQWAgMBAh4BAheABQJMB/ruAhkBAAoJEAHF6gQQyKF6MLwH/3Ri/TZl9uo0 SepYWXOnxL6EaDVXDA+dLb1eLKC4PRBBjX29ttQ0KaWapiE6y5/AfzOPmRtHLrHYHjd/aiHX GMLHcYRXD+5GvdkK8iMALrZ28X0JXyuuZa8rAxWIWmCbYHNSBy2unqWgTI04Erodk90IALgM 9JeHN9sFqTM6zalrMnTzlcmel4kcjT3lyYw3vOKgoYLtsLhKZSbJoVVVlvRlGBpHFJI5AoYJ SyfXoN0rcX6k9X7Isp2K50YjqxV4v78xluh1puhwZyC0p8IShPrmrp9Oy9JkMX90o6UAXdGU KfdExJuGJfUZOFBTtNIMNIAKfMTjhpRhxONIr0emxxC5AQ0ETAEXWQEIAJ2p6l9LBoqdH/0J PEFDY2t2gTvAuzz+8zs3R03dFuHcNbOwjvWCG0aOmVpAzkRa8egn5JB4sZaFUtKPYJEQ1Iu+ LUBwgvtXf4vWpzC67zs2dDuiW4LamH5p6xkTD61aHR7mCB3bg2TUjrDWn2Jt44cvoYxj3dz4 S49U1rc9ZPgD5axCNv45j72tggWlZvpefThP7xT1OlNTUqye2gAwQravXpZkl5JG4eOqJVIU X316iE3qso0iXRUtO7OseBf0PiVmk+wCahdreHOeOxK5jMhYkPKVn7z1sZiB7W2H2TojbmcK HZC22sz7Z/H36Lhg1+/RCnGzdEcjGc8oFHXHCxUAEQEAAYkBHwQYAQIACQUCTAEXWQIbDAAK CRABxeoEEMihegkYCAC3ivGYNe2taNm/4Nx5GPdzuaAJGKWksV+w9mo7dQvU+NmI2az5w8vw 98OmX7G0OV9snxMW+6cyNqBrVFTu33VVNzz9pnqNCHxGvj5dL5ltP160JV2zw2bUwJBYsgYQ WfyJJIM7l3gv5ZS3DGqaGIm9gOK1ANxfrR5PgPzvI9VxDhlr2juEVMZYAqPLEJe+SSxbwLoz BcFCNdDAyXcaAzXsx/E02YWm1hIWNRxanAe7Vlg7OL+gvLpdtrYCMg28PNqKNyrQ87LQ49O9 50IIZDOtNFeR0FGucjcLPdS9PiEqCoH7/waJxWp6ydJ+g4OYRBYNM0EmMgy1N85JJrV1mi5i Message-ID: <040e7778-dd19-be48-a5b4-1d6f02ddfbc0@FreeBSD.org> Date: Tue, 25 Jun 2019 16:27:45 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <201906251328.x5PDSIZV049620@gndrsh.dnsmgr.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tJyJbSWRCMkkLJ9uZe7qFROjD1RWOzXkw" X-Rspamd-Queue-Id: D033B8B480 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.87 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.87)[-0.870,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 13:30:26 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --tJyJbSWRCMkkLJ9uZe7qFROjD1RWOzXkw Content-Type: multipart/mixed; boundary="AfA7sp1xvi48BX4MLvPebp5UwC5tNpeGw"; protected-headers="v1" From: "Andrey V. Elsukov" To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <040e7778-dd19-be48-a5b4-1d6f02ddfbc0@FreeBSD.org> Subject: Re: svn commit: r349366 - head/sys/netpfil/ipfw References: <201906251328.x5PDSIZV049620@gndrsh.dnsmgr.net> In-Reply-To: <201906251328.x5PDSIZV049620@gndrsh.dnsmgr.net> --AfA7sp1xvi48BX4MLvPebp5UwC5tNpeGw Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 25.06.2019 16:28, Rodney W. Grimes wrote: >> Author: ae >> Date: Tue Jun 25 11:40:37 2019 >> New Revision: 349366 >> URL: https://svnweb.freebsd.org/changeset/base/349366 >> >> Log: >> Follow the RFC 3128 and drop short TCP fragments with offset =3D 1. >> =20 >> Reported by: emaste >> MFC after: 1 week >=20 > Can we get a counter or something so that the dropping of these > is not totally silent and invisible? They are logged as all short packets with "Pullup failed" message when net.inet.ip.fw.verbose is enabled. --=20 WBR, Andrey V. Elsukov --AfA7sp1xvi48BX4MLvPebp5UwC5tNpeGw-- --tJyJbSWRCMkkLJ9uZe7qFROjD1RWOzXkw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAl0SIVEACgkQAcXqBBDI oXq4pgf9EtVoUTBdXD2glAb4JyarVsraW07y8ZkkLMzMjvyVEoJeJXQqWVZ68QyZ OZ4zUYvRy0Fpkt29TiScxMjCwPi29Gl4gNZ4+EjoEHzJ1lO8QQ/G3YqU0n5uXPto KdsnTzviYpbD8er8IJXDzjZGWg8Jl7iTDg/npQJd09FUA2nkLmgLgFRmJjgL1WVR fc8HmWHfAdHBnhRYeWHz8GLSU3MUMECHlf8Lp4C4fcyi++etJMXuNXVvEdYGd0Jf uC9sfBzgIm2mJI2IV9ySMq7Z1brrWlASyfRspuDDP+2kCDnis5OaHyI2UjhlwXdG IqoqWD2tWE7KHn5ZLP5JnLYR1c4mUA== =l0pY -----END PGP SIGNATURE----- --tJyJbSWRCMkkLJ9uZe7qFROjD1RWOzXkw-- From owner-svn-src-head@freebsd.org Tue Jun 25 13:35:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D88215CCF45; Tue, 25 Jun 2019 13:35:15 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.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 DFACA8BB20; Tue, 25 Jun 2019 13:35:14 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x5PDZBi1049676; Tue, 25 Jun 2019 06:35:11 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x5PDZBUP049675; Tue, 25 Jun 2019 06:35:11 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201906251335.x5PDZBUP049675@gndrsh.dnsmgr.net> Subject: Re: svn commit: r349366 - head/sys/netpfil/ipfw In-Reply-To: <040e7778-dd19-be48-a5b4-1d6f02ddfbc0@FreeBSD.org> To: "Andrey V. Elsukov" Date: Tue, 25 Jun 2019 06:35:11 -0700 (PDT) CC: rgrimes@FreeBSD.org, 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-Rspamd-Queue-Id: DFACA8BB20 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.92 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.92)[-0.924,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 13:35:15 -0000 -- Start of PGP signed section. [ Charset UTF-8 unsupported, converting... ] > On 25.06.2019 16:28, Rodney W. Grimes wrote: > >> Author: ae > >> Date: Tue Jun 25 11:40:37 2019 > >> New Revision: 349366 > >> URL: https://svnweb.freebsd.org/changeset/base/349366 > >> > >> Log: > >> Follow the RFC 3128 and drop short TCP fragments with offset = 1. > >> > >> Reported by: emaste > >> MFC after: 1 week > > > > Can we get a counter or something so that the dropping of these > > is not totally silent and invisible? > > They are logged as all short packets with "Pullup failed" message when > net.inet.ip.fw.verbose is enabled. Thats over kill for what I was asking about. Also are there not other casses that pullup failed is counted? I was asking for a counter specifically on the rfc3128 packets which one use to be able to do with a ipfw rule, but since the kernel started to deal with these I lost that visibility. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Tue Jun 25 14:50:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4010F15CE605; Tue, 25 Jun 2019 14:50:04 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DAF5B8DE8F; Tue, 25 Jun 2019 14:50:03 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFC8F19CBB; Tue, 25 Jun 2019 14:50:03 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5PEo3fY030082; Tue, 25 Jun 2019 14:50:03 GMT (envelope-from zec@FreeBSD.org) Received: (from zec@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PEo3A5030081; Tue, 25 Jun 2019 14:50:03 GMT (envelope-from zec@FreeBSD.org) Message-Id: <201906251450.x5PEo3A5030081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zec set sender to zec@FreeBSD.org using -f From: Marko Zec Date: Tue, 25 Jun 2019 14:50:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349371 - head/usr.bin/calendar/calendars/hr_HR.ISO8859-2 X-SVN-Group: head X-SVN-Commit-Author: zec X-SVN-Commit-Paths: head/usr.bin/calendar/calendars/hr_HR.ISO8859-2 X-SVN-Commit-Revision: 349371 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DAF5B8DE8F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 14:50:04 -0000 Author: zec Date: Tue Jun 25 14:50:03 2019 New Revision: 349371 URL: https://svnweb.freebsd.org/changeset/base/349371 Log: Croatian calendar: update / fix names, dates, group national public holidays, sort by date. MFC after: 3 days Modified: head/usr.bin/calendar/calendars/hr_HR.ISO8859-2/calendar.praznici Modified: head/usr.bin/calendar/calendars/hr_HR.ISO8859-2/calendar.praznici ============================================================================== --- head/usr.bin/calendar/calendars/hr_HR.ISO8859-2/calendar.praznici Tue Jun 25 13:15:29 2019 (r349370) +++ head/usr.bin/calendar/calendars/hr_HR.ISO8859-2/calendar.praznici Tue Jun 25 14:50:03 2019 (r349371) @@ -10,31 +10,31 @@ LANG=hr_HR.ISO8859-2 /* dr¾avni praznici */ -01/01 Nova godina -05/01 Praznik rada -05/30 Tjelovo -06/22 Dan antifa¹istièke borbe -06/25 Dan dr¾avnosti -08/05 Dan domovinske zahvalnosti -10/08 Dan neovisnosti - -/* katolièki blagdani */ -01/06 Sveta tri kralja -Easter-2 Veliki petak +01/01 Nova godina +01/06 Bogojavljenje ili Sveta tri kralja Easter Uskrs Easter+1 Uskrsni ponedjeljak -Easter+49 Duhovi -Easter+50 Duhovni ponedjeljak -Easter+39 Uza¹a¹æe +05/01 Praznik rada +Easter+60 Tijelovo +06/22 Dan antifa¹istièke borbe +06/25 Dan dr¾avnosti +08/05 Dan pobjede i domovinske zahvalnosti i Dan hrvatskih branitelja 08/15 Velika Gospa +10/08 Dan neovisnosti 11/01 Svi sveti 12/25 Bo¾iæ -12/26 Stjepandan +12/26 Sveti Stjepan + +/* katolièki blagdani */ +Easter-2 Veliki petak +Easter+39 Uza¹a¹æe +Easter+49 Duhovi +Easter+50 Duhovni ponedjeljak /* godi¹nja doba */ 03/21* Poèetak proljeæa 06/21* Poèetak ljeta -09/21* Poèetak jesena +09/23* Poèetak jeseni 12/21* Poèetak zime /* ljetno vrijeme */ From owner-svn-src-head@freebsd.org Tue Jun 25 14:56:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5CF015CEA16; Tue, 25 Jun 2019 14:56:14 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 665B88E518; Tue, 25 Jun 2019 14:56:14 +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 2D2D619E87; Tue, 25 Jun 2019 14:56:14 +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 x5PEuEfM035294; Tue, 25 Jun 2019 14:56:14 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PEuEmd035293; Tue, 25 Jun 2019 14:56:14 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201906251456.x5PEuEmd035293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 25 Jun 2019 14:56:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349372 - head/release X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release X-SVN-Commit-Revision: 349372 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 665B88E518 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 14:56:14 -0000 Author: gjb Date: Tue Jun 25 14:56:13 2019 New Revision: 349372 URL: https://svnweb.freebsd.org/changeset/base/349372 Log: Include files containing metadata specific to the branch in the directory where the individual distribution sets exist. The new metadata files include the build date, svn branch, and revision of the build. Requested by: Mellanox Technologies (via kib) MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/release/Makefile.mirrors Modified: head/release/Makefile.mirrors ============================================================================== --- head/release/Makefile.mirrors Tue Jun 25 14:50:03 2019 (r349371) +++ head/release/Makefile.mirrors Tue Jun 25 14:56:13 2019 (r349372) @@ -19,6 +19,7 @@ FTPDIR?= ${RELEASEDIR}/ftp-stage .if exists(${RELEASEDIR}) STAGE_TARGETS?= iso-images-stage .endif +SRCBRANCH!= ${SVN_CMD} info --show-item relative-url ${WORLDDIR} .if (defined(EMBEDDED_TARGET) && !empty(EMBEDDED_TARGET)) || (defined(EMBEDDEDBUILD) && !empty(EMBEDDEDBUILD)) . if ${TARGET:Marm*} != "" || ${EMBEDDED_TARGET:Marm*} != "" @@ -185,6 +186,9 @@ iso-images-stage: .if exists(${RELEASEDIR}/ftp) mkdir -p ${FTP_DIR} cp -p ${RELEASEDIR}/ftp/*.txz ${RELEASEDIR}/ftp/MANIFEST ${FTP_DIR} + echo ${BUILDDATE} > ${FTP_DIR}/BUILDDATE + echo ${SRCBRANCH} > ${FTP_DIR}/SRCBRANCH + echo r${SVNREVISION} > ${FTP_DIR}/REVISION cd ${TLD}/${TARGET} && \ ln -s ${TARGET_ARCH}/${REVISION}-${BRANCH} \ ${REVISION}-${BRANCH} From owner-svn-src-head@freebsd.org Tue Jun 25 15:26:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C82DC15CF652 for ; Tue, 25 Jun 2019 15:26:16 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1ED488F7D9 for ; Tue, 25 Jun 2019 15:26:16 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72b.google.com with SMTP id r6so12948674qkc.0 for ; Tue, 25 Jun 2019 08:26:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9HRCJqY2mStZ5GjEdLdZl7Yrp9Lzk58XZJbUlSLiSyA=; b=VgG2kez46pK6qnDKqR5fID8Z7DfPv+BtZrH6F8S70VPSshzGwkpS8fEJ5dw79B24hH 2V2eBwwks/drpmeN6L/U11Rz4C3IEse0+0pSUeGYXqGAX3VlQKW9xIiVZxeM2gFoCdub NsBA0bM1WBJYQGoAo2H/eMH0kLpz+JGQaYhQXktS039sdZohh9ZzncqQxJMEQd/TNtld CVT10eQIC4iRdmU+CHgVYGSa1FXYWiHiuB+hxKuo/qX/HqRBuPDQ2gdesEnjJ1jymQxU TZl33Z0wPCnPJs1RuWk1XsYS4GxBVOMc3XqXw+hR3Dc3TnUWyjYRMAMz3Nv2zj8eJQvK VqlA== 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=9HRCJqY2mStZ5GjEdLdZl7Yrp9Lzk58XZJbUlSLiSyA=; b=AhfMJkAHcOhdffsHFSdHM/QfUBgNcZS5MV10tEq0Xm3GADpfEsh3/1YSJGjFEE9Sdo PUKrZUEoPXTztW+wMAHgbwA1y5Y24MA+NRLpxg1o3LAvQKdT0xiODPpKBEz7FV7R595m zXiZCgkOn0qeRnjAx+bPY/XEX5eZ0yX+rxjmBmUG8wjxC9t4mPqF+5u+SWinBXVJZzdg 407hwGIgYQoFxwh5/HXRWBJx4BdqcHDp907hMs9Th/dRVAlCPQ0zy91wV/gqlPWP1l/Q wvh1O6bBwmB0NYeHYdRPzSHzqOljZd4tMUqQZsg1KM0sN+bH8ZfpuaPOz5yNDyts1xod qW8A== X-Gm-Message-State: APjAAAXGk3oM16Lw0rilwrQGF243Qcn0T+J5Xm+o6zSCnbMBNdGd5q54 467eSWqjbkhCjD8aZv2c7fZ6MtAlyhcti+6t24TDAg== X-Google-Smtp-Source: APXvYqzSmWQiOCj8WUApuBqftHqgds2noP9+5BtY6f2XeDX2eaS/tizSP98pcUOJBuLTJt8ArU7bvvfA2xnlBQ3nv4M= X-Received: by 2002:a37:6652:: with SMTP id a79mr40003322qkc.60.1561476375133; Tue, 25 Jun 2019 08:26:15 -0700 (PDT) MIME-Version: 1.0 References: <201906251324.x5PDONUQ049600@gndrsh.dnsmgr.net> In-Reply-To: <201906251324.x5PDONUQ049600@gndrsh.dnsmgr.net> From: Warner Losh Date: Tue, 25 Jun 2019 09:26:03 -0600 Message-ID: Subject: Re: svn commit: r349352 - in head: etc/mtree include lib lib/libnandfs sbin sbin/camcontrol sbin/nandfs sbin/newfs_nandfs share/man/man4 share/man/man5 share/mk stand stand/arm/uboot stand/common stand... To: "Rodney W. Grimes" Cc: Warner Losh , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 1ED488F7D9 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 15:26:17 -0000 On Tue, Jun 25, 2019 at 7:24 AM Rodney W. Grimes wrote: > > This commit accidentally reverted r349333, r349334, r349335, r349336, > > r349339, r349340, r349341 and r349342. I rebased after one of the make > > universes I did to proof this set and something must have gone wrong and > I > > lost these changes. I noticed while committing, but didn't hit ^C fast > > enough to prevent the damage it seems. > > > > I've reapplied those changes rather than revert this commit for two > > reasons: first, reverting commits that delete things has caused me > trouble > > in the past. Second, I judge that to be less repo-churn than doing the > > revert, then redoing the nand* removal. > > > > Time was of the essence, so I hope my snap-judgement was sound. My > > apologies both for the 'oops' and for any other fallout. > > Though this may of reduced repo churn it also broke any MFC > that may of been marked in those sets. I am not even sure > how one would untwist that maze. > > MFC original commit is going to leave your second commit as > wrongly avaliable commit, so that needs dealt with. > > MFC your reapply commit, which they have to get by noting these > commits as the new merge number. Again, leaving a danglying > merge avaliable commit > > MFC the original commit, your mangle commit, but only the > part that applies to there original commit, and the reapply > commit. This marks the mangle as merged, but does infact > leave the merge avail list for head correct. > > None of that is very pretty. There are some other options... > > > Anyway my main reason for writting is somehow we need to get out > of this "repo churn is expensive I must not revert!" mode of > operations. Reverts are almost always the correct way to clean > up a mistake, and it almost always leeds to other issues to > not revert and instead try to do some magic like what was > done here. > > It is also often a mistake to not exactly revert the original > commit, commit that, then commit any additional fix. Reverting > and making other changes in the same commit leads to problems > more often than it solves them. I do understand the tree might > not be in a buildable or correct state for a commit or two. > I think that you over-state the issue here. Wouldn't the issue be fixed for MFCs of the replayed commits by MFCing them twice? The first time the first commit with svn merge, and then the second commit with a svn merge --record-only? We could do the same --record-only trick with the NAND removal commit, since it will never be MFC'd. Since the number of commits is small, and the people that would be MFCing them are super experienced with svn, I think that wouldn't be an issue. Then for others, it won't show up as a possible merge candidate (though honestly, with the files affected, that bit of svn is rarely used, also mitigating the data anomaly). I made a conscious decision to minimize time to get the repo repaired from the damage of the one commit. Warner Regards, > Rod > > > Warner > > > > On Mon, Jun 24, 2019 at 10:50 PM Warner Losh wrote: > > > > > Author: imp > > > Date: Tue Jun 25 04:50:09 2019 > > > New Revision: 349352 > > > URL: https://svnweb.freebsd.org/changeset/base/349352 > > > > > > Log: > > > Remove NAND and NANDFS support > > > > > > NANDFS has been broken for years. Remove it. The NAND drivers that > > > remain are for ancient parts that are no longer relevant. They are > > > polled, have terrible performance and just for ancient arm > > > hardware. NAND parts have evolved significantly from this early work > > > and little to none of it would be relevant should someone need to > > > update to support raw nand. This code has been off by default for > > > years and has violated the vnode protocol leading to panics since it > > > was committed. > > > > > > Numerous posts to arch@ and other locations have found no actual > users > > > for this software. > > > > > > Relnotes: Yes > > > No Objection From: arch@ > > > Differential Revision: https://reviews.freebsd.org/D20745 > > > ... > > -- > Rod Grimes > rgrimes@freebsd.org > From owner-svn-src-head@freebsd.org Tue Jun 25 15:43:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1513615CFCD4; Tue, 25 Jun 2019 15:43:53 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A84F7683E7; Tue, 25 Jun 2019 15:43:52 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 847C11A74B; Tue, 25 Jun 2019 15:43:52 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5PFhqQh061417; Tue, 25 Jun 2019 15:43:52 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PFhq6c061416; Tue, 25 Jun 2019 15:43:52 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201906251543.x5PFhq6c061416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Tue, 25 Jun 2019 15:43:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349373 - head/sys/netipsec X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/netipsec X-SVN-Commit-Revision: 349373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A84F7683E7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 15:43:53 -0000 Author: rlibby Date: Tue Jun 25 15:43:52 2019 New Revision: 349373 URL: https://svnweb.freebsd.org/changeset/base/349373 Log: netipsec key_register: check for M_NOWAIT alloc failure Reviewed by: ae, cem Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D20742 Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Tue Jun 25 14:56:13 2019 (r349372) +++ head/sys/netipsec/key.c Tue Jun 25 15:43:52 2019 (r349373) @@ -7164,7 +7164,7 @@ key_register(struct socket *so, struct mbuf *m, const return key_senderror(so, m, ENOBUFS); MGETHDR(n, M_NOWAIT, MT_DATA); - if (len > MHLEN) { + if (n != NULL && len > MHLEN) { if (!(MCLGET(n, M_NOWAIT))) { m_freem(n); n = NULL; From owner-svn-src-head@freebsd.org Tue Jun 25 16:39:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B49215D0F47; Tue, 25 Jun 2019 16:39:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1FCA66B599; Tue, 25 Jun 2019 16:39:27 +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 10AEC1AFFB; Tue, 25 Jun 2019 16:39:27 +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 x5PGdQ6R088245; Tue, 25 Jun 2019 16:39:26 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PGdP77088237; Tue, 25 Jun 2019 16:39:25 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201906251639.x5PGdP77088237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Jun 2019 16:39:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349374 - in head/sys: arm/conf conf kern X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: arm/conf conf kern X-SVN-Commit-Revision: 349374 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1FCA66B599 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 16:39:27 -0000 Author: imp Date: Tue Jun 25 16:39:25 2019 New Revision: 349374 URL: https://svnweb.freebsd.org/changeset/base/349374 Log: Remove a couple of harmless stray references to nandfs. Submitted by: tsoome@ Modified: head/sys/arm/conf/DB-78XXX head/sys/arm/conf/DB-88F6XXX head/sys/arm/conf/SHEEVAPLUG head/sys/arm/conf/VYBRID head/sys/conf/options head/sys/kern/Make.tags.inc Modified: head/sys/arm/conf/DB-78XXX ============================================================================== --- head/sys/arm/conf/DB-78XXX Tue Jun 25 15:43:52 2019 (r349373) +++ head/sys/arm/conf/DB-78XXX Tue Jun 25 16:39:25 2019 (r349374) @@ -20,7 +20,6 @@ options GEOM_PART_BSD # BSD partition scheme options GEOM_PART_MBR # MBR partition scheme options TMPFS # Efficient memory filesystem options FFS # Berkeley Fast Filesystem -options NANDFS # NAND Filesystem options NFSCL # Network Filesystem Client options NFSLOCKD # Network Lock Manager options NFS_ROOT # NFS usable as /, requires NFSCL Modified: head/sys/arm/conf/DB-88F6XXX ============================================================================== --- head/sys/arm/conf/DB-88F6XXX Tue Jun 25 15:43:52 2019 (r349373) +++ head/sys/arm/conf/DB-88F6XXX Tue Jun 25 16:39:25 2019 (r349374) @@ -17,7 +17,6 @@ options INET # InterNETworking options INET6 # IPv6 communications protocols options TCP_HHOOK # hhook(9) framework for TCP options FFS # Berkeley Fast Filesystem -options NANDFS # NAND Filesystem options NFSCL # Network Filesystem Client options NFSLOCKD # Network Lock Manager options NFS_ROOT # NFS usable as /, requires NFSCL Modified: head/sys/arm/conf/SHEEVAPLUG ============================================================================== --- head/sys/arm/conf/SHEEVAPLUG Tue Jun 25 15:43:52 2019 (r349373) +++ head/sys/arm/conf/SHEEVAPLUG Tue Jun 25 16:39:25 2019 (r349374) @@ -19,7 +19,6 @@ options INET # InterNETworking options INET6 # IPv6 communications protocols options TCP_HHOOK # hhook(9) framework for TCP options FFS # Berkeley Fast Filesystem -options NANDFS # NAND Filesystem options NFSCL # Network Filesystem Client options NFSLOCKD # Network Lock Manager options NFS_ROOT # NFS usable as /, requires NFSCL Modified: head/sys/arm/conf/VYBRID ============================================================================== --- head/sys/arm/conf/VYBRID Tue Jun 25 15:43:52 2019 (r349373) +++ head/sys/arm/conf/VYBRID Tue Jun 25 16:39:25 2019 (r349374) @@ -26,7 +26,6 @@ makeoptions WERROR="-Werror" options SCHED_4BSD # 4BSD scheduler options PLATFORM # Platform based SoC -#options NANDFS # NAND Filesystem #options SMP # Enable multiple cores # NFS root from boopt/dhcp Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Tue Jun 25 15:43:52 2019 (r349373) +++ head/sys/conf/options Tue Jun 25 16:39:25 2019 (r349374) @@ -256,7 +256,6 @@ FDESCFS opt_dontuse.h FFS opt_dontuse.h FUSEFS opt_dontuse.h MSDOSFS opt_dontuse.h -NANDFS opt_dontuse.h NULLFS opt_dontuse.h PROCFS opt_dontuse.h PSEUDOFS opt_dontuse.h Modified: head/sys/kern/Make.tags.inc ============================================================================== --- head/sys/kern/Make.tags.inc Tue Jun 25 15:43:52 2019 (r349373) +++ head/sys/kern/Make.tags.inc Tue Jun 25 16:39:25 2019 (r349374) @@ -28,7 +28,6 @@ COMM= ${SYS}/sys/vnode.h \ ${SYS}/fs/fifofs/*.[ch] \ ${SYS}/fs/fuse/*.[ch] \ ${SYS}/fs/msdosfs/*.[ch] \ - ${SYS}/fs/nandfs/*.[ch] \ ${SYS}/fs/nfs/*.[ch] \ ${SYS}/fs/nfsclient/*.[ch] \ ${SYS}/fs/nfsserver/*.[ch] \ @@ -82,7 +81,6 @@ COMMDIR2= ${SYS}/dev/alc \ ${SYS}/fs/fifofs \ ${SYS}/fs/fuse \ ${SYS}/fs/msdosfs \ - ${SYS}/fs/nandfs \ ${SYS}/fs/nfs \ ${SYS}/fs/nfsclient \ ${SYS}/fs/nfsserver \ From owner-svn-src-head@freebsd.org Tue Jun 25 17:00:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8EF2F15D1668; Tue, 25 Jun 2019 17:00:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 35FE46C371; Tue, 25 Jun 2019 17:00:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 117031B376; Tue, 25 Jun 2019 17:00:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5PH0r5h099119; Tue, 25 Jun 2019 17:00:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PH0rPj099118; Tue, 25 Jun 2019 17:00:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201906251700.x5PH0rPj099118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 25 Jun 2019 17:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349376 - head/usr.sbin/mountd X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/usr.sbin/mountd X-SVN-Commit-Revision: 349376 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 35FE46C371 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 17:00:54 -0000 Author: mav Date: Tue Jun 25 17:00:53 2019 New Revision: 349376 URL: https://svnweb.freebsd.org/changeset/base/349376 Log: Fix strsep_quote() on strings without quotes. For strings without quotes and escapes dstptr and srcptr are equal, so zeroing *dstptr before checking *srcptr is not a good idea. In practice it means that in -maproot=65534:65533 everything after the colon is lost. The problem was there since r293305, but before r346976 it was covered by improper strsep_quote() usage. PR: 238725 MFC after: 3 days Sponsored by: iXsystems, Inc. Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Tue Jun 25 16:49:20 2019 (r349375) +++ head/usr.sbin/mountd/mountd.c Tue Jun 25 17:00:53 2019 (r349376) @@ -385,8 +385,8 @@ strsep_quote(char **stringp, const char *delim) *dstptr++ = *srcptr++; } - *dstptr = 0; /* Terminate the string */ *stringp = (*srcptr == '\0') ? NULL : srcptr + 1; + *dstptr = 0; /* Terminate the string */ return (retval); } From owner-svn-src-head@freebsd.org Tue Jun 25 17:04:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0074515D1C0A; Tue, 25 Jun 2019 17:04:21 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 780AC6C87A; Tue, 25 Jun 2019 17:04:21 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f46.google.com with SMTP id s7so4800902iob.11; Tue, 25 Jun 2019 10:04:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=riWwjuwS0VzKS9G8yHbhUmcEY4Ok5JBNLCQumpbgIaI=; b=Ub3NvBaziAvo8u0TlLsgBxSoTJ8GcCwflypWH/AQzPLzpeReuKxHcXN++TdMlLb7fW blpv43H/+Z1eo+ANe1aqwT4LVNg0frlDPc3hclP37mgNxy6u1ykenF6wPnV17Bb6OYE2 P2pF58PF5D0XgMMwVEL3JnWOP/XqlKqNzS9E6CxAw6Xx/elEj/N4Dr36KFFzLwAyd6pm BS8URHYAJhvqRGNU+eswkC+y7k2ddzR4uyXHfUKsVtKD3A2jBDnGphmnqGrMCCodhqbt RTI7Z4zN9bI4ixbJUb7c5tHO3M7KXjbXC2AmZ0NgXulMj7FeEkorQ9GxByBGcPVzJu+G wygg== X-Gm-Message-State: APjAAAXHdgh86DhqTmxLWy8ecNId+R7S6KM6adBuLF0kJEnS5BbAr/tz p7chtfav0I2tS+SsJQU+FOa+5hDRIJhSgOiD/0zdk3KJ X-Google-Smtp-Source: APXvYqxvudx2FkRv03wfswGBldnBBhEhKvZyNIoDSZMalCkHOCCEQcmu0HfGXHlELm4ISVpAzlYuCPsisqjPdipSV/Y= X-Received: by 2002:a6b:5b01:: with SMTP id v1mr9224166ioh.120.1561482254671; Tue, 25 Jun 2019 10:04:14 -0700 (PDT) MIME-Version: 1.0 References: <201906242318.x5ONIhlS043523@repo.freebsd.org> In-Reply-To: <201906242318.x5ONIhlS043523@repo.freebsd.org> From: Ed Maste Date: Tue, 25 Jun 2019 09:03:47 -0400 Message-ID: Subject: Re: svn commit: r349349 - in head/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa To: Rebecca Cran Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 780AC6C87A X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.96)[-0.963,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 17:04:22 -0000 On Mon, 24 Jun 2019 at 19:18, Rebecca Cran wrote: > > Author: bcran > Date: Mon Jun 24 23:18:42 2019 > New Revision: 349349 > URL: https://svnweb.freebsd.org/changeset/base/349349 > > Log: > loader: add HTTP support using UEFI My QEMU smoke test script (tools/boot/ci-qemu-test.sh) fails after this change, with an exception in the loader: Consoles: EFI console | Reading loader env vars from /efi/freebsd/loader.env Setting currdev to disk0p1: / - !!!! X64 Exception Type - 000000000000000E CPU Apic ID - 00000000 !!!! RIP - 0000020000000002, CS - 0000000000000028, RFLAGS - 0000000000000246 ExceptionData - 0000000000000000 RAX - 000000000FF93610, RCX - 000000000A500AD0, RDX - 000000000FF935F8 RBX - 000000000FF93610, RSP - 000000000FF93588, RBP - 000000000FF936C0 RSI - 0000000000000000, RDI - 000000000FF9361C R8 - 0000000000000000, R9 - 000000000A500908, R10 - 000000000E8EFEC8 R11 - 0000000000000083, R12 - 000000000FF935F8, R13 - 000000000000000C R14 - 000000000A500870, R15 - 000000000E8DC0D5 DS - 0000000000000008, ES - 0000000000000008, FS - 0000000000000008 GS - 0000000000000008, SS - 0000000000000008 CR0 - 0000000080000033, CR2 - 0000020000000002, CR3 - 000000000FF33000 CR4 - 0000000000000668, CR8 - 0000000000000000 DR0 - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000 DR3 - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400 GDTR - 000000000FF1ED98 000000000000003F, LDTR - 0000000000000000 IDTR - 000000000F47F018 0000000000000FFF, TR - 0000000000000000 FXSAVE_STATE - 000000000FF931E0 qemu-system-x86_64: terminating on signal 15 from pid 54769 (timeout) Did not boot successfully, see /tmp/ci-qemu-test-boot.log From owner-svn-src-head@freebsd.org Tue Jun 25 17:15:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDEBF15D1F25; Tue, 25 Jun 2019 17:15:45 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8C8DD6CEA0; Tue, 25 Jun 2019 17:15:45 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C9621B6DB; Tue, 25 Jun 2019 17:15:45 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5PHFj5r008999; Tue, 25 Jun 2019 17:15:45 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PHFjwo008995; Tue, 25 Jun 2019 17:15:45 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201906251715.x5PHFjwo008995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Tue, 25 Jun 2019 17:15:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349377 - in head/sys: net sys X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: in head/sys: net sys X-SVN-Commit-Revision: 349377 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8C8DD6CEA0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 17:15:46 -0000 Author: luporl Date: Tue Jun 25 17:15:44 2019 New Revision: 349377 URL: https://svnweb.freebsd.org/changeset/base/349377 Log: [PowerPC64] Don't mark module data as static Fixes panic when loading ipfw.ko and if_epair.ko built with modern compiler. Similar to arm64 and riscv, when using a modern compiler (!gcc4.2), code generated tries to access data in the wrong location, causing kernel panic (data storage interrupt trap) when loading if_epair and ipfw. Issue was reproduced with kernel/module compiled using gcc8 and clang8. It affects both ELFv1 and ELFv2 ABI environments. PR: 232387 Submitted by: alfredo.junior_eldorado.org.br Reported by: Mark Millard Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20461 Modified: head/sys/net/vnet.h head/sys/sys/pcpu.h Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Tue Jun 25 17:00:53 2019 (r349376) +++ head/sys/net/vnet.h Tue Jun 25 17:15:44 2019 (r349377) @@ -273,7 +273,8 @@ extern struct sx vnet_sxlock; /* struct _hack is to stop this from being used with static data */ #define VNET_DEFINE(t, n) \ struct _hack; t VNET_NAME(n) __section(VNET_SETNAME) __used -#if defined(KLD_MODULE) && (defined(__aarch64__) || defined(__riscv)) +#if defined(KLD_MODULE) && (defined(__aarch64__) || defined(__riscv) \ + || defined(__powerpc64__)) /* * As with DPCPU_DEFINE_STATIC we are unable to mark this data as static * in modules on some architectures. Modified: head/sys/sys/pcpu.h ============================================================================== --- head/sys/sys/pcpu.h Tue Jun 25 17:00:53 2019 (r349376) +++ head/sys/sys/pcpu.h Tue Jun 25 17:15:44 2019 (r349377) @@ -85,7 +85,8 @@ extern uintptr_t dpcpu_off[]; /* struct _hack is to stop this from being used with the static keyword. */ #define DPCPU_DEFINE(t, n) \ struct _hack; t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used -#if defined(KLD_MODULE) && (defined(__aarch64__) || defined(__riscv)) +#if defined(KLD_MODULE) && (defined(__aarch64__) || defined(__riscv) \ + || defined(__powerpc64__)) /* * On some architectures the compiler will use PC-relative load to * find the address of DPCPU data with the static keyword. We then From owner-svn-src-head@freebsd.org Tue Jun 25 17:27:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C04E15D22D3; Tue, 25 Jun 2019 17:27:38 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 31B3A6D712; Tue, 25 Jun 2019 17:27:38 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 037C51B88E; Tue, 25 Jun 2019 17:27:38 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5PHRbfo015050; Tue, 25 Jun 2019 17:27:37 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PHRbi8015049; Tue, 25 Jun 2019 17:27:37 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201906251727.x5PHRbi8015049@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Tue, 25 Jun 2019 17:27:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349379 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 349379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 31B3A6D712 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 17:27:38 -0000 Author: dougm Date: Tue Jun 25 17:27:37 2019 New Revision: 349379 URL: https://svnweb.freebsd.org/changeset/base/349379 Log: Document the KERN_PROTECTION_FAILURE return value from vm_map_protect(). Reviewed by: alc (earlier version) Approved by: kib, markj (mentors) Differential Revision: https://reviews.freebsd.org/D20751 Modified: head/share/man/man9/vm_map_protect.9 Modified: head/share/man/man9/vm_map_protect.9 ============================================================================== --- head/share/man/man9/vm_map_protect.9 Tue Jun 25 17:24:43 2019 (r349378) +++ head/share/man/man9/vm_map_protect.9 Tue Jun 25 17:27:37 2019 (r349379) @@ -96,6 +96,11 @@ would exceed for an entry within the range, .Dv KERN_PROTECTION_FAILURE is returned. +If a copy-on-write mapping is transitioned from read-only to +read-write, and too little swap space is available for backing the +copied pages, +.Dv KERN_RESOURCE_SHORTAGE +is returned. .Sh SEE ALSO .Xr vm_map 9 .Sh AUTHORS From owner-svn-src-head@freebsd.org Tue Jun 25 17:35:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5056015D24DB; Tue, 25 Jun 2019 17:35:41 +0000 (UTC) (envelope-from bcran@freebsd.org) Received: from muon.bluestop.org (muon.bluestop.org [65.103.231.193]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD7B36DC72; Tue, 25 Jun 2019 17:35:40 +0000 (UTC) (envelope-from bcran@freebsd.org) Received: from muon.bluestop.org (localhost [127.0.0.1]) by muon.bluestop.org (Postfix) with ESMTP id ECBFE5BAE8; Tue, 25 Jun 2019 11:40:02 -0600 (MDT) Received: from muon.bluestop.org ([127.0.0.1]) by muon.bluestop.org (muon.bluestop.org [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id DYaEzXDt4jw5; Tue, 25 Jun 2019 11:40:02 -0600 (MDT) Received: from photon.int.bluestop.org (unknown [10.0.10.170]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by muon.bluestop.org (Postfix) with ESMTPSA; Tue, 25 Jun 2019 11:40:02 -0600 (MDT) Subject: Re: svn commit: r349349 - in head/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa To: Ed Maste Cc: src-committers , svn-src-all , svn-src-head References: <201906242318.x5ONIhlS043523@repo.freebsd.org> From: Rebecca Cran Openpgp: preference=signencrypt Autocrypt: addr=bcran@freebsd.org; keydata= mQINBFrUMZ4BEADI1yUEGeZeXeTCPay1ZpTBdDEpGPAw1dq2VCSTc1VhsnrEBa1iZxAfaeSv Uu5Ti7jlhQ/3sQMl0bJMKGB/RtmIW7k8h2w476oZmG8gChk8su5ZEx/pV1gdqInyFmmJKTYc gabJz8pL+m82w07qPv+oalepZ4dbj+HF++RAK/iEju+q9UHlsjj8e3mMNsvtrOz1K6bnpveO jZ+ms/2H3Hs5a4k8y6buwe2RvwhJQaXa13cR3LhzL+nwj4B9PHZZEa2WpEyYpw/bI0V9YSQN QgC1CYRzDyakZge6BCM6wHOgZSUzRPufGilrNKUwIVbRoIBR9/85+0wR+PlFUOUOfOc6ox7T dWcIx6PuPhek48rh4uwmmwsPtPiH4Z3T5p+GmWQ9NLFZKA1YnEdaSkWtYZsDxwVZZeYG2plt MfhXP0Hj4rf9Y3eoUenCaGioxAbUOBCtXdTGNAhNjz1g5NGDBVyhjKkzwJQvt9UrYTseERit 5dX2CMTy8hYLvSXd/Ivy+HylUS5IslfZxW5z9LgWX7Z97kILgkH3N0ewtLkygkG+Y+x7uaAV dFqp9ASOyzaiwKbJdeOI+WxRSh+AqeCR0S+bpkcLudLmbjrPmaFwjKycy1H85Z5R2J3YHyXY oT6OYjD8vLbUU2GWp6Onkcy1Pu8EMbRuzKil6HnpYg3BexbPFwARAQABtCBSZWJlY2NhIENy YW4gPGJjcmFuQGZyZWVic2Qub3JnPokCVAQTAQgAPhYhBB+5fZtkTdO940Yr4g0CK1MRvhAg BQJa2B8pAhsjBQkJZgGABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEA0CK1MRvhAgAe0P /R65umdPBVFCYKPZ91HMqlZtn0EWOGwycWEK/feWI+jaYOa+8+VVxFau4gwnBmgCdf5XOAJW QugUlPte9T+dP9QXmgm8z3KMLCj2PATYlmqmQfvIleJPf8w7BFBw/kkd6ZxoEQXaEyZwWuJc vY58uFYizZ8s1gMjD7uV3eg2UuGYd4loBZ3MSanWrhE6mmxAjzcYYb0KTsaTH9ON4uctcTYG 4FN0KzRx5d4nAhnS/yaL+3OI23vUDt+XnOCx8tIOczScOEN5NFChgyvTxzwi7hTVNB7uUCha mN6vcjtrrzi03zHXooldE4gRJ5G+SzuH9yHKrrwYXUeKi8sG8uXVoWwzsLbCxHRe7T9Ow7Im 92Aep3DEIE9whG6Fg3hRQ4/d/9OVCGrV3XwRMEstCvamJQc69ZsULo1ssGmPvcLn8fNaLNeP ICCLQj4JLcYvKKfLIQ/Cm0Orsy8rJGhwF4W1mBUbTdR6pk2azEkrhE7KZDylgikpNNqshKV3 1nD/5SNrTDl0P8rTnu0OKT0IbozIsaz9FD2xMPHPUMPnVSTB96+PhgoBIQlHcys19gftotuN 1tlLs4Ny93xWLSjKWoW5l9E9LbIh+M8gD3A7JyyV9DRZkHdbOt3pGjpaozchDPCpRkcsFXp4 9zSbXtxnbAWfZwoSYQTvznmXpzHMzoLMWf/guQINBFrUMZ4BEADkc4mvMcMcDF1tdNxNQuIB E1F243oZamG3LACCKfc1Yur3CPzHwIk5LXCUmbq23iE5bowxMWw3mlVT0p5xM0WnUidIBwCK u4kRyy/fY4NyWWBuwy9srpTdmUcKRBRNB8zEZE8xIlidD1ijjgqLBfeM7n9ylawAxHLxwU96 sdpdHFzb7Z0yKY2e/bzDaHiG0fUvcCmkgLf+uwKKZid1j8zR5PzKpgPqfy/PF01eKyGV3MNu 8Y90xMoiEMWfCI2IB1m+hTuzZoboFvGV54SiMuvfWK/VMQjhsL6K2ddOqwVuy2nIMI4G3xDQ W/v8KVyn43OSIAyW1eaklhzu0Ir2sO60PXRkvbTUrouvmSvpJfIQS49rU0M/X6FSDgXQLKrZ 3my94+g8ptz9KoVml6s4OAwYVz+sb49nuSxipFKkU5FwhKOLmzbsBxCtytcUJoLmjuJPJPDQ ue6YJiIXyc86GVY2pH3DjemKdbB4dSgqAJIp+lCzKSJzz7bgueh2Ox8vzx1tSxKj7V8Nal+U TKKbkxPmMh+e20YZ4esAVifO3bS6IJP/aDnfagghB71vA7+aWGXPbjPlc2UHpCBiRSsl+Igo QXvdvZBsKRyfBx8neODa2C6JIE5vcaCjilSeKF8SzsFXvimnndhQNhAPU/DwQwSXdCl4gTsF Vi5d8Oxq1sce+wARAQABiQI8BBgBCAAmFiEEH7l9m2RN073jRiviDQIrUxG+ECAFAlrUMZ4C GwwFCQlmAYAACgkQDQIrUxG+ECAWnRAAsmZX+KgNxW3v7R/76Tz4Wjmh4AGeE+Ji3p5QsdTY ny1B6vYBL9vCzPJ/AK8pgKMDRaweUP5eZQpfrdWC8Q7SNGgi4Q+97KEs+i2xZLQ+WJb8a+WE EIc716u0y4ITiHfOgM5jWcFO4MXQATbJgv0drLLesa+LQCvZgPBqupt307EsCubQs+Sxt+RV jf6rOUolp1GJXEQYwGsKklVd6yqLC8M1BSG53/WE5tSv5GzBZ8fp6EtmjT7leuidFtEvKYHQ z4DqG9ELpHUF0X0UUCBK/MgXe3kCVLKE060UrJ4M6uPSx57rmVFA2MvwQR8M7GsWC5UsSM4P YwPWBhwxE7vcx0691YKAHT/5q8LxRVBdUyzPSprMhSQFttsBt+ygm6wRi3Pi3TuCEARNubPk QefyeC34yr40SAUCkOl3eWxSXPF4NfXFQb4AAzZSE5hv3qbDuwo3lrL0LqpIpEQPAz+JZ1QZ 6mMFQ5/JD9Gukj54kZc0X8w3sQt0a8vyE/qrJg8vKgv2rCHrPc5MeDkEUEFiiJiCEDdkJtMy oRlU3S4NrnbyLOLEcHE8fGe3hStPX8hY62id2ecdQ5WZ7vLZW5SFeLarbUciuHIkVL6MHnUj bV7XlY50N7ebeFCIdlCWhdum2FJs/Ni+SSxbZC564vrokwlBBGSo6WTPQTa8IWx1DtU= Message-ID: Date: Tue, 25 Jun 2019 11:35:34 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="raGHgiPTDFrbgBuaAr5yK6u5NDUJE1Smk" X-Rspamd-Queue-Id: BD7B36DC72 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 17:35:41 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --raGHgiPTDFrbgBuaAr5yK6u5NDUJE1Smk Content-Type: multipart/mixed; boundary="yF3esNnbRohMe1DJ1kH6aLYbJWA8VvReS"; protected-headers="v1" From: Rebecca Cran To: Ed Maste Cc: src-committers , svn-src-all , svn-src-head Message-ID: Subject: Re: svn commit: r349349 - in head/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa References: <201906242318.x5ONIhlS043523@repo.freebsd.org> In-Reply-To: --yF3esNnbRohMe1DJ1kH6aLYbJWA8VvReS Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 2019-06-25 07:03, Ed Maste wrote: > My QEMU smoke test script (tools/boot/ci-qemu-test.sh) fails after > this change, with an exception in the loader: I can replicate this failure, and am working to debug it. --=20 Rebecca Cran --yF3esNnbRohMe1DJ1kH6aLYbJWA8VvReS-- --raGHgiPTDFrbgBuaAr5yK6u5NDUJE1Smk Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEH7l9m2RN073jRiviDQIrUxG+ECAFAl0SW2YACgkQDQIrUxG+ ECClZxAAnkKg6TSZVp26X2AcTdH0LxSNcT0TP8jwJ9Li6niaK1lLaSFbMxM+03aF LC2C83QaWOVZ9P9xqxv4myGxyZ0tG7Eta7fCqOID9xq13QQKtTJm6UAMPhzXzTHp Q5N07+HIqzwnG7S9JPmgkiADvCCsdlzyyvdP21siyi0JigADiZbulslYuFPtfNDM PfA15CoXIBv0tV9DQ4tGJgPVXCSaN/hGlITfMKQTCESIJCLDFx2bzC0EB5CViIbH cHzh7RIM05zk47F2cqVtd6z89X5G0ORFUhPGJscN+gQ+RGm/MTCAMs81NXek0zpa wjXoseopeUNw1o3KOdrU5Vb2fDzUKL2es7RmPVS6sKqDNP2zL+due+/GkcPvqdlf ztho4GZERuLmOsYqyYHNtGk7SZIdE4yZoLyD6EXob9qHu+vPZyqQQk8V5m8VjFNu wf24jYjx+Xe5dnJB8QKstcBkr8JkC+koXtUQuYwBSw52Tz9B1MuLc5KB7YF3FuHr 2eNG05LgNPRilDQpQhJ5L6/f2A+E7ZlFZLK66lLY31+DyaIGMeHAVBt47AIB8b4f ufLTgZ8C1HsK0dexaWWjNVid54YGnVkp6Bi1Sy5VyWAIqXiG42caVWtknLzlFjyK sfkGvglAHlFirwNfdL4LGAEM8tmIJGbbx5sHy7yheTlUWJTjg48= =VGgY -----END PGP SIGNATURE----- --raGHgiPTDFrbgBuaAr5yK6u5NDUJE1Smk-- From owner-svn-src-head@freebsd.org Tue Jun 25 18:13:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA5C715D31FD; Tue, 25 Jun 2019 18:13:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CBA96EE9F; Tue, 25 Jun 2019 18:13:40 +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 1E3421C123; Tue, 25 Jun 2019 18:13:40 +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 x5PIDd6V045762; Tue, 25 Jun 2019 18:13:39 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PIDdB0045761; Tue, 25 Jun 2019 18:13:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201906251813.x5PIDdB0045761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 25 Jun 2019 18:13:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349380 - head/lib/libbe X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libbe X-SVN-Commit-Revision: 349380 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4CBA96EE9F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 18:13:40 -0000 Author: kevans Date: Tue Jun 25 18:13:39 2019 New Revision: 349380 URL: https://svnweb.freebsd.org/changeset/base/349380 Log: libbe(3): mount: the BE dataset is mounted at / Other parts of libbe(3) were fairly strict on the mountpoint property of the BE dataset, and be_mount was not much better. It was improved in r347027 to allow mountpoint=none for depth==0, but this bit was still sensitive to mountpoint != / and mountpoint != none. Given that other parts of libbe(3) no longer restrict the mountpoint property here, and the rest of the base system is generally OK and will assume that a BE is mounted at /, let's do the same. Reported by: ler MFC after: 3 days Modified: head/lib/libbe/be_access.c Modified: head/lib/libbe/be_access.c ============================================================================== --- head/lib/libbe/be_access.c Tue Jun 25 17:27:37 2019 (r349379) +++ head/lib/libbe/be_access.c Tue Jun 25 18:13:39 2019 (r349380) @@ -96,7 +96,7 @@ be_mount_iter(zfs_handle_t *zfs_hdl, void *data) NULL, NULL, 0, 1)) return (1); - if (strcmp("none", zfs_mnt) == 0) { + if (strcmp("none", zfs_mnt) == 0 || info->depth == 0) { /* * mountpoint=none; we'll mount it at info->mountpoint assuming * we're at the root. If we're not at the root, we're likely From owner-svn-src-head@freebsd.org Tue Jun 25 18:35:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DDCC15D3995; Tue, 25 Jun 2019 18:35:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D91846FBC4; Tue, 25 Jun 2019 18:35:24 +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 B1BE71C4C0; Tue, 25 Jun 2019 18:35:24 +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 x5PIZOfR056469; Tue, 25 Jun 2019 18:35:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PIZOJ6056467; Tue, 25 Jun 2019 18:35:24 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201906251835.x5PIZOJ6056467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 25 Jun 2019 18:35:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349381 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 349381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D91846FBC4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 18:35:25 -0000 Author: mav Date: Tue Jun 25 18:35:23 2019 New Revision: 349381 URL: https://svnweb.freebsd.org/changeset/base/349381 Log: Avoid extra taskq_dispatch() calls by DMU. DMU sync code calls taskq_dispatch() for each sublist of os_dirty_dnodes and os_synced_dnodes. Since the number of sublists by default is equal to number of CPUs, it will dispatch equal, potentially large, number of tasks, waking up many CPUs to handle them, even if only one or few of sublists actually have any work to do. This change adds check for empty sublists to avoid this. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Tue Jun 25 18:13:39 2019 (r349380) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Tue Jun 25 18:35:23 2019 (r349381) @@ -1334,6 +1334,8 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx zio_t *zio; list_t *list; dbuf_dirty_record_t *dr; + int num_sublists; + multilist_t *ml; blkptr_t *blkptr_copy = kmem_alloc(sizeof (*os->os_rootbp), KM_SLEEP); *blkptr_copy = *os->os_rootbp; @@ -1402,10 +1404,13 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx } } - for (int i = 0; - i < multilist_get_num_sublists(os->os_dirty_dnodes[txgoff]); i++) { + ml = os->os_dirty_dnodes[txgoff]; + num_sublists = multilist_get_num_sublists(ml); + for (int i = 0; i < num_sublists; i++) { + if (multilist_sublist_is_empty_idx(ml, i)) + continue; sync_dnodes_arg_t *sda = kmem_alloc(sizeof (*sda), KM_SLEEP); - sda->sda_list = os->os_dirty_dnodes[txgoff]; + sda->sda_list = ml; sda->sda_sublist_idx = i; sda->sda_tx = tx; (void) taskq_dispatch(dmu_objset_pool(os)->dp_sync_taskq, @@ -1619,6 +1624,8 @@ userquota_updates_task(void *arg) void dmu_objset_do_userquota_updates(objset_t *os, dmu_tx_t *tx) { + int num_sublists; + if (!dmu_objset_userused_enabled(os)) return; @@ -1632,8 +1639,10 @@ dmu_objset_do_userquota_updates(objset_t *os, dmu_tx_t DMU_OT_USERGROUP_USED, DMU_OT_NONE, 0, tx)); } - for (int i = 0; - i < multilist_get_num_sublists(os->os_synced_dnodes); i++) { + num_sublists = multilist_get_num_sublists(os->os_synced_dnodes); + for (int i = 0; i < num_sublists; i++) { + if (multilist_sublist_is_empty_idx(os->os_synced_dnodes, i)) + continue; userquota_updates_arg_t *uua = kmem_alloc(sizeof (*uua), KM_SLEEP); uua->uua_os = os; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c Tue Jun 25 18:13:39 2019 (r349380) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c Tue Jun 25 18:35:23 2019 (r349381) @@ -360,6 +360,28 @@ multilist_sublist_remove(multilist_sublist_t *mls, voi list_remove(&mls->mls_list, obj); } +int +multilist_sublist_is_empty(multilist_sublist_t *mls) +{ + ASSERT(MUTEX_HELD(&mls->mls_lock)); + return (list_is_empty(&mls->mls_list)); +} + +int +multilist_sublist_is_empty_idx(multilist_t *ml, unsigned int sublist_idx) +{ + multilist_sublist_t *mls; + int empty; + + ASSERT3U(sublist_idx, <, ml->ml_num_sublists); + mls = &ml->ml_sublists[sublist_idx]; + ASSERT(!MUTEX_HELD(&mls->mls_lock)); + mutex_enter(&mls->mls_lock); + empty = list_is_empty(&mls->mls_list); + mutex_exit(&mls->mls_lock); + return (empty); +} + void * multilist_sublist_head(multilist_sublist_t *mls) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h Tue Jun 25 18:13:39 2019 (r349380) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h Tue Jun 25 18:35:23 2019 (r349381) @@ -89,6 +89,8 @@ void multilist_sublist_insert_head(multilist_sublist_t void multilist_sublist_insert_tail(multilist_sublist_t *, void *); void multilist_sublist_move_forward(multilist_sublist_t *mls, void *obj); void multilist_sublist_remove(multilist_sublist_t *, void *); +int multilist_sublist_is_empty(multilist_sublist_t *); +int multilist_sublist_is_empty_idx(multilist_t *, unsigned int); void *multilist_sublist_head(multilist_sublist_t *); void *multilist_sublist_tail(multilist_sublist_t *); From owner-svn-src-head@freebsd.org Tue Jun 25 18:47:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76CFE15D3F67; Tue, 25 Jun 2019 18:47:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1D228703D5; Tue, 25 Jun 2019 18:47:41 +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 E85B71C65F; Tue, 25 Jun 2019 18:47:40 +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 x5PIle3O061820; Tue, 25 Jun 2019 18:47:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PIlecl061819; Tue, 25 Jun 2019 18:47:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201906251847.x5PIlecl061819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 25 Jun 2019 18:47:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349383 - head/lib/libbe X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libbe X-SVN-Commit-Revision: 349383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1D228703D5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 18:47:41 -0000 Author: kevans Date: Tue Jun 25 18:47:40 2019 New Revision: 349383 URL: https://svnweb.freebsd.org/changeset/base/349383 Log: libbe(3): restructure be_mount, skip canmount check for BE dataset Further cleanup after r349380; loader and kernel will both ignore canmount on the root dataset as well, so we should not be so strict about it when mounting it. be_mount is restructured to make it more clear that depth==0 is special, and to not try fetching these properties that we won't care about. MFC after: 3 days Modified: head/lib/libbe/be_access.c Modified: head/lib/libbe/be_access.c ============================================================================== --- head/lib/libbe/be_access.c Tue Jun 25 18:36:11 2019 (r349382) +++ head/lib/libbe/be_access.c Tue Jun 25 18:47:40 2019 (r349383) @@ -89,25 +89,31 @@ be_mount_iter(zfs_handle_t *zfs_hdl, void *data) return (0); } - if (zfs_prop_get_int(zfs_hdl, ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_OFF) - return (0); + /* + * canmount and mountpoint are both ignored for the BE dataset, because + * the rest of the system (kernel and loader) will effectively do the + * same. + */ + if (info->depth == 0) { + snprintf(tmp, BE_MAXPATHLEN, "%s", info->mountpoint); + } else { + if (zfs_prop_get_int(zfs_hdl, ZFS_PROP_CANMOUNT) == + ZFS_CANMOUNT_OFF) + return (0); - if (zfs_prop_get(zfs_hdl, ZFS_PROP_MOUNTPOINT, zfs_mnt, BE_MAXPATHLEN, - NULL, NULL, 0, 1)) - return (1); + if (zfs_prop_get(zfs_hdl, ZFS_PROP_MOUNTPOINT, zfs_mnt, + BE_MAXPATHLEN, NULL, NULL, 0, 1)) + return (1); - if (strcmp("none", zfs_mnt) == 0 || info->depth == 0) { /* - * mountpoint=none; we'll mount it at info->mountpoint assuming - * we're at the root. If we're not at the root, we're likely - * at some intermediate dataset (e.g. zroot/var) that will have - * children that may need to be mounted. + * We've encountered mountpoint=none at some intermediate + * dataset (e.g. zroot/var) that will have children that may + * need to be mounted. Skip mounting it, but iterate through + * the children. */ - if (info->depth > 0) + if (strcmp("none", zfs_mnt) == 0) goto skipmount; - snprintf(tmp, BE_MAXPATHLEN, "%s", info->mountpoint); - } else { mountpoint = be_mountpoint_augmented(info->lbh, zfs_mnt); snprintf(tmp, BE_MAXPATHLEN, "%s%s", info->mountpoint, mountpoint); From owner-svn-src-head@freebsd.org Tue Jun 25 19:06:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC7CB15D461E; Tue, 25 Jun 2019 19:06:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5B4527102F; Tue, 25 Jun 2019 19:06:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 320B81C9B9; Tue, 25 Jun 2019 19:06:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5PJ6iFQ072233; Tue, 25 Jun 2019 19:06:44 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PJ6iZI072231; Tue, 25 Jun 2019 19:06:44 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201906251906.x5PJ6iZI072231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 25 Jun 2019 19:06:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349385 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5B4527102F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 19:06:45 -0000 Author: emaste Date: Tue Jun 25 19:06:43 2019 New Revision: 349385 URL: https://svnweb.freebsd.org/changeset/base/349385 Log: bhyve: avoid theoretical stack buffer overflow from integer overflow Use the proper size_t type to match strlen's return type. This is not exploitable in practice as this parses command line arguments, which are limited to well below 2^31 bytes. This is a minimal change to address the reported issue; hda_parse_config and the rest of this file will benefit from further review. Reported by: Fakhri Zulkifli Reviewed by: jhb, markj MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/bhyve/pci_hda.c Modified: head/usr.sbin/bhyve/pci_hda.c ============================================================================== --- head/usr.sbin/bhyve/pci_hda.c Tue Jun 25 18:58:51 2019 (r349384) +++ head/usr.sbin/bhyve/pci_hda.c Tue Jun 25 19:06:43 2019 (r349385) @@ -324,15 +324,14 @@ hda_parse_config(const char *opts, const char *key, ch char buf[64]; char *s = buf; char *tmp = NULL; - int len; + size_t len; int i; if (!opts) return (0); len = strlen(opts); - - if (len >= 64) { + if (len >= sizeof(buf)) { DPRINTF("Opts too big\n"); return (0); } From owner-svn-src-head@freebsd.org Tue Jun 25 19:44:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B741015D5AAA; Tue, 25 Jun 2019 19:44:23 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5E2D772E36; Tue, 25 Jun 2019 19:44:23 +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 348421D087; Tue, 25 Jun 2019 19:44:23 +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 x5PJiNha093353; Tue, 25 Jun 2019 19:44:23 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PJiNaA093352; Tue, 25 Jun 2019 19:44:23 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201906251944.x5PJiNaA093352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 25 Jun 2019 19:44:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349391 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5E2D772E36 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 19:44:23 -0000 Author: asomers Date: Tue Jun 25 19:44:22 2019 New Revision: 349391 URL: https://svnweb.freebsd.org/changeset/base/349391 Log: fcntl: style changes to r349248 Reported by: bde MFC after: 2 weeks MFC-With: 349248 Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Tue Jun 25 19:36:01 2019 (r349390) +++ head/sys/kern/vfs_vnops.c Tue Jun 25 19:44:22 2019 (r349391) @@ -499,10 +499,8 @@ sequential_heuristic(struct uio *uio, struct file *fp) * closely related to the best I/O size for real disks than * to any block size used by software. */ - fp->f_seqcount += MIN(IO_SEQMAX, + fp->f_seqcount += lmin(IO_SEQMAX, howmany(uio->uio_resid, 16384)); - if (fp->f_seqcount > IO_SEQMAX) - fp->f_seqcount = IO_SEQMAX; return (fp->f_seqcount << IO_SEQSHIFT); } From owner-svn-src-head@freebsd.org Tue Jun 25 19:55:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A73F715D5E4D; Tue, 25 Jun 2019 19:55:43 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CBF57347E; Tue, 25 Jun 2019 19:55:43 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DE771D22E; Tue, 25 Jun 2019 19:55:43 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5PJtgZx098888; Tue, 25 Jun 2019 19:55:42 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PJtgil098887; Tue, 25 Jun 2019 19:55:42 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201906251955.x5PJtgil098887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Tue, 25 Jun 2019 19:55:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349392 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: julian X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 349392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4CBF57347E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 19:55:43 -0000 Author: julian Date: Tue Jun 25 19:55:42 2019 New Revision: 349392 URL: https://svnweb.freebsd.org/changeset/base/349392 Log: Fix annoying whitespace issue. NO real change Modified: head/sys/sys/pmckern.h Modified: head/sys/sys/pmckern.h ============================================================================== --- head/sys/sys/pmckern.h Tue Jun 25 19:44:22 2019 (r349391) +++ head/sys/sys/pmckern.h Tue Jun 25 19:55:42 2019 (r349392) @@ -226,7 +226,7 @@ do { \ */ #define PMC_CALL_HOOK_UNLOCKED(t, cmd, arg) \ do { \ - if (pmc_hook != NULL) \ + if (pmc_hook != NULL) \ (pmc_hook)((t), (cmd), (arg)); \ } while (0) From owner-svn-src-head@freebsd.org Tue Jun 25 20:25:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B48E15D6B8D; Tue, 25 Jun 2019 20:25:17 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E9C274DAF; Tue, 25 Jun 2019 20:25:17 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E18AE1D73A; Tue, 25 Jun 2019 20:25:16 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5PKPGYJ014590; Tue, 25 Jun 2019 20:25:16 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PKPGml014589; Tue, 25 Jun 2019 20:25:16 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201906252025.x5PKPGml014589@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Tue, 25 Jun 2019 20:25:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349393 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 349393 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0E9C274DAF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 20:25:17 -0000 Author: dougm Date: Tue Jun 25 20:25:16 2019 New Revision: 349393 URL: https://svnweb.freebsd.org/changeset/base/349393 Log: Eliminate some uses of the prev and next fields of vm_map_entry_t. Since the only caller to vm_map_splay is vm_map_lookup_entry, move the implementation of vm_map_splay into vm_map_lookup_helper, called by vm_map_lookup_entry. vm_map_lookup_entry returns the greatest entry less than or equal to a given address, but in many cases the caller wants the least entry greater than or equal to the address and uses the next pointer to get to it. Provide an alternative interface to lookup, vm_map_lookup_entry_ge, to provide the latter behavior, and let callers use one or the other rather than having them use the next pointer after a lookup miss to get what they really want. In vm_map_growstack, the caller wants an entry that includes a given address, and either the preceding or next entry depending on the value of eflags in the first entry. Incorporate that behavior into vm_map_lookup_helper, the function that implements all of these lookups. Eliminate some temporary variables used with vm_map_lookup_entry, but inessential. Reviewed by: markj (earlier version) Approved by: kib (mentor) Differential Revision: https://reviews.freebsd.org/D20664 Modified: head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Tue Jun 25 19:55:42 2019 (r349392) +++ head/sys/vm/vm_map.c Tue Jun 25 20:25:16 2019 (r349393) @@ -983,6 +983,17 @@ vm_map_entry_max_free_right(vm_map_entry_t root, vm_ma root->right->max_free : right_ancestor->start - root->end); } +/* + * vm_map_splay_split, vm_map_splay_merge: + * + * The Sleator and Tarjan top-down splay algorithm with the following + * variation. Max_free must be computed bottom-up, so on the downward + * pass (vm_map_splay_split), maintain the left and right spines in + * reverse order, and ensure that the max_free values for those nodes + * store the values of their descendents not on the search path. Later, + * make a second pass up each side (vm_map_splay_merge) to fix the + * pointers and compute max_free. The time bound is O(log n) amortized. + */ #define SPLAY_LEFT_STEP(root, y, rlist, test) do { \ vm_size_t max_free; \ \ @@ -1166,56 +1177,6 @@ vm_map_splay_merge(vm_map_t map, vm_map_entry_t root, } /* - * vm_map_splay: - * - * The Sleator and Tarjan top-down splay algorithm with the - * following variation. Max_free must be computed bottom-up, so - * on the downward pass, maintain the left and right spines in - * reverse order. Then, make a second pass up each side to fix - * the pointers and compute max_free. The time bound is O(log n) - * amortized. - * - * The new root is the vm_map_entry containing "addr", or else an - * adjacent entry (lower if possible) if addr is not in the tree. - * - * The map must be locked, and leaves it so. - * - * Returns: the new root. - */ -static vm_map_entry_t -vm_map_splay(vm_map_t map, vm_offset_t addr) -{ - vm_map_entry_t llist, rlist, root; - - root = vm_map_splay_split(map, addr, 0, &llist, &rlist); - if (root != NULL) { - /* do nothing */ - } else if (llist != &map->header) { - /* - * Recover the greatest node in the left - * subtree and make it the root. - */ - root = llist; - llist = root->right; - root->right = NULL; - } else if (rlist != &map->header) { - /* - * Recover the least node in the right - * subtree and make it the root. - */ - root = rlist; - rlist = root->left; - root->left = NULL; - } else { - /* There is no root. */ - return (NULL); - } - vm_map_splay_merge(map, root, llist, rlist); - VM_MAP_ASSERT_CONSISTENT(map); - return (root); -} - -/* * vm_map_entry_{un,}link: * * Insert/remove entries from maps. @@ -1331,81 +1292,133 @@ vm_map_entry_resize(vm_map_t map, vm_map_entry_t entry } /* - * vm_map_lookup_entry: [ internal use only ] + * vm_map_lookup_helper: [ internal use only ] * - * Finds the map entry containing (or - * immediately preceding) the specified address - * in the given map; the entry is returned - * in the "entry" parameter. The boolean - * result indicates whether the address is - * actually contained in the map. + * Finds the map entry containing (or adjacent to) the specified address + * in the given map; the entry is returned in the "entry" parameter. The + * boolean result indicates whether the address is actually contained in + * the map. If the address is not contained in the map, parameter lesseq + * determines whether the entry provided is before or after the address. + * If the address is contained in the map, parameter nbr, if not NULL, is + * where the next or previous entry is saved, depending on the value of + * eflags in the found entry. */ -boolean_t -vm_map_lookup_entry( - vm_map_t map, - vm_offset_t address, - vm_map_entry_t *entry) /* OUT */ +static bool +vm_map_lookup_helper(vm_map_t map, vm_offset_t addr, bool lesseq, + vm_map_entry_t *entry, vm_map_entry_t *nbr) /* OUT */ { - vm_map_entry_t cur, lbound; - boolean_t locked; + vm_map_entry_t llist, rlist, root; + bool locked, found; /* * If the map is empty, then the map entry immediately preceding - * "address" is the map's header. + * "addr" is the map's header. */ - cur = map->root; - if (cur == NULL) { + root = map->root; + if (root == NULL) { *entry = &map->header; - return (FALSE); + return (false); } - if (address >= cur->start && cur->end > address) { - *entry = cur; - return (TRUE); - } if ((locked = vm_map_locked(map)) || sx_try_upgrade(&map->lock)) { + /* * Splay requires a write lock on the map. However, it only * restructures the binary search tree; it does not otherwise * change the map. Thus, the map's timestamp need not change * on a temporary upgrade. */ - cur = vm_map_splay(map, address); + root = vm_map_splay_split(map, addr, 0, &llist, &rlist); + found = root != NULL; + *entry = root; + if (root != NULL) { + if (nbr == NULL) + ; /* Ignore. */ + else if ((root->eflags & MAP_ENTRY_STACK_GAP_DN) != 0) { + vm_map_splay_findnext(root, &rlist); + *nbr = rlist; + } else { + vm_map_splay_findprev(root, &llist); + *nbr = llist; + } + } else if (llist != &map->header) { + /* + * Recover the greatest node in the left + * subtree and make it the root. + */ + *entry = lesseq ? llist : rlist; + root = llist; + llist = root->right; + root->right = NULL; + } else { + /* + * Recover the least node in the right + * subtree and make it the root. + */ + *entry = lesseq ? llist : rlist; + root = rlist; + rlist = root->left; + root->left = NULL; + } + vm_map_splay_merge(map, root, llist, rlist); + VM_MAP_ASSERT_CONSISTENT(map); if (!locked) sx_downgrade(&map->lock); - - /* - * If "address" is contained within a map entry, the new root - * is that map entry. Otherwise, the new root is a map entry - * immediately before or after "address". - */ - if (address < cur->start) { - *entry = &map->header; - return (FALSE); - } - *entry = cur; - return (address < cur->end); + return (found); } /* * Since the map is only locked for read access, perform a - * standard binary search tree lookup for "address". + * standard binary search tree lookup for "addr". */ - lbound = &map->header; + llist = rlist = &map->header; do { - if (address < cur->start) { - cur = cur->left; - } else if (cur->end <= address) { - lbound = cur; - cur = cur->right; + if (addr < root->start) { + rlist = root; + root = root->left; + } else if (root->end <= addr) { + llist = root; + root = root->right; } else { - *entry = cur; - return (TRUE); + *entry = root; + if (nbr == NULL); + else if ((root->eflags & MAP_ENTRY_STACK_GAP_DN) != 0) { + /* Make nbr the successor to root. */ + if (root->right != NULL) { + rlist = root->right; + while (rlist->left != NULL) + rlist = rlist->left; + } + *nbr = rlist; + } else { + /* Make nbr the predecessor to root. */ + if (root->left != NULL) { + llist = root->left; + while (llist->right != NULL) + llist = llist->right; + } + *nbr = llist; + } + return (true); } - } while (cur != NULL); - *entry = lbound; - return (FALSE); + } while (root != NULL); + *entry = lesseq ? llist : rlist; + return (false); } +bool +vm_map_lookup_entry(vm_map_t map, vm_offset_t addr, + vm_map_entry_t *entry) /* OUT */ +{ + return (vm_map_lookup_helper(map, addr, true, entry, NULL)); +} + +static bool +vm_map_lookup_entry_ge(vm_map_t map, vm_offset_t addr, + vm_map_entry_t *entry) /* OUT */ +{ + return (vm_map_lookup_helper(map, addr, false, entry, NULL)); +} + /* * vm_map_insert: * @@ -1422,7 +1435,7 @@ int vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset, vm_offset_t start, vm_offset_t end, vm_prot_t prot, vm_prot_t max, int cow) { - vm_map_entry_t new_entry, prev_entry, temp_entry; + vm_map_entry_t new_entry, prev_entry; struct ucred *cred; vm_eflags_t protoeflags; vm_inherit_t inheritance; @@ -1447,11 +1460,9 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof * Find the entry prior to the proposed starting address; if it's part * of an existing entry, this range is bogus. */ - if (vm_map_lookup_entry(map, start, &temp_entry)) + if (vm_map_lookup_entry(map, start, &prev_entry)) return (KERN_NO_SPACE); - prev_entry = temp_entry; - /* * Assert that the next entry doesn't overlap the end point. */ @@ -2314,10 +2325,8 @@ vm_map_submap( VM_MAP_RANGE_CHECK(map, start, end); - if (vm_map_lookup_entry(map, start, &entry)) { + if (vm_map_lookup_entry_ge(map, start, &entry)) vm_map_clip_start(map, entry, start); - } else - entry = entry->next; vm_map_clip_end(map, entry, end); @@ -2472,8 +2481,7 @@ again: VM_MAP_RANGE_CHECK(map, start, end); - if (!vm_map_lookup_entry(map, start, &entry)) - entry = entry->next; + vm_map_lookup_entry_ge(map, start, &entry); /* * Make a first pass to check for protection violations. @@ -2663,11 +2671,9 @@ vm_map_madvise( */ VM_MAP_RANGE_CHECK(map, start, end); - if (vm_map_lookup_entry(map, start, &entry)) { + if (vm_map_lookup_entry_ge(map, start, &entry)) { if (modify_map) vm_map_clip_start(map, entry, start); - } else { - entry = entry->next; } if (modify_map) { @@ -2799,7 +2805,6 @@ vm_map_inherit(vm_map_t map, vm_offset_t start, vm_off vm_inherit_t new_inheritance) { vm_map_entry_t entry; - vm_map_entry_t temp_entry; switch (new_inheritance) { case VM_INHERIT_NONE: @@ -2814,11 +2819,8 @@ vm_map_inherit(vm_map_t map, vm_offset_t start, vm_off return (KERN_SUCCESS); vm_map_lock(map); VM_MAP_RANGE_CHECK(map, start, end); - if (vm_map_lookup_entry(map, start, &temp_entry)) { - entry = temp_entry; + if (vm_map_lookup_entry_ge(map, start, &entry)) vm_map_clip_start(map, entry, start); - } else - entry = temp_entry->next; while (entry->start < end) { vm_map_clip_end(map, entry, end); if ((entry->eflags & MAP_ENTRY_GUARD) == 0 || @@ -2851,10 +2853,8 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs user_unwire = (flags & VM_MAP_WIRE_USER) ? TRUE : FALSE; vm_map_lock(map); VM_MAP_RANGE_CHECK(map, start, end); - if (!vm_map_lookup_entry(map, start, &first_entry)) { - if (flags & VM_MAP_WIRE_HOLESOK) - first_entry = first_entry->next; - else { + if (!vm_map_lookup_entry_ge(map, start, &first_entry)) { + if ((flags & VM_MAP_WIRE_HOLESOK) == 0) { vm_map_unlock(map); return (KERN_INVALID_ADDRESS); } @@ -2882,11 +2882,9 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs * Specifically, the entry may have been * clipped, merged, or deleted. */ - if (!vm_map_lookup_entry(map, saved_start, + if (!vm_map_lookup_entry_ge(map, saved_start, &tmp_entry)) { - if (flags & VM_MAP_WIRE_HOLESOK) - tmp_entry = tmp_entry->next; - else { + if ((flags & VM_MAP_WIRE_HOLESOK) == 0) { if (saved_start == start) { /* * First_entry has been deleted. @@ -2944,11 +2942,9 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs done: need_wakeup = FALSE; if (first_entry == NULL) { - result = vm_map_lookup_entry(map, start, &first_entry); - if (!result && (flags & VM_MAP_WIRE_HOLESOK)) - first_entry = first_entry->next; - else - KASSERT(result, ("vm_map_unwire: lookup failed")); + result = vm_map_lookup_entry_ge(map, start, &first_entry); + KASSERT(result || (flags & VM_MAP_WIRE_HOLESOK) != 0, + ("vm_map_unwire: lookup failed")); } for (entry = first_entry; entry->start < end; entry = entry->next) { /* @@ -3090,10 +3086,8 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm prot |= VM_PROT_WRITE; user_wire = (flags & VM_MAP_WIRE_USER) ? TRUE : FALSE; VM_MAP_RANGE_CHECK(map, start, end); - if (!vm_map_lookup_entry(map, start, &first_entry)) { - if (flags & VM_MAP_WIRE_HOLESOK) - first_entry = first_entry->next; - else + if (!vm_map_lookup_entry_ge(map, start, &first_entry)) { + if ((flags & VM_MAP_WIRE_HOLESOK) == 0) return (KERN_INVALID_ADDRESS); } last_timestamp = map->timestamp; @@ -3119,11 +3113,9 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm * Specifically, the entry may have been * clipped, merged, or deleted. */ - if (!vm_map_lookup_entry(map, saved_start, + if (!vm_map_lookup_entry_ge(map, saved_start, &tmp_entry)) { - if (flags & VM_MAP_WIRE_HOLESOK) - tmp_entry = tmp_entry->next; - else { + if ((flags & VM_MAP_WIRE_HOLESOK) == 0) { if (saved_start == start) { /* * first_entry has been deleted. @@ -3256,11 +3248,9 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm done: need_wakeup = FALSE; if (first_entry == NULL) { - result = vm_map_lookup_entry(map, start, &first_entry); - if (!result && (flags & VM_MAP_WIRE_HOLESOK)) - first_entry = first_entry->next; - else - KASSERT(result, ("vm_map_wire: lookup failed")); + result = vm_map_lookup_entry_ge(map, start, &first_entry); + KASSERT(result || (flags & VM_MAP_WIRE_HOLESOK) != 0, + ("vm_map_wire: lookup failed")); } for (entry = first_entry; entry->start < end; entry = entry->next) { /* @@ -3361,7 +3351,8 @@ vm_map_sync( if (!vm_map_lookup_entry(map, start, &entry)) { vm_map_unlock_read(map); return (KERN_INVALID_ADDRESS); - } else if (start == end) { + } + if (start == end) { start = entry->start; end = entry->end; } @@ -3416,9 +3407,10 @@ vm_map_sync( start += size; vm_object_deallocate(object); vm_map_lock_read(map); - if (last_timestamp == map->timestamp || - !vm_map_lookup_entry(map, start, ¤t)) + if (last_timestamp == map->timestamp) current = current->next; + else + vm_map_lookup_entry_ge(map, start, ¤t); } vm_map_unlock_read(map); @@ -3551,7 +3543,6 @@ int vm_map_delete(vm_map_t map, vm_offset_t start, vm_offset_t end) { vm_map_entry_t entry; - vm_map_entry_t first_entry; VM_MAP_ASSERT_LOCKED(map); if (start == end) @@ -3560,12 +3551,8 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offs /* * Find the start of the region, and clip it */ - if (!vm_map_lookup_entry(map, start, &first_entry)) - entry = first_entry->next; - else { - entry = first_entry; + if (vm_map_lookup_entry_ge(map, start, &entry)) vm_map_clip_start(map, entry, start); - } /* * Step through all entries in this region @@ -3583,29 +3570,22 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offs vm_map_entry_system_wired_count(entry) != 0)) { unsigned int last_timestamp; vm_offset_t saved_start; - vm_map_entry_t tmp_entry; saved_start = entry->start; entry->eflags |= MAP_ENTRY_NEEDS_WAKEUP; last_timestamp = map->timestamp; (void) vm_map_unlock_and_wait(map, 0); vm_map_lock(map); - if (last_timestamp + 1 != map->timestamp) { - /* - * Look again for the entry because the map was - * modified while it was unlocked. - * Specifically, the entry may have been - * clipped, merged, or deleted. - */ - if (!vm_map_lookup_entry(map, saved_start, - &tmp_entry)) - entry = tmp_entry->next; - else { - entry = tmp_entry; - vm_map_clip_start(map, entry, - saved_start); - } - } + if (last_timestamp + 1 == map->timestamp) + continue; + + /* + * Look again for the entry because the map was + * modified while it was unlocked. Specifically, the + * entry may have been clipped, merged, or deleted. + */ + if (vm_map_lookup_entry_ge(map, saved_start, &entry)) + vm_map_clip_start(map, entry, saved_start); continue; } vm_map_clip_end(map, entry, end); @@ -3680,11 +3660,9 @@ vm_map_check_protection(vm_map_t map, vm_offset_t star vm_prot_t protection) { vm_map_entry_t entry; - vm_map_entry_t tmp_entry; - if (!vm_map_lookup_entry(map, start, &tmp_entry)) + if (!vm_map_lookup_entry(map, start, &entry)) return (FALSE); - entry = tmp_entry; while (start < end) { /* @@ -4120,7 +4098,7 @@ static int vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, vm_size_t max_ssize, vm_size_t growsize, vm_prot_t prot, vm_prot_t max, int cow) { - vm_map_entry_t new_entry, prev_entry; + vm_map_entry_t new_entry; vm_offset_t bot, gap_bot, gap_top, top; vm_size_t init_ssize, sgp; int orient, rv; @@ -4148,13 +4126,13 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, init_ssize = max_ssize - sgp; /* If addr is already mapped, no go */ - if (vm_map_lookup_entry(map, addrbos, &prev_entry)) + if (vm_map_lookup_entry_ge(map, addrbos, &new_entry)) return (KERN_NO_SPACE); /* * If we can't accommodate max_ssize in the current mapping, no go. */ - if (prev_entry->next->start < addrbos + max_ssize) + if (new_entry->start < addrbos + max_ssize) return (KERN_NO_SPACE); /* @@ -4181,7 +4159,6 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, rv = vm_map_insert(map, NULL, 0, bot, top, prot, max, cow); if (rv != KERN_SUCCESS) return (rv); - new_entry = prev_entry->next; KASSERT(new_entry->end == top || new_entry->start == bot, ("Bad entry start/end for new stack entry")); KASSERT((orient & MAP_STACK_GROWS_DOWN) == 0 || @@ -4240,19 +4217,18 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_ma vmemlim = lim_cur(curthread, RLIMIT_VMEM); retry: /* If addr is not in a hole for a stack grow area, no need to grow. */ - if (gap_entry == NULL && !vm_map_lookup_entry(map, addr, &gap_entry)) + if (gap_entry == NULL && + !vm_map_lookup_helper(map, addr, true, &gap_entry, &stack_entry)) return (KERN_FAILURE); if ((gap_entry->eflags & MAP_ENTRY_GUARD) == 0) return (KERN_SUCCESS); if ((gap_entry->eflags & MAP_ENTRY_STACK_GAP_DN) != 0) { - stack_entry = gap_entry->next; if ((stack_entry->eflags & MAP_ENTRY_GROWS_DOWN) == 0 || stack_entry->start != gap_entry->end) return (KERN_FAILURE); grow_amount = round_page(stack_entry->start - addr); grow_down = true; } else if ((gap_entry->eflags & MAP_ENTRY_STACK_GAP_UP) != 0) { - stack_entry = gap_entry->prev; if ((stack_entry->eflags & MAP_ENTRY_GROWS_UP) == 0 || stack_entry->end != gap_entry->start) return (KERN_FAILURE); Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Tue Jun 25 19:55:42 2019 (r349392) +++ head/sys/vm/vm_map.h Tue Jun 25 20:25:16 2019 (r349393) @@ -415,7 +415,7 @@ int vm_map_lookup (vm_map_t *, vm_offset_t, vm_prot_t, int vm_map_lookup_locked(vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, vm_object_t *, vm_pindex_t *, vm_prot_t *, boolean_t *); void vm_map_lookup_done (vm_map_t, vm_map_entry_t); -boolean_t vm_map_lookup_entry (vm_map_t, vm_offset_t, vm_map_entry_t *); +bool vm_map_lookup_entry(vm_map_t, vm_offset_t, vm_map_entry_t *); int vm_map_protect (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t, boolean_t); int vm_map_remove (vm_map_t, vm_offset_t, vm_offset_t); void vm_map_simplify_entry(vm_map_t map, vm_map_entry_t entry); From owner-svn-src-head@freebsd.org Tue Jun 25 21:26:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 920C115D7E9E; Tue, 25 Jun 2019 21:26:59 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE1B677A85; Tue, 25 Jun 2019 21:26:58 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 501DA1E173; Tue, 25 Jun 2019 21:26:58 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5PLQwCr048336; Tue, 25 Jun 2019 21:26:58 GMT (envelope-from bcran@FreeBSD.org) Received: (from bcran@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5PLQwuU048335; Tue, 25 Jun 2019 21:26:58 GMT (envelope-from bcran@FreeBSD.org) Message-Id: <201906252126.x5PLQwuU048335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcran set sender to bcran@FreeBSD.org using -f From: Rebecca Cran Date: Tue, 25 Jun 2019 21:26:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349395 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: bcran X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 349395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DE1B677A85 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2019 21:26:59 -0000 Author: bcran Date: Tue Jun 25 21:26:57 2019 New Revision: 349395 URL: https://svnweb.freebsd.org/changeset/base/349395 Log: Disconnect EFI HTTP support The EFI HTTP code has been causing boot failures for people, so disable it while a fix is being worked on. Modified: head/stand/efi/loader/conf.c Modified: head/stand/efi/loader/conf.c ============================================================================== --- head/stand/efi/loader/conf.c Tue Jun 25 21:21:34 2019 (r349394) +++ head/stand/efi/loader/conf.c Tue Jun 25 21:26:57 2019 (r349395) @@ -39,7 +39,6 @@ struct devsw *devsw[] = { &efipart_fddev, &efipart_cddev, &efipart_hddev, - &efihttp_dev, /* ordering with efinet_dev matters */ &efinet_dev, &vdisk_dev, #ifdef EFI_ZFS_BOOT @@ -55,7 +54,6 @@ struct fs_ops *file_system[] = { &dosfs_fsops, &ufs_fsops, &cd9660_fsops, - &efihttp_fsops, &tftp_fsops, &nfs_fsops, &gzipfs_fsops, From owner-svn-src-head@freebsd.org Wed Jun 26 00:53:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC4BA15DB617; Wed, 26 Jun 2019 00:53:43 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 930AA8598B; Wed, 26 Jun 2019 00:53:43 +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 6CA152043B; Wed, 26 Jun 2019 00:53:43 +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 x5Q0rhp7058601; Wed, 26 Jun 2019 00:53:43 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5Q0rhZs058600; Wed, 26 Jun 2019 00:53:43 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201906260053.x5Q0rhZs058600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 26 Jun 2019 00:53:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349399 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 930AA8598B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.92)[-0.916,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 00:53:44 -0000 Author: cy Date: Wed Jun 26 00:53:43 2019 New Revision: 349399 URL: https://svnweb.freebsd.org/changeset/base/349399 Log: Prompted by r349366, ipfilter is also does not conform to RFC 3128 by dropping TCP fragments with offset = 1. In addition to dropping these fragments, add a DTrace probe to allow for more detailed monitoring and diagnosis if required. MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Wed Jun 26 00:06:41 2019 (r349398) +++ head/sys/contrib/ipfilter/netinet/fil.c Wed Jun 26 00:53:43 2019 (r349399) @@ -1723,6 +1723,10 @@ ipf_pr_ipv4hdr(fin) * calculate the byte offset that it represents. */ off &= IP_MF|IP_OFFMASK; + if (off == 1 && p == IPPROTO_TCP) { + fin->fin_flx |= FI_SHORT; /* RFC 3128 */ + DT1(ipf_fi_tcp_frag_off_1, fr_info_t *, fin); + } if (off != 0) { int morefrag = off & IP_MF; From owner-svn-src-head@freebsd.org Wed Jun 26 00:53:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1687515DB635; Wed, 26 Jun 2019 00:53:47 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AD7C485997; Wed, 26 Jun 2019 00:53:46 +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 871462043C; Wed, 26 Jun 2019 00:53:46 +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 x5Q0rkrQ058649; Wed, 26 Jun 2019 00:53:46 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5Q0rkSE058648; Wed, 26 Jun 2019 00:53:46 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201906260053.x5Q0rkSE058648@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 26 Jun 2019 00:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349400 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AD7C485997 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.916,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 00:53:47 -0000 Author: cy Date: Wed Jun 26 00:53:46 2019 New Revision: 349400 URL: https://svnweb.freebsd.org/changeset/base/349400 Log: Remove a tautological compare for offset != 0. MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Wed Jun 26 00:53:43 2019 (r349399) +++ head/sys/contrib/ipfilter/netinet/fil.c Wed Jun 26 00:53:46 2019 (r349400) @@ -1732,24 +1732,22 @@ ipf_pr_ipv4hdr(fin) fi->fi_flx |= FI_FRAG; off &= IP_OFFMASK; - if (off != 0) { - fin->fin_flx |= FI_FRAGBODY; - off <<= 3; - if ((off + fin->fin_dlen > 65535) || - (fin->fin_dlen == 0) || - ((morefrag != 0) && ((fin->fin_dlen & 7) != 0))) { - /* - * The length of the packet, starting at its - * offset cannot exceed 65535 (0xffff) as the - * length of an IP packet is only 16 bits. - * - * Any fragment that isn't the last fragment - * must have a length greater than 0 and it - * must be an even multiple of 8. - */ - fi->fi_flx |= FI_BAD; - DT1(ipf_fi_bad_fragbody_gt_65535, fr_info_t *, fin); - } + fin->fin_flx |= FI_FRAGBODY; + off <<= 3; + if ((off + fin->fin_dlen > 65535) || + (fin->fin_dlen == 0) || + ((morefrag != 0) && ((fin->fin_dlen & 7) != 0))) { + /* + * The length of the packet, starting at its + * offset cannot exceed 65535 (0xffff) as the + * length of an IP packet is only 16 bits. + * + * Any fragment that isn't the last fragment + * must have a length greater than 0 and it + * must be an even multiple of 8. + */ + fi->fi_flx |= FI_BAD; + DT1(ipf_fi_bad_fragbody_gt_65535, fr_info_t *, fin); } } fin->fin_off = off; From owner-svn-src-head@freebsd.org Wed Jun 26 00:53:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 761F615DB656; Wed, 26 Jun 2019 00:53:55 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D386385A41; Wed, 26 Jun 2019 00:53:52 +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 021D12043D; Wed, 26 Jun 2019 00:53:50 +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 x5Q0rnFK058695; Wed, 26 Jun 2019 00:53:49 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5Q0rnSW058693; Wed, 26 Jun 2019 00:53:49 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201906260053.x5Q0rnSW058693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 26 Jun 2019 00:53:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349401 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D386385A41 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.916,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 00:53:55 -0000 Author: cy Date: Wed Jun 26 00:53:49 2019 New Revision: 349401 URL: https://svnweb.freebsd.org/changeset/base/349401 Log: While working on PR/238796 I discovered an unused variable in frdest, the next hop structure. It is likely this contributes to PR/238796 though other factors remain to be investigated. PR: 238796 MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/fil.c head/sys/contrib/ipfilter/netinet/ip_fil.h Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Wed Jun 26 00:53:46 2019 (r349400) +++ head/sys/contrib/ipfilter/netinet/fil.c Wed Jun 26 00:53:49 2019 (r349401) @@ -7474,10 +7474,6 @@ ipf_resolvedest(softc, base, fdp, v) } fdp->fd_ptr = ifp; - if ((ifp != NULL) && (ifp != (void *)-1)) { - fdp->fd_local = ipf_deliverlocal(softc, v, ifp, &fdp->fd_ip6); - } - return errval; } Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil.h Wed Jun 26 00:53:46 2019 (r349400) +++ head/sys/contrib/ipfilter/netinet/ip_fil.h Wed Jun 26 00:53:49 2019 (r349401) @@ -560,7 +560,6 @@ typedef struct frdest { addrfamily_t fd_addr; fr_dtypes_t fd_type; int fd_name; - int fd_local; } frdest_t; #define fd_ip6 fd_addr.adf_addr From owner-svn-src-head@freebsd.org Wed Jun 26 01:14:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2626115DBEC9; Wed, 26 Jun 2019 01:14:41 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BF7F586721; Wed, 26 Jun 2019 01:14:40 +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 7CC4E20799; Wed, 26 Jun 2019 01:14:40 +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 x5Q1Eeq9069257; Wed, 26 Jun 2019 01:14:40 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5Q1Ee7e069255; Wed, 26 Jun 2019 01:14:40 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201906260114.x5Q1Ee7e069255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 26 Jun 2019 01:14:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349402 - in head/sys/powerpc: include powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys/powerpc: include powerpc X-SVN-Commit-Revision: 349402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BF7F586721 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.919,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 01:14:41 -0000 Author: jhibbits Date: Wed Jun 26 01:14:39 2019 New Revision: 349402 URL: https://svnweb.freebsd.org/changeset/base/349402 Log: powerpc/booke: Handle misaligned floating point loads/stores as on AIM Misaligned floating point loads and stores are already handled for AIM, but use the DSISR to obtain the necessary data. Book-E does not have the DSISR, so these fixups are not performed, leading to a SIGBUS on misaligned FP loads or stores. Obtain the necessary data on the Book-E side, similar to how is done for SPE. MFC after: 1 week Modified: head/sys/powerpc/include/trap.h head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/include/trap.h ============================================================================== --- head/sys/powerpc/include/trap.h Wed Jun 26 00:53:49 2019 (r349401) +++ head/sys/powerpc/include/trap.h Wed Jun 26 01:14:39 2019 (r349402) @@ -130,7 +130,7 @@ /* Macros to extract register information */ #define EXC_ALI_RST(dsisr) ((dsisr >> 5) & 0x1f) /* source or target */ #define EXC_ALI_RA(dsisr) (dsisr & 0x1f) -#define EXC_ALI_SPE_REG(instr) ((instr >> 21) & 0x1f) +#define EXC_ALI_INST_RST(instr) ((instr >> 21) & 0x1f) /* * SRR1 bits for program exception traps. These identify what caused Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Wed Jun 26 00:53:49 2019 (r349401) +++ head/sys/powerpc/powerpc/trap.c Wed Jun 26 01:14:39 2019 (r349402) @@ -788,7 +788,7 @@ static int fix_unaligned(struct thread *td, struct trapframe *frame) { struct thread *fputhread; -#ifdef __SPE__ +#ifdef BOOKE uint32_t inst; #endif int indicator, reg; @@ -799,7 +799,7 @@ fix_unaligned(struct thread *td, struct trapframe *fra if (indicator & ESR_SPE) { if (copyin((void *)frame->srr0, &inst, sizeof(inst)) != 0) return (-1); - reg = EXC_ALI_SPE_REG(inst); + reg = EXC_ALI_INST_RST(inst); fpr = (double *)td->td_pcb->pcb_vec.vr[reg]; fputhread = PCPU_GET(vecthread); @@ -829,12 +829,22 @@ fix_unaligned(struct thread *td, struct trapframe *fra return (0); } #else +#ifdef BOOKE + indicator = (frame->cpu.booke.esr & ESR_ST) ? EXC_ALI_STFD : EXC_ALI_LFD; +#else indicator = EXC_ALI_OPCODE_INDICATOR(frame->cpu.aim.dsisr); +#endif switch (indicator) { case EXC_ALI_LFD: case EXC_ALI_STFD: +#ifdef BOOKE + if (copyin((void *)frame->srr0, &inst, sizeof(inst)) != 0) + return (-1); + reg = EXC_ALI_INST_RST(inst); +#else reg = EXC_ALI_RST(frame->cpu.aim.dsisr); +#endif fpr = &td->td_pcb->pcb_fpu.fpr[reg].fpr; fputhread = PCPU_GET(fputhread); From owner-svn-src-head@freebsd.org Wed Jun 26 03:06:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AF1F15DDD65; Wed, 26 Jun 2019 03:06:58 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2ED6A89D82; Wed, 26 Jun 2019 03:06:58 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0064C21A44; Wed, 26 Jun 2019 03:06:58 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5Q36vuH027998; Wed, 26 Jun 2019 03:06:57 GMT (envelope-from bcran@FreeBSD.org) Received: (from bcran@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5Q36v3t027997; Wed, 26 Jun 2019 03:06:57 GMT (envelope-from bcran@FreeBSD.org) Message-Id: <201906260306.x5Q36v3t027997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcran set sender to bcran@FreeBSD.org using -f From: Rebecca Cran Date: Wed, 26 Jun 2019 03:06:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349404 - in head/stand/efi: libefi loader X-SVN-Group: head X-SVN-Commit-Author: bcran X-SVN-Commit-Paths: in head/stand/efi: libefi loader X-SVN-Commit-Revision: 349404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2ED6A89D82 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 03:06:58 -0000 Author: bcran Date: Wed Jun 26 03:06:57 2019 New Revision: 349404 URL: https://svnweb.freebsd.org/changeset/base/349404 Log: Re-enable loader efi http boot and fix dv_open bug if dv_init failed The code in efihttp.c was assuming that dv_open wouldn't be called if dv_init failed. But the dv_init return value is currently ignored. Add a new variable, `efihttp_init_done` and only proceed in dv_open if it's true. This fixes the loader on systems without efi http support. Modified: head/stand/efi/libefi/efihttp.c head/stand/efi/loader/conf.c Modified: head/stand/efi/libefi/efihttp.c ============================================================================== --- head/stand/efi/libefi/efihttp.c Wed Jun 26 02:09:22 2019 (r349403) +++ head/stand/efi/libefi/efihttp.c Wed Jun 26 03:06:57 2019 (r349404) @@ -52,6 +52,8 @@ static EFI_GUID http_guid = EFI_HTTP_PROTOCOL_GUID; static EFI_GUID httpsb_guid = EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID; static EFI_GUID ip4config2_guid = EFI_IP4_CONFIG2_PROTOCOL_GUID; +static bool efihttp_init_done = false; + static int efihttp_dev_init(void); static int efihttp_dev_strategy(void *devdata, int rw, daddr_t blk, size_t size, char *buf, size_t *rsize); @@ -208,6 +210,9 @@ efihttp_dev_init(void) return (efi_status_to_errno(status)); err = efi_register_handles(&efihttp_dev, &handle, NULL, 1); + if (!err) + efihttp_init_done = true; + return (err); } @@ -236,6 +241,9 @@ efihttp_dev_open(struct open_file *f, ...) EFI_STATUS status; int err, len; + if (!efihttp_init_done) + return (ENXIO); + imgpath = efi_lookup_image_devpath(IH); if (imgpath == NULL) return (ENXIO); @@ -555,6 +563,8 @@ efihttp_fs_open(const char *path, struct open_file *f) char *path_slash; int err; + if (!efihttp_init_done) + return (ENXIO); /* * If any path fails to open, try with a trailing slash in * case it's a directory. Modified: head/stand/efi/loader/conf.c ============================================================================== --- head/stand/efi/loader/conf.c Wed Jun 26 02:09:22 2019 (r349403) +++ head/stand/efi/loader/conf.c Wed Jun 26 03:06:57 2019 (r349404) @@ -39,6 +39,7 @@ struct devsw *devsw[] = { &efipart_fddev, &efipart_cddev, &efipart_hddev, + &efihttp_dev, /* ordering with efinet_dev matters */ &efinet_dev, &vdisk_dev, #ifdef EFI_ZFS_BOOT @@ -54,6 +55,7 @@ struct fs_ops *file_system[] = { &dosfs_fsops, &ufs_fsops, &cd9660_fsops, + &efihttp_fsops, &tftp_fsops, &nfs_fsops, &gzipfs_fsops, From owner-svn-src-head@freebsd.org Wed Jun 26 03:12:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1089715DDFB5; Wed, 26 Jun 2019 03:12:58 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B82E78A22E; Wed, 26 Jun 2019 03:12:57 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94A5421C02; Wed, 26 Jun 2019 03:12:57 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5Q3CviR033175; Wed, 26 Jun 2019 03:12:57 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5Q3Cvgo033173; Wed, 26 Jun 2019 03:12:57 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201906260312.x5Q3Cvgo033173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Wed, 26 Jun 2019 03:12:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349405 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 349405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B82E78A22E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 03:12:58 -0000 Author: dougm Date: Wed Jun 26 03:12:57 2019 New Revision: 349405 URL: https://svnweb.freebsd.org/changeset/base/349405 Log: Revert r349393, which leads to an assertion failure on bootup, in vm_map_stack_locked. Reported by: ler@lerctr.org Approved by: kib, markj (mentors, implicit) Modified: head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Wed Jun 26 03:06:57 2019 (r349404) +++ head/sys/vm/vm_map.c Wed Jun 26 03:12:57 2019 (r349405) @@ -983,17 +983,6 @@ vm_map_entry_max_free_right(vm_map_entry_t root, vm_ma root->right->max_free : right_ancestor->start - root->end); } -/* - * vm_map_splay_split, vm_map_splay_merge: - * - * The Sleator and Tarjan top-down splay algorithm with the following - * variation. Max_free must be computed bottom-up, so on the downward - * pass (vm_map_splay_split), maintain the left and right spines in - * reverse order, and ensure that the max_free values for those nodes - * store the values of their descendents not on the search path. Later, - * make a second pass up each side (vm_map_splay_merge) to fix the - * pointers and compute max_free. The time bound is O(log n) amortized. - */ #define SPLAY_LEFT_STEP(root, y, rlist, test) do { \ vm_size_t max_free; \ \ @@ -1177,6 +1166,56 @@ vm_map_splay_merge(vm_map_t map, vm_map_entry_t root, } /* + * vm_map_splay: + * + * The Sleator and Tarjan top-down splay algorithm with the + * following variation. Max_free must be computed bottom-up, so + * on the downward pass, maintain the left and right spines in + * reverse order. Then, make a second pass up each side to fix + * the pointers and compute max_free. The time bound is O(log n) + * amortized. + * + * The new root is the vm_map_entry containing "addr", or else an + * adjacent entry (lower if possible) if addr is not in the tree. + * + * The map must be locked, and leaves it so. + * + * Returns: the new root. + */ +static vm_map_entry_t +vm_map_splay(vm_map_t map, vm_offset_t addr) +{ + vm_map_entry_t llist, rlist, root; + + root = vm_map_splay_split(map, addr, 0, &llist, &rlist); + if (root != NULL) { + /* do nothing */ + } else if (llist != &map->header) { + /* + * Recover the greatest node in the left + * subtree and make it the root. + */ + root = llist; + llist = root->right; + root->right = NULL; + } else if (rlist != &map->header) { + /* + * Recover the least node in the right + * subtree and make it the root. + */ + root = rlist; + rlist = root->left; + root->left = NULL; + } else { + /* There is no root. */ + return (NULL); + } + vm_map_splay_merge(map, root, llist, rlist); + VM_MAP_ASSERT_CONSISTENT(map); + return (root); +} + +/* * vm_map_entry_{un,}link: * * Insert/remove entries from maps. @@ -1292,133 +1331,81 @@ vm_map_entry_resize(vm_map_t map, vm_map_entry_t entry } /* - * vm_map_lookup_helper: [ internal use only ] + * vm_map_lookup_entry: [ internal use only ] * - * Finds the map entry containing (or adjacent to) the specified address - * in the given map; the entry is returned in the "entry" parameter. The - * boolean result indicates whether the address is actually contained in - * the map. If the address is not contained in the map, parameter lesseq - * determines whether the entry provided is before or after the address. - * If the address is contained in the map, parameter nbr, if not NULL, is - * where the next or previous entry is saved, depending on the value of - * eflags in the found entry. + * Finds the map entry containing (or + * immediately preceding) the specified address + * in the given map; the entry is returned + * in the "entry" parameter. The boolean + * result indicates whether the address is + * actually contained in the map. */ -static bool -vm_map_lookup_helper(vm_map_t map, vm_offset_t addr, bool lesseq, - vm_map_entry_t *entry, vm_map_entry_t *nbr) /* OUT */ +boolean_t +vm_map_lookup_entry( + vm_map_t map, + vm_offset_t address, + vm_map_entry_t *entry) /* OUT */ { - vm_map_entry_t llist, rlist, root; - bool locked, found; + vm_map_entry_t cur, lbound; + boolean_t locked; /* * If the map is empty, then the map entry immediately preceding - * "addr" is the map's header. + * "address" is the map's header. */ - root = map->root; - if (root == NULL) { + cur = map->root; + if (cur == NULL) { *entry = &map->header; - return (false); + return (FALSE); } + if (address >= cur->start && cur->end > address) { + *entry = cur; + return (TRUE); + } if ((locked = vm_map_locked(map)) || sx_try_upgrade(&map->lock)) { - /* * Splay requires a write lock on the map. However, it only * restructures the binary search tree; it does not otherwise * change the map. Thus, the map's timestamp need not change * on a temporary upgrade. */ - root = vm_map_splay_split(map, addr, 0, &llist, &rlist); - found = root != NULL; - *entry = root; - if (root != NULL) { - if (nbr == NULL) - ; /* Ignore. */ - else if ((root->eflags & MAP_ENTRY_STACK_GAP_DN) != 0) { - vm_map_splay_findnext(root, &rlist); - *nbr = rlist; - } else { - vm_map_splay_findprev(root, &llist); - *nbr = llist; - } - } else if (llist != &map->header) { - /* - * Recover the greatest node in the left - * subtree and make it the root. - */ - *entry = lesseq ? llist : rlist; - root = llist; - llist = root->right; - root->right = NULL; - } else { - /* - * Recover the least node in the right - * subtree and make it the root. - */ - *entry = lesseq ? llist : rlist; - root = rlist; - rlist = root->left; - root->left = NULL; - } - vm_map_splay_merge(map, root, llist, rlist); - VM_MAP_ASSERT_CONSISTENT(map); + cur = vm_map_splay(map, address); if (!locked) sx_downgrade(&map->lock); - return (found); + + /* + * If "address" is contained within a map entry, the new root + * is that map entry. Otherwise, the new root is a map entry + * immediately before or after "address". + */ + if (address < cur->start) { + *entry = &map->header; + return (FALSE); + } + *entry = cur; + return (address < cur->end); } /* * Since the map is only locked for read access, perform a - * standard binary search tree lookup for "addr". + * standard binary search tree lookup for "address". */ - llist = rlist = &map->header; + lbound = &map->header; do { - if (addr < root->start) { - rlist = root; - root = root->left; - } else if (root->end <= addr) { - llist = root; - root = root->right; + if (address < cur->start) { + cur = cur->left; + } else if (cur->end <= address) { + lbound = cur; + cur = cur->right; } else { - *entry = root; - if (nbr == NULL); - else if ((root->eflags & MAP_ENTRY_STACK_GAP_DN) != 0) { - /* Make nbr the successor to root. */ - if (root->right != NULL) { - rlist = root->right; - while (rlist->left != NULL) - rlist = rlist->left; - } - *nbr = rlist; - } else { - /* Make nbr the predecessor to root. */ - if (root->left != NULL) { - llist = root->left; - while (llist->right != NULL) - llist = llist->right; - } - *nbr = llist; - } - return (true); + *entry = cur; + return (TRUE); } - } while (root != NULL); - *entry = lesseq ? llist : rlist; - return (false); + } while (cur != NULL); + *entry = lbound; + return (FALSE); } -bool -vm_map_lookup_entry(vm_map_t map, vm_offset_t addr, - vm_map_entry_t *entry) /* OUT */ -{ - return (vm_map_lookup_helper(map, addr, true, entry, NULL)); -} - -static bool -vm_map_lookup_entry_ge(vm_map_t map, vm_offset_t addr, - vm_map_entry_t *entry) /* OUT */ -{ - return (vm_map_lookup_helper(map, addr, false, entry, NULL)); -} - /* * vm_map_insert: * @@ -1435,7 +1422,7 @@ int vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset, vm_offset_t start, vm_offset_t end, vm_prot_t prot, vm_prot_t max, int cow) { - vm_map_entry_t new_entry, prev_entry; + vm_map_entry_t new_entry, prev_entry, temp_entry; struct ucred *cred; vm_eflags_t protoeflags; vm_inherit_t inheritance; @@ -1460,9 +1447,11 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof * Find the entry prior to the proposed starting address; if it's part * of an existing entry, this range is bogus. */ - if (vm_map_lookup_entry(map, start, &prev_entry)) + if (vm_map_lookup_entry(map, start, &temp_entry)) return (KERN_NO_SPACE); + prev_entry = temp_entry; + /* * Assert that the next entry doesn't overlap the end point. */ @@ -2325,8 +2314,10 @@ vm_map_submap( VM_MAP_RANGE_CHECK(map, start, end); - if (vm_map_lookup_entry_ge(map, start, &entry)) + if (vm_map_lookup_entry(map, start, &entry)) { vm_map_clip_start(map, entry, start); + } else + entry = entry->next; vm_map_clip_end(map, entry, end); @@ -2481,7 +2472,8 @@ again: VM_MAP_RANGE_CHECK(map, start, end); - vm_map_lookup_entry_ge(map, start, &entry); + if (!vm_map_lookup_entry(map, start, &entry)) + entry = entry->next; /* * Make a first pass to check for protection violations. @@ -2671,9 +2663,11 @@ vm_map_madvise( */ VM_MAP_RANGE_CHECK(map, start, end); - if (vm_map_lookup_entry_ge(map, start, &entry)) { + if (vm_map_lookup_entry(map, start, &entry)) { if (modify_map) vm_map_clip_start(map, entry, start); + } else { + entry = entry->next; } if (modify_map) { @@ -2805,6 +2799,7 @@ vm_map_inherit(vm_map_t map, vm_offset_t start, vm_off vm_inherit_t new_inheritance) { vm_map_entry_t entry; + vm_map_entry_t temp_entry; switch (new_inheritance) { case VM_INHERIT_NONE: @@ -2819,8 +2814,11 @@ vm_map_inherit(vm_map_t map, vm_offset_t start, vm_off return (KERN_SUCCESS); vm_map_lock(map); VM_MAP_RANGE_CHECK(map, start, end); - if (vm_map_lookup_entry_ge(map, start, &entry)) + if (vm_map_lookup_entry(map, start, &temp_entry)) { + entry = temp_entry; vm_map_clip_start(map, entry, start); + } else + entry = temp_entry->next; while (entry->start < end) { vm_map_clip_end(map, entry, end); if ((entry->eflags & MAP_ENTRY_GUARD) == 0 || @@ -2853,8 +2851,10 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs user_unwire = (flags & VM_MAP_WIRE_USER) ? TRUE : FALSE; vm_map_lock(map); VM_MAP_RANGE_CHECK(map, start, end); - if (!vm_map_lookup_entry_ge(map, start, &first_entry)) { - if ((flags & VM_MAP_WIRE_HOLESOK) == 0) { + if (!vm_map_lookup_entry(map, start, &first_entry)) { + if (flags & VM_MAP_WIRE_HOLESOK) + first_entry = first_entry->next; + else { vm_map_unlock(map); return (KERN_INVALID_ADDRESS); } @@ -2882,9 +2882,11 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs * Specifically, the entry may have been * clipped, merged, or deleted. */ - if (!vm_map_lookup_entry_ge(map, saved_start, + if (!vm_map_lookup_entry(map, saved_start, &tmp_entry)) { - if ((flags & VM_MAP_WIRE_HOLESOK) == 0) { + if (flags & VM_MAP_WIRE_HOLESOK) + tmp_entry = tmp_entry->next; + else { if (saved_start == start) { /* * First_entry has been deleted. @@ -2942,9 +2944,11 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs done: need_wakeup = FALSE; if (first_entry == NULL) { - result = vm_map_lookup_entry_ge(map, start, &first_entry); - KASSERT(result || (flags & VM_MAP_WIRE_HOLESOK) != 0, - ("vm_map_unwire: lookup failed")); + result = vm_map_lookup_entry(map, start, &first_entry); + if (!result && (flags & VM_MAP_WIRE_HOLESOK)) + first_entry = first_entry->next; + else + KASSERT(result, ("vm_map_unwire: lookup failed")); } for (entry = first_entry; entry->start < end; entry = entry->next) { /* @@ -3086,8 +3090,10 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm prot |= VM_PROT_WRITE; user_wire = (flags & VM_MAP_WIRE_USER) ? TRUE : FALSE; VM_MAP_RANGE_CHECK(map, start, end); - if (!vm_map_lookup_entry_ge(map, start, &first_entry)) { - if ((flags & VM_MAP_WIRE_HOLESOK) == 0) + if (!vm_map_lookup_entry(map, start, &first_entry)) { + if (flags & VM_MAP_WIRE_HOLESOK) + first_entry = first_entry->next; + else return (KERN_INVALID_ADDRESS); } last_timestamp = map->timestamp; @@ -3113,9 +3119,11 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm * Specifically, the entry may have been * clipped, merged, or deleted. */ - if (!vm_map_lookup_entry_ge(map, saved_start, + if (!vm_map_lookup_entry(map, saved_start, &tmp_entry)) { - if ((flags & VM_MAP_WIRE_HOLESOK) == 0) { + if (flags & VM_MAP_WIRE_HOLESOK) + tmp_entry = tmp_entry->next; + else { if (saved_start == start) { /* * first_entry has been deleted. @@ -3248,9 +3256,11 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm done: need_wakeup = FALSE; if (first_entry == NULL) { - result = vm_map_lookup_entry_ge(map, start, &first_entry); - KASSERT(result || (flags & VM_MAP_WIRE_HOLESOK) != 0, - ("vm_map_wire: lookup failed")); + result = vm_map_lookup_entry(map, start, &first_entry); + if (!result && (flags & VM_MAP_WIRE_HOLESOK)) + first_entry = first_entry->next; + else + KASSERT(result, ("vm_map_wire: lookup failed")); } for (entry = first_entry; entry->start < end; entry = entry->next) { /* @@ -3351,8 +3361,7 @@ vm_map_sync( if (!vm_map_lookup_entry(map, start, &entry)) { vm_map_unlock_read(map); return (KERN_INVALID_ADDRESS); - } - if (start == end) { + } else if (start == end) { start = entry->start; end = entry->end; } @@ -3407,10 +3416,9 @@ vm_map_sync( start += size; vm_object_deallocate(object); vm_map_lock_read(map); - if (last_timestamp == map->timestamp) + if (last_timestamp == map->timestamp || + !vm_map_lookup_entry(map, start, ¤t)) current = current->next; - else - vm_map_lookup_entry_ge(map, start, ¤t); } vm_map_unlock_read(map); @@ -3543,6 +3551,7 @@ int vm_map_delete(vm_map_t map, vm_offset_t start, vm_offset_t end) { vm_map_entry_t entry; + vm_map_entry_t first_entry; VM_MAP_ASSERT_LOCKED(map); if (start == end) @@ -3551,8 +3560,12 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offs /* * Find the start of the region, and clip it */ - if (vm_map_lookup_entry_ge(map, start, &entry)) + if (!vm_map_lookup_entry(map, start, &first_entry)) + entry = first_entry->next; + else { + entry = first_entry; vm_map_clip_start(map, entry, start); + } /* * Step through all entries in this region @@ -3570,22 +3583,29 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offs vm_map_entry_system_wired_count(entry) != 0)) { unsigned int last_timestamp; vm_offset_t saved_start; + vm_map_entry_t tmp_entry; saved_start = entry->start; entry->eflags |= MAP_ENTRY_NEEDS_WAKEUP; last_timestamp = map->timestamp; (void) vm_map_unlock_and_wait(map, 0); vm_map_lock(map); - if (last_timestamp + 1 == map->timestamp) - continue; - - /* - * Look again for the entry because the map was - * modified while it was unlocked. Specifically, the - * entry may have been clipped, merged, or deleted. - */ - if (vm_map_lookup_entry_ge(map, saved_start, &entry)) - vm_map_clip_start(map, entry, saved_start); + if (last_timestamp + 1 != map->timestamp) { + /* + * Look again for the entry because the map was + * modified while it was unlocked. + * Specifically, the entry may have been + * clipped, merged, or deleted. + */ + if (!vm_map_lookup_entry(map, saved_start, + &tmp_entry)) + entry = tmp_entry->next; + else { + entry = tmp_entry; + vm_map_clip_start(map, entry, + saved_start); + } + } continue; } vm_map_clip_end(map, entry, end); @@ -3660,9 +3680,11 @@ vm_map_check_protection(vm_map_t map, vm_offset_t star vm_prot_t protection) { vm_map_entry_t entry; + vm_map_entry_t tmp_entry; - if (!vm_map_lookup_entry(map, start, &entry)) + if (!vm_map_lookup_entry(map, start, &tmp_entry)) return (FALSE); + entry = tmp_entry; while (start < end) { /* @@ -4098,7 +4120,7 @@ static int vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, vm_size_t max_ssize, vm_size_t growsize, vm_prot_t prot, vm_prot_t max, int cow) { - vm_map_entry_t new_entry; + vm_map_entry_t new_entry, prev_entry; vm_offset_t bot, gap_bot, gap_top, top; vm_size_t init_ssize, sgp; int orient, rv; @@ -4126,13 +4148,13 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, init_ssize = max_ssize - sgp; /* If addr is already mapped, no go */ - if (vm_map_lookup_entry_ge(map, addrbos, &new_entry)) + if (vm_map_lookup_entry(map, addrbos, &prev_entry)) return (KERN_NO_SPACE); /* * If we can't accommodate max_ssize in the current mapping, no go. */ - if (new_entry->start < addrbos + max_ssize) + if (prev_entry->next->start < addrbos + max_ssize) return (KERN_NO_SPACE); /* @@ -4159,6 +4181,7 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, rv = vm_map_insert(map, NULL, 0, bot, top, prot, max, cow); if (rv != KERN_SUCCESS) return (rv); + new_entry = prev_entry->next; KASSERT(new_entry->end == top || new_entry->start == bot, ("Bad entry start/end for new stack entry")); KASSERT((orient & MAP_STACK_GROWS_DOWN) == 0 || @@ -4217,18 +4240,19 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_ma vmemlim = lim_cur(curthread, RLIMIT_VMEM); retry: /* If addr is not in a hole for a stack grow area, no need to grow. */ - if (gap_entry == NULL && - !vm_map_lookup_helper(map, addr, true, &gap_entry, &stack_entry)) + if (gap_entry == NULL && !vm_map_lookup_entry(map, addr, &gap_entry)) return (KERN_FAILURE); if ((gap_entry->eflags & MAP_ENTRY_GUARD) == 0) return (KERN_SUCCESS); if ((gap_entry->eflags & MAP_ENTRY_STACK_GAP_DN) != 0) { + stack_entry = gap_entry->next; if ((stack_entry->eflags & MAP_ENTRY_GROWS_DOWN) == 0 || stack_entry->start != gap_entry->end) return (KERN_FAILURE); grow_amount = round_page(stack_entry->start - addr); grow_down = true; } else if ((gap_entry->eflags & MAP_ENTRY_STACK_GAP_UP) != 0) { + stack_entry = gap_entry->prev; if ((stack_entry->eflags & MAP_ENTRY_GROWS_UP) == 0 || stack_entry->end != gap_entry->start) return (KERN_FAILURE); Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Wed Jun 26 03:06:57 2019 (r349404) +++ head/sys/vm/vm_map.h Wed Jun 26 03:12:57 2019 (r349405) @@ -415,7 +415,7 @@ int vm_map_lookup (vm_map_t *, vm_offset_t, vm_prot_t, int vm_map_lookup_locked(vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, vm_object_t *, vm_pindex_t *, vm_prot_t *, boolean_t *); void vm_map_lookup_done (vm_map_t, vm_map_entry_t); -bool vm_map_lookup_entry(vm_map_t, vm_offset_t, vm_map_entry_t *); +boolean_t vm_map_lookup_entry (vm_map_t, vm_offset_t, vm_map_entry_t *); int vm_map_protect (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t, boolean_t); int vm_map_remove (vm_map_t, vm_offset_t, vm_offset_t); void vm_map_simplify_entry(vm_map_t map, vm_map_entry_t entry); From owner-svn-src-head@freebsd.org Wed Jun 26 03:32:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D4BC15DE5E6; Wed, 26 Jun 2019 03:32:17 +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 E03448AD10; Wed, 26 Jun 2019 03:32:15 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id fyfNhmWDUo7SQfyfOhcpmq; Tue, 25 Jun 2019 21:32:14 -0600 X-Authority-Analysis: v=2.3 cv=Go88BX9C c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=dq6fvYVFJ5YA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=hhWWyWAOk7TUdWXy1xYA:9 a=oZqBB_jpOfjAqMcn:21 a=DkvMeU1PYl3GNetm:21 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 CEA10D4; Tue, 25 Jun 2019 20:32:12 -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 x5Q3WCBm004935; Tue, 25 Jun 2019 20:32:12 -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 x5Q3WCIG004876; Tue, 25 Jun 2019 20:32:12 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201906260332.x5Q3WCIG004876@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Doug Moore cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Larry Rosenman Subject: Re: svn commit: r349393 - head/sys/vm In-Reply-To: Message from Doug Moore of "Tue, 25 Jun 2019 20:25:16 -0000." <201906252025.x5PKPGml014589@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 25 Jun 2019 20:32:12 -0700 X-CMAE-Envelope: MS4wfDxx29+0Jg5Rd2oNxscgV+WCRQ29QqgBetJkvHQ7Aj36pT7gmFb5jdEe9T3GNSL261i+TtAWFqAIJGG9mbB4lmNYJPUfKBAV0YhmJ+VpZ4QXmrL53q0I keqBDS5H81ntgr2Lr5BH1kOvDTrimdT+A1QQpfdn/rDmiUtLGLlp9ND82b5yNsvBa4wZY6sMbys7T97XM9gOfM38zHQiF7CMG+x5fS/M/o520A32d5LJLRDy qwknoOoVgGyRohMDne7axD8HvgyFSN7o4VpMSO9zCXkoih8i7bCkaMUIWszmMuRjnEmRMgDWs5qRlEGce0UY9A== X-Rspamd-Queue-Id: E03448AD10 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-4.98 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.zen.spamhaus.org : 127.0.0.11]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: spqr.komquats.com]; NEURAL_HAM_SHORT(-0.87)[-0.875,0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.40)[ip: (-6.08), ipnet: 64.59.128.0/20(-3.28), asn: 6327(-2.54), country: CA(-0.09)]; RCVD_IN_DNSWL_LOW(-0.10)[139.136.59.64.list.dnswl.org : 127.0.5.1] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 03:32:17 -0000 In message <201906252025.x5PKPGml014589@repo.freebsd.org>, Doug Moore writes: > Author: dougm > Date: Tue Jun 25 20:25:16 2019 > New Revision: 349393 > URL: https://svnweb.freebsd.org/changeset/base/349393 > > Log: > Eliminate some uses of the prev and next fields of vm_map_entry_t. > > Since the only caller to vm_map_splay is vm_map_lookup_entry, move the > implementation of vm_map_splay into vm_map_lookup_helper, called by > vm_map_lookup_entry. > > vm_map_lookup_entry returns the greatest entry less than or equal to a > given address, but in many cases the caller wants the least entry > greater than or equal to the address and uses the next pointer to get > to it. Provide an alternative interface to lookup, > vm_map_lookup_entry_ge, to provide the latter behavior, and let > callers use one or the other rather than having them use the next > pointer after a lookup miss to get what they really want. > > In vm_map_growstack, the caller wants an entry that includes a given > address, and either the preceding or next entry depending on the value > of eflags in the first entry. Incorporate that behavior into > vm_map_lookup_helper, the function that implements all of these > lookups. > > Eliminate some temporary variables used with vm_map_lookup_entry, but > inessential. > > Reviewed by: markj (earlier version) > Approved by: kib (mentor) > Differential Revision: https://reviews.freebsd.org/D20664 > > Modified: > head/sys/vm/vm_map.c > head/sys/vm/vm_map.h > [...] Hi Doug, This commit causes the following panic. The panic occurs during UFS fsck. Booting into single user and issuing fsck by hand also results in the panic. Reverting this rev provides relief. <118>Starting file system checks: Fatal trap 12: page fault while in kernel mode cpuid = 1; apic id = 01 fault virtual address = 0x52 fault code = supervisor read data, page not present instruction pointer = 0x20:0xffffffff809649b4 stack pointer = 0x0:0xfffffe0035853810 frame pointer = 0x0:0xfffffe00358538f0 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 62 (fsck_ufs) trap number = 12 panic: page fault cpuid = 1 time = 1561490154 KDB: stack backtrace: #0 0xffffffff806bff77 at kdb_backtrace+0x67 #1 0xffffffff806744fd at vpanic+0x19d #2 0xffffffff80674353 at panic+0x43 #3 0xffffffff809adcdc at trap_fatal+0x39c #4 0xffffffff809add29 at trap_pfault+0x49 #5 0xffffffff809ad31f at trap+0x29f #6 0xffffffff80989125 at calltrap+0x8 #7 0xffffffff80956702 at vm_fault_hold+0x72 #8 0xffffffff80956640 at vm_fault+0x60 #9 0xffffffff809ade44 at trap_pfault+0x164 #10 0xffffffff809ad4ab at trap+0x42b #11 0xffffffff80989125 at calltrap+0x8 Uptime: 22s Dumping 302 out of 4068 MB:..6%..11%..22%..32%..43%..53%..64%..74%..85%. .96% __curthread () at /opt/src/svn-current/sys/amd64/include/pcpu.h:246 246 __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (OFFSETOF_CURTHREAD)); (kgdb) bt #0 __curthread () at /opt/src/svn-current/sys/amd64/include/pcpu.h:246 #1 doadump (textdump=) at /opt/src/svn-current/sys/kern/ kern_shutdown.c:392 #2 0xffffffff806740b8 in kern_reboot (howto=260) at /opt/src/svn-current/sys/kern/kern_shutdown.c:479 #3 0xffffffff80674559 in vpanic (fmt=, ap=) at /opt/src/svn-current/sys/kern/kern_shutdown.c:905 #4 0xffffffff80674353 in panic (fmt=) at /opt/src/svn-current/sys/kern/kern_shutdown.c:832 #5 0xffffffff809adcdc in trap_fatal (frame=0xfffffe0035853750, eva=82) at /opt/src/svn-current/sys/amd64/amd64/trap.c:943 #6 0xffffffff809add29 in trap_pfault (frame=0xfffffe0035853750, usermode=0) at /opt/src/svn-current/sys/amd64/amd64/trap.c:767 #7 0xffffffff809ad31f in trap (frame=0xfffffe0035853750) at /opt/src/svn-current/sys/amd64/amd64/trap.c:443 #8 #9 0xffffffff809649b4 in vm_map_growstack (map=0xfffff80005757000, addr=140737487298560, gap_entry=0xfffff8000546a9a0) at /opt/src/svn-current/sys/vm/vm_map.c:4226 #10 vm_map_lookup (var_map=0xfffffe00358539e0, vaddr=140737487298560, fault_typea=18 '\022', out_entry=0xfffffe00358539e8, object=0xfffffe00358539d0, pindex=0xfffffe00358539d8, out_prot=0xfffffe0035853a17 "\003", wired=0xfffffe0035853a04) at /opt/src/svn-current/sys/vm/vm_map.c:4549 #11 0xffffffff80956702 in vm_fault_hold (map=0xfffff80005757000, vaddr=140737487298560, fault_type=2 '\002', fault_flags=0, m_hold=0x0) at /opt/src/svn-current/sys/vm/vm_fault.c:589 #12 0xffffffff80956640 in vm_fault (map=0xfffff80005757000, vaddr=, fault_type=2 '\002', fault_flags=0) at /opt/src/svn-current/sys/vm/vm_fault.c:550 #13 0xffffffff809ade44 in trap_pfault (frame=0xfffffe0035853c00, usermode=1) at /opt/src/svn-current/sys/amd64/amd64/trap.c:846 #14 0xffffffff809ad4ab in trap (frame=0xfffffe0035853c00) at /opt/src/svn-current/sys/amd64/amd64/trap.c:355 #15 #16 0x0000000000215f3e in ?? () Backtrace stopped: Cannot access memory at address 0x7fffffefe4b0 -- 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 Wed Jun 26 06:40:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E804E15B8A7A; Wed, 26 Jun 2019 06:40:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5236B8FE7F; Wed, 26 Jun 2019 06:40:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2763923DE8; Wed, 26 Jun 2019 06:40:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5Q6eUHM037864; Wed, 26 Jun 2019 06:40:30 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5Q6eUNM037863; Wed, 26 Jun 2019 06:40:30 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201906260640.x5Q6eUNM037863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 26 Jun 2019 06:40:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349406 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 349406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5236B8FE7F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 06:40:32 -0000 Author: avg Date: Wed Jun 26 06:40:30 2019 New Revision: 349406 URL: https://svnweb.freebsd.org/changeset/base/349406 Log: owc.4: document how to set up the 1-wire bus on a device.hints system MFC after: 1 week Modified: head/share/man/man4/owc.4 Modified: head/share/man/man4/owc.4 ============================================================================== --- head/share/man/man4/owc.4 Wed Jun 26 03:12:57 2019 (r349405) +++ head/share/man/man4/owc.4 Wed Jun 26 06:40:30 2019 (r349406) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 20, 2015 +.Dd June 26, 2019 .Dt OWC 4 .Os .Sh NAME @@ -69,6 +69,23 @@ For more details about the .Va gpios property, please consult .Pa /usr/src/sys/dts/bindings-gpio.txt . +.Pp +On a +.Xr device.hints 5 +based system these values are required for the +.Nm : +.Bl -tag -width ".Va hint.owc.%d.atXXX" +.It Va hint.owc.%d.at +The +.Nm gpiobus +you are attaching to. +.It Va hint.owc.%d.pins +This is a bitmask that defines a pin on the +.Nm gpiobus +that is to be used for the 1-Wire bus. +For instance, to configure pin 10, use the bitmask of 0x400. +Please note that this mask should have only one bit set +(any other bits - i.e., pins - will be ignored). .Sh SEE ALSO .Xr gpiobus 4 , .Xr ow 4 , From owner-svn-src-head@freebsd.org Wed Jun 26 07:08:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04C3915B9058; Wed, 26 Jun 2019 07:08:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 88D32908CB; Wed, 26 Jun 2019 07:08:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5CEA5242DF; Wed, 26 Jun 2019 07:08:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5Q78q4e053370; Wed, 26 Jun 2019 07:08:52 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5Q78qLk053369; Wed, 26 Jun 2019 07:08:52 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201906260708.x5Q78qLk053369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 26 Jun 2019 07:08:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349407 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 349407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 88D32908CB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.945,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 07:08:53 -0000 Author: avg Date: Wed Jun 26 07:08:51 2019 New Revision: 349407 URL: https://svnweb.freebsd.org/changeset/base/349407 Log: fix up r349406, add missing .El MFC after: 1 week Modified: head/share/man/man4/owc.4 Modified: head/share/man/man4/owc.4 ============================================================================== --- head/share/man/man4/owc.4 Wed Jun 26 06:40:30 2019 (r349406) +++ head/share/man/man4/owc.4 Wed Jun 26 07:08:51 2019 (r349407) @@ -86,6 +86,7 @@ that is to be used for the 1-Wire bus. For instance, to configure pin 10, use the bitmask of 0x400. Please note that this mask should have only one bit set (any other bits - i.e., pins - will be ignored). +.El .Sh SEE ALSO .Xr gpiobus 4 , .Xr ow 4 , From owner-svn-src-head@freebsd.org Wed Jun 26 07:38:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F336715B9909; Wed, 26 Jun 2019 07:38:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A7CC914EC; Wed, 26 Jun 2019 07:38:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76523247E5; Wed, 26 Jun 2019 07:38:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5Q7cViK068545; Wed, 26 Jun 2019 07:38:31 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5Q7cVVr068544; Wed, 26 Jun 2019 07:38:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201906260738.x5Q7cVVr068544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 26 Jun 2019 07:38:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349408 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 349408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9A7CC914EC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.945,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 07:38:32 -0000 Author: avg Date: Wed Jun 26 07:38:31 2019 New Revision: 349408 URL: https://svnweb.freebsd.org/changeset/base/349408 Log: gpio.4: document device hints common to all devices on gpiobus "at" keyword is documented in device.hints(5) for all buses, but it does hurt to add another reference to it. "pins" keyword is specific to gpiobus. At least these two hints should be configured for any gpiobus device on a hints based system. MFC after: 10 days Modified: head/share/man/man4/gpio.4 Modified: head/share/man/man4/gpio.4 ============================================================================== --- head/share/man/man4/gpio.4 Wed Jun 26 07:08:51 2019 (r349407) +++ head/share/man/man4/gpio.4 Wed Jun 26 07:38:31 2019 (r349408) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 5, 2013 +.Dd June 26, 2019 .Dt GPIO 4 .Os .Sh NAME @@ -103,12 +103,36 @@ passed to the kernel, being either statically compiled of ways where the boot loader (or Open Firmware enabled system) passes the DTS blob to the kernel at boot. .Pp +On a +.Xr device.hints 5 +based system these hints can be used to configure drivers for devices +attached to +.Nm +pins: +.Bl -tag -width ".Va hint.driver.unit.pins" +.It Va hint.driver.unit.at +The +.Nm gpiobus +where the device is attached. +For example, +.Qq gpiobus0 . +.Ar driver +and +.Ar unit +are the driver name and the unit number for the device driver. +.It Va hint.driver.unit.pins +This is a bitmask of the pins on the +.Nm gpiobus +that are connected to the device. +The pins will be allocated to the specified driver instance. +.El +.Pp The following .Xr device.hints 5 are only provided by the .Cd ar71xx_gpio driver: -.Bl -tag -width ".Va hint.gpioiic.%d.atXXX" +.Bl -tag -width ".Va hint.gpio.function_clear" .It Va hint.gpio.%d.pinmask This is a bitmask of pins on the GPIO board that we would like to expose for use to the host operating system. @@ -133,6 +157,7 @@ of some device in a system. .Xr gpioiic 4 , .Xr gpioled 4 , .Xr iicbus 4 , +.Xr device.hints 5 , .Xr gpioctl 8 .Sh HISTORY The From owner-svn-src-head@freebsd.org Wed Jun 26 11:28:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D9E915C553A; Wed, 26 Jun 2019 11:28:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 148C86A32B; Wed, 26 Jun 2019 11:28: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 D7CAD26E9F; Wed, 26 Jun 2019 11:28:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5QBS8Z4088460; Wed, 26 Jun 2019 11:28:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QBS8Jx088459; Wed, 26 Jun 2019 11:28:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201906261128.x5QBS8Jx088459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 26 Jun 2019 11:28:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349409 - head/lib/libusb X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/lib/libusb X-SVN-Commit-Revision: 349409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 148C86A32B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 11:28:09 -0000 Author: hselasky Date: Wed Jun 26 11:28:08 2019 New Revision: 349409 URL: https://svnweb.freebsd.org/changeset/base/349409 Log: Fix support for LIBUSB_HOTPLUG_ENUMERATE in libusb. Currently all devices are enumerated regardless of of the LIBUSB_HOTPLUG_ENUMERATE flag. Make sure when the flag is not specified no arrival events are generated for currently enumerated devices. MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/lib/libusb/libusb10.h head/lib/libusb/libusb10_hotplug.c Modified: head/lib/libusb/libusb10.h ============================================================================== --- head/lib/libusb/libusb10.h Wed Jun 26 07:38:31 2019 (r349408) +++ head/lib/libusb/libusb10.h Wed Jun 26 11:28:08 2019 (r349409) @@ -89,6 +89,8 @@ struct libusb_hotplug_callback_handle_struct { void *user_data; }; +TAILQ_HEAD(libusb_device_head, libusb_device); + struct libusb_context { int debug; int debug_fixed; @@ -106,7 +108,7 @@ struct libusb_context { TAILQ_HEAD(, libusb_super_pollfd) pollfds; TAILQ_HEAD(, libusb_super_transfer) tr_done; TAILQ_HEAD(, libusb_hotplug_callback_handle_struct) hotplug_cbh; - TAILQ_HEAD(, libusb_device) hotplug_devs; + struct libusb_device_head hotplug_devs; struct libusb_super_pollfd ctx_poll; Modified: head/lib/libusb/libusb10_hotplug.c ============================================================================== --- head/lib/libusb/libusb10_hotplug.c Wed Jun 26 07:38:31 2019 (r349408) +++ head/lib/libusb/libusb10_hotplug.c Wed Jun 26 11:28:08 2019 (r349409) @@ -85,20 +85,35 @@ libusb_hotplug_filter(libusb_context *ctx, libusb_hotp return (pcbh->fn(ctx, dev, event, pcbh->user_data)); } +static int +libusb_hotplug_enumerate(libusb_context *ctx, struct libusb_device_head *phead) +{ + libusb_device **ppdev; + ssize_t count; + ssize_t x; + + count = libusb_get_device_list(ctx, &ppdev); + if (count < 0) + return (-1); + + for (x = 0; x != count; x++) + TAILQ_INSERT_TAIL(phead, ppdev[x], hotplug_entry); + + libusb_free_device_list(ppdev, 0); + return (0); +} + static void * libusb_hotplug_scan(void *arg) { - TAILQ_HEAD(, libusb_device) hotplug_devs; + struct libusb_device_head hotplug_devs; libusb_hotplug_callback_handle acbh; libusb_hotplug_callback_handle bcbh; libusb_context *ctx = arg; - libusb_device **ppdev; libusb_device *temp; libusb_device *adev; libusb_device *bdev; unsigned do_loop = 1; - ssize_t count; - ssize_t x; while (do_loop) { usleep(4000000); @@ -108,14 +123,8 @@ libusb_hotplug_scan(void *arg) TAILQ_INIT(&hotplug_devs); if (ctx->hotplug_handler != NO_THREAD) { - count = libusb_get_device_list(ctx, &ppdev); - if (count < 0) + if (libusb_hotplug_enumerate(ctx, &hotplug_devs) < 0) continue; - for (x = 0; x != count; x++) { - TAILQ_INSERT_TAIL(&hotplug_devs, ppdev[x], - hotplug_entry); - } - libusb_free_device_list(ppdev, 0); } else { do_loop = 0; } @@ -201,6 +210,8 @@ int libusb_hotplug_register_callback(libusb_context *c handle->devclass = dev_class; handle->fn = cb_fn; handle->user_data = user_data; + + libusb_hotplug_enumerate(ctx, &ctx->hotplug_devs); if (flags & LIBUSB_HOTPLUG_ENUMERATE) { TAILQ_FOREACH(adev, &ctx->hotplug_devs, hotplug_entry) { From owner-svn-src-head@freebsd.org Wed Jun 26 12:04:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76DEC15C6C79; Wed, 26 Jun 2019 12:04:55 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E6F06B89A; Wed, 26 Jun 2019 12:04:55 +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 0B66227545; Wed, 26 Jun 2019 12:04:55 +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 x5QC4s5j009716; Wed, 26 Jun 2019 12:04:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QC4sjv009715; Wed, 26 Jun 2019 12:04:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201906261204.x5QC4sjv009715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 26 Jun 2019 12:04:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349410 - head/lib/libusb X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/lib/libusb X-SVN-Commit-Revision: 349410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1E6F06B89A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.940,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 12:04:55 -0000 Author: hselasky Date: Wed Jun 26 12:04:54 2019 New Revision: 349410 URL: https://svnweb.freebsd.org/changeset/base/349410 Log: Only call libusb_hotplug_enumerate() once from libusb_hotplug_register_callback(). Else when registering multiple filters the same USB device may appear twice in the list. MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/lib/libusb/libusb10_hotplug.c Modified: head/lib/libusb/libusb10_hotplug.c ============================================================================== --- head/lib/libusb/libusb10_hotplug.c Wed Jun 26 11:28:08 2019 (r349409) +++ head/lib/libusb/libusb10_hotplug.c Wed Jun 26 12:04:54 2019 (r349410) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /*- - * Copyright (c) 2016 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2016-2019 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -200,6 +200,8 @@ int libusb_hotplug_register_callback(libusb_context *c HOTPLUG_LOCK(ctx); if (ctx->hotplug_handler == NO_THREAD) { + libusb_hotplug_enumerate(ctx, &ctx->hotplug_devs); + if (pthread_create(&ctx->hotplug_handler, NULL, &libusb_hotplug_scan, ctx) != 0) ctx->hotplug_handler = NO_THREAD; @@ -210,8 +212,6 @@ int libusb_hotplug_register_callback(libusb_context *c handle->devclass = dev_class; handle->fn = cb_fn; handle->user_data = user_data; - - libusb_hotplug_enumerate(ctx, &ctx->hotplug_devs); if (flags & LIBUSB_HOTPLUG_ENUMERATE) { TAILQ_FOREACH(adev, &ctx->hotplug_devs, hotplug_entry) { From owner-svn-src-head@freebsd.org Wed Jun 26 15:28:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9531015CB130; Wed, 26 Jun 2019 15:28:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 33FB67224F; Wed, 26 Jun 2019 15:28:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0985A181B; Wed, 26 Jun 2019 15:28:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5QFSLJg014598; Wed, 26 Jun 2019 15:28:21 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QFSL5q014597; Wed, 26 Jun 2019 15:28:21 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201906261528.x5QFSL5q014597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 26 Jun 2019 15:28:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349414 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 349414 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 33FB67224F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 15:28:22 -0000 Author: marius Date: Wed Jun 26 15:28:21 2019 New Revision: 349414 URL: https://svnweb.freebsd.org/changeset/base/349414 Log: o In iflib_txq_drain(): - Remove desc_used, which is only ever written to. - Remove a dead store to reclaimed. - Don't recycle avail. - Sort variables according to style(9). These changes will make a subsequent commit easier to read. o In iflib_tx_credits_update(), don't bother checking whether the ift_txd_credits_update method pointer is NULL; _iflib_pre_assert() asserts upfront that this method has been assigned and functions like iflib_{fast_intr_rxtx,netmap_timer_adjust,txq_can_drain}() and _task_fn_tx() were already unconditionally relying on the method being callable. Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Wed Jun 26 15:16:23 2019 (r349413) +++ head/sys/net/iflib.c Wed Jun 26 15:28:21 2019 (r349414) @@ -3580,10 +3580,10 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, ui iflib_txq_t txq = r->cookie; if_ctx_t ctx = txq->ift_ctx; if_t ifp = ctx->ifc_ifp; - struct mbuf **mp, *m; - int i, count, consumed, pkt_sent, bytes_sent, mcast_sent, avail; - int reclaimed, err, in_use_prev, desc_used; - bool do_prefetch, ring, rang; + struct mbuf *m, **mp; + int avail, bytes_sent, consumed, count, err, i, in_use_prev; + int mcast_sent, pkt_sent, reclaimed, txq_avail; + bool do_prefetch, rang, ring; if (__predict_false(!(if_getdrvflags(ifp) & IFF_DRV_RUNNING) || !LINK_ACTIVE(ctx))) { @@ -3621,16 +3621,15 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, ui avail, ctx->ifc_flags, TXQ_AVAIL(txq)); #endif do_prefetch = (ctx->ifc_flags & IFC_PREFETCH); - avail = TXQ_AVAIL(txq); + txq_avail = TXQ_AVAIL(txq); err = 0; - for (desc_used = i = 0; i < count && avail > MAX_TX_DESC(ctx) + 2; i++) { + for (i = 0; i < count && txq_avail > MAX_TX_DESC(ctx) + 2; i++) { int rem = do_prefetch ? count - i : 0; mp = _ring_peek_one(r, cidx, i, rem); MPASS(mp != NULL && *mp != NULL); if (__predict_false(*mp == (struct mbuf *)txq)) { consumed++; - reclaimed++; continue; } in_use_prev = txq->ift_in_use; @@ -3649,10 +3648,9 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, ui DBG_COUNTER_INC(tx_sent); bytes_sent += m->m_pkthdr.len; mcast_sent += !!(m->m_flags & M_MCAST); - avail = TXQ_AVAIL(txq); + txq_avail = TXQ_AVAIL(txq); txq->ift_db_pending += (txq->ift_in_use - in_use_prev); - desc_used += (txq->ift_in_use - in_use_prev); ETHER_BPF_MTAP(ifp, m); if (__predict_false(!(ifp->if_drv_flags & IFF_DRV_RUNNING))) break; @@ -6154,9 +6152,6 @@ iflib_tx_credits_update(if_ctx_t ctx, iflib_txq_t txq) #ifdef INVARIANTS int credits_pre = txq->ift_cidx_processed; #endif - - if (ctx->isc_txd_credits_update == NULL) - return (0); bus_dmamap_sync(txq->ift_ifdi->idi_tag, txq->ift_ifdi->idi_map, BUS_DMASYNC_POSTREAD); From owner-svn-src-head@freebsd.org Wed Jun 26 15:43:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C02C15CB64E; Wed, 26 Jun 2019 15:43:21 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A8B072B4E; Wed, 26 Jun 2019 15:43:21 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07C041B77; Wed, 26 Jun 2019 15:43:21 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5QFhKjZ024800; Wed, 26 Jun 2019 15:43:20 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QFhKTA024799; Wed, 26 Jun 2019 15:43:20 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201906261543.x5QFhKTA024799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Wed, 26 Jun 2019 15:43:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349416 - head/lib/libc/stdlib X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/lib/libc/stdlib X-SVN-Commit-Revision: 349416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1A8B072B4E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 15:43:21 -0000 Author: arichardson Date: Wed Jun 26 15:43:20 2019 New Revision: 349416 URL: https://svnweb.freebsd.org/changeset/base/349416 Log: Fix -Wsign-compare warnings in realpath.c This is needed in order to build realpath.c as part of rtld. Modified: head/lib/libc/stdlib/realpath.c Modified: head/lib/libc/stdlib/realpath.c ============================================================================== --- head/lib/libc/stdlib/realpath.c Wed Jun 26 15:34:35 2019 (r349415) +++ head/lib/libc/stdlib/realpath.c Wed Jun 26 15:43:20 2019 (r349416) @@ -91,7 +91,7 @@ realpath1(const char *path, char *resolved) */ p = strchr(left, '/'); - next_token_len = p != NULL ? p - left : left_len; + next_token_len = p != NULL ? (size_t)(p - left) : left_len; memcpy(next_token, left, next_token_len); next_token[next_token_len] = '\0'; @@ -146,7 +146,7 @@ realpath1(const char *path, char *resolved) return (NULL); } slen = readlink(resolved, symlink, sizeof(symlink)); - if (slen <= 0 || slen >= sizeof(symlink)) { + if (slen <= 0 || slen >= (ssize_t)sizeof(symlink)) { if (slen < 0) ; /* keep errno from readlink(2) call */ else if (slen == 0) @@ -173,7 +173,7 @@ realpath1(const char *path, char *resolved) */ if (p != NULL) { if (symlink[slen - 1] != '/') { - if (slen + 1 >= sizeof(symlink)) { + if (slen + 1 >= (ssize_t)sizeof(symlink)) { errno = ENAMETOOLONG; return (NULL); } From owner-svn-src-head@freebsd.org Wed Jun 26 15:43:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6038915CB674; Wed, 26 Jun 2019 15:43:29 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EAF6B72BCE; Wed, 26 Jun 2019 15:43:28 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEC511B78; Wed, 26 Jun 2019 15:43:26 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5QFhQmv024855; Wed, 26 Jun 2019 15:43:26 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QFhQ7B024853; Wed, 26 Jun 2019 15:43:26 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201906261543.x5QFhQ7B024853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Wed, 26 Jun 2019 15:43:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349417 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 349417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EAF6B72BCE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 15:43:29 -0000 Author: arichardson Date: Wed Jun 26 15:43:26 2019 New Revision: 349417 URL: https://svnweb.freebsd.org/changeset/base/349417 Log: Use rtld_putstr() instead of write() for the rtld msg() macro This removes an unnecessary libc dependency from rtld. See https://reviews.freebsd.org/D20663 for more details. Modified: head/libexec/rtld-elf/debug.h head/libexec/rtld-elf/rtld_printf.h Modified: head/libexec/rtld-elf/debug.h ============================================================================== --- head/libexec/rtld-elf/debug.h Wed Jun 26 15:43:20 2019 (r349416) +++ head/libexec/rtld-elf/debug.h Wed Jun 26 15:43:26 2019 (r349417) @@ -37,7 +37,7 @@ #include #include -#include +#include "rtld_printf.h" void debug_printf(const char *, ...) __printflike(1, 2); extern int debug; @@ -57,7 +57,7 @@ extern int debug; #define assert(cond) ((cond) ? (void) 0 : \ (msg(_MYNAME ": assert failed: " __FILE__ ":" \ __XSTRING(__LINE__) "\n"), abort())) -#define msg(s) write(STDOUT_FILENO, s, strlen(s)) +#define msg(s) rtld_putstr(s) #define trace() msg(_MYNAME ": " __XSTRING(__LINE__) "\n") Modified: head/libexec/rtld-elf/rtld_printf.h ============================================================================== --- head/libexec/rtld-elf/rtld_printf.h Wed Jun 26 15:43:20 2019 (r349416) +++ head/libexec/rtld-elf/rtld_printf.h Wed Jun 26 15:43:26 2019 (r349417) @@ -31,6 +31,7 @@ #define RTLD_PRINTF_H 1 #include +#include #include int rtld_snprintf(char *buf, size_t bufsize, const char *fmt, ...) From owner-svn-src-head@freebsd.org Wed Jun 26 16:23:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9A5815CC236; Wed, 26 Jun 2019 16:23:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7CD5574381; Wed, 26 Jun 2019 16:23:25 +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 6A8312267; Wed, 26 Jun 2019 16:23:25 +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 x5QGNPKG045810; Wed, 26 Jun 2019 16:23:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QGNPk3045809; Wed, 26 Jun 2019 16:23:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201906261623.x5QGNPk3045809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Jun 2019 16:23:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349418 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 349418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7CD5574381 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 16:23:26 -0000 Author: mav Date: Wed Jun 26 16:23:24 2019 New Revision: 349418 URL: https://svnweb.freebsd.org/changeset/base/349418 Log: Fix qlxgbe(4) static build. MFC after: 2 weeks Modified: head/sys/conf/files.amd64 Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Wed Jun 26 15:43:26 2019 (r349417) +++ head/sys/conf/files.amd64 Wed Jun 26 16:23:24 2019 (r349418) @@ -389,6 +389,9 @@ dev/qlxgbe/ql_isr.c optional qlxgbe pci dev/qlxgbe/ql_misc.c optional qlxgbe pci dev/qlxgbe/ql_os.c optional qlxgbe pci dev/qlxgbe/ql_reset.c optional qlxgbe pci +dev/qlxgbe/ql_fw.c optional qlxgbe pci +dev/qlxgbe/ql_boot.c optional qlxgbe pci +dev/qlxgbe/ql_minidump.c optional qlxgbe pci dev/qlnx/qlnxe/ecore_cxt.c optional qlnxe pci \ compile-with "${LINUXKPI_C}" dev/qlnx/qlnxe/ecore_dbg_fw_funcs.c optional qlnxe pci \ From owner-svn-src-head@freebsd.org Wed Jun 26 16:28:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 679DA15CC33A; Wed, 26 Jun 2019 16:28:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0996B745C4; Wed, 26 Jun 2019 16:28: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 D6CC52288; Wed, 26 Jun 2019 16:28:42 +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 x5QGSgTO046071; Wed, 26 Jun 2019 16:28:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QGSgF0046070; Wed, 26 Jun 2019 16:28:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201906261628.x5QGSgF0046070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 26 Jun 2019 16:28:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349419 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 349419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0996B745C4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 16:28:43 -0000 Author: markj Date: Wed Jun 26 16:28:42 2019 New Revision: 349419 URL: https://svnweb.freebsd.org/changeset/base/349419 Log: Remove references to splbio in ffs_softdep.c. Assert that the per-mountpoint softdep mutex is held in modified functions that do not already have this assertion. No functional change intended. Reviewed by: kib, mckusick (previous version) MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20741 Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Wed Jun 26 16:23:24 2019 (r349418) +++ head/sys/ufs/ffs/ffs_softdep.c Wed Jun 26 16:28:42 2019 (r349419) @@ -2110,7 +2110,6 @@ pagedep_find(pagedephd, ino, lbn, pagedeppp) * Look up a pagedep. Return 1 if found, 0 otherwise. * If not found, allocate if DEPALLOC flag is passed. * Found or allocated entry is returned in pagedeppp. - * This routine must be called with splbio interrupts blocked. */ static int pagedep_lookup(mp, bp, ino, lbn, flags, pagedeppp) @@ -2202,7 +2201,6 @@ inodedep_find(inodedephd, inum, inodedeppp) * Look up an inodedep. Return 1 if found, 0 if not found. * If not found, allocate if DEPALLOC flag is passed. * Found or allocated entry is returned in inodedeppp. - * This routine must be called with splbio interrupts blocked. */ static int inodedep_lookup(mp, inum, flags, inodedeppp) @@ -5478,7 +5476,6 @@ jnewblk_merge(new, old, wkhd) /* * Replace an old allocdirect dependency with a newer one. - * This routine must be called with splbio interrupts blocked. */ static void allocdirect_merge(adphead, newadp, oldadp) @@ -7534,7 +7531,6 @@ free_newblk(newblk) /* * Free a newdirblk. Clear the NEWBLOCK flag on its associated pagedep. - * This routine must be called with splbio interrupts blocked. */ static void free_newdirblk(newdirblk) @@ -7665,7 +7661,6 @@ softdep_freefile(pvp, ino, mode) /* * Check to see if an inode has never been written to disk. If * so free the inodedep and return success, otherwise return failure. - * This routine must be called with splbio interrupts blocked. * * If we still have a bitmap dependency, then the inode has never * been written to disk. Drop the dependency as it is no longer @@ -8897,8 +8892,7 @@ cancel_diradd(dap, dirrem, jremref, dotremref, dotdotr } /* - * Free a diradd dependency structure. This routine must be called - * with splbio interrupts blocked. + * Free a diradd dependency structure. */ static void free_diradd(dap, wkhd) @@ -11195,9 +11189,7 @@ softdep_disk_write_complete(bp) } /* - * Called from within softdep_disk_write_complete above. Note that - * this routine is always called from interrupt level with further - * splbio interrupts blocked. + * Called from within softdep_disk_write_complete above. */ static void handle_allocdirect_partdone(adp, wkhd) @@ -11209,6 +11201,7 @@ handle_allocdirect_partdone(adp, wkhd) struct inodedep *inodedep; long bsize; + LOCK_OWNED(VFSTOUFS(adp->ad_block.nb_list.wk_mp)); if ((adp->ad_state & ALLCOMPLETE) != ALLCOMPLETE) return; /* @@ -11818,7 +11811,6 @@ handle_written_indirdep(indirdep, bp, bpp, flags) /* * Process a diradd entry after its dependent inode has been written. - * This routine must be called with splbio interrupts blocked. */ static void diradd_inode_written(dap, inodedep) @@ -11826,6 +11818,7 @@ diradd_inode_written(dap, inodedep) struct inodedep *inodedep; { + LOCK_OWNED(VFSTOUFS(dap->da_list.wk_mp)); dap->da_state |= COMPLETE; complete_diradd(dap); WORKLIST_INSERT(&inodedep->id_pendinghd, &dap->da_list); @@ -12386,8 +12379,7 @@ retry: /* * Merge the a new inode dependency list (such as id_newinoupdt) into an - * old inode dependency list (such as id_inoupdt). This routine must be - * called with splbio interrupts blocked. + * old inode dependency list (such as id_inoupdt). */ static void merge_inode_lists(newlisthead, oldlisthead) @@ -12397,6 +12389,8 @@ merge_inode_lists(newlisthead, oldlisthead) struct allocdirect *listadp, *newadp; newadp = TAILQ_FIRST(newlisthead); + if (newadp != NULL) + LOCK_OWNED(VFSTOUFS(newadp->ad_block.nb_list.wk_mp)); for (listadp = TAILQ_FIRST(oldlisthead); listadp && newadp;) { if (listadp->ad_offset < newadp->ad_offset) { listadp = TAILQ_NEXT(listadp, ad_next); @@ -12891,7 +12885,6 @@ out: /* * Flush the dependencies associated with an inodedep. - * Called with splbio blocked. */ static int flush_inodedep_deps(vp, mp, ino) @@ -12956,7 +12949,6 @@ restart: /* * Flush an inode dependency list. - * Called with splbio blocked. */ static int flush_deplist(listhead, waitfor, errorp) @@ -13098,7 +13090,6 @@ flush_newblk_dep(vp, mp, lbn) /* * Eliminate a pagedep dependency by flushing out all its diradd dependencies. - * Called with splbio blocked. */ static int flush_pagedep_deps(pvp, mp, diraddhdp) From owner-svn-src-head@freebsd.org Wed Jun 26 16:30:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E356C15CC407; Wed, 26 Jun 2019 16:30:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A2197477D; Wed, 26 Jun 2019 16:30:15 +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 7F166228F; Wed, 26 Jun 2019 16:30:15 +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 x5QGUFes046200; Wed, 26 Jun 2019 16:30:15 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QGUFGE046199; Wed, 26 Jun 2019 16:30:15 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201906261630.x5QGUFGE046199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 26 Jun 2019 16:30:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349420 - head/contrib/elftoolchain/libelftc X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/contrib/elftoolchain/libelftc X-SVN-Commit-Revision: 349420 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8A2197477D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 16:30:16 -0000 Author: markj Date: Wed Jun 26 16:30:14 2019 New Revision: 349420 URL: https://svnweb.freebsd.org/changeset/base/349420 Log: libelftc: Micro-optimize string table insertion. The string's length is already known, so use memcpy() instead of strcpy() to add it to the string table image. Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20760 Modified: head/contrib/elftoolchain/libelftc/elftc_string_table.c Modified: head/contrib/elftoolchain/libelftc/elftc_string_table.c ============================================================================== --- head/contrib/elftoolchain/libelftc/elftc_string_table.c Wed Jun 26 16:28:42 2019 (r349419) +++ head/contrib/elftoolchain/libelftc/elftc_string_table.c Wed Jun 26 16:30:14 2019 (r349420) @@ -119,7 +119,7 @@ elftc_string_table_add_to_pool(Elftc_String_Table *st, st->st_string_pool_size = newsize; } - strcpy(st->st_string_pool + stlen, string); + memcpy(st->st_string_pool + stlen, string, len); ELFTC_STRING_TABLE_UPDATE_LENGTH(st, stlen + len); return (stlen); From owner-svn-src-head@freebsd.org Wed Jun 26 16:31:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D9D915CC651; Wed, 26 Jun 2019 16:31:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B419A74B31; Wed, 26 Jun 2019 16:31: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 8DC0B2406; Wed, 26 Jun 2019 16:31: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 x5QGVpTc047836; Wed, 26 Jun 2019 16:31:51 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QGVp2i047833; Wed, 26 Jun 2019 16:31:51 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201906261631.x5QGVp2i047833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 26 Jun 2019 16:31:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349421 - head/contrib/elftoolchain/libelftc X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/contrib/elftoolchain/libelftc X-SVN-Commit-Revision: 349421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B419A74B31 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 16:31:52 -0000 Author: markj Date: Wed Jun 26 16:31:50 2019 New Revision: 349421 URL: https://svnweb.freebsd.org/changeset/base/349421 Log: libelftc: Consistently use size_t for string table offsets and sizes. Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20702 Modified: head/contrib/elftoolchain/libelftc/elftc_string_table.c head/contrib/elftoolchain/libelftc/elftc_string_table_create.3 head/contrib/elftoolchain/libelftc/libelftc.h Modified: head/contrib/elftoolchain/libelftc/elftc_string_table.c ============================================================================== --- head/contrib/elftoolchain/libelftc/elftc_string_table.c Wed Jun 26 16:30:14 2019 (r349420) +++ head/contrib/elftoolchain/libelftc/elftc_string_table.c Wed Jun 26 16:31:50 2019 (r349421) @@ -44,7 +44,7 @@ ELFTC_VCSID("$Id: elftc_string_table.c 2869 2013-01-06 #define ELFTC_STRING_TABLE_POOL_SIZE_INCREMENT (4*1024) struct _Elftc_String_Table_Entry { - int ste_idx; + ssize_t ste_idx; SLIST_ENTRY(_Elftc_String_Table_Entry) ste_next; }; @@ -64,9 +64,9 @@ struct _Elftc_String_Table_Entry { } while (0) struct _Elftc_String_Table { - unsigned int st_len; /* length and flags */ + size_t st_len; /* length and flags */ int st_nbuckets; - int st_string_pool_size; + size_t st_string_pool_size; char *st_string_pool; SLIST_HEAD(_Elftc_String_Table_Bucket, _Elftc_String_Table_Entry) st_buckets[]; @@ -86,7 +86,7 @@ elftc_string_table_find_hash_entry(Elftc_String_Table *rhashindex = hashindex; SLIST_FOREACH(ste, &st->st_buckets[hashindex], ste_next) { - s = st->st_string_pool + abs(ste->ste_idx); + s = st->st_string_pool + labs(ste->ste_idx); assert(s > st->st_string_pool && s < st->st_string_pool + st->st_string_pool_size); @@ -102,7 +102,7 @@ static int elftc_string_table_add_to_pool(Elftc_String_Table *st, const char *string) { char *newpool; - int len, newsize, stlen; + size_t len, newsize, stlen; len = strlen(string) + 1; /* length, including the trailing NUL */ stlen = ELFTC_STRING_TABLE_LENGTH(st); @@ -126,10 +126,10 @@ elftc_string_table_add_to_pool(Elftc_String_Table *st, } Elftc_String_Table * -elftc_string_table_create(int sizehint) +elftc_string_table_create(size_t sizehint) { - int n, nbuckets, tablesize; struct _Elftc_String_Table *st; + int n, nbuckets, tablesize; if (sizehint < ELFTC_STRING_TABLE_DEFAULT_SIZE) sizehint = ELFTC_STRING_TABLE_DEFAULT_SIZE; @@ -173,13 +173,13 @@ elftc_string_table_destroy(Elftc_String_Table *st) } Elftc_String_Table * -elftc_string_table_from_section(Elf_Scn *scn, int sizehint) +elftc_string_table_from_section(Elf_Scn *scn, size_t sizehint) { - int len; Elf_Data *d; GElf_Shdr sh; const char *s, *end; Elftc_String_Table *st; + size_t len; /* Verify the type of the section passed in. */ if (gelf_getshdr(scn, &sh) == NULL || @@ -235,7 +235,8 @@ elftc_string_table_image(Elftc_String_Table *st, size_ char *r, *s, *end; struct _Elftc_String_Table_Entry *ste; struct _Elftc_String_Table_Bucket *head; - int copied, hashindex, offset, length, newsize; + size_t copied, offset, length, newsize; + int hashindex; /* * For the common case of a string table has not seen @@ -303,8 +304,9 @@ elftc_string_table_image(Elftc_String_Table *st, size_ size_t elftc_string_table_insert(Elftc_String_Table *st, const char *string) { - int hashindex, idx; struct _Elftc_String_Table_Entry *ste; + ssize_t idx; + int hashindex; hashindex = 0; @@ -326,7 +328,7 @@ elftc_string_table_insert(Elftc_String_Table *st, cons idx = ste->ste_idx; if (idx < 0) /* Undelete. */ - ste->ste_idx = idx = (- idx); + ste->ste_idx = idx = -idx; return (idx); } @@ -334,8 +336,9 @@ elftc_string_table_insert(Elftc_String_Table *st, cons size_t elftc_string_table_lookup(Elftc_String_Table *st, const char *string) { - int hashindex, idx; struct _Elftc_String_Table_Entry *ste; + ssize_t idx; + int hashindex; ste = elftc_string_table_find_hash_entry(st, string, &hashindex); @@ -350,17 +353,17 @@ elftc_string_table_lookup(Elftc_String_Table *st, cons int elftc_string_table_remove(Elftc_String_Table *st, const char *string) { - int idx; struct _Elftc_String_Table_Entry *ste; + ssize_t idx; ste = elftc_string_table_find_hash_entry(st, string, NULL); if (ste == NULL || (idx = ste->ste_idx) < 0) return (ELFTC_FAILURE); - assert(idx > 0 && idx < (int) ELFTC_STRING_TABLE_LENGTH(st)); + assert(idx > 0 && (size_t)idx < ELFTC_STRING_TABLE_LENGTH(st)); - ste->ste_idx = (- idx); + ste->ste_idx = -idx; ELFTC_STRING_TABLE_SET_COMPACTION_FLAG(st); Modified: head/contrib/elftoolchain/libelftc/elftc_string_table_create.3 ============================================================================== --- head/contrib/elftoolchain/libelftc/elftc_string_table_create.3 Wed Jun 26 16:30:14 2019 (r349420) +++ head/contrib/elftoolchain/libelftc/elftc_string_table_create.3 Wed Jun 26 16:31:50 2019 (r349421) @@ -24,7 +24,7 @@ .\" .\" $Id: elftc_string_table_create.3 3645 2018-10-15 20:17:14Z jkoshy $ .\" -.Dd January 5, 2013 +.Dd June 19, 2019 .Dt ELFTC_STRING_TABLE_CREATE 3 .Os .Sh NAME @@ -40,11 +40,11 @@ .Sh SYNOPSIS .In libelftc.h .Ft "Elftc_String_Table *" -.Fn elftc_string_table_create "int sizehint" +.Fn elftc_string_table_create "size_t sizehint" .Ft int .Fn elftc_string_table_destroy "Elftc_String_Table *table" .Ft "Elftc_String_Table *" -.Fn elftc_string_table_from_section "Elf_Scn *scn" "int sizehint" +.Fn elftc_string_table_from_section "Elf_Scn *scn" "size_t sizehint" .Ft "const char *" .Fo elftc_string_table_image .Fa "Elftc_String_Table *table" Modified: head/contrib/elftoolchain/libelftc/libelftc.h ============================================================================== --- head/contrib/elftoolchain/libelftc/libelftc.h Wed Jun 26 16:30:14 2019 (r349420) +++ head/contrib/elftoolchain/libelftc/libelftc.h Wed Jun 26 16:31:50 2019 (r349421) @@ -77,10 +77,10 @@ int elftc_demangle(const char *_mangledname, char *_b size_t _bufsize, unsigned int _flags); const char *elftc_reloc_type_str(unsigned int mach, unsigned int type); int elftc_set_timestamps(const char *_filename, struct stat *_sb); -Elftc_String_Table *elftc_string_table_create(int _hint); +Elftc_String_Table *elftc_string_table_create(size_t _sizehint); void elftc_string_table_destroy(Elftc_String_Table *_table); Elftc_String_Table *elftc_string_table_from_section(Elf_Scn *_scn, - int _hint); + size_t _sizehint); const char *elftc_string_table_image(Elftc_String_Table *_table, size_t *_sz); size_t elftc_string_table_insert(Elftc_String_Table *_table, From owner-svn-src-head@freebsd.org Wed Jun 26 16:32:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7000415CC6C4; Wed, 26 Jun 2019 16:32:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1397074D3C; Wed, 26 Jun 2019 16:32:42 +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 E2F30244C; Wed, 26 Jun 2019 16:32:41 +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 x5QGWfMT050882; Wed, 26 Jun 2019 16:32:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QGWfnW050881; Wed, 26 Jun 2019 16:32:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201906261632.x5QGWfnW050881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 26 Jun 2019 16:32:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349422 - head/contrib/elftoolchain/libelftc X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/contrib/elftoolchain/libelftc X-SVN-Commit-Revision: 349422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1397074D3C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 16:32:42 -0000 Author: markj Date: Wed Jun 26 16:32:41 2019 New Revision: 349422 URL: https://svnweb.freebsd.org/changeset/base/349422 Log: libelftc: Fix the documented prototype for elftc_string_table_destroy(). MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/libelftc/elftc_string_table_create.3 Modified: head/contrib/elftoolchain/libelftc/elftc_string_table_create.3 ============================================================================== --- head/contrib/elftoolchain/libelftc/elftc_string_table_create.3 Wed Jun 26 16:31:50 2019 (r349421) +++ head/contrib/elftoolchain/libelftc/elftc_string_table_create.3 Wed Jun 26 16:32:41 2019 (r349422) @@ -41,7 +41,7 @@ .In libelftc.h .Ft "Elftc_String_Table *" .Fn elftc_string_table_create "size_t sizehint" -.Ft int +.Ft void .Fn elftc_string_table_destroy "Elftc_String_Table *table" .Ft "Elftc_String_Table *" .Fn elftc_string_table_from_section "Elf_Scn *scn" "size_t sizehint" From owner-svn-src-head@freebsd.org Wed Jun 26 16:35:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B0F215CC7E3; Wed, 26 Jun 2019 16:35:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 09B7B74F22; Wed, 26 Jun 2019 16:35:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2AF3244E; Wed, 26 Jun 2019 16:35:37 +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 x5QGZbn6051085; Wed, 26 Jun 2019 16:35:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QGZbJ7051084; Wed, 26 Jun 2019 16:35:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201906261635.x5QGZbJ7051084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 26 Jun 2019 16:35:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349423 - head/contrib/elftoolchain/elfcopy X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/contrib/elftoolchain/elfcopy X-SVN-Commit-Revision: 349423 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 09B7B74F22 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 16:35:38 -0000 Author: markj Date: Wed Jun 26 16:35:37 2019 New Revision: 349423 URL: https://svnweb.freebsd.org/changeset/base/349423 Log: elfcopy: Provide a size hint when creating the section string table. Use the input file's .shstrtab size as the hint if it exists. This gives a small performance improvement when processing files with many sections. Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20544 Modified: head/contrib/elftoolchain/elfcopy/sections.c Modified: head/contrib/elftoolchain/elfcopy/sections.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/sections.c Wed Jun 26 16:32:41 2019 (r349422) +++ head/contrib/elftoolchain/elfcopy/sections.c Wed Jun 26 16:35:37 2019 (r349423) @@ -1398,8 +1398,24 @@ update_shdr(struct elfcopy *ecp, int update_link) void init_shstrtab(struct elfcopy *ecp) { + Elf_Scn *shstrtab; + GElf_Shdr shdr; struct section *s; + size_t indx, sizehint; + if (elf_getshstrndx(ecp->ein, &indx) != 0) { + shstrtab = elf_getscn(ecp->ein, indx); + if (shstrtab == NULL) + errx(EXIT_FAILURE, "elf_getscn failed: %s", + elf_errmsg(-1)); + if (gelf_getshdr(shstrtab, &shdr) != &shdr) + errx(EXIT_FAILURE, "gelf_getshdr failed: %s", + elf_errmsg(-1)); + sizehint = shdr.sh_size; + } else { + sizehint = 0; + } + if ((ecp->shstrtab = calloc(1, sizeof(*ecp->shstrtab))) == NULL) err(EXIT_FAILURE, "calloc failed"); s = ecp->shstrtab; @@ -1410,7 +1426,7 @@ init_shstrtab(struct elfcopy *ecp) s->loadable = 0; s->type = SHT_STRTAB; s->vma = 0; - s->strtab = elftc_string_table_create(0); + s->strtab = elftc_string_table_create(sizehint); add_to_shstrtab(ecp, ""); add_to_shstrtab(ecp, ".symtab"); From owner-svn-src-head@freebsd.org Wed Jun 26 16:38:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76EB615CC8D6; Wed, 26 Jun 2019 16:38: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 18DDC750D6; Wed, 26 Jun 2019 16:38:31 +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 D6C2A2458; Wed, 26 Jun 2019 16:38: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 x5QGcUU8051234; Wed, 26 Jun 2019 16:38:30 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QGcUac051233; Wed, 26 Jun 2019 16:38:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201906261638.x5QGcUac051233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 26 Jun 2019 16:38:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349424 - head/contrib/elftoolchain/libdwarf X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/contrib/elftoolchain/libdwarf X-SVN-Commit-Revision: 349424 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 18DDC750D6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 16:38:31 -0000 Author: markj Date: Wed Jun 26 16:38:30 2019 New Revision: 349424 URL: https://svnweb.freebsd.org/changeset/base/349424 Log: libdwarf: Use the cached strtab pointer when reading string attributes. Previously we would perform a linear search of the DWARF section list for ".debug_str". However, libdwarf always caches a pointer to the strtab image in its debug descriptor. Using it gives a modest performance improvement when iterating over the attributes of each DIE. Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20759 Modified: head/contrib/elftoolchain/libdwarf/libdwarf_attr.c Modified: head/contrib/elftoolchain/libdwarf/libdwarf_attr.c ============================================================================== --- head/contrib/elftoolchain/libdwarf/libdwarf_attr.c Wed Jun 26 16:35:37 2019 (r349423) +++ head/contrib/elftoolchain/libdwarf/libdwarf_attr.c Wed Jun 26 16:38:30 2019 (r349424) @@ -100,7 +100,6 @@ _dwarf_attr_init(Dwarf_Debug dbg, Dwarf_Section *ds, u uint64_t form, int indirect, Dwarf_Error *error) { struct _Dwarf_Attribute atref; - Dwarf_Section *str; int ret; ret = DW_DLE_NONE; @@ -183,9 +182,7 @@ _dwarf_attr_init(Dwarf_Debug dbg, Dwarf_Section *ds, u break; case DW_FORM_strp: atref.u[0].u64 = dbg->read(ds->ds_data, offsetp, dwarf_size); - str = _dwarf_find_section(dbg, ".debug_str"); - assert(str != NULL); - atref.u[1].s = (char *) str->ds_data + atref.u[0].u64; + atref.u[1].s = _dwarf_strtab_get_table(dbg) + atref.u[0].u64; break; case DW_FORM_ref_sig8: atref.u[0].u64 = 8; From owner-svn-src-head@freebsd.org Wed Jun 26 16:56:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6088F15CCE66; Wed, 26 Jun 2019 16:56:57 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 05F0375B3A; Wed, 26 Jun 2019 16:56:57 +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 CBDFA27AA; Wed, 26 Jun 2019 16:56:56 +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 x5QGuuPI061821; Wed, 26 Jun 2019 16:56:56 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QGuuwS061820; Wed, 26 Jun 2019 16:56:56 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201906261656.x5QGuuwS061820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Wed, 26 Jun 2019 16:56:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349426 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: cognet X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 05F0375B3A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 16:56:57 -0000 Author: cognet Date: Wed Jun 26 16:56:56 2019 New Revision: 349426 URL: https://svnweb.freebsd.org/changeset/base/349426 Log: Fix debugging of 32bits arm binaries on arm64. In set_regs32()/fill_regs32(), we have to get/set SP and LR from/to tf_x[13] and tf_x[14]. set_regs() and fill_regs() may be called for a 32bits process, if the process is ptrace'd from a 64bits debugger. So, in set_regs() and fill_regs(), get or set PC and SPSR from where the debugger expects it, from tf_x[15] and tf_x[16]. Modified: head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Wed Jun 26 16:38:46 2019 (r349425) +++ head/sys/arm64/arm64/machdep.c Wed Jun 26 16:56:56 2019 (r349426) @@ -194,6 +194,16 @@ fill_regs(struct thread *td, struct reg *regs) memcpy(regs->x, frame->tf_x, sizeof(regs->x)); +#ifdef COMPAT_FREEBSD32 + /* + * We may be called here for a 32bits process, if we're using a + * 64bits debugger. If so, put PC and SPSR where it expects it. + */ + if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) { + regs->x[15] = frame->tf_elr; + regs->x[16] = frame->tf_spsr; + } +#endif return (0); } @@ -211,6 +221,17 @@ set_regs(struct thread *td, struct reg *regs) memcpy(frame->tf_x, regs->x, sizeof(frame->tf_x)); +#ifdef COMPAT_FREEBSD32 + if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) { + /* + * We may be called for a 32bits process if we're using + * a 64bits debugger. If so, get PC and SPSR from where + * it put it. + */ + frame->tf_elr = regs->x[15]; + frame->tf_spsr = regs->x[16] & PSR_FLAGS; + } +#endif return (0); } @@ -283,8 +304,9 @@ fill_regs32(struct thread *td, struct reg32 *regs) tf = td->td_frame; for (i = 0; i < 13; i++) regs->r[i] = tf->tf_x[i]; - regs->r_sp = tf->tf_sp; - regs->r_lr = tf->tf_lr; + /* For arm32, SP is r13 and LR is r14 */ + regs->r_sp = tf->tf_x[13]; + regs->r_lr = tf->tf_x[14]; regs->r_pc = tf->tf_elr; regs->r_cpsr = tf->tf_spsr; @@ -300,8 +322,9 @@ set_regs32(struct thread *td, struct reg32 *regs) tf = td->td_frame; for (i = 0; i < 13; i++) tf->tf_x[i] = regs->r[i]; - tf->tf_sp = regs->r_sp; - tf->tf_lr = regs->r_lr; + /* For arm 32, SP is r13 an LR is r14 */ + tf->tf_x[13] = regs->r_sp; + tf->tf_x[14] = regs->r_lr; tf->tf_elr = regs->r_pc; tf->tf_spsr = regs->r_cpsr; From owner-svn-src-head@freebsd.org Wed Jun 26 17:16:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C73C15CD616; Wed, 26 Jun 2019 17:16:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13A197688E; Wed, 26 Jun 2019 17:16: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 E28702B4D; Wed, 26 Jun 2019 17:16:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5QHGQ35071842; Wed, 26 Jun 2019 17:16:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QHGQYB071841; Wed, 26 Jun 2019 17:16:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201906261716.x5QHGQYB071841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 26 Jun 2019 17:16:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349427 - 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: 349427 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 13A197688E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 17:16:27 -0000 Author: kib Date: Wed Jun 26 17:16:26 2019 New Revision: 349427 URL: https://svnweb.freebsd.org/changeset/base/349427 Log: amd64 pmap: Fix pkru handling in pmap_remove(). When pmap_pkru_on_remove() is called, the sva argument value was advanced. Clear PKRU earlier when sva still specifies the start of the region. Noted and reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Jun 26 16:56:56 2019 (r349426) +++ head/sys/amd64/amd64/pmap.c Wed Jun 26 17:16:26 2019 (r349427) @@ -4998,6 +4998,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t pmap_delayed_invl_start(); PMAP_LOCK(pmap); + pmap_pkru_on_remove(pmap, sva, eva); /* * special handling of removing one page. a very @@ -5091,7 +5092,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t out: if (anyvalid) pmap_invalidate_all(pmap); - pmap_pkru_on_remove(pmap, sva, eva); PMAP_UNLOCK(pmap); pmap_delayed_invl_finish(); vm_page_free_pages_toq(&free, true); From owner-svn-src-head@freebsd.org Wed Jun 26 17:17:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99C8515CD6CC; Wed, 26 Jun 2019 17:17:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3B5A876A4D; Wed, 26 Jun 2019 17:17:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1592C2B4F; Wed, 26 Jun 2019 17:17:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5QHHXTI071927; Wed, 26 Jun 2019 17:17:33 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QHHX3M071926; Wed, 26 Jun 2019 17:17:33 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201906261717.x5QHHX3M071926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 26 Jun 2019 17:17:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349428 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 349428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3B5A876A4D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 17:17:34 -0000 Author: avg Date: Wed Jun 26 17:17:33 2019 New Revision: 349428 URL: https://svnweb.freebsd.org/changeset/base/349428 Log: owc_gpiobus: clean / fix up the driver module things "fdt" is removed from the driver module name as the driver does not require FDT and can work very well on hints based systems. A module dependency is added for gpiobus. Without that owc cannot resolve symbols in gpiobus if both are loaded as kernel modules. Finally, a driver module module version is added. Reviewed by: imp MFC after: 11 days Modified: head/sys/dev/ow/owc_gpiobus.c Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Wed Jun 26 17:16:26 2019 (r349427) +++ head/sys/dev/ow/owc_gpiobus.c Wed Jun 26 17:17:33 2019 (r349428) @@ -416,5 +416,7 @@ static driver_t owc_gpiobus_driver = { sizeof(struct owc_gpiobus_softc), }; -DRIVER_MODULE(owc_gpiobus_fdt, gpiobus, owc_gpiobus_driver, owc_gpiobus_devclass, 0, 0); -MODULE_DEPEND(owc_gpiobus_fdt, ow, 1, 1, 1); +DRIVER_MODULE(owc_gpiobus, gpiobus, owc_gpiobus_driver, owc_gpiobus_devclass, 0, 0); +MODULE_DEPEND(owc_gpiobust, ow, 1, 1, 1); +MODULE_DEPEND(owc_gpiobus, gpiobus, 1, 1, 1); +MODULE_VERSION(owc_gpiobus, 1); From owner-svn-src-head@freebsd.org Wed Jun 26 17:31:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7910B15CDF3A for ; Wed, 26 Jun 2019 17:31:32 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8B2C77EFD for ; Wed, 26 Jun 2019 17:31:31 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1561570289; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=YwBVzCuMC9wN58QqtfllQudJIMSEGrm8lKwYSSrJ7R9ckzF03AuYfCyf4snfkkn0Q0rSObyasQqk+ Y6ZRfoF0tkWyokhukFQggsGINEHZdohNiSKrgEhenq/4kUQxRPk71b5yt8hN3gDHNnUUodzcoCCpYa Q/E/HjyKlU6XGtMY05RnYGuTKdeODUFjxB7rqlrODaPXp1rBjWjwej3Vko6ZjzPsBgR3a0EqBzx6A5 FsLdbgoXD08DmDHvAbV7wkFzI/+4TOlSK/xv+21vSIQm90jIlSiDW3cK2HXnsz/7Huq8+b6/fOHZzb s5S3u8wxOHuozRzdHyzs2I9LM0ZCW/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=u8VcAzL5MhLbY0FdEr+GQwR9l0WvLyAWqJe/OWVYTCo=; b=SMyNiIG+v1xK3BoCXTzZ04R6FJToffypYZk6rwnNVsEvXIhNDHGxd01TjpBNqztYkzFAakskGO4xD MJU8X4o0U+wcEM3aoLq1i7aol40U8cZY4MjHlYc/gg5X2nJ31UYWBKDZlrKPvRxEKEb3H6j1tvsn9J hcAzwo7jp6Rt8oJWbyQIoZ+7eR1o5jdJt5pD4OKrsqBG7rd2EQvVcTx3n54WeD0D5iUF/YGr/wu/m3 u7TF0uJvEenMpeGZ+dRUNk+r9TcxNEcHhRB8HHlb7RP7yKyP8wK1tZGkfMb1o0tKbkhwRVJJg8k7Fl mJznnNawjvCh/AJTHR9gaY8+g5BIiFQ== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=u8VcAzL5MhLbY0FdEr+GQwR9l0WvLyAWqJe/OWVYTCo=; b=D2jJ3peFpV81UTnAVJibHvcJrxiANiCvq5ZxeU/Y04KvynPUViCWWSdaRzUKZ0tmgu7Xy47zVGyqV r3h49Ti8YKDOj3ikz0XtWN1FwJuFUYrr9ixfcBYh/GxNV1QcQMlNKDoKALwm9Xe0gmgMoufxHNuNxW MqFJfgZG69CB0oh0qeblhuIQ9BoDNHnTPXChRdlkqG2ynNk1lLl9spd/o4A4XLMBZPNb4ikVXeBZzz LHlpmBFs/Iy1ZcOXw56VxsP1zGMRNcepDNouVSZ8EpsUrHiiSkEKMbVBnalKLtOp0gKqye7zabwg6G v2E5k/ZzEWBzlpxG0KP8yVph1PqeUDw== X-MHO-RoutePath: aGlwcGll X-MHO-User: 3a11b609-9838-11e9-a4fc-d9033e875444 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 outbound3.ore.mailhop.org (Halon) with ESMTPSA id 3a11b609-9838-11e9-a4fc-d9033e875444; Wed, 26 Jun 2019 17:31:28 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x5QHVQGR051566; Wed, 26 Jun 2019 11:31:26 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <5b434ce0f1123b3a569c486c4365a8481cb16ccc.camel@freebsd.org> Subject: Re: svn commit: r349428 - head/sys/dev/ow From: Ian Lepore To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Wed, 26 Jun 2019 11:31:26 -0600 In-Reply-To: <201906261717.x5QHHX3M071926@repo.freebsd.org> References: <201906261717.x5QHHX3M071926@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: E8B2C77EFD X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 17:31:32 -0000 On Wed, 2019-06-26 at 17:17 +0000, Andriy Gapon wrote: > +MODULE_DEPEND(owc_gpiobust, ow, 1, 1, 1); Looks like a typo there. -- Ian From owner-svn-src-head@freebsd.org Wed Jun 26 17:36:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06A7715CE034; Wed, 26 Jun 2019 17:36:39 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B94802B0; Wed, 26 Jun 2019 17:36:38 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lj1-f173.google.com with SMTP id p17so3093965ljg.1; Wed, 26 Jun 2019 10:36:38 -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:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=fDbyjenVSIolg/Tf6dkl7wW5UsJCphOegPVc99WOqaU=; b=ev9LgjCxlZ1MGu3sHpCqqXDvG1TKrSi50nlGEhv4Zja95WB8iRmw7NkMgbABYn7zEM NaWXEy3rw+9QZvgeFTe5aUseEvnRXZSx5dkA9VPWZOUIvMP+jIT1K+gpGQl6q5oLWRJz kaDGSyah3h4kh3ka6VKlYNxKYh/sK1JDJNn7lv1cRdnfb7PIRLqI7Z3RuJuhcdJZosp2 3Ne8sseOsPfcxlKWhJmKQEeKSCMztbL5qo5jU5qt8yi5mlFs0vjxJU1EtzFXqXWHMZa0 64A2Mefr0Z1/pGJeauh6DEFk3Ec5pkuo+VoNER/rqAbJTdrxXZUH5vYFTDwD6Cm/aYaF D9rQ== X-Gm-Message-State: APjAAAWKMI2e3oH0OR0/R9ybq12LLHIJNj7fx4KtlkAtc27KKfALl4Tq iPUelILKWWtA+nQHBWNSiOEDyiXHEAQ= X-Google-Smtp-Source: APXvYqxmnbY1uz0fF+OgZtbeb6JGxALXLR+xUqyCYRHY+6wnkm6SAk5IVT0/NCT6ayirXSYzDQ5Law== X-Received: by 2002:a2e:81c4:: with SMTP id s4mr3634330ljg.182.1561570591117; Wed, 26 Jun 2019 10:36:31 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id 20sm2900279ljf.21.2019.06.26.10.36.29 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jun 2019 10:36:30 -0700 (PDT) Subject: Re: svn commit: r349428 - head/sys/dev/ow To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201906261717.x5QHHX3M071926@repo.freebsd.org> <5b434ce0f1123b3a569c486c4365a8481cb16ccc.camel@freebsd.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: <37f2825a-5754-2f30-89a8-2e8d6d8d6866@FreeBSD.org> Date: Wed, 26 Jun 2019 20:36:29 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <5b434ce0f1123b3a569c486c4365a8481cb16ccc.camel@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49B94802B0 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.97)[-0.972,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 17:36:39 -0000 On 26/06/2019 20:31, Ian Lepore wrote: > On Wed, 2019-06-26 at 17:17 +0000, Andriy Gapon wrote: >> +MODULE_DEPEND(owc_gpiobust, ow, 1, 1, 1); > > Looks like a typo there. Busted! Thank you! -- Andriy Gapon From owner-svn-src-head@freebsd.org Wed Jun 26 17:37:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FE2F15CE0CF; Wed, 26 Jun 2019 17:37:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED7CA80442; Wed, 26 Jun 2019 17:37:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD4832EB4; Wed, 26 Jun 2019 17:37:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5QHbqVo084430; Wed, 26 Jun 2019 17:37:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QHbp8J084423; Wed, 26 Jun 2019 17:37:51 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201906261737.x5QHbp8J084423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 26 Jun 2019 17:37:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349432 - in head/sys: amd64/sgx dev/drm2/ttm vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: amd64/sgx dev/drm2/ttm vm X-SVN-Commit-Revision: 349432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ED7CA80442 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 17:37:53 -0000 Author: markj Date: Wed Jun 26 17:37:51 2019 New Revision: 349432 URL: https://svnweb.freebsd.org/changeset/base/349432 Log: Add a return value to vm_page_remove(). Use it to indicate whether the page may be safely freed following its removal from the object. Also change vm_page_remove() to assume that the page's object pointer is non-NULL, and have callers perform this check instead. This is a step towards an implementation of an atomic reference counter for each physical page structure. Reviewed by: alc, dougm, kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20758 Modified: head/sys/amd64/sgx/sgx.c head/sys/dev/drm2/ttm/ttm_bo_vm.c head/sys/vm/device_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/amd64/sgx/sgx.c ============================================================================== --- head/sys/amd64/sgx/sgx.c Wed Jun 26 17:32:31 2019 (r349431) +++ head/sys/amd64/sgx/sgx.c Wed Jun 26 17:37:51 2019 (r349432) @@ -358,7 +358,7 @@ sgx_page_remove(struct sgx_softc *sc, vm_page_t p) uint64_t offs; vm_page_lock(p); - vm_page_remove(p); + (void)vm_page_remove(p); vm_page_unlock(p); dprintf("%s: p->pidx %ld\n", __func__, p->pindex); Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_bo_vm.c Wed Jun 26 17:32:31 2019 (r349431) +++ head/sys/dev/drm2/ttm/ttm_bo_vm.c Wed Jun 26 17:37:51 2019 (r349432) @@ -115,7 +115,7 @@ ttm_bo_vm_fault(vm_object_t vm_obj, vm_ooffset_t offse vm_object_pip_add(vm_obj, 1); if (*mres != NULL) { vm_page_lock(*mres); - vm_page_remove(*mres); + (void)vm_page_remove(*mres); vm_page_unlock(*mres); } retry: Modified: head/sys/vm/device_pager.c ============================================================================== --- head/sys/vm/device_pager.c Wed Jun 26 17:32:31 2019 (r349431) +++ head/sys/vm/device_pager.c Wed Jun 26 17:37:51 2019 (r349432) @@ -236,7 +236,7 @@ cdev_pager_free_page(vm_object_t object, vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("unmanaged %p", m)); pmap_remove_all(m); vm_page_lock(m); - vm_page_remove(m); + (void)vm_page_remove(m); vm_page_unlock(m); } else if (object->type == OBJT_DEVICE) dev_pager_free_page(object, m); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Wed Jun 26 17:32:31 2019 (r349431) +++ head/sys/vm/vm_fault.c Wed Jun 26 17:37:51 2019 (r349432) @@ -1144,7 +1144,7 @@ readrest: fs.object == fs.first_object->backing_object) { vm_page_lock(fs.m); vm_page_dequeue(fs.m); - vm_page_remove(fs.m); + (void)vm_page_remove(fs.m); vm_page_unlock(fs.m); vm_page_lock(fs.first_m); vm_page_replace_checked(fs.m, fs.first_object, Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed Jun 26 17:32:31 2019 (r349431) +++ head/sys/vm/vm_object.c Wed Jun 26 17:37:51 2019 (r349432) @@ -1595,10 +1595,8 @@ vm_object_collapse_scan(vm_object_t object, int op) vm_page_lock(p); KASSERT(!pmap_page_is_mapped(p), ("freeing mapped page %p", p)); - if (!vm_page_wired(p)) + if (vm_page_remove(p)) vm_page_free(p); - else - vm_page_remove(p); vm_page_unlock(p); continue; } @@ -1639,10 +1637,8 @@ vm_object_collapse_scan(vm_object_t object, int op) vm_page_lock(p); KASSERT(!pmap_page_is_mapped(p), ("freeing mapped page %p", p)); - if (!vm_page_wired(p)) + if (vm_page_remove(p)) vm_page_free(p); - else - vm_page_remove(p); vm_page_unlock(p); continue; } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Jun 26 17:32:31 2019 (r349431) +++ head/sys/vm/vm_page.c Wed Jun 26 17:37:51 2019 (r349432) @@ -1458,20 +1458,21 @@ vm_page_insert_radixdone(vm_page_t m, vm_object_t obje * vm_page_remove: * * Removes the specified page from its containing object, but does not - * invalidate any backing storage. + * invalidate any backing storage. Return true if the page may be safely + * freed and false otherwise. * * The object must be locked. The page must be locked if it is managed. */ -void +bool vm_page_remove(vm_page_t m) { vm_object_t object; vm_page_t mrem; + object = m->object; + if ((m->oflags & VPO_UNMANAGED) == 0) vm_page_assert_locked(m); - if ((object = m->object) == NULL) - return; VM_OBJECT_ASSERT_WLOCKED(object); if (vm_page_xbusied(m)) vm_page_xunbusy_maybelocked(m); @@ -1495,6 +1496,7 @@ vm_page_remove(vm_page_t m) vdrop(object->handle); m->object = NULL; + return (!vm_page_wired(m)); } /* @@ -1665,7 +1667,7 @@ vm_page_rename(vm_page_t m, vm_object_t new_object, vm */ m->pindex = opidx; vm_page_lock(m); - vm_page_remove(m); + (void)vm_page_remove(m); /* Return back to the new pindex to complete vm_page_insert(). */ m->pindex = new_pindex; @@ -3436,7 +3438,8 @@ vm_page_free_prep(vm_page_t m) if (vm_page_sbusied(m)) panic("vm_page_free_prep: freeing busy page %p", m); - vm_page_remove(m); + if (m->object != NULL) + (void)vm_page_remove(m); /* * If fictitious remove object association and Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Wed Jun 26 17:32:31 2019 (r349431) +++ head/sys/vm/vm_page.h Wed Jun 26 17:37:51 2019 (r349432) @@ -561,7 +561,7 @@ bool vm_page_reclaim_contig(int req, u_long npages, vm bool vm_page_reclaim_contig_domain(int domain, int req, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary); void vm_page_reference(vm_page_t m); -void vm_page_remove (vm_page_t); +bool vm_page_remove(vm_page_t); int vm_page_rename (vm_page_t, vm_object_t, vm_pindex_t); vm_page_t vm_page_replace(vm_page_t mnew, vm_object_t object, vm_pindex_t pindex); From owner-svn-src-head@freebsd.org Wed Jun 26 17:38:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A057D15CE13A; Wed, 26 Jun 2019 17:38:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 141E480595; Wed, 26 Jun 2019 17:38:39 +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 E42A42EB9; Wed, 26 Jun 2019 17:38:38 +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 x5QHcc8o084505; Wed, 26 Jun 2019 17:38:38 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QHccwg084504; Wed, 26 Jun 2019 17:38:38 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201906261738.x5QHccwg084504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 26 Jun 2019 17:38:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349433 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 349433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 141E480595 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 17:38:39 -0000 Author: avg Date: Wed Jun 26 17:38:38 2019 New Revision: 349433 URL: https://svnweb.freebsd.org/changeset/base/349433 Log: fix up r349428, fix a typo made during "fdt" removal Reported by: ian MFC after: 11 days Modified: head/sys/dev/ow/owc_gpiobus.c Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Wed Jun 26 17:37:51 2019 (r349432) +++ head/sys/dev/ow/owc_gpiobus.c Wed Jun 26 17:38:38 2019 (r349433) @@ -417,6 +417,6 @@ static driver_t owc_gpiobus_driver = { }; DRIVER_MODULE(owc_gpiobus, gpiobus, owc_gpiobus_driver, owc_gpiobus_devclass, 0, 0); -MODULE_DEPEND(owc_gpiobust, ow, 1, 1, 1); +MODULE_DEPEND(owc_gpiobus, ow, 1, 1, 1); MODULE_DEPEND(owc_gpiobus, gpiobus, 1, 1, 1); MODULE_VERSION(owc_gpiobus, 1); From owner-svn-src-head@freebsd.org Wed Jun 26 20:11:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FFC815D0FC6; Wed, 26 Jun 2019 20:11:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E73C085F95; Wed, 26 Jun 2019 20:11:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C497C4DB3; Wed, 26 Jun 2019 20:11:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5QKBqlC065477; Wed, 26 Jun 2019 20:11:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QKBq5e065476; Wed, 26 Jun 2019 20:11:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201906262011.x5QKBq5e065476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 26 Jun 2019 20:11:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349438 - head/sbin/dhclient X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sbin/dhclient X-SVN-Commit-Revision: 349438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E73C085F95 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 20:11:53 -0000 Author: markj Date: Wed Jun 26 20:11:52 2019 New Revision: 349438 URL: https://svnweb.freebsd.org/changeset/base/349438 Log: Avoid a divide-by-zero when bad checksum counters overflow. A mixture of IP or UDP packets with valid and invalid checksum could cause {ip,udp}_packets_bad_checksum to wrap around to 0, resulting in a division by zero. This is packet.c rev. 1.27 from OpenBSD. admbugs: 552 Obtained from: OpenBSD MFC after: 3 days Modified: head/sbin/dhclient/packet.c Modified: head/sbin/dhclient/packet.c ============================================================================== --- head/sbin/dhclient/packet.c Wed Jun 26 20:07:16 2019 (r349437) +++ head/sbin/dhclient/packet.c Wed Jun 26 20:11:52 2019 (r349438) @@ -183,7 +183,7 @@ decode_udp_ip_header(unsigned char *buf, int bufix, st ip_packets_seen++; if (wrapsum(checksum(buf + bufix, ip_len, 0)) != 0) { ip_packets_bad_checksum++; - if (ip_packets_seen > 4 && + if (ip_packets_seen > 4 && ip_packets_bad_checksum != 0 && (ip_packets_seen / ip_packets_bad_checksum) < 2) { note("%d bad IP checksums seen in %d packets", ip_packets_bad_checksum, ip_packets_seen); @@ -235,7 +235,7 @@ decode_udp_ip_header(unsigned char *buf, int bufix, st udp_packets_seen++; if (usum && usum != sum) { udp_packets_bad_checksum++; - if (udp_packets_seen > 4 && + if (udp_packets_seen > 4 && udp_packets_bad_checksum != 0 && (udp_packets_seen / udp_packets_bad_checksum) < 2) { note("%d bad udp checksums in %d packets", udp_packets_bad_checksum, udp_packets_seen); From owner-svn-src-head@freebsd.org Wed Jun 26 20:19:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44F1915D120F; Wed, 26 Jun 2019 20:19:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D99D18657D; Wed, 26 Jun 2019 20:19: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 B112F4EF9; Wed, 26 Jun 2019 20:19: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 x5QKJmAI068405; Wed, 26 Jun 2019 20:19:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QKJmfJ068404; Wed, 26 Jun 2019 20:19:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201906262019.x5QKJmfJ068404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 26 Jun 2019 20:19:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349439 - head/sbin/dhclient X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sbin/dhclient X-SVN-Commit-Revision: 349439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D99D18657D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 20:19:49 -0000 Author: markj Date: Wed Jun 26 20:19:48 2019 New Revision: 349439 URL: https://svnweb.freebsd.org/changeset/base/349439 Log: Free DHCP options with length zero. Otherwise they are leaked, allowing an attacker to trigger memory exhaustion. This is options.c rev. 1.70 from OpenBSD. admbugs: 552 Obtained from: OpenBSD MFC after: 3 days Modified: head/sbin/dhclient/options.c Modified: head/sbin/dhclient/options.c ============================================================================== --- head/sbin/dhclient/options.c Wed Jun 26 20:11:52 2019 (r349438) +++ head/sbin/dhclient/options.c Wed Jun 26 20:19:48 2019 (r349439) @@ -896,6 +896,5 @@ do_packet(struct interface_info *interface, struct dhc /* Free the data associated with the options. */ for (i = 0; i < 256; i++) - if (tp.options[i].len && tp.options[i].data) - free(tp.options[i].data); + free(tp.options[i].data); } From owner-svn-src-head@freebsd.org Wed Jun 26 21:19:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 901F315D258C; Wed, 26 Jun 2019 21:19:44 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 31E5F884F0; Wed, 26 Jun 2019 21:19:44 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 004E259F1; Wed, 26 Jun 2019 21:19:44 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5QLJhkb099461; Wed, 26 Jun 2019 21:19:43 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QLJhkq099460; Wed, 26 Jun 2019 21:19:43 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201906262119.x5QLJhkq099460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Wed, 26 Jun 2019 21:19:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349441 - head/sys/amd64/vmm X-SVN-Group: head X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: head/sys/amd64/vmm X-SVN-Commit-Revision: 349441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 31E5F884F0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 21:19:44 -0000 Author: rgrimes Date: Wed Jun 26 21:19:43 2019 New Revision: 349441 URL: https://svnweb.freebsd.org/changeset/base/349441 Log: Emulate the "TEST r/m{16,32,64}, imm{16,32,32}" instructions (opcode F7H). This adds emulation for: test r/m16, imm16 test r/m32, imm32 test r/m64, imm32 sign-extended to 64 OpenBSD guests compiled with clang 8.0.0 use TEST directly against a Local APIC register instead of separate read via MOV followed by a TEST against the register. PR: 238794 Submitted by: jhb Reported by: Jason Tubnor jason@tubnor.net Tested by: Jason Tubnor jason@tubnor.net Reviewed by: markj, Patrick Mooney patrick.mooney@joyent.com MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D20755 Modified: head/sys/amd64/vmm/vmm_instruction_emul.c Modified: head/sys/amd64/vmm/vmm_instruction_emul.c ============================================================================== --- head/sys/amd64/vmm/vmm_instruction_emul.c Wed Jun 26 20:25:57 2019 (r349440) +++ head/sys/amd64/vmm/vmm_instruction_emul.c Wed Jun 26 21:19:43 2019 (r349441) @@ -78,6 +78,7 @@ enum { VIE_OP_TYPE_BITTEST, VIE_OP_TYPE_TWOB_GRP15, VIE_OP_TYPE_ADD, + VIE_OP_TYPE_TEST, VIE_OP_TYPE_LAST }; @@ -221,6 +222,12 @@ static const struct vie_op one_byte_opcodes[256] = { .op_byte = 0x8F, .op_type = VIE_OP_TYPE_POP, }, + [0xF7] = { + /* XXX Group 3 extended opcode - not just TEST */ + .op_byte = 0xF7, + .op_type = VIE_OP_TYPE_TEST, + .op_flags = VIE_OP_F_IMM, + }, [0xFF] = { /* XXX Group 5 extended opcode - not just PUSH */ .op_byte = 0xFF, @@ -450,6 +457,41 @@ getaddflags(int opsize, uint64_t x, uint64_t y) return (getaddflags64(x, y)); } +/* + * Return the status flags that would result from doing (x & y). + */ +#define GETANDFLAGS(sz) \ +static u_long \ +getandflags##sz(uint##sz##_t x, uint##sz##_t y) \ +{ \ + u_long rflags; \ + \ + __asm __volatile("and %2,%1; pushfq; popq %0" : \ + "=r" (rflags), "+r" (x) : "m" (y)); \ + return (rflags); \ +} struct __hack + +GETANDFLAGS(8); +GETANDFLAGS(16); +GETANDFLAGS(32); +GETANDFLAGS(64); + +static u_long +getandflags(int opsize, uint64_t x, uint64_t y) +{ + KASSERT(opsize == 1 || opsize == 2 || opsize == 4 || opsize == 8, + ("getandflags: invalid operand size %d", opsize)); + + if (opsize == 1) + return (getandflags8(x, y)); + else if (opsize == 2) + return (getandflags16(x, y)); + else if (opsize == 4) + return (getandflags32(x, y)); + else + return (getandflags64(x, y)); +} + static int emulate_mov(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, mem_region_read_t memread, mem_region_write_t memwrite, void *arg) @@ -1219,6 +1261,55 @@ emulate_cmp(void *vm, int vcpuid, uint64_t gpa, struct } static int +emulate_test(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, + mem_region_read_t memread, mem_region_write_t memwrite, void *arg) +{ + int error, size; + uint64_t op1, rflags, rflags2; + + size = vie->opsize; + error = EINVAL; + + switch (vie->op.op_byte) { + case 0xF7: + /* + * F7 /0 test r/m16, imm16 + * F7 /0 test r/m32, imm32 + * REX.W + F7 /0 test r/m64, imm32 sign-extended to 64 + * + * Test mem (ModRM:r/m) with immediate and set status + * flags according to the results. The comparison is + * performed by anding the immediate from the first + * operand and then setting the status flags. + */ + if ((vie->reg & 7) != 0) + return (EINVAL); + + error = memread(vm, vcpuid, gpa, &op1, size, arg); + if (error) + return (error); + + rflags2 = getandflags(size, op1, vie->immediate); + break; + default: + return (EINVAL); + } + error = vie_read_register(vm, vcpuid, VM_REG_GUEST_RFLAGS, &rflags); + if (error) + return (error); + + /* + * OF and CF are cleared; the SF, ZF and PF flags are set according + * to the result; AF is undefined. + */ + rflags &= ~RFLAGS_STATUS_BITS; + rflags |= rflags2 & (PSL_PF | PSL_Z | PSL_N); + + error = vie_update_register(vm, vcpuid, VM_REG_GUEST_RFLAGS, rflags, 8); + return (error); +} + +static int emulate_add(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, mem_region_read_t memread, mem_region_write_t memwrite, void *arg) { @@ -1642,6 +1733,10 @@ vmm_emulate_instruction(void *vm, int vcpuid, uint64_t case VIE_OP_TYPE_ADD: error = emulate_add(vm, vcpuid, gpa, vie, memread, memwrite, memarg); + break; + case VIE_OP_TYPE_TEST: + error = emulate_test(vm, vcpuid, gpa, vie, + memread, memwrite, memarg); break; default: error = EINVAL; From owner-svn-src-head@freebsd.org Wed Jun 26 21:43:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 637C715D2F6B; Wed, 26 Jun 2019 21:43:42 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 06CF489354; Wed, 26 Jun 2019 21:43:42 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D67115EFF; Wed, 26 Jun 2019 21:43:41 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5QLhfjR015005; Wed, 26 Jun 2019 21:43:41 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QLhf6u015004; Wed, 26 Jun 2019 21:43:41 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201906262143.x5QLhf6u015004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Wed, 26 Jun 2019 21:43:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349442 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 06CF489354 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.965,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 21:43:42 -0000 Author: alc Date: Wed Jun 26 21:43:41 2019 New Revision: 349442 URL: https://svnweb.freebsd.org/changeset/base/349442 Log: Revert one of the changes from r349323. Specifically, undo the change that replaced a pmap_invalidate_page() with a dsb(ishst) in pmap_enter_quick_locked(). Even though this change is in principle correct, I am seeing occasional, spurious bus errors that are only reproducible without this pmap_invalidate_page(). (None of adding an isb, "upgrading" the dsb to wait on loads as well as stores, or disabling superpage mappings eliminates the bus errors.) Add an XXX comment explaining why the pmap_invalidate_page() is being performed. Discussed with: andrew, markj Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Wed Jun 26 21:19:43 2019 (r349441) +++ head/sys/arm64/arm64/pmap.c Wed Jun 26 21:43:41 2019 (r349442) @@ -3758,7 +3758,15 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v cpu_icache_sync_range(PHYS_TO_DMAP(pa), PAGE_SIZE); pmap_load_store(l3, l3_val); - dsb(ishst); + + /* + * XXX In principle, because this L3 entry was invalid, we should not + * need to perform a TLB invalidation here. However, in practice, + * when simply performing a "dsb ishst" here, processes are being + * terminated due to bus errors and segmentation violations. + */ + pmap_invalidate_page(pmap, va); + return (mpte); } From owner-svn-src-head@freebsd.org Wed Jun 26 22:06:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 198BA15D3588; Wed, 26 Jun 2019 22:06:41 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A0C3889EF9; Wed, 26 Jun 2019 22:06:40 +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 87FD7626C; Wed, 26 Jun 2019 22:06:40 +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 x5QM6e1S025574; Wed, 26 Jun 2019 22:06:40 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QM6eYw025573; Wed, 26 Jun 2019 22:06:40 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201906262206.x5QM6eYw025573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Wed, 26 Jun 2019 22:06:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349444 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: cognet X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349444 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A0C3889EF9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 22:06:41 -0000 Author: cognet Date: Wed Jun 26 22:06:40 2019 New Revision: 349444 URL: https://svnweb.freebsd.org/changeset/base/349444 Log: In get_fpcontext32() and set_fpcontext32(), we can't just use memcpy() to copy the VFP registers. arvm7 VFP uses 32 64bits fp registers (but those could be used in pairs to make 16 128bits registers), while aarch64 uses 32 128bits fp registers, so we have to copy the value of each register. Modified: head/sys/arm64/arm64/freebsd32_machdep.c Modified: head/sys/arm64/arm64/freebsd32_machdep.c ============================================================================== --- head/sys/arm64/arm64/freebsd32_machdep.c Wed Jun 26 21:59:43 2019 (r349443) +++ head/sys/arm64/arm64/freebsd32_machdep.c Wed Jun 26 22:06:40 2019 (r349444) @@ -122,6 +122,7 @@ static void get_fpcontext32(struct thread *td, mcontext32_vfp_t *mcp) { struct pcb *curpcb; + int i; critical_enter(); curpcb = curthread->td_pcb; @@ -137,8 +138,8 @@ get_fpcontext32(struct thread *td, mcontext32_vfp_t *m ("Called get_fpcontext while the kernel is using the VFP")); KASSERT((curpcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0, ("Non-userspace FPU flags set in get_fpcontext")); - memcpy(mcp->mcv_reg, curpcb->pcb_fpustate.vfp_regs, - sizeof(mcp->mcv_reg)); + for (i = 0; i < 32; i++) + mcp->mcv_reg[i] = (uint64_t)curpcb->pcb_fpustate.vfp_regs[i]; mcp->mcv_fpscr = VFP_FPSCR_FROM_SRCR(curpcb->pcb_fpustate.vfp_fpcr, curpcb->pcb_fpustate.vfp_fpsr); } @@ -149,13 +150,14 @@ static void set_fpcontext32(struct thread *td, mcontext32_vfp_t *mcp) { struct pcb *pcb; + int i; critical_enter(); pcb = td->td_pcb; if (td == curthread) vfp_discard(td); - memcpy(pcb->pcb_fpustate.vfp_regs, mcp->mcv_reg, - sizeof(pcb->pcb_fpustate.vfp_regs)); + for (i = 0; i < 32; i++) + pcb->pcb_fpustate.vfp_regs[i] = mcp->mcv_reg[i]; pcb->pcb_fpustate.vfp_fpsr = VFP_FPSR_FROM_FPSCR(mcp->mcv_fpscr); pcb->pcb_fpustate.vfp_fpcr = VFP_FPSR_FROM_FPSCR(mcp->mcv_fpscr); critical_exit(); From owner-svn-src-head@freebsd.org Wed Jun 26 23:33:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C519E15D4C80; Wed, 26 Jun 2019 23:33:34 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 69F5D8C363; Wed, 26 Jun 2019 23:33:34 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 435777147; Wed, 26 Jun 2019 23:33:34 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5QNXYJa071714; Wed, 26 Jun 2019 23:33:34 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5QNXWqq071707; Wed, 26 Jun 2019 23:33:32 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201906262333.x5QNXWqq071707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Wed, 26 Jun 2019 23:33:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349446 - in head/lib/libsecureboot: . h openpgp X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in head/lib/libsecureboot: . h openpgp X-SVN-Commit-Revision: 349446 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 69F5D8C363 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2019 23:33:35 -0000 Author: sjg Date: Wed Jun 26 23:33:32 2019 New Revision: 349446 URL: https://svnweb.freebsd.org/changeset/base/349446 Log: libsecureboot: allow OpenPGP support to be dormant Since we can now add OpenPGP trust anchors at runtime, ensure the latent support is available. Ensure we do not add duplicate keys to trust store. Also allow reporting names of trust anchors added/revoked We only do this for loader and only after initializing trust store. Thus only changes to initial trust store will be logged. Reviewed by: stevek MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D20700 Modified: head/lib/libsecureboot/h/libsecureboot.h head/lib/libsecureboot/libsecureboot-priv.h head/lib/libsecureboot/local.trust.mk head/lib/libsecureboot/openpgp/opgp_key.c head/lib/libsecureboot/readfile.c head/lib/libsecureboot/verify_file.c head/lib/libsecureboot/vets.c Modified: head/lib/libsecureboot/h/libsecureboot.h ============================================================================== --- head/lib/libsecureboot/h/libsecureboot.h Wed Jun 26 23:10:20 2019 (r349445) +++ head/lib/libsecureboot/h/libsecureboot.h Wed Jun 26 23:33:32 2019 (r349446) @@ -42,6 +42,7 @@ #include +unsigned char * read_fd(int, size_t); #ifndef NEED_BRSSL_H unsigned char * read_file(const char *, size_t *); #endif @@ -51,8 +52,12 @@ extern int DebugVe; #define DEBUG_PRINTF(n, x) if (DebugVe >= n) printf x int ve_trust_init(void); +size_t ve_trust_anchors_add_buf(unsigned char *, size_t); +size_t ve_trust_anchors_revoke(unsigned char *, size_t); int ve_trust_add(const char *); void ve_debug_set(int); +void ve_anchor_verbose_set(int); +int ve_anchor_verbose_get(void); void ve_utc_set(time_t utc); char *ve_error_get(void); int ve_error_set(const char *, ...) __printflike(1,2); Modified: head/lib/libsecureboot/libsecureboot-priv.h ============================================================================== --- head/lib/libsecureboot/libsecureboot-priv.h Wed Jun 26 23:10:20 2019 (r349445) +++ head/lib/libsecureboot/libsecureboot-priv.h Wed Jun 26 23:33:32 2019 (r349446) @@ -56,6 +56,8 @@ int is_verified(struct stat *stp); void add_verify_status(struct stat *stp, int status); int openpgp_trust_init(void); +int openpgp_trust_add_buf(unsigned char *, size_t); +int openpgp_trust_revoke(const char *); int openpgp_self_tests(void); int efi_secure_boot_enabled(void); Modified: head/lib/libsecureboot/local.trust.mk ============================================================================== --- head/lib/libsecureboot/local.trust.mk Wed Jun 26 23:10:20 2019 (r349445) +++ head/lib/libsecureboot/local.trust.mk Wed Jun 26 23:33:32 2019 (r349446) @@ -33,6 +33,10 @@ VE_SIGNATURE_EXT_LIST+= \ sig .endif +# add OpenPGP support - possibly dormant +VE_SIGNATURE_LIST+= OPENPGP +VE_SIGNATURE_EXT_LIST+= asc + SIGNER ?= ${SB_TOOLS_PATH:U/volume/buildtools/bin}/sign.py .if exists(${SIGNER}) @@ -42,7 +46,12 @@ SIGN_ECDSA= ${PYTHON} ${SIGNER} -u ${SIGN_HOST}:${ECDS RSA2_PORT:= ${163%y:L:gmtime} SIGN_RSA2= ${PYTHON} ${SIGNER} -u ${SIGN_HOST}:${RSA2_PORT} -h sha256 +# deal with quirk of our .esig format +XCFLAGS.vets+= -DVE_ECDSA_HASH_AGAIN + .if !empty(OPENPGP_SIGN_URL) +XCFLAGS.opgp_key+= -DHAVE_TA_ASC_H + VE_SIGNATURE_LIST+= OPENPGP VE_SIGNATURE_EXT_LIST+= asc Modified: head/lib/libsecureboot/openpgp/opgp_key.c ============================================================================== --- head/lib/libsecureboot/openpgp/opgp_key.c Wed Jun 26 23:10:20 2019 (r349445) +++ head/lib/libsecureboot/openpgp/opgp_key.c Wed Jun 26 23:33:32 2019 (r349446) @@ -209,13 +209,54 @@ openpgp_trust_add(OpenPGP_key *key) LIST_INIT(&trust_list); } - if (key) { - DEBUG_PRINTF(2, ("openpgp_trust_add(%s)\n", key->id)); + if (key && openpgp_trust_get(key->id) == NULL) { + if (ve_anchor_verbose_get()) + printf("openpgp_trust_add(%s)\n", key->id); LIST_INSERT_HEAD(&trust_list, key, entries); } } /** + * @brief add trust anchor from buf + */ +int +openpgp_trust_add_buf(unsigned char *buf, size_t nbytes) +{ + OpenPGP_key *key; + + if ((key = load_key_buf(buf, nbytes))) { + openpgp_trust_add(key); + } + return (key != NULL); +} + + +/** + * @brief if keyID is in our list clobber it + * + * @return true if keyID removed + */ +int +openpgp_trust_revoke(const char *keyID) +{ + OpenPGP_key *key, *tkey; + + openpgp_trust_add(NULL); /* initialize if needed */ + + LIST_FOREACH(key, &trust_list, entries) { + if (strcmp(key->id, keyID) == 0) { + tkey = key; + LIST_REMOVE(tkey, entries); + printf("openpgp_trust_revoke(%s)\n", key->id); + memset(key, 0, sizeof(OpenPGP_key)); + free(key); + return (1); + } + } + return (0); +} + +/** * @brief if keyID is in our list return the key * * @return key or NULL @@ -251,7 +292,9 @@ load_key_file(const char *kfile) return (key); } +#ifdef HAVE_TA_ASC_H #include +#endif #ifndef _STANDALONE /* we can lookup keyID in filesystem */ @@ -330,8 +373,8 @@ openpgp_trust_init(void) } } } - } #endif + } return (once); } Modified: head/lib/libsecureboot/readfile.c ============================================================================== --- head/lib/libsecureboot/readfile.c Wed Jun 26 23:10:20 2019 (r349445) +++ head/lib/libsecureboot/readfile.c Wed Jun 26 23:33:32 2019 (r349446) @@ -28,21 +28,13 @@ __FBSDID("$FreeBSD$"); #include unsigned char * -read_file(const char *path, size_t *len) +read_fd(int fd, size_t len) { - int fd, m, n, x; - struct stat st; + int m, n, x; unsigned char *buf; - if (len) - *len = 0; - if ((fd = open(path, O_RDONLY)) < 0) - return (NULL); - fstat(fd, &st); - if (len) - *len = st.st_size; - buf = malloc(st.st_size + 1); - for (x = 0, m = st.st_size; m > 0; ) { + buf = malloc(len + 1); + for (x = 0, m = len; m > 0; ) { n = read(fd, &buf[x], m); if (n < 0) break; @@ -51,11 +43,30 @@ read_file(const char *path, size_t *len) x += n; } } - close(fd); if (m == 0) { - buf[st.st_size] = '\0'; + buf[len] = '\0'; return (buf); } free(buf); return (NULL); } + +unsigned char * +read_file(const char *path, size_t *len) +{ + struct stat st; + unsigned char *ucp; + int fd; + + if (len) + *len = 0; + if ((fd = open(path, O_RDONLY)) < 0) + return (NULL); + fstat(fd, &st); + ucp = read_fd(fd, st.st_size); + close(fd); + if (len != NULL && ucp != NULL) + *len = st.st_size; + return (ucp); +} + Modified: head/lib/libsecureboot/verify_file.c ============================================================================== --- head/lib/libsecureboot/verify_file.c Wed Jun 26 23:10:20 2019 (r349445) +++ head/lib/libsecureboot/verify_file.c Wed Jun 26 23:33:32 2019 (r349446) @@ -246,7 +246,9 @@ severity_guess(const char *filename) } static void -verify_tweak(char *tweak, int *accept_no_fp, int *verbose, int *verifying) +verify_tweak(int fd, off_t off, struct stat *stp, + char *tweak, int *accept_no_fp, + int *verbose, int *verifying) { if (strcmp(tweak, "off") == 0) { *verifying = 0; @@ -268,6 +270,25 @@ verify_tweak(char *tweak, int *accept_no_fp, int *verb *verbose = 1; } else if (strcmp(tweak, "quiet") == 0) { *verbose = 0; + } else if (strncmp(tweak, "trust", 5) == 0) { + /* content is trust anchor to add or revoke */ + unsigned char *ucp; + size_t num; + + if (off > 0) + lseek(fd, 0, SEEK_SET); + ucp = read_fd(fd, stp->st_size); + if (ucp == NULL) + return; + if (strstr(tweak, "revoke")) { + num = ve_trust_anchors_revoke(ucp, stp->st_size); + DEBUG_PRINTF(3, ("revoked %d trust anchors\n", + (int) num)); + } else { + num = ve_trust_anchors_add_buf(ucp, stp->st_size); + DEBUG_PRINTF(3, ("added %d trust anchors\n", + (int) num)); + } } } @@ -317,8 +338,10 @@ verify_file(int fd, const char *filename, off_t off, i rc = verifying ? VE_NOT_CHECKED : VE_NOT_VERIFYING; ve_status_set(0, rc); ve_status_state = VE_STATUS_NONE; - if (verifying) + if (verifying) { ve_self_tests(); + ve_anchor_verbose_set(1); + } } if (!verifying) return (0); @@ -367,7 +390,7 @@ verify_file(int fd, const char *filename, off_t off, i cp++; if (strncmp(cp, "loader.ve.", 10) == 0) { cp += 10; - verify_tweak(cp, + verify_tweak(fd, off, &st, cp, &accept_no_fp, &verbose, &verifying); } Modified: head/lib/libsecureboot/vets.c ============================================================================== --- head/lib/libsecureboot/vets.c Wed Jun 26 23:10:20 2019 (r349445) +++ head/lib/libsecureboot/vets.c Wed Jun 26 23:33:32 2019 (r349446) @@ -55,7 +55,21 @@ static anchor_list trust_anchors = VEC_INIT; static anchor_list forbidden_anchors = VEC_INIT; static digest_list forbidden_digests = VEC_INIT; +static int anchor_verbose = 0; + void +ve_anchor_verbose_set(int n) +{ + anchor_verbose = n; +} + +int +ve_anchor_verbose_get(void) +{ + return (anchor_verbose); +} + +void ve_debug_set(int n) { DebugVe = n; @@ -116,6 +130,47 @@ free_cert_contents(br_x509_certificate *xc) xfree(xc->data); } +/* + * a bit of a dance to get commonName from a certificate + */ +static char * +x509_cn_get(br_x509_certificate *xc, char *buf, size_t len) +{ + br_x509_minimal_context mc; + br_name_element cn; + unsigned char cn_oid[4]; + int err; + + if (buf == NULL) + return (buf); + /* + * We want the commonName field + * the OID we want is 2,5,4,3 - but DER encoded + */ + cn_oid[0] = 3; + cn_oid[1] = 0x55; + cn_oid[2] = 4; + cn_oid[3] = 3; + cn.oid = cn_oid; + cn.buf = buf; + cn.len = len; + cn.buf[0] = '\0'; + + br_x509_minimal_init(&mc, &br_sha256_vtable, NULL, 0); + br_x509_minimal_set_name_elements(&mc, &cn, 1); + /* the below actually does the work - updates cn.status */ + mc.vtable->start_chain(&mc.vtable, NULL); + mc.vtable->start_cert(&mc.vtable, xc->data_len); + mc.vtable->append(&mc.vtable, xc->data, xc->data_len); + mc.vtable->end_cert(&mc.vtable); + /* we don' actually care about cert status - just its name */ + err = mc.vtable->end_chain(&mc.vtable); + + if (!cn.status) + buf = NULL; + return (buf); +} + /* ASN parsing related defines */ #define ASN1_PRIMITIVE_TAG 0x1F #define ASN1_INF_LENGTH 0x80 @@ -184,7 +239,8 @@ ve_forbidden_digest_add(hash_data *digest, size_t num) } static size_t -ve_anchors_add(br_x509_certificate *xcs, size_t num, anchor_list *anchors) +ve_anchors_add(br_x509_certificate *xcs, size_t num, anchor_list *anchors, + char *anchors_name) { br_x509_trust_anchor ta; size_t u; @@ -194,6 +250,15 @@ ve_anchors_add(br_x509_certificate *xcs, size_t num, a break; } VEC_ADD(*anchors, ta); + if (anchor_verbose && anchors_name) { + char buf[64]; + char *cp; + + cp = x509_cn_get(&xcs[u], buf, sizeof(buf)); + if (cp) { + printf("x509_anchor(%s) %s\n", cp, anchors_name); + } + } } return (u); } @@ -205,27 +270,78 @@ ve_anchors_add(br_x509_certificate *xcs, size_t num, a size_t ve_trust_anchors_add(br_x509_certificate *xcs, size_t num) { - return (ve_anchors_add(xcs, num, &trust_anchors)); + return (ve_anchors_add(xcs, num, &trust_anchors, "trusted")); } size_t ve_forbidden_anchors_add(br_x509_certificate *xcs, size_t num) { - return (ve_anchors_add(xcs, num, &forbidden_anchors)); + return (ve_anchors_add(xcs, num, &forbidden_anchors, "forbidden")); } + /** + * @brief add trust anchors in buf + * + * Assume buf contains x509 certificates, but if not and + * we support OpenPGP try adding as that. + * + * @return number of anchors added + */ +size_t +ve_trust_anchors_add_buf(unsigned char *buf, size_t len) +{ + br_x509_certificate *xcs; + size_t num; + + num = 0; + xcs = parse_certificates(buf, len, &num); + if (xcs != NULL) { + num = ve_trust_anchors_add(xcs, num); +#ifdef VE_OPENPGP_SUPPORT + } else { + num = openpgp_trust_add_buf(buf, len); +#endif + } + return (num); +} + +/** + * @brief revoke trust anchors in buf + * + * Assume buf contains x509 certificates, but if not and + * we support OpenPGP try revoking keyId + * + * @return number of anchors revoked + */ +size_t +ve_trust_anchors_revoke(unsigned char *buf, size_t len) +{ + br_x509_certificate *xcs; + size_t num; + + num = 0; + xcs = parse_certificates(buf, len, &num); + if (xcs != NULL) { + num = ve_forbidden_anchors_add(xcs, num); +#ifdef VE_OPENPGP_SUPPORT + } else { + if (buf[len - 1] == '\n') + buf[len - 1] = '\0'; + num = openpgp_trust_revoke((char *)buf); +#endif + } + return (num); +} + +/** * @brief * initialize our trust_anchors from ta_PEM */ int ve_trust_init(void) { -#ifdef TRUST_ANCHOR_STR - br_x509_certificate *xcs; -#endif static int once = -1; - size_t num; if (once >= 0) return (once); @@ -240,10 +356,8 @@ ve_trust_init(void) #endif #ifdef TRUST_ANCHOR_STR - xcs = parse_certificates(__DECONST(unsigned char *, TRUST_ANCHOR_STR), - sizeof(TRUST_ANCHOR_STR), &num); - if (xcs != NULL) - num = ve_trust_anchors_add(xcs, num); + ve_trust_anchors_add_buf(__DECONST(unsigned char *, TRUST_ANCHOR_STR), + sizeof(TRUST_ANCHOR_STR)); #endif once = (int) VEC_LEN(trust_anchors); #ifdef VE_OPENPGP_SUPPORT @@ -552,6 +666,7 @@ verify_ec(br_x509_pkey *pk, const char *file, const ch br_sha256_init(&ctx); br_sha256_update(&ctx, fcp, flen); br_sha256_out(&ctx, rhbuf); +#ifdef VE_ECDSA_HASH_AGAIN hex = hexdigest(hexbuf, sizeof(hexbuf), rhbuf, br_sha256_SIZE); /* now hash that */ if (hex) { @@ -559,6 +674,7 @@ verify_ec(br_x509_pkey *pk, const char *file, const ch br_sha256_update(&ctx, hex, strlen(hex)); br_sha256_out(&ctx, rhbuf); } +#endif ec = br_ec_get_default(); vrfy = br_ecdsa_vrfy_asn1_get_default(); if (!vrfy(ec, rhbuf, br_sha256_SIZE, &pk->key.ec, po->data, From owner-svn-src-head@freebsd.org Thu Jun 27 02:42:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E279115D8682; Thu, 27 Jun 2019 02:42:57 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 837956A9E7; Thu, 27 Jun 2019 02:42:57 +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 5872E90F0; Thu, 27 Jun 2019 02:42:57 +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 x5R2gv9O070653; Thu, 27 Jun 2019 02:42:57 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5R2gvof070652; Thu, 27 Jun 2019 02:42:57 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201906270242.x5R2gvof070652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 27 Jun 2019 02:42:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349448 - head/contrib/ipfilter/man X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/contrib/ipfilter/man X-SVN-Commit-Revision: 349448 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 837956A9E7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 02:42:58 -0000 Author: cy Date: Thu Jun 27 02:42:56 2019 New Revision: 349448 URL: https://svnweb.freebsd.org/changeset/base/349448 Log: Fix a typo. PR/238816 initially addressed updates to usage() however it has now become a shopping list of fixes to ipmon man pages and usage(). PR: 238816 MFC after: 3 days Modified: head/contrib/ipfilter/man/ipmon.8 Modified: head/contrib/ipfilter/man/ipmon.8 ============================================================================== --- head/contrib/ipfilter/man/ipmon.8 Thu Jun 27 00:00:48 2019 (r349447) +++ head/contrib/ipfilter/man/ipmon.8 Thu Jun 27 02:42:56 2019 (r349448) @@ -27,7 +27,7 @@ ipmon \- monitors /dev/ipl for logged packets .LP \fBipmon\fP opens \fB/dev/ipl\fP for reading and awaits data to be saved from the packet filter. The binary data read from the device is reprinted in -human readable for, however, IP#'s are not mapped back to hostnames, nor are +human readable form, however, IP#'s are not mapped back to hostnames, nor are ports mapped back to service names. The output goes to standard output by default or a filename, if given on the command line. Should the \fB\-s\fP option be used, output is instead sent to \fBsyslogd(8)\fP. Messages sent From owner-svn-src-head@freebsd.org Thu Jun 27 02:43:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19DC115D86BC; Thu, 27 Jun 2019 02:43:28 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5F0B6AB3B; Thu, 27 Jun 2019 02:43:27 +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 9270B90F4; Thu, 27 Jun 2019 02:43:27 +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 x5R2hRG7070732; Thu, 27 Jun 2019 02:43:27 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5R2hRMA070730; Thu, 27 Jun 2019 02:43:27 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201906270243.x5R2hRMA070730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 27 Jun 2019 02:43:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349449 - in head: sbin/ipf/ipmon tools/build/mk X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in head: sbin/ipf/ipmon tools/build/mk X-SVN-Commit-Revision: 349449 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B5F0B6AB3B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 02:43:28 -0000 Author: cy Date: Thu Jun 27 02:43:26 2019 New Revision: 349449 URL: https://svnweb.freebsd.org/changeset/base/349449 Log: Add the ipmon.5 man page. PR/238816 initially addressed updates to usage() however the PR has morphed into a shopping list of updates to usage() and man pages. PR: 238816 (I added to the list during discussion) MFC after: 1 week Modified: head/sbin/ipf/ipmon/Makefile head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/sbin/ipf/ipmon/Makefile ============================================================================== --- head/sbin/ipf/ipmon/Makefile Thu Jun 27 02:42:56 2019 (r349448) +++ head/sbin/ipf/ipmon/Makefile Thu Jun 27 02:43:26 2019 (r349449) @@ -3,7 +3,7 @@ PACKAGE= ipf PROG= ipmon SRCS= ${GENHDRS} ipmon.c ipmon_y.c ipmon_l.c -MAN= ipmon.8 +MAN= ipmon.5 ipmon.8 CFLAGS+= -DLOGFAC=LOG_LOCAL0 -I. Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Thu Jun 27 02:42:56 2019 (r349448) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Thu Jun 27 02:43:26 2019 (r349449) @@ -3350,6 +3350,7 @@ OLD_FILES+=usr/share/man/man5/ipf.5.gz OLD_FILES+=usr/share/man/man5/ipf.conf.5.gz OLD_FILES+=usr/share/man/man5/ipf6.conf.5.gz OLD_FILES+=usr/share/man/man5/ipfilter.5.gz +OLD_FILES+=usr/share/man/man8/ipmon.5.gz OLD_FILES+=usr/share/man/man5/ipnat.5.gz OLD_FILES+=usr/share/man/man5/ipnat.conf.5.gz OLD_FILES+=usr/share/man/man5/ippool.5.gz From owner-svn-src-head@freebsd.org Thu Jun 27 02:43:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D17715D86E2; Thu, 27 Jun 2019 02:43:31 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D08ED6AB48; Thu, 27 Jun 2019 02:43: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 A93F390F6; Thu, 27 Jun 2019 02:43: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 x5R2hUU2070793; Thu, 27 Jun 2019 02:43:30 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5R2hUZx070792; Thu, 27 Jun 2019 02:43:30 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201906270243.x5R2hUZx070792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 27 Jun 2019 02:43:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349450 - head/contrib/ipfilter/tools X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/contrib/ipfilter/tools X-SVN-Commit-Revision: 349450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D08ED6AB48 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 02:43:31 -0000 Author: cy Date: Thu Jun 27 02:43:30 2019 New Revision: 349450 URL: https://svnweb.freebsd.org/changeset/base/349450 Log: Update usage() to refect the current state of ipmon. PR: 238816 MFC after: 1 week Modified: head/contrib/ipfilter/tools/ipmon.c Modified: head/contrib/ipfilter/tools/ipmon.c ============================================================================== --- head/contrib/ipfilter/tools/ipmon.c Thu Jun 27 02:43:26 2019 (r349449) +++ head/contrib/ipfilter/tools/ipmon.c Thu Jun 27 02:43:30 2019 (r349450) @@ -1438,8 +1438,11 @@ printipflog: static void usage(prog) char *prog; { - fprintf(stderr, "%s: [-NFhstvxX] [-f ]\n", prog); - exit(1); + fprintf(stderr, "Usage: %s [ -abDFhnpstvxX ] [ -B ] [ -C ]\n" + "\t[ -f ] [ -L ] [ -N ]\n" + "\t[ -o [NSI] ] [ -O [NSI] ] [ -P ] [ -S ]\n" + "\t[ ]\n", prog); + exit(-1); } From owner-svn-src-head@freebsd.org Thu Jun 27 03:01:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C785215D8DA4; Thu, 27 Jun 2019 03:01:59 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.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 35FBC6B57A; Thu, 27 Jun 2019 03:01:59 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x5R31srq057764; Wed, 26 Jun 2019 20:01:54 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x5R31sLH057763; Wed, 26 Jun 2019 20:01:54 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201906270301.x5R31sLH057763@gndrsh.dnsmgr.net> Subject: Re: svn commit: r349450 - head/contrib/ipfilter/tools In-Reply-To: <201906270243.x5R2hUZx070792@repo.freebsd.org> To: Cy Schubert Date: Wed, 26 Jun 2019 20:01:54 -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-Rspamd-Queue-Id: 35FBC6B57A X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 03:02:00 -0000 > Author: cy > Date: Thu Jun 27 02:43:30 2019 > New Revision: 349450 > URL: https://svnweb.freebsd.org/changeset/base/349450 > > Log: > Update usage() to refect the current state of ipmon. > > PR: 238816 > MFC after: 1 week > > Modified: > head/contrib/ipfilter/tools/ipmon.c > > Modified: head/contrib/ipfilter/tools/ipmon.c > ============================================================================== > --- head/contrib/ipfilter/tools/ipmon.c Thu Jun 27 02:43:26 2019 (r349449) > +++ head/contrib/ipfilter/tools/ipmon.c Thu Jun 27 02:43:30 2019 (r349450) > @@ -1438,8 +1438,11 @@ printipflog: > static void usage(prog) > char *prog; > { > - fprintf(stderr, "%s: [-NFhstvxX] [-f ]\n", prog); > - exit(1); expected > + fprintf(stderr, "Usage: %s [ -abDFhnpstvxX ] [ -B ] [ -C ]\n" > + "\t[ -f ] [ -L ] [ -N ]\n" > + "\t[ -o [NSI] ] [ -O [NSI] ] [ -P ] [ -S ]\n" > + "\t[ ]\n", prog); > + exit(-1); Was it intentional to flip the exit code to -1? Someones scripts might not be prepared for that. > } -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Thu Jun 27 03:43:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C65E15D9C10; Thu, 27 Jun 2019 03:43:22 +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 CE5226CC5D; Thu, 27 Jun 2019 03:43:20 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id gLJchgfslldkPgLJehoSbw; Wed, 26 Jun 2019 21:43:18 -0600 X-Authority-Analysis: v=2.3 cv=Ko4zJleN c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=dq6fvYVFJ5YA:10 a=iKhvJSA4AAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=Vaev78BLB3p2O4-yin8A:9 a=CjuIK1q_8ugA:10 a=odh9cflL3HIXMm4fY7Wr:22 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 1D5B298F; Wed, 26 Jun 2019 20:43:16 -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 x5R3hFhO058293; Wed, 26 Jun 2019 20:43:15 -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 x5R3hFfS058290; Wed, 26 Jun 2019 20:43:15 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201906270343.x5R3hFfS058290@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: rgrimes@freebsd.org cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349450 - head/contrib/ipfilter/tools In-Reply-To: Message from "Rodney W. Grimes" of "Wed, 26 Jun 2019 20:01:54 -0700." <201906270301.x5R31sLH057763@gndrsh.dnsmgr.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 26 Jun 2019 20:43:15 -0700 X-CMAE-Envelope: MS4wfIg/Zlq/oIv5wL4bbI4sF0JJn81o6PA0iEe35zxL2y8Z9KAjNCDC8wTFSLlMjl3Zt9XU+hPuamEvDNKyD70S2T5wnyNFvfAkudbYkgv24nOIyE77Q68r 3+KRWdkp9pP/r93HPsPfQRJ9FOE6i+KNZe/uvBWt1ZusJISR06+wUcwVVWTKGQO0JzgqQY5X2OHQMRHCQSWBnIlSqILRD6WUe1HlWnNVmNytZQmZTRhCZ9zW BndlidxL1OBEQtkIIafNdZ9Rhmtm9MyM2T3pSQBNcIgM86CciwGftAI7Uj6Vd6TlmM9yInQYddfMKP6dR2YODQ== X-Rspamd-Queue-Id: CE5226CC5D X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-4.99 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.zen.spamhaus.org : 127.0.0.11]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; IP_SCORE(-2.55)[ip: (-6.85), ipnet: 64.59.128.0/20(-3.27), asn: 6327(-2.54), country: CA(-0.09)]; MX_GOOD(-0.01)[cached: spqr.komquats.com]; NEURAL_HAM_SHORT(-0.73)[-0.729,0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[12.134.59.64.list.dnswl.org : 127.0.5.1] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 03:43:22 -0000 In message <201906270301.x5R31sLH057763@gndrsh.dnsmgr.net>, "Rodney W. Grimes" writes: > > Author: cy > > Date: Thu Jun 27 02:43:30 2019 > > New Revision: 349450 > > URL: https://svnweb.freebsd.org/changeset/base/349450 > > > > Log: > > Update usage() to refect the current state of ipmon. > > > > PR: 238816 > > MFC after: 1 week > > > > Modified: > > head/contrib/ipfilter/tools/ipmon.c > > > > Modified: head/contrib/ipfilter/tools/ipmon.c > > =========================================================================== > === > > --- head/contrib/ipfilter/tools/ipmon.c Thu Jun 27 02:43:26 2019 > (r349449) > > +++ head/contrib/ipfilter/tools/ipmon.c Thu Jun 27 02:43:30 2019 > (r349450) > > @@ -1438,8 +1438,11 @@ printipflog: > > static void usage(prog) > > char *prog; > > { > > - fprintf(stderr, "%s: [-NFhstvxX] [-f ]\n", prog); > > - exit(1); > expected > > > + fprintf(stderr, "Usage: %s [ -abDFhnpstvxX ] [ -B ] [ > -C ]\n" > > + "\t[ -f ] [ -L ] [ -N ]\n" > > + "\t[ -o [NSI] ] [ -O [NSI] ] [ -P ] [ -S ]\n > " > > + "\t[ ]\n", prog); > > + exit(-1); > > Was it intentional to flip the exit code to -1? > Someones scripts might not be prepared for that. My mistake I missed that. -- 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 Jun 27 03:50:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BEEC15D9DD8; Thu, 27 Jun 2019 03:50:14 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DDE16CFDF; Thu, 27 Jun 2019 03:50:14 +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 D6CA09B82; Thu, 27 Jun 2019 03:50:13 +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 x5R3oDvw005554; Thu, 27 Jun 2019 03:50:13 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5R3oDlg005553; Thu, 27 Jun 2019 03:50:13 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201906270350.x5R3oDlg005553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 27 Jun 2019 03:50:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349451 - head/contrib/ipfilter/tools X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/contrib/ipfilter/tools X-SVN-Commit-Revision: 349451 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0DDE16CFDF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 03:50:14 -0000 Author: cy Date: Thu Jun 27 03:50:13 2019 New Revision: 349451 URL: https://svnweb.freebsd.org/changeset/base/349451 Log: Return a return code scripts might expect. I missed this while reviewing and rewriting a patch in PR/238816. PR: 238816 Reported by: rgrimes@ Pointy hat to: cy@ MFC after: 1 week X-MFC with: r349450 Modified: head/contrib/ipfilter/tools/ipmon.c Modified: head/contrib/ipfilter/tools/ipmon.c ============================================================================== --- head/contrib/ipfilter/tools/ipmon.c Thu Jun 27 02:43:30 2019 (r349450) +++ head/contrib/ipfilter/tools/ipmon.c Thu Jun 27 03:50:13 2019 (r349451) @@ -1442,7 +1442,7 @@ static void usage(prog) "\t[ -f ] [ -L ] [ -N ]\n" "\t[ -o [NSI] ] [ -O [NSI] ] [ -P ] [ -S ]\n" "\t[ ]\n", prog); - exit(-1); + exit(1); } From owner-svn-src-head@freebsd.org Thu Jun 27 12:37:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BB8015C1CCA; Thu, 27 Jun 2019 12:37:46 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B69F284551; Thu, 27 Jun 2019 12:37:45 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 969D0F5D0; Thu, 27 Jun 2019 12:37:45 +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 x5RCbjQu088270; Thu, 27 Jun 2019 12:37:45 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RCbjxX088267; Thu, 27 Jun 2019 12:37:45 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201906271237.x5RCbjxX088267@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 27 Jun 2019 12:37:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349452 - in head: sbin/ipf/ipmon tools/build/mk X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in head: sbin/ipf/ipmon tools/build/mk X-SVN-Commit-Revision: 349452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B69F284551 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 12:37:46 -0000 Author: cy Date: Thu Jun 27 12:37:44 2019 New Revision: 349452 URL: https://svnweb.freebsd.org/changeset/base/349452 Log: Create a link to the ipmon.conf.5 man page as documented in ipmon.5. Add its corresponding optional removal entry. PR: 238816 MFC after: 1 week Modified: head/sbin/ipf/ipmon/Makefile head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/sbin/ipf/ipmon/Makefile ============================================================================== --- head/sbin/ipf/ipmon/Makefile Thu Jun 27 03:50:13 2019 (r349451) +++ head/sbin/ipf/ipmon/Makefile Thu Jun 27 12:37:44 2019 (r349452) @@ -4,6 +4,7 @@ PACKAGE= ipf PROG= ipmon SRCS= ${GENHDRS} ipmon.c ipmon_y.c ipmon_l.c MAN= ipmon.5 ipmon.8 +MLINKS= ipmon.5 ipmon.conf.5 CFLAGS+= -DLOGFAC=LOG_LOCAL0 -I. Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Thu Jun 27 03:50:13 2019 (r349451) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Thu Jun 27 12:37:44 2019 (r349452) @@ -3351,6 +3351,7 @@ OLD_FILES+=usr/share/man/man5/ipf.conf.5.gz OLD_FILES+=usr/share/man/man5/ipf6.conf.5.gz OLD_FILES+=usr/share/man/man5/ipfilter.5.gz OLD_FILES+=usr/share/man/man8/ipmon.5.gz +OLD_FILES+=usr/share/man/man5/ipmon.conf.5.gz OLD_FILES+=usr/share/man/man5/ipnat.5.gz OLD_FILES+=usr/share/man/man5/ipnat.conf.5.gz OLD_FILES+=usr/share/man/man5/ippool.5.gz From owner-svn-src-head@freebsd.org Thu Jun 27 13:31:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F24CD15C3201; Thu, 27 Jun 2019 13:31: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 83FE585EF9; Thu, 27 Jun 2019 13:31: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 5F50DFFBD; Thu, 27 Jun 2019 13:31: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 x5RDVuBK020035; Thu, 27 Jun 2019 13:31:56 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RDVukU020034; Thu, 27 Jun 2019 13:31:56 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201906271331.x5RDVukU020034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 27 Jun 2019 13:31:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349453 - head/release/picobsd/build X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/release/picobsd/build X-SVN-Commit-Revision: 349453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 83FE585EF9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 13:31:57 -0000 Author: emaste Date: Thu Jun 27 13:31:55 2019 New Revision: 349453 URL: https://svnweb.freebsd.org/changeset/base/349453 Log: picobsd: also exclude .git where we exclude .svn today Sponsored by: The FreeBSD Foundation Modified: head/release/picobsd/build/picobsd Modified: head/release/picobsd/build/picobsd ============================================================================== --- head/release/picobsd/build/picobsd Thu Jun 27 12:37:44 2019 (r349452) +++ head/release/picobsd/build/picobsd Thu Jun 27 13:31:55 2019 (r349453) @@ -437,7 +437,7 @@ populate_floppy_fs() { # OK ${MY_TREE}/floppy.tree.${SITE} ; do if [ -d ${FLOPPY_TREE} ] ; then (cd ${FLOPPY_TREE} ; tar -cf - \ - --exclude .svn ${excl} . ) | \ + --exclude .git --exclude .svn ${excl} . ) | \ (cd ${dst} ; tar x${o_tarv}f - ) log "Copied from ${FLOPPY_TREE}" fi @@ -698,7 +698,7 @@ populate_mfs_tree() { for MFS_TREE in ${PICO_TREE}/mfs_tree ${MY_TREE}/mfs_tree ; do if [ -d ${MFS_TREE} ] ; then log "Copy ${MFS_TREE} ..." - (cd ${MFS_TREE} ; tar -cf - --exclude .svn . ) | \ + (cd ${MFS_TREE} ; tar -cf - --exclude .git --exclude .svn . ) | \ (cd ${dst} ; tar x${o_tarv}f - ) fi done From owner-svn-src-head@freebsd.org Thu Jun 27 14:03:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2E9D15C3C45; Thu, 27 Jun 2019 14:03:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 884AA86F37; Thu, 27 Jun 2019 14:03:33 +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 613C518504; Thu, 27 Jun 2019 14:03:33 +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 x5RE3XZg039006; Thu, 27 Jun 2019 14:03:33 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RE3XDC039005; Thu, 27 Jun 2019 14:03:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201906271403.x5RE3XDC039005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 27 Jun 2019 14:03:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349455 - in head/sbin/bectl: . tests X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sbin/bectl: . tests X-SVN-Commit-Revision: 349455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 884AA86F37 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 14:03:34 -0000 Author: kevans Date: Thu Jun 27 14:03:32 2019 New Revision: 349455 URL: https://svnweb.freebsd.org/changeset/base/349455 Log: bectl(8): create non-recursive boot environments bectl advertises that it has the ability to create recursive and non-recursive boot environments. This patch implements that functionality using the be_create_depth API provided by libbe. With this patch, bectl now works as bectl(8) describes in regards to creating recursive/non-recursive boot environments. Submitted by: Rob Fairbanks (with minor changes) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D20240 Modified: head/sbin/bectl/bectl.c head/sbin/bectl/tests/bectl_test.sh Modified: head/sbin/bectl/bectl.c ============================================================================== --- head/sbin/bectl/bectl.c Thu Jun 27 13:37:34 2019 (r349454) +++ head/sbin/bectl/bectl.c Thu Jun 27 14:03:32 2019 (r349455) @@ -184,7 +184,8 @@ bectl_cmd_activate(int argc, char *argv[]) static int bectl_cmd_create(int argc, char *argv[]) { - char *atpos, *bootenv, *snapname, *source; + char snapshot[BE_MAXPATHLEN]; + char *atpos, *bootenv, *snapname; int err, opt; bool recursive; @@ -214,6 +215,8 @@ bectl_cmd_create(int argc, char *argv[]) } bootenv = *argv; + + err = BE_ERR_SUCCESS; if ((atpos = strchr(bootenv, '@')) != NULL) { /* * This is the "create a snapshot variant". No new boot @@ -221,24 +224,22 @@ bectl_cmd_create(int argc, char *argv[]) */ *atpos++ = '\0'; err = be_snapshot(be, bootenv, atpos, recursive, NULL); - } else if (snapname != NULL) { - if (strchr(snapname, '@') != NULL) - err = be_create_from_existing_snap(be, bootenv, - snapname); - else - err = be_create_from_existing(be, bootenv, snapname); } else { - if ((snapname = strchr(bootenv, '@')) != NULL) { - *(snapname++) = '\0'; - if ((err = be_snapshot(be, be_active_path(be), - snapname, true, NULL)) != BE_ERR_SUCCESS) - fprintf(stderr, "failed to create snapshot\n"); - asprintf(&source, "%s@%s", be_active_path(be), snapname); - err = be_create_from_existing_snap(be, bootenv, - source); - return (err); - } else - err = be_create(be, bootenv); + if (snapname == NULL) + /* Create from currently booted BE */ + err = be_snapshot(be, be_active_path(be), NULL, + recursive, snapshot); + else if (strchr(snapname, '@') != NULL) + /* Create from given snapshot */ + strlcpy(snapshot, snapname, sizeof(snapshot)); + else + /* Create from given BE */ + err = be_snapshot(be, snapname, NULL, recursive, + snapshot); + + if (err == BE_ERR_SUCCESS) + err = be_create_depth(be, bootenv, snapshot, + recursive == true ? -1 : 0); } switch (err) { Modified: head/sbin/bectl/tests/bectl_test.sh ============================================================================== --- head/sbin/bectl/tests/bectl_test.sh Thu Jun 27 13:37:34 2019 (r349454) +++ head/sbin/bectl/tests/bectl_test.sh Thu Jun 27 14:03:32 2019 (r349455) @@ -99,11 +99,35 @@ bectl_create_body() mount=${cwd}/mnt bectl_create_setup ${zpool} ${disk} ${mount} + + # Create a child dataset that will be used to test creation + # of recursive and non-recursive boot environments. + atf_check zfs create -o mountpoint=/usr -o canmount=noauto \ + ${zpool}/ROOT/default/usr + # Test standard creation, creation of a snapshot, and creation from a # snapshot. atf_check bectl -r ${zpool}/ROOT create -e default default2 atf_check bectl -r ${zpool}/ROOT create default2@test_snap atf_check bectl -r ${zpool}/ROOT create -e default2@test_snap default3 + + # Test standard creation, creation of a snapshot, and creation from a + # snapshot for recursive boot environments. + atf_check bectl -r ${zpool}/ROOT create -r -e default recursive + atf_check bectl -r ${zpool}/ROOT create -r recursive@test_snap + atf_check bectl -r ${zpool}/ROOT create -r -e recursive@test_snap recursive-snap + + # Test that non-recursive boot environments have no child datasets. + atf_check -e not-empty -s not-exit:0 \ + zfs list "${zpool}/ROOT/default2/usr" + atf_check -e not-empty -s not-exit:0 \ + zfs list "${zpool}/ROOT/default3/usr" + + # Test that recursive boot environments have child datasets. + atf_check -o not-empty \ + zfs list "${zpool}/ROOT/recursive/usr" + atf_check -o not-empty \ + zfs list "${zpool}/ROOT/recursive-snap/usr" } bectl_create_cleanup() { From owner-svn-src-head@freebsd.org Thu Jun 27 15:07:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A834A15C58C7; Thu, 27 Jun 2019 15:07:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1A48A576; Thu, 27 Jun 2019 15:07:07 +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 2882018F79; Thu, 27 Jun 2019 15:07:07 +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 x5RF770m070617; Thu, 27 Jun 2019 15:07:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RF775Q070616; Thu, 27 Jun 2019 15:07:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201906271507.x5RF775Q070616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 27 Jun 2019 15:07:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349459 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 349459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4F1A48A576 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 15:07:07 -0000 Author: avg Date: Thu Jun 27 15:07:06 2019 New Revision: 349459 URL: https://svnweb.freebsd.org/changeset/base/349459 Log: upgrade the warning printf-s in bus accessors to KASSERT-s After this change sys/bus.h includes sys/systm.h. Discussed with: cem, imp MFC after: 2 weeks Modified: head/sys/sys/bus.h Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Thu Jun 27 14:26:57 2019 (r349458) +++ head/sys/sys/bus.h Thu Jun 27 15:07:06 2019 (r349459) @@ -35,6 +35,7 @@ #include #include #include +#include /** * @defgroup NEWBUS newbus - a generic framework for managing devices @@ -813,12 +814,9 @@ static __inline type varp ## _get_ ## var(device_t dev int e; \ e = BUS_READ_IVAR(device_get_parent(dev), dev, \ ivarp ## _IVAR_ ## ivar, &v); \ - if (e != 0) { \ - device_printf(dev, "failed to read ivar " \ - __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, " \ - "error = %d\n", \ - device_get_nameunit(device_get_parent(dev)), e); \ - } \ + KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \ + __func__, device_get_nameunit(dev), \ + device_get_nameunit(device_get_parent(dev)), e)); \ return ((type) v); \ } \ \ @@ -828,12 +826,9 @@ static __inline void varp ## _set_ ## var(device_t dev int e; \ e = BUS_WRITE_IVAR(device_get_parent(dev), dev, \ ivarp ## _IVAR_ ## ivar, v); \ - if (e != 0) { \ - device_printf(dev, "failed to write ivar " \ - __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, " \ - "error = %d\n", \ - device_get_nameunit(device_get_parent(dev)), e); \ - } \ + KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \ + __func__, device_get_nameunit(dev), \ + device_get_nameunit(device_get_parent(dev)), e)); \ } /** From owner-svn-src-head@freebsd.org Thu Jun 27 15:46:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81CDB15C6524; Thu, 27 Jun 2019 15:46:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 243208BB1A; Thu, 27 Jun 2019 15:46:07 +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 E9F141962E; Thu, 27 Jun 2019 15:46:06 +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 x5RFk64I091266; Thu, 27 Jun 2019 15:46:06 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RFk68w091263; Thu, 27 Jun 2019 15:46:06 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201906271546.x5RFk68w091263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 27 Jun 2019 15:46:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349460 - in head: share/man/man4 sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/gpio X-SVN-Commit-Revision: 349460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 243208BB1A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 15:46:07 -0000 Author: avg Date: Thu Jun 27 15:46:06 2019 New Revision: 349460 URL: https://svnweb.freebsd.org/changeset/base/349460 Log: gpiobus: provide a new hint, pin_list "pin_list" allows to specify child pins as a list of pin numbers. Existing hint "pins" serves the same purpose but with a 32-bit wide bit mask. One problem with that is that a controller can have more than 32 pins. One example is amdgpio. Also, a list of numbers is a little bit more human friendly than a matching bit mask. As a side note, it seems that in FDT pins are typically specified by their numbers as well. This commit also adds accessors for instance variables (IVARs) that define the child pins. My primary goal is to allow a child to be configured programmatically rather than via hints (assuming that FDT is not supported on a platform). Also, while a child should not care about specific pin numbers that are allocated to it, it could be interested in how many were actually assigned to it. While there, I removed "flags" instance variable. It was unused. Reviewed by: mizhka MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20459 Modified: head/share/man/man4/gpio.4 head/sys/dev/gpio/gpiobus.c head/sys/dev/gpio/gpiobusvar.h Modified: head/share/man/man4/gpio.4 ============================================================================== --- head/share/man/man4/gpio.4 Thu Jun 27 15:07:06 2019 (r349459) +++ head/share/man/man4/gpio.4 Thu Jun 27 15:46:06 2019 (r349460) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 26, 2019 +.Dd June 27, 2019 .Dt GPIO 4 .Os .Sh NAME @@ -109,7 +109,7 @@ based system these hints can be used to configure driv attached to .Nm pins: -.Bl -tag -width ".Va hint.driver.unit.pins" +.Bl -tag -width ".Va hint.driver.unit.pin_list" .It Va hint.driver.unit.at The .Nm gpiobus @@ -125,6 +125,20 @@ This is a bitmask of the pins on the .Nm gpiobus that are connected to the device. The pins will be allocated to the specified driver instance. +Only pins with numbers from 0 to 31 can be specified using this hint. +.It Va hint.driver.unit.pin_list +This is a list of pin numbers of pins on the +.Nm gpiobus +that are connected to the device. +The pins will be allocated to the specified driver instance. +This is a more user friendly alternative to the +.Ar pins +hint. +Additionally, this hint allows specifying pin numbers greater than 31. +The numbers can be decimal or hexadecimal with 0x prefix. +Any non-digit character can be used as a separator. +For example, it can be a comma, a slash or a space. +The separator can be followed by any number of space characters. .El .Pp The following Modified: head/sys/dev/gpio/gpiobus.c ============================================================================== --- head/sys/dev/gpio/gpiobus.c Thu Jun 27 15:07:06 2019 (r349459) +++ head/sys/dev/gpio/gpiobus.c Thu Jun 27 15:46:06 2019 (r349460) @@ -255,13 +255,6 @@ gpiobus_alloc_ivars(struct gpiobus_ivar *devi) M_NOWAIT | M_ZERO); if (devi->pins == NULL) return (ENOMEM); - devi->flags = malloc(sizeof(uint32_t) * devi->npins, M_DEVBUF, - M_NOWAIT | M_ZERO); - if (devi->flags == NULL) { - free(devi->pins, M_DEVBUF); - return (ENOMEM); - } - return (0); } @@ -269,14 +262,11 @@ void gpiobus_free_ivars(struct gpiobus_ivar *devi) { - if (devi->flags) { - free(devi->flags, M_DEVBUF); - devi->flags = NULL; - } if (devi->pins) { free(devi->pins, M_DEVBUF); devi->pins = NULL; } + devi->npins = 0; } int @@ -326,6 +316,34 @@ gpiobus_release_pin(device_t bus, uint32_t pin) } static int +gpiobus_acquire_child_pins(device_t dev, device_t child) +{ + struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); + int i; + + for (i = 0; i < devi->npins; i++) { + /* Reserve the GPIO pin. */ + if (gpiobus_acquire_pin(dev, devi->pins[i]) != 0) { + device_printf(child, "cannot acquire pin %d\n", + devi->pins[i]); + while (--i >= 0) { + (void)gpiobus_release_pin(dev, + devi->pins[i]); + } + gpiobus_free_ivars(devi); + return (EBUSY); + } + } + for (i = 0; i < devi->npins; i++) { + /* Use the child name as pin name. */ + GPIOBUS_PIN_SETNAME(dev, devi->pins[i], + device_get_nameunit(child)); + + } + return (0); +} + +static int gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask) { struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); @@ -349,21 +367,70 @@ gpiobus_parse_pins(struct gpiobus_softc *sc, device_t for (i = 0; i < 32; i++) { if ((mask & (1 << i)) == 0) continue; - /* Reserve the GPIO pin. */ - if (gpiobus_acquire_pin(sc->sc_busdev, i) != 0) { - gpiobus_free_ivars(devi); - return (EINVAL); - } devi->pins[npins++] = i; - /* Use the child name as pin name. */ - GPIOBUS_PIN_SETNAME(sc->sc_busdev, i, - device_get_nameunit(child)); } + if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0) + return (EINVAL); return (0); } static int +gpiobus_parse_pin_list(struct gpiobus_softc *sc, device_t child, + const char *pins) +{ + struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); + const char *p; + char *endp; + unsigned long pin; + int i, npins; + + npins = 0; + p = pins; + for (;;) { + pin = strtoul(p, &endp, 0); + if (endp == p) + break; + npins++; + if (*endp == '\0') + break; + p = endp + 1; + } + + if (*endp != '\0') { + device_printf(child, "garbage in the pin list: %s\n", endp); + return (EINVAL); + } + if (npins == 0) { + device_printf(child, "empty pin list\n"); + return (EINVAL); + } + + devi->npins = npins; + if (gpiobus_alloc_ivars(devi) != 0) { + device_printf(child, "cannot allocate device ivars\n"); + return (EINVAL); + } + + i = 0; + p = pins; + for (;;) { + pin = strtoul(p, &endp, 0); + + devi->pins[i] = pin; + + if (*endp == '\0') + break; + i++; + p = endp + 1; + } + + if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0) + return (EINVAL); + return (0); +} + +static int gpiobus_probe(device_t dev) { device_set_desc(dev, "GPIO bus"); @@ -539,16 +606,27 @@ gpiobus_hinted_child(device_t bus, const char *dname, struct gpiobus_softc *sc = GPIOBUS_SOFTC(bus); struct gpiobus_ivar *devi; device_t child; - int irq, pins; + const char *pins; + int irq, pinmask; child = BUS_ADD_CHILD(bus, 0, dname, dunit); devi = GPIOBUS_IVAR(child); - resource_int_value(dname, dunit, "pins", &pins); - if (gpiobus_parse_pins(sc, child, pins)) { - resource_list_free(&devi->rl); - free(devi, M_DEVBUF); - device_delete_child(bus, child); + if (resource_int_value(dname, dunit, "pins", &pinmask) == 0) { + if (gpiobus_parse_pins(sc, child, pinmask)) { + resource_list_free(&devi->rl); + free(devi, M_DEVBUF); + device_delete_child(bus, child); + return; + } } + else if (resource_string_value(dname, dunit, "pin_list", &pins) == 0) { + if (gpiobus_parse_pin_list(sc, child, pins)) { + resource_list_free(&devi->rl); + free(devi, M_DEVBUF); + device_delete_child(bus, child); + return; + } + } if (resource_int_value(dname, dunit, "irq", &irq) == 0) { if (bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1) != 0) device_printf(bus, @@ -574,6 +652,61 @@ gpiobus_set_resource(device_t dev, device_t child, int return (0); } +static int +gpiobus_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) +{ + struct gpiobus_ivar *devi; + + devi = GPIOBUS_IVAR(child); + switch (which) { + case GPIOBUS_IVAR_NPINS: + *result = devi->npins; + break; + case GPIOBUS_IVAR_PINS: + /* Children do not ever need to directly examine this. */ + return (ENOTSUP); + default: + return (ENOENT); + } + + return (0); +} + +static int +gpiobus_write_ivar(device_t dev, device_t child, int which, uintptr_t value) +{ + struct gpiobus_ivar *devi; + const uint32_t *ptr; + int i; + + devi = GPIOBUS_IVAR(child); + switch (which) { + case GPIOBUS_IVAR_NPINS: + /* GPIO ivars are set once. */ + if (devi->npins != 0) { + return (EBUSY); + } + devi->npins = value; + if (gpiobus_alloc_ivars(devi) != 0) { + device_printf(child, "cannot allocate device ivars\n"); + devi->npins = 0; + return (ENOMEM); + } + break; + case GPIOBUS_IVAR_PINS: + ptr = (const uint32_t *)value; + for (i = 0; i < devi->npins; i++) + devi->pins[i] = ptr[i]; + if (gpiobus_acquire_child_pins(dev, child) != 0) + return (EBUSY); + break; + default: + return (ENOENT); + } + + return (0); +} + static struct resource * gpiobus_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) @@ -833,6 +966,8 @@ static device_method_t gpiobus_methods[] = { DEVMETHOD(bus_child_pnpinfo_str, gpiobus_child_pnpinfo_str), DEVMETHOD(bus_child_location_str, gpiobus_child_location_str), DEVMETHOD(bus_hinted_child, gpiobus_hinted_child), + DEVMETHOD(bus_read_ivar, gpiobus_read_ivar), + DEVMETHOD(bus_write_ivar, gpiobus_write_ivar), /* GPIO protocol */ DEVMETHOD(gpiobus_acquire_bus, gpiobus_acquire_bus), Modified: head/sys/dev/gpio/gpiobusvar.h ============================================================================== --- head/sys/dev/gpio/gpiobusvar.h Thu Jun 27 15:07:06 2019 (r349459) +++ head/sys/dev/gpio/gpiobusvar.h Thu Jun 27 15:46:06 2019 (r349460) @@ -107,9 +107,21 @@ struct gpiobus_ivar { struct resource_list rl; /* isr resource list */ uint32_t npins; /* pins total */ - uint32_t *flags; /* pins flags */ uint32_t *pins; /* pins map */ }; + +enum gpiobus_ivars { + GPIOBUS_IVAR_NPINS = 10500, + GPIOBUS_IVAR_PINS, +}; + +#define GPIOBUS_ACCESSOR(var, ivar, type) \ + __BUS_ACCESSOR(gpiobus, var, GPIOBUS, ivar, type) + +GPIOBUS_ACCESSOR(npins, NPINS, uint32_t) +GPIOBUS_ACCESSOR(pins, PINS, const uint32_t *) + +#undef GPIOBUS_ACCESSOR #ifdef FDT struct ofw_gpiobus_devinfo { From owner-svn-src-head@freebsd.org Thu Jun 27 15:48:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3155415C65E0; Thu, 27 Jun 2019 15:48:03 +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 946058BCD7; Thu, 27 Jun 2019 15:48:02 +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 353823DCAC5; Fri, 28 Jun 2019 01:47:53 +1000 (AEST) Date: Fri, 28 Jun 2019 01:47:51 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andriy Gapon cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349459 - head/sys/sys In-Reply-To: <201906271507.x5RF775Q070616@repo.freebsd.org> Message-ID: <20190628012059.D2091@besplex.bde.org> References: <201906271507.x5RF775Q070616@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=P6RKvmIu c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=3aoYDsRNsgoN-TxrW0EA:9 a=CjuIK1q_8ugA:10 X-Rspamd-Queue-Id: 946058BCD7 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.96)[-0.955,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 15:48:03 -0000 On Thu, 27 Jun 2019, Andriy Gapon wrote: > Log: > upgrade the warning printf-s in bus accessors to KASSERT-s > > After this change sys/bus.h includes sys/systm.h. This is further namespace pollution. sys/systm.h is a prerequiste for all kernel headers except sys/param.h and the headers that that includes, since any kernel header (except sys/param.hm etc.) may have inlines which use features in systm.h, e.g., KASSERT() or an inline function. > Modified: head/sys/sys/bus.h > ============================================================================== > --- head/sys/sys/bus.h Thu Jun 27 14:26:57 2019 (r349458) > +++ head/sys/sys/bus.h Thu Jun 27 15:07:06 2019 (r349459) > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include This header used to be relatively clean, with no polluting includes. The following low-quality headers in sys already include sys/systm.h: - capsicum.h:#include - fail.h:#include - fbio.h:#include - intr.h:#include - libkern.h:#include - malloc.h:#include - mbuf.h:#include - pmckern.h:#include - proc.h:#include - refcount.h:#include - seqc.h:#include - sf_buf.h:#include - zutil.h:#include This is especially bad in: - libkern.h. systm.h includes libkern.h, so this recurses. The recursion is bounded by the reinclude guard. libkern.h was broken by adding KASSERT()s to it. It is a leaf header, so must be written carefully. - malloc.h and mbuf.h. I fixed all the include pollution in them. They are now much more polluted than before I cleaned them - proc.h. Almost everything includes this. Including sys/systm.h in it hdes the bug of not including sys/systm.h in the correct place in .c files. > /** > * @defgroup NEWBUS newbus - a generic framework for managing devices > @@ -813,12 +814,9 @@ static __inline type varp ## _get_ ## var(device_t dev > int e; \ > e = BUS_READ_IVAR(device_get_parent(dev), dev, \ > ivarp ## _IVAR_ ## ivar, &v); \ > - if (e != 0) { \ > - device_printf(dev, "failed to read ivar " \ > - __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, " \ > - "error = %d\n", \ > - device_get_nameunit(device_get_parent(dev)), e); \ > - } \ > + KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \ > + __func__, device_get_nameunit(dev), \ > + device_get_nameunit(device_get_parent(dev)), e)); \ > return ((type) v); \ > } \ > \ Inline functions in headers generally cause namespace pollution, like here. Some headers use macros which don't have that problem. mbuf.h used to be like that. The cleaned version of it in FreeBSD-4 includes only sys/queue.h. It has rotted to include sys/systm.h, sys/refcount.h, vm/uma.h. sys/lock.h and sys/sdt.h. Bruce From owner-svn-src-head@freebsd.org Thu Jun 27 15:51:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59B3015C68CF; Thu, 27 Jun 2019 15:51:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 008818C210; Thu, 27 Jun 2019 15:51:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D06E1196AB; Thu, 27 Jun 2019 15:51:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5RFpo0D095340; Thu, 27 Jun 2019 15:51:50 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RFpoPh095339; Thu, 27 Jun 2019 15:51:50 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201906271551.x5RFpoPh095339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 27 Jun 2019 15:51:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349461 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 349461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 008818C210 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 15:51:51 -0000 Author: avg Date: Thu Jun 27 15:51:50 2019 New Revision: 349461 URL: https://svnweb.freebsd.org/changeset/base/349461 Log: revert r349460, printf -> KASSERT in bus.h, until I can fix it I tested only kernel builds naively assuming that sys/bus.h cannot affect userland builds. Pointyhat to: me Modified: head/sys/sys/bus.h Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Thu Jun 27 15:46:06 2019 (r349460) +++ head/sys/sys/bus.h Thu Jun 27 15:51:50 2019 (r349461) @@ -35,7 +35,6 @@ #include #include #include -#include /** * @defgroup NEWBUS newbus - a generic framework for managing devices @@ -814,9 +813,12 @@ static __inline type varp ## _get_ ## var(device_t dev int e; \ e = BUS_READ_IVAR(device_get_parent(dev), dev, \ ivarp ## _IVAR_ ## ivar, &v); \ - KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \ - __func__, device_get_nameunit(dev), \ - device_get_nameunit(device_get_parent(dev)), e)); \ + if (e != 0) { \ + device_printf(dev, "failed to read ivar " \ + __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, " \ + "error = %d\n", \ + device_get_nameunit(device_get_parent(dev)), e); \ + } \ return ((type) v); \ } \ \ @@ -826,9 +828,12 @@ static __inline void varp ## _set_ ## var(device_t dev int e; \ e = BUS_WRITE_IVAR(device_get_parent(dev), dev, \ ivarp ## _IVAR_ ## ivar, v); \ - KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \ - __func__, device_get_nameunit(dev), \ - device_get_nameunit(device_get_parent(dev)), e)); \ + if (e != 0) { \ + device_printf(dev, "failed to write ivar " \ + __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, " \ + "error = %d\n", \ + device_get_nameunit(device_get_parent(dev)), e); \ + } \ } /** From owner-svn-src-head@freebsd.org Thu Jun 27 16:01:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FB8F15C6CFC; Thu, 27 Jun 2019 16:01:41 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 686928C7D5; Thu, 27 Jun 2019 16:01:40 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf1-f49.google.com with SMTP id x144so1935503lfa.9; Thu, 27 Jun 2019 09:01:40 -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:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=HcWqPngCeBhYZZe8lP6q1kctMIKX9sHtjVDxyTumER8=; b=K1iwAwQNONVKr3bOtIA0tt0XKXS3j4KEWwDYINRZSW0HKG50hv24+Ikb3iAn368YnP etNSqpG5ahIpWGuZ4/N8jK2qd01uOpvNylY6DT4ACI4YWAVi0TWHdWiYSGhEhp78vDL+ iRl6Mv0qNmJ6N3A+xd8eDSTdV0XGLjFRH/1HyNXRUOM8Fn69Sook1keCu1/QjdA5KdE0 A4owiZeOWgGS4aiNQcSQXKWK0h7L2S2e7jTE2cs1O6xDBRXODbBPZgIpGr/m8G/9slA+ lIyTftmITCRCPDus9qj8mMtUvkwqdNGiI6kTRFjiegZkRj3nyjbscrul+Q7KfVA9ZbpQ R8hw== X-Gm-Message-State: APjAAAUOzVxw7eAjWCkA4rhutbj7ujL5KtWcjsuZfA0R12vo1AwWhO+Z VinNL84wjv1Nh2jb3U1xOr41BpbMZ3g= X-Google-Smtp-Source: APXvYqzWncMhncUdZ53mFihYPfhk6XZZPUJ66Td7bTXSLMxCvNhbVKQI0DlsUoM2ACaIdOaz1jD4QQ== X-Received: by 2002:ac2:4a78:: with SMTP id q24mr2308877lfp.59.1561650844243; Thu, 27 Jun 2019 08:54:04 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id 24sm697013ljs.63.2019.06.27.08.54.03 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 27 Jun 2019 08:54:03 -0700 (PDT) Subject: Re: svn commit: r349459 - head/sys/sys To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201906271507.x5RF775Q070616@repo.freebsd.org> <20190628012059.D2091@besplex.bde.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: Date: Thu, 27 Jun 2019 18:54:02 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190628012059.D2091@besplex.bde.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 686928C7D5 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.96)[-0.958,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 16:01:41 -0000 On 27/06/2019 18:47, Bruce Evans wrote: > On Thu, 27 Jun 2019, Andriy Gapon wrote: > >> Log: >>  upgrade the warning printf-s in bus accessors to KASSERT-s >> >>  After this change sys/bus.h includes sys/systm.h. > > This is further namespace pollution.  sys/systm.h is a prerequiste for > all kernel headers except sys/param.h and the headers that that includes, > since any kernel header (except sys/param.hm etc.) may have inlines which > use features in systm.h, e.g., KASSERT() or an inline function. Bruce, what do you think about amending style(9) to require that if sys/systm.h is to be included, then it must be included before any other header except for sys/param.h (and possibly sys/cdefs.h) ? -- Andriy Gapon From owner-svn-src-head@freebsd.org Thu Jun 27 17:38:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E5E715C87FC; Thu, 27 Jun 2019 17:38:08 +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 E1D198F3BB; Thu, 27 Jun 2019 17:38:07 +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 162767E5C6A; Fri, 28 Jun 2019 03:37:58 +1000 (AEST) Date: Fri, 28 Jun 2019 03:37:56 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andriy Gapon cc: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349459 - head/sys/sys In-Reply-To: Message-ID: <20190628032225.T2863@besplex.bde.org> References: <201906271507.x5RF775Q070616@repo.freebsd.org> <20190628012059.D2091@besplex.bde.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=D+Q3ErZj c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=nlC_4_pT8q9DhB4Ho9EA:9 a=lAimr6Aa0iGmYpgNssEA:9 a=45ClL6m2LaAA:10 X-Rspamd-Queue-Id: E1D198F3BB X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.88 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.88)[-0.882,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 17:38:08 -0000 On Thu, 27 Jun 2019, Andriy Gapon wrote: > On 27/06/2019 18:47, Bruce Evans wrote: >> On Thu, 27 Jun 2019, Andriy Gapon wrote: >> >>> Log: >>> =C2=A0upgrade the warning printf-s in bus accessors to KASSERT-s >>> >>> =C2=A0After this change sys/bus.h includes sys/systm.h. >> >> This is further namespace pollution.=C2=A0 sys/systm.h is a prerequiste = for >> all kernel headers except sys/param.h and the headers that that includes= , >> since any kernel header (except sys/param.hm etc.) may have inlines whic= h >> use features in systm.h, e.g., KASSERT() or an inline function. > > what do you think about amending style(9) to require that if sys/systm.h = is to > be included, then it must be included before any other header except for > sys/param.h (and possibly sys/cdefs.h) ? It is not a style matter. sys/systm.h is just a prerequisite for almost all kernel code. Perhaps this can be enforced using #ifdef magic even for headers that don't currently use it. If it is to be included nested, then sys/param.h is the place to include it, but I don't like that since it is even less related to parameters than sys/param.h, and this would be a regression from minor depollution of sys/param.h. sys/systm.h is also kernel-only, and as you found, including it nested tends to break applications, so other headers that have the bug of including it tend to have _KERNEL ifdefs to avoid including it in applications. This is so fundamental that it doesn't have a "No user-serviceable parts inside" ifdef. Bruce From owner-svn-src-head@freebsd.org Thu Jun 27 18:08:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AFB615C918D; Thu, 27 Jun 2019 18:08:20 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5DB669A36; Thu, 27 Jun 2019 18:08:19 +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 62B451ADD3; Thu, 27 Jun 2019 18:08:19 +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 x5RI8JGl064724; Thu, 27 Jun 2019 18:08:19 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RI8IuQ064721; Thu, 27 Jun 2019 18:08:18 GMT (envelope-from br@FreeBSD.org) Message-Id: <201906271808.x5RI8IuQ064721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 27 Jun 2019 18:08:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349466 - in head/sys: conf dev/altera/msgdma mips/conf X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: conf dev/altera/msgdma mips/conf X-SVN-Commit-Revision: 349466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A5DB669A36 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 18:08:20 -0000 Author: br Date: Thu Jun 27 18:08:18 2019 New Revision: 349466 URL: https://svnweb.freebsd.org/changeset/base/349466 Log: Add support for extended descriptor format to Altera mSGDMA driver. The format to use depends on hardware configuration (synthesis-time), so make it compile-time kernel option. Extended format allows DMA engine to operate with 64-bit memory addresses. Sponsored by: DARPA, AFRL Modified: head/sys/conf/options head/sys/dev/altera/msgdma/msgdma.c head/sys/dev/altera/msgdma/msgdma.h head/sys/mips/conf/BERI_DE4_BASE Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu Jun 27 17:59:15 2019 (r349465) +++ head/sys/conf/options Thu Jun 27 18:08:18 2019 (r349466) @@ -861,6 +861,12 @@ AH_INTERRUPT_DEBUGGING opt_ah.h # XXX do not use this for AR9130 AH_AR5416_INTERRUPT_MITIGATION opt_ah.h +# options for the Altera mSGDMA driver (altera_msgdma) +ALTERA_MSGDMA_DESC_STD opt_altera_msgdma.h +ALTERA_MSGDMA_DESC_EXT opt_altera_msgdma.h +ALTERA_MSGDMA_DESC_PF_STD opt_altera_msgdma.h +ALTERA_MSGDMA_DESC_PF_EXT opt_altera_msgdma.h + # options for the Broadcom BCM43xx driver (bwi) BWI_DEBUG opt_bwi.h BWI_DEBUG_VERBOSE opt_bwi.h Modified: head/sys/dev/altera/msgdma/msgdma.c ============================================================================== --- head/sys/dev/altera/msgdma/msgdma.c Thu Jun 27 17:59:15 2019 (r349465) +++ head/sys/dev/altera/msgdma/msgdma.c Thu Jun 27 18:08:18 2019 (r349466) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include "xdma_if.h" +#include "opt_altera_msgdma.h" #include @@ -470,8 +471,8 @@ msgdma_channel_submit_sg(device_t dev, struct xdma_cha struct msgdma_channel *chan; struct msgdma_desc *desc; struct msgdma_softc *sc; - uint32_t src_addr_lo; - uint32_t dst_addr_lo; + bus_addr_t src_addr_lo; + bus_addr_t dst_addr_lo; uint32_t len; uint32_t tmp; int i; @@ -481,14 +482,18 @@ msgdma_channel_submit_sg(device_t dev, struct xdma_cha chan = (struct msgdma_channel *)xchan->chan; for (i = 0; i < sg_n; i++) { - src_addr_lo = (uint32_t)sg[i].src_addr; - dst_addr_lo = (uint32_t)sg[i].dst_addr; + src_addr_lo = sg[i].src_addr; + dst_addr_lo = sg[i].dst_addr; len = (uint32_t)sg[i].len; dprintf("%s: src %x dst %x len %d\n", __func__, src_addr_lo, dst_addr_lo, len); desc = chan->descs[chan->idx_head]; +#if defined(ALTERA_MSGDMA_DESC_EXT) || defined(ALTERA_MSGDMA_DESC_PF_EXT) + desc->read_hi = htole32(src_addr_lo >> 32); + desc->write_hi = htole32(dst_addr_lo >> 32); +#endif desc->read_lo = htole32(src_addr_lo); desc->write_lo = htole32(dst_addr_lo); desc->length = htole32(len); Modified: head/sys/dev/altera/msgdma/msgdma.h ============================================================================== --- head/sys/dev/altera/msgdma/msgdma.h Thu Jun 27 17:59:15 2019 (r349465) +++ head/sys/dev/altera/msgdma/msgdma.h Thu Jun 27 18:08:18 2019 (r349466) @@ -30,6 +30,8 @@ * $FreeBSD$ */ +#include "opt_altera_msgdma.h" + /* Altera mSGDMA registers. */ #define DMA_STATUS 0x00 #define STATUS_RESETTING (1 << 6) @@ -75,22 +77,74 @@ #define WRITE4_DESC(_sc, _reg, _val) \ bus_space_write_4(_sc->bst_d, _sc->bsh_d, _reg, htole32(_val)) -/* Prefetcher-disabled descriptor format. */ -struct msgdma_desc_nonpf { - uint32_t src_addr; - uint32_t dst_addr; +#if defined(ALTERA_MSGDMA_DESC_STD) + +/* Standard descriptor format with prefetcher disabled. */ +struct msgdma_desc { + uint32_t read_lo; + uint32_t write_lo; uint32_t length; uint32_t control; }; -/* Prefetcher-enabled descriptor format. */ +#elif defined(ALTERA_MSGDMA_DESC_EXT) + +/* Extended descriptor format with prefetcher disabled. */ struct msgdma_desc { uint32_t read_lo; uint32_t write_lo; uint32_t length; + uint8_t write_burst; + uint8_t read_burst; + uint16_t seq_num; + uint16_t write_stride; + uint16_t read_stride; + uint32_t read_hi; + uint32_t write_hi; + uint32_t control; +}; + +#elif defined(ALTERA_MSGDMA_DESC_PF_STD) + +/* Standard descriptor format with prefetcher enabled. */ +struct msgdma_desc { + uint32_t read_lo; + uint32_t write_lo; + uint32_t length; uint32_t next; uint32_t transferred; uint32_t status; uint32_t reserved; uint32_t control; }; + +#elif defined(ALTERA_MSGDMA_DESC_PF_EXT) + +/* Extended descriptor format with prefetcher enabled. */ +struct msgdma_desc { + uint32_t read_lo; + uint32_t write_lo; + uint32_t length; + uint32_t next; + uint32_t transferred; + uint32_t status; + uint32_t reserved; + uint8_t write_burst; + uint8_t read_burst; + uint16_t seq_num; + uint16_t write_stride; + uint16_t read_stride; + uint32_t read_hi; + uint32_t write_hi; + uint32_t next_hi; + uint32_t reserved1; + uint32_t reserved2; + uint32_t reserved3; + uint32_t control; +}; + +#else + +#error "mSGDMA descriptor format (kernel option) is not set." + +#endif Modified: head/sys/mips/conf/BERI_DE4_BASE ============================================================================== --- head/sys/mips/conf/BERI_DE4_BASE Thu Jun 27 17:59:15 2019 (r349465) +++ head/sys/mips/conf/BERI_DE4_BASE Thu Jun 27 18:08:18 2019 (r349466) @@ -44,6 +44,7 @@ options DEVICE_POLLING # # DMA support # +options ALTERA_MSGDMA_DESC_PF_STD device xdma device altera_softdma device altera_msgdma From owner-svn-src-head@freebsd.org Thu Jun 27 19:18:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A024F15CAC8E; Thu, 27 Jun 2019 19:18:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDD046C1A1; Thu, 27 Jun 2019 19:18:50 +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 x5RJIhs2047340 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 27 Jun 2019 22:18:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x5RJIhs2047340 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x5RJIhBD047339; Thu, 27 Jun 2019 22:18:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 27 Jun 2019 22:18:43 +0300 From: Konstantin Belousov To: Alan Somers Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349231 - in head/sys: kern sys ufs/ufs Message-ID: <20190627191843.GQ8697@kib.kiev.ua> References: <201906201413.x5KEDB5u010923@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201906201413.x5KEDB5u010923@repo.freebsd.org> User-Agent: Mutt/1.12.0 (2019-05-25) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 19:18:51 -0000 On Thu, Jun 20, 2019 at 02:13:11PM +0000, Alan Somers wrote: > Author: asomers > Date: Thu Jun 20 14:13:10 2019 > New Revision: 349231 > URL: https://svnweb.freebsd.org/changeset/base/349231 > > Log: > Add FIOBMAP2 ioctl > > This ioctl exposes VOP_BMAP information to userland. It can be used by > programs like fragmentation analyzers and optimized cp implementations. But > I'm using it to test fusefs's VOP_BMAP implementation. The "2" in the name > distinguishes it from the similar but incompatible FIBMAP ioctls in NetBSD > and Linux. FIOBMAP2 differs from FIBMAP in that it uses a 64-bit block > number instead of 32-bit, and it also returns runp and runb. > > Reviewed by: mckusick > MFC after: 2 weeks > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D20705 > > Modified: > head/sys/kern/vfs_vnops.c > head/sys/sys/filio.h > head/sys/ufs/ufs/ufs_bmap.c > > Modified: head/sys/kern/vfs_vnops.c > ============================================================================== > --- head/sys/kern/vfs_vnops.c Thu Jun 20 13:59:46 2019 (r349230) > +++ head/sys/kern/vfs_vnops.c Thu Jun 20 14:13:10 2019 (r349231) > @@ -1458,6 +1458,25 @@ vn_stat(struct vnode *vp, struct stat *sb, struct ucre > return (0); > } > > +/* generic FIOBMAP2 implementation */ > +static int > +vn_ioc_bmap2(struct file *fp, struct fiobmap2_arg *arg, struct ucred *cred) I do not like the fact that internal kernel function takes the user-visible structure which results in the mix of ABI and KBI. Traditionally we pass explicit arguments to kern_XXX, vn_XXX and similar internal implementations. > +{ > + struct vnode *vp = fp->f_vnode; Why do you pass fp to the function that 1. Has vn_ namespace, i.e. operating on vnode. 2. Only needs vnode to operate on. Please change the argument from fp to vp. You would need to pass f_cred as additional argument, or move mac check to vn_ioctl (I think this is a better approach). > + daddr_t lbn = arg->bn; Style: initialization in declaration. > + int error; > + > + vn_lock(vp, LK_SHARED | LK_RETRY); > +#ifdef MAC > + error = mac_vnode_check_read(cred, fp->f_cred, vp); > + if (error == 0) > +#endif > + error = VOP_BMAP(vp, lbn, NULL, &arg->bn, &arg->runp, > + &arg->runb); Wrong indent for continuation line. > + VOP_UNLOCK(vp, 0); > + return (error); > +} > + > /* > * File table vnode ioctl routine. > */ > @@ -1481,6 +1500,9 @@ vn_ioctl(struct file *fp, u_long com, void *data, stru > if (error == 0) > *(int *)data = vattr.va_size - fp->f_offset; > return (error); > + case FIOBMAP2: > + return (vn_ioc_bmap2(fp, (struct fiobmap2_arg*)data, Need space between fiobmap2_arg and '*'. > + active_cred)); Wrong indent. > case FIONBIO: > case FIOASYNC: > return (0); > > Modified: head/sys/sys/filio.h > ============================================================================== > --- head/sys/sys/filio.h Thu Jun 20 13:59:46 2019 (r349230) > +++ head/sys/sys/filio.h Thu Jun 20 14:13:10 2019 (r349231) > @@ -62,6 +62,13 @@ struct fiodgname_arg { > /* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */ > #define FIOSEEKDATA _IOWR('f', 97, off_t) /* SEEK_DATA */ > #define FIOSEEKHOLE _IOWR('f', 98, off_t) /* SEEK_HOLE */ > +struct fiobmap2_arg { > + int64_t bn; > + int runp; > + int runb; > +}; This structure has different layout for LP64 and ILP32, and you did not provided the compat shims. > +/* Get the file's bmap info for the logical block bn */ > +#define FIOBMAP2 _IOWR('f', 99, struct fiobmap2_arg) > > #ifdef _KERNEL > #ifdef COMPAT_FREEBSD32 > > Modified: head/sys/ufs/ufs/ufs_bmap.c > ============================================================================== > --- head/sys/ufs/ufs/ufs_bmap.c Thu Jun 20 13:59:46 2019 (r349230) > +++ head/sys/ufs/ufs/ufs_bmap.c Thu Jun 20 14:13:10 2019 (r349231) > @@ -200,12 +200,15 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb) > *bnp = blkptrtodb(ump, ip->i_din2->di_extb[-1 - bn]); > if (*bnp == 0) > *bnp = -1; > - if (nbp == NULL) > - panic("ufs_bmaparray: mapping ext data"); > + if (nbp == NULL) { > + /* indirect block not found */ > + return (EINVAL); > + } This (and next chunk) loose useful checks for in-kernel interfaces. > nbp->b_xflags |= BX_ALTDATA; > return (0); > } else { > - panic("ufs_bmaparray: blkno out of range"); > + /* blkno out of range */ > + return (EINVAL); > } > /* > * Since this is FFS independent code, we are out of From owner-svn-src-head@freebsd.org Thu Jun 27 19:36:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BEC715CB476; Thu, 27 Jun 2019 19:36:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C5C186CB60; Thu, 27 Jun 2019 19:36:30 +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 9A7191BDF7; Thu, 27 Jun 2019 19:36:30 +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 x5RJaUvr011405; Thu, 27 Jun 2019 19:36:30 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RJaU2n011404; Thu, 27 Jun 2019 19:36:30 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201906271936.x5RJaU2n011404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 27 Jun 2019 19:36:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349467 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 349467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C5C186CB60 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 19:36:31 -0000 Author: jhb Date: Thu Jun 27 19:36:30 2019 New Revision: 349467 URL: https://svnweb.freebsd.org/changeset/base/349467 Log: Hold an explicit reference on the socket for the aiotx task. Previously, the aiotx task relied on the aio jobs in the queue to hold a reference on the socket. However, when the last job is completed, there is nothing left to hold a reference to the socket buffer lock used to check if the queue is empty. In addition, if the last job on the queue is cancelled, the task can run with no queued jobs holding a reference to the socket buffer lock the task uses to notice the queue is empty. Fix these races by holding an explicit reference on the socket when the task is queued and dropping that reference when the task completes. Reviewed by: np MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D20539 Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Jun 27 18:08:18 2019 (r349466) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Jun 27 19:36:30 2019 (r349467) @@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$"); #include "tom/t4_tom.h" static void t4_aiotx_cancel(struct kaiocb *job); -static void t4_aiotx_queue_toep(struct toepcb *toep); +static void t4_aiotx_queue_toep(struct socket *so, struct toepcb *toep); static size_t aiotx_mbuf_pgoff(struct mbuf *m) @@ -785,7 +785,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep if (sowwakeup) { if (!TAILQ_EMPTY( &toep->aiotx_jobq)) - t4_aiotx_queue_toep( + t4_aiotx_queue_toep(so, toep); sowwakeup_locked(so); } else @@ -829,7 +829,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep } if (sowwakeup) { if (!TAILQ_EMPTY(&toep->aiotx_jobq)) - t4_aiotx_queue_toep(toep); + t4_aiotx_queue_toep(so, toep); sowwakeup_locked(so); } else SOCKBUF_UNLOCK(sb); @@ -1821,7 +1821,7 @@ do_fw4_ack(struct sge_iq *iq, const struct rss_header tls_ofld->sb_off -= plen; } if (!TAILQ_EMPTY(&toep->aiotx_jobq)) - t4_aiotx_queue_toep(toep); + t4_aiotx_queue_toep(so, toep); sowwakeup_locked(so); /* unlocks so_snd */ } SOCKBUF_UNLOCK_ASSERT(sb); @@ -2195,10 +2195,10 @@ static void t4_aiotx_task(void *context, int pending) { struct toepcb *toep = context; - struct inpcb *inp = toep->inp; - struct socket *so = inp->inp_socket; + struct socket *so; struct kaiocb *job; + so = toep->aiotx_so; CURVNET_SET(toep->vnet); SOCKBUF_LOCK(&so->so_snd); while (!TAILQ_EMPTY(&toep->aiotx_jobq) && sowriteable(so)) { @@ -2209,15 +2209,17 @@ t4_aiotx_task(void *context, int pending) t4_aiotx_process_job(toep, so, job); } - toep->aiotx_task_active = false; + toep->aiotx_so = NULL; SOCKBUF_UNLOCK(&so->so_snd); CURVNET_RESTORE(); free_toepcb(toep); + SOCK_LOCK(so); + sorele(so); } static void -t4_aiotx_queue_toep(struct toepcb *toep) +t4_aiotx_queue_toep(struct socket *so, struct toepcb *toep) { SOCKBUF_LOCK_ASSERT(&toep->inp->inp_socket->so_snd); @@ -2225,9 +2227,10 @@ t4_aiotx_queue_toep(struct toepcb *toep) CTR3(KTR_CXGBE, "%s: queueing aiotx task for tid %d, active = %s", __func__, toep->tid, toep->aiotx_task_active ? "true" : "false"); #endif - if (toep->aiotx_task_active) + if (toep->aiotx_so != NULL) return; - toep->aiotx_task_active = true; + soref(so); + toep->aiotx_so = so; hold_toepcb(toep); soaio_enqueue(&toep->aiotx_task); } @@ -2284,7 +2287,7 @@ t4_aio_queue_aiotx(struct socket *so, struct kaiocb *j panic("new job was cancelled"); TAILQ_INSERT_TAIL(&toep->aiotx_jobq, job, list); if (sowriteable(so)) - t4_aiotx_queue_toep(toep); + t4_aiotx_queue_toep(so, toep); SOCKBUF_UNLOCK(&so->so_snd); return (0); } Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Thu Jun 27 18:08:18 2019 (r349466) +++ head/sys/dev/cxgbe/tom/t4_tom.h Thu Jun 27 19:36:30 2019 (r349467) @@ -194,7 +194,7 @@ struct toepcb { TAILQ_HEAD(, kaiocb) aiotx_jobq; struct task aiotx_task; - bool aiotx_task_active; + struct socket *aiotx_so; /* Tx software descriptor */ uint8_t txsd_total; From owner-svn-src-head@freebsd.org Thu Jun 27 20:01:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A392A15CC07F; Thu, 27 Jun 2019 20:01:30 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 33E526DC07; Thu, 27 Jun 2019 20:01:30 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lj1-f193.google.com with SMTP id x25so3647362ljh.2; Thu, 27 Jun 2019 13:01:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Jc4DzYF5DK0JoRGxBnjUHfDk3UazJPSqip78WXkgR70=; b=P+Sf1GZuDxKmhMSCvrBXtEN6d9T1iec1qQyXjHKczmoNXNhcGTccyM6DQYgchdVRNk abSYeAS+Ka7o/Ae8Sn2+1p0tZpu1rsyrawEYMRMUg6CstZcSNc8sppAUnouk1ongBPZS KYz9ZLQHo0ZR6qGbGd54fBYNbYN1tqNv48ivJPq2DPmlmctJxFXjCqCkNFcPRZiqEQXK GCH0BE4aBsFMGi+EqHLfBLjq94a5JaleOQ9E85IJoChr/gpfCjGuSFfvHVnwoT5TvQYJ 5uhoc6qGactWRszYJ8QPynYElnyrtrmOPq3TLhpv25HuhI9hvNq61xqh/tuzQtggTILg 9/DA== X-Gm-Message-State: APjAAAUZKe8STtDwvRhOEKhMFueDeIRriBq8tKCEycPGJ+LqYpodjHpc FQSidrYVay/FGsEIYFoTn17g7YprCvtMN7usdYk= X-Google-Smtp-Source: APXvYqzH5Ft4rvMGCg69K7oL89kza2bd6n87Jvaq00OTodkh8cjEyymNU2PpJCCzrIydxy7sUdWV8SyMPvCuFgWB7a0= X-Received: by 2002:a2e:9cd1:: with SMTP id g17mr3912501ljj.234.1561665683465; Thu, 27 Jun 2019 13:01:23 -0700 (PDT) MIME-Version: 1.0 References: <201906201413.x5KEDB5u010923@repo.freebsd.org> <20190627191843.GQ8697@kib.kiev.ua> In-Reply-To: <20190627191843.GQ8697@kib.kiev.ua> From: Alan Somers Date: Thu, 27 Jun 2019 14:01:11 -0600 Message-ID: Subject: Re: svn commit: r349231 - in head/sys: kern sys ufs/ufs To: Konstantin Belousov Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 33E526DC07 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.86 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.86)[-0.858,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 20:01:31 -0000 On Thu, Jun 27, 2019 at 1:18 PM Konstantin Belousov wrote: > > On Thu, Jun 20, 2019 at 02:13:11PM +0000, Alan Somers wrote: > > Author: asomers > > Date: Thu Jun 20 14:13:10 2019 > > New Revision: 349231 > > URL: https://svnweb.freebsd.org/changeset/base/349231 > > > > Log: > > Add FIOBMAP2 ioctl > > > > > This ioctl exposes VOP_BMAP information to userland. It can be used by > > programs like fragmentation analyzers and optimized cp implementations. But > > I'm using it to test fusefs's VOP_BMAP implementation. The "2" in the name > > distinguishes it from the similar but incompatible FIBMAP ioctls in NetBSD > > and Linux. FIOBMAP2 differs from FIBMAP in that it uses a 64-bit block > > number instead of 32-bit, and it also returns runp and runb. > > > > Reviewed by: mckusick > > MFC after: 2 weeks > > Sponsored by: The FreeBSD Foundation > > Differential Revision: https://reviews.freebsd.org/D20705 > > > > Modified: > > head/sys/kern/vfs_vnops.c > > head/sys/sys/filio.h > > head/sys/ufs/ufs/ufs_bmap.c > > > > Modified: head/sys/kern/vfs_vnops.c > > ============================================================================== > > --- head/sys/kern/vfs_vnops.c Thu Jun 20 13:59:46 2019 (r349230) > > +++ head/sys/kern/vfs_vnops.c Thu Jun 20 14:13:10 2019 (r349231) > > @@ -1458,6 +1458,25 @@ vn_stat(struct vnode *vp, struct stat *sb, struct ucre > > return (0); > > } > > > > +/* generic FIOBMAP2 implementation */ > > +static int > > +vn_ioc_bmap2(struct file *fp, struct fiobmap2_arg *arg, struct ucred *cred) > I do not like the fact that internal kernel function takes the > user-visible structure which results in the mix of ABI and KBI. > Traditionally we pass explicit arguments to kern_XXX, vn_XXX and similar > internal implementations. Ok. It will increase the number of function arguments, which is ugly, but I can do it if you prefer. > > > +{ > > + struct vnode *vp = fp->f_vnode; > Why do you pass fp to the function that > 1. Has vn_ namespace, i.e. operating on vnode. > 2. Only needs vnode to operate on. > Please change the argument from fp to vp. You would need to pass f_cred > as additional argument, or move mac check to vn_ioctl (I think this is > a better approach). Ok. > > > + daddr_t lbn = arg->bn; > Style: initialization in declaration. > > > + int error; > > + > > + vn_lock(vp, LK_SHARED | LK_RETRY); > > +#ifdef MAC > > + error = mac_vnode_check_read(cred, fp->f_cred, vp); > > + if (error == 0) > > +#endif > > + error = VOP_BMAP(vp, lbn, NULL, &arg->bn, &arg->runp, > > + &arg->runb); > Wrong indent for continuation line. > > > + VOP_UNLOCK(vp, 0); > > + return (error); > > +} > > + > > /* > > * File table vnode ioctl routine. > > */ > > @@ -1481,6 +1500,9 @@ vn_ioctl(struct file *fp, u_long com, void *data, stru > > if (error == 0) > > *(int *)data = vattr.va_size - fp->f_offset; > > return (error); > > + case FIOBMAP2: > > + return (vn_ioc_bmap2(fp, (struct fiobmap2_arg*)data, > Need space between fiobmap2_arg and '*'. > > + active_cred)); > Wrong indent. > > > case FIONBIO: > > case FIOASYNC: > > return (0); > > > > Modified: head/sys/sys/filio.h > > ============================================================================== > > --- head/sys/sys/filio.h Thu Jun 20 13:59:46 2019 (r349230) > > +++ head/sys/sys/filio.h Thu Jun 20 14:13:10 2019 (r349231) > > @@ -62,6 +62,13 @@ struct fiodgname_arg { > > /* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */ > > #define FIOSEEKDATA _IOWR('f', 97, off_t) /* SEEK_DATA */ > > #define FIOSEEKHOLE _IOWR('f', 98, off_t) /* SEEK_HOLE */ > > +struct fiobmap2_arg { > > + int64_t bn; > > + int runp; > > + int runb; > > +}; > This structure has different layout for LP64 and ILP32, and you did not > provided the compat shims. Really? How so? All of the fields have the same width on 64 and 32 bit archs, and there shouldn't be any need for padding, either. > > > +/* Get the file's bmap info for the logical block bn */ > > +#define FIOBMAP2 _IOWR('f', 99, struct fiobmap2_arg) > > > > #ifdef _KERNEL > > #ifdef COMPAT_FREEBSD32 > > > > Modified: head/sys/ufs/ufs/ufs_bmap.c > > ============================================================================== > > --- head/sys/ufs/ufs/ufs_bmap.c Thu Jun 20 13:59:46 2019 (r349230) > > +++ head/sys/ufs/ufs/ufs_bmap.c Thu Jun 20 14:13:10 2019 (r349231) > > @@ -200,12 +200,15 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb) > > *bnp = blkptrtodb(ump, ip->i_din2->di_extb[-1 - bn]); > > if (*bnp == 0) > > *bnp = -1; > > - if (nbp == NULL) > > - panic("ufs_bmaparray: mapping ext data"); > > + if (nbp == NULL) { > > + /* indirect block not found */ > > + return (EINVAL); > > + } > This (and next chunk) loose useful checks for in-kernel interfaces. mckusick disagrees with you on this. He thought that changing the panics into errors was a good idea. Note that ufs_bmap was already capable of returning errors that not all callers check. > > > nbp->b_xflags |= BX_ALTDATA; > > return (0); > > } else { > > - panic("ufs_bmaparray: blkno out of range"); > > + /* blkno out of range */ > > + return (EINVAL); > > } > > /* > > * Since this is FFS independent code, we are out of From owner-svn-src-head@freebsd.org Thu Jun 27 20:18:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7F7215CCBFD; Thu, 27 Jun 2019 20:18:11 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 29A0F6F80A; Thu, 27 Jun 2019 20:18:10 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lj1-f169.google.com with SMTP id v24so3635802ljg.13; Thu, 27 Jun 2019 13:18:10 -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:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=M2fLoie1gQSyGJG8zSw2sFty283gV5VWw55suzDYTRI=; b=tfp83SNeO77BeAQtcb5Q4fCYF+WQRCdrL7QYABuYUHfzqb44Hw0PVkzi5BzxvuvzDq /IUCvke5aFwUqNhDDetCSCIRmrTsPNzSRSvOLc1iVyr4Q9Ozl57p+MDWsBLfSnkxcXrP OQbf43OQ0T4x6FYCxIvtF2O2FcjlnNiHEgbLbsl2GwK0PwU49j3ICyS08dSkQzC6HJJj rAIS7jIz9qwLahq3EqicyXACWiuIR3eWX+53Z5OqX9JnhuSRjmDlNo0y7Qaa08roAiOT MB90btrtq0u1/oVlFWaJyYVgjsMROSN9y/ItrIyjQWBy3D3auaJ8nTOrLre/2NLDNBAV D4Bg== X-Gm-Message-State: APjAAAUyB4radOFmluZ/ozog3moDMK0qK9/h0v8xN514vGyVf+HP/cF9 kTu55JHt9lo/c6PtC5Ni/PFdIdPuLZQ= X-Google-Smtp-Source: APXvYqy1RTvl3OOsXcLNvYmfpI+IFTpaIRo811piQVDDNWSy24ymqnDWHUX9ZZRHkmtBLDbRoaXDvQ== X-Received: by 2002:a2e:a0d5:: with SMTP id f21mr3822842ljm.69.1561666681900; Thu, 27 Jun 2019 13:18:01 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id k4sm8335ljj.41.2019.06.27.13.17.59 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 27 Jun 2019 13:18:00 -0700 (PDT) Subject: Re: svn commit: r349459 - head/sys/sys To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201906271507.x5RF775Q070616@repo.freebsd.org> <20190628012059.D2091@besplex.bde.org> <20190628032225.T2863@besplex.bde.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: Date: Thu, 27 Jun 2019 23:17:59 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190628032225.T2863@besplex.bde.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 29A0F6F80A X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 20:18:12 -0000 On 27/06/2019 20:37, Bruce Evans wrote: > On Thu, 27 Jun 2019, Andriy Gapon wrote: > >> On 27/06/2019 18:47, Bruce Evans wrote: >>> On Thu, 27 Jun 2019, Andriy Gapon wrote: >>> >>>> Log: >>>>  upgrade the warning printf-s in bus accessors to KASSERT-s >>>> >>>>  After this change sys/bus.h includes sys/systm.h. >>> >>> This is further namespace pollution.  sys/systm.h is a prerequiste for >>> all kernel headers except sys/param.h and the headers that that includes, >>> since any kernel header (except sys/param.hm etc.) may have inlines which >>> use features in systm.h, e.g., KASSERT() or an inline function. >> >> what do you think about amending style(9) to require that if sys/systm.h is to >> be included, then it must be included before any other header except for >> sys/param.h (and possibly sys/cdefs.h) ? > > It is not a style matter. I know... but style(9) documents sys/param.h for similar reasons. > sys/systm.h is just a prerequisite for almost > all kernel code.  Perhaps this can be enforced using #ifdef magic even > for headers that don't currently use it.  If it is to be included nested, > then sys/param.h is the place to include it, but I don't like that since > it is even less related to parameters than sys/param.h, and this would be > a regression from minor depollution of sys/param.h. > > sys/systm.h is also kernel-only, and as you found, including it nested > tends to break applications, so other headers that have the bug of > including it tend to have _KERNEL ifdefs to avoid including it in > applications.  This is so fundamental that it doesn't have a "No > user-serviceable parts inside" ifdef. I think that there is a trivial fix to my commit: moving the sys/systm.h include to the _KERNEL section of sys/bus.h. That's where its definitions are actually used. But I agree that there should be a better approach. -- Andriy Gapon From owner-svn-src-head@freebsd.org Thu Jun 27 20:34:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7DA615CDC7F; Thu, 27 Jun 2019 20:34: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D9B37073D; Thu, 27 Jun 2019 20:34: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 6D9EE1C84C; Thu, 27 Jun 2019 20:34: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 x5RKYpdo045980; Thu, 27 Jun 2019 20:34:51 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RKYpCE045979; Thu, 27 Jun 2019 20:34:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201906272034.x5RKYpCE045979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 27 Jun 2019 20:34:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349469 - head/usr.bin/uname X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.bin/uname X-SVN-Commit-Revision: 349469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8D9B37073D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 20:34:52 -0000 Author: emaste Date: Thu Jun 27 20:34:50 2019 New Revision: 349469 URL: https://svnweb.freebsd.org/changeset/base/349469 Log: Expose the kernel's build-ID through `uname -b` After r348611 the kernel's build-ID is available via sysctl. Add a -b flag to uname to report it. Submitted by: Ali Mashtizadeh Reviewed by: markj, imp Relnotes: Yes Event: Waterloo Hackathon 2019 Differential Revision: https://reviews.freebsd.org/D20511 Modified: head/usr.bin/uname/uname.1 head/usr.bin/uname/uname.c Modified: head/usr.bin/uname/uname.1 ============================================================================== --- head/usr.bin/uname/uname.1 Thu Jun 27 20:18:12 2019 (r349468) +++ head/usr.bin/uname/uname.1 Thu Jun 27 20:34:50 2019 (r349469) @@ -28,7 +28,7 @@ .\" @(#)uname.1 8.3 (Berkeley) 4/8/94 .\" $FreeBSD$ .\" -.Dd May 31, 2017 +.Dd June 27, 2019 .Dt UNAME 1 .Os .Sh NAME @@ -36,7 +36,7 @@ .Nd display information about the system .Sh SYNOPSIS .Nm -.Op Fl aiKmnoprsUv +.Op Fl abiKmnoprsUv .Sh DESCRIPTION The .Nm @@ -53,6 +53,8 @@ Behave as though the options and .Fl v were specified. +.It Fl b +Write the kernel's linker-generated build-id to standard output. .It Fl i Write the kernel ident to standard output. .It Fl K @@ -152,3 +154,7 @@ and .Fl U extension flags appeared in .Fx 10.0 . +The +.Fl b +extension flag appeared in +.Fx 13.0 . Modified: head/usr.bin/uname/uname.c ============================================================================== --- head/usr.bin/uname/uname.c Thu Jun 27 20:18:12 2019 (r349468) +++ head/usr.bin/uname/uname.c Thu Jun 27 20:34:50 2019 (r349469) @@ -67,9 +67,10 @@ static const char sccsid[] = "@(#)uname.c 8.2 (Berkele #define IFLAG 0x40 #define UFLAG 0x80 #define KFLAG 0x100 +#define BFLAG 0x200 typedef void (*get_t)(void); -static get_t get_ident, get_platform, get_hostname, get_arch, +static get_t get_buildid, get_ident, get_platform, get_hostname, get_arch, get_release, get_sysname, get_kernvers, get_uservers, get_version; static void native_ident(void); @@ -81,11 +82,13 @@ static void native_sysname(void); static void native_version(void); static void native_kernvers(void); static void native_uservers(void); +static void native_buildid(void); static void print_uname(u_int); static void setup_get(void); static void usage(void); -static char *ident, *platform, *hostname, *arch, *release, *sysname, *version, *kernvers, *uservers; +static char *buildid, *ident, *platform, *hostname, *arch, *release, *sysname, + *version, *kernvers, *uservers; static int space; int @@ -97,11 +100,14 @@ main(int argc, char *argv[]) setup_get(); flags = 0; - while ((ch = getopt(argc, argv, "aiKmnoprsUv")) != -1) + while ((ch = getopt(argc, argv, "abiKmnoprsUv")) != -1) switch(ch) { case 'a': flags |= (MFLAG | NFLAG | RFLAG | SFLAG | VFLAG); break; + case 'b': + flags |= BFLAG; + break; case 'i': flags |= IFLAG; break; @@ -169,6 +175,7 @@ setup_get(void) CHECK_ENV("i", ident); CHECK_ENV("K", kernvers); CHECK_ENV("U", uservers); + CHECK_ENV("b", buildid); } #define PRINT_FLAG(flags,flag,var) \ @@ -194,6 +201,7 @@ print_uname(u_int flags) PRINT_FLAG(flags, IFLAG, ident); PRINT_FLAG(flags, KFLAG, kernvers); PRINT_FLAG(flags, UFLAG, uservers); + PRINT_FLAG(flags, BFLAG, buildid); printf("\n"); } @@ -261,6 +269,9 @@ NATIVE_SYSCTL2_GET(arch, CTL_HW, HW_MACHINE_ARCH) { NATIVE_SYSCTLNAME_GET(ident, "kern.ident") { } NATIVE_SET; +NATIVE_SYSCTLNAME_GET(buildid, "kern.build_id") { +} NATIVE_SET; + static void native_uservers(void) { @@ -282,6 +293,6 @@ native_kernvers(void) static void usage(void) { - fprintf(stderr, "usage: uname [-aiKmnoprsUv]\n"); + fprintf(stderr, "usage: uname [-abiKmnoprsUv]\n"); exit(1); } From owner-svn-src-head@freebsd.org Thu Jun 27 21:09:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B9D315CE667; Thu, 27 Jun 2019 21:09:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D996B717AA; Thu, 27 Jun 2019 21:09:48 +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 x5RL9erK073732 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 28 Jun 2019 00:09:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x5RL9erK073732 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x5RL9eA0073731; Fri, 28 Jun 2019 00:09:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 28 Jun 2019 00:09:40 +0300 From: Konstantin Belousov To: Alan Somers Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r349231 - in head/sys: kern sys ufs/ufs Message-ID: <20190627210940.GR8697@kib.kiev.ua> References: <201906201413.x5KEDB5u010923@repo.freebsd.org> <20190627191843.GQ8697@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.0 (2019-05-25) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 21:09:50 -0000 On Thu, Jun 27, 2019 at 02:01:11PM -0600, Alan Somers wrote: > On Thu, Jun 27, 2019 at 1:18 PM Konstantin Belousov wrote: > > > > On Thu, Jun 20, 2019 at 02:13:11PM +0000, Alan Somers wrote: > > > Author: asomers > > > Date: Thu Jun 20 14:13:10 2019 > > > New Revision: 349231 > > > URL: https://svnweb.freebsd.org/changeset/base/349231 > > > > > > Log: > > > Add FIOBMAP2 ioctl > > > > > > > > This ioctl exposes VOP_BMAP information to userland. It can be used by > > > programs like fragmentation analyzers and optimized cp implementations. But > > > I'm using it to test fusefs's VOP_BMAP implementation. The "2" in the name > > > distinguishes it from the similar but incompatible FIBMAP ioctls in NetBSD > > > and Linux. FIOBMAP2 differs from FIBMAP in that it uses a 64-bit block > > > number instead of 32-bit, and it also returns runp and runb. > > > > > > Reviewed by: mckusick > > > MFC after: 2 weeks > > > Sponsored by: The FreeBSD Foundation > > > Differential Revision: https://reviews.freebsd.org/D20705 > > > > > > Modified: > > > head/sys/kern/vfs_vnops.c > > > head/sys/sys/filio.h > > > head/sys/ufs/ufs/ufs_bmap.c > > > > > > Modified: head/sys/kern/vfs_vnops.c > > > ============================================================================== > > > --- head/sys/kern/vfs_vnops.c Thu Jun 20 13:59:46 2019 (r349230) > > > +++ head/sys/kern/vfs_vnops.c Thu Jun 20 14:13:10 2019 (r349231) > > > @@ -1458,6 +1458,25 @@ vn_stat(struct vnode *vp, struct stat *sb, struct ucre > > > return (0); > > > } > > > > > > +/* generic FIOBMAP2 implementation */ > > > +static int > > > +vn_ioc_bmap2(struct file *fp, struct fiobmap2_arg *arg, struct ucred *cred) > > I do not like the fact that internal kernel function takes the > > user-visible structure which results in the mix of ABI and KBI. > > Traditionally we pass explicit arguments to kern_XXX, vn_XXX and similar > > internal implementations. > > Ok. It will increase the number of function arguments, which is ugly, > but I can do it if you prefer. > > > > > > +{ > > > + struct vnode *vp = fp->f_vnode; > > Why do you pass fp to the function that > > 1. Has vn_ namespace, i.e. operating on vnode. > > 2. Only needs vnode to operate on. > > Please change the argument from fp to vp. You would need to pass f_cred > > as additional argument, or move mac check to vn_ioctl (I think this is > > a better approach). > > Ok. > > > > > > + daddr_t lbn = arg->bn; > > Style: initialization in declaration. > > > > > + int error; > > > + > > > + vn_lock(vp, LK_SHARED | LK_RETRY); > > > +#ifdef MAC > > > + error = mac_vnode_check_read(cred, fp->f_cred, vp); > > > + if (error == 0) > > > +#endif > > > + error = VOP_BMAP(vp, lbn, NULL, &arg->bn, &arg->runp, > > > + &arg->runb); > > Wrong indent for continuation line. > > > > > + VOP_UNLOCK(vp, 0); > > > + return (error); > > > +} > > > + > > > /* > > > * File table vnode ioctl routine. > > > */ > > > @@ -1481,6 +1500,9 @@ vn_ioctl(struct file *fp, u_long com, void *data, stru > > > if (error == 0) > > > *(int *)data = vattr.va_size - fp->f_offset; > > > return (error); > > > + case FIOBMAP2: > > > + return (vn_ioc_bmap2(fp, (struct fiobmap2_arg*)data, > > Need space between fiobmap2_arg and '*'. > > > + active_cred)); > > Wrong indent. > > > > > case FIONBIO: > > > case FIOASYNC: > > > return (0); > > > > > > Modified: head/sys/sys/filio.h > > > ============================================================================== > > > --- head/sys/sys/filio.h Thu Jun 20 13:59:46 2019 (r349230) > > > +++ head/sys/sys/filio.h Thu Jun 20 14:13:10 2019 (r349231) > > > @@ -62,6 +62,13 @@ struct fiodgname_arg { > > > /* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */ > > > #define FIOSEEKDATA _IOWR('f', 97, off_t) /* SEEK_DATA */ > > > #define FIOSEEKHOLE _IOWR('f', 98, off_t) /* SEEK_HOLE */ > > > +struct fiobmap2_arg { > > > + int64_t bn; > > > + int runp; > > > + int runb; > > > +}; > > This structure has different layout for LP64 and ILP32, and you did not > > provided the compat shims. > > Really? How so? All of the fields have the same width on 64 and 32 > bit archs, and there shouldn't be any need for padding, either. Sorry, you are right. > > > > > > +/* Get the file's bmap info for the logical block bn */ > > > +#define FIOBMAP2 _IOWR('f', 99, struct fiobmap2_arg) > > > > > > #ifdef _KERNEL > > > #ifdef COMPAT_FREEBSD32 > > > > > > Modified: head/sys/ufs/ufs/ufs_bmap.c > > > ============================================================================== > > > --- head/sys/ufs/ufs/ufs_bmap.c Thu Jun 20 13:59:46 2019 (r349230) > > > +++ head/sys/ufs/ufs/ufs_bmap.c Thu Jun 20 14:13:10 2019 (r349231) > > > @@ -200,12 +200,15 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb) > > > *bnp = blkptrtodb(ump, ip->i_din2->di_extb[-1 - bn]); > > > if (*bnp == 0) > > > *bnp = -1; > > > - if (nbp == NULL) > > > - panic("ufs_bmaparray: mapping ext data"); > > > + if (nbp == NULL) { > > > + /* indirect block not found */ > > > + return (EINVAL); > > > + } > > This (and next chunk) loose useful checks for in-kernel interfaces. > > mckusick disagrees with you on this. He thought that changing the > panics into errors was a good idea. Note that ufs_bmap was already > capable of returning errors that not all callers check. For user-callable code, this is of course the requirement. But for in-kernel use, IMO it makes the interfaces loose. From owner-svn-src-head@freebsd.org Thu Jun 27 21:45:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F045E15CF223; Thu, 27 Jun 2019 21:45:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 93D1972AD2; Thu, 27 Jun 2019 21:45:41 +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 6A5931D46A; Thu, 27 Jun 2019 21:45:41 +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 x5RLjfPp082798; Thu, 27 Jun 2019 21:45:41 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RLjfoo082797; Thu, 27 Jun 2019 21:45:41 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201906272145.x5RLjfoo082797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 27 Jun 2019 21:45:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349470 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 93D1972AD2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 21:45:42 -0000 Author: jhb Date: Thu Jun 27 21:45:40 2019 New Revision: 349470 URL: https://svnweb.freebsd.org/changeset/base/349470 Log: Use __FBSDID() and sort #includes. No functional change. Modified: head/usr.sbin/bhyve/net_utils.c Modified: head/usr.sbin/bhyve/net_utils.c ============================================================================== --- head/usr.sbin/bhyve/net_utils.c Thu Jun 27 20:34:50 2019 (r349469) +++ head/usr.sbin/bhyve/net_utils.c Thu Jun 27 21:45:40 2019 (r349470) @@ -21,17 +21,21 @@ * 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 "net_utils.h" -#include "bhyverun.h" -#include +#include +__FBSDID("$FreeBSD$"); + +#include #include -#include -#include + #include +#include +#include +#include + +#include "bhyverun.h" +#include "net_utils.h" int net_parsemac(char *mac_str, uint8_t *mac_addr) From owner-svn-src-head@freebsd.org Thu Jun 27 21:48:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E54F615CF336; Thu, 27 Jun 2019 21:48:32 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 871F772D5B; Thu, 27 Jun 2019 21:48:32 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 6825A20241; Thu, 27 Jun 2019 17:48:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 27 Jun 2019 17:48:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm3; bh=5 OdQlXMjzArjBfKmAqhdIKW6iT3PA7DhTAilKANGuaY=; b=yjwdjUPzlJuZihuE/ 9iexOvO0+SmOh2VeBwROgImdy73YDWS8xtB0WO3HPv5kFufTgC+rVxmdQblQA0LV gAXSIkZxxKtV4YZI+CzgypSnLtGvE6T60/AENR4qXNSDVZdlAJFvnkJ92LbTjJlX gTugLD3NZyYJtjZR9EFc3X+fS6v5DKHcsLwxgEj0p1JykUuCXW8DhCj7jbXyjXU4 WXhWMeAbnFTXJd+qiOZUD3myjmUJelmb9/xXan0LaUtpFwxT5BNvDCocsjGB/37w TxV50524A/F/grfZim8JLG5k1ycAw90qcb5h8edSbvA6YPD336d7z4vqB0sVSMCq hQgLA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=5OdQlXMjzArjBfKmAqhdIKW6iT3PA7DhTAilKANGu aY=; b=oUdpY+VT1xxGGPRxJs8tSOZ17JjddORvZzCAnDAw8IfNJE1XCHOjFZ7Z4 zg6EMx9Ne22a8QKHTp4YoZo5nc9/mEQZUEbLTG69nVgEjC+RUoM2aE/JItBCm/6T VWmF0V5KsC+TecwR9TDQx1qXz3OlMhkpFkWpVndawlCkx0BxCczs3W8IBvDWF5ui A3ecMiL8AKzDB20Jeij2+PaNuxyjzStQmeECT4HlTMDoumcuTeA06x/lY2Qu0q47 VOHc+QuAm4hOVWwHTrAzWn8BMAtvjblQiEY+niW6xv9b3n2O1NfbH2PAs/0KyD+N GIVEQHesmPeejaYoudt4vVzZ1WU8A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudelgddtvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpegtggfuhfgjfffgkfhfvffosehtqhhmtdhhtdejnecuhfhrohhmpefutghothht ucfnohhnghcuoehstghothhtlhesshgrmhhstghordhorhhgqeenucffohhmrghinhepfh hrvggvsghsugdrohhrghenucfkphepudelvddrheehrdehgedriedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpehstghothhtlhesshgrmhhstghordhorhhgnecuvehluhhsthgvrh fuihiivgeptd X-ME-Proxy: Received: from [10.178.24.8] (unknown [192.55.54.60]) by mail.messagingengine.com (Postfix) with ESMTPA id 19CEE380086; Thu, 27 Jun 2019 17:48:24 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r349231 - in head/sys: kern sys ufs/ufs From: Scott Long In-Reply-To: <20190627210940.GR8697@kib.kiev.ua> Date: Thu, 27 Jun 2019 15:48:23 -0600 Cc: Alan Somers , src-committers , svn-src-all , svn-src-head Content-Transfer-Encoding: quoted-printable Message-Id: <0988866D-918B-4800-ADE7-938E1EBD729C@samsco.org> References: <201906201413.x5KEDB5u010923@repo.freebsd.org> <20190627191843.GQ8697@kib.kiev.ua> <20190627210940.GR8697@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 871F772D5B X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 21:48:33 -0000 > On Jun 27, 2019, at 3:09 PM, Konstantin Belousov = wrote: >=20 > On Thu, Jun 27, 2019 at 02:01:11PM -0600, Alan Somers wrote: >> On Thu, Jun 27, 2019 at 1:18 PM Konstantin Belousov = wrote: >>>=20 >>> On Thu, Jun 20, 2019 at 02:13:11PM +0000, Alan Somers wrote: >>>> Author: asomers >>>> Date: Thu Jun 20 14:13:10 2019 >>>> New Revision: 349231 >>>> URL: https://svnweb.freebsd.org/changeset/base/349231 >>>>=20 >>>> Log: >>>> Add FIOBMAP2 ioctl >>>=20 >>>>=20 >>>> This ioctl exposes VOP_BMAP information to userland. It can be = used by >>>> programs like fragmentation analyzers and optimized cp = implementations. But >>>> I'm using it to test fusefs's VOP_BMAP implementation. The "2" in = the name >>>> distinguishes it from the similar but incompatible FIBMAP ioctls = in NetBSD >>>> and Linux. FIOBMAP2 differs from FIBMAP in that it uses a 64-bit = block >>>> number instead of 32-bit, and it also returns runp and runb. >>>>=20 >>>> Reviewed by: mckusick >>>> MFC after: 2 weeks >>>> Sponsored by: The FreeBSD Foundation >>>> Differential Revision: https://reviews.freebsd.org/D20705 >>>>=20 >>>> Modified: >>>> head/sys/kern/vfs_vnops.c >>>> head/sys/sys/filio.h >>>> head/sys/ufs/ufs/ufs_bmap.c >>>>=20 >>>> Modified: head/sys/kern/vfs_vnops.c >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/kern/vfs_vnops.c Thu Jun 20 13:59:46 2019 = (r349230) >>>> +++ head/sys/kern/vfs_vnops.c Thu Jun 20 14:13:10 2019 = (r349231) >>>> @@ -1458,6 +1458,25 @@ vn_stat(struct vnode *vp, struct stat *sb, = struct ucre >>>> return (0); >>>> } >>>>=20 >>>> +/* generic FIOBMAP2 implementation */ >>>> +static int >>>> +vn_ioc_bmap2(struct file *fp, struct fiobmap2_arg *arg, struct = ucred *cred) >>> I do not like the fact that internal kernel function takes the >>> user-visible structure which results in the mix of ABI and KBI. >>> Traditionally we pass explicit arguments to kern_XXX, vn_XXX and = similar >>> internal implementations. >>=20 >> Ok. It will increase the number of function arguments, which is = ugly, >> but I can do it if you prefer. >>=20 >>>=20 >>>> +{ >>>> + struct vnode *vp =3D fp->f_vnode; >>> Why do you pass fp to the function that >>> 1. Has vn_ namespace, i.e. operating on vnode. >>> 2. Only needs vnode to operate on. >>> Please change the argument from fp to vp. You would need to pass = f_cred >>> as additional argument, or move mac check to vn_ioctl (I think this = is >>> a better approach). >>=20 >> Ok. >>=20 >>>=20 >>>> + daddr_t lbn =3D arg->bn; >>> Style: initialization in declaration. >>>=20 >>>> + int error; >>>> + >>>> + vn_lock(vp, LK_SHARED | LK_RETRY); >>>> +#ifdef MAC >>>> + error =3D mac_vnode_check_read(cred, fp->f_cred, vp); >>>> + if (error =3D=3D 0) >>>> +#endif >>>> + error =3D VOP_BMAP(vp, lbn, NULL, &arg->bn, = &arg->runp, >>>> + &arg->runb); >>> Wrong indent for continuation line. >>>=20 >>>> + VOP_UNLOCK(vp, 0); >>>> + return (error); >>>> +} >>>> + >>>> /* >>>> * File table vnode ioctl routine. >>>> */ >>>> @@ -1481,6 +1500,9 @@ vn_ioctl(struct file *fp, u_long com, void = *data, stru >>>> if (error =3D=3D 0) >>>> *(int *)data =3D vattr.va_size - = fp->f_offset; >>>> return (error); >>>> + case FIOBMAP2: >>>> + return (vn_ioc_bmap2(fp, (struct = fiobmap2_arg*)data, >>> Need space between fiobmap2_arg and '*'. >>>> + active_cred)); >>> Wrong indent. >>>=20 >>>> case FIONBIO: >>>> case FIOASYNC: >>>> return (0); >>>>=20 >>>> Modified: head/sys/sys/filio.h >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/sys/filio.h Thu Jun 20 13:59:46 2019 = (r349230) >>>> +++ head/sys/sys/filio.h Thu Jun 20 14:13:10 2019 = (r349231) >>>> @@ -62,6 +62,13 @@ struct fiodgname_arg { >>>> /* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. = */ >>>> #define FIOSEEKDATA _IOWR('f', 97, off_t) /* SEEK_DATA = */ >>>> #define FIOSEEKHOLE _IOWR('f', 98, off_t) /* SEEK_HOLE = */ >>>> +struct fiobmap2_arg { >>>> + int64_t bn; >>>> + int runp; >>>> + int runb; >>>> +}; >>> This structure has different layout for LP64 and ILP32, and you did = not >>> provided the compat shims. >>=20 >> Really? How so? All of the fields have the same width on 64 and 32 >> bit archs, and there shouldn't be any need for padding, either. > Sorry, you are right. >=20 >>=20 >>>=20 >>>> +/* Get the file's bmap info for the logical block bn */ >>>> +#define FIOBMAP2 _IOWR('f', 99, struct fiobmap2_arg) >>>>=20 >>>> #ifdef _KERNEL >>>> #ifdef COMPAT_FREEBSD32 >>>>=20 >>>> Modified: head/sys/ufs/ufs/ufs_bmap.c >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/ufs/ufs/ufs_bmap.c Thu Jun 20 13:59:46 2019 = (r349230) >>>> +++ head/sys/ufs/ufs/ufs_bmap.c Thu Jun 20 14:13:10 2019 = (r349231) >>>> @@ -200,12 +200,15 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb) >>>> *bnp =3D blkptrtodb(ump, = ip->i_din2->di_extb[-1 - bn]); >>>> if (*bnp =3D=3D 0) >>>> *bnp =3D -1; >>>> - if (nbp =3D=3D NULL) >>>> - panic("ufs_bmaparray: mapping ext = data"); >>>> + if (nbp =3D=3D NULL) { >>>> + /* indirect block not found */ >>>> + return (EINVAL); >>>> + } >>> This (and next chunk) loose useful checks for in-kernel interfaces. >>=20 >> mckusick disagrees with you on this. He thought that changing the >> panics into errors was a good idea. Note that ufs_bmap was already >> capable of returning errors that not all callers check. > For user-callable code, this is of course the requirement. But for = in-kernel > use, IMO it makes the interfaces loose. I=E2=80=99m firmly in agreement on changing panics into errors. When = callers are encountered that don=E2=80=99t properly check and propagate the errors, = they should be fixed too. I=E2=80=99m not saying that it=E2=80=99s an easy = process and that we should just delete all panics, but it=E2=80=99s a goal that should be = vigorously pursued. Scott From owner-svn-src-head@freebsd.org Thu Jun 27 22:06:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 948B415CF806; Thu, 27 Jun 2019 22:06:42 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 30F7673603; Thu, 27 Jun 2019 22:06:42 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F422E1D831; Thu, 27 Jun 2019 22:06:41 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5RM6f89093235; Thu, 27 Jun 2019 22:06:41 GMT (envelope-from bcran@FreeBSD.org) Received: (from bcran@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RM6f52093234; Thu, 27 Jun 2019 22:06:41 GMT (envelope-from bcran@FreeBSD.org) Message-Id: <201906272206.x5RM6f52093234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcran set sender to bcran@FreeBSD.org using -f From: Rebecca Cran Date: Thu, 27 Jun 2019 22:06:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349471 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: bcran X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 349471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 30F7673603 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 22:06:42 -0000 Author: bcran Date: Thu Jun 27 22:06:41 2019 New Revision: 349471 URL: https://svnweb.freebsd.org/changeset/base/349471 Log: Increase EFI_STAGING_SIZE to 100MB on x64 To avoid failures when the large 18MB nvidia.ko module is being loaded, increase EFI_STAGING_SIZE from 64MB to 100MB on x64 systems. Leave the other platforms at 64MB. Modified: head/stand/efi/loader/copy.c Modified: head/stand/efi/loader/copy.c ============================================================================== --- head/stand/efi/loader/copy.c Thu Jun 27 21:45:40 2019 (r349470) +++ head/stand/efi/loader/copy.c Thu Jun 27 22:06:41 2019 (r349471) @@ -176,7 +176,11 @@ out: #endif /* __i386__ || __amd64__ */ #ifndef EFI_STAGING_SIZE +#if defined(__amd64__) +#define EFI_STAGING_SIZE 100 +#else #define EFI_STAGING_SIZE 64 +#endif #endif EFI_PHYSICAL_ADDRESS staging, staging_end; From owner-svn-src-head@freebsd.org Thu Jun 27 22:18:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C394015CFAC6; Thu, 27 Jun 2019 22:18:22 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6919E73C3B; Thu, 27 Jun 2019 22:18:22 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41D6E1DA17; Thu, 27 Jun 2019 22:18:22 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5RMIMxt098628; Thu, 27 Jun 2019 22:18:22 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RMIMKY098627; Thu, 27 Jun 2019 22:18:22 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201906272218.x5RMIMKY098627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 27 Jun 2019 22:18:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349472 - head/sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/dev/gpio X-SVN-Commit-Revision: 349472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6919E73C3B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 22:18:22 -0000 Author: lwhsu Date: Thu Jun 27 22:18:21 2019 New Revision: 349472 URL: https://svnweb.freebsd.org/changeset/base/349472 Log: Follow r349460 to complete removing "flags" in struct gpiobus_ivar MFC with: r349460 Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/gpio/ofw_gpiobus.c Modified: head/sys/dev/gpio/ofw_gpiobus.c ============================================================================== --- head/sys/dev/gpio/ofw_gpiobus.c Thu Jun 27 22:06:41 2019 (r349471) +++ head/sys/dev/gpio/ofw_gpiobus.c Thu Jun 27 22:18:21 2019 (r349472) @@ -321,10 +321,8 @@ ofw_gpiobus_setup_devinfo(device_t bus, device_t child ofw_gpiobus_destroy_devinfo(bus, dinfo); return (NULL); } - for (i = 0; i < devi->npins; i++) { - devi->flags[i] = pins[i].flags; + for (i = 0; i < devi->npins; i++) devi->pins[i] = pins[i].pin; - } free(pins, M_DEVBUF); /* Parse the interrupt resources. */ if (ofw_bus_intr_to_rl(bus, node, &dinfo->opd_dinfo.rl, NULL) != 0) { From owner-svn-src-head@freebsd.org Thu Jun 27 22:34:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6713015D0227; Thu, 27 Jun 2019 22:34:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0C91B74BB6; Thu, 27 Jun 2019 22:34:06 +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 DBBD51DDCE; Thu, 27 Jun 2019 22:34:05 +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 x5RMY52D009148; Thu, 27 Jun 2019 22:34:05 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RMY5DP009147; Thu, 27 Jun 2019 22:34:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201906272234.x5RMY5DP009147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 27 Jun 2019 22:34:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349474 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 349474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0C91B74BB6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 22:34:06 -0000 Author: jhb Date: Thu Jun 27 22:34:05 2019 New Revision: 349474 URL: https://svnweb.freebsd.org/changeset/base/349474 Log: Reject attempts to register a TCP stack being unloaded. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20617 Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Thu Jun 27 22:24:56 2019 (r349473) +++ head/sys/netinet/tcp_subr.c Thu Jun 27 22:34:05 2019 (r349474) @@ -798,8 +798,12 @@ register_tcp_functions_as_names(struct tcp_function_bl } } + if (blk->tfb_flags & TCP_FUNC_BEING_REMOVED) { + *num_names = 0; + return (EINVAL); + } + refcount_init(&blk->tfb_refcnt, 0); - blk->tfb_flags = 0; blk->tfb_id = atomic_fetchadd_int(&next_tcp_stack_id, 1); for (i = 0; i < *num_names; i++) { n = malloc(sizeof(struct tcp_function), M_TCPFUNCTIONS, wait); From owner-svn-src-head@freebsd.org Thu Jun 27 22:50:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B9D615D063C; Thu, 27 Jun 2019 22:50:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D417E751B7; Thu, 27 Jun 2019 22:50:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FF321DFA1; Thu, 27 Jun 2019 22:50:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5RMoBh3014581; Thu, 27 Jun 2019 22:50:11 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RMoBmk014580; Thu, 27 Jun 2019 22:50:11 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201906272250.x5RMoBmk014580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 27 Jun 2019 22:50:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349475 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D417E751B7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 22:50:12 -0000 Author: jhb Date: Thu Jun 27 22:50:11 2019 New Revision: 349475 URL: https://svnweb.freebsd.org/changeset/base/349475 Log: Fix comment in sofree() to reference sbdestroy(). r160875 added sbdestroy() as a wrapper around sbrelease_internal to be called from sofree(), yet the comment added in the same revision to sofree() still mentions sbrelease_internal(). Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20488 Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Thu Jun 27 22:34:05 2019 (r349474) +++ head/sys/kern/uipc_socket.c Thu Jun 27 22:50:11 2019 (r349475) @@ -1044,7 +1044,7 @@ sofree(struct socket *so) * * We used to do a lot of socket buffer and socket locking here, as * well as invoke sorflush() and perform wakeups. The direct call to - * dom_dispose() and sbrelease_internal() are an inlining of what was + * dom_dispose() and sbdestroy() are an inlining of what was * necessary from sorflush(). * * Notice that the socket buffer and kqueue state are torn down From owner-svn-src-head@freebsd.org Thu Jun 27 23:10:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C73F515D0E4C; Thu, 27 Jun 2019 23:10:41 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D63D75CC6; Thu, 27 Jun 2019 23:10:41 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A6001E376; Thu, 27 Jun 2019 23:10:41 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5RNAf4Y027391; Thu, 27 Jun 2019 23:10:41 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RNAes5027389; Thu, 27 Jun 2019 23:10:40 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201906272310.x5RNAes5027389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 27 Jun 2019 23:10:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349476 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 349476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6D63D75CC6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 23:10:42 -0000 Author: rmacklem Date: Thu Jun 27 23:10:40 2019 New Revision: 349476 URL: https://svnweb.freebsd.org/changeset/base/349476 Log: Add non-blocking trylock variants for the rangelock functions. A future patch that will add a Linux compatible copy_file_range(2) syscall needs to be able to lock the byte ranges of two files concurrently. To do this without a risk of deadlock, a non-blocking variant of vn_rangelock_rlock() called vn_rangelock_tryrlock() was needed. This patch adds this, along with vn_rangelock_trywlock(), in order to do this. The patch also adds a couple of comments, that I hope clarify how the algorithm used in kern_rangelock.c works. Reviewed by: kib, asomers (previous version) Differential Revision: https://reviews.freebsd.org/D20645 Modified: head/sys/kern/kern_rangelock.c head/sys/sys/rangelock.h head/sys/sys/vnode.h Modified: head/sys/kern/kern_rangelock.c ============================================================================== --- head/sys/kern/kern_rangelock.c Thu Jun 27 22:50:11 2019 (r349475) +++ head/sys/kern/kern_rangelock.c Thu Jun 27 23:10:40 2019 (r349476) @@ -141,15 +141,33 @@ out: static void rangelock_unlock_locked(struct rangelock *lock, struct rl_q_entry *entry, - struct mtx *ilk) + struct mtx *ilk, bool do_calc_block) { MPASS(lock != NULL && entry != NULL && ilk != NULL); mtx_assert(ilk, MA_OWNED); - KASSERT(entry != lock->rl_currdep, ("stuck currdep")); + if (!do_calc_block) { + /* + * This is the case where rangelock_enqueue() has been called + * with trylock == true and just inserted this entry in the + * queue. + * If rl_currdep is this entry, rl_currdep needs to + * be set to the next entry in the rl_waiters list. + * However, since this entry is the last entry in the + * list, the next entry is NULL. + */ + if (lock->rl_currdep == entry) { + KASSERT(TAILQ_NEXT(lock->rl_currdep, rl_q_link) == NULL, + ("rangelock_enqueue: next entry not NULL")); + lock->rl_currdep = NULL; + } + } else + KASSERT(entry != lock->rl_currdep, ("stuck currdep")); + TAILQ_REMOVE(&lock->rl_waiters, entry, rl_q_link); - rangelock_calc_block(lock); + if (do_calc_block) + rangelock_calc_block(lock); mtx_unlock(ilk); if (curthread->td_rlqe == NULL) curthread->td_rlqe = entry; @@ -164,7 +182,7 @@ rangelock_unlock(struct rangelock *lock, void *cookie, MPASS(lock != NULL && cookie != NULL && ilk != NULL); mtx_lock(ilk); - rangelock_unlock_locked(lock, cookie, ilk); + rangelock_unlock_locked(lock, cookie, ilk, true); } /* @@ -185,7 +203,7 @@ rangelock_unlock_range(struct rangelock *lock, void *c mtx_lock(ilk); if (entry->rl_q_end == end) { - rangelock_unlock_locked(lock, cookie, ilk); + rangelock_unlock_locked(lock, cookie, ilk, true); return (NULL); } entry->rl_q_end = end; @@ -196,11 +214,11 @@ rangelock_unlock_range(struct rangelock *lock, void *c /* * Add the lock request to the queue of the pending requests for - * rangelock. Sleep until the request can be granted. + * rangelock. Sleep until the request can be granted unless trylock == true. */ static void * rangelock_enqueue(struct rangelock *lock, off_t start, off_t end, int mode, - struct mtx *ilk) + struct mtx *ilk, bool trylock) { struct rl_q_entry *entry; struct thread *td; @@ -226,11 +244,28 @@ rangelock_enqueue(struct rangelock *lock, off_t start, */ TAILQ_INSERT_TAIL(&lock->rl_waiters, entry, rl_q_link); + /* + * If rl_currdep == NULL, there is no entry waiting for a conflicting + * range to be resolved, so set rl_currdep to this entry. If there is + * no conflicting entry for this entry, rl_currdep will be set back to + * NULL by rangelock_calc_block(). + */ if (lock->rl_currdep == NULL) lock->rl_currdep = entry; rangelock_calc_block(lock); - while (!(entry->rl_q_flags & RL_LOCK_GRANTED)) + while (!(entry->rl_q_flags & RL_LOCK_GRANTED)) { + if (trylock) { + /* + * For this case, the range is not actually locked + * yet, but removal from the list requires the same + * steps, except for not doing a rangelock_calc_block() + * call, since rangelock_calc_block() was called above. + */ + rangelock_unlock_locked(lock, entry, ilk, false); + return (NULL); + } msleep(entry, ilk, 0, "range", 0); + } mtx_unlock(ilk); return (entry); } @@ -239,12 +274,28 @@ void * rangelock_rlock(struct rangelock *lock, off_t start, off_t end, struct mtx *ilk) { - return (rangelock_enqueue(lock, start, end, RL_LOCK_READ, ilk)); + return (rangelock_enqueue(lock, start, end, RL_LOCK_READ, ilk, false)); } void * +rangelock_tryrlock(struct rangelock *lock, off_t start, off_t end, + struct mtx *ilk) +{ + + return (rangelock_enqueue(lock, start, end, RL_LOCK_READ, ilk, true)); +} + +void * rangelock_wlock(struct rangelock *lock, off_t start, off_t end, struct mtx *ilk) { - return (rangelock_enqueue(lock, start, end, RL_LOCK_WRITE, ilk)); + return (rangelock_enqueue(lock, start, end, RL_LOCK_WRITE, ilk, false)); +} + +void * +rangelock_trywlock(struct rangelock *lock, off_t start, off_t end, + struct mtx *ilk) +{ + + return (rangelock_enqueue(lock, start, end, RL_LOCK_WRITE, ilk, true)); } Modified: head/sys/sys/rangelock.h ============================================================================== --- head/sys/sys/rangelock.h Thu Jun 27 22:50:11 2019 (r349475) +++ head/sys/sys/rangelock.h Thu Jun 27 23:10:40 2019 (r349476) @@ -75,7 +75,11 @@ void *rangelock_unlock_range(struct rangelock *lock, v off_t start, off_t end, struct mtx *ilk); void *rangelock_rlock(struct rangelock *lock, off_t start, off_t end, struct mtx *ilk); +void *rangelock_tryrlock(struct rangelock *lock, off_t start, off_t end, + struct mtx *ilk); void *rangelock_wlock(struct rangelock *lock, off_t start, off_t end, + struct mtx *ilk); +void *rangelock_trywlock(struct rangelock *lock, off_t start, off_t end, struct mtx *ilk); void rlqentry_free(struct rl_q_entry *rlqe); Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Thu Jun 27 22:50:11 2019 (r349475) +++ head/sys/sys/vnode.h Thu Jun 27 23:10:40 2019 (r349476) @@ -720,8 +720,12 @@ int vn_io_fault_pgmove(vm_page_t ma[], vm_offset_t off VI_MTX(vp)) #define vn_rangelock_rlock(vp, start, end) \ rangelock_rlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) +#define vn_rangelock_tryrlock(vp, start, end) \ + rangelock_tryrlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) #define vn_rangelock_wlock(vp, start, end) \ rangelock_wlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) +#define vn_rangelock_trywlock(vp, start, end) \ + rangelock_trywlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) int vfs_cache_lookup(struct vop_lookup_args *ap); void vfs_timestamp(struct timespec *); From owner-svn-src-head@freebsd.org Thu Jun 27 23:37:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C067B15D1A9B; Thu, 27 Jun 2019 23:37:10 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6435A76D88; Thu, 27 Jun 2019 23:37:10 +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 0A2441E882; Thu, 27 Jun 2019 23:37:10 +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 x5RNb9K9040446; Thu, 27 Jun 2019 23:37:09 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RNb9Yx040445; Thu, 27 Jun 2019 23:37:09 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201906272337.x5RNb9Yx040445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 27 Jun 2019 23:37:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349477 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 349477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6435A76D88 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 23:37:10 -0000 Author: asomers Date: Thu Jun 27 23:37:09 2019 New Revision: 349477 URL: https://svnweb.freebsd.org/changeset/base/349477 Log: [skip ci] VOP_BMAP.9: fix diction in copyright header MFC after: 2 weeks MFC-With: r349230 Sponsored by: The FreeBSD Foundation Modified: head/share/man/man9/VOP_BMAP.9 Modified: head/share/man/man9/VOP_BMAP.9 ============================================================================== --- head/share/man/man9/VOP_BMAP.9 Thu Jun 27 23:10:40 2019 (r349476) +++ head/share/man/man9/VOP_BMAP.9 Thu Jun 27 23:37:09 2019 (r349477) @@ -3,8 +3,8 @@ .\" .\" Copyright (c) 2019 The FreeBSD Foundation .\" -.\" This software was developed by BFF Storage Systems, LLC under sponsorship -.\" from the FreeBSD Foundation. +.\" This documentation was written by BFF Storage Systems, LLC under +.\" sponsorship from the FreeBSD Foundation. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions From owner-svn-src-head@freebsd.org Thu Jun 27 23:39:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 643B615D1C14; Thu, 27 Jun 2019 23:39:08 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A99F76F8A; Thu, 27 Jun 2019 23:39:07 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 411741E883; Thu, 27 Jun 2019 23:39:07 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5RNd7uM040563; Thu, 27 Jun 2019 23:39:07 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RNd7nx040562; Thu, 27 Jun 2019 23:39:07 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201906272339.x5RNd7nx040562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 27 Jun 2019 23:39:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349478 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6A99F76F8A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2019 23:39:08 -0000 Author: asomers Date: Thu Jun 27 23:39:06 2019 New Revision: 349478 URL: https://svnweb.freebsd.org/changeset/base/349478 Log: FIOBMAP2: inline vn_ioc_bmap2 Reported by: kib Reviewed by: kib MFC after: 2 weeks MFC-With: 349238 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20783 Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Thu Jun 27 23:37:09 2019 (r349477) +++ head/sys/kern/vfs_vnops.c Thu Jun 27 23:39:06 2019 (r349478) @@ -1457,25 +1457,6 @@ vn_stat(struct vnode *vp, struct stat *sb, struct ucre return (0); } -/* generic FIOBMAP2 implementation */ -static int -vn_ioc_bmap2(struct file *fp, struct fiobmap2_arg *arg, struct ucred *cred) -{ - struct vnode *vp = fp->f_vnode; - daddr_t lbn = arg->bn; - int error; - - vn_lock(vp, LK_SHARED | LK_RETRY); -#ifdef MAC - error = mac_vnode_check_read(cred, fp->f_cred, vp); - if (error == 0) -#endif - error = VOP_BMAP(vp, lbn, NULL, &arg->bn, &arg->runp, - &arg->runb); - VOP_UNLOCK(vp, 0); - return (error); -} - /* * File table vnode ioctl routine. */ @@ -1485,6 +1466,7 @@ vn_ioctl(struct file *fp, u_long com, void *data, stru { struct vattr vattr; struct vnode *vp; + struct fiobmap2_arg *bmarg; int error; vp = fp->f_vnode; @@ -1500,8 +1482,17 @@ vn_ioctl(struct file *fp, u_long com, void *data, stru *(int *)data = vattr.va_size - fp->f_offset; return (error); case FIOBMAP2: - return (vn_ioc_bmap2(fp, (struct fiobmap2_arg*)data, - active_cred)); + bmarg = (struct fiobmap2_arg *)data; + vn_lock(vp, LK_SHARED | LK_RETRY); +#ifdef MAC + error = mac_vnode_check_read(active_cred, fp->f_cred, + vp); + if (error == 0) +#endif + error = VOP_BMAP(vp, bmarg->bn, NULL, + &bmarg->bn, &bmarg->runp, &bmarg->runb); + VOP_UNLOCK(vp, 0); + return (error); case FIONBIO: case FIOASYNC: return (0); From owner-svn-src-head@freebsd.org Fri Jun 28 00:03:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2456115D2A03; Fri, 28 Jun 2019 00:03:30 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA39E80064; Fri, 28 Jun 2019 00:03:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 961B91EDA1; Fri, 28 Jun 2019 00:03:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5S03TVg056292; Fri, 28 Jun 2019 00:03:29 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5S03TA0056291; Fri, 28 Jun 2019 00:03:29 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201906280003.x5S03TA0056291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 28 Jun 2019 00:03:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349481 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 349481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BA39E80064 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 00:03:30 -0000 Author: mhorne Date: Fri Jun 28 00:03:29 2019 New Revision: 349481 URL: https://svnweb.freebsd.org/changeset/base/349481 Log: Add some missing RISC-V ELF defines This adds defines for the RISC-V specific e_flags values, and some of the missing static relocations. Reviewed by: markj Approved by: markj (mentor) Differential Revision: https://reviews.freebsd.org/D20766 Modified: head/sys/sys/elf_common.h Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Fri Jun 28 00:00:02 2019 (r349480) +++ head/sys/sys/elf_common.h Fri Jun 28 00:03:29 2019 (r349481) @@ -369,6 +369,15 @@ typedef struct { #define EF_PPC_RELOCATABLE 0x00010000 #define EF_PPC_RELOCATABLE_LIB 0x00008000 +#define EF_RISCV_RVC 0x00000001 +#define EF_RISCV_FLOAT_ABI_MASK 0x00000006 +#define EF_RISCV_FLOAT_ABI_SOFT 0x00000000 +#define EF_RISCV_FLOAT_ABI_SINGLE 0x000002 +#define EF_RISCV_FLOAT_ABI_DOUBLE 0x000004 +#define EF_RISCV_FLOAT_ABI_QUAD 0x00000006 +#define EF_RISCV_RVE 0x00000008 +#define EF_RISCV_TSO 0x00000010 + #define EF_SPARC_EXT_MASK 0x00ffff00 #define EF_SPARC_32PLUS 0x00000100 #define EF_SPARC_SUN_US1 0x00000200 @@ -1310,6 +1319,17 @@ typedef struct { #define R_RISCV_ALIGN 43 #define R_RISCV_RVC_BRANCH 44 #define R_RISCV_RVC_JUMP 45 +#define R_RISCV_RVC_LUI 46 +#define R_RISCV_GPREL_I 47 +#define R_RISCV_GPREL_S 48 +#define R_RISCV_TPREL_I 49 +#define R_RISCV_TPREL_S 50 +#define R_RISCV_RELAX 51 +#define R_RISCV_SUB6 52 +#define R_RISCV_SET6 53 +#define R_RISCV_SET8 54 +#define R_RISCV_SET16 55 +#define R_RISCV_SET32 56 #define R_SPARC_NONE 0 #define R_SPARC_8 1 From owner-svn-src-head@freebsd.org Fri Jun 28 00:10:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E807915D2B7A; Fri, 28 Jun 2019 00:10:27 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 86B1D8023D; Fri, 28 Jun 2019 00:10:27 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73B741EDAC; Fri, 28 Jun 2019 00:10:27 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5S0ARjY056621; Fri, 28 Jun 2019 00:10:27 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5S0ARLh056619; Fri, 28 Jun 2019 00:10:27 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201906280010.x5S0ARLh056619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 28 Jun 2019 00:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349482 - in head/contrib/elftoolchain: common readelf X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: in head/contrib/elftoolchain: common readelf X-SVN-Commit-Revision: 349482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 86B1D8023D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 00:10:28 -0000 Author: mhorne Date: Fri Jun 28 00:10:26 2019 New Revision: 349482 URL: https://svnweb.freebsd.org/changeset/base/349482 Log: readelf: Add support for RISC-V specific e_flags Reviewed by: markj Approved by: markj (mentor) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D20767 Modified: head/contrib/elftoolchain/common/elfdefinitions.h head/contrib/elftoolchain/readelf/readelf.c Modified: head/contrib/elftoolchain/common/elfdefinitions.h ============================================================================== --- head/contrib/elftoolchain/common/elfdefinitions.h Fri Jun 28 00:03:29 2019 (r349481) +++ head/contrib/elftoolchain/common/elfdefinitions.h Fri Jun 28 00:10:26 2019 (r349482) @@ -33,7 +33,7 @@ * See: http://www.sco.com/developers/gabi/latest/ch4.intro.html * - The May 1998 (version 1.5) draft of "The ELF-64 object format". * - Processor-specific ELF ABI definitions for sparc, i386, amd64, mips, - * ia64, and powerpc processors. + * ia64, powerpc, and RISC-V processors. * - The "Linkers and Libraries Guide", from Sun Microsystems. */ @@ -426,6 +426,22 @@ _ELF_DEFINE_EF(EF_PPC_RELOCATABLE, 0x00010000UL, \ "-mrelocatable flag") \ _ELF_DEFINE_EF(EF_PPC_RELOCATABLE_LIB, 0x00008000UL, \ "-mrelocatable-lib flag") \ +_ELF_DEFINE_EF(EF_RISCV_RVC, 0x00000001UL, \ + "Compressed instruction extension") \ +_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_MASK, 0x00000006UL, \ + "Floating point ABI") \ +_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_SOFT, 0x00000000UL, \ + "Software emulated floating point") \ +_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_SINGLE, 0x00000002UL, \ + "Single precision floating point") \ +_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_DOUBLE, 0x00000004UL, \ + "Double precision floating point") \ +_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_QUAD, 0x00000006UL, \ + "Quad precision floating point") \ +_ELF_DEFINE_EF(EF_RISCV_RVE, 0x00000008UL, \ + "Compressed instruction ABI") \ +_ELF_DEFINE_EF(EF_RISCV_TSO, 0x00000010UL, \ + "RVTSO memory consistency model") \ _ELF_DEFINE_EF(EF_SPARC_EXT_MASK, 0x00ffff00UL, \ "Vendor Extension mask") \ _ELF_DEFINE_EF(EF_SPARC_32PLUS, 0x00000100UL, \ Modified: head/contrib/elftoolchain/readelf/readelf.c ============================================================================== --- head/contrib/elftoolchain/readelf/readelf.c Fri Jun 28 00:03:29 2019 (r349481) +++ head/contrib/elftoolchain/readelf/readelf.c Fri Jun 28 00:10:26 2019 (r349482) @@ -431,6 +431,13 @@ static struct eflags_desc powerpc_eflags_desc[] = { {0, NULL} }; +static struct eflags_desc riscv_eflags_desc[] = { + {EF_RISCV_RVC, "RVC"}, + {EF_RISCV_RVE, "RVE"}, + {EF_RISCV_TSO, "TSO"}, + {0, NULL} +}; + static struct eflags_desc sparc_eflags_desc[] = { {EF_SPARC_32PLUS, "v8+"}, {EF_SPARC_SUN_US1, "ultrasparcI"}, @@ -2293,6 +2300,23 @@ dump_eflags(struct readelf *re, uint64_t e_flags) case EM_PPC: case EM_PPC64: edesc = powerpc_eflags_desc; + break; + case EM_RISCV: + switch (e_flags & EF_RISCV_FLOAT_ABI_MASK) { + case EF_RISCV_FLOAT_ABI_SOFT: + printf(", soft-float ABI"); + break; + case EF_RISCV_FLOAT_ABI_SINGLE: + printf(", single-float ABI"); + break; + case EF_RISCV_FLOAT_ABI_DOUBLE: + printf(", double-float ABI"); + break; + case EF_RISCV_FLOAT_ABI_QUAD: + printf(", quad-float ABI"); + break; + } + edesc = riscv_eflags_desc; break; case EM_SPARC: case EM_SPARC32PLUS: From owner-svn-src-head@freebsd.org Fri Jun 28 00:14:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 135C315D2DFF; Fri, 28 Jun 2019 00:14:14 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 77B2C80664; Fri, 28 Jun 2019 00:14:13 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BF161EF4F; Fri, 28 Jun 2019 00:14:13 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5S0EDhP061578; Fri, 28 Jun 2019 00:14:13 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5S0ECxH061576; Fri, 28 Jun 2019 00:14:12 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201906280014.x5S0ECxH061576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 28 Jun 2019 00:14:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349483 - head/contrib/elftoolchain/libelftc X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/contrib/elftoolchain/libelftc X-SVN-Commit-Revision: 349483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 77B2C80664 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 00:14:14 -0000 Author: mhorne Date: Fri Jun 28 00:14:12 2019 New Revision: 349483 URL: https://svnweb.freebsd.org/changeset/base/349483 Log: libelftc: add RISC-V bfd targets This adds the following targets: elf32-riscv, elf64-riscv, elf64-riscv-freebsd Reviewed by: emaste, markj, jkoshy@users.sourceforge.net Approved by: markj (mentor) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D20768 Modified: head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Modified: head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 ============================================================================== --- head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Fri Jun 28 00:10:26 2019 (r349482) +++ head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Fri Jun 28 00:14:12 2019 (r349483) @@ -76,6 +76,9 @@ Known descriptor names and their properties include: .It Li elf32-powerpc Ta ELF Ta MSB Ta 32 .It Li elf32-powerpc-freebsd Ta ELF Ta MSB Ta 32 .It Li elf32-powerpcle Ta ELF Ta LSB Ta 32 +.It Li elf32-riscv Ta ELF Ta LSB Ta 32 +.It Li elf64-riscv Ta ELF Ta LSB Ta 64 +.It Li elf64-riscv-freebsd Ta ELF Ta LSB Ta 64 .It Li elf32-sh Ta ELF Ta MSB Ta 32 .It Li elf32-shl Ta ELF Ta LSB Ta 32 .It Li elf32-sh-nbsd Ta ELF Ta MSB Ta 32 Modified: head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c ============================================================================== --- head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Fri Jun 28 00:10:26 2019 (r349482) +++ head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Fri Jun 28 00:14:12 2019 (r349483) @@ -316,6 +316,31 @@ struct _Elftc_Bfd_Target _libelftc_targets[] = { }, { + .bt_name = "elf32-riscv", + .bt_type = ETF_ELF, + .bt_byteorder = ELFDATA2LSB, + .bt_elfclass = ELFCLASS32, + .bt_machine = EM_RISCV, + }, + + { + .bt_name = "elf64-riscv", + .bt_type = ETF_ELF, + .bt_byteorder = ELFDATA2LSB, + .bt_elfclass = ELFCLASS64, + .bt_machine = EM_RISCV, + }, + + { + .bt_name = "elf64-riscv-freebsd", + .bt_type = ETF_ELF, + .bt_byteorder = ELFDATA2MSB, + .bt_elfclass = ELFCLASS64, + .bt_machine = EM_RISCV, + .bt_osabi = ELFOSABI_FREEBSD, + }, + + { .bt_name = "elf64-sh64", .bt_type = ETF_ELF, .bt_byteorder = ELFDATA2MSB, From owner-svn-src-head@freebsd.org Fri Jun 28 01:17:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7C1115D436F; Fri, 28 Jun 2019 01:17:34 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5576F829D6; Fri, 28 Jun 2019 01:17:34 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37F3A1F988; Fri, 28 Jun 2019 01:17:34 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5S1HXhP093268; Fri, 28 Jun 2019 01:17:33 GMT (envelope-from bcran@FreeBSD.org) Received: (from bcran@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5S1HXfK093267; Fri, 28 Jun 2019 01:17:33 GMT (envelope-from bcran@FreeBSD.org) Message-Id: <201906280117.x5S1HXfK093267@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcran set sender to bcran@FreeBSD.org using -f From: Rebecca Cran Date: Fri, 28 Jun 2019 01:17:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349493 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: bcran X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 349493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5576F829D6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 01:17:34 -0000 Author: bcran Date: Fri Jun 28 01:17:33 2019 New Revision: 349493 URL: https://svnweb.freebsd.org/changeset/base/349493 Log: Add missing ACPI GICv2 MSI/MSI-X attachment This lets PCIe MSI-X device interrupts work on the MACCHIATObin (Marvell Armada 8k), which allows e.g. the Intel igb NIC to fully work. Submitted by: Greg V Reviewed by: mw, bcran Differential Revision: https://reviews.freebsd.org/D20775 Modified: head/sys/arm/arm/gic_acpi.c Modified: head/sys/arm/arm/gic_acpi.c ============================================================================== --- head/sys/arm/arm/gic_acpi.c Fri Jun 28 01:07:19 2019 (r349492) +++ head/sys/arm/arm/gic_acpi.c Fri Jun 28 01:17:33 2019 (r349493) @@ -331,9 +331,21 @@ arm_gicv2m_acpi_probe(device_t dev) return (BUS_PROBE_DEFAULT); } +static int +arm_gicv2m_acpi_attach(device_t dev) +{ + struct arm_gicv2m_softc *sc; + + sc = device_get_softc(dev); + sc->sc_xref = ACPI_MSI_XREF; + + return (arm_gicv2m_attach(dev)); +} + static device_method_t arm_gicv2m_acpi_methods[] = { /* Device interface */ DEVMETHOD(device_probe, arm_gicv2m_acpi_probe), + DEVMETHOD(device_attach, arm_gicv2m_acpi_attach), /* End */ DEVMETHOD_END From owner-svn-src-head@freebsd.org Fri Jun 28 01:19:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D229915D43FE; Fri, 28 Jun 2019 01:19:09 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5FD6682B53; Fri, 28 Jun 2019 01:19:09 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 397D71F998; Fri, 28 Jun 2019 01:19:09 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5S1J9T5093377; Fri, 28 Jun 2019 01:19:09 GMT (envelope-from bcran@FreeBSD.org) Received: (from bcran@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5S1J9xb093376; Fri, 28 Jun 2019 01:19:09 GMT (envelope-from bcran@FreeBSD.org) Message-Id: <201906280119.x5S1J9xb093376@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcran set sender to bcran@FreeBSD.org using -f From: Rebecca Cran Date: Fri, 28 Jun 2019 01:19:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349494 - head/sys/dev/uart X-SVN-Group: head X-SVN-Commit-Author: bcran X-SVN-Commit-Paths: head/sys/dev/uart X-SVN-Commit-Revision: 349494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5FD6682B53 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 01:19:10 -0000 Author: bcran Date: Fri Jun 28 01:19:08 2019 New Revision: 349494 URL: https://svnweb.freebsd.org/changeset/base/349494 Log: Add ACPI entries for Synopsys Designware UARTs used on ARM platforms This fixes (userspace) console on the Marvell MACCHIATObin in ACPI mode with latest TianoCore EDK2 firmware. Submitted by: Greg V Reviewed by: mw, bcran Differential Revision: https://reviews.freebsd.org/D20765 Modified: head/sys/dev/uart/uart_dev_ns8250.c Modified: head/sys/dev/uart/uart_dev_ns8250.c ============================================================================== --- head/sys/dev/uart/uart_dev_ns8250.c Fri Jun 28 01:17:33 2019 (r349493) +++ head/sys/dev/uart/uart_dev_ns8250.c Fri Jun 28 01:19:08 2019 (r349494) @@ -415,6 +415,9 @@ struct uart_class uart_ns8250_class = { static struct acpi_uart_compat_data acpi_compat_data[] = { {"AMD0020", &uart_ns8250_class, 0, 2, 0, 48000000, UART_F_BUSY_DETECT, "AMD / Synopsys Designware UART"}, {"AMDI0020", &uart_ns8250_class, 0, 2, 0, 48000000, UART_F_BUSY_DETECT, "AMD / Synopsys Designware UART"}, + {"MRVL0001", &uart_ns8250_class, 0, 2, 0, 200000000, UART_F_BUSY_DETECT, "Marvell / Synopsys Designware UART"}, + {"SCX0006", &uart_ns8250_class, 0, 2, 0, 62500000, UART_F_BUSY_DETECT, "SynQuacer / Synopsys Designware UART"}, + {"HISI0031", &uart_ns8250_class, 0, 2, 0, 200000000, UART_F_BUSY_DETECT, "HiSilicon / Synopsys Designware UART"}, {"PNP0500", &uart_ns8250_class, 0, 0, 0, 0, 0, "Standard PC COM port"}, {"PNP0501", &uart_ns8250_class, 0, 0, 0, 0, 0, "16550A-compatible COM port"}, {"PNP0502", &uart_ns8250_class, 0, 0, 0, 0, 0, "Multiport serial device (non-intelligent 16550)"}, From owner-svn-src-head@freebsd.org Fri Jun 28 02:14:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C55C15D53E3; Fri, 28 Jun 2019 02:14:55 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 01AC08458A; Fri, 28 Jun 2019 02:14:55 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8B9D20397; Fri, 28 Jun 2019 02:14:54 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5S2EsnM024676; Fri, 28 Jun 2019 02:14:54 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5S2EsME024675; Fri, 28 Jun 2019 02:14:54 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201906280214.x5S2EsME024675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Fri, 28 Jun 2019 02:14:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349498 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 349498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 01AC08458A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 02:14:55 -0000 Author: dougm Date: Fri Jun 28 02:14:54 2019 New Revision: 349498 URL: https://svnweb.freebsd.org/changeset/base/349498 Log: If vm_map_protect fails with KERN_RESOURCE_SHORTAGE, be sure to simplify modified entries before returning. Reviewed by: alc, markj (earlier version), kib (earlier version) Approved by: kib, markj (mentors, implicit) Differential Revision: https://reviews.freebsd.org/D20753 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Fri Jun 28 01:57:59 2019 (r349497) +++ head/sys/vm/vm_map.c Fri Jun 28 02:14:54 2019 (r349498) @@ -2454,6 +2454,7 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off vm_object_t obj; struct ucred *cred; vm_prot_t old_prot; + int rv; if (start == end) return (KERN_SUCCESS); @@ -2508,10 +2509,13 @@ again: } /* - * Do an accounting pass for private read-only mappings that - * now will do cow due to allowed write (e.g. debugger sets - * breakpoint on text segment) + * Before changing the protections, try to reserve swap space for any + * private (i.e., copy-on-write) mappings that are transitioning from + * read-only to read/write access. If a reservation fails, break out + * of this loop early and let the next loop simplify the entries, since + * some may now be mergeable. */ + rv = KERN_SUCCESS; vm_map_clip_start(map, entry, start); for (current = entry; current->start < end; current = current->next) { @@ -2529,8 +2533,9 @@ again: if (obj == NULL || (current->eflags & MAP_ENTRY_NEEDS_COPY)) { if (!swap_reserve(current->end - current->start)) { - vm_map_unlock(map); - return (KERN_RESOURCE_SHORTAGE); + rv = KERN_RESOURCE_SHORTAGE; + end = current->end; + break; } crhold(cred); current->cred = cred; @@ -2553,8 +2558,9 @@ again: obj, current)); if (!swap_reserve(ptoa(obj->size))) { VM_OBJECT_WUNLOCK(obj); - vm_map_unlock(map); - return (KERN_RESOURCE_SHORTAGE); + rv = KERN_RESOURCE_SHORTAGE; + end = current->end; + break; } crhold(cred); @@ -2564,11 +2570,14 @@ again: } /* - * Go back and fix up protections. [Note that clipping is not - * necessary the second time.] + * If enough swap space was available, go back and fix up protections. + * Otherwise, just simplify entries, since some may have been modified. + * [Note that clipping is not necessary the second time.] */ - for (current = entry; current->start < end; current = current->next) { - if ((current->eflags & MAP_ENTRY_GUARD) != 0) + for (current = entry; current->start < end; + vm_map_simplify_entry(map, current), current = current->next) { + if (rv != KERN_SUCCESS || + (current->eflags & MAP_ENTRY_GUARD) != 0) continue; old_prot = current->protection; @@ -2603,10 +2612,9 @@ again: current->protection & MASK(current)); #undef MASK } - vm_map_simplify_entry(map, current); } vm_map_unlock(map); - return (KERN_SUCCESS); + return (rv); } /* From owner-svn-src-head@freebsd.org Fri Jun 28 02:21:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CFDF15D5633; Fri, 28 Jun 2019 02:21:50 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A8F5E84ABB; Fri, 28 Jun 2019 02:21:47 +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 759F1204FF; Fri, 28 Jun 2019 02:21:43 +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 x5S2LhE8029234; Fri, 28 Jun 2019 02:21:43 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5S2LhGN029232; Fri, 28 Jun 2019 02:21:43 GMT (envelope-from np@FreeBSD.org) Message-Id: <201906280221.x5S2LhGN029232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 28 Jun 2019 02:21:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349499 - head/sys/dev/cxgbe/iw_cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/iw_cxgbe X-SVN-Commit-Revision: 349499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A8F5E84ABB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 02:21:50 -0000 Author: np Date: Fri Jun 28 02:21:42 2019 New Revision: 349499 URL: https://svnweb.freebsd.org/changeset/base/349499 Log: cxgbe/iw_cxgbe: Remove unused field from the endpoint structure. MFC after: 3 days Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/cm.c Fri Jun 28 02:14:54 2019 (r349498) +++ head/sys/dev/cxgbe/iw_cxgbe/cm.c Fri Jun 28 02:21:42 2019 (r349499) @@ -528,7 +528,6 @@ set_tcpinfo(struct c4iw_ep *ep) ep->hwtid = toep->tid; ep->snd_seq = tp->snd_nxt; ep->rcv_seq = tp->rcv_nxt; - ep->emss = max(tp->t_maxseg, 128); done: INP_WUNLOCK(inp); return (rc); Modified: head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Fri Jun 28 02:14:54 2019 (r349498) +++ head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Fri Jun 28 02:21:42 2019 (r349499) @@ -862,7 +862,6 @@ struct c4iw_ep { u32 tx_chan; u32 mtu; u16 mss; - u16 emss; u16 plen; u16 rss_qid; u16 txq_idx; From owner-svn-src-head@freebsd.org Fri Jun 28 02:41:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 394DC15D5C83; Fri, 28 Jun 2019 02:41:19 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D39F0855B6; Fri, 28 Jun 2019 02:41:18 +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 AFF1D2071A; Fri, 28 Jun 2019 02:41:18 +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 x5S2fIlO038970; Fri, 28 Jun 2019 02:41:18 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5S2fIt3038967; Fri, 28 Jun 2019 02:41:18 GMT (envelope-from np@FreeBSD.org) Message-Id: <201906280241.x5S2fIt3038967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 28 Jun 2019 02:41:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349500 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 349500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D39F0855B6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 02:41:19 -0000 Author: np Date: Fri Jun 28 02:41:17 2019 New Revision: 349500 URL: https://svnweb.freebsd.org/changeset/base/349500 Log: cxgbe/t4_tom: Fix regression in t_maxseg usage within t4_tom. t_maxseg was changed in r293284 to not have any adjustment for TCP timestamps. t4_tom inadvertently went back to pre-r293284 semantics in r332506. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Jun 28 02:21:42 2019 (r349499) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Jun 28 02:41:17 2019 (r349500) @@ -327,31 +327,33 @@ send_reset(struct adapter *sc, struct toepcb *toep, ui * reported by HW to FreeBSD's native format. */ static void -assign_rxopt(struct tcpcb *tp, unsigned int opt) +assign_rxopt(struct tcpcb *tp, uint16_t opt) { struct toepcb *toep = tp->t_toe; struct inpcb *inp = tp->t_inpcb; struct adapter *sc = td_adapter(toep->td); - int n; INP_LOCK_ASSERT(inp); + toep->tcp_opt = opt; + toep->mtu_idx = G_TCPOPT_MSS(opt); + tp->t_maxseg = sc->params.mtus[toep->mtu_idx]; if (inp->inp_inc.inc_flags & INC_ISIPV6) - n = sizeof(struct ip6_hdr) + sizeof(struct tcphdr); + tp->t_maxseg -= sizeof(struct ip6_hdr) + sizeof(struct tcphdr); else - n = sizeof(struct ip) + sizeof(struct tcphdr); - tp->t_maxseg = sc->params.mtus[G_TCPOPT_MSS(opt)] - n; + tp->t_maxseg -= sizeof(struct ip) + sizeof(struct tcphdr); + toep->emss = tp->t_maxseg; if (G_TCPOPT_TSTAMP(opt)) { tp->t_flags |= TF_RCVD_TSTMP; /* timestamps ok */ tp->ts_recent = 0; /* hmmm */ tp->ts_recent_age = tcp_ts_getticks(); - tp->t_maxseg -= TCPOLEN_TSTAMP_APPA; + toep->emss -= TCPOLEN_TSTAMP_APPA; } - CTR5(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u), mss %u", __func__, - toep->tid, G_TCPOPT_MSS(opt), sc->params.mtus[G_TCPOPT_MSS(opt)], - tp->t_maxseg); + CTR6(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u), t_maxseg %u, emss %u", + __func__, toep->tid, toep->mtu_idx, + sc->params.mtus[G_TCPOPT_MSS(opt)], tp->t_maxseg, toep->emss); if (G_TCPOPT_SACK(opt)) tp->t_flags |= TF_SACK_PERMIT; /* should already be set */ @@ -399,7 +401,7 @@ make_established(struct toepcb *toep, uint32_t iss, ui tp->irs = irs; tcp_rcvseqinit(tp); - tp->rcv_wnd = toep->opt0_rcv_bufsize << 10; + tp->rcv_wnd = (u_int)toep->opt0_rcv_bufsize << 10; tp->rcv_adv += tp->rcv_wnd; tp->last_ack_sent = tp->rcv_nxt; @@ -421,7 +423,7 @@ make_established(struct toepcb *toep, uint32_t iss, ui ftxp.snd_nxt = tp->snd_nxt; ftxp.rcv_nxt = tp->rcv_nxt; ftxp.snd_space = bufsize; - ftxp.mss = tp->t_maxseg; + ftxp.mss = toep->emss; send_flowc_wr(toep, &ftxp); soisconnected(so); @@ -613,7 +615,7 @@ write_tx_wr(void *dst, struct toepcb *toep, unsigned i if (txalign > 0) { struct tcpcb *tp = intotcpcb(toep->inp); - if (plen < 2 * tp->t_maxseg) + if (plen < 2 * toep->emss) txwr->lsodisable_to_flags |= htobe32(F_FW_OFLD_TX_DATA_WR_LSODISABLE); else Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Fri Jun 28 02:21:42 2019 (r349499) +++ head/sys/dev/cxgbe/tom/t4_tom.c Fri Jun 28 02:41:17 2019 (r349500) @@ -851,8 +851,7 @@ remove_tid(struct adapter *sc, int tid, int ntids) * What mtu_idx to use, given a 4-tuple. Note that both s->mss and tcp_mssopt * have the MSS that we should advertise in our SYN. Advertised MSS doesn't * account for any TCP options so the effective MSS (only payload, no headers or - * options) could be different. We fill up tp->t_maxseg with the effective MSS - * at the end of the 3-way handshake. + * options) could be different. */ int find_best_mtu_idx(struct adapter *sc, struct in_conninfo *inc, Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Fri Jun 28 02:21:42 2019 (r349499) +++ head/sys/dev/cxgbe/tom/t4_tom.h Fri Jun 28 02:41:17 2019 (r349500) @@ -181,7 +181,10 @@ struct toepcb { u_int tx_nocompl; /* tx WR credits since last compl request */ u_int plen_nocompl; /* payload since last compl request */ - int opt0_rcv_bufsize; /* XXX: save full opt0/opt2 for later? */ + uint16_t opt0_rcv_bufsize; /* XXX: save full opt0/opt2 for later? */ + uint16_t mtu_idx; + uint16_t emss; + uint16_t tcp_opt; u_int ulp_mode; /* ULP mode */ void *ulpcb; From owner-svn-src-head@freebsd.org Fri Jun 28 04:02:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02DFE15D721F; Fri, 28 Jun 2019 04:02: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9934F87C0C; Fri, 28 Jun 2019 04:02: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 463462168C; Fri, 28 Jun 2019 04:02: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 x5S42vZP083701; Fri, 28 Jun 2019 04:02:57 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5S42vnm083699; Fri, 28 Jun 2019 04:02:57 GMT (envelope-from np@FreeBSD.org) Message-Id: <201906280402.x5S42vnm083699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 28 Jun 2019 04:02:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349501 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 349501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9934F87C0C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.921,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 04:02:58 -0000 Author: np Date: Fri Jun 28 04:02:56 2019 New Revision: 349501 URL: https://svnweb.freebsd.org/changeset/base/349501 Log: cxgbe/t4_tom: Mark the socket's receive as done before calling handle_ddp_close. This eliminates a bad race where an aio_ddp_requeue that happened to run after handle_ddp_close could bump up the active count. Discussed with: jhb@ MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Jun 28 02:41:17 2019 (r349500) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Jun 28 04:02:56 2019 (r349501) @@ -1253,6 +1253,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head tp->rcv_nxt++; /* FIN */ so = inp->inp_socket; + socantrcvmore(so); if (toep->ulp_mode == ULP_MODE_TCPDDP) { DDP_LOCK(toep); if (__predict_false(toep->ddp.flags & @@ -1260,7 +1261,6 @@ do_peer_close(struct sge_iq *iq, const struct rss_head handle_ddp_close(toep, tp, cpl->rcv_nxt); DDP_UNLOCK(toep); } - socantrcvmore(so); if (toep->ulp_mode != ULP_MODE_RDMA) { KASSERT(tp->rcv_nxt == be32toh(cpl->rcv_nxt), From owner-svn-src-head@freebsd.org Fri Jun 28 04:28:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA0A915D7922; Fri, 28 Jun 2019 04:28:33 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 897F788853; Fri, 28 Jun 2019 04:28:33 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A79F219DE; Fri, 28 Jun 2019 04:28:33 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5S4SXSM094526; Fri, 28 Jun 2019 04:28:33 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5S4SXhf094525; Fri, 28 Jun 2019 04:28:33 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201906280428.x5S4SXhf094525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 28 Jun 2019 04:28:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349503 - head/contrib/ipfilter/man X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/contrib/ipfilter/man X-SVN-Commit-Revision: 349503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 897F788853 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 04:28:34 -0000 Author: cy Date: Fri Jun 28 04:28:32 2019 New Revision: 349503 URL: https://svnweb.freebsd.org/changeset/base/349503 Log: Document the -B, binary logfile, and the -C config file options. Reference the ipmon.5 man page and ipmon.conf. PR: 238816 MFC after: 1 week Modified: head/contrib/ipfilter/man/ipmon.8 Modified: head/contrib/ipfilter/man/ipmon.8 ============================================================================== --- head/contrib/ipfilter/man/ipmon.8 Fri Jun 28 04:18:10 2019 (r349502) +++ head/contrib/ipfilter/man/ipmon.8 Fri Jun 28 04:28:32 2019 (r349503) @@ -7,6 +7,10 @@ ipmon \- monitors /dev/ipl for logged packets [ .B \-abBDFhnpstvxX ] [ +.B "\-B " +] [ +.B "\-B " +] [ .B "\-N " ] [ .B "\-L " @@ -92,6 +96,10 @@ Enable logging of the raw, unformatted binary data to \fI\fP file. This can be read, later, using \fBipmon\fP with the \fB-f\fP option. .TP +.B \-C +This option specifies a file to be used to specify optional extra actions +when it sees specific log entries from the kernel. +.TP .B \-D Cause ipmon to turn itself into a daemon. Using subshells or backgrounding of ipmon is not required to turn it into an orphan so it can run indefinitely. @@ -178,9 +186,11 @@ recorded data. .br /dev/ipstate .br +/etc/ipmon.conf +.br /etc/services .SH SEE ALSO -ipl(4), ipf(8), ipfstat(8), ipnat(8) +ipl(4), ipmon(5), ipf(8), ipfstat(8), ipnat(8) .SH BUGS .PP If you find any, please send email to me at darrenr@pobox.com From owner-svn-src-head@freebsd.org Fri Jun 28 04:52:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 335C215D7E52; Fri, 28 Jun 2019 04:52:25 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C51D58928A; Fri, 28 Jun 2019 04:52:24 +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 828AA21EE3; Fri, 28 Jun 2019 04:52:24 +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 x5S4qOfA007687; Fri, 28 Jun 2019 04:52:24 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5S4qOpn007686; Fri, 28 Jun 2019 04:52:24 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201906280452.x5S4qOpn007686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 28 Jun 2019 04:52:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349504 - head/contrib/ipfilter/man X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/contrib/ipfilter/man X-SVN-Commit-Revision: 349504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C51D58928A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 04:52:25 -0000 Author: cy Date: Fri Jun 28 04:52:24 2019 New Revision: 349504 URL: https://svnweb.freebsd.org/changeset/base/349504 Log: Fix a typo. PR: 238816 MFC after: 1 week X-MFC with: r349503 Modified: head/contrib/ipfilter/man/ipmon.8 Modified: head/contrib/ipfilter/man/ipmon.8 ============================================================================== --- head/contrib/ipfilter/man/ipmon.8 Fri Jun 28 04:28:32 2019 (r349503) +++ head/contrib/ipfilter/man/ipmon.8 Fri Jun 28 04:52:24 2019 (r349504) @@ -9,7 +9,7 @@ ipmon \- monitors /dev/ipl for logged packets ] [ .B "\-B " ] [ -.B "\-B " +.B "\-C " ] [ .B "\-N " ] [ From owner-svn-src-head@freebsd.org Fri Jun 28 05:11:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 634FB15D8341; Fri, 28 Jun 2019 05:11:06 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 101FB89B57; Fri, 28 Jun 2019 05:11:06 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE9D822105; Fri, 28 Jun 2019 05:11:05 +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 x5S5B55Q019700; Fri, 28 Jun 2019 05:11:05 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5S5B25N019677; Fri, 28 Jun 2019 05:11:02 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201906280511.x5S5B25N019677@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 28 Jun 2019 05:11:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349505 - head/contrib/bzip2 X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/contrib/bzip2 X-SVN-Commit-Revision: 349505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 101FB89B57 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 05:11:06 -0000 Author: delphij Date: Fri Jun 28 05:11:02 2019 New Revision: 349505 URL: https://svnweb.freebsd.org/changeset/base/349505 Log: Upgrade to Bzip2 version 1.0.7. MFC after: 3 days Modified: head/contrib/bzip2/CHANGES head/contrib/bzip2/LICENSE head/contrib/bzip2/README head/contrib/bzip2/README.COMPILATION.PROBLEMS head/contrib/bzip2/blocksort.c head/contrib/bzip2/bzip2.1 head/contrib/bzip2/bzip2.c head/contrib/bzip2/bzip2recover.c head/contrib/bzip2/bzlib.c head/contrib/bzip2/bzlib.h head/contrib/bzip2/bzlib_private.h head/contrib/bzip2/compress.c head/contrib/bzip2/crctable.c head/contrib/bzip2/decompress.c head/contrib/bzip2/huffman.c head/contrib/bzip2/randtable.c head/contrib/bzip2/spewG.c head/contrib/bzip2/unzcrash.c head/contrib/bzip2/words2 Directory Properties: head/contrib/bzip2/ (props changed) Modified: head/contrib/bzip2/CHANGES ============================================================================== --- head/contrib/bzip2/CHANGES Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/CHANGES Fri Jun 28 05:11:02 2019 (r349505) @@ -2,8 +2,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward + bzip2/libbzip2 version 1.0.7 of 27 June 2019 + Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -325,3 +325,16 @@ Security fix only. Fixes CERT-FI 20469 as it applies Izdebski. * Make the documentation build on Ubuntu 10.04 + +1.0.7 (27 Jun 19) +~~~~~~~~~~~~~~~~~ + +* Fix undefined behavior in the macros SET_BH, CLEAR_BH, & ISSET_BH + +* bzip2: Fix return value when combining --test,-t and -q. + +* bzip2recover: Fix buffer overflow for large argv[0] + +* bzip2recover: Fix use after free issue with outFile (CVE-2016-3189) + +* Make sure nSelectors is not out of range (CVE-2019-12900) Modified: head/contrib/bzip2/LICENSE ============================================================================== --- head/contrib/bzip2/LICENSE Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/LICENSE Fri Jun 28 05:11:02 2019 (r349505) @@ -36,7 +36,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUD NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Julian Seward, jseward@bzip.org -bzip2/libbzip2 version 1.0.6 of 6 September 2010 +Julian Seward, jseward@acm.org +bzip2/libbzip2 version 1.0.7 of 27 June 2019 -------------------------------------------------------------------------- Modified: head/contrib/bzip2/README ============================================================================== --- head/contrib/bzip2/README Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/README Fri Jun 28 05:11:02 2019 (r349505) @@ -6,8 +6,8 @@ This version is fully compatible with the previous pub This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. -bzip2/libbzip2 version 1.0.6 of 6 September 2010 -Copyright (C) 1996-2010 Julian Seward +bzip2/libbzip2 version 1.0.7 of 27 June 2019 +Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in this file. @@ -73,7 +73,7 @@ HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc. It's difficult for me to support compilation on all these platforms. My approach is to collect binaries for these platforms, and put them -on the master web site (http://www.bzip.org). Look there. However +on the master web site (https://sourceware.org/bzip2/). Look there. However (FWIW), bzip2-1.0.X is very standard ANSI C and should compile unmodified with MS Visual C. If you have difficulties building, you might want to read README.COMPILATION.PROBLEMS. @@ -161,43 +161,22 @@ WHAT'S NEW IN 0.9.5 ? * Many small improvements in file and flag handling. * A Y2K statement. -WHAT'S NEW IN 1.0.0 ? +WHAT'S NEW IN 1.0.x ? See the CHANGES file. -WHAT'S NEW IN 1.0.2 ? - - See the CHANGES file. - -WHAT'S NEW IN 1.0.3 ? - - See the CHANGES file. - -WHAT'S NEW IN 1.0.4 ? - - See the CHANGES file. - -WHAT'S NEW IN 1.0.5 ? - - See the CHANGES file. - -WHAT'S NEW IN 1.0.6 ? - - See the CHANGES file. - - I hope you find bzip2 useful. Feel free to contact me at - jseward@bzip.org + jseward@acm.org if you have any suggestions or queries. Many people mailed me with comments, suggestions and patches after the releases of bzip-0.15, bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and 1.0.3, and the changes in bzip2 are largely a result of this feedback. I thank you for your comments. -bzip2's "home" is http://www.bzip.org/ +bzip2's "home" is https://sourceware.org/bzip2/ Julian Seward -jseward@bzip.org +jseward@acm.org Cambridge, UK. 18 July 1996 (version 0.15) @@ -213,3 +192,4 @@ Cambridge, UK. 20 December 2006 (bzip2, version 1.0.4) 10 December 2007 (bzip2, version 1.0.5) 6 Sept 2010 (bzip2, version 1.0.6) +27 June 2019 (bzip2, version 1.0.7) Modified: head/contrib/bzip2/README.COMPILATION.PROBLEMS ============================================================================== --- head/contrib/bzip2/README.COMPILATION.PROBLEMS Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/README.COMPILATION.PROBLEMS Fri Jun 28 05:11:02 2019 (r349505) @@ -2,8 +2,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. -bzip2/libbzip2 version 1.0.6 of 6 September 2010 -Copyright (C) 1996-2010 Julian Seward +bzip2/libbzip2 version 1.0.7 of 27 June 2019 +Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -12,7 +12,7 @@ This program is released under the terms of the licens in the file LICENSE. ------------------------------------------------------------------ -bzip2-1.0.6 should compile without problems on the vast majority of +bzip2 should compile without problems on the vast majority of platforms. Using the supplied Makefile, I've built and tested it myself for x86-linux and amd64-linux. With makefile.msc, Visual C++ 6.0 and nmake, you can build a native Win32 version too. Large file Modified: head/contrib/bzip2/blocksort.c ============================================================================== --- head/contrib/bzip2/blocksort.c Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/blocksort.c Fri Jun 28 05:11:02 2019 (r349505) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward + bzip2/libbzip2 version 1.0.7 of 27 June 2019 + Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -202,9 +202,9 @@ void fallbackQSort3 ( UInt32* fmap, bhtab [ 0 .. 2+(nblock/32) ] destroyed */ -#define SET_BH(zz) bhtab[(zz) >> 5] |= (1 << ((zz) & 31)) -#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31)) -#define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1 << ((zz) & 31))) +#define SET_BH(zz) bhtab[(zz) >> 5] |= ((UInt32)1 << ((zz) & 31)) +#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~((UInt32)1 << ((zz) & 31)) +#define ISSET_BH(zz) (bhtab[(zz) >> 5] & ((UInt32)1 << ((zz) & 31))) #define WORD_BH(zz) bhtab[(zz) >> 5] #define UNALIGNED_BH(zz) ((zz) & 0x01f) Modified: head/contrib/bzip2/bzip2.1 ============================================================================== --- head/contrib/bzip2/bzip2.1 Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/bzip2.1 Fri Jun 28 05:11:02 2019 (r349505) @@ -1,6 +1,6 @@ .TH bzip2 1 .SH NAME -bzip2, bunzip2 \- a block-sorting file compressor, v1.0.6 +bzip2, bunzip2 \- a block-sorting file compressor, v1.0.7 .br bzcat \- decompresses files to stdout .br @@ -404,7 +404,7 @@ I/O error messages are not as helpful as they could be tries hard to detect I/O errors and exit cleanly, but the details of what the problem is sometimes seem rather misleading. -This manual page pertains to version 1.0.6 of +This manual page pertains to version 1.0.7 of .I bzip2. Compressed data created by this version is entirely forwards and backwards compatible with the previous public releases, versions @@ -426,9 +426,9 @@ with MaybeUInt64 set to be an unsigned 64-bit integer. .SH AUTHOR -Julian Seward, jsewardbzip.org. +Julian Seward, jseward@acm.org. -http://www.bzip.org +https://sourceware.org/bzip2/ The ideas embodied in .I bzip2 Modified: head/contrib/bzip2/bzip2.c ============================================================================== --- head/contrib/bzip2/bzip2.c Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/bzip2.c Fri Jun 28 05:11:02 2019 (r349505) @@ -7,8 +7,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward + bzip2/libbzip2 version 1.0.7 of 27 June 2019 + Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -554,7 +554,7 @@ static Bool testStream ( FILE *zStream ) { BZFILE* bzf = NULL; - Int32 bzerr, bzerr_dummy, ret, nread, streamNo, i; + Int32 bzerr, bzerr_dummy, ret, streamNo, i; UChar obuf[5000]; UChar unused[BZ_MAX_UNUSED]; Int32 nUnused; @@ -577,7 +577,7 @@ Bool testStream ( FILE *zStream ) streamNo++; while (bzerr == BZ_OK) { - nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 ); + BZ2_bzRead ( &bzerr, bzf, obuf, 5000 ); if (bzerr == BZ_DATA_ERROR_MAGIC) goto errhandler; } if (bzerr != BZ_STREAM_END) goto errhandler; @@ -749,7 +749,7 @@ void panic ( const Char* s ) "\n%s: PANIC -- internal consistency error:\n" "\t%s\n" "\tThis is a BUG. Please report it to me at:\n" - "\tjseward@bzip.org\n", + "\tjseward@acm.org\n", progName, s ); showFileNames(); cleanUpAndFail( 3 ); @@ -829,7 +829,7 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n ) " The user's manual, Section 4.3, has more info on (1) and (2).\n" " \n" " If you suspect this is a bug in bzip2, or are unsure about (1)\n" - " or (2), feel free to report it to me at: jseward@bzip.org.\n" + " or (2), feel free to report it to me at: jseward@acm.org.\n" " Section 4.3 of the user's manual describes the info a useful\n" " bug report should have. If the manual is available on your\n" " system, please try and read it before mailing me. If you don't\n" @@ -852,7 +852,7 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n ) " The user's manual, Section 4.3, has more info on (2) and (3).\n" " \n" " If you suspect this is a bug in bzip2, or are unsure about (2)\n" - " or (3), feel free to report it to me at: jseward@bzip.org.\n" + " or (3), feel free to report it to me at: jseward@acm.org.\n" " Section 4.3 of the user's manual describes the info a useful\n" " bug report should have. If the manual is available on your\n" " system, please try and read it before mailing me. If you don't\n" @@ -1609,7 +1609,7 @@ void license ( void ) " \n" " This program is free software; you can redistribute it and/or modify\n" " it under the terms set out in the LICENSE file, which is included\n" - " in the bzip2-1.0.6 source distribution.\n" + " in the bzip2 source distribution.\n" " \n" " This program is distributed in the hope that it will be useful,\n" " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" @@ -2005,12 +2005,14 @@ IntNative main ( IntNative argc, Char *argv[] ) testf ( aa->name ); } } - if (testFailsExist && noisy) { - fprintf ( stderr, - "\n" - "You can use the `bzip2recover' program to attempt to recover\n" - "data from undamaged sections of corrupted files.\n\n" - ); + if (testFailsExist) { + if (noisy) { + fprintf ( stderr, + "\n" + "You can use the `bzip2recover' program to attempt to recover\n" + "data from undamaged sections of corrupted files.\n\n" + ); + } setExit(2); exit(exitValue); } Modified: head/contrib/bzip2/bzip2recover.c ============================================================================== --- head/contrib/bzip2/bzip2recover.c Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/bzip2recover.c Fri Jun 28 05:11:02 2019 (r349505) @@ -7,8 +7,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward + bzip2/libbzip2 version 1.0.7 of 27 June 2019 + Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -309,11 +309,12 @@ Int32 main ( Int32 argc, Char** argv ) UInt32 buffHi, buffLo, blockCRC; Char* p; - strcpy ( progName, argv[0] ); + strncpy ( progName, argv[0], BZ_MAX_FILENAME-1); + progName[BZ_MAX_FILENAME-1]='\0'; inFileName[0] = outFileName[0] = 0; fprintf ( stderr, - "bzip2recover 1.0.6: extracts blocks from damaged .bz2 files.\n" ); + "bzip2recover 1.0.7: extracts blocks from damaged .bz2 files.\n" ); if (argc != 2) { fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n", @@ -457,6 +458,7 @@ Int32 main ( Int32 argc, Char** argv ) bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 ); bsPutUInt32 ( bsWr, blockCRC ); bsClose ( bsWr ); + outFile = NULL; } if (wrBlock >= rbCtr) break; wrBlock++; Modified: head/contrib/bzip2/bzlib.c ============================================================================== --- head/contrib/bzip2/bzlib.c Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/bzlib.c Fri Jun 28 05:11:02 2019 (r349505) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward + bzip2/libbzip2 version 1.0.7 of 27 June 2019 + Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -47,7 +47,7 @@ void BZ2_bz__AssertH__fail ( int errcode ) fprintf(stderr, "\n\nbzip2/libbzip2: internal error number %d.\n" "This is a bug in bzip2/libbzip2, %s.\n" - "Please report it to me at: jseward@bzip.org. If this happened\n" + "Please report it to me at: jseward@acm.org. If this happened\n" "when you were using some program which uses libbzip2 as a\n" "component, you should also report this bug to the author(s)\n" "of that program. Please make an effort to report this bug;\n" Modified: head/contrib/bzip2/bzlib.h ============================================================================== --- head/contrib/bzip2/bzlib.h Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/bzlib.h Fri Jun 28 05:11:02 2019 (r349505) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward + bzip2/libbzip2 version 1.0.7 of 27 June 2019 + Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. Modified: head/contrib/bzip2/bzlib_private.h ============================================================================== --- head/contrib/bzip2/bzlib_private.h Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/bzlib_private.h Fri Jun 28 05:11:02 2019 (r349505) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward + bzip2/libbzip2 version 1.0.7 of 27 June 2019 + Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -36,7 +36,7 @@ /*-- General stuff. --*/ -#define BZ_VERSION "1.0.6, 6-Sept-2010" +#define BZ_VERSION "1.0.7, 27-Jun-2019" typedef char Char; typedef unsigned char Bool; Modified: head/contrib/bzip2/compress.c ============================================================================== --- head/contrib/bzip2/compress.c Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/compress.c Fri Jun 28 05:11:02 2019 (r349505) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward + bzip2/libbzip2 version 1.0.7 of 27 June 2019 + Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. Modified: head/contrib/bzip2/crctable.c ============================================================================== --- head/contrib/bzip2/crctable.c Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/crctable.c Fri Jun 28 05:11:02 2019 (r349505) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward + bzip2/libbzip2 version 1.0.7 of 27 June 2019 + Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. Modified: head/contrib/bzip2/decompress.c ============================================================================== --- head/contrib/bzip2/decompress.c Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/decompress.c Fri Jun 28 05:11:02 2019 (r349505) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward + bzip2/libbzip2 version 1.0.7 of 27 June 2019 + Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -285,9 +285,9 @@ Int32 BZ2_decompress ( DState* s ) /*--- Now the selectors ---*/ GET_BITS(BZ_X_SELECTOR_1, nGroups, 3); - if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR); + if (nGroups < 2 || nGroups > BZ_N_GROUPS) RETURN(BZ_DATA_ERROR); GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15); - if (nSelectors < 1) RETURN(BZ_DATA_ERROR); + if (nSelectors < 1 || nSelectors > BZ_MAX_SELECTORS) RETURN(BZ_DATA_ERROR); for (i = 0; i < nSelectors; i++) { j = 0; while (True) { Modified: head/contrib/bzip2/huffman.c ============================================================================== --- head/contrib/bzip2/huffman.c Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/huffman.c Fri Jun 28 05:11:02 2019 (r349505) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward + bzip2/libbzip2 version 1.0.7 of 27 June 2019 + Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. Modified: head/contrib/bzip2/randtable.c ============================================================================== --- head/contrib/bzip2/randtable.c Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/randtable.c Fri Jun 28 05:11:02 2019 (r349505) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward + bzip2/libbzip2 version 1.0.7 of 27 June 2019 + Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. Modified: head/contrib/bzip2/spewG.c ============================================================================== --- head/contrib/bzip2/spewG.c Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/spewG.c Fri Jun 28 05:11:02 2019 (r349505) @@ -13,8 +13,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward + bzip2/libbzip2 version 1.0.7 of 27 June 2019 + Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. Modified: head/contrib/bzip2/unzcrash.c ============================================================================== --- head/contrib/bzip2/unzcrash.c Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/unzcrash.c Fri Jun 28 05:11:02 2019 (r349505) @@ -17,8 +17,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward + bzip2/libbzip2 version 1.0.7 of 27 June 2019 + Copyright (C) 1996-2010 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. Modified: head/contrib/bzip2/words2 ============================================================================== --- head/contrib/bzip2/words2 Fri Jun 28 04:52:24 2019 (r349504) +++ head/contrib/bzip2/words2 Fri Jun 28 05:11:02 2019 (r349505) @@ -1,5 +1,5 @@ Checking test results. If any of the four "cmp"s which follow report any differences, something is wrong. If you can't easily -figure out what, please let me know (jseward@bzip.org). +figure out what, please let me know (jseward@acm.org). From owner-svn-src-head@freebsd.org Fri Jun 28 05:12:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF78C15D83D5; Fri, 28 Jun 2019 05:12:32 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7086889EC6; Fri, 28 Jun 2019 05:12:32 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pf1-x443.google.com with SMTP id x15so2362544pfq.0; Thu, 27 Jun 2019 22:12:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zuYwX4AI91e7QlyQoVABAbC2aJOdhCi8K8TeifDwgrc=; b=NNlzEfbUQPeTiGBUe3ibGJ2l648k6TmRY2trbzzTQN+ZYtx+Sau7X8EUEaFCIBzpsb 8EA9jZVYPjatRr38LfwBjhvBqt5IJT42ddV+kJgF/hTYRYVk8bZvigrZxa11EEJzzS2H FeNaH1ab24aBHg3Qg0yjdC/rl3vhFZVr9mqwxE1QVLsx5tcUYffOqVW7rWOaXPi0xb2x SrKqkZt5Fb/V2UaJGwYcip9dtvqMA4FHDip6V9Ef0XuXFV0nL0e0bngpII9bVCFoscLr FNCbp10F1K0Cdz2FKYid679S6BYuh8QixqU1MlyVYoi5DZ9/grMQ3TabORcBE5EtWzhA 3nNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:references:cc:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=zuYwX4AI91e7QlyQoVABAbC2aJOdhCi8K8TeifDwgrc=; b=Qd8us/92bq4VHLoJCaXcEDKwhnvNtiimfTzH7DcQwwbIKiW0wj2RBzz2Z/X4NzANPL Et1oUog3T3sJO9mDZv6tTIwe1uvJwjf9tgpKHTDctdfiKV/RPgqoI24G4lUJpiioTfsn ziD4pHwCj4ptUexqVV5P6x2aLOEN04UYaMWc/YinQc3pdv5dDIpooxo2HKmBQvDhujyV FY9KFK0I1dEF2spYPJ2n6N408LhdSwX79IZMUjG1vmKVqplrk/R0o/6KEWyHmUY269EG ISyZZ5AcJbbXTx53eEFypZsoDAFeltW5eqkB6SwlrXGn41yBMGEjRL0Xa8uoHcb4U6x3 MzCQ== X-Gm-Message-State: APjAAAXav4zq9/LY5CofVZd/P2QwXLZsdVkNS1vZ9KAWgMRFytDGrY+M 1CyipLjI0aqovQjsqOxo0i+LGqV0 X-Google-Smtp-Source: APXvYqw0OQuFKL7Nw8+Rfhi4gzDtlu2subXYmDHof06CjdrhbYNn2tAn8/mM8MV/EGvolYWZuH4wmw== X-Received: by 2002:a65:55ca:: with SMTP id k10mr7530817pgs.14.1561698750960; Thu, 27 Jun 2019 22:12:30 -0700 (PDT) Received: from [192.168.1.103] (180-150-68-130.b49644.syd.nbn.aussiebb.net. [180.150.68.130]) by smtp.gmail.com with ESMTPSA id v184sm860194pfb.82.2019.06.27.22.12.28 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 27 Jun 2019 22:12:30 -0700 (PDT) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: svn commit: r349505 - head/contrib/bzip2 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201906280511.x5S5B25N019677@repo.freebsd.org> Cc: Xin LI From: Kubilay Kocak Message-ID: <60eaa49c-cd73-c807-bf4e-57e56f1efb73@FreeBSD.org> Date: Fri, 28 Jun 2019 15:12:26 +1000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.0 MIME-Version: 1.0 In-Reply-To: <201906280511.x5S5B25N019677@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 7086889EC6 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 05:12:33 -0000 On 28/06/2019 3:11 pm, Xin LI wrote: > Author: delphij > Date: Fri Jun 28 05:11:02 2019 > New Revision: 349505 > URL: https://svnweb.freebsd.org/changeset/base/349505 > > Log: > Upgrade to Bzip2 version 1.0.7. PR: 238843 > MFC after: 3 days > > Modified: > head/contrib/bzip2/CHANGES > head/contrib/bzip2/LICENSE > head/contrib/bzip2/README > head/contrib/bzip2/README.COMPILATION.PROBLEMS > head/contrib/bzip2/blocksort.c > head/contrib/bzip2/bzip2.1 > head/contrib/bzip2/bzip2.c > head/contrib/bzip2/bzip2recover.c > head/contrib/bzip2/bzlib.c > head/contrib/bzip2/bzlib.h > head/contrib/bzip2/bzlib_private.h > head/contrib/bzip2/compress.c > head/contrib/bzip2/crctable.c > head/contrib/bzip2/decompress.c > head/contrib/bzip2/huffman.c > head/contrib/bzip2/randtable.c > head/contrib/bzip2/spewG.c > head/contrib/bzip2/unzcrash.c > head/contrib/bzip2/words2 > Directory Properties: > head/contrib/bzip2/ (props changed) > > Modified: head/contrib/bzip2/CHANGES > ============================================================================== > --- head/contrib/bzip2/CHANGES Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/CHANGES Fri Jun 28 05:11:02 2019 (r349505) > @@ -2,8 +2,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > - bzip2/libbzip2 version 1.0.6 of 6 September 2010 > - Copyright (C) 1996-2010 Julian Seward > + bzip2/libbzip2 version 1.0.7 of 27 June 2019 > + Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > @@ -325,3 +325,16 @@ Security fix only. Fixes CERT-FI 20469 as it applies > Izdebski. > > * Make the documentation build on Ubuntu 10.04 > + > +1.0.7 (27 Jun 19) > +~~~~~~~~~~~~~~~~~ > + > +* Fix undefined behavior in the macros SET_BH, CLEAR_BH, & ISSET_BH > + > +* bzip2: Fix return value when combining --test,-t and -q. > + > +* bzip2recover: Fix buffer overflow for large argv[0] > + > +* bzip2recover: Fix use after free issue with outFile (CVE-2016-3189) > + > +* Make sure nSelectors is not out of range (CVE-2019-12900) > > Modified: head/contrib/bzip2/LICENSE > ============================================================================== > --- head/contrib/bzip2/LICENSE Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/LICENSE Fri Jun 28 05:11:02 2019 (r349505) > @@ -36,7 +36,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUD > NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS > SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > -Julian Seward, jseward@bzip.org > -bzip2/libbzip2 version 1.0.6 of 6 September 2010 > +Julian Seward, jseward@acm.org > +bzip2/libbzip2 version 1.0.7 of 27 June 2019 > > -------------------------------------------------------------------------- > > Modified: head/contrib/bzip2/README > ============================================================================== > --- head/contrib/bzip2/README Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/README Fri Jun 28 05:11:02 2019 (r349505) > @@ -6,8 +6,8 @@ This version is fully compatible with the previous pub > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > -bzip2/libbzip2 version 1.0.6 of 6 September 2010 > -Copyright (C) 1996-2010 Julian Seward > +bzip2/libbzip2 version 1.0.7 of 27 June 2019 > +Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in this file. > > @@ -73,7 +73,7 @@ HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc. > > It's difficult for me to support compilation on all these platforms. > My approach is to collect binaries for these platforms, and put them > -on the master web site (http://www.bzip.org). Look there. However > +on the master web site (https://sourceware.org/bzip2/). Look there. However > (FWIW), bzip2-1.0.X is very standard ANSI C and should compile > unmodified with MS Visual C. If you have difficulties building, you > might want to read README.COMPILATION.PROBLEMS. > @@ -161,43 +161,22 @@ WHAT'S NEW IN 0.9.5 ? > * Many small improvements in file and flag handling. > * A Y2K statement. > > -WHAT'S NEW IN 1.0.0 ? > +WHAT'S NEW IN 1.0.x ? > > See the CHANGES file. > > -WHAT'S NEW IN 1.0.2 ? > - > - See the CHANGES file. > - > -WHAT'S NEW IN 1.0.3 ? > - > - See the CHANGES file. > - > -WHAT'S NEW IN 1.0.4 ? > - > - See the CHANGES file. > - > -WHAT'S NEW IN 1.0.5 ? > - > - See the CHANGES file. > - > -WHAT'S NEW IN 1.0.6 ? > - > - See the CHANGES file. > - > - > I hope you find bzip2 useful. Feel free to contact me at > - jseward@bzip.org > + jseward@acm.org > if you have any suggestions or queries. Many people mailed me with > comments, suggestions and patches after the releases of bzip-0.15, > bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, > 1.0.2 and 1.0.3, and the changes in bzip2 are largely a result of this > feedback. I thank you for your comments. > > -bzip2's "home" is http://www.bzip.org/ > +bzip2's "home" is https://sourceware.org/bzip2/ > > Julian Seward > -jseward@bzip.org > +jseward@acm.org > Cambridge, UK. > > 18 July 1996 (version 0.15) > @@ -213,3 +192,4 @@ Cambridge, UK. > 20 December 2006 (bzip2, version 1.0.4) > 10 December 2007 (bzip2, version 1.0.5) > 6 Sept 2010 (bzip2, version 1.0.6) > +27 June 2019 (bzip2, version 1.0.7) > > Modified: head/contrib/bzip2/README.COMPILATION.PROBLEMS > ============================================================================== > --- head/contrib/bzip2/README.COMPILATION.PROBLEMS Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/README.COMPILATION.PROBLEMS Fri Jun 28 05:11:02 2019 (r349505) > @@ -2,8 +2,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > -bzip2/libbzip2 version 1.0.6 of 6 September 2010 > -Copyright (C) 1996-2010 Julian Seward > +bzip2/libbzip2 version 1.0.7 of 27 June 2019 > +Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > @@ -12,7 +12,7 @@ This program is released under the terms of the licens > in the file LICENSE. > ------------------------------------------------------------------ > > -bzip2-1.0.6 should compile without problems on the vast majority of > +bzip2 should compile without problems on the vast majority of > platforms. Using the supplied Makefile, I've built and tested it > myself for x86-linux and amd64-linux. With makefile.msc, Visual C++ > 6.0 and nmake, you can build a native Win32 version too. Large file > > Modified: head/contrib/bzip2/blocksort.c > ============================================================================== > --- head/contrib/bzip2/blocksort.c Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/blocksort.c Fri Jun 28 05:11:02 2019 (r349505) > @@ -8,8 +8,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > - bzip2/libbzip2 version 1.0.6 of 6 September 2010 > - Copyright (C) 1996-2010 Julian Seward > + bzip2/libbzip2 version 1.0.7 of 27 June 2019 > + Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > @@ -202,9 +202,9 @@ void fallbackQSort3 ( UInt32* fmap, > bhtab [ 0 .. 2+(nblock/32) ] destroyed > */ > > -#define SET_BH(zz) bhtab[(zz) >> 5] |= (1 << ((zz) & 31)) > -#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31)) > -#define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1 << ((zz) & 31))) > +#define SET_BH(zz) bhtab[(zz) >> 5] |= ((UInt32)1 << ((zz) & 31)) > +#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~((UInt32)1 << ((zz) & 31)) > +#define ISSET_BH(zz) (bhtab[(zz) >> 5] & ((UInt32)1 << ((zz) & 31))) > #define WORD_BH(zz) bhtab[(zz) >> 5] > #define UNALIGNED_BH(zz) ((zz) & 0x01f) > > > Modified: head/contrib/bzip2/bzip2.1 > ============================================================================== > --- head/contrib/bzip2/bzip2.1 Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/bzip2.1 Fri Jun 28 05:11:02 2019 (r349505) > @@ -1,6 +1,6 @@ > .TH bzip2 1 > .SH NAME > -bzip2, bunzip2 \- a block-sorting file compressor, v1.0.6 > +bzip2, bunzip2 \- a block-sorting file compressor, v1.0.7 > .br > bzcat \- decompresses files to stdout > .br > @@ -404,7 +404,7 @@ I/O error messages are not as helpful as they could be > tries hard to detect I/O errors and exit cleanly, but the details of > what the problem is sometimes seem rather misleading. > > -This manual page pertains to version 1.0.6 of > +This manual page pertains to version 1.0.7 of > .I bzip2. > Compressed data created by this version is entirely forwards and > backwards compatible with the previous public releases, versions > @@ -426,9 +426,9 @@ with MaybeUInt64 set to be an unsigned 64-bit integer. > > > .SH AUTHOR > -Julian Seward, jsewardbzip.org. > +Julian Seward, jseward@acm.org. > > -http://www.bzip.org > +https://sourceware.org/bzip2/ > > The ideas embodied in > .I bzip2 > > Modified: head/contrib/bzip2/bzip2.c > ============================================================================== > --- head/contrib/bzip2/bzip2.c Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/bzip2.c Fri Jun 28 05:11:02 2019 (r349505) > @@ -7,8 +7,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > - bzip2/libbzip2 version 1.0.6 of 6 September 2010 > - Copyright (C) 1996-2010 Julian Seward > + bzip2/libbzip2 version 1.0.7 of 27 June 2019 > + Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > @@ -554,7 +554,7 @@ static > Bool testStream ( FILE *zStream ) > { > BZFILE* bzf = NULL; > - Int32 bzerr, bzerr_dummy, ret, nread, streamNo, i; > + Int32 bzerr, bzerr_dummy, ret, streamNo, i; > UChar obuf[5000]; > UChar unused[BZ_MAX_UNUSED]; > Int32 nUnused; > @@ -577,7 +577,7 @@ Bool testStream ( FILE *zStream ) > streamNo++; > > while (bzerr == BZ_OK) { > - nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 ); > + BZ2_bzRead ( &bzerr, bzf, obuf, 5000 ); > if (bzerr == BZ_DATA_ERROR_MAGIC) goto errhandler; > } > if (bzerr != BZ_STREAM_END) goto errhandler; > @@ -749,7 +749,7 @@ void panic ( const Char* s ) > "\n%s: PANIC -- internal consistency error:\n" > "\t%s\n" > "\tThis is a BUG. Please report it to me at:\n" > - "\tjseward@bzip.org\n", > + "\tjseward@acm.org\n", > progName, s ); > showFileNames(); > cleanUpAndFail( 3 ); > @@ -829,7 +829,7 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n ) > " The user's manual, Section 4.3, has more info on (1) and (2).\n" > " \n" > " If you suspect this is a bug in bzip2, or are unsure about (1)\n" > - " or (2), feel free to report it to me at: jseward@bzip.org.\n" > + " or (2), feel free to report it to me at: jseward@acm.org.\n" > " Section 4.3 of the user's manual describes the info a useful\n" > " bug report should have. If the manual is available on your\n" > " system, please try and read it before mailing me. If you don't\n" > @@ -852,7 +852,7 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n ) > " The user's manual, Section 4.3, has more info on (2) and (3).\n" > " \n" > " If you suspect this is a bug in bzip2, or are unsure about (2)\n" > - " or (3), feel free to report it to me at: jseward@bzip.org.\n" > + " or (3), feel free to report it to me at: jseward@acm.org.\n" > " Section 4.3 of the user's manual describes the info a useful\n" > " bug report should have. If the manual is available on your\n" > " system, please try and read it before mailing me. If you don't\n" > @@ -1609,7 +1609,7 @@ void license ( void ) > " \n" > " This program is free software; you can redistribute it and/or modify\n" > " it under the terms set out in the LICENSE file, which is included\n" > - " in the bzip2-1.0.6 source distribution.\n" > + " in the bzip2 source distribution.\n" > " \n" > " This program is distributed in the hope that it will be useful,\n" > " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" > @@ -2005,12 +2005,14 @@ IntNative main ( IntNative argc, Char *argv[] ) > testf ( aa->name ); > } > } > - if (testFailsExist && noisy) { > - fprintf ( stderr, > - "\n" > - "You can use the `bzip2recover' program to attempt to recover\n" > - "data from undamaged sections of corrupted files.\n\n" > - ); > + if (testFailsExist) { > + if (noisy) { > + fprintf ( stderr, > + "\n" > + "You can use the `bzip2recover' program to attempt to recover\n" > + "data from undamaged sections of corrupted files.\n\n" > + ); > + } > setExit(2); > exit(exitValue); > } > > Modified: head/contrib/bzip2/bzip2recover.c > ============================================================================== > --- head/contrib/bzip2/bzip2recover.c Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/bzip2recover.c Fri Jun 28 05:11:02 2019 (r349505) > @@ -7,8 +7,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > - bzip2/libbzip2 version 1.0.6 of 6 September 2010 > - Copyright (C) 1996-2010 Julian Seward > + bzip2/libbzip2 version 1.0.7 of 27 June 2019 > + Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > @@ -309,11 +309,12 @@ Int32 main ( Int32 argc, Char** argv ) > UInt32 buffHi, buffLo, blockCRC; > Char* p; > > - strcpy ( progName, argv[0] ); > + strncpy ( progName, argv[0], BZ_MAX_FILENAME-1); > + progName[BZ_MAX_FILENAME-1]='\0'; > inFileName[0] = outFileName[0] = 0; > > fprintf ( stderr, > - "bzip2recover 1.0.6: extracts blocks from damaged .bz2 files.\n" ); > + "bzip2recover 1.0.7: extracts blocks from damaged .bz2 files.\n" ); > > if (argc != 2) { > fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n", > @@ -457,6 +458,7 @@ Int32 main ( Int32 argc, Char** argv ) > bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 ); > bsPutUInt32 ( bsWr, blockCRC ); > bsClose ( bsWr ); > + outFile = NULL; > } > if (wrBlock >= rbCtr) break; > wrBlock++; > > Modified: head/contrib/bzip2/bzlib.c > ============================================================================== > --- head/contrib/bzip2/bzlib.c Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/bzlib.c Fri Jun 28 05:11:02 2019 (r349505) > @@ -8,8 +8,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > - bzip2/libbzip2 version 1.0.6 of 6 September 2010 > - Copyright (C) 1996-2010 Julian Seward > + bzip2/libbzip2 version 1.0.7 of 27 June 2019 > + Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > @@ -47,7 +47,7 @@ void BZ2_bz__AssertH__fail ( int errcode ) > fprintf(stderr, > "\n\nbzip2/libbzip2: internal error number %d.\n" > "This is a bug in bzip2/libbzip2, %s.\n" > - "Please report it to me at: jseward@bzip.org. If this happened\n" > + "Please report it to me at: jseward@acm.org. If this happened\n" > "when you were using some program which uses libbzip2 as a\n" > "component, you should also report this bug to the author(s)\n" > "of that program. Please make an effort to report this bug;\n" > > Modified: head/contrib/bzip2/bzlib.h > ============================================================================== > --- head/contrib/bzip2/bzlib.h Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/bzlib.h Fri Jun 28 05:11:02 2019 (r349505) > @@ -8,8 +8,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > - bzip2/libbzip2 version 1.0.6 of 6 September 2010 > - Copyright (C) 1996-2010 Julian Seward > + bzip2/libbzip2 version 1.0.7 of 27 June 2019 > + Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > > Modified: head/contrib/bzip2/bzlib_private.h > ============================================================================== > --- head/contrib/bzip2/bzlib_private.h Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/bzlib_private.h Fri Jun 28 05:11:02 2019 (r349505) > @@ -8,8 +8,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > - bzip2/libbzip2 version 1.0.6 of 6 September 2010 > - Copyright (C) 1996-2010 Julian Seward > + bzip2/libbzip2 version 1.0.7 of 27 June 2019 > + Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > @@ -36,7 +36,7 @@ > > /*-- General stuff. --*/ > > -#define BZ_VERSION "1.0.6, 6-Sept-2010" > +#define BZ_VERSION "1.0.7, 27-Jun-2019" > > typedef char Char; > typedef unsigned char Bool; > > Modified: head/contrib/bzip2/compress.c > ============================================================================== > --- head/contrib/bzip2/compress.c Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/compress.c Fri Jun 28 05:11:02 2019 (r349505) > @@ -8,8 +8,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > - bzip2/libbzip2 version 1.0.6 of 6 September 2010 > - Copyright (C) 1996-2010 Julian Seward > + bzip2/libbzip2 version 1.0.7 of 27 June 2019 > + Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > > Modified: head/contrib/bzip2/crctable.c > ============================================================================== > --- head/contrib/bzip2/crctable.c Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/crctable.c Fri Jun 28 05:11:02 2019 (r349505) > @@ -8,8 +8,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > - bzip2/libbzip2 version 1.0.6 of 6 September 2010 > - Copyright (C) 1996-2010 Julian Seward > + bzip2/libbzip2 version 1.0.7 of 27 June 2019 > + Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > > Modified: head/contrib/bzip2/decompress.c > ============================================================================== > --- head/contrib/bzip2/decompress.c Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/decompress.c Fri Jun 28 05:11:02 2019 (r349505) > @@ -8,8 +8,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > - bzip2/libbzip2 version 1.0.6 of 6 September 2010 > - Copyright (C) 1996-2010 Julian Seward > + bzip2/libbzip2 version 1.0.7 of 27 June 2019 > + Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > @@ -285,9 +285,9 @@ Int32 BZ2_decompress ( DState* s ) > > /*--- Now the selectors ---*/ > GET_BITS(BZ_X_SELECTOR_1, nGroups, 3); > - if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR); > + if (nGroups < 2 || nGroups > BZ_N_GROUPS) RETURN(BZ_DATA_ERROR); > GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15); > - if (nSelectors < 1) RETURN(BZ_DATA_ERROR); > + if (nSelectors < 1 || nSelectors > BZ_MAX_SELECTORS) RETURN(BZ_DATA_ERROR); > for (i = 0; i < nSelectors; i++) { > j = 0; > while (True) { > > Modified: head/contrib/bzip2/huffman.c > ============================================================================== > --- head/contrib/bzip2/huffman.c Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/huffman.c Fri Jun 28 05:11:02 2019 (r349505) > @@ -8,8 +8,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > - bzip2/libbzip2 version 1.0.6 of 6 September 2010 > - Copyright (C) 1996-2010 Julian Seward > + bzip2/libbzip2 version 1.0.7 of 27 June 2019 > + Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > > Modified: head/contrib/bzip2/randtable.c > ============================================================================== > --- head/contrib/bzip2/randtable.c Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/randtable.c Fri Jun 28 05:11:02 2019 (r349505) > @@ -8,8 +8,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > - bzip2/libbzip2 version 1.0.6 of 6 September 2010 > - Copyright (C) 1996-2010 Julian Seward > + bzip2/libbzip2 version 1.0.7 of 27 June 2019 > + Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > > Modified: head/contrib/bzip2/spewG.c > ============================================================================== > --- head/contrib/bzip2/spewG.c Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/spewG.c Fri Jun 28 05:11:02 2019 (r349505) > @@ -13,8 +13,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > - bzip2/libbzip2 version 1.0.6 of 6 September 2010 > - Copyright (C) 1996-2010 Julian Seward > + bzip2/libbzip2 version 1.0.7 of 27 June 2019 > + Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > > Modified: head/contrib/bzip2/unzcrash.c > ============================================================================== > --- head/contrib/bzip2/unzcrash.c Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/unzcrash.c Fri Jun 28 05:11:02 2019 (r349505) > @@ -17,8 +17,8 @@ > This file is part of bzip2/libbzip2, a program and library for > lossless, block-sorting data compression. > > - bzip2/libbzip2 version 1.0.6 of 6 September 2010 > - Copyright (C) 1996-2010 Julian Seward > + bzip2/libbzip2 version 1.0.7 of 27 June 2019 > + Copyright (C) 1996-2010 Julian Seward > > Please read the WARNING, DISCLAIMER and PATENTS sections in the > README file. > > Modified: head/contrib/bzip2/words2 > ============================================================================== > --- head/contrib/bzip2/words2 Fri Jun 28 04:52:24 2019 (r349504) > +++ head/contrib/bzip2/words2 Fri Jun 28 05:11:02 2019 (r349505) > @@ -1,5 +1,5 @@ > > Checking test results. If any of the four "cmp"s which follow > report any differences, something is wrong. If you can't easily > -figure out what, please let me know (jseward@bzip.org). > +figure out what, please let me know (jseward@acm.org). > > _______________________________________________ > 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 Fri Jun 28 09:23:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F38C15DD082; Fri, 28 Jun 2019 09:23:09 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 919E46A003; Fri, 28 Jun 2019 09:23:08 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f65.google.com with SMTP id u19so2560315ior.9; Fri, 28 Jun 2019 02:23:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=I53FWSJHImXvmyYxBTkIAeHd9Qlt9XXJzqOYRxhctxs=; b=H9qbsFSUMo5XZ5/8f4nUr2s2Fpp4xchrM4t4xX6jJRagGfzW6oOG1P4vXHOaSmJNgJ KnCPfvN/cokcXwVtZk9Pl+JZ5a/P+0a0ZZR+ZWwtXxregI+hLM3VNQmDcKoj9PFQJTuz 4OTRKuTesSzIV0WP9VLg/OCsrfAGxHLbEJlX8vYNmxDb2WsS29V+LdLANGIW0NngG+72 ta3kflARM3GAQ+KlWgGnGsjcSUqagj8EkxLgPbi6UXHSt8w71Iyrkrg/+CNy6pU5rZZH eG1N6W11vQWeXRi6NUTAhDiryrU7eBnJ5qb17ZnpOeD/vv0znmC+Su2GVnFnUUiar8Nv DHDA== X-Gm-Message-State: APjAAAWz8EiUWCSdHu7G0zU7W3xcQGqZVj2f9Ahvl9TjEh2P+N8PaYs/ Ht/qGXUTm5kaSYn3dGf5CVUleA3mBj8= X-Google-Smtp-Source: APXvYqxTmJctPSr5Ls84RTS7z2oIxZhHH1SmyfzRndSPsp8Ytqc/aXreesXvqsq5zIE1+Nuh9Q3kvA== X-Received: by 2002:a5e:8518:: with SMTP id i24mr9502919ioj.149.1561713781236; Fri, 28 Jun 2019 02:23:01 -0700 (PDT) Received: from mail-io1-f47.google.com (mail-io1-f47.google.com. [209.85.166.47]) by smtp.gmail.com with ESMTPSA id v26sm1415272iom.88.2019.06.28.02.22.58 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jun 2019 02:22:59 -0700 (PDT) Received: by mail-io1-f47.google.com with SMTP id e3so11003796ioc.12; Fri, 28 Jun 2019 02:22:58 -0700 (PDT) X-Received: by 2002:a5d:8ccc:: with SMTP id k12mr9757897iot.141.1561713778598; Fri, 28 Jun 2019 02:22:58 -0700 (PDT) MIME-Version: 1.0 References: <201906201413.x5KEDB5u010923@repo.freebsd.org> <20190627191843.GQ8697@kib.kiev.ua> <20190627210940.GR8697@kib.kiev.ua> <0988866D-918B-4800-ADE7-938E1EBD729C@samsco.org> In-Reply-To: <0988866D-918B-4800-ADE7-938E1EBD729C@samsco.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Fri, 28 Jun 2019 11:22:47 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r349231 - in head/sys: kern sys ufs/ufs To: Scott Long Cc: Alan Somers , Konstantin Belousov , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 919E46A003 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.988,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 09:23:09 -0000 To this end, __result_use_check can help ensure no unchecked callers are missed when panics are downgraded to errors. (In OneFS, the macro has the imo more memorable name =E2=80=9C__must_check=E2=80=9D. Cheers, Conrad On Thu, Jun 27, 2019 at 23:48 Scott Long wrote: > > > > On Jun 27, 2019, at 3:09 PM, Konstantin Belousov > wrote: > > > > On Thu, Jun 27, 2019 at 02:01:11PM -0600, Alan Somers wrote: > >> On Thu, Jun 27, 2019 at 1:18 PM Konstantin Belousov < > kostikbel@gmail.com> wrote: > >>> > >>> On Thu, Jun 20, 2019 at 02:13:11PM +0000, Alan Somers wrote: > >>>> Author: asomers > >>>> Date: Thu Jun 20 14:13:10 2019 > >>>> New Revision: 349231 > >>>> URL: https://svnweb.freebsd.org/changeset/base/349231 > >>>> > >>>> Log: > >>>> Add FIOBMAP2 ioctl > >>> > >>>> > >>>> This ioctl exposes VOP_BMAP information to userland. It can be used > by > >>>> programs like fragmentation analyzers and optimized cp > implementations. But > >>>> I'm using it to test fusefs's VOP_BMAP implementation. The "2" in > the name > >>>> distinguishes it from the similar but incompatible FIBMAP ioctls in > NetBSD > >>>> and Linux. FIOBMAP2 differs from FIBMAP in that it uses a 64-bit > block > >>>> number instead of 32-bit, and it also returns runp and runb. > >>>> > >>>> Reviewed by: mckusick > >>>> MFC after: 2 weeks > >>>> Sponsored by: The FreeBSD Foundation > >>>> Differential Revision: https://reviews.freebsd.org/D20705 > >>>> > >>>> Modified: > >>>> head/sys/kern/vfs_vnops.c > >>>> head/sys/sys/filio.h > >>>> head/sys/ufs/ufs/ufs_bmap.c > >>>> > >>>> Modified: head/sys/kern/vfs_vnops.c > >>>> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > >>>> --- head/sys/kern/vfs_vnops.c Thu Jun 20 13:59:46 2019 > (r349230) > >>>> +++ head/sys/kern/vfs_vnops.c Thu Jun 20 14:13:10 2019 > (r349231) > >>>> @@ -1458,6 +1458,25 @@ vn_stat(struct vnode *vp, struct stat *sb, > struct ucre > >>>> return (0); > >>>> } > >>>> > >>>> +/* generic FIOBMAP2 implementation */ > >>>> +static int > >>>> +vn_ioc_bmap2(struct file *fp, struct fiobmap2_arg *arg, struct ucre= d > *cred) > >>> I do not like the fact that internal kernel function takes the > >>> user-visible structure which results in the mix of ABI and KBI. > >>> Traditionally we pass explicit arguments to kern_XXX, vn_XXX and > similar > >>> internal implementations. > >> > >> Ok. It will increase the number of function arguments, which is ugly, > >> but I can do it if you prefer. > >> > >>> > >>>> +{ > >>>> + struct vnode *vp =3D fp->f_vnode; > >>> Why do you pass fp to the function that > >>> 1. Has vn_ namespace, i.e. operating on vnode. > >>> 2. Only needs vnode to operate on. > >>> Please change the argument from fp to vp. You would need to pass > f_cred > >>> as additional argument, or move mac check to vn_ioctl (I think this i= s > >>> a better approach). > >> > >> Ok. > >> > >>> > >>>> + daddr_t lbn =3D arg->bn; > >>> Style: initialization in declaration. > >>> > >>>> + int error; > >>>> + > >>>> + vn_lock(vp, LK_SHARED | LK_RETRY); > >>>> +#ifdef MAC > >>>> + error =3D mac_vnode_check_read(cred, fp->f_cred, vp); > >>>> + if (error =3D=3D 0) > >>>> +#endif > >>>> + error =3D VOP_BMAP(vp, lbn, NULL, &arg->bn, &arg->runp= , > >>>> + &arg->runb); > >>> Wrong indent for continuation line. > >>> > >>>> + VOP_UNLOCK(vp, 0); > >>>> + return (error); > >>>> +} > >>>> + > >>>> /* > >>>> * File table vnode ioctl routine. > >>>> */ > >>>> @@ -1481,6 +1500,9 @@ vn_ioctl(struct file *fp, u_long com, void > *data, stru > >>>> if (error =3D=3D 0) > >>>> *(int *)data =3D vattr.va_size - > fp->f_offset; > >>>> return (error); > >>>> + case FIOBMAP2: > >>>> + return (vn_ioc_bmap2(fp, (struct > fiobmap2_arg*)data, > >>> Need space between fiobmap2_arg and '*'. > >>>> + active_cred)); > >>> Wrong indent. > >>> > >>>> case FIONBIO: > >>>> case FIOASYNC: > >>>> return (0); > >>>> > >>>> Modified: head/sys/sys/filio.h > >>>> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > >>>> --- head/sys/sys/filio.h Thu Jun 20 13:59:46 2019 > (r349230) > >>>> +++ head/sys/sys/filio.h Thu Jun 20 14:13:10 2019 > (r349231) > >>>> @@ -62,6 +62,13 @@ struct fiodgname_arg { > >>>> /* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */ > >>>> #define FIOSEEKDATA _IOWR('f', 97, off_t) /* SEEK_DATA */ > >>>> #define FIOSEEKHOLE _IOWR('f', 98, off_t) /* SEEK_HOLE */ > >>>> +struct fiobmap2_arg { > >>>> + int64_t bn; > >>>> + int runp; > >>>> + int runb; > >>>> +}; > >>> This structure has different layout for LP64 and ILP32, and you did n= ot > >>> provided the compat shims. > >> > >> Really? How so? All of the fields have the same width on 64 and 32 > >> bit archs, and there shouldn't be any need for padding, either. > > Sorry, you are right. > > > >> > >>> > >>>> +/* Get the file's bmap info for the logical block bn */ > >>>> +#define FIOBMAP2 _IOWR('f', 99, struct fiobmap2_arg) > >>>> > >>>> #ifdef _KERNEL > >>>> #ifdef COMPAT_FREEBSD32 > >>>> > >>>> Modified: head/sys/ufs/ufs/ufs_bmap.c > >>>> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > >>>> --- head/sys/ufs/ufs/ufs_bmap.c Thu Jun 20 13:59:46 2019 > (r349230) > >>>> +++ head/sys/ufs/ufs/ufs_bmap.c Thu Jun 20 14:13:10 2019 > (r349231) > >>>> @@ -200,12 +200,15 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb) > >>>> *bnp =3D blkptrtodb(ump, ip->i_din2->di_extb[-1= - > bn]); > >>>> if (*bnp =3D=3D 0) > >>>> *bnp =3D -1; > >>>> - if (nbp =3D=3D NULL) > >>>> - panic("ufs_bmaparray: mapping ext > data"); > >>>> + if (nbp =3D=3D NULL) { > >>>> + /* indirect block not found */ > >>>> + return (EINVAL); > >>>> + } > >>> This (and next chunk) loose useful checks for in-kernel interfaces. > >> > >> mckusick disagrees with you on this. He thought that changing the > >> panics into errors was a good idea. Note that ufs_bmap was already > >> capable of returning errors that not all callers check. > > For user-callable code, this is of course the requirement. But for > in-kernel > > use, IMO it makes the interfaces loose. > > I=E2=80=99m firmly in agreement on changing panics into errors. When cal= lers are > encountered that don=E2=80=99t properly check and propagate the errors, t= hey > should be fixed too. I=E2=80=99m not saying that it=E2=80=99s an easy pr= ocess and that > we should just delete all panics, but it=E2=80=99s a goal that should be = vigorously > pursued. > > Scott > > > > From owner-svn-src-head@freebsd.org Fri Jun 28 10:17:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 164D315DE137; Fri, 28 Jun 2019 10:17:03 +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 5E30E6B943; Fri, 28 Jun 2019 10:17:02 +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 32D5B149D2D; Fri, 28 Jun 2019 20:16:53 +1000 (AEST) Date: Fri, 28 Jun 2019 20:16:51 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andriy Gapon cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349459 - head/sys/sys In-Reply-To: Message-ID: <20190628192001.K982@besplex.bde.org> References: <201906271507.x5RF775Q070616@repo.freebsd.org> <20190628012059.D2091@besplex.bde.org> <20190628032225.T2863@besplex.bde.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=nlC_4_pT8q9DhB4Ho9EA:9 a=y87RR0B9tQQI9nNFtbYA:9 a=45ClL6m2LaAA:10 X-Rspamd-Queue-Id: 5E30E6B943 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-7.00 / 15.00]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.996,0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 10:17:03 -0000 On Thu, 27 Jun 2019, Andriy Gapon wrote: > On 27/06/2019 20:37, Bruce Evans wrote: >> On Thu, 27 Jun 2019, Andriy Gapon wrote: >> >>> On 27/06/2019 18:47, Bruce Evans wrote: >>>> On Thu, 27 Jun 2019, Andriy Gapon wrote: >>>> >>>>> Log: >>>>> =C2=A0upgrade the warning printf-s in bus accessors to KASSERT-s >>>>> >>>>> =C2=A0After this change sys/bus.h includes sys/systm.h. >>>> >>>> This is further namespace pollution.=C2=A0 sys/systm.h is a prerequist= e for >>>> all kernel headers except sys/param.h and the headers that that includ= es, >>>> since any kernel header (except sys/param.hm etc.) may have inlines wh= ich >>>> use features in systm.h, e.g., KASSERT() or an inline function. >>> >>> what do you think about amending style(9) to require that if sys/systm.= h is to >>> be included, then it must be included before any other header except fo= r >>> sys/param.h (and possibly sys/cdefs.h) ? >> >> It is not a style matter. > > I know... but style(9) documents sys/param.h for similar reasons. > >> sys/systm.h is just a prerequisite for almost >> all kernel code.=C2=A0 Perhaps this can be enforced using #ifdef magic e= ven >> for headers that don't currently use it.=C2=A0 If it is to be included n= ested, >> then sys/param.h is the place to include it, but I don't like that since >> it is even less related to parameters than sys/param.h, and this would b= e >> a regression from minor depollution of sys/param.h. >> >> sys/systm.h is also kernel-only, and as you found, including it nested >> tends to break applications, so other headers that have the bug of >> including it tend to have _KERNEL ifdefs to avoid including it in >> applications.=C2=A0 This is so fundamental that it doesn't have a "No >> user-serviceable parts inside" ifdef. > > I think that there is a trivial fix to my commit: moving the sys/systm.h = include > to the _KERNEL section of sys/bus.h. That's where its definitions are ac= tually > used. > But I agree that there should be a better approach. I did a quick check of how many .c files are missing includes of sys/systm.= h. In an old version of FreeBSD, my normal kernel has about 1100 object files, and about 89 of these broke when a KASSERT() was added to sys/bus.h without adding the pollution. That is many more than I expected. Many of these errors are in automatically generated bus if.c files. E.g., the include list in acpi_if.c is: #include #include #include #include #include #include #include #include "acpi_if.h" Here sys/bus.h and sys/types.h and the contrib include are in the .m file, and the others are automatically generated. Including sys/types.h is nonsense since sys/param.h already included it and sys/bus.h already used typedefs in it. The generation also misorders sys/queue.h and mangles the formatting of the contrib include (in the .m file, it is separated by spaces). Here the .m file should know sys/bus.h's prerequisites and add them all except sys/param.h and sys/systm.h, or maybe the include of sys/bus.h should be auto-generated too (my test kernel has 25 foo_if.c files and 21 of these include sys/bus.c). Most of the generated if.c files include sys/systm.h by nested pollution anyway. Just not early enough to actually work. E.g., in acpi_if.c, the above 8 includes expand to 45 lines, 144 words and 2679 chars in =2Edepend.acpi_if.o according to wc. The word count of 144 is approximately the number of includes. sys/systm.h is first included deeply nested in contrib/..../acpi.h. 11 of the 25 generated foo_if.c end up never including sys/systm.h. Of the remaining 64 files that fail to compile, all except 7 including 1 maintained by me (cy_pci.c) *blush* end up including sys/systm.h. The other 57 apparently include it either misordered in the .c file or via nested pollution. After removing all nested includes of sys/systm.h in headers, only another 50 object files fail to build. most of the extras are for libkern functions (20 for str*() alone). libkern was polluted.h relatively recently as part of unimproving the implementation of bcd conversion APIs from macros to inlines with KASSERT()s. The KASSERT()s were a bad fix for missing sanity checks of bcd data in callers. Bruce From owner-svn-src-head@freebsd.org Fri Jun 28 10:38:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6381615DE63C; Fri, 28 Jun 2019 10:38:58 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EDDA26C2C8; Fri, 28 Jun 2019 10:38:57 +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 C1935257FF; Fri, 28 Jun 2019 10:38:57 +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 x5SAcvAm088281; Fri, 28 Jun 2019 10:38:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SAcv5f088278; Fri, 28 Jun 2019 10:38:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201906281038.x5SAcv5f088278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 28 Jun 2019 10:38:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349506 - in head: share/man/man9 sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 349506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EDDA26C2C8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 10:38:58 -0000 Author: hselasky Date: Fri Jun 28 10:38:56 2019 New Revision: 349506 URL: https://svnweb.freebsd.org/changeset/base/349506 Log: Implement API for draining EPOCH(9) callbacks. The epoch_drain_callbacks() function is used to drain all pending callbacks which have been invoked by prior epoch_call() function calls on the same epoch. This function is useful when there are shared memory structure(s) referred to by the epoch callback(s) which are not refcounted and are rarely freed. The typical place for calling this function is right before freeing or invalidating the shared resource(s) used by the epoch callback(s). This function can sleep and is not optimized for performance. Differential Revision: https://reviews.freebsd.org/D20109 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/share/man/man9/Makefile head/share/man/man9/epoch.9 head/sys/kern/subr_epoch.c head/sys/sys/epoch.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Fri Jun 28 05:11:02 2019 (r349505) +++ head/share/man/man9/Makefile Fri Jun 28 10:38:56 2019 (r349506) @@ -945,6 +945,15 @@ MLINKS+=drbr.9 drbr_free.9 \ MLINKS+=DRIVER_MODULE.9 DRIVER_MODULE_ORDERED.9 \ DRIVER_MODULE.9 EARLY_DRIVER_MODULE.9 \ DRIVER_MODULE.9 EARLY_DRIVER_MODULE_ORDERED.9 +MLINKS+=epoch.9 epoch_context.9 \ + epoch.9 epoch_alloc.9 \ + epoch.9 epoch_free.9 \ + epoch.9 epoch_enter.9 \ + epoch.9 epoch_exit.9 \ + epoch.9 epoch_wait.9 \ + epoch.9 epoch_call.9 \ + epoch.9 epoch_drain_callbacks.9 \ + epoch.9 in_epoch.9 MLINKS+=EVENTHANDLER.9 EVENTHANDLER_DECLARE.9 \ EVENTHANDLER.9 EVENTHANDLER_DEFINE.9 \ EVENTHANDLER.9 EVENTHANDLER_DEREGISTER.9 \ Modified: head/share/man/man9/epoch.9 ============================================================================== --- head/share/man/man9/epoch.9 Fri Jun 28 05:11:02 2019 (r349505) +++ head/share/man/man9/epoch.9 Fri Jun 28 10:38:56 2019 (r349506) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2018 +.Dd June 28, 2019 .Dt EPOCH 9 .Os .Sh NAME @@ -38,6 +38,7 @@ .Nm epoch_exit , .Nm epoch_wait , .Nm epoch_call , +.Nm epoch_drain_callbacks , .Nm in_epoch , .Nd kernel epoch based reclamation .Sh SYNOPSIS @@ -60,6 +61,8 @@ .Fn epoch_wait_preempt "epoch_t epoch" .Ft void .Fn epoch_call "epoch_t epoch" "epoch_context_t ctx" "void (*callback) (epoch_context_t)" +.Ft void +.Fn epoch_drain_callbacks "epoch_t epoch" .Ft int .Fn in_epoch "epoch_t epoch" .Sh DESCRIPTION @@ -120,6 +123,18 @@ routines must be used and the caller can no longer mod in place. An item to be modified must be handled with copy on write and frees must be deferred until after a grace period has elapsed. +.Pp +The +.Fn epoch_drain_callbacks +function is used to drain all pending callbacks which have been invoked by prior +.Fn epoch_call +function calls on the same epoch. +This function is useful when there are shared memory structure(s) +referred to by the epoch callback(s) which are not refcounted and are +rarely freed. +The typical place for calling this function is right before freeing or +invalidating the shared resource(s) used by the epoch callback(s). +This function can sleep and is not optimized for performance. .Sh RETURN VALUES .Fn in_epoch curepoch will return 1 if curthread is in curepoch, 0 otherwise. Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Fri Jun 28 05:11:02 2019 (r349505) +++ head/sys/kern/subr_epoch.c Fri Jun 28 10:38:56 2019 (r349506) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -64,6 +65,8 @@ static MALLOC_DEFINE(M_EPOCH, "epoch", "epoch based re TAILQ_HEAD (epoch_tdlist, epoch_tracker); typedef struct epoch_record { ck_epoch_record_t er_record; + struct epoch_context er_drain_ctx; + struct epoch *er_parent; volatile struct epoch_tdlist er_tdlist; volatile uint32_t er_gen; uint32_t er_cpuid; @@ -74,6 +77,9 @@ struct epoch { epoch_record_t e_pcpu_record; int e_idx; int e_flags; + struct sx e_drain_sx; + struct mtx e_drain_mtx; + volatile int e_drain_count; }; /* arbitrary --- needs benchmarking */ @@ -178,6 +184,7 @@ epoch_ctor(epoch_t epoch) ck_epoch_register(&epoch->e_epoch, &er->er_record, NULL); TAILQ_INIT((struct threadlist *)(uintptr_t)&er->er_tdlist); er->er_cpuid = cpu; + er->er_parent = epoch; } } @@ -203,6 +210,8 @@ epoch_alloc(int flags) MPASS(epoch_count < MAX_EPOCHS - 2); epoch->e_flags = flags; epoch->e_idx = epoch_count; + sx_init(&epoch->e_drain_sx, "epoch-drain-sx"); + mtx_init(&epoch->e_drain_mtx, "epoch-drain-mtx", NULL, MTX_DEF); allepochs[epoch_count++] = epoch; return (epoch); } @@ -210,18 +219,13 @@ epoch_alloc(int flags) void epoch_free(epoch_t epoch) { -#ifdef INVARIANTS - struct epoch_record *er; - int cpu; - CPU_FOREACH(cpu) { - er = zpcpu_get_cpu(epoch->e_pcpu_record, cpu); - MPASS(TAILQ_EMPTY(&er->er_tdlist)); - } -#endif + epoch_drain_callbacks(epoch); allepochs[epoch->e_idx] = NULL; epoch_wait(global_epoch); uma_zfree_pcpu(pcpu_zone_record, epoch->e_pcpu_record); + mtx_destroy(&epoch->e_drain_mtx); + sx_destroy(&epoch->e_drain_sx); free(epoch, M_EPOCH); } @@ -655,6 +659,83 @@ int in_epoch(epoch_t epoch) { return (in_epoch_verbose(epoch, 0)); +} + +static void +epoch_drain_cb(struct epoch_context *ctx) +{ + struct epoch *epoch = + __containerof(ctx, struct epoch_record, er_drain_ctx)->er_parent; + + if (atomic_fetchadd_int(&epoch->e_drain_count, -1) == 1) { + mtx_lock(&epoch->e_drain_mtx); + wakeup(epoch); + mtx_unlock(&epoch->e_drain_mtx); + } +} + +void +epoch_drain_callbacks(epoch_t epoch) +{ + epoch_record_t er; + struct thread *td; + int was_bound; + int old_pinned; + int old_cpu; + int cpu; + + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "epoch_drain_callbacks() may sleep!"); + + /* too early in boot to have epoch set up */ + if (__predict_false(epoch == NULL)) + return; +#if !defined(EARLY_AP_STARTUP) + if (__predict_false(inited < 2)) + return; +#endif + DROP_GIANT(); + + sx_xlock(&epoch->e_drain_sx); + mtx_lock(&epoch->e_drain_mtx); + + td = curthread; + thread_lock(td); + old_cpu = PCPU_GET(cpuid); + old_pinned = td->td_pinned; + was_bound = sched_is_bound(td); + sched_unbind(td); + td->td_pinned = 0; + + CPU_FOREACH(cpu) + epoch->e_drain_count++; + CPU_FOREACH(cpu) { + er = zpcpu_get_cpu(epoch->e_pcpu_record, cpu); + sched_bind(td, cpu); + epoch_call(epoch, &er->er_drain_ctx, &epoch_drain_cb); + } + + /* restore CPU binding, if any */ + if (was_bound != 0) { + sched_bind(td, old_cpu); + } else { + /* get thread back to initial CPU, if any */ + if (old_pinned != 0) + sched_bind(td, old_cpu); + sched_unbind(td); + } + /* restore pinned after bind */ + td->td_pinned = old_pinned; + + thread_unlock(td); + + while (epoch->e_drain_count != 0) + msleep(epoch, &epoch->e_drain_mtx, PZERO, "EDRAIN", 0); + + mtx_unlock(&epoch->e_drain_mtx); + sx_xunlock(&epoch->e_drain_sx); + + PICKUP_GIANT(); } void Modified: head/sys/sys/epoch.h ============================================================================== --- head/sys/sys/epoch.h Fri Jun 28 05:11:02 2019 (r349505) +++ head/sys/sys/epoch.h Fri Jun 28 10:38:56 2019 (r349506) @@ -69,6 +69,7 @@ epoch_t epoch_alloc(int flags); void epoch_free(epoch_t epoch); void epoch_wait(epoch_t epoch); void epoch_wait_preempt(epoch_t epoch); +void epoch_drain_callbacks(epoch_t epoch); void epoch_call(epoch_t epoch, epoch_context_t ctx, void (*callback) (epoch_context_t)); int in_epoch(epoch_t epoch); int in_epoch_verbose(epoch_t epoch, int dump_onfail); From owner-svn-src-head@freebsd.org Fri Jun 28 10:49:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4678C15DEA04; Fri, 28 Jun 2019 10:49:05 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E08CD6C8D6; Fri, 28 Jun 2019 10:49: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 B9D57259B9; Fri, 28 Jun 2019 10:49: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 x5SAn4tR093469; Fri, 28 Jun 2019 10:49:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SAn4op093468; Fri, 28 Jun 2019 10:49:04 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201906281049.x5SAn4op093468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 28 Jun 2019 10:49:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349507 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 349507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E08CD6C8D6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 10:49:05 -0000 Author: hselasky Date: Fri Jun 28 10:49:04 2019 New Revision: 349507 URL: https://svnweb.freebsd.org/changeset/base/349507 Log: Need to wait for epoch callbacks to complete before detaching a network interface. This particularly manifests itself when an INP has multicast options attached during a network interface detach. Then the IPv4 and IPv6 leave group call which results from freeing the multicast address, may access a freed ifnet structure. These are the steps to reproduce: service mdnsd onestart # installed from ports ifconfig epair create ifconfig epair0a 0/24 up ifconfig epair0a destroy Tested by: pho @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Fri Jun 28 10:38:56 2019 (r349506) +++ head/sys/net/if.c Fri Jun 28 10:49:04 2019 (r349507) @@ -1127,6 +1127,15 @@ if_detach_internal(struct ifnet *ifp, int vmove, struc curvnet->vnet_ifcnt--; #endif epoch_wait_preempt(net_epoch_preempt); + + /* + * Ensure all pending EPOCH(9) callbacks have been executed. This + * fixes issues about late destruction of multicast options + * which lead to leave group calls, which in turn access the + * belonging ifnet structure: + */ + epoch_drain_callbacks(net_epoch_preempt); + /* * In any case (destroy or vmove) detach us from the groups * and remove/wait for pending events on the taskq. From owner-svn-src-head@freebsd.org Fri Jun 28 10:53:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA3DF15DEC2E; Fri, 28 Jun 2019 10:53: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 3170D6CD31; Fri, 28 Jun 2019 10:53: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 1193F14AEDA; Fri, 28 Jun 2019 20:53:55 +1000 (AEST) Date: Fri, 28 Jun 2019 20:53:54 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Cy Schubert cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349503 - head/contrib/ipfilter/man In-Reply-To: <201906280428.x5S4SXhf094525@repo.freebsd.org> Message-ID: <20190628202903.J1192@besplex.bde.org> References: <201906280428.x5S4SXhf094525@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=P6RKvmIu c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=Dw3HR1N7fkTZfM9K41MA:9 a=CjuIK1q_8ugA:10 X-Rspamd-Queue-Id: 3170D6CD31 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-7.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.996,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 10:54:00 -0000 On Fri, 28 Jun 2019, Cy Schubert wrote: > Log: > Document the -B, binary logfile, and the -C config file options. > Reference the ipmon.5 man page and ipmon.conf. > > PR: 238816 > MFC after: 1 week > > Modified: > head/contrib/ipfilter/man/ipmon.8 > > Modified: head/contrib/ipfilter/man/ipmon.8 > ============================================================================== > --- head/contrib/ipfilter/man/ipmon.8 Fri Jun 28 04:18:10 2019 (r349502) > +++ head/contrib/ipfilter/man/ipmon.8 Fri Jun 28 04:28:32 2019 (r349503) > @@ -7,6 +7,10 @@ ipmon \- monitors /dev/ipl for logged packets > [ > .B \-abBDFhnpstvxX -B was misdocumented as a flag here, and still is. > ] [ > +.B "\-B " > +] [ This file isn't written in mdoc. This gives errors starting with misformatting the SYNOPIS. The most obvious ones are: - split lines are not properly indented - splitting is done in bad places (after '[' for [ ] - unusual quoting. mdoc would not put angle brackets and spaces around 'filename. These brackets and spaces seem to be mostly hard-coded using .B and literals. - bad rendering or for square brackets around NSI. These square brackets mean optional options as usual, but are not rendered normally. The .B macro apparently gives normal rendering for outer square brackets, but the inner square brackets around NSI use the same rendering as the letters. - various misorderings: -N before -L, -f after -[NLoOPS; NSI randomly ordered. The recent fixes to the usage message have the correct order for [-NLf], and different misformatting for split lines, so are hard to compare with the man page. This commit makes the usage message out of date again. Bruce From owner-svn-src-head@freebsd.org Fri Jun 28 12:01:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 725E415B3C11; Fri, 28 Jun 2019 12:01:23 +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 000EF6F02B; Fri, 28 Jun 2019 12:01:21 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id gpZ7hsoxKldkPgpZ8hstz8; Fri, 28 Jun 2019 06:01:19 -0600 X-Authority-Analysis: v=2.3 cv=Ko4zJleN c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=dq6fvYVFJ5YA:10 a=JzwRw_2MAAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=KN_jujpiJkyYWXqJCzAA: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 7F4333FB; Fri, 28 Jun 2019 05:01:16 -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 x5SC1Gdx006426; Fri, 28 Jun 2019 05:01:16 -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 x5SC1FE4006423; Fri, 28 Jun 2019 05:01:16 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201906281201.x5SC1FE4006423@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Bruce Evans cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349503 - head/contrib/ipfilter/man In-Reply-To: Message from Bruce Evans of "Fri, 28 Jun 2019 20:53:54 +1000." <20190628202903.J1192@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 28 Jun 2019 05:01:15 -0700 X-CMAE-Envelope: MS4wfMO2KBBjKMpqdcvWuAvX2YEAe5i87RE6sahoy9W/xW5p+GLDUMMOvtoLwf4gLuJh/KbmUUGHaSyuKbrriUTsnQ3ggkBTMXcsm0KPIJOtNrp7xpogfJCk IaeJMcmBKTXcKo2oGNlBS1FtAF5b6T5tgdKUl25oCZhvtnLNrGrRm5/sBzGrLOPwT1QpOSPegHnUq0UXoyV58+b3rK0gDuzh+JmHDyuxOFPCNxDyvNcfNKgb PJ6+mBvuuzhjwTRvLb6N+GTz7Xj8hFcKXN9DdJEGGxUNz+HxRt7mqozlUo7eODcUDc5gVcddol7CCuPc0fR9HQ== X-Rspamd-Queue-Id: 000EF6F02B X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-5.23 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; HAS_XAW(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; MX_GOOD(-0.01)[cached: spqr.komquats.com]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; FREEMAIL_TO(0.00)[optusnet.com.au]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.zen.spamhaus.org : 127.0.0.11]; IP_SCORE(-2.56)[ip: (-6.87), ipnet: 64.59.128.0/20(-3.28), asn: 6327(-2.54), country: CA(-0.09)]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_IN_DNSWL_LOW(-0.10)[13.134.59.64.list.dnswl.org : 127.0.5.1]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; R_DKIM_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; R_SPF_NA(0.00)[]; RCVD_TLS_LAST(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 12:01:23 -0000 In message <20190628202903.J1192@besplex.bde.org>, Bruce Evans writes: > On Fri, 28 Jun 2019, Cy Schubert wrote: > > > Log: > > Document the -B, binary logfile, and the -C config file options. > > Reference the ipmon.5 man page and ipmon.conf. > > > > PR: 238816 > > MFC after: 1 week > > > > Modified: > > head/contrib/ipfilter/man/ipmon.8 > > > > Modified: head/contrib/ipfilter/man/ipmon.8 > > =========================================================================== > === > > --- head/contrib/ipfilter/man/ipmon.8 Fri Jun 28 04:18:10 2019 > (r349502) > > +++ head/contrib/ipfilter/man/ipmon.8 Fri Jun 28 04:28:32 2019 > (r349503) > > @@ -7,6 +7,10 @@ ipmon \- monitors /dev/ipl for logged packets > > [ > > .B \-abBDFhnpstvxX > > -B was misdocumented as a flag here, and still is. > > > ] [ > > +.B "\-B " > > +] [ > > This file isn't written in mdoc. This gives errors starting with > misformatting the SYNOPIS. The most obvious ones are: > - split lines are not properly indented > - splitting is done in bad places (after '[' for [ ] > - unusual quoting. mdoc would not put angle brackets and spaces around > 'filename. These brackets and spaces seem to be mostly hard-coded > using .B and literals. > - bad rendering or for square brackets around NSI. These square brackets > mean optional options as usual, but are not rendered normally. The .B > macro apparently gives normal rendering for outer square brackets, but > the inner square brackets around NSI use the same rendering as the letters > . > - various misorderings: -N before -L, -f after -[NLoOPS; NSI randomly > ordered. > > The recent fixes to the usage message have the correct order for [-NLf], > and different misformatting for split lines, so are hard to compare with > the man page. > > This commit makes the usage message out of date again. Agreed, the ipfilter man pages should be rewritten into mandoc and synced with usage(). I considered doing that but as PR grew and no one suggested it, rewriting the man page is out of scope for the PR. It is something I considered but best left for after more important bugs are fixed. So yes, these issues are in my queue. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. > > Bruce From owner-svn-src-head@freebsd.org Fri Jun 28 15:49:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9902915C4C99; Fri, 28 Jun 2019 15:49:15 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A9B876649; Fri, 28 Jun 2019 15:49:15 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EDE2D78; Fri, 28 Jun 2019 15:49:15 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5SFnFEa049048; Fri, 28 Jun 2019 15:49:15 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SFnF5J049047; Fri, 28 Jun 2019 15:49:15 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201906281549.x5SFnF5J049047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Fri, 28 Jun 2019 15:49:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349508 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 349508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3A9B876649 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 15:49:15 -0000 Author: luporl Date: Fri Jun 28 15:49:14 2019 New Revision: 349508 URL: https://svnweb.freebsd.org/changeset/base/349508 Log: Fix missing powerpc64 in _LLVM_TARGET_FILT This change was originally in D20378. Making it in a new diff since it's a bugfix. Submitted by: alfredo.junior_eldorado.org.br Reviewed by: emaste, luporl Differential Revision: https://reviews.freebsd.org/D20756 Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Jun 28 10:49:04 2019 (r349507) +++ head/share/mk/src.opts.mk Fri Jun 28 15:49:14 2019 (r349508) @@ -269,7 +269,7 @@ __LLVM_TARGETS= \ powerpc \ sparc \ x86 -__LLVM_TARGET_FILT= C/(amd64|i386)/x86/:S/sparc64/sparc/:S/arm64/aarch64/ +__LLVM_TARGET_FILT= C/(amd64|i386)/x86/:S/sparc64/sparc/:S/arm64/aarch64/:S/powerpc64/powerpc/ .for __llt in ${__LLVM_TARGETS} # Default the given TARGET's LLVM_TARGET support to the value of MK_CLANG. .if ${__TT:${__LLVM_TARGET_FILT}} == ${__llt} From owner-svn-src-head@freebsd.org Fri Jun 28 15:52:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43F3615C51BA; Fri, 28 Jun 2019 15:52:41 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D9C2776C9E; Fri, 28 Jun 2019 15:52:40 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7F13F36; Fri, 28 Jun 2019 15:52:40 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5SFqe1O053850; Fri, 28 Jun 2019 15:52:40 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SFqe2D053849; Fri, 28 Jun 2019 15:52:40 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201906281552.x5SFqe2D053849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Fri, 28 Jun 2019 15:52:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349509 - head/contrib/file/magic/Magdir X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/contrib/file/magic/Magdir X-SVN-Commit-Revision: 349509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D9C2776C9E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 15:52:41 -0000 Author: luporl Date: Fri Jun 28 15:52:40 2019 New Revision: 349509 URL: https://svnweb.freebsd.org/changeset/base/349509 Log: [PowerPC64] Add ABI flags to 'file' magic The distinction between ELF header version and OpenPOWER ELF ABI version is confusing for most of people, so this adds text to "file" output to make it clear about which OpenPOWER ELF ABI version binary was built for. The strings used in this change are based on "64-Bit ELF V2 ABI Specification/3.1. ELF Header" document available at http://openpowerfoundation.org/wp-content/uploads/resources/leabi/content/dbdoclet.50655241_97607.html Example: $ file t1-Flag2 -m -m contrib/file/magic/Magdir/elf t1-Flag2: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, OpenPOWER ELF V2 ABI, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 13.0 (1300033), FreeBSD-style, not stripped Submitted by: alfredo.junior_eldorado.org.br Reviewed by: luporl Differential Revision: https://reviews.freebsd.org/D20771 Modified: head/contrib/file/magic/Magdir/elf Modified: head/contrib/file/magic/Magdir/elf ============================================================================== --- head/contrib/file/magic/Magdir/elf Fri Jun 28 15:49:14 2019 (r349508) +++ head/contrib/file/magic/Magdir/elf Fri Jun 28 15:52:40 2019 (r349509) @@ -108,6 +108,9 @@ >18 leshort 19 Intel 80960, >18 leshort 20 PowerPC or cisco 4500, >18 leshort 21 64-bit PowerPC or cisco 7500, +>>48 lelong 0 Unspecified or Power ELF V1 ABI, +>>48 lelong 1 Power ELF V1 ABI, +>>48 lelong 2 OpenPOWER ELF V2 ABI, >18 leshort 22 IBM S/390, >18 leshort 23 Cell SPU, >18 leshort 24 cisco SVIP, From owner-svn-src-head@freebsd.org Fri Jun 28 16:00:56 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A7E815C5488; Fri, 28 Jun 2019 16:00:56 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 333FD77065; Fri, 28 Jun 2019 16:00:56 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EB57F68; Fri, 28 Jun 2019 16:00:56 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5SG0tF8057786; Fri, 28 Jun 2019 16:00:55 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SG0tPC057785; Fri, 28 Jun 2019 16:00:55 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201906281600.x5SG0tPC057785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Fri, 28 Jun 2019 16:00:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349510 - head/contrib/elftoolchain/readelf X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/contrib/elftoolchain/readelf X-SVN-Commit-Revision: 349510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 333FD77065 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 16:00:56 -0000 Author: luporl Date: Fri Jun 28 16:00:55 2019 New Revision: 349510 URL: https://svnweb.freebsd.org/changeset/base/349510 Log: [PowerPC64] readelf: print description for 'e_flags' in ELF header (ABI type) This prints out description text with the meaning of 'Flags' value in PowerPC64. Example: $ readelf -h ~/tmp/t1-Flag2 ELF Header: Magic: 7f 45 4c 46 02 02 01 09 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, big endian Version: 1 (current) OS/ABI: FreeBSD ABI Version: 0 Type: EXEC (Executable file) Machine: PowerPC 64-bit Version: 0x1 Entry point address: 0x10010000 Start of program headers: 64 (bytes into file) Start of section headers: 209368 (bytes into file) Flags: 0x2, OpenPOWER ELF V2 ABI Size of this header: 64 (bytes) Size of program headers: 56 (bytes) Number of program headers: 10 Size of section headers: 64 (bytes) Number of section headers: 34 Section header string table index: 31 Submitted by: alfredo.junior_eldorado.org.br Reviewed by: luporl Differential Revision: https://reviews.freebsd.org/D20782 Modified: head/contrib/elftoolchain/readelf/readelf.c Modified: head/contrib/elftoolchain/readelf/readelf.c ============================================================================== --- head/contrib/elftoolchain/readelf/readelf.c Fri Jun 28 15:52:40 2019 (r349509) +++ head/contrib/elftoolchain/readelf/readelf.c Fri Jun 28 16:00:55 2019 (r349510) @@ -2297,8 +2297,15 @@ dump_eflags(struct readelf *re, uint64_t e_flags) } edesc = mips_eflags_desc; break; - case EM_PPC: case EM_PPC64: + switch (e_flags) { + case 0: printf(", Unspecified or Power ELF V1 ABI"); break; + case 1: printf(", Power ELF V1 ABI"); break; + case 2: printf(", OpenPOWER ELF V2 ABI"); break; + default: break; + } + /* explicit fall through*/ + case EM_PPC: edesc = powerpc_eflags_desc; break; case EM_RISCV: From owner-svn-src-head@freebsd.org Fri Jun 28 16:42:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91F9415C6033; Fri, 28 Jun 2019 16:42:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2EA87802DC; Fri, 28 Jun 2019 16:42:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 039C617E6; Fri, 28 Jun 2019 16:42:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5SGgipH080182; Fri, 28 Jun 2019 16:42:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SGgisF080181; Fri, 28 Jun 2019 16:42:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201906281642.x5SGgisF080181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Jun 2019 16:42:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349511 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 349511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2EA87802DC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 16:42:45 -0000 Author: kib Date: Fri Jun 28 16:42:44 2019 New Revision: 349511 URL: https://svnweb.freebsd.org/changeset/base/349511 Log: Typo. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/lib/libc/sys/procctl.2 Modified: head/lib/libc/sys/procctl.2 ============================================================================== --- head/lib/libc/sys/procctl.2 Fri Jun 28 16:00:55 2019 (r349510) +++ head/lib/libc/sys/procctl.2 Fri Jun 28 16:42:44 2019 (r349511) @@ -91,7 +91,7 @@ The image flag and set-uid might prevent ASLR enableme .It Dv PROC_ASLR_FORCE_DISABLE Request that ASLR is disabled after execution. Same notes as for -.Dv PROC_ASKR_FORCE_ENABLE +.Dv PROC_ASLR_FORCE_ENABLE apply. .It Dv PROC_ASLR_NOFORCE Use system-wide configured policy for ASLR. From owner-svn-src-head@freebsd.org Fri Jun 28 16:45:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81C9915C60ED; Fri, 28 Jun 2019 16:45:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2409E80449; Fri, 28 Jun 2019 16:45:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 74296138A5; Fri, 28 Jun 2019 16:45:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r349482 - in head/contrib/elftoolchain: common readelf To: Mitchell Horne , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201906280010.x5S0ARLh056619@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Fri, 28 Jun 2019 09:45:09 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <201906280010.x5S0ARLh056619@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 2409E80449 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.945,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 16:45:11 -0000 On 6/27/19 5:10 PM, Mitchell Horne wrote: > Author: mhorne > Date: Fri Jun 28 00:10:26 2019 > New Revision: 349482 > URL: https://svnweb.freebsd.org/changeset/base/349482 > > Log: > readelf: Add support for RISC-V specific e_flags > > Reviewed by: markj > Approved by: markj (mentor) > MFC after: 3 days > Differential Revision: https://reviews.freebsd.org/D20767 > > Modified: > head/contrib/elftoolchain/common/elfdefinitions.h > head/contrib/elftoolchain/readelf/readelf.c > > Modified: head/contrib/elftoolchain/common/elfdefinitions.h > ============================================================================== > --- head/contrib/elftoolchain/common/elfdefinitions.h Fri Jun 28 00:03:29 2019 (r349481) > +++ head/contrib/elftoolchain/common/elfdefinitions.h Fri Jun 28 00:10:26 2019 (r349482) > @@ -426,6 +426,22 @@ _ELF_DEFINE_EF(EF_PPC_RELOCATABLE, 0x00010000UL, \ > "-mrelocatable flag") \ > _ELF_DEFINE_EF(EF_PPC_RELOCATABLE_LIB, 0x00008000UL, \ > "-mrelocatable-lib flag") \ > +_ELF_DEFINE_EF(EF_RISCV_RVE, 0x00000008UL, \ > + "Compressed instruction ABI") \ I don't think this description for RVE is quite right. RVE is for RV32E which is not using compressed ('C') instructions, but using a smaller register file (16 GPRs instead of 32) which is in theory intended for embedded / microprocessor variants. The riscv-elf-psabi-doc describes it as: EF_RISCV_RVE (0x0008): This bit is set when the binary targets the E ABI. -- John Baldwin From owner-svn-src-head@freebsd.org Fri Jun 28 18:03:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB1C115C776D; Fri, 28 Jun 2019 18:03:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D55D825E3; Fri, 28 Jun 2019 18:03:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65F192530; Fri, 28 Jun 2019 18:03:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5SI3EcZ021984; Fri, 28 Jun 2019 18:03:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SI3E7B021983; Fri, 28 Jun 2019 18:03:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201906281803.x5SI3E7B021983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Jun 2019 18:03:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349512 - head/usr.bin/proccontrol X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/usr.bin/proccontrol X-SVN-Commit-Revision: 349512 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8D55D825E3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 18:03:15 -0000 Author: kib Date: Fri Jun 28 18:03:13 2019 New Revision: 349512 URL: https://svnweb.freebsd.org/changeset/base/349512 Log: Mention proccontrol(1) -m kpti. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/usr.bin/proccontrol/proccontrol.1 Modified: head/usr.bin/proccontrol/proccontrol.1 ============================================================================== --- head/usr.bin/proccontrol/proccontrol.1 Fri Jun 28 16:42:44 2019 (r349511) +++ head/usr.bin/proccontrol/proccontrol.1 Fri Jun 28 18:03:13 2019 (r349512) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 13, 2019 +.Dd June 28, 2019 .Dt PROCCONTROL 1 .Os .Sh NAME @@ -66,6 +66,8 @@ Note that process is only allowed to enable tracing fo not for any other process. .It Ar trapcap Controls the signalling of capability mode access violations. +.It Ar kpti +Controls the KPTI enable, AMD64 only. .El .Pp The From owner-svn-src-head@freebsd.org Fri Jun 28 19:27:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A502515C9996; Fri, 28 Jun 2019 19:27:46 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A4F2852A2; Fri, 28 Jun 2019 19:27:46 +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 238FE33B8; Fri, 28 Jun 2019 19:27:46 +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 x5SJRkNk064327; Fri, 28 Jun 2019 19:27:46 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SJRkLg064326; Fri, 28 Jun 2019 19:27:46 GMT (envelope-from np@FreeBSD.org) Message-Id: <201906281927.x5SJRkLg064326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 28 Jun 2019 19:27:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349514 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 349514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4A4F2852A2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 19:27:46 -0000 Author: np Date: Fri Jun 28 19:27:45 2019 New Revision: 349514 URL: https://svnweb.freebsd.org/changeset/base/349514 Log: cxgbe/t4_tom: the AIO tx job queue must be empty by the time the driver releases the offload resources associated with the tid. Reviewed by: jhb@ MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D20798 Modified: head/sys/dev/cxgbe/tom/t4_tom.c Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Fri Jun 28 18:48:02 2019 (r349513) +++ head/sys/dev/cxgbe/tom/t4_tom.c Fri Jun 28 19:27:45 2019 (r349514) @@ -294,6 +294,7 @@ release_offload_resources(struct toepcb *toep) if (toep->ulp_mode == ULP_MODE_TCPDDP) ddp_assert_empty(toep); #endif + MPASS(TAILQ_EMPTY(&toep->aiotx_jobq)); if (toep->l2te) t4_l2t_release(toep->l2te); From owner-svn-src-head@freebsd.org Fri Jun 28 19:37:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FFCF15C9DE3; Fri, 28 Jun 2019 19:37:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D48FB85910; Fri, 28 Jun 2019 19:37:48 +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 AA2E53728; Fri, 28 Jun 2019 19:37:48 +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 x5SJbm0M069685; Fri, 28 Jun 2019 19:37:48 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SJbmiC069684; Fri, 28 Jun 2019 19:37:48 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201906281937.x5SJbmiC069684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 28 Jun 2019 19:37:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349515 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 349515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D48FB85910 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 19:37:49 -0000 Author: jhb Date: Fri Jun 28 19:37:48 2019 New Revision: 349515 URL: https://svnweb.freebsd.org/changeset/base/349515 Log: Use a tab after #define for EXT_* constants. This matches other #define's in this manpage as well as . Sponsored by: Netflix Modified: head/share/man/man9/mbuf.9 Modified: head/share/man/man9/mbuf.9 ============================================================================== --- head/share/man/man9/mbuf.9 Fri Jun 28 19:27:45 2019 (r349514) +++ head/share/man/man9/mbuf.9 Fri Jun 28 19:37:48 2019 (r349515) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 27, 2017 +.Dd June 28, 2019 .Dt MBUF 9 .Os .\" @@ -247,17 +247,17 @@ types are defined as follows: The available external buffer types are defined as follows: .Bd -literal /* external buffer types */ -#define EXT_CLUSTER 1 /* mbuf cluster */ -#define EXT_SFBUF 2 /* sendfile(2)'s sf_bufs */ -#define EXT_JUMBOP 3 /* jumbo cluster 4096 bytes */ -#define EXT_JUMBO9 4 /* jumbo cluster 9216 bytes */ -#define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */ -#define EXT_PACKET 6 /* mbuf+cluster from packet zone */ -#define EXT_MBUF 7 /* external mbuf reference */ -#define EXT_NET_DRV 252 /* custom ext_buf provided by net driver(s) */ -#define EXT_MOD_TYPE 253 /* custom module's ext_buf type */ -#define EXT_DISPOSABLE 254 /* can throw this buffer away w/page flipping */ -#define EXT_EXTREF 255 /* has externally maintained ref_cnt ptr */ +#define EXT_CLUSTER 1 /* mbuf cluster */ +#define EXT_SFBUF 2 /* sendfile(2)'s sf_bufs */ +#define EXT_JUMBOP 3 /* jumbo cluster 4096 bytes */ +#define EXT_JUMBO9 4 /* jumbo cluster 9216 bytes */ +#define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */ +#define EXT_PACKET 6 /* mbuf+cluster from packet zone */ +#define EXT_MBUF 7 /* external mbuf reference */ +#define EXT_NET_DRV 252 /* custom ext_buf provided by net driver(s) */ +#define EXT_MOD_TYPE 253 /* custom module's ext_buf type */ +#define EXT_DISPOSABLE 254 /* can throw this buffer away w/page flipping */ +#define EXT_EXTREF 255 /* has externally maintained ref_cnt ptr */ .Ed .Pp If the From owner-svn-src-head@freebsd.org Fri Jun 28 19:49:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA38615CA292; Fri, 28 Jun 2019 19:49:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 71CAD85EE8; Fri, 28 Jun 2019 19:49:48 +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 6357338E3; Fri, 28 Jun 2019 19:49:48 +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 x5SJnmWB074967; Fri, 28 Jun 2019 19:49:48 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SJnmFr074966; Fri, 28 Jun 2019 19:49:48 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201906281949.x5SJnmFr074966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 28 Jun 2019 19:49:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349516 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 349516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 71CAD85EE8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 19:49:49 -0000 Author: jhb Date: Fri Jun 28 19:49:47 2019 New Revision: 349516 URL: https://svnweb.freebsd.org/changeset/base/349516 Log: Sync mbuf flags, types, and external buffer types with . Sponsored by: Netflix Modified: head/share/man/man9/mbuf.9 Modified: head/share/man/man9/mbuf.9 ============================================================================== --- head/share/man/man9/mbuf.9 Fri Jun 28 19:37:48 2019 (r349515) +++ head/share/man/man9/mbuf.9 Fri Jun 28 19:49:47 2019 (r349516) @@ -209,11 +209,21 @@ The .Vt mbuf flag bits are defined as follows: .Bd -literal -/* mbuf flags */ #define M_EXT 0x00000001 /* has associated external storage */ #define M_PKTHDR 0x00000002 /* start of record */ #define M_EOR 0x00000004 /* end of record */ #define M_RDONLY 0x00000008 /* associated data marked read-only */ +#define M_NOMAP 0x00000100 /* mbuf data is unmapped (soon from Drew) */ +#define M_NOFREE 0x00000200 /* do not free mbuf, embedded in cluster */ +#define M_BCAST 0x00000010 /* send/received as link-level broadcast */ +#define M_MCAST 0x00000020 /* send/received as link-level multicast */ +#define M_PROMISC 0x00000040 /* packet was not for us */ +#define M_VLANTAG 0x00000080 /* ether_vtag is valid */ +#define M_TSTMP 0x00000400 /* rcv_tstmp field is valid */ +#define M_TSTMP_HPREC 0x00000800 /* rcv_tstmp is high-prec, typically + hw-stamped on port (useful for IEEE 1588 + and 802.1AS) */ + #define M_PROTO1 0x00001000 /* protocol-specific */ #define M_PROTO2 0x00002000 /* protocol-specific */ #define M_PROTO3 0x00004000 /* protocol-specific */ @@ -226,27 +236,34 @@ flag bits are defined as follows: #define M_PROTO10 0x00200000 /* protocol-specific */ #define M_PROTO11 0x00400000 /* protocol-specific */ #define M_PROTO12 0x00800000 /* protocol-specific */ - -/* mbuf pkthdr flags (also stored in m_flags) */ -#define M_BCAST 0x00000010 /* send/received as link-level broadcast */ -#define M_MCAST 0x00000020 /* send/received as link-level multicast */ .Ed .Pp The available .Vt mbuf types are defined as follows: .Bd -literal -/* mbuf types */ #define MT_DATA 1 /* dynamic (data) allocation */ #define MT_HEADER MT_DATA /* packet header */ + +#define MT_VENDOR1 4 /* for vendor-internal use */ +#define MT_VENDOR2 5 /* for vendor-internal use */ +#define MT_VENDOR3 6 /* for vendor-internal use */ +#define MT_VENDOR4 7 /* for vendor-internal use */ + #define MT_SONAME 8 /* socket name */ + +#define MT_EXP1 9 /* for experimental use */ +#define MT_EXP2 10 /* for experimental use */ +#define MT_EXP3 11 /* for experimental use */ +#define MT_EXP4 12 /* for experimental use */ + #define MT_CONTROL 14 /* extra-data protocol message */ -#define MT_OOBDATA 15 /* expedited data */ +#define MT_EXTCONTROL 15 /* control message with externalized contents */ +#define MT_OOBDATA 16 /* expedited data */ .Ed .Pp The available external buffer types are defined as follows: .Bd -literal -/* external buffer types */ #define EXT_CLUSTER 1 /* mbuf cluster */ #define EXT_SFBUF 2 /* sendfile(2)'s sf_bufs */ #define EXT_JUMBOP 3 /* jumbo cluster 4096 bytes */ @@ -254,6 +271,18 @@ The available external buffer types are defined as fol #define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */ #define EXT_PACKET 6 /* mbuf+cluster from packet zone */ #define EXT_MBUF 7 /* external mbuf reference */ +#define EXT_RXRING 8 /* data in NIC receive ring */ + +#define EXT_VENDOR1 224 /* for vendor-internal use */ +#define EXT_VENDOR2 225 /* for vendor-internal use */ +#define EXT_VENDOR3 226 /* for vendor-internal use */ +#define EXT_VENDOR4 227 /* for vendor-internal use */ + +#define EXT_EXP1 244 /* for experimental use */ +#define EXT_EXP2 245 /* for experimental use */ +#define EXT_EXP3 246 /* for experimental use */ +#define EXT_EXP4 247 /* for experimental use */ + #define EXT_NET_DRV 252 /* custom ext_buf provided by net driver(s) */ #define EXT_MOD_TYPE 253 /* custom module's ext_buf type */ #define EXT_DISPOSABLE 254 /* can throw this buffer away w/page flipping */ From owner-svn-src-head@freebsd.org Fri Jun 28 19:57:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEB3D15CA4F6; Fri, 28 Jun 2019 19:57:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40D3C86358; Fri, 28 Jun 2019 19:57:43 +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 EAF833B22; Fri, 28 Jun 2019 19:57:42 +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 x5SJvgO5080086; Fri, 28 Jun 2019 19:57:42 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SJvgNI080084; Fri, 28 Jun 2019 19:57:42 GMT (envelope-from np@FreeBSD.org) Message-Id: <201906281957.x5SJvgNI080084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 28 Jun 2019 19:57:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349517 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 349517 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 40D3C86358 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 19:57:44 -0000 Author: np Date: Fri Jun 28 19:57:42 2019 New Revision: 349517 URL: https://svnweb.freebsd.org/changeset/base/349517 Log: cxgbe/t4_tom: Tweaks to some of the AIO related CTRs. Reviewed by: jhb@ MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_ddp.c Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Jun 28 19:49:47 2019 (r349516) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Jun 28 19:57:42 2019 (r349517) @@ -724,8 +724,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep ("%s: ulp_mode %u for toep %p", __func__, toep->ulp_mode, toep)); #ifdef VERBOSE_TRACES - CTR4(KTR_CXGBE, "%s: tid %d toep flags %#x tp flags %#x drop %d", - __func__, toep->tid, toep->flags, tp->t_flags); + CTR5(KTR_CXGBE, "%s: tid %d toep flags %#x tp flags %#x drop %d", + __func__, toep->tid, toep->flags, tp->t_flags, drop); #endif if (__predict_false(toep->flags & TPF_ABORT_SHUTDOWN)) return; @@ -1244,8 +1244,10 @@ do_peer_close(struct sge_iq *iq, const struct rss_head INP_WLOCK(inp); tp = intotcpcb(inp); - CTR5(KTR_CXGBE, "%s: tid %u (%s), toep_flags 0x%x, inp %p", __func__, - tid, tp ? tcpstates[tp->t_state] : "no tp", toep->flags, inp); + CTR6(KTR_CXGBE, + "%s: tid %u (%s), toep_flags 0x%x, ddp_flags 0x%x, inp %p", + __func__, tid, tp ? tcpstates[tp->t_state] : "no tp", toep->flags, + toep->ddp.flags, inp); if (toep->flags & TPF_ABORT_SHUTDOWN) goto done; @@ -2227,7 +2229,7 @@ t4_aiotx_queue_toep(struct socket *so, struct toepcb * SOCKBUF_LOCK_ASSERT(&toep->inp->inp_socket->so_snd); #ifdef VERBOSE_TRACES CTR3(KTR_CXGBE, "%s: queueing aiotx task for tid %d, active = %s", - __func__, toep->tid, toep->aiotx_task_active ? "true" : "false"); + __func__, toep->tid, toep->aiotx_so != NULL ? "true" : "false"); #endif if (toep->aiotx_so != NULL) return; @@ -2283,7 +2285,7 @@ t4_aio_queue_aiotx(struct socket *so, struct kaiocb *j SOCKBUF_LOCK(&so->so_snd); #ifdef VERBOSE_TRACES - CTR2(KTR_CXGBE, "%s: queueing %p", __func__, job); + CTR3(KTR_CXGBE, "%s: queueing %p for tid %u", __func__, job, toep->tid); #endif if (!aio_set_cancel_function(job, t4_aiotx_cancel)) panic("new job was cancelled"); Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Fri Jun 28 19:49:47 2019 (r349516) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Fri Jun 28 19:57:42 2019 (r349517) @@ -263,8 +263,8 @@ complete_ddp_buffer(struct toepcb *toep, struct ddp_bu } else toep->ddp.active_id ^= 1; #ifdef VERBOSE_TRACES - CTR2(KTR_CXGBE, "%s: ddp_active_id = %d", __func__, - toep->ddp.active_id); + CTR3(KTR_CXGBE, "%s: tid %u, ddp_active_id = %d", __func__, + toep->tid, toep->ddp.active_id); #endif } else { KASSERT(toep->ddp.active_count != 0 && @@ -534,8 +534,8 @@ handle_ddp_data(struct toepcb *toep, __be32 ddp_report tp->rcv_wnd -= len; #endif #ifdef VERBOSE_TRACES - CTR4(KTR_CXGBE, "%s: DDP[%d] placed %d bytes (%#x)", __func__, db_idx, - len, report); + CTR5(KTR_CXGBE, "%s: tid %u, DDP[%d] placed %d bytes (%#x)", __func__, + toep->tid, db_idx, len, report); #endif /* receive buffer autosize */ @@ -574,8 +574,9 @@ handle_ddp_data(struct toepcb *toep, __be32 ddp_report } else { copied = job->aio_received; #ifdef VERBOSE_TRACES - CTR4(KTR_CXGBE, "%s: completing %p (copied %ld, placed %d)", - __func__, job, copied, len); + CTR5(KTR_CXGBE, + "%s: tid %u, completing %p (copied %ld, placed %d)", + __func__, toep->tid, job, copied, len); #endif aio_complete(job, copied + len, 0); t4_rcvd(&toep->td->tod, tp); @@ -1792,8 +1793,9 @@ sbcopy: } #ifdef VERBOSE_TRACES - CTR5(KTR_CXGBE, "%s: scheduling %p for DDP[%d] (flags %#lx/%#lx)", - __func__, job, db_idx, ddp_flags, ddp_flags_mask); + CTR6(KTR_CXGBE, + "%s: tid %u, scheduling %p for DDP[%d] (flags %#lx/%#lx)", __func__, + toep->tid, job, db_idx, ddp_flags, ddp_flags_mask); #endif /* Give the chip the go-ahead. */ t4_wrq_tx(sc, wr); @@ -1919,7 +1921,7 @@ t4_aio_queue_ddp(struct socket *so, struct kaiocb *job */ #ifdef VERBOSE_TRACES - CTR2(KTR_CXGBE, "%s: queueing %p", __func__, job); + CTR3(KTR_CXGBE, "%s: queueing %p for tid %u", __func__, job, toep->tid); #endif if (!aio_set_cancel_function(job, t4_aio_cancel_queued)) panic("new job was cancelled"); From owner-svn-src-head@freebsd.org Fri Jun 28 20:40:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 329A615CB448; Fri, 28 Jun 2019 20:40: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC756877CB; Fri, 28 Jun 2019 20:40: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 A8672424D; Fri, 28 Jun 2019 20:40:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5SKeslD003491; Fri, 28 Jun 2019 20:40:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SKes90003490; Fri, 28 Jun 2019 20:40:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201906282040.x5SKes90003490@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Jun 2019 20:40:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349519 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349519 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CC756877CB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 20:40:55 -0000 Author: kib Date: Fri Jun 28 20:40:54 2019 New Revision: 349519 URL: https://svnweb.freebsd.org/changeset/base/349519 Log: Style. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Fri Jun 28 20:28:20 2019 (r349518) +++ head/sys/kern/kern_umtx.c Fri Jun 28 20:40:54 2019 (r349519) @@ -2624,7 +2624,8 @@ do_cv_broadcast(struct thread *td, struct ucond *cv) } static int -do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag, struct _umtx_time *timeout) +do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag, + struct _umtx_time *timeout) { struct abs_timeout timo; struct umtx_q *uq; From owner-svn-src-head@freebsd.org Fri Jun 28 22:12:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBEC315CD533; Fri, 28 Jun 2019 22:12:44 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C8E38AD11; Fri, 28 Jun 2019 22:12:44 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 468F953B3; Fri, 28 Jun 2019 22:12:44 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5SMCixo054512; Fri, 28 Jun 2019 22:12:44 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SMChwt054510; Fri, 28 Jun 2019 22:12:43 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201906282212.x5SMChwt054510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 28 Jun 2019 22:12:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349520 - in head: sbin/etherswitchcfg sys/dev/etherswitch X-SVN-Group: head X-SVN-Commit-Author: loos X-SVN-Commit-Paths: in head: sbin/etherswitchcfg sys/dev/etherswitch X-SVN-Commit-Revision: 349520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6C8E38AD11 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 22:12:45 -0000 Author: loos Date: Fri Jun 28 22:12:43 2019 New Revision: 349520 URL: https://svnweb.freebsd.org/changeset/base/349520 Log: Add the 'drop tagged' flag support for ethernet switch ports. This is intended to drop all 802.1q tagged packets on a port. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sbin/etherswitchcfg/etherswitchcfg.8 head/sbin/etherswitchcfg/etherswitchcfg.c head/sys/dev/etherswitch/etherswitch.h Modified: head/sbin/etherswitchcfg/etherswitchcfg.8 ============================================================================== --- head/sbin/etherswitchcfg/etherswitchcfg.8 Fri Jun 28 20:40:54 2019 (r349519) +++ head/sbin/etherswitchcfg/etherswitchcfg.8 Fri Jun 28 22:12:43 2019 (r349520) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 2, 2016 +.Dd June 28, 2019 .Dt ETHERSWITCHCFG 8 .Os .Sh NAME @@ -147,6 +147,10 @@ MAC addresses. Disable the first lock option. Note that sometimes you need to reset the switch to really disable this option. +.It Cm droptagged +Drop packets with a VLAN tag. +.It Fl droptagged +Disable the drop tagged packets option. .It Cm dropuntagged Drop packets without a VLAN tag. .It Fl dropuntagged Modified: head/sbin/etherswitchcfg/etherswitchcfg.c ============================================================================== --- head/sbin/etherswitchcfg/etherswitchcfg.c Fri Jun 28 20:40:54 2019 (r349519) +++ head/sbin/etherswitchcfg/etherswitchcfg.c Fri Jun 28 22:12:43 2019 (r349520) @@ -215,6 +215,8 @@ set_port_flag(struct cfg *cfg, int argc, char *argv[]) f = ETHERSWITCH_PORT_ADDTAG; else if (strcasecmp(flag, "firstlock") == 0) f = ETHERSWITCH_PORT_FIRSTLOCK; + else if (strcasecmp(flag, "droptagged") == 0) + f = ETHERSWITCH_PORT_DROPTAGGED; else if (strcasecmp(flag, "dropuntagged") == 0) f = ETHERSWITCH_PORT_DROPUNTAGGED; else if (strcasecmp(flag, "doubletag") == 0) @@ -871,6 +873,8 @@ static struct cmds cmds[] = { { MODE_PORT, "-doubletag", 0, set_port_flag }, { MODE_PORT, "firstlock", 0, set_port_flag }, { MODE_PORT, "-firstlock", 0, set_port_flag }, + { MODE_PORT, "droptagged", 0, set_port_flag }, + { MODE_PORT, "-droptagged", 0, set_port_flag }, { MODE_PORT, "dropuntagged", 0, set_port_flag }, { MODE_PORT, "-dropuntagged", 0, set_port_flag }, { MODE_CONFIG, "vlan_mode", 1, set_vlan_mode }, Modified: head/sys/dev/etherswitch/etherswitch.h ============================================================================== --- head/sys/dev/etherswitch/etherswitch.h Fri Jun 28 20:40:54 2019 (r349519) +++ head/sys/dev/etherswitch/etherswitch.h Fri Jun 28 22:12:43 2019 (r349520) @@ -64,8 +64,10 @@ typedef struct etherswitch_conf etherswitch_conf_t; #define ETHERSWITCH_PORT_DROPUNTAGGED (1 << 4) #define ETHERSWITCH_PORT_DOUBLE_TAG (1 << 5) #define ETHERSWITCH_PORT_INGRESS (1 << 6) +#define ETHERSWITCH_PORT_DROPTAGGED (1 << 7) #define ETHERSWITCH_PORT_FLAGS_BITS \ -"\020\1CPUPORT\2STRIPTAG\3ADDTAG\4FIRSTLOCK\5DROPUNTAGGED\6QinQ\7INGRESS" +"\020\1CPUPORT\2STRIPTAG\3ADDTAG\4FIRSTLOCK\5DROPUNTAGGED\6QinQ\7INGRESS" \ +"\10DROPTAGGED" #define ETHERSWITCH_PORT_MAX_LEDS 3 From owner-svn-src-head@freebsd.org Fri Jun 28 22:19:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4E9615CD638; Fri, 28 Jun 2019 22:19:51 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 81A928AED3; Fri, 28 Jun 2019 22:19:51 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5741253BA; Fri, 28 Jun 2019 22:19:51 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5SMJpuS054827; Fri, 28 Jun 2019 22:19:51 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SMJpfg054825; Fri, 28 Jun 2019 22:19:51 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201906282219.x5SMJpfg054825@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 28 Jun 2019 22:19:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349521 - head/sys/dev/etherswitch/e6000sw X-SVN-Group: head X-SVN-Commit-Author: loos X-SVN-Commit-Paths: head/sys/dev/etherswitch/e6000sw X-SVN-Commit-Revision: 349521 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 81A928AED3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 22:19:52 -0000 Author: loos Date: Fri Jun 28 22:19:50 2019 New Revision: 349521 URL: https://svnweb.freebsd.org/changeset/base/349521 Log: Add the 802.1q support for the Marvell e6000 series of ethernet switches. Tested on: espressobin, Clearfog, SG-3100 and others Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c head/sys/dev/etherswitch/e6000sw/e6000swreg.h Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c ============================================================================== --- head/sys/dev/etherswitch/e6000sw/e6000sw.c Fri Jun 28 22:12:43 2019 (r349520) +++ head/sys/dev/etherswitch/e6000sw/e6000sw.c Fri Jun 28 22:19:50 2019 (r349521) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2015 Semihalf * Copyright (c) 2015 Stormshield + * Copyright (c) 2018-2019, Rubicon Communications, LLC (Netgate) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,7 +61,16 @@ MALLOC_DEFINE(M_E6000SW, "e6000sw", "e6000sw switch"); #define E6000SW_UNLOCK(_sc) sx_unlock(&(_sc)->sx) #define E6000SW_LOCK_ASSERT(_sc, _what) sx_assert(&(_sc)->sx, (_what)) #define E6000SW_TRYLOCK(_sc) sx_tryxlock(&(_sc)->sx) +#define E6000SW_WAITREADY(_sc, _reg, _bit) \ + e6000sw_waitready((_sc), REG_GLOBAL, (_reg), (_bit)) +#define E6000SW_WAITREADY2(_sc, _reg, _bit) \ + e6000sw_waitready((_sc), REG_GLOBAL2, (_reg), (_bit)) +#define MDIO_READ(dev, addr, reg) \ + MDIO_READREG(device_get_parent(dev), (addr), (reg)) +#define MDIO_WRITE(dev, addr, reg, val) \ + MDIO_WRITEREG(device_get_parent(dev), (addr), (reg), (val)) + typedef struct e6000sw_softc { device_t dev; phandle_t node; @@ -71,6 +81,7 @@ typedef struct e6000sw_softc { device_t miibus[E6000SW_MAX_PORTS]; struct proc *kproc; + int vlans[E6000SW_NUM_VLANS]; uint32_t swid; uint32_t vlan_mode; uint32_t cpuports_mask; @@ -80,13 +91,12 @@ typedef struct e6000sw_softc { int phy_base; int sw_addr; int num_ports; - boolean_t multi_chip; } e6000sw_softc_t; static etherswitch_info_t etherswitch_info = { .es_nports = 0, .es_nvlangroups = 0, - .es_vlan_caps = ETHERSWITCH_VLAN_PORT, + .es_vlan_caps = ETHERSWITCH_VLAN_PORT | ETHERSWITCH_VLAN_DOT1Q, .es_name = "Marvell 6000 series switch" }; @@ -100,10 +110,12 @@ static int e6000sw_readphy(device_t, int, int); static int e6000sw_writephy(device_t, int, int, int); static etherswitch_info_t* e6000sw_getinfo(device_t); static int e6000sw_getconf(device_t, etherswitch_conf_t *); +static int e6000sw_setconf(device_t, etherswitch_conf_t *); static void e6000sw_lock(device_t); static void e6000sw_unlock(device_t); static int e6000sw_getport(device_t, etherswitch_port_t *); static int e6000sw_setport(device_t, etherswitch_port_t *); +static int e6000sw_set_vlan_mode(e6000sw_softc_t *, uint32_t); static int e6000sw_readreg_wrapper(device_t, int); static int e6000sw_writereg_wrapper(device_t, int, int); static int e6000sw_readphy_wrapper(device_t, int, int); @@ -113,10 +125,11 @@ static int e6000sw_setvgroup_wrapper(device_t, ethersw static int e6000sw_setvgroup(device_t, etherswitch_vlangroup_t *); static int e6000sw_getvgroup(device_t, etherswitch_vlangroup_t *); static void e6000sw_setup(device_t, e6000sw_softc_t *); -static void e6000sw_port_vlan_conf(e6000sw_softc_t *); static void e6000sw_tick(void *); static void e6000sw_set_atustat(device_t, e6000sw_softc_t *, int, int); static int e6000sw_atu_flush(device_t, e6000sw_softc_t *, int); +static int e6000sw_vtu_flush(e6000sw_softc_t *); +static int e6000sw_vtu_update(e6000sw_softc_t *, int, int, int, int, int); static __inline void e6000sw_writereg(e6000sw_softc_t *, int, int, int); static __inline uint32_t e6000sw_readreg(e6000sw_softc_t *, int, int); static int e6000sw_ifmedia_upd(struct ifnet *); @@ -124,7 +137,7 @@ static void e6000sw_ifmedia_sts(struct ifnet *, struct static int e6000sw_atu_mac_table(device_t, e6000sw_softc_t *, struct atu_opt *, int); static int e6000sw_get_pvid(e6000sw_softc_t *, int, int *); -static int e6000sw_set_pvid(e6000sw_softc_t *, int, int); +static void e6000sw_set_pvid(e6000sw_softc_t *, int, int); static __inline bool e6000sw_is_cpuport(e6000sw_softc_t *, int); static __inline bool e6000sw_is_fixedport(e6000sw_softc_t *, int); static __inline bool e6000sw_is_fixed25port(e6000sw_softc_t *, int); @@ -150,6 +163,7 @@ static device_method_t e6000sw_methods[] = { /* etherswitch interface */ DEVMETHOD(etherswitch_getinfo, e6000sw_getinfo), DEVMETHOD(etherswitch_getconf, e6000sw_getconf), + DEVMETHOD(etherswitch_setconf, e6000sw_setconf), DEVMETHOD(etherswitch_lock, e6000sw_lock), DEVMETHOD(etherswitch_unlock, e6000sw_unlock), DEVMETHOD(etherswitch_getport, e6000sw_getport), @@ -175,17 +189,7 @@ DRIVER_MODULE(etherswitch, e6000sw, etherswitch_driver DRIVER_MODULE(miibus, e6000sw, miibus_driver, miibus_devclass, 0, 0); MODULE_DEPEND(e6000sw, mdio, 1, 1, 1); -#define SMI_CMD 0 -#define SMI_CMD_BUSY (1 << 15) -#define SMI_CMD_OP_READ ((2 << 10) | SMI_CMD_BUSY | (1 << 12)) -#define SMI_CMD_OP_WRITE ((1 << 10) | SMI_CMD_BUSY | (1 << 12)) -#define SMI_DATA 1 -#define MDIO_READ(dev, addr, reg) \ - MDIO_READREG(device_get_parent(dev), (addr), (reg)) -#define MDIO_WRITE(dev, addr, reg, val) \ - MDIO_WRITEREG(device_get_parent(dev), (addr), (reg), (val)) - static void e6000sw_identify(driver_t *driver, device_t parent) { @@ -217,16 +221,10 @@ e6000sw_probe(device_t dev) if (OF_getencprop(sc->node, "reg", &sc->sw_addr, sizeof(sc->sw_addr)) < 0) return (ENXIO); + if (sc->sw_addr < 0 || sc->sw_addr > 32) + return (ENXIO); /* - * According to the Linux source code, all of the Switch IDs we support - * are multi_chip capable, and should go into multi-chip mode if the - * sw_addr != 0. - */ - if (!OF_hasprop(sc->node, "single-chip-addressing") && sc->sw_addr != 0) - sc->multi_chip = true; - - /* * Create temporary lock, just to satisfy assertions, * when obtaining the switch ID. Destroy immediately afterwards. */ @@ -396,8 +394,14 @@ e6000sw_attach(device_t dev) err = 0; sc = device_get_softc(dev); - if (sc->multi_chip) - device_printf(dev, "multi-chip addressing mode\n"); + /* + * According to the Linux source code, all of the Switch IDs we support + * are multi_chip capable, and should go into multi-chip mode if the + * sw_addr != 0. + */ + if (MVSWITCH_MULTICHIP(sc)) + device_printf(dev, "multi-chip addressing mode (%#x)\n", + sc->sw_addr); else device_printf(dev, "single-chip addressing mode\n"); @@ -470,7 +474,11 @@ e6000sw_attach(device_t dev) etherswitch_info.es_nports = sc->num_ports; /* Default to port vlan. */ - e6000sw_port_vlan_conf(sc); + e6000sw_set_vlan_mode(sc, ETHERSWITCH_VLAN_PORT); + + reg = e6000sw_readreg(sc, REG_GLOBAL, SWITCH_GLOBAL_STATUS); + if (reg & SWITCH_GLOBAL_STATUS_IR) + device_printf(dev, "switch is ready.\n"); E6000SW_UNLOCK(sc); bus_generic_probe(dev); @@ -487,21 +495,19 @@ out_fail: return (err); } -static __inline int -e6000sw_poll_done(e6000sw_softc_t *sc) +static int +e6000sw_waitready(e6000sw_softc_t *sc, uint32_t phy, uint32_t reg, + uint32_t busybit) { int i; - for (i = 0; i < E6000SW_SMI_TIMEOUT; i++) { - - if ((e6000sw_readreg(sc, REG_GLOBAL2, SMI_PHY_CMD_REG) & - (1 << PHY_CMD_SMI_BUSY)) == 0) + for (i = 0; i < E6000SW_RETRIES; i++) { + if ((e6000sw_readreg(sc, phy, reg) & busybit) == 0) return (0); - - pause("e6000sw PHY poll", hz/1000); + DELAY(1); } - return (ETIMEDOUT); + return (1); } /* @@ -513,7 +519,6 @@ e6000sw_readphy(device_t dev, int phy, int reg) { e6000sw_softc_t *sc; uint32_t val; - int err; sc = device_get_softc(dev); if (!e6000sw_is_phyport(sc, phy) || reg >= E6000SW_NUM_PHY_REGS) { @@ -522,24 +527,17 @@ e6000sw_readphy(device_t dev, int phy, int reg) } E6000SW_LOCK_ASSERT(sc, SA_XLOCKED); - - err = e6000sw_poll_done(sc); - if (err != 0) { + if (E6000SW_WAITREADY2(sc, SMI_PHY_CMD_REG, SMI_CMD_BUSY)) { device_printf(dev, "Timeout while waiting for switch\n"); - return (err); + return (ETIMEDOUT); } - val = 1 << PHY_CMD_SMI_BUSY; - val |= PHY_CMD_MODE_MDIO << PHY_CMD_MODE; - val |= PHY_CMD_OPCODE_READ << PHY_CMD_OPCODE; - val |= (reg << PHY_CMD_REG_ADDR) & PHY_CMD_REG_ADDR_MASK; - val |= (phy << PHY_CMD_DEV_ADDR) & PHY_CMD_DEV_ADDR_MASK; - e6000sw_writereg(sc, REG_GLOBAL2, SMI_PHY_CMD_REG, val); - - err = e6000sw_poll_done(sc); - if (err != 0) { + e6000sw_writereg(sc, REG_GLOBAL2, SMI_PHY_CMD_REG, + SMI_CMD_OP_C22_READ | (reg & SMI_CMD_REG_ADDR_MASK) | + ((phy << SMI_CMD_DEV_ADDR) & SMI_CMD_DEV_ADDR_MASK)); + if (E6000SW_WAITREADY2(sc, SMI_PHY_CMD_REG, SMI_CMD_BUSY)) { device_printf(dev, "Timeout while waiting for switch\n"); - return (err); + return (ETIMEDOUT); } val = e6000sw_readreg(sc, REG_GLOBAL2, SMI_PHY_DATA_REG); @@ -551,8 +549,6 @@ static int e6000sw_writephy(device_t dev, int phy, int reg, int data) { e6000sw_softc_t *sc; - uint32_t val; - int err; sc = device_get_softc(dev); if (!e6000sw_is_phyport(sc, phy) || reg >= E6000SW_NUM_PHY_REGS) { @@ -561,27 +557,18 @@ e6000sw_writephy(device_t dev, int phy, int reg, int d } E6000SW_LOCK_ASSERT(sc, SA_XLOCKED); - - err = e6000sw_poll_done(sc); - if (err != 0) { + if (E6000SW_WAITREADY2(sc, SMI_PHY_CMD_REG, SMI_CMD_BUSY)) { device_printf(dev, "Timeout while waiting for switch\n"); - return (err); + return (ETIMEDOUT); } - val = 1 << PHY_CMD_SMI_BUSY; - val |= PHY_CMD_MODE_MDIO << PHY_CMD_MODE; - val |= PHY_CMD_OPCODE_WRITE << PHY_CMD_OPCODE; - val |= (reg << PHY_CMD_REG_ADDR) & PHY_CMD_REG_ADDR_MASK; - val |= (phy << PHY_CMD_DEV_ADDR) & PHY_CMD_DEV_ADDR_MASK; e6000sw_writereg(sc, REG_GLOBAL2, SMI_PHY_DATA_REG, data & PHY_DATA_MASK); - e6000sw_writereg(sc, REG_GLOBAL2, SMI_PHY_CMD_REG, val); + e6000sw_writereg(sc, REG_GLOBAL2, SMI_PHY_CMD_REG, + SMI_CMD_OP_C22_WRITE | (reg & SMI_CMD_REG_ADDR_MASK) | + ((phy << SMI_CMD_DEV_ADDR) & SMI_CMD_DEV_ADDR_MASK)); - err = e6000sw_poll_done(sc); - if (err != 0) - device_printf(dev, "Timeout while waiting for switch\n"); - - return (err); + return (0); } static int @@ -625,6 +612,22 @@ e6000sw_getconf(device_t dev, etherswitch_conf_t *conf return (0); } +static int +e6000sw_setconf(device_t dev, etherswitch_conf_t *conf) +{ + struct e6000sw_softc *sc; + + /* Set the VLAN mode. */ + sc = device_get_softc(dev); + if (conf->cmd & ETHERSWITCH_CONF_VLAN_MODE) { + E6000SW_LOCK(sc); + e6000sw_set_vlan_mode(sc, conf->vlan_mode); + E6000SW_UNLOCK(sc); + } + + return (0); +} + static void e6000sw_lock(device_t dev) { @@ -653,6 +656,7 @@ e6000sw_getport(device_t dev, etherswitch_port_t *p) struct mii_data *mii; int err; struct ifmediareq *ifmr; + uint32_t reg; e6000sw_softc_t *sc = device_get_softc(dev); E6000SW_LOCK_ASSERT(sc, SA_UNLOCKED); @@ -662,10 +666,17 @@ e6000sw_getport(device_t dev, etherswitch_port_t *p) if (!e6000sw_is_portenabled(sc, p->es_port)) return (0); - err = 0; E6000SW_LOCK(sc); e6000sw_get_pvid(sc, p->es_port, &p->es_pvid); + /* Port flags. */ + reg = e6000sw_readreg(sc, REG_PORT(p->es_port), PORT_CONTROL2); + if (reg & PORT_CONTROL2_DISC_TAGGED) + p->es_flags |= ETHERSWITCH_PORT_DROPTAGGED; + if (reg & PORT_CONTROL2_DISC_UNTAGGED) + p->es_flags |= ETHERSWITCH_PORT_DROPUNTAGGED; + + err = 0; if (e6000sw_is_fixedport(sc, p->es_port)) { if (e6000sw_is_cpuport(sc, p->es_port)) p->es_flags |= ETHERSWITCH_PORT_CPU; @@ -695,6 +706,7 @@ e6000sw_setport(device_t dev, etherswitch_port_t *p) e6000sw_softc_t *sc; int err; struct mii_data *mii; + uint32_t reg; sc = device_get_softc(dev); E6000SW_LOCK_ASSERT(sc, SA_UNLOCKED); @@ -704,6 +716,18 @@ e6000sw_setport(device_t dev, etherswitch_port_t *p) if (!e6000sw_is_portenabled(sc, p->es_port)) return (0); + /* Port flags. */ + reg = e6000sw_readreg(sc, REG_PORT(p->es_port), PORT_CONTROL2); + if (p->es_flags & ETHERSWITCH_PORT_DROPTAGGED) + reg |= PORT_CONTROL2_DISC_TAGGED; + else + reg &= ~PORT_CONTROL2_DISC_TAGGED; + if (p->es_flags & ETHERSWITCH_PORT_DROPUNTAGGED) + reg |= PORT_CONTROL2_DISC_UNTAGGED; + else + reg &= ~PORT_CONTROL2_DISC_UNTAGGED; + e6000sw_writereg(sc, REG_PORT(p->es_port), PORT_CONTROL2, reg); + err = 0; E6000SW_LOCK(sc); if (p->es_pvid != 0) @@ -718,6 +742,128 @@ e6000sw_setport(device_t dev, etherswitch_port_t *p) return (err); } +static __inline void +e6000sw_port_vlan_assign(e6000sw_softc_t *sc, int port, uint32_t fid, + uint32_t members) +{ + uint32_t reg; + + reg = e6000sw_readreg(sc, REG_PORT(port), PORT_VLAN_MAP); + reg &= ~(PORT_MASK(sc) | PORT_VLAN_MAP_FID_MASK); + reg |= members & PORT_MASK(sc) & ~(1 << port); + reg |= (fid << PORT_VLAN_MAP_FID) & PORT_VLAN_MAP_FID_MASK; + e6000sw_writereg(sc, REG_PORT(port), PORT_VLAN_MAP, reg); + reg = e6000sw_readreg(sc, REG_PORT(port), PORT_CONTROL1); + reg &= ~PORT_CONTROL1_FID_MASK; + reg |= (fid >> 4) & PORT_CONTROL1_FID_MASK; + e6000sw_writereg(sc, REG_PORT(port), PORT_CONTROL1, reg); +} + +static int +e6000sw_init_vlan(struct e6000sw_softc *sc) +{ + int i, port, ret; + uint32_t members; + + /* Disable all ports */ + for (port = 0; port < sc->num_ports; port++) { + ret = e6000sw_readreg(sc, REG_PORT(port), PORT_CONTROL); + e6000sw_writereg(sc, REG_PORT(port), PORT_CONTROL, + (ret & ~PORT_CONTROL_ENABLE)); + } + + /* Flush VTU. */ + e6000sw_vtu_flush(sc); + + for (port = 0; port < sc->num_ports; port++) { + /* Reset the egress and frame mode. */ + ret = e6000sw_readreg(sc, REG_PORT(port), PORT_CONTROL); + ret &= ~(PORT_CONTROL_EGRESS | PORT_CONTROL_FRAME); + e6000sw_writereg(sc, REG_PORT(port), PORT_CONTROL, ret); + + /* Set the the 802.1q mode. */ + ret = e6000sw_readreg(sc, REG_PORT(port), PORT_CONTROL2); + ret &= ~PORT_CONTROL2_DOT1Q; + if (sc->vlan_mode == ETHERSWITCH_VLAN_DOT1Q) + ret |= PORT_CONTROL2_DOT1Q; + e6000sw_writereg(sc, REG_PORT(port), PORT_CONTROL2, ret); + } + + for (port = 0; port < sc->num_ports; port++) { + if (!e6000sw_is_portenabled(sc, port)) + continue; + + ret = e6000sw_readreg(sc, REG_PORT(port), PORT_VID); + + /* Set port priority */ + ret &= ~PORT_VID_PRIORITY_MASK; + + /* Set VID map */ + ret &= ~PORT_VID_DEF_VID_MASK; + if (sc->vlan_mode == ETHERSWITCH_VLAN_DOT1Q) + ret |= 1; + else + ret |= (port + 1); + e6000sw_writereg(sc, REG_PORT(port), PORT_VID, ret); + } + + /* Assign the member ports to each origin port. */ + for (port = 0; port < sc->num_ports; port++) { + members = 0; + if (e6000sw_is_portenabled(sc, port)) { + for (i = 0; i < sc->num_ports; i++) { + if (i == port || !e6000sw_is_portenabled(sc, i)) + continue; + members |= (1 << i); + } + } + /* Default to FID 0. */ + e6000sw_port_vlan_assign(sc, port, 0, members); + } + + /* Reset internal VLAN table. */ + for (i = 0; i < nitems(sc->vlans); i++) + sc->vlans[i] = 0; + + /* Create default VLAN (1). */ + if (sc->vlan_mode == ETHERSWITCH_VLAN_DOT1Q) { + sc->vlans[0] = 1; + e6000sw_vtu_update(sc, 0, sc->vlans[0], 1, 0, sc->ports_mask); + } + + /* Enable all ports */ + for (port = 0; port < sc->num_ports; port++) { + if (!e6000sw_is_portenabled(sc, port)) + continue; + ret = e6000sw_readreg(sc, REG_PORT(port), PORT_CONTROL); + e6000sw_writereg(sc, REG_PORT(port), PORT_CONTROL, + (ret | PORT_CONTROL_ENABLE)); + } + + return (0); +} + +static int +e6000sw_set_vlan_mode(struct e6000sw_softc *sc, uint32_t mode) +{ + + E6000SW_LOCK_ASSERT(sc, SA_XLOCKED); + switch (mode) { + case ETHERSWITCH_VLAN_PORT: + sc->vlan_mode = ETHERSWITCH_VLAN_PORT; + etherswitch_info.es_nvlangroups = sc->num_ports; + return (e6000sw_init_vlan(sc)); + break; + case ETHERSWITCH_VLAN_DOT1Q: + sc->vlan_mode = ETHERSWITCH_VLAN_DOT1Q; + etherswitch_info.es_nvlangroups = E6000SW_NUM_VLANS; + return (e6000sw_init_vlan(sc)); + break; + default: + return (EINVAL); + } +} + /* * Registers in this switch are divided into sections, specified in * documentation. So as to access any of them, section index and reg index @@ -825,24 +971,6 @@ e6000sw_getvgroup_wrapper(device_t dev, etherswitch_vl return (ret); } -static __inline void -e6000sw_port_vlan_assign(e6000sw_softc_t *sc, int port, uint32_t fid, - uint32_t members) -{ - uint32_t reg; - - reg = e6000sw_readreg(sc, REG_PORT(port), PORT_VLAN_MAP); - reg &= ~PORT_VLAN_MAP_TABLE_MASK; - reg &= ~PORT_VLAN_MAP_FID_MASK; - reg |= members & PORT_VLAN_MAP_TABLE_MASK & ~(1 << port); - reg |= (fid << PORT_VLAN_MAP_FID) & PORT_VLAN_MAP_FID_MASK; - e6000sw_writereg(sc, REG_PORT(port), PORT_VLAN_MAP, reg); - reg = e6000sw_readreg(sc, REG_PORT(port), PORT_CONTROL_1); - reg &= ~PORT_CONTROL_1_FID_MASK; - reg |= (fid >> 4) & PORT_CONTROL_1_FID_MASK; - e6000sw_writereg(sc, REG_PORT(port), PORT_CONTROL_1, reg); -} - static int e6000sw_set_port_vlan(e6000sw_softc_t *sc, etherswitch_vlangroup_t *vg) { @@ -857,13 +985,41 @@ e6000sw_set_port_vlan(e6000sw_softc_t *sc, etherswitch return (EINVAL); } - e6000sw_port_vlan_assign(sc, port, port + 1, vg->es_untagged_ports); + e6000sw_port_vlan_assign(sc, port, 0, vg->es_untagged_ports); vg->es_vid = port | ETHERSWITCH_VID_VALID; return (0); } static int +e6000sw_set_dot1q_vlan(e6000sw_softc_t *sc, etherswitch_vlangroup_t *vg) +{ + int i, vlan; + + vlan = vg->es_vid & ETHERSWITCH_VID_MASK; + + /* Set VLAN to '0' removes it from table. */ + if (vlan == 0) { + e6000sw_vtu_update(sc, VTU_PURGE, + sc->vlans[vg->es_vlangroup], 0, 0, 0); + sc->vlans[vg->es_vlangroup] = 0; + return (0); + } + + /* Is this VLAN already in table ? */ + for (i = 0; i < etherswitch_info.es_nvlangroups; i++) + if (i != vg->es_vlangroup && vlan == sc->vlans[i]) + return (EINVAL); + + sc->vlans[vg->es_vlangroup] = vlan; + e6000sw_vtu_update(sc, 0, vlan, vg->es_vlangroup + 1, + vg->es_member_ports & sc->ports_mask, + vg->es_untagged_ports & sc->ports_mask); + + return (0); +} + +static int e6000sw_setvgroup(device_t dev, etherswitch_vlangroup_t *vg) { e6000sw_softc_t *sc; @@ -873,6 +1029,8 @@ e6000sw_setvgroup(device_t dev, etherswitch_vlangroup_ if (sc->vlan_mode == ETHERSWITCH_VLAN_PORT) return (e6000sw_set_port_vlan(sc, vg)); + else if (sc->vlan_mode == ETHERSWITCH_VLAN_DOT1Q) + return (e6000sw_set_dot1q_vlan(sc, vg)); return (EINVAL); } @@ -892,17 +1050,66 @@ e6000sw_get_port_vlan(e6000sw_softc_t *sc, etherswitch } reg = e6000sw_readreg(sc, REG_PORT(port), PORT_VLAN_MAP); - vg->es_untagged_ports = vg->es_member_ports = - reg & PORT_VLAN_MAP_TABLE_MASK; + vg->es_untagged_ports = vg->es_member_ports = reg & PORT_MASK(sc); vg->es_vid = port | ETHERSWITCH_VID_VALID; vg->es_fid = (reg & PORT_VLAN_MAP_FID_MASK) >> PORT_VLAN_MAP_FID; - reg = e6000sw_readreg(sc, REG_PORT(port), PORT_CONTROL_1); - vg->es_fid |= (reg & PORT_CONTROL_1_FID_MASK) << 4; + reg = e6000sw_readreg(sc, REG_PORT(port), PORT_CONTROL1); + vg->es_fid |= (reg & PORT_CONTROL1_FID_MASK) << 4; return (0); } static int +e6000sw_get_dot1q_vlan(e6000sw_softc_t *sc, etherswitch_vlangroup_t *vg) +{ + int i, port; + uint32_t reg; + + vg->es_fid = 0; + vg->es_vid = sc->vlans[vg->es_vlangroup]; + vg->es_untagged_ports = vg->es_member_ports = 0; + if (vg->es_vid == 0) + return (0); + + if (E6000SW_WAITREADY(sc, VTU_OPERATION, VTU_BUSY)) { + device_printf(sc->dev, "VTU unit is busy, cannot access\n"); + return (EBUSY); + } + + e6000sw_writereg(sc, REG_GLOBAL, VTU_VID, vg->es_vid - 1); + + reg = e6000sw_readreg(sc, REG_GLOBAL, VTU_OPERATION); + reg &= ~VTU_OP_MASK; + reg |= VTU_GET_NEXT | VTU_BUSY; + e6000sw_writereg(sc, REG_GLOBAL, VTU_OPERATION, reg); + if (E6000SW_WAITREADY(sc, VTU_OPERATION, VTU_BUSY)) { + device_printf(sc->dev, "Timeout while reading\n"); + return (EBUSY); + } + + reg = e6000sw_readreg(sc, REG_GLOBAL, VTU_VID); + if (reg == VTU_VID_MASK || (reg & VTU_VID_VALID) == 0) + return (EINVAL); + if ((reg & VTU_VID_MASK) != vg->es_vid) + return (EINVAL); + + vg->es_vid |= ETHERSWITCH_VID_VALID; + reg = e6000sw_readreg(sc, REG_GLOBAL, VTU_DATA); + for (i = 0; i < sc->num_ports; i++) { + if (i == VTU_PPREG(sc)) + reg = e6000sw_readreg(sc, REG_GLOBAL, VTU_DATA2); + port = (reg >> VTU_PORT(sc, i)) & VTU_PORT_MASK; + if (port == VTU_PORT_UNTAGGED) { + vg->es_untagged_ports |= (1 << i); + vg->es_member_ports |= (1 << i); + } else if (port == VTU_PORT_TAGGED) + vg->es_member_ports |= (1 << i); + } + + return (0); +} + +static int e6000sw_getvgroup(device_t dev, etherswitch_vlangroup_t *vg) { e6000sw_softc_t *sc; @@ -912,6 +1119,8 @@ e6000sw_getvgroup(device_t dev, etherswitch_vlangroup_ if (sc->vlan_mode == ETHERSWITCH_VLAN_PORT) return (e6000sw_get_port_vlan(sc, vg)); + else if (sc->vlan_mode == ETHERSWITCH_VLAN_DOT1Q) + return (e6000sw_get_dot1q_vlan(sc, vg)); return (EINVAL); } @@ -978,7 +1187,7 @@ e6000sw_readreg(e6000sw_softc_t *sc, int addr, int reg E6000SW_LOCK_ASSERT(sc, SA_XLOCKED); - if (!sc->multi_chip) + if (!MVSWITCH_MULTICHIP(sc)) return (MDIO_READ(sc->dev, addr, reg) & 0xffff); if (e6000sw_smi_waitready(sc, sc->sw_addr)) { @@ -986,7 +1195,8 @@ e6000sw_readreg(e6000sw_softc_t *sc, int addr, int reg return (0xffff); } MDIO_WRITE(sc->dev, sc->sw_addr, SMI_CMD, - SMI_CMD_OP_READ | (addr << 5) | reg); + SMI_CMD_OP_C22_READ | (reg & SMI_CMD_REG_ADDR_MASK) | + ((addr << SMI_CMD_DEV_ADDR) & SMI_CMD_DEV_ADDR_MASK)); if (e6000sw_smi_waitready(sc, sc->sw_addr)) { printf("e6000sw: readreg timeout\n"); return (0xffff); @@ -1001,7 +1211,7 @@ e6000sw_writereg(e6000sw_softc_t *sc, int addr, int re E6000SW_LOCK_ASSERT(sc, SA_XLOCKED); - if (!sc->multi_chip) { + if (!MVSWITCH_MULTICHIP(sc)) { MDIO_WRITE(sc->dev, addr, reg, val); return; } @@ -1012,11 +1222,8 @@ e6000sw_writereg(e6000sw_softc_t *sc, int addr, int re } MDIO_WRITE(sc->dev, sc->sw_addr, SMI_DATA, val); MDIO_WRITE(sc->dev, sc->sw_addr, SMI_CMD, - SMI_CMD_OP_WRITE | (addr << 5) | reg); - if (e6000sw_smi_waitready(sc, sc->sw_addr)) { - printf("e6000sw: readreg timeout\n"); - return; - } + SMI_CMD_OP_C22_WRITE | (reg & SMI_CMD_REG_ADDR_MASK) | + ((addr << SMI_CMD_DEV_ADDR) & SMI_CMD_DEV_ADDR_MASK)); } static __inline bool @@ -1056,14 +1263,15 @@ e6000sw_is_portenabled(e6000sw_softc_t *sc, int port) return ((sc->ports_mask & (1 << port)) ? true : false); } -static __inline int +static __inline void e6000sw_set_pvid(e6000sw_softc_t *sc, int port, int pvid) { + uint32_t reg; - e6000sw_writereg(sc, REG_PORT(port), PORT_VID, pvid & - PORT_VID_DEF_VID_MASK); - - return (0); + reg = e6000sw_readreg(sc, REG_PORT(port), PORT_VID); + reg &= ~PORT_VID_DEF_VID_MASK; + reg |= (pvid & PORT_VID_DEF_VID_MASK); + e6000sw_writereg(sc, REG_PORT(port), PORT_VID, reg); } static __inline int @@ -1114,7 +1322,7 @@ e6000sw_update_ifmedia(uint16_t portstatus, u_int *med } static void -e6000sw_tick (void *arg) +e6000sw_tick(void *arg) { e6000sw_softc_t *sc; struct mii_data *mii; @@ -1159,12 +1367,13 @@ e6000sw_tick (void *arg) static void e6000sw_setup(device_t dev, e6000sw_softc_t *sc) { - uint16_t atu_ctrl, atu_age; + uint32_t atu_ctrl; - /* Set aging time */ - e6000sw_writereg(sc, REG_GLOBAL, ATU_CONTROL, - (E6000SW_DEFAULT_AGETIME << ATU_CONTROL_AGETIME) | - (1 << ATU_CONTROL_LEARN2ALL)); + /* Set aging time. */ + atu_ctrl = e6000sw_readreg(sc, REG_GLOBAL, ATU_CONTROL); + atu_ctrl &= ~ATU_CONTROL_AGETIME_MASK; + atu_ctrl |= E6000SW_DEFAULT_AGETIME << ATU_CONTROL_AGETIME; + e6000sw_writereg(sc, REG_GLOBAL, ATU_CONTROL, atu_ctrl); /* Send all with specific mac address to cpu port */ e6000sw_writereg(sc, REG_GLOBAL2, MGMT_EN_2x, MGMT_EN_ALL); @@ -1183,76 +1392,9 @@ e6000sw_setup(device_t dev, e6000sw_softc_t *sc) e6000sw_atu_flush(dev, sc, NO_OPERATION); e6000sw_atu_mac_table(dev, sc, NULL, NO_OPERATION); e6000sw_set_atustat(dev, sc, 0, COUNT_ALL); - - /* Set ATU AgeTime to 15 seconds */ - atu_age = 1; - - atu_ctrl = e6000sw_readreg(sc, REG_GLOBAL, ATU_CONTROL); - - /* Set new AgeTime field */ - atu_ctrl &= ~ATU_CONTROL_AGETIME_MASK; - e6000sw_writereg(sc, REG_GLOBAL, ATU_CONTROL, atu_ctrl | - (atu_age << ATU_CONTROL_AGETIME)); } static void -e6000sw_port_vlan_conf(e6000sw_softc_t *sc) -{ - int i, port, ret; - uint32_t members; - - /* Disable all ports */ - for (port = 0; port < sc->num_ports; port++) { - ret = e6000sw_readreg(sc, REG_PORT(port), PORT_CONTROL); - e6000sw_writereg(sc, REG_PORT(port), PORT_CONTROL, - (ret & ~PORT_CONTROL_ENABLE)); - } - - /* Set port priority */ - for (port = 0; port < sc->num_ports; port++) { - if (!e6000sw_is_portenabled(sc, port)) - continue; - ret = e6000sw_readreg(sc, REG_PORT(port), PORT_VID); - ret &= ~PORT_VID_PRIORITY_MASK; - e6000sw_writereg(sc, REG_PORT(port), PORT_VID, ret); - } - - /* Set VID map */ - for (port = 0; port < sc->num_ports; port++) { - if (!e6000sw_is_portenabled(sc, port)) - continue; - ret = e6000sw_readreg(sc, REG_PORT(port), PORT_VID); - ret &= ~PORT_VID_DEF_VID_MASK; - ret |= (port + 1); - e6000sw_writereg(sc, REG_PORT(port), PORT_VID, ret); - } - - /* Enable all ports */ - for (port = 0; port < sc->num_ports; port++) { - if (!e6000sw_is_portenabled(sc, port)) - continue; - ret = e6000sw_readreg(sc, REG_PORT(port), PORT_CONTROL); - e6000sw_writereg(sc, REG_PORT(port), PORT_CONTROL, - (ret | PORT_CONTROL_ENABLE)); - } - - /* Set VLAN mode. */ - sc->vlan_mode = ETHERSWITCH_VLAN_PORT; - etherswitch_info.es_nvlangroups = sc->num_ports; - for (port = 0; port < sc->num_ports; port++) { - members = 0; - if (e6000sw_is_portenabled(sc, port)) { - for (i = 0; i < sc->num_ports; i++) { - if (i == port || !e6000sw_is_portenabled(sc, i)) - continue; - members |= (1 << i); - } - } - e6000sw_port_vlan_assign(sc, port, port + 1, members); - } -} - -static void e6000sw_set_atustat(device_t dev, e6000sw_softc_t *sc, int bin, int flag) { uint16_t ret; @@ -1268,7 +1410,6 @@ e6000sw_atu_mac_table(device_t dev, e6000sw_softc_t *s { uint16_t ret_opt; uint16_t ret_data; - int retries; if (flag == NO_OPERATION) return (0); @@ -1278,41 +1419,34 @@ e6000sw_atu_mac_table(device_t dev, e6000sw_softc_t *s return (EINVAL); } - ret_opt = e6000sw_readreg(sc, REG_GLOBAL, ATU_OPERATION); - - if (ret_opt & ATU_UNIT_BUSY) { - device_printf(dev, "ATU unit is busy, cannot access" - "register\n"); + if (E6000SW_WAITREADY(sc, ATU_OPERATION, ATU_UNIT_BUSY)) { + device_printf(dev, "ATU unit is busy, cannot access\n"); return (EBUSY); - } else { - if(flag & LOAD_FROM_FIB) { - ret_data = e6000sw_readreg(sc, REG_GLOBAL, ATU_DATA); - e6000sw_writereg(sc, REG_GLOBAL2, ATU_DATA, (ret_data & - ~ENTRY_STATE)); - } - e6000sw_writereg(sc, REG_GLOBAL, ATU_MAC_ADDR01, atu->mac_01); - e6000sw_writereg(sc, REG_GLOBAL, ATU_MAC_ADDR23, atu->mac_23); - e6000sw_writereg(sc, REG_GLOBAL, ATU_MAC_ADDR45, atu->mac_45); - e6000sw_writereg(sc, REG_GLOBAL, ATU_FID, atu->fid); + } - e6000sw_writereg(sc, REG_GLOBAL, ATU_OPERATION, (ret_opt | - ATU_UNIT_BUSY | flag)); + ret_opt = e6000sw_readreg(sc, REG_GLOBAL, ATU_OPERATION); + if (flag & LOAD_FROM_FIB) { + ret_data = e6000sw_readreg(sc, REG_GLOBAL, ATU_DATA); + e6000sw_writereg(sc, REG_GLOBAL2, ATU_DATA, (ret_data & + ~ENTRY_STATE)); + } + e6000sw_writereg(sc, REG_GLOBAL, ATU_MAC_ADDR01, atu->mac_01); + e6000sw_writereg(sc, REG_GLOBAL, ATU_MAC_ADDR23, atu->mac_23); + e6000sw_writereg(sc, REG_GLOBAL, ATU_MAC_ADDR45, atu->mac_45); + e6000sw_writereg(sc, REG_GLOBAL, ATU_FID, atu->fid); - retries = E6000SW_RETRIES; - while (--retries & (e6000sw_readreg(sc, REG_GLOBAL, - ATU_OPERATION) & ATU_UNIT_BUSY)) - DELAY(1); + e6000sw_writereg(sc, REG_GLOBAL, ATU_OPERATION, + (ret_opt | ATU_UNIT_BUSY | flag)); - if (retries == 0) - device_printf(dev, "Timeout while flushing\n"); - else if (flag & GET_NEXT_IN_FIB) { - atu->mac_01 = e6000sw_readreg(sc, REG_GLOBAL, - ATU_MAC_ADDR01); - atu->mac_23 = e6000sw_readreg(sc, REG_GLOBAL, - ATU_MAC_ADDR23); - atu->mac_45 = e6000sw_readreg(sc, REG_GLOBAL, - ATU_MAC_ADDR45); - } + if (E6000SW_WAITREADY(sc, ATU_OPERATION, ATU_UNIT_BUSY)) + device_printf(dev, "Timeout while waiting ATU\n"); + else if (flag & GET_NEXT_IN_FIB) { + atu->mac_01 = e6000sw_readreg(sc, REG_GLOBAL, + ATU_MAC_ADDR01); + atu->mac_23 = e6000sw_readreg(sc, REG_GLOBAL, + ATU_MAC_ADDR23); + atu->mac_45 = e6000sw_readreg(sc, REG_GLOBAL, + ATU_MAC_ADDR45); } return (0); @@ -1321,26 +1455,85 @@ e6000sw_atu_mac_table(device_t dev, e6000sw_softc_t *s static int e6000sw_atu_flush(device_t dev, e6000sw_softc_t *sc, int flag) { - uint16_t ret; - int retries; + uint32_t reg; if (flag == NO_OPERATION) return (0); - ret = e6000sw_readreg(sc, REG_GLOBAL, ATU_OPERATION); - if (ret & ATU_UNIT_BUSY) { - device_printf(dev, "Atu unit is busy, cannot flush\n"); + if (E6000SW_WAITREADY(sc, ATU_OPERATION, ATU_UNIT_BUSY)) { + device_printf(dev, "ATU unit is busy, cannot access\n"); return (EBUSY); - } else { - e6000sw_writereg(sc, REG_GLOBAL, ATU_OPERATION, (ret | - ATU_UNIT_BUSY | flag)); - retries = E6000SW_RETRIES; - while (--retries & (e6000sw_readreg(sc, REG_GLOBAL, - ATU_OPERATION) & ATU_UNIT_BUSY)) - DELAY(1); + } + reg = e6000sw_readreg(sc, REG_GLOBAL, ATU_OPERATION); + e6000sw_writereg(sc, REG_GLOBAL, ATU_OPERATION, + (reg | ATU_UNIT_BUSY | flag)); + if (E6000SW_WAITREADY(sc, ATU_OPERATION, ATU_UNIT_BUSY)) + device_printf(dev, "Timeout while flushing ATU\n"); - if (retries == 0) - device_printf(dev, "Timeout while flushing\n"); + return (0); +} + +static int +e6000sw_vtu_flush(e6000sw_softc_t *sc) +{ + + if (E6000SW_WAITREADY(sc, VTU_OPERATION, VTU_BUSY)) { + device_printf(sc->dev, "VTU unit is busy, cannot access\n"); + return (EBUSY); + } + + e6000sw_writereg(sc, REG_GLOBAL, VTU_OPERATION, VTU_FLUSH | VTU_BUSY); + if (E6000SW_WAITREADY(sc, VTU_OPERATION, VTU_BUSY)) { + device_printf(sc->dev, "Timeout while flushing VTU\n"); + return (ETIMEDOUT); + } + + return (0); +} + +static int +e6000sw_vtu_update(e6000sw_softc_t *sc, int purge, int vid, int fid, + int members, int untagged) +{ + int i, op; + uint32_t data[2]; + + if (E6000SW_WAITREADY(sc, VTU_OPERATION, VTU_BUSY)) { + device_printf(sc->dev, "VTU unit is busy, cannot access\n"); + return (EBUSY); + } + + *data = (vid & VTU_VID_MASK); + if (purge == 0) + *data |= VTU_VID_VALID; + e6000sw_writereg(sc, REG_GLOBAL, VTU_VID, *data); + + if (purge == 0) { + data[0] = 0; + data[1] = 0; + for (i = 0; i < sc->num_ports; i++) { + if ((untagged & (1 << i)) != 0) + data[i / VTU_PPREG(sc)] |= + VTU_PORT_UNTAGGED << VTU_PORT(sc, i); + else if ((members & (1 << i)) != 0) + data[i / VTU_PPREG(sc)] |= + VTU_PORT_TAGGED << VTU_PORT(sc, i); + else + data[i / VTU_PPREG(sc)] |= + VTU_PORT_DISCARD << VTU_PORT(sc, i); + } + e6000sw_writereg(sc, REG_GLOBAL, VTU_DATA, data[0]); + e6000sw_writereg(sc, REG_GLOBAL, VTU_DATA2, data[1]); + e6000sw_writereg(sc, REG_GLOBAL, VTU_FID, + fid & VTU_FID_MASK(sc)); + op = VTU_LOAD; + } else + op = VTU_PURGE; + + e6000sw_writereg(sc, REG_GLOBAL, VTU_OPERATION, op | VTU_BUSY); + if (E6000SW_WAITREADY(sc, VTU_OPERATION, VTU_BUSY)) { + device_printf(sc->dev, "Timeout while flushing VTU\n"); + return (ETIMEDOUT); } return (0); Modified: head/sys/dev/etherswitch/e6000sw/e6000swreg.h ============================================================================== --- head/sys/dev/etherswitch/e6000sw/e6000swreg.h Fri Jun 28 22:12:43 2019 (r349520) +++ head/sys/dev/etherswitch/e6000sw/e6000swreg.h Fri Jun 28 22:19:50 2019 (r349521) @@ -29,7 +29,7 @@ */ #ifndef _E6000SWREG_H_ -#define _E6000SWREG_H_ +#define _E6000SWREG_H_ struct atu_opt { uint16_t mac_01; @@ -50,20 +50,21 @@ struct atu_opt { #define MV88E6176 0x1760 #define MVSWITCH(_sc, id) ((_sc)->swid == (id)) +#define MVSWITCH_MULTICHIP(_sc) ((_sc)->sw_addr != 0) /* * Switch Registers */ -#define REG_GLOBAL 0x1b -#define REG_GLOBAL2 0x1c -#define REG_PORT(p) (0x10 + (p)) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Jun 28 22:28:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC53E15CD905; Fri, 28 Jun 2019 22:28: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D5C28B3BA; Fri, 28 Jun 2019 22:28:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 589C85560; Fri, 28 Jun 2019 22:28:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5SMSq9l059798; Fri, 28 Jun 2019 22:28:52 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SMSquS059797; Fri, 28 Jun 2019 22:28:52 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201906282228.x5SMSquS059797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 28 Jun 2019 22:28:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349522 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 349522 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7D5C28B3BA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 22:28:53 -0000 Author: hselasky Date: Fri Jun 28 22:28:51 2019 New Revision: 349522 URL: https://svnweb.freebsd.org/changeset/base/349522 Log: Need to apply the PCIM_BAR_MEM_BASE mask to the physical memory address before returning it to the user. Some of the least significant bits have special meaning and should be masked away. Discussed with: kib@ MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/pci/pci_user.c Modified: head/sys/dev/pci/pci_user.c ============================================================================== --- head/sys/dev/pci/pci_user.c Fri Jun 28 22:19:50 2019 (r349521) +++ head/sys/dev/pci/pci_user.c Fri Jun 28 22:28:51 2019 (r349522) @@ -855,6 +855,7 @@ pci_bar_mmap(device_t pcidev, struct pci_bar_mmap *pbm struct thread *td; struct sglist *sg; struct pci_map *pm; + vm_paddr_t membase; vm_paddr_t pbase; vm_size_t plen; vm_offset_t addr; @@ -877,8 +878,9 @@ pci_bar_mmap(device_t pcidev, struct pci_bar_mmap *pbm return (EBUSY); /* XXXKIB enable if _ACTIVATE */ if (!PCI_BAR_MEM(pm->pm_value)) return (EIO); - pbase = trunc_page(pm->pm_value); - plen = round_page(pm->pm_value + ((pci_addr_t)1 << pm->pm_size)) - + membase = pm->pm_value & PCIM_BAR_MEM_BASE; + pbase = trunc_page(membase); + plen = round_page(membase + ((pci_addr_t)1 << pm->pm_size)) - pbase; prot = VM_PROT_READ | (((pbm->pbm_flags & PCIIO_BAR_MMAP_RW) != 0) ? VM_PROT_WRITE : 0); @@ -910,7 +912,7 @@ pci_bar_mmap(device_t pcidev, struct pci_bar_mmap *pbm } pbm->pbm_map_base = (void *)addr; pbm->pbm_map_length = plen; - pbm->pbm_bar_off = pm->pm_value - pbase; + pbm->pbm_bar_off = membase - pbase; pbm->pbm_bar_length = (pci_addr_t)1 << pm->pm_size; out: From owner-svn-src-head@freebsd.org Fri Jun 28 22:40:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9B6015CDF13; Fri, 28 Jun 2019 22:40:35 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C7CA8BE79; Fri, 28 Jun 2019 22:40:35 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 274B7571F; Fri, 28 Jun 2019 22:40:35 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5SMeZrZ065203; Fri, 28 Jun 2019 22:40:35 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SMeY01065201; Fri, 28 Jun 2019 22:40:34 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201906282240.x5SMeY01065201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Fri, 28 Jun 2019 22:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349526 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 349526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4C7CA8BE79 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 22:40:35 -0000 Author: alc Date: Fri Jun 28 22:40:34 2019 New Revision: 349526 URL: https://svnweb.freebsd.org/changeset/base/349526 Log: When we protect PTEs (as opposed to PDEs), we only call vm_page_dirty() when, in fact, we are write protecting the page and the PTE has PG_M set. However, pmap_protect_pde() was always calling vm_page_dirty() when the PDE has PG_M set. So, adding PG_NX to a writeable PDE could result in unnecessary (but harmless) calls to vm_page_dirty(). Simplify the loop calling vm_page_dirty() in pmap_protect_pde(). Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D20793 Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Fri Jun 28 22:36:27 2019 (r349525) +++ head/sys/amd64/amd64/pmap.c Fri Jun 28 22:40:34 2019 (r349526) @@ -5202,8 +5202,7 @@ static boolean_t pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot) { pd_entry_t newpde, oldpde; - vm_offset_t eva, va; - vm_page_t m; + vm_page_t m, mt; boolean_t anychanged; pt_entry_t PG_G, PG_M, PG_RW; @@ -5217,15 +5216,15 @@ pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offs anychanged = FALSE; retry: oldpde = newpde = *pde; - if ((oldpde & (PG_MANAGED | PG_M | PG_RW)) == - (PG_MANAGED | PG_M | PG_RW)) { - eva = sva + NBPDR; - for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME); - va < eva; va += PAGE_SIZE, m++) - vm_page_dirty(m); - } - if ((prot & VM_PROT_WRITE) == 0) + if ((prot & VM_PROT_WRITE) == 0) { + if ((oldpde & (PG_MANAGED | PG_M | PG_RW)) == + (PG_MANAGED | PG_M | PG_RW)) { + m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME); + for (mt = m; mt < &m[NBPDR / PAGE_SIZE]; mt++) + vm_page_dirty(mt); + } newpde &= ~(PG_RW | PG_M); + } if ((prot & VM_PROT_EXECUTE) == 0) newpde |= pg_nx; if (newpde != oldpde) { Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Fri Jun 28 22:36:27 2019 (r349525) +++ head/sys/i386/i386/pmap.c Fri Jun 28 22:40:34 2019 (r349526) @@ -3251,8 +3251,7 @@ static boolean_t pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot) { pd_entry_t newpde, oldpde; - vm_offset_t eva, va; - vm_page_t m; + vm_page_t m, mt; boolean_t anychanged; PMAP_LOCK_ASSERT(pmap, MA_OWNED); @@ -3261,15 +3260,15 @@ pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offs anychanged = FALSE; retry: oldpde = newpde = *pde; - if ((oldpde & (PG_MANAGED | PG_M | PG_RW)) == - (PG_MANAGED | PG_M | PG_RW)) { - eva = sva + NBPDR; - for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME); - va < eva; va += PAGE_SIZE, m++) - vm_page_dirty(m); - } - if ((prot & VM_PROT_WRITE) == 0) + if ((prot & VM_PROT_WRITE) == 0) { + if ((oldpde & (PG_MANAGED | PG_M | PG_RW)) == + (PG_MANAGED | PG_M | PG_RW)) { + m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME); + for (mt = m; mt < &m[NBPDR / PAGE_SIZE]; mt++) + vm_page_dirty(mt); + } newpde &= ~(PG_RW | PG_M); + } #ifdef PMAP_PAE_COMP if ((prot & VM_PROT_EXECUTE) == 0 && !i386_read_exec) newpde |= pg_nx; From owner-svn-src-head@freebsd.org Fri Jun 28 22:41:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E166E15CDF96; Fri, 28 Jun 2019 22:41:18 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 88A758C045; Fri, 28 Jun 2019 22:41:18 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62D8A5760; Fri, 28 Jun 2019 22:41:18 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5SMfI2J069424; Fri, 28 Jun 2019 22:41:18 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5SMfHdU069419; Fri, 28 Jun 2019 22:41:17 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201906282241.x5SMfHdU069419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Fri, 28 Jun 2019 22:41:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349527 - in head/contrib/libarchive/libarchive: . test X-SVN-Group: head X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in head/contrib/libarchive/libarchive: . test X-SVN-Commit-Revision: 349527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 88A758C045 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 22:41:19 -0000 Author: mm Date: Fri Jun 28 22:41:17 2019 New Revision: 349527 URL: https://svnweb.freebsd.org/changeset/base/349527 Log: MFV r349454: Sync libarchive with vendor. Relevant vendor changes: PR #1217: RAR5 reader - fix ARM filter going beyond window buffer boundary (OSS-Fuzz 15431) PR #1218: Fixes to sparse file handling MFC after: 1 week Added: head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu - copied unchanged from r349454, vendor/libarchive/dist/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu Modified: head/contrib/libarchive/libarchive/archive_read.c head/contrib/libarchive/libarchive/archive_read_disk_posix.c head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c head/contrib/libarchive/libarchive/test/test_read_format_rar5.c Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/contrib/libarchive/libarchive/archive_read.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read.c Fri Jun 28 22:40:34 2019 (r349526) +++ head/contrib/libarchive/libarchive/archive_read.c Fri Jun 28 22:41:17 2019 (r349527) @@ -844,7 +844,8 @@ archive_read_data(struct archive *_a, void *buff, size dest = (char *)buff; while (s > 0) { - if (a->read_data_remaining == 0) { + if (a->read_data_offset == a->read_data_output_offset && + a->read_data_remaining == 0) { read_buf = a->read_data_block; a->read_data_is_posix_read = 1; a->read_data_requested = s; Modified: head/contrib/libarchive/libarchive/archive_read_disk_posix.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_posix.c Fri Jun 28 22:40:34 2019 (r349526) +++ head/contrib/libarchive/libarchive/archive_read_disk_posix.c Fri Jun 28 22:41:17 2019 (r349527) @@ -1143,6 +1143,8 @@ _archive_read_next_header2(struct archive *_a, struct t->entry_fd = -1; } + archive_entry_clear(entry); + for (;;) { r = next_entry(a, t, entry); if (t->entry_fd >= 0) { Modified: head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Fri Jun 28 22:40:34 2019 (r349526) +++ head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Fri Jun 28 22:41:17 2019 (r349527) @@ -623,9 +623,9 @@ static int run_arm_filter(struct rar5* rar, struct fil for(i = 0; i < flt->block_length - 3; i += 4) { uint8_t* b = &rar->cstate.window_buf[ (rar->cstate.solid_offset + - flt->block_start + i) & rar->cstate.window_mask]; + flt->block_start + i + 3) & rar->cstate.window_mask]; - if(b[3] == 0xEB) { + if(*b == 0xEB) { /* 0xEB = ARM's BL (branch + link) instruction. */ offset = read_filter_data(rar, (rar->cstate.solid_offset + flt->block_start + i) & Modified: head/contrib/libarchive/libarchive/test/test_read_format_rar5.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_read_format_rar5.c Fri Jun 28 22:40:34 2019 (r349526) +++ head/contrib/libarchive/libarchive/test/test_read_format_rar5.c Fri Jun 28 22:41:17 2019 (r349527) @@ -1215,3 +1215,18 @@ DEFINE_TEST(test_read_format_rar5_different_window_siz EPILOGUE(); } + +DEFINE_TEST(test_read_format_rar5_arm_filter_on_window_boundary) +{ + char buf[4096]; + PROLOGUE("test_read_format_rar5_arm_filter_on_window_boundary.rar"); + + /* Return codes of those calls are ignored, because this sample file + * is invalid. However, the unpacker shouldn't produce any SIGSEGV + * errors during processing. */ + + (void) archive_read_next_header(a, &ae); + while(0 != archive_read_data(a, buf, sizeof(buf))) {} + + EPILOGUE(); +} Copied: head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu (from r349454, vendor/libarchive/dist/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu Fri Jun 28 22:41:17 2019 (r349527, copy of r349454, vendor/libarchive/dist/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu) @@ -0,0 +1,9 @@ +begin 600 test_read_format_rar5_arm_filter_on_window_boundary.rar +M4F%R(1H'`0"-[P+2``(''(`'`/[_(`#_!``"(0$``/X(TB`!'O___P@``/W_ +M_Q``_]U84%"0_P1LAFVQ9,S,M[$`20"#__\`_P#_`/G___!DSR0V2+$`20`Z +M@R[_______\I:!<**-@P70D`KB1! Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DEA915CED84; Fri, 28 Jun 2019 23:27:25 +0000 (UTC) (envelope-from mhorne063@gmail.com) Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CFFF88D390; Fri, 28 Jun 2019 23:27:24 +0000 (UTC) (envelope-from mhorne063@gmail.com) Received: by mail-ot1-x344.google.com with SMTP id d17so7680509oth.5; Fri, 28 Jun 2019 16:27:24 -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=UU6mYjfhH9RH0RijFBft+NcEpD4uqF9MacTQ+c0GUsw=; b=I8q8Moca94+YBfbvra40PXH550l/ra9Gubn04DhnlJMkMLl9gp9JIdDAcM/vBgsYVm //q1aZjRet+gC3BLLZie3cDfLFqYGnw6PCKOpd30p3Btamcx/1PKuPeM0wqwAqqdCF+l Sw2ns9OXk/xdf0ZC9+N7U4KJx4mUa8NFAfRuDExu5kB0h3Zto3JppltB0OuFLucCZgI4 caGj7ta2KdSrrs4hk2CfPzJnFK9kCx5jgHTs+y4YMMGEBoigxHEyicJQJlciPEUh+a/K /+OKYIc5ulsvW7NsmLxxlkNZ5/riGwLUN/psNjT8+ECrLrYDg+zZaTBkkoyEW1cgGdCr 8eOQ== 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=UU6mYjfhH9RH0RijFBft+NcEpD4uqF9MacTQ+c0GUsw=; b=D9aXcO21uID9xABfaebej4wZi/V2WtBXdaqYN/G/QaAjsWhMwuweTQdc8xLyVhpPca csttksx/tISqEkh1/GoQ09Xvurb7MDb7DvPTVYW8W4gTo3rT/DiOCYg0oTdM2PtZ1opN VOjsUt43KhfzBFywf2D54fsuWRwDr3ntrLPVizUb5YWCA2Y2b9MPWs5FDJCne3y2uZsD BRoJrmX30Bh2wQo6elp2K1mYcuj2JtIMyjvSq/8I5jMR12REev7eY/I8ICq9qcJ1EzQ1 82hBiUFm+XqH2GNlLduJ8V/AbLxKkCuR2+PNTtJ9dapDhO2oUmG933PDm6xdIktTvAjr 1gPw== X-Gm-Message-State: APjAAAUwXD5dZmUqgbK3I0HXeTzm4YNGyk35kIIgn2NpccemVm/XwLab brKqPMCsKp4enoSqjersgIzwVj/JOsTvrHj9ed7oWQ== X-Google-Smtp-Source: APXvYqzOW0U0v11xeHlT6Z91smtO2SbPKAhc2SknhUBhBzLpCX3JqEwc2gI+urg5rUtTz0+T+6qhxoHe7hj8brKnCew= X-Received: by 2002:a9d:68d7:: with SMTP id i23mr9383617oto.124.1561764443463; Fri, 28 Jun 2019 16:27:23 -0700 (PDT) MIME-Version: 1.0 References: <201906280010.x5S0ARLh056619@repo.freebsd.org> In-Reply-To: From: Mitchell Horne Date: Fri, 28 Jun 2019 19:27:12 -0400 Message-ID: Subject: Re: svn commit: r349482 - in head/contrib/elftoolchain: common readelf To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: CFFF88D390 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.92 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.92)[-0.922,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2019 23:27:25 -0000 On Fri, Jun 28, 2019 at 12:45 PM John Baldwin wrote: > > On 6/27/19 5:10 PM, Mitchell Horne wrote: > > Author: mhorne > > Date: Fri Jun 28 00:10:26 2019 > > New Revision: 349482 > > URL: https://svnweb.freebsd.org/changeset/base/349482 > > > > Log: > > readelf: Add support for RISC-V specific e_flags > > > > Reviewed by: markj > > Approved by: markj (mentor) > > MFC after: 3 days > > Differential Revision: https://reviews.freebsd.org/D20767 > > > > Modified: > > head/contrib/elftoolchain/common/elfdefinitions.h > > head/contrib/elftoolchain/readelf/readelf.c > > > > Modified: head/contrib/elftoolchain/common/elfdefinitions.h > > ============================================================================== > > --- head/contrib/elftoolchain/common/elfdefinitions.h Fri Jun 28 00:03:29 2019 (r349481) > > +++ head/contrib/elftoolchain/common/elfdefinitions.h Fri Jun 28 00:10:26 2019 (r349482) > > @@ -426,6 +426,22 @@ _ELF_DEFINE_EF(EF_PPC_RELOCATABLE, 0x00010000UL, \ > > "-mrelocatable flag") \ > > _ELF_DEFINE_EF(EF_PPC_RELOCATABLE_LIB, 0x00008000UL, \ > > "-mrelocatable-lib flag") \ > > +_ELF_DEFINE_EF(EF_RISCV_RVE, 0x00000008UL, \ > > + "Compressed instruction ABI") \ > > I don't think this description for RVE is quite right. RVE is for RV32E which > is not using compressed ('C') instructions, but using a smaller register file > (16 GPRs instead of 32) which is in theory intended for embedded / microprocessor > variants. The riscv-elf-psabi-doc describes it as: > > EF_RISCV_RVE (0x0008): This bit is set when the binary targets the E ABI. > Yep, good catch. This got duplicated from the RVC entry and slipped by during review. I'll adjust it. Mitchell > -- > John Baldwin From owner-svn-src-head@freebsd.org Sat Jun 29 00:48:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BD8915D03C5; Sat, 29 Jun 2019 00:48:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BFB9F8FEDA; Sat, 29 Jun 2019 00:48:36 +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 9A51D6CAC; Sat, 29 Jun 2019 00:48:36 +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 x5T0maKq033145; Sat, 29 Jun 2019 00:48:36 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5T0mYMt033132; Sat, 29 Jun 2019 00:48:34 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201906290048.x5T0mYMt033132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 29 Jun 2019 00:48:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349529 - in head: sbin/ifconfig share/man/man9 sys/conf sys/kern sys/net sys/netinet sys/netinet6 sys/sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: sbin/ifconfig share/man/man9 sys/conf sys/kern sys/net sys/netinet sys/netinet6 sys/sys X-SVN-Commit-Revision: 349529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BFB9F8FEDA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.983,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2019 00:48:37 -0000 Author: jhb Date: Sat Jun 29 00:48:33 2019 New Revision: 349529 URL: https://svnweb.freebsd.org/changeset/base/349529 Log: Add an external mbuf buffer type that holds multiple unmapped pages. Unmapped mbufs allow sendfile to carry multiple pages of data in a single mbuf, without mapping those pages. It is a requirement for Netflix's in-kernel TLS, and provides a 5-10% CPU savings on heavy web serving workloads when used by sendfile, due to effectively compressing socket buffers by an order of magnitude, and hence reducing cache misses. For this new external mbuf buffer type (EXT_PGS), the ext_buf pointer now points to a struct mbuf_ext_pgs structure instead of a data buffer. This structure contains an array of physical addresses (this reduces cache misses compared to an earlier version that stored an array of vm_page_t pointers). It also stores additional fields needed for in-kernel TLS such as the TLS header and trailer data that are currently unused. To more easily detect these mbufs, the M_NOMAP flag is set in m_flags in addition to M_EXT. Various functions like m_copydata() have been updated to safely access packet contents (using uiomove_fromphys()), to make things like BPF safe. NIC drivers advertise support for unmapped mbufs on transmit via a new IFCAP_NOMAP capability. This capability can be toggled via the new 'nomap' and '-nomap' ifconfig(8) commands. For NIC drivers that only transmit packet contents via DMA and use bus_dma, adding the capability to if_capabilities and if_capenable should be all that is required. If a NIC does not support unmapped mbufs, they are converted to a chain of mapped mbufs (using sf_bufs to provide the mapping) in ip_output or ip6_output. If an unmapped mbuf requires software checksums, it is also converted to a chain of mapped mbufs before computing the checksum. Submitted by: gallatin (earlier version) Reviewed by: gallatin, hselasky, rrs Discussed with: ae, kp (firewalls) Relnotes: yes Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20616 Modified: head/sbin/ifconfig/ifconfig.8 head/sbin/ifconfig/ifconfig.c head/share/man/man9/Makefile head/share/man/man9/mbuf.9 head/share/man/man9/sglist.9 head/sys/conf/files head/sys/conf/kern.mk head/sys/kern/kern_mbuf.c head/sys/kern/subr_bus_dma.c head/sys/kern/subr_sglist.c head/sys/kern/uipc_mbuf.c head/sys/kern/uipc_sockbuf.c head/sys/kern/uipc_socket.c head/sys/net/bpf.c head/sys/net/bpf_buffer.c head/sys/net/if.h head/sys/netinet/ip_output.c head/sys/netinet/tcp_pcap.c head/sys/netinet/tcp_usrreq.c head/sys/netinet6/ip6_output.c head/sys/sys/mbuf.h head/sys/sys/sglist.h Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Fri Jun 28 23:40:58 2019 (r349528) +++ head/sbin/ifconfig/ifconfig.8 Sat Jun 29 00:48:33 2019 (r349529) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd May 18, 2019 +.Dd June 28, 2019 .Dt IFCONFIG 8 .Os .Sh NAME @@ -538,6 +538,12 @@ large receive offloading, enable LRO on the interface. If the driver supports .Xr tcp 4 large receive offloading, disable LRO on the interface. +.It Cm nomap +If the driver supports unmapped network buffers, +enable them on the interface. +.It Fl nomap +If the driver supports unmapped network buffers, +disable them on the interface. .It Cm wol , wol_ucast , wol_mcast , wol_magic Enable Wake On Lan (WOL) support, if available. WOL is a facility whereby a machine in a low power state may be woken Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Fri Jun 28 23:40:58 2019 (r349528) +++ head/sbin/ifconfig/ifconfig.c Sat Jun 29 00:48:33 2019 (r349529) @@ -1257,7 +1257,7 @@ unsetifdescr(const char *val, int value, int s, const "\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \ "\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \ "\17TOE4\20TOE6\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP" \ -"\26RXCSUM_IPV6\27TXCSUM_IPV6\31TXRTLMT\32HWRXTSTMP" +"\26RXCSUM_IPV6\27TXCSUM_IPV6\31TXRTLMT\32HWRXTSTMP\33NOMAP" /* * Print the status of the interface. If an address family was @@ -1557,6 +1557,8 @@ static struct cmd basic_cmds[] = { DEF_CMD("-link2", -IFF_LINK2, setifflags), DEF_CMD("monitor", IFF_MONITOR, setifflags), DEF_CMD("-monitor", -IFF_MONITOR, setifflags), + DEF_CMD("nomap", IFCAP_NOMAP, setifcap), + DEF_CMD("-nomap", -IFCAP_NOMAP, setifcap), DEF_CMD("staticarp", IFF_STATICARP, setifflags), DEF_CMD("-staticarp", -IFF_STATICARP, setifflags), DEF_CMD("rxcsum6", IFCAP_RXCSUM_IPV6, setifcap), Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Fri Jun 28 23:40:58 2019 (r349528) +++ head/share/man/man9/Makefile Sat Jun 29 00:48:33 2019 (r349529) @@ -1834,6 +1834,8 @@ MLINKS+=sf_buf.9 sf_buf_alloc.9 \ MLINKS+=sglist.9 sglist_alloc.9 \ sglist.9 sglist_append.9 \ sglist.9 sglist_append_bio.9 \ + sglist.9 sglist_append_ext_pgs.9 \ + sglist.9 sglist_append_mb_ext_pgs.9 \ sglist.9 sglist_append_mbuf.9 \ sglist.9 sglist_append_phys.9 \ sglist.9 sglist_append_sglist.9 \ @@ -1844,6 +1846,8 @@ MLINKS+=sglist.9 sglist_alloc.9 \ sglist.9 sglist_clone.9 \ sglist.9 sglist_consume_uio.9 \ sglist.9 sglist_count.9 \ + sglist.9 sglist_count_ext_pgs.9 \ + sglist.9 sglist_count_mb_ext_pgs.9 \ sglist.9 sglist_count_vmpages.9 \ sglist.9 sglist_free.9 \ sglist.9 sglist_hold.9 \ Modified: head/share/man/man9/mbuf.9 ============================================================================== --- head/share/man/man9/mbuf.9 Fri Jun 28 23:40:58 2019 (r349528) +++ head/share/man/man9/mbuf.9 Sat Jun 29 00:48:33 2019 (r349529) @@ -213,7 +213,7 @@ flag bits are defined as follows: #define M_PKTHDR 0x00000002 /* start of record */ #define M_EOR 0x00000004 /* end of record */ #define M_RDONLY 0x00000008 /* associated data marked read-only */ -#define M_NOMAP 0x00000100 /* mbuf data is unmapped (soon from Drew) */ +#define M_NOMAP 0x00000100 /* mbuf data is unmapped */ #define M_NOFREE 0x00000200 /* do not free mbuf, embedded in cluster */ #define M_BCAST 0x00000010 /* send/received as link-level broadcast */ #define M_MCAST 0x00000020 /* send/received as link-level multicast */ @@ -272,6 +272,7 @@ The available external buffer types are defined as fol #define EXT_PACKET 6 /* mbuf+cluster from packet zone */ #define EXT_MBUF 7 /* external mbuf reference */ #define EXT_RXRING 8 /* data in NIC receive ring */ +#define EXT_PGS 9 /* array of unmapped pages */ #define EXT_VENDOR1 224 /* for vendor-internal use */ #define EXT_VENDOR2 225 /* for vendor-internal use */ Modified: head/share/man/man9/sglist.9 ============================================================================== --- head/share/man/man9/sglist.9 Fri Jun 28 23:40:58 2019 (r349528) +++ head/share/man/man9/sglist.9 Sat Jun 29 00:48:33 2019 (r349529) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 16, 2017 +.Dd June 28, 2019 .Dt SGLIST 9 .Os .Sh NAME @@ -34,6 +34,8 @@ .Nm sglist_alloc , .Nm sglist_append , .Nm sglist_append_bio , +.Nm sglist_append_ext_pgs, +.Nm sglist_append_mb_ext_pgs, .Nm sglist_append_mbuf , .Nm sglist_append_phys , .Nm sglist_append_sglist , @@ -44,6 +46,8 @@ .Nm sglist_clone , .Nm sglist_consume_uio , .Nm sglist_count , +.Nm sglist_count_ext_pgs , +.Nm sglist_count_mb_ext_pgs , .Nm sglist_count_vmpages , .Nm sglist_free , .Nm sglist_hold , @@ -64,6 +68,10 @@ .Ft int .Fn sglist_append_bio "struct sglist *sg" "struct bio *bp" .Ft int +.Fn sglist_append_ext_pgs "struct sglist *sg" "struct mbuf_ext_pgs *ext_pgs" "size_t offset" "size_t len" +.Ft int +.Fn sglist_append_mb_ext_pgs "struct sglist *sg" "struct mbuf *m" +.Ft int .Fn sglist_append_mbuf "struct sglist *sg" "struct mbuf *m" .Ft int .Fn sglist_append_phys "struct sglist *sg" "vm_paddr_t paddr" "size_t len" @@ -84,6 +92,10 @@ .Ft int .Fn sglist_count "void *buf" "size_t len" .Ft int +.Fn sglist_count_ext_pgs "struct mbuf_ext_pgs *ext_pgs" "size_t offset" "size_t len" +.Ft int +.Fn sglist_count_mb_ext_pgs "struct mbuf *m" +.Ft int .Fn sglist_count_vmpages "vm_page_t *m" "size_t pgoff" "size_t len" .Ft void .Fn sglist_free "struct sglist *sg" @@ -146,6 +158,22 @@ and is bytes long. .Pp The +.Nm sglist_count_ext_pgs +function returns the number of scatter/gather list elements needed to describe +the unmapped external mbuf buffer +.Fa ext_pgs . +The ranges start at an offset of +.Fa offset +relative to the start of the buffer and is +.Fa len +bytes long. +The +.Nm sglist_count_mb_ext_pgs +function returns the number of scatter/gather list elements needed to describe +the physical address ranges of a single unmapped mbuf +.Fa m . +.Pp +The .Nm sglist_count_vmpages function returns the number of scatter/gather list elements needed to describe the physical address ranges of a buffer backed by an array of virtual memory @@ -237,6 +265,34 @@ to the scatter/gather list .Fa sg . .Pp The +.Nm sglist_append_ext_pgs +function appends the physical address ranges described by the unmapped +external mbuf buffer +.Fa ext_pgs +to the scatter/gather list +.Fa sg . +The physical address ranges start at offset +.Fa offset +within +.Fa ext_pgs +and continue for +.Fa len +bytes. +.Pp +The +.Nm sglist_append_mb_ext_pgs +function appends the physical address ranges described by the unmapped +mbuf +.Fa m +to the scatter/gather list +.Fa sg . +Note that unlike +.Nm sglist_append_mbuf , +.Nm sglist_append_mb_ext_pgs +only adds ranges for a single mbuf, +not an entire mbuf chain. +.Pp +The .Nm sglist_append_mbuf function appends the physical address ranges described by an entire mbuf chain @@ -467,8 +523,7 @@ functions return zero on success or an error on failur .Pp The .Nm sglist_count -and -.Nm sglist_count_vmpages +family of functions return a count of scatter/gather list elements. .Pp The Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Jun 28 23:40:58 2019 (r349528) +++ head/sys/conf/files Sat Jun 29 00:48:33 2019 (r349529) @@ -4255,7 +4255,8 @@ 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 netinet/tcp_hpts.c optional tcphpts inet | tcphpts inet6 -netinet/tcp_pcap.c optional inet tcppcap | inet6 tcppcap +netinet/tcp_pcap.c optional inet tcppcap | inet6 tcppcap \ + compile-with "${NORMAL_C} ${NO_WNONNULL}" netinet/tcp_reass.c optional inet | inet6 netinet/tcp_sack.c optional inet | inet6 netinet/tcp_subr.c optional inet | inet6 Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Fri Jun 28 23:40:58 2019 (r349528) +++ head/sys/conf/kern.mk Sat Jun 29 00:48:33 2019 (r349529) @@ -76,6 +76,7 @@ CWARNEXTRA?= -Wno-uninitialized # GCC 4.2 doesn't have -Wno-error=cast-qual, so just disable the warning for # the few files that are already known to generate cast-qual warnings. NO_WCAST_QUAL= -Wno-cast-qual +NO_WNONNULL= -Wno-nonnull .endif .endif Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Fri Jun 28 23:40:58 2019 (r349528) +++ head/sys/kern/kern_mbuf.c Sat Jun 29 00:48:33 2019 (r349529) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -281,6 +282,7 @@ uma_zone_t zone_pack; uma_zone_t zone_jumbop; uma_zone_t zone_jumbo9; uma_zone_t zone_jumbo16; +uma_zone_t zone_extpgs; /* * Local prototypes. @@ -298,6 +300,9 @@ static void *mbuf_jumbo_alloc(uma_zone_t, vm_size_t /* Ensure that MSIZE is a power of 2. */ CTASSERT((((MSIZE - 1) ^ MSIZE) + 1) >> 1 == MSIZE); +_Static_assert(sizeof(struct mbuf_ext_pgs) == 256, + "mbuf_ext_pgs size mismatch"); + /* * Initialize FreeBSD Network buffer allocation. */ @@ -379,6 +384,15 @@ mbuf_init(void *dummy) uma_zone_set_warning(zone_jumbo16, "kern.ipc.nmbjumbo16 limit reached"); uma_zone_set_maxaction(zone_jumbo16, mb_reclaim); + zone_extpgs = uma_zcreate(MBUF_EXTPGS_MEM_NAME, + sizeof(struct mbuf_ext_pgs), +#ifdef INVARIANTS + trash_ctor, trash_dtor, trash_init, trash_fini, +#else + NULL, NULL, NULL, NULL, +#endif + UMA_ALIGN_CACHE, 0); + /* * Hook event handler for low-memory situation, used to * drain protocols and push data back to the caches (UMA @@ -824,6 +838,380 @@ mb_reclaim(uma_zone_t zone __unused, int pending __unu } /* + * Free "count" units of I/O from an mbuf chain. They could be held + * in EXT_PGS or just as a normal mbuf. This code is intended to be + * called in an error path (I/O error, closed connection, etc). + */ +void +mb_free_notready(struct mbuf *m, int count) +{ + int i; + + for (i = 0; i < count && m != NULL; i++) { + if ((m->m_flags & M_EXT) != 0 && + m->m_ext.ext_type == EXT_PGS) { + m->m_ext.ext_pgs->nrdy--; + if (m->m_ext.ext_pgs->nrdy != 0) + continue; + } + m = m_free(m); + } + KASSERT(i == count, ("Removed only %d items from %p", i, m)); +} + +/* + * Compress an unmapped mbuf into a simple mbuf when it holds a small + * amount of data. This is used as a DOS defense to avoid having + * small packets tie up wired pages, an ext_pgs structure, and an + * mbuf. Since this converts the existing mbuf in place, it can only + * be used if there are no other references to 'm'. + */ +int +mb_unmapped_compress(struct mbuf *m) +{ + volatile u_int *refcnt; + struct mbuf m_temp; + + /* + * Assert that 'm' does not have a packet header. If 'm' had + * a packet header, it would only be able to hold MHLEN bytes + * and m_data would have to be initialized differently. + */ + KASSERT((m->m_flags & M_PKTHDR) == 0 && (m->m_flags & M_EXT) && + m->m_ext.ext_type == EXT_PGS, + ("%s: m %p !M_EXT or !EXT_PGS or M_PKTHDR", __func__, m)); + KASSERT(m->m_len <= MLEN, ("m_len too large %p", m)); + + if (m->m_ext.ext_flags & EXT_FLAG_EMBREF) { + refcnt = &m->m_ext.ext_count; + } else { + KASSERT(m->m_ext.ext_cnt != NULL, + ("%s: no refcounting pointer on %p", __func__, m)); + refcnt = m->m_ext.ext_cnt; + } + + if (*refcnt != 1) + return (EBUSY); + + /* + * Copy mbuf header and m_ext portion of 'm' to 'm_temp' to + * create a "fake" EXT_PGS mbuf that can be used with + * m_copydata() as well as the ext_free callback. + */ + memcpy(&m_temp, m, offsetof(struct mbuf, m_ext) + sizeof (m->m_ext)); + m_temp.m_next = NULL; + m_temp.m_nextpkt = NULL; + + /* Turn 'm' into a "normal" mbuf. */ + m->m_flags &= ~(M_EXT | M_RDONLY | M_NOMAP); + m->m_data = m->m_dat; + + /* Copy data from template's ext_pgs. */ + m_copydata(&m_temp, 0, m_temp.m_len, mtod(m, caddr_t)); + + /* Free the backing pages. */ + m_temp.m_ext.ext_free(&m_temp); + + /* Finally, free the ext_pgs struct. */ + uma_zfree(zone_extpgs, m_temp.m_ext.ext_pgs); + return (0); +} + +/* + * These next few routines are used to permit downgrading an unmapped + * mbuf to a chain of mapped mbufs. This is used when an interface + * doesn't supported unmapped mbufs or if checksums need to be + * computed in software. + * + * Each unmapped mbuf is converted to a chain of mbufs. First, any + * TLS header data is stored in a regular mbuf. Second, each page of + * unmapped data is stored in an mbuf with an EXT_SFBUF external + * cluster. These mbufs use an sf_buf to provide a valid KVA for the + * associated physical page. They also hold a reference on the + * original EXT_PGS mbuf to ensure the physical page doesn't go away. + * Finally, any TLS trailer data is stored in a regular mbuf. + * + * mb_unmapped_free_mext() is the ext_free handler for the EXT_SFBUF + * mbufs. It frees the associated sf_buf and releases its reference + * on the original EXT_PGS mbuf. + * + * _mb_unmapped_to_ext() is a helper function that converts a single + * unmapped mbuf into a chain of mbufs. + * + * mb_unmapped_to_ext() is the public function that walks an mbuf + * chain converting any unmapped mbufs to mapped mbufs. It returns + * the new chain of unmapped mbufs on success. On failure it frees + * the original mbuf chain and returns NULL. + */ +static void +mb_unmapped_free_mext(struct mbuf *m) +{ + struct sf_buf *sf; + struct mbuf *old_m; + + sf = m->m_ext.ext_arg1; + sf_buf_free(sf); + + /* Drop the reference on the backing EXT_PGS mbuf. */ + old_m = m->m_ext.ext_arg2; + mb_free_ext(old_m); +} + +static struct mbuf * +_mb_unmapped_to_ext(struct mbuf *m) +{ + struct mbuf_ext_pgs *ext_pgs; + struct mbuf *m_new, *top, *prev, *mref; + struct sf_buf *sf; + vm_page_t pg; + int i, len, off, pglen, pgoff, seglen, segoff; + volatile u_int *refcnt; + u_int ref_inc = 0; + + MBUF_EXT_PGS_ASSERT(m); + ext_pgs = m->m_ext.ext_pgs; + len = m->m_len; + KASSERT(ext_pgs->tls == NULL, ("%s: can't convert TLS mbuf %p", + __func__, m)); + + /* See if this is the mbuf that holds the embedded refcount. */ + if (m->m_ext.ext_flags & EXT_FLAG_EMBREF) { + refcnt = &m->m_ext.ext_count; + mref = m; + } else { + KASSERT(m->m_ext.ext_cnt != NULL, + ("%s: no refcounting pointer on %p", __func__, m)); + refcnt = m->m_ext.ext_cnt; + mref = __containerof(refcnt, struct mbuf, m_ext.ext_count); + } + + /* Skip over any data removed from the front. */ + off = mtod(m, vm_offset_t); + + top = NULL; + if (ext_pgs->hdr_len != 0) { + if (off >= ext_pgs->hdr_len) { + off -= ext_pgs->hdr_len; + } else { + seglen = ext_pgs->hdr_len - off; + segoff = off; + seglen = min(seglen, len); + off = 0; + len -= seglen; + m_new = m_get(M_NOWAIT, MT_DATA); + if (m_new == NULL) + goto fail; + m_new->m_len = seglen; + prev = top = m_new; + memcpy(mtod(m_new, void *), &ext_pgs->hdr[segoff], + seglen); + } + } + pgoff = ext_pgs->first_pg_off; + for (i = 0; i < ext_pgs->npgs && len > 0; i++) { + pglen = mbuf_ext_pg_len(ext_pgs, i, pgoff); + if (off >= pglen) { + off -= pglen; + pgoff = 0; + continue; + } + seglen = pglen - off; + segoff = pgoff + off; + off = 0; + seglen = min(seglen, len); + len -= seglen; + + pg = PHYS_TO_VM_PAGE(ext_pgs->pa[i]); + m_new = m_get(M_NOWAIT, MT_DATA); + if (m_new == NULL) + goto fail; + if (top == NULL) { + top = prev = m_new; + } else { + prev->m_next = m_new; + prev = m_new; + } + sf = sf_buf_alloc(pg, SFB_NOWAIT); + if (sf == NULL) + goto fail; + + ref_inc++; + m_extadd(m_new, (char *)sf_buf_kva(sf), PAGE_SIZE, + mb_unmapped_free_mext, sf, mref, M_RDONLY, EXT_SFBUF); + m_new->m_data += segoff; + m_new->m_len = seglen; + + pgoff = 0; + }; + if (len != 0) { + KASSERT((off + len) <= ext_pgs->trail_len, + ("off + len > trail (%d + %d > %d)", off, len, + ext_pgs->trail_len)); + m_new = m_get(M_NOWAIT, MT_DATA); + if (m_new == NULL) + goto fail; + if (top == NULL) + top = m_new; + else + prev->m_next = m_new; + m_new->m_len = len; + memcpy(mtod(m_new, void *), &ext_pgs->trail[off], len); + } + + if (ref_inc != 0) { + /* + * Obtain an additional reference on the old mbuf for + * each created EXT_SFBUF mbuf. They will be dropped + * in mb_unmapped_free_mext(). + */ + if (*refcnt == 1) + *refcnt += ref_inc; + else + atomic_add_int(refcnt, ref_inc); + } + m_free(m); + return (top); + +fail: + if (ref_inc != 0) { + /* + * Obtain an additional reference on the old mbuf for + * each created EXT_SFBUF mbuf. They will be + * immediately dropped when these mbufs are freed + * below. + */ + if (*refcnt == 1) + *refcnt += ref_inc; + else + atomic_add_int(refcnt, ref_inc); + } + m_free(m); + m_freem(top); + return (NULL); +} + +struct mbuf * +mb_unmapped_to_ext(struct mbuf *top) +{ + struct mbuf *m, *next, *prev = NULL; + + prev = NULL; + for (m = top; m != NULL; m = next) { + /* m might be freed, so cache the next pointer. */ + next = m->m_next; + if (m->m_flags & M_NOMAP) { + if (prev != NULL) { + /* + * Remove 'm' from the new chain so + * that the 'top' chain terminates + * before 'm' in case 'top' is freed + * due to an error. + */ + prev->m_next = NULL; + } + m = _mb_unmapped_to_ext(m); + if (m == NULL) { + m_freem(top); + m_freem(next); + return (NULL); + } + if (prev == NULL) { + top = m; + } else { + prev->m_next = m; + } + + /* + * Replaced one mbuf with a chain, so we must + * find the end of chain. + */ + prev = m_last(m); + } else { + if (prev != NULL) { + prev->m_next = m; + } + prev = m; + } + } + return (top); +} + +/* + * Allocate an empty EXT_PGS mbuf. The ext_free routine is + * responsible for freeing any pages backing this mbuf when it is + * freed. + */ +struct mbuf * +mb_alloc_ext_pgs(int how, bool pkthdr, m_ext_free_t ext_free) +{ + struct mbuf *m; + struct mbuf_ext_pgs *ext_pgs; + + if (pkthdr) + m = m_gethdr(how, MT_DATA); + else + m = m_get(how, MT_DATA); + if (m == NULL) + return (NULL); + + ext_pgs = uma_zalloc(zone_extpgs, how); + if (ext_pgs == NULL) { + m_free(m); + return (NULL); + } + ext_pgs->npgs = 0; + ext_pgs->nrdy = 0; + ext_pgs->first_pg_off = 0; + ext_pgs->last_pg_len = 0; + ext_pgs->hdr_len = 0; + ext_pgs->trail_len = 0; + ext_pgs->tls = NULL; + ext_pgs->so = NULL; + m->m_data = NULL; + m->m_flags |= (M_EXT | M_RDONLY | M_NOMAP); + m->m_ext.ext_type = EXT_PGS; + m->m_ext.ext_flags = EXT_FLAG_EMBREF; + m->m_ext.ext_count = 1; + m->m_ext.ext_pgs = ext_pgs; + m->m_ext.ext_size = 0; + m->m_ext.ext_free = ext_free; + return (m); +} + +#ifdef INVARIANT_SUPPORT +void +mb_ext_pgs_check(struct mbuf_ext_pgs *ext_pgs) +{ + + /* + * NB: This expects a non-empty buffer (npgs > 0 and + * last_pg_len > 0). + */ + KASSERT(ext_pgs->npgs > 0, + ("ext_pgs with no valid pages: %p", ext_pgs)); + KASSERT(ext_pgs->npgs <= nitems(ext_pgs->pa), + ("ext_pgs with too many pages: %p", ext_pgs)); + KASSERT(ext_pgs->nrdy <= ext_pgs->npgs, + ("ext_pgs with too many ready pages: %p", ext_pgs)); + KASSERT(ext_pgs->first_pg_off < PAGE_SIZE, + ("ext_pgs with too large page offset: %p", ext_pgs)); + KASSERT(ext_pgs->last_pg_len > 0, + ("ext_pgs with zero last page length: %p", ext_pgs)); + KASSERT(ext_pgs->last_pg_len <= PAGE_SIZE, + ("ext_pgs with too large last page length: %p", ext_pgs)); + if (ext_pgs->npgs == 1) { + KASSERT(ext_pgs->first_pg_off + ext_pgs->last_pg_len <= + PAGE_SIZE, ("ext_pgs with single page too large: %p", + ext_pgs)); + } + KASSERT(ext_pgs->hdr_len <= sizeof(ext_pgs->hdr), + ("ext_pgs with too large header length: %p", ext_pgs)); + KASSERT(ext_pgs->trail_len <= sizeof(ext_pgs->trail), + ("ext_pgs with too large header length: %p", ext_pgs)); +} +#endif + +/* * Clean up after mbufs with M_EXT storage attached to them if the * reference count hits 1. */ @@ -886,6 +1274,10 @@ mb_free_ext(struct mbuf *m) break; case EXT_JUMBO16: uma_zfree(zone_jumbo16, m->m_ext.ext_buf); + uma_zfree(zone_mbuf, mref); + break; + case EXT_PGS: + uma_zfree(zone_extpgs, mref->m_ext.ext_pgs); uma_zfree(zone_mbuf, mref); break; case EXT_SFBUF: Modified: head/sys/kern/subr_bus_dma.c ============================================================================== --- head/sys/kern/subr_bus_dma.c Fri Jun 28 23:40:58 2019 (r349528) +++ head/sys/kern/subr_bus_dma.c Sat Jun 29 00:48:33 2019 (r349529) @@ -111,6 +111,67 @@ _bus_dmamap_load_plist(bus_dma_tag_t dmat, bus_dmamap_ } /* + * Load an unmapped mbuf + */ +static int +_bus_dmamap_load_unmapped_mbuf_sg(bus_dma_tag_t dmat, bus_dmamap_t map, + struct mbuf *m, bus_dma_segment_t *segs, int *nsegs, int flags) +{ + struct mbuf_ext_pgs *ext_pgs; + int error, i, off, len, pglen, pgoff, seglen, segoff; + + MBUF_EXT_PGS_ASSERT(m); + ext_pgs = m->m_ext.ext_pgs; + + len = m->m_len; + error = 0; + + /* Skip over any data removed from the front. */ + off = mtod(m, vm_offset_t); + + if (ext_pgs->hdr_len != 0) { + if (off >= ext_pgs->hdr_len) { + off -= ext_pgs->hdr_len; + } else { + seglen = ext_pgs->hdr_len - off; + segoff = off; + seglen = min(seglen, len); + off = 0; + len -= seglen; + error = _bus_dmamap_load_buffer(dmat, map, + &ext_pgs->hdr[segoff], seglen, kernel_pmap, + flags, segs, nsegs); + } + } + pgoff = ext_pgs->first_pg_off; + for (i = 0; i < ext_pgs->npgs && error == 0 && len > 0; i++) { + pglen = mbuf_ext_pg_len(ext_pgs, i, pgoff); + if (off >= pglen) { + off -= pglen; + pgoff = 0; + continue; + } + seglen = pglen - off; + segoff = pgoff + off; + off = 0; + seglen = min(seglen, len); + len -= seglen; + error = _bus_dmamap_load_phys(dmat, map, + ext_pgs->pa[i] + segoff, seglen, flags, segs, nsegs); + pgoff = 0; + }; + if (len != 0 && error == 0) { + KASSERT((off + len) <= ext_pgs->trail_len, + ("off + len > trail (%d + %d > %d)", off, len, + ext_pgs->trail_len)); + error = _bus_dmamap_load_buffer(dmat, map, + &ext_pgs->trail[off], len, kernel_pmap, flags, segs, + nsegs); + } + return (error); +} + +/* * Load an mbuf chain. */ static int @@ -123,9 +184,13 @@ _bus_dmamap_load_mbuf_sg(bus_dma_tag_t dmat, bus_dmama error = 0; for (m = m0; m != NULL && error == 0; m = m->m_next) { if (m->m_len > 0) { - error = _bus_dmamap_load_buffer(dmat, map, m->m_data, - m->m_len, kernel_pmap, flags | BUS_DMA_LOAD_MBUF, - segs, nsegs); + if ((m->m_flags & M_NOMAP) != 0) + error = _bus_dmamap_load_unmapped_mbuf_sg(dmat, + map, m, segs, nsegs, flags); + else + error = _bus_dmamap_load_buffer(dmat, map, + m->m_data, m->m_len, kernel_pmap, + flags | BUS_DMA_LOAD_MBUF, segs, nsegs); } } CTR5(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d nsegs %d", Modified: head/sys/kern/subr_sglist.c ============================================================================== --- head/sys/kern/subr_sglist.c Fri Jun 28 23:40:58 2019 (r349528) +++ head/sys/kern/subr_sglist.c Sat Jun 29 00:48:33 2019 (r349529) @@ -219,6 +219,75 @@ sglist_count_vmpages(vm_page_t *m, size_t pgoff, size_ } /* + * Determine the number of scatter/gather list elements needed to + * describe an EXT_PGS buffer. + */ +int +sglist_count_ext_pgs(struct mbuf_ext_pgs *ext_pgs, size_t off, size_t len) +{ + vm_paddr_t nextaddr, paddr; + size_t seglen, segoff; + int i, nsegs, pglen, pgoff; + + if (len == 0) + return (0); + + nsegs = 0; + if (ext_pgs->hdr_len != 0) { + if (off >= ext_pgs->hdr_len) { + off -= ext_pgs->hdr_len; + } else { + seglen = ext_pgs->hdr_len - off; + segoff = off; + seglen = MIN(seglen, len); + off = 0; + len -= seglen; + nsegs += sglist_count(&ext_pgs->hdr[segoff], seglen); + } + } + nextaddr = 0; + pgoff = ext_pgs->first_pg_off; + for (i = 0; i < ext_pgs->npgs && len > 0; i++) { + pglen = mbuf_ext_pg_len(ext_pgs, i, pgoff); + if (off >= pglen) { + off -= pglen; + pgoff = 0; + continue; + } + seglen = pglen - off; + segoff = pgoff + off; + off = 0; + seglen = MIN(seglen, len); + len -= seglen; + paddr = ext_pgs->pa[i] + segoff; + if (paddr != nextaddr) + nsegs++; + nextaddr = paddr + seglen; + pgoff = 0; + }; + if (len != 0) { + seglen = MIN(len, ext_pgs->trail_len - off); + len -= seglen; + nsegs += sglist_count(&ext_pgs->trail[off], seglen); + } + KASSERT(len == 0, ("len != 0")); + return (nsegs); +} + +/* + * Determine the number of scatter/gather list elements needed to + * describe an EXT_PGS mbuf. + */ +int +sglist_count_mb_ext_pgs(struct mbuf *m) +{ + + MBUF_EXT_PGS_ASSERT(m); + return (sglist_count_ext_pgs(m->m_ext.ext_pgs, mtod(m, vm_offset_t), + m->m_len)); +} + +/* * Allocate a scatter/gather list along with 'nsegs' segments. The * 'mflags' parameters are the same as passed to malloc(9). The caller * should use sglist_free() to free this list. @@ -320,6 +389,76 @@ sglist_append_phys(struct sglist *sg, vm_paddr_t paddr } /* + * Append the segments to describe an EXT_PGS buffer to a + * scatter/gather list. If there are insufficient segments, then this + * fails with EFBIG. + */ +int +sglist_append_ext_pgs(struct sglist *sg, struct mbuf_ext_pgs *ext_pgs, + size_t off, size_t len) +{ + size_t seglen, segoff; + vm_paddr_t paddr; + int error, i, pglen, pgoff; + + error = 0; + if (ext_pgs->hdr_len != 0) { + if (off >= ext_pgs->hdr_len) { + off -= ext_pgs->hdr_len; + } else { + seglen = ext_pgs->hdr_len - off; + segoff = off; + seglen = MIN(seglen, len); + off = 0; + len -= seglen; + error = sglist_append(sg, + &ext_pgs->hdr[segoff], seglen); + } + } + pgoff = ext_pgs->first_pg_off; + for (i = 0; i < ext_pgs->npgs && error == 0 && len > 0; i++) { + pglen = mbuf_ext_pg_len(ext_pgs, i, pgoff); + if (off >= pglen) { + off -= pglen; + pgoff = 0; + continue; + } + seglen = pglen - off; + segoff = pgoff + off; + off = 0; + seglen = MIN(seglen, len); + len -= seglen; + paddr = ext_pgs->pa[i] + segoff; + error = sglist_append_phys(sg, paddr, seglen); + pgoff = 0; + }; + if (error == 0 && len > 0) { + seglen = MIN(len, ext_pgs->trail_len - off); + len -= seglen; + error = sglist_append(sg, + &ext_pgs->trail[off], seglen); + } + if (error == 0) + KASSERT(len == 0, ("len != 0")); + return (error); +} + +/* + * Append the segments to describe an EXT_PGS mbuf to a scatter/gather + * list. If there are insufficient segments, then this fails with + * EFBIG. + */ +int +sglist_append_mb_ext_pgs(struct sglist *sg, struct mbuf *m) +{ + + /* for now, all unmapped mbufs are assumed to be EXT_PGS */ + MBUF_EXT_PGS_ASSERT(m); + return (sglist_append_ext_pgs(sg, m->m_ext.ext_pgs, + mtod(m, vm_offset_t), m->m_len)); +} + +/* * Append the segments that describe a single mbuf chain to a * scatter/gather list. If there are insufficient segments, then this * fails with EFBIG. @@ -338,7 +477,11 @@ sglist_append_mbuf(struct sglist *sg, struct mbuf *m0) SGLIST_SAVE(sg, save); for (m = m0; m != NULL; m = m->m_next) { if (m->m_len > 0) { - error = sglist_append(sg, m->m_data, m->m_len); + if ((m->m_flags & M_NOMAP) != 0) + error = sglist_append_mb_ext_pgs(sg, m); + else + error = sglist_append(sg, m->m_data, + m->m_len); if (error) { SGLIST_RESTORE(sg, save); return (error); Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Fri Jun 28 23:40:58 2019 (r349528) +++ head/sys/kern/uipc_mbuf.c Sat Jun 29 00:48:33 2019 (r349529) @@ -49,7 +49,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include +#include +#include SDT_PROBE_DEFINE5_XLATE(sdt, , , m__init, "struct mbuf *", "mbufinfo_t *", @@ -202,7 +206,7 @@ mb_dupcl(struct mbuf *n, struct mbuf *m) else bcopy(&m->m_ext, &n->m_ext, m_ext_copylen); n->m_flags |= M_EXT; - n->m_flags |= m->m_flags & M_RDONLY; + n->m_flags |= m->m_flags & (M_RDONLY | M_NOMAP); /* See if this is the mbuf that holds the embedded refcount. */ if (m->m_ext.ext_flags & EXT_FLAG_EMBREF) { @@ -246,7 +250,8 @@ m_demote(struct mbuf *m0, int all, int flags) __func__, m, m0)); if (m->m_flags & M_PKTHDR) m_demote_pkthdr(m); - m->m_flags = m->m_flags & (M_EXT | M_RDONLY | M_NOFREE | flags); + m->m_flags = m->m_flags & (M_EXT | M_RDONLY | M_NOFREE | + M_NOMAP | flags); } } @@ -376,7 +381,8 @@ m_move_pkthdr(struct mbuf *to, struct mbuf *from) if (to->m_flags & M_PKTHDR) m_tag_delete_chain(to, NULL); #endif - to->m_flags = (from->m_flags & M_COPYFLAGS) | (to->m_flags & M_EXT); + to->m_flags = (from->m_flags & M_COPYFLAGS) | + (to->m_flags & (M_EXT | M_NOMAP)); if ((to->m_flags & M_EXT) == 0) to->m_data = to->m_pktdat; to->m_pkthdr = from->m_pkthdr; /* especially tags */ @@ -414,7 +420,8 @@ m_dup_pkthdr(struct mbuf *to, const struct mbuf *from, if (to->m_flags & M_PKTHDR) m_tag_delete_chain(to, NULL); #endif - to->m_flags = (from->m_flags & M_COPYFLAGS) | (to->m_flags & M_EXT); + to->m_flags = (from->m_flags & M_COPYFLAGS) | + (to->m_flags & (M_EXT | M_NOMAP)); if ((to->m_flags & M_EXT) == 0) to->m_data = to->m_pktdat; to->m_pkthdr = from->m_pkthdr; @@ -579,6 +586,30 @@ nospace: return (NULL); } +static void +m_copyfromunmapped(const struct mbuf *m, int off, int len, caddr_t cp) +{ + struct iovec iov; + struct uio uio; + int error; + + KASSERT(off >= 0, ("m_copyfromunmapped: negative off %d", off)); + KASSERT(len >= 0, ("m_copyfromunmapped: negative len %d", len)); + KASSERT(off < m->m_len, + ("m_copyfromunmapped: len exceeds mbuf length")); + iov.iov_base = cp; + iov.iov_len = len; + uio.uio_resid = len; + uio.uio_iov = &iov; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_iovcnt = 1; + uio.uio_offset = 0; + uio.uio_rw = UIO_READ; + error = m_unmappedtouio(m, off, &uio, len); + KASSERT(error == 0, ("m_unmappedtouio failed: off %d, len %d", off, + len)); +} + /* * Copy data from an mbuf chain starting "off" bytes from the beginning, * continuing for "len" bytes, into the indicated buffer. @@ -600,7 +631,10 @@ m_copydata(const struct mbuf *m, int off, int len, cad *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Jun 29 00:49:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1E7215D0443; Sat, 29 Jun 2019 00:49:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 489CC9002E; Sat, 29 Jun 2019 00:49:36 +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 1FEBD6CAF; Sat, 29 Jun 2019 00:49:36 +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 x5T0naP7033229; Sat, 29 Jun 2019 00:49:36 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5T0nZUm033226; Sat, 29 Jun 2019 00:49:35 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201906290049.x5T0nZUm033226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 29 Jun 2019 00:49:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349530 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 349530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 489CC9002E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2019 00:49:36 -0000 Author: jhb Date: Sat Jun 29 00:49:35 2019 New Revision: 349530 URL: https://svnweb.freebsd.org/changeset/base/349530 Log: Add support for using unmapped mbufs with sendfile(2). This can be enabled at runtime via the kern.ipc.mb_use_ext_pgs sysctl. It is disabled by default. Submitted by: gallatin (earlier version) Reviewed by: gallatin, hselasky, rrs Relnotes: yes Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20616 Modified: head/sys/kern/kern_mbuf.c head/sys/kern/kern_sendfile.c head/sys/sys/mbuf.h Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Sat Jun 29 00:48:33 2019 (r349529) +++ head/sys/kern/kern_mbuf.c Sat Jun 29 00:49:35 2019 (r349530) @@ -112,6 +112,11 @@ int nmbjumbop; /* limits number of page size jumbo c int nmbjumbo9; /* limits number of 9k jumbo clusters */ int nmbjumbo16; /* limits number of 16k jumbo clusters */ +bool mb_use_ext_pgs; /* use EXT_PGS mbufs for sendfile */ +SYSCTL_BOOL(_kern_ipc, OID_AUTO, mb_use_ext_pgs, CTLFLAG_RWTUN, + &mb_use_ext_pgs, 0, + "Use unmapped mbufs for sendfile(2)"); + static quad_t maxmbufmem; /* overall real memory limit for all mbufs */ SYSCTL_QUAD(_kern_ipc, OID_AUTO, maxmbufmem, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &maxmbufmem, 0, Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Sat Jun 29 00:48:33 2019 (r349529) +++ head/sys/kern/kern_sendfile.c Sat Jun 29 00:49:35 2019 (r349530) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -62,6 +63,7 @@ __FBSDID("$FreeBSD$"); #define EXT_FLAG_SYNC EXT_FLAG_VENDOR1 #define EXT_FLAG_NOCACHE EXT_FLAG_VENDOR2 +#define EXT_FLAG_CACHE_LAST EXT_FLAG_VENDOR3 /* * Structure describing a single sendfile(2) I/O, which may consist of @@ -201,6 +203,39 @@ sendfile_free_mext(struct mbuf *m) } } +static void +sendfile_free_mext_pg(struct mbuf *m) +{ + struct mbuf_ext_pgs *ext_pgs; + vm_page_t pg; + int i; + bool nocache, cache_last; + + KASSERT(m->m_flags & M_EXT && m->m_ext.ext_type == EXT_PGS, + ("%s: m %p !M_EXT or !EXT_PGS", __func__, m)); + + nocache = m->m_ext.ext_flags & EXT_FLAG_NOCACHE; + cache_last = m->m_ext.ext_flags & EXT_FLAG_CACHE_LAST; + ext_pgs = m->m_ext.ext_pgs; + + for (i = 0; i < ext_pgs->npgs; i++) { + if (cache_last && i == ext_pgs->npgs - 1) + nocache = false; + pg = PHYS_TO_VM_PAGE(ext_pgs->pa[i]); + sendfile_free_page(pg, nocache); + } + + if (m->m_ext.ext_flags & EXT_FLAG_SYNC) { + struct sendfile_sync *sfs = m->m_ext.ext_arg2; + + mtx_lock(&sfs->mtx); + KASSERT(sfs->count > 0, ("Sendfile sync botchup count == 0")); + if (--sfs->count == 0) + cv_signal(&sfs->cv); + mtx_unlock(&sfs->mtx); + } +} + /* * Helper function to calculate how much data to put into page i of n. * Only first and last pages are special. @@ -283,8 +318,6 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i CURVNET_SET(so->so_vnet); if (sfio->error) { - struct mbuf *m; - /* * I/O operation failed. The state of data in the socket * is now inconsistent, and all what we can do is to tear @@ -299,9 +332,7 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i so->so_proto->pr_usrreqs->pru_abort(so); so->so_error = EIO; - m = sfio->m; - for (int i = 0; i < sfio->npages; i++) - m = m_free(m); + mb_free_notready(sfio->m, sfio->npages); } else (void)(so->so_proto->pr_usrreqs->pru_ready)(so, sfio->m, sfio->npages); @@ -540,13 +571,15 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *h struct vnode *vp; struct vm_object *obj; struct socket *so; + struct mbuf_ext_pgs *ext_pgs; struct mbuf *m, *mh, *mhtail; struct sf_buf *sf; struct shmfd *shmfd; struct sendfile_sync *sfs; struct vattr va; off_t off, sbytes, rem, obj_size; - int error, softerr, bsize, hdrlen; + int bsize, error, ext_pgs_idx, hdrlen, max_pgs, softerr; + bool use_ext_pgs; obj = NULL; so = NULL; @@ -554,6 +587,7 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *h sfs = NULL; hdrlen = sbytes = 0; softerr = 0; + use_ext_pgs = false; error = sendfile_getobj(td, fp, &obj, &vp, &shmfd, &obj_size, &bsize); if (error != 0) @@ -714,6 +748,17 @@ retry_space: if (space > rem) space = rem; + else if (space > PAGE_SIZE) { + /* + * Use page boundaries when possible for large + * requests. + */ + if (off & PAGE_MASK) + space -= (PAGE_SIZE - (off & PAGE_MASK)); + space = trunc_page(space); + if (off & PAGE_MASK) + space += (PAGE_SIZE - (off & PAGE_MASK)); + } npages = howmany(space + (off & PAGE_MASK), PAGE_SIZE); @@ -751,6 +796,22 @@ retry_space: * dumped into socket buffer. */ pa = sfio->pa; + + /* + * Use unmapped mbufs if enabled for TCP. Unmapped + * bufs are restricted to TCP as that is what has been + * tested. In particular, unmapped mbufs have not + * been tested with UNIX-domain sockets. + */ + if (mb_use_ext_pgs && + so->so_proto->pr_protocol == IPPROTO_TCP) { + use_ext_pgs = true; + max_pgs = MBUF_PEXT_MAX_PGS; + + /* Start at last index, to wrap on first use. */ + ext_pgs_idx = max_pgs - 1; + } + for (int i = 0; i < npages; i++) { struct mbuf *m0; @@ -764,6 +825,66 @@ retry_space: npages = i; softerr = EBUSY; break; + } + + if (use_ext_pgs) { + off_t xfs; + + ext_pgs_idx++; + if (ext_pgs_idx == max_pgs) { + m0 = mb_alloc_ext_pgs(M_WAITOK, false, + sendfile_free_mext_pg); + + if (flags & SF_NOCACHE) { + m0->m_ext.ext_flags |= + EXT_FLAG_NOCACHE; + + /* + * See comment below regarding + * ignoring SF_NOCACHE for the + * last page. + */ + if ((npages - i <= max_pgs) && + ((off + space) & PAGE_MASK) && + (rem > space || rhpages > 0)) + m0->m_ext.ext_flags |= + EXT_FLAG_CACHE_LAST; + } + if (sfs != NULL) { + m0->m_ext.ext_flags |= + EXT_FLAG_SYNC; + m0->m_ext.ext_arg2 = sfs; + mtx_lock(&sfs->mtx); + sfs->count++; + mtx_unlock(&sfs->mtx); + } + ext_pgs = m0->m_ext.ext_pgs; + if (i == 0) + sfio->m = m0; + ext_pgs_idx = 0; + + /* Append to mbuf chain. */ + if (mtail != NULL) + mtail->m_next = m0; + else + m = m0; + mtail = m0; + ext_pgs->first_pg_off = + vmoff(i, off) & PAGE_MASK; + } + if (nios) { + mtail->m_flags |= M_NOTREADY; + ext_pgs->nrdy++; + } + + ext_pgs->pa[ext_pgs_idx] = VM_PAGE_TO_PHYS(pa[i]); + ext_pgs->npgs++; + xfs = xfsize(i, npages, off, space); + ext_pgs->last_pg_len = xfs; + MBUF_EXT_PGS_ASSERT_SANITY(ext_pgs); + mtail->m_len += xfs; + mtail->m_ext.ext_size += PAGE_SIZE; + continue; } /* Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat Jun 29 00:48:33 2019 (r349529) +++ head/sys/sys/mbuf.h Sat Jun 29 00:49:35 2019 (r349530) @@ -1129,6 +1129,7 @@ extern int max_hdr; /* Largest link + protocol header extern int max_linkhdr; /* Largest link-level header */ extern int max_protohdr; /* Largest protocol header */ extern int nmbclusters; /* Maximum number of clusters */ +extern bool mb_use_ext_pgs; /* Use ext_pgs for sendfile */ /*- * Network packets may have annotations attached by affixing a list of From owner-svn-src-head@freebsd.org Sat Jun 29 00:50:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75AF015D0531; Sat, 29 Jun 2019 00:50: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1947B901E8; Sat, 29 Jun 2019 00:50: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 DFC0E6CE1; Sat, 29 Jun 2019 00:50: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 x5T0oPXK033333; Sat, 29 Jun 2019 00:50:25 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5T0oPJg033332; Sat, 29 Jun 2019 00:50:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201906290050.x5T0oPJg033332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 29 Jun 2019 00:50:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349531 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349531 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1947B901E8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2019 00:50:26 -0000 Author: jhb Date: Sat Jun 29 00:50:25 2019 New Revision: 349531 URL: https://svnweb.freebsd.org/changeset/base/349531 Log: Compress pending socket buffer data once it is marked ready. Apply similar logic from sbcompress to pending data in the socket buffer once it is marked ready via sbready. Normally sbcompress merges small mbufs to reduce the length of mbuf chains in the socket buffer. However, sbcompress cannot do this for mbufs marked M_NOTREADY. sbcompress_ready is now called from sbready when mbufs are marked ready to merge small mbuf chains once the data is available to copy. Submitted by: gallatin (earlier version) Reviewed by: gallatin, hselasky, rrs Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20616 Modified: head/sys/kern/uipc_sockbuf.c Modified: head/sys/kern/uipc_sockbuf.c ============================================================================== --- head/sys/kern/uipc_sockbuf.c Sat Jun 29 00:49:35 2019 (r349530) +++ head/sys/kern/uipc_sockbuf.c Sat Jun 29 00:50:25 2019 (r349531) @@ -89,6 +89,78 @@ sbm_clrprotoflags(struct mbuf *m, int flags) } /* + * Compress M_NOTREADY mbufs after they have been readied by sbready(). + * + * sbcompress() skips M_NOTREADY mbufs since the data is not available to + * be copied at the time of sbcompress(). This function combines small + * mbufs similar to sbcompress() once mbufs are ready. 'm0' is the first + * mbuf sbready() marked ready, and 'end' is the first mbuf still not + * ready. + */ +static void +sbready_compress(struct sockbuf *sb, struct mbuf *m0, struct mbuf *end) +{ + struct mbuf *m, *n; + int ext_size; + + SOCKBUF_LOCK_ASSERT(sb); + + if ((sb->sb_flags & SB_NOCOALESCE) != 0) + return; + + for (m = m0; m != end; m = m->m_next) { + MPASS((m->m_flags & M_NOTREADY) == 0); + + /* Compress small unmapped mbufs into plain mbufs. */ + if ((m->m_flags & M_NOMAP) && m->m_len <= MLEN) { + MPASS(m->m_flags & M_EXT); + ext_size = m->m_ext.ext_size; + if (mb_unmapped_compress(m) == 0) { + sb->sb_mbcnt -= ext_size; + sb->sb_ccnt -= 1; + } + } + + /* + * NB: In sbcompress(), 'n' is the last mbuf in the + * socket buffer and 'm' is the new mbuf being copied + * into the trailing space of 'n'. Here, the roles + * are reversed and 'n' is the next mbuf after 'm' + * that is being copied into the trailing space of + * 'm'. + */ + n = m->m_next; + while ((n != NULL) && (n != end) && (m->m_flags & M_EOR) == 0 && + M_WRITABLE(m) && + (m->m_flags & M_NOMAP) == 0 && + n->m_len <= MCLBYTES / 4 && /* XXX: Don't copy too much */ + n->m_len <= M_TRAILINGSPACE(m) && + m->m_type == n->m_type) { + KASSERT(sb->sb_lastrecord != n, + ("%s: merging start of record (%p) into previous mbuf (%p)", + __func__, n, m)); + m_copydata(n, 0, n->m_len, mtodo(m, m->m_len)); + m->m_len += n->m_len; + m->m_next = n->m_next; + m->m_flags |= n->m_flags & M_EOR; + if (sb->sb_mbtail == n) + sb->sb_mbtail = m; + + sb->sb_mbcnt -= MSIZE; + sb->sb_mcnt -= 1; + if (n->m_flags & M_EXT) { + sb->sb_mbcnt -= n->m_ext.ext_size; + sb->sb_ccnt -= 1; + } + m_free(n); + n = m->m_next; + } + } + SBLASTRECORDCHK(sb); + SBLASTMBUFCHK(sb); +} + +/* * Mark ready "count" units of I/O starting with "m". Most mbufs * count as a single unit of I/O except for EXT_PGS-backed mbufs which * can be backed by multiple pages. @@ -138,6 +210,7 @@ sbready(struct sockbuf *sb, struct mbuf *m0, int count } if (!blocker) { + sbready_compress(sb, m0, m); return (EINPROGRESS); } @@ -150,6 +223,7 @@ sbready(struct sockbuf *sb, struct mbuf *m0, int count } sb->sb_fnrdy = m; + sbready_compress(sb, m0, m); return (0); } From owner-svn-src-head@freebsd.org Sat Jun 29 00:51:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C801C15D05D6; Sat, 29 Jun 2019 00:51:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6CEE19052F; Sat, 29 Jun 2019 00:51:39 +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 5DEC86D3A; Sat, 29 Jun 2019 00:51:39 +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 x5T0pdYs037550; Sat, 29 Jun 2019 00:51:39 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5T0pdRN037549; Sat, 29 Jun 2019 00:51:39 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201906290051.x5T0pdRN037549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 29 Jun 2019 00:51:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349532 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 349532 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6CEE19052F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.981,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2019 00:51:40 -0000 Author: jhb Date: Sat Jun 29 00:51:38 2019 New Revision: 349532 URL: https://svnweb.freebsd.org/changeset/base/349532 Log: Support IFCAP_NOMAP in vlan(4). Enable IFCAP_NOMAP for a vlan interface if it is supported by the underlying trunk device. Reviewed by: gallatin, hselasky, rrs Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20616 Modified: head/sys/net/if_vlan.c Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Sat Jun 29 00:50:25 2019 (r349531) +++ head/sys/net/if_vlan.c Sat Jun 29 00:51:38 2019 (r349532) @@ -1731,6 +1731,16 @@ vlan_capabilities(struct ifvlan *ifv) ena |= (mena & IFCAP_TXRTLMT); #endif + /* + * If the parent interface supports unmapped mbufs, so does + * the VLAN interface. Note that this should be fine even for + * interfaces that don't support hardware tagging as headers + * are prepended in normal mbufs to unmapped mbufs holding + * payload data. + */ + cap |= (p->if_capabilities & IFCAP_NOMAP); + ena |= (mena & IFCAP_NOMAP); + ifp->if_capabilities = cap; ifp->if_capenable = ena; ifp->if_hwassist = hwa; From owner-svn-src-head@freebsd.org Sat Jun 29 00:52:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7254615D07A5; Sat, 29 Jun 2019 00:52:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 10028906F7; Sat, 29 Jun 2019 00:52:22 +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 001676E75; Sat, 29 Jun 2019 00:52:21 +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 x5T0qLmJ037624; Sat, 29 Jun 2019 00:52:21 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5T0qL66037621; Sat, 29 Jun 2019 00:52:21 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201906290052.x5T0qL66037621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 29 Jun 2019 00:52:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349533 - in head/sys/dev/cxgbe: . tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . tom X-SVN-Commit-Revision: 349533 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 10028906F7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2019 00:52:22 -0000 Author: jhb Date: Sat Jun 29 00:52:21 2019 New Revision: 349533 URL: https://svnweb.freebsd.org/changeset/base/349533 Log: Add support for IFCAP_NOMAP to cxgbe(4). Since cxgbe(4) uses sglist instead of bus_dma, this required updates to the code that generates scatter/gather lists for packets. Also, unmapped mbufs are always sent via DMA and never as immediate data in the payload of a work request. Submitted by: gallatin (earlier version) Reviewed by: gallatin, hselasky, rrs Discussed with: np Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20616 Modified: head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c head/sys/dev/cxgbe/tom/t4_cpl_io.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Sat Jun 29 00:51:38 2019 (r349532) +++ head/sys/dev/cxgbe/t4_main.c Sat Jun 29 00:52:21 2019 (r349533) @@ -1623,7 +1623,7 @@ cxgbe_probe(device_t dev) #define T4_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | \ IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU | IFCAP_LRO | \ IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE | IFCAP_HWCSUM_IPV6 | IFCAP_HWSTATS | \ - IFCAP_HWRXTSTMP) + IFCAP_HWRXTSTMP | IFCAP_NOMAP) #define T4_CAP_ENABLE (T4_CAP) static int @@ -1986,6 +1986,8 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, cadd rxq->iq.flags &= ~IQ_RX_TIMESTAMP; } } + if (mask & IFCAP_NOMAP) + ifp->if_capenable ^= IFCAP_NOMAP; #ifdef VLAN_CAPABILITIES VLAN_CAPABILITIES(ifp); Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Sat Jun 29 00:51:38 2019 (r349532) +++ head/sys/dev/cxgbe/t4_sge.c Sat Jun 29 00:52:21 2019 (r349533) @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #endif /* Internal mbuf flags stored in PH_loc.eight[1]. */ +#define MC_NOMAP 0x01 #define MC_RAW_WR 0x02 /* @@ -2434,15 +2435,78 @@ m_advance(struct mbuf **pm, int *poffset, int len) return ((void *)p); } +static inline int +count_mbuf_ext_pgs(struct mbuf *m, int skip, vm_paddr_t *nextaddr) +{ + struct mbuf_ext_pgs *ext_pgs; + vm_paddr_t paddr; + int i, len, off, pglen, pgoff, seglen, segoff; + int nsegs = 0; + + MBUF_EXT_PGS_ASSERT(m); + ext_pgs = m->m_ext.ext_pgs; + off = mtod(m, vm_offset_t); + len = m->m_len; + off += skip; + len -= skip; + + if (ext_pgs->hdr_len != 0) { + if (off >= ext_pgs->hdr_len) { + off -= ext_pgs->hdr_len; + } else { + seglen = ext_pgs->hdr_len - off; + segoff = off; + seglen = min(seglen, len); + off = 0; + len -= seglen; + paddr = pmap_kextract( + (vm_offset_t)&ext_pgs->hdr[segoff]); + if (*nextaddr != paddr) + nsegs++; + *nextaddr = paddr + seglen; + } + } + pgoff = ext_pgs->first_pg_off; + for (i = 0; i < ext_pgs->npgs && len > 0; i++) { + pglen = mbuf_ext_pg_len(ext_pgs, i, pgoff); + if (off >= pglen) { + off -= pglen; + pgoff = 0; + continue; + } + seglen = pglen - off; + segoff = pgoff + off; + off = 0; + seglen = min(seglen, len); + len -= seglen; + paddr = ext_pgs->pa[i] + segoff; + if (*nextaddr != paddr) + nsegs++; + *nextaddr = paddr + seglen; + pgoff = 0; + }; + if (len != 0) { + seglen = min(len, ext_pgs->trail_len - off); + len -= seglen; + paddr = pmap_kextract((vm_offset_t)&ext_pgs->trail[off]); + if (*nextaddr != paddr) + nsegs++; + *nextaddr = paddr + seglen; + } + + return (nsegs); +} + + /* * Can deal with empty mbufs in the chain that have m_len = 0, but the chain * must have at least one mbuf that's not empty. It is possible for this * routine to return 0 if skip accounts for all the contents of the mbuf chain. */ static inline int -count_mbuf_nsegs(struct mbuf *m, int skip) +count_mbuf_nsegs(struct mbuf *m, int skip, uint8_t *cflags) { - vm_paddr_t lastb, next; + vm_paddr_t nextaddr, paddr; vm_offset_t va; int len, nsegs; @@ -2451,9 +2515,8 @@ count_mbuf_nsegs(struct mbuf *m, int skip) MPASS(m->m_pkthdr.len >= skip); nsegs = 0; - lastb = 0; + nextaddr = 0; for (; m; m = m->m_next) { - len = m->m_len; if (__predict_false(len == 0)) continue; @@ -2461,14 +2524,20 @@ count_mbuf_nsegs(struct mbuf *m, int skip) skip -= len; continue; } + if ((m->m_flags & M_NOMAP) != 0) { + *cflags |= MC_NOMAP; + nsegs += count_mbuf_ext_pgs(m, skip, &nextaddr); + skip = 0; + continue; + } va = mtod(m, vm_offset_t) + skip; len -= skip; skip = 0; - next = pmap_kextract(va); + paddr = pmap_kextract(va); nsegs += sglist_count((void *)(uintptr_t)va, len); - if (lastb + 1 == next) + if (paddr == nextaddr) nsegs--; - lastb = pmap_kextract(va + len - 1); + nextaddr = pmap_kextract(va + len - 1) + 1; } return (nsegs); @@ -2490,7 +2559,9 @@ parse_pkt(struct adapter *sc, struct mbuf **mp) struct tcphdr *tcp; #endif uint16_t eh_type; + uint8_t cflags; + cflags = 0; M_ASSERTPKTHDR(m0); if (__predict_false(m0->m_pkthdr.len < ETHER_HDR_LEN)) { rc = EINVAL; @@ -2506,7 +2577,7 @@ restart: */ M_ASSERTPKTHDR(m0); MPASS(m0->m_pkthdr.len > 0); - nsegs = count_mbuf_nsegs(m0, 0); + nsegs = count_mbuf_nsegs(m0, 0, &cflags); if (nsegs > (needs_tso(m0) ? TX_SGL_SEGS_TSO : TX_SGL_SEGS)) { if (defragged++ > 0 || (m = m_defrag(m0, M_NOWAIT)) == NULL) { rc = EFBIG; @@ -2516,7 +2587,8 @@ restart: goto restart; } - if (__predict_false(nsegs > 2 && m0->m_pkthdr.len <= MHLEN)) { + if (__predict_false(nsegs > 2 && m0->m_pkthdr.len <= MHLEN && + !(cflags & MC_NOMAP))) { m0 = m_pullup(m0, m0->m_pkthdr.len); if (m0 == NULL) { /* Should have left well enough alone. */ @@ -2527,7 +2599,7 @@ restart: goto restart; } set_mbuf_nsegs(m0, nsegs); - set_mbuf_cflags(m0, 0); + set_mbuf_cflags(m0, cflags); if (sc->flags & IS_VF) set_mbuf_len16(m0, txpkt_vm_len16(nsegs, needs_tso(m0))); else @@ -2616,7 +2688,9 @@ restart: /* EO WRs have the headers in the WR and not the GL. */ immhdrs = m0->m_pkthdr.l2hlen + m0->m_pkthdr.l3hlen + m0->m_pkthdr.l4hlen; - nsegs = count_mbuf_nsegs(m0, immhdrs); + cflags = 0; + nsegs = count_mbuf_nsegs(m0, immhdrs, &cflags); + MPASS(cflags == mbuf_cflags(m0)); set_mbuf_eo_nsegs(m0, nsegs); set_mbuf_eo_len16(m0, txpkt_eo_len16(nsegs, immhdrs, needs_tso(m0))); @@ -4723,7 +4797,8 @@ write_txpkt_wr(struct sge_txq *txq, struct fw_eth_tx_p ctrl = sizeof(struct cpl_tx_pkt_core); if (needs_tso(m0)) ctrl += sizeof(struct cpl_tx_pkt_lso_core); - else if (pktlen <= imm_payload(2) && available >= 2) { + else if (!(mbuf_cflags(m0) & MC_NOMAP) && pktlen <= imm_payload(2) && + available >= 2) { /* Immediate data. Recalculate len16 and set nsegs to 0. */ ctrl += pktlen; len16 = howmany(sizeof(struct fw_eth_tx_pkt_wr) + Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Sat Jun 29 00:51:38 2019 (r349532) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Sat Jun 29 00:52:21 2019 (r349533) @@ -650,6 +650,8 @@ write_tx_sgl(void *dst, struct mbuf *start, struct mbu if (IS_AIOTX_MBUF(m)) rc = sglist_append_vmpages(&sg, aiotx_mbuf_pages(m), aiotx_mbuf_pgoff(m), m->m_len); + else if (m->m_flags & M_NOMAP) + rc = sglist_append_mb_ext_pgs(&sg, m); else rc = sglist_append(&sg, mtod(m, void *), m->m_len); if (__predict_false(rc != 0)) @@ -771,6 +773,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep if (IS_AIOTX_MBUF(m)) n = sglist_count_vmpages(aiotx_mbuf_pages(m), aiotx_mbuf_pgoff(m), m->m_len); + else if (m->m_flags & M_NOMAP) + n = sglist_count_mb_ext_pgs(m); else n = sglist_count(mtod(m, void *), m->m_len); From owner-svn-src-head@freebsd.org Sat Jun 29 00:53:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BEEF15D0812; Sat, 29 Jun 2019 00:53:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C256490840; Sat, 29 Jun 2019 00:53:07 +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 AB3CF6E7F; Sat, 29 Jun 2019 00:53:07 +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 x5T0r71C038660; Sat, 29 Jun 2019 00:53:07 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5T0r72q038659; Sat, 29 Jun 2019 00:53:07 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201906290053.x5T0r72q038659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 29 Jun 2019 00:53:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349534 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 349534 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C256490840 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.981,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2019 00:53:08 -0000 Author: jhb Date: Sat Jun 29 00:53:07 2019 New Revision: 349534 URL: https://svnweb.freebsd.org/changeset/base/349534 Log: Add support for IFCAP_NOMAP to mlx5(4). Since mlx5 uses bus_dma, this only required adding the capability flag. Submitted by: gallatin Reviewed by: gallatin, hselasky, rrs Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20616 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 Sat Jun 29 00:52:21 2019 (r349533) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Sat Jun 29 00:53:07 2019 (r349534) @@ -3281,6 +3281,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t "tso6 disabled due to -txcsum6.\n"); } } + if (mask & IFCAP_NOMAP) + ifp->if_capenable ^= IFCAP_NOMAP; if (mask & IFCAP_RXCSUM) ifp->if_capenable ^= IFCAP_RXCSUM; if (mask & IFCAP_RXCSUM_IPV6) @@ -4147,6 +4149,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) ifp->if_capabilities |= IFCAP_LRO; ifp->if_capabilities |= IFCAP_TSO | IFCAP_VLAN_HWTSO; ifp->if_capabilities |= IFCAP_HWSTATS | IFCAP_HWRXTSTMP; + ifp->if_capabilities |= IFCAP_NOMAP; ifp->if_capabilities |= IFCAP_TXRTLMT; ifp->if_snd_tag_alloc = mlx5e_snd_tag_alloc; ifp->if_snd_tag_free = mlx5e_snd_tag_free; From owner-svn-src-head@freebsd.org Sat Jun 29 10:58:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2149215D9CAA; Sat, 29 Jun 2019 10:58:32 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AB171717CE; Sat, 29 Jun 2019 10:58:31 +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 842F8D5B9; Sat, 29 Jun 2019 10:58:31 +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 x5TAwVSc057331; Sat, 29 Jun 2019 10:58:31 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5TAwVIr057330; Sat, 29 Jun 2019 10:58:31 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201906291058.x5TAwVIr057330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sat, 29 Jun 2019 10:58:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349538 - head/lib/libarchive/tests X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/lib/libarchive/tests X-SVN-Commit-Revision: 349538 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AB171717CE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2019 10:58:32 -0000 Author: lwhsu Date: Sat Jun 29 10:58:31 2019 New Revision: 349538 URL: https://svnweb.freebsd.org/changeset/base/349538 Log: Install missing test data file MFC with: r349527 Sponsored by: The FreeBSD Foundation Modified: head/lib/libarchive/tests/Makefile Modified: head/lib/libarchive/tests/Makefile ============================================================================== --- head/lib/libarchive/tests/Makefile Sat Jun 29 09:14:53 2019 (r349537) +++ head/lib/libarchive/tests/Makefile Sat Jun 29 10:58:31 2019 (r349538) @@ -512,6 +512,7 @@ ${PACKAGE}FILES+= test_read_format_rar_subblock.rar.uu ${PACKAGE}FILES+= test_read_format_rar_unicode.rar.uu ${PACKAGE}FILES+= test_read_format_rar_windows.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_arm.rar.uu +${PACKAGE}FILES+= test_read_format_rar5_arm_filter_on_window_boundary.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_blake2.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_compressed.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_different_window_size.rar.uu From owner-svn-src-head@freebsd.org Sat Jun 29 12:19:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E65315DB95D; Sat, 29 Jun 2019 12:19:58 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 23A3E736FD; Sat, 29 Jun 2019 12:19:58 +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 E8C40E327; Sat, 29 Jun 2019 12:19:57 +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 x5TCJvCo098992; Sat, 29 Jun 2019 12:19:57 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5TCJvgp098990; Sat, 29 Jun 2019 12:19:57 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201906291219.x5TCJvgp098990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sat, 29 Jun 2019 12:19:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349539 - head/tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/tests/sys/netpfil/pf X-SVN-Commit-Revision: 349539 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 23A3E736FD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.965,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2019 12:19:58 -0000 Author: lwhsu Date: Sat Jun 29 12:19:57 2019 New Revision: 349539 URL: https://svnweb.freebsd.org/changeset/base/349539 Log: Skip sys.netpfil.pf.names.names and sys.netpfil.pf.synproxy.synproxy temporarily because kernel panics when flushing epair queue. PR: 238870 Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/netpfil/pf/names.sh head/tests/sys/netpfil/pf/synproxy.sh Modified: head/tests/sys/netpfil/pf/names.sh ============================================================================== --- head/tests/sys/netpfil/pf/names.sh Sat Jun 29 10:58:31 2019 (r349538) +++ head/tests/sys/netpfil/pf/names.sh Sat Jun 29 12:19:57 2019 (r349539) @@ -11,6 +11,7 @@ names_head() names_body() { + atf_skip "Kernel panics when flushing epair queue (bug238870)" pft_init epair=$(vnet_mkepair) Modified: head/tests/sys/netpfil/pf/synproxy.sh ============================================================================== --- head/tests/sys/netpfil/pf/synproxy.sh Sat Jun 29 10:58:31 2019 (r349538) +++ head/tests/sys/netpfil/pf/synproxy.sh Sat Jun 29 12:19:57 2019 (r349539) @@ -11,6 +11,7 @@ synproxy_head() synproxy_body() { + atf_skip "Kernel panics when flushing epair queue (bug238870)" pft_init epair=$(vnet_mkepair) From owner-svn-src-head@freebsd.org Sat Jun 29 14:55:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8C0215DDFBD; Sat, 29 Jun 2019 14:55:54 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 55046801B5; Sat, 29 Jun 2019 14:55:54 +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 2D051FE69; Sat, 29 Jun 2019 14:55:54 +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 x5TEtrRY082095; Sat, 29 Jun 2019 14:55:53 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5TEtrPb082094; Sat, 29 Jun 2019 14:55:53 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201906291455.x5TEtrPb082094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sat, 29 Jun 2019 14:55:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349543 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 349543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 55046801B5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2019 14:55:54 -0000 Author: lwhsu Date: Sat Jun 29 14:55:53 2019 New Revision: 349543 URL: https://svnweb.freebsd.org/changeset/base/349543 Log: Fix VOP_PUTPAGES(9) in regards to the use of VM_PAGER_CLUSTER_OK Submitted by: Ka Ho Ng Reviewed by: mckusick MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20695 Modified: head/share/man/man9/VOP_GETPAGES.9 Modified: head/share/man/man9/VOP_GETPAGES.9 ============================================================================== --- head/share/man/man9/VOP_GETPAGES.9 Sat Jun 29 13:30:05 2019 (r349542) +++ head/share/man/man9/VOP_GETPAGES.9 Sat Jun 29 14:55:53 2019 (r349543) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 7, 2017 +.Dd June 29, 2019 .Dt VOP_GETPAGES 9 .Os .Sh NAME @@ -105,7 +105,7 @@ This could occur via a call to which puts such pages onto the head of the inactive queue. If .Dv VM_PAGER_CLUSTER_OK -is set, writes may be performed asynchronously, so that related writes +is set, writes may be delayed, so that related writes can be coalesced for efficiency, e.g., using the clustering mechanism of the buffer cache. .It Fa rtvals From owner-svn-src-head@freebsd.org Sat Jun 29 16:05:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FF3D15DF7BA; Sat, 29 Jun 2019 16:05:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 11F1F82A8C; Sat, 29 Jun 2019 16:05:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC1A618A5A; Sat, 29 Jun 2019 16:05:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5TG5qDh019556; Sat, 29 Jun 2019 16:05:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5TG5qBA019555; Sat, 29 Jun 2019 16:05:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201906291605.x5TG5qBA019555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 29 Jun 2019 16:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349546 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 11F1F82A8C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2019 16:05:53 -0000 Author: markj Date: Sat Jun 29 16:05:52 2019 New Revision: 349546 URL: https://svnweb.freebsd.org/changeset/base/349546 Log: Fix mutual exclusion in pipe_direct_write(). We use PIPE_DIRECTW as a semaphore for direct writes to a pipe, where the reader copies data directly from pages mapped into the writer. However, when a reader finishes such a copy, it previously cleared PIPE_DIRECTW, allowing multiple writers to race and corrupt the state used to track wired pages belonging to the writer. Fix this by having the writer clear PIPE_DIRECTW and instead use the count of unread bytes to determine whether a write is finished. Reported by: syzbot+21811cc0a89b2a87a9e7@syzkaller.appspotmail.com Reviewed by: kib, mjg Tested by: pho MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20784 Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Sat Jun 29 15:28:36 2019 (r349545) +++ head/sys/kern/sys_pipe.c Sat Jun 29 16:05:52 2019 (r349546) @@ -724,7 +724,7 @@ pipe_read(struct file *fp, struct uio *uio, struct ucr rpipe->pipe_map.pos += size; rpipe->pipe_map.cnt -= size; if (rpipe->pipe_map.cnt == 0) { - rpipe->pipe_state &= ~(PIPE_DIRECTW|PIPE_WANTW); + rpipe->pipe_state &= ~PIPE_WANTW; wakeup(rpipe); } #endif @@ -855,13 +855,17 @@ pipe_build_write_buffer(struct pipe *wpipe, struct uio } /* - * unmap and unwire the process buffer + * Unwire the process buffer. */ static void pipe_destroy_write_buffer(struct pipe *wpipe) { PIPE_LOCK_ASSERT(wpipe, MA_OWNED); + KASSERT((wpipe->pipe_state & PIPE_DIRECTW) != 0, + ("%s: PIPE_DIRECTW not set on %p", __func__, wpipe)); + + wpipe->pipe_state &= ~PIPE_DIRECTW; vm_page_unhold_pages(wpipe->pipe_map.ms, wpipe->pipe_map.npages); wpipe->pipe_map.npages = 0; } @@ -880,13 +884,15 @@ pipe_clone_write_buffer(struct pipe *wpipe) int pos; PIPE_LOCK_ASSERT(wpipe, MA_OWNED); + KASSERT((wpipe->pipe_state & PIPE_DIRECTW) != 0, + ("%s: PIPE_DIRECTW not set on %p", __func__, wpipe)); + size = wpipe->pipe_map.cnt; pos = wpipe->pipe_map.pos; wpipe->pipe_buffer.in = size; wpipe->pipe_buffer.out = 0; wpipe->pipe_buffer.cnt = size; - wpipe->pipe_state &= ~PIPE_DIRECTW; PIPE_UNLOCK(wpipe); iov.iov_base = wpipe->pipe_buffer.buffer; @@ -925,7 +931,7 @@ retry: pipeunlock(wpipe); goto error1; } - while (wpipe->pipe_state & PIPE_DIRECTW) { + if (wpipe->pipe_state & PIPE_DIRECTW) { if (wpipe->pipe_state & PIPE_WANTR) { wpipe->pipe_state &= ~PIPE_WANTR; wakeup(wpipe); @@ -968,8 +974,7 @@ retry: goto error1; } - error = 0; - while (!error && (wpipe->pipe_state & PIPE_DIRECTW)) { + while (wpipe->pipe_map.cnt != 0) { if (wpipe->pipe_state & PIPE_EOF) { pipe_destroy_write_buffer(wpipe); pipeselwakeup(wpipe); @@ -987,20 +992,19 @@ retry: error = msleep(wpipe, PIPE_MTX(wpipe), PRIBIO | PCATCH, "pipdwt", 0); pipelock(wpipe, 0); + if (error != 0) + break; } if (wpipe->pipe_state & PIPE_EOF) error = EPIPE; - if (wpipe->pipe_state & PIPE_DIRECTW) { - /* - * this bit of trickery substitutes a kernel buffer for - * the process that might be going away. - */ + if (error == EINTR || error == ERESTART) pipe_clone_write_buffer(wpipe); - } else { + else pipe_destroy_write_buffer(wpipe); - } pipeunlock(wpipe); + KASSERT((wpipe->pipe_state & PIPE_DIRECTW) == 0, + ("pipe %p leaked PIPE_DIRECTW", wpipe)); return (error); error1: From owner-svn-src-head@freebsd.org Sat Jun 29 16:11:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8409015DFA4A; Sat, 29 Jun 2019 16:11:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E741882EE7; Sat, 29 Jun 2019 16:11:09 +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 C32A718A95; Sat, 29 Jun 2019 16:11:09 +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 x5TGB9Eg022249; Sat, 29 Jun 2019 16:11:09 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5TGB908022248; Sat, 29 Jun 2019 16:11:09 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201906291611.x5TGB908022248@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 29 Jun 2019 16:11:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349547 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E741882EE7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2019 16:11:10 -0000 Author: markj Date: Sat Jun 29 16:11:09 2019 New Revision: 349547 URL: https://svnweb.freebsd.org/changeset/base/349547 Log: Use a consistent snapshot of the fd's rights in fget_mmap(). fget_mmap() translates rights on the descriptor to a VM protection mask. It was doing so without holding any locks on the descriptor table, so a writer could simultaneously be modifying those rights. Such a situation would be detected using a sequence counter, but not before an inconsistency could trigger assertion failures in the capability code. Fix the problem by copying the fd's rights to a structure on the stack, and perform the translation only once we know that that snapshot is consistent. Reported by: syzbot+ae359438769fda1840f8@syzkaller.appspotmail.com Reviewed by: brooks, mjg MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20800 Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sat Jun 29 16:05:52 2019 (r349546) +++ head/sys/kern/kern_descrip.c Sat Jun 29 16:11:09 2019 (r349547) @@ -2761,6 +2761,7 @@ fget_mmap(struct thread *td, int fd, cap_rights_t *rig if (maxprotp != NULL) *maxprotp = VM_PROT_ALL; #else + cap_rights_t fdrights; struct filedesc *fdp = td->td_proc->p_fd; seqc_t seq; @@ -2769,15 +2770,18 @@ fget_mmap(struct thread *td, int fd, cap_rights_t *rig error = _fget(td, fd, fpp, 0, rightsp, &seq); if (error != 0) return (error); - /* - * If requested, convert capability rights to access flags. - */ if (maxprotp != NULL) - *maxprotp = cap_rights_to_vmprot(cap_rights(fdp, fd)); + fdrights = *cap_rights(fdp, fd); if (!fd_modified(fdp, fd, seq)) break; fdrop(*fpp, td); } + + /* + * If requested, convert capability rights to access flags. + */ + if (maxprotp != NULL) + *maxprotp = cap_rights_to_vmprot(&fdrights); #endif return (error); } From owner-svn-src-head@freebsd.org Sat Jun 29 17:01:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BE3315E0505; Sat, 29 Jun 2019 17:01:57 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C353784259; Sat, 29 Jun 2019 17:01:56 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E45D19337; Sat, 29 Jun 2019 17:01:56 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5TH1uN3051058; Sat, 29 Jun 2019 17:01:56 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5TH1uh8051057; Sat, 29 Jun 2019 17:01:56 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201906291701.x5TH1uh8051057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Sat, 29 Jun 2019 17:01:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349548 - head X-SVN-Group: head X-SVN-Commit-Author: tijl X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 349548 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C353784259 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2019 17:01:57 -0000 Author: tijl Date: Sat Jun 29 17:01:56 2019 New Revision: 349548 URL: https://svnweb.freebsd.org/changeset/base/349548 Log: Build lib32 libl. The library is built from usr.bin/lex/lib. It would be better to move this directory to lib/libl, but this requires more extensive changes to Makefile.inc1. This simple fix can be MFCed quickly. PR: 238874 Reviewed by: imp MFC after: 3 days Modified: head/Makefile.libcompat Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Sat Jun 29 16:11:09 2019 (r349547) +++ head/Makefile.libcompat Sat Jun 29 17:01:56 2019 (r349548) @@ -136,6 +136,7 @@ LIBCOMPATIMAKE+= ${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR= _LC_LIBDIRS.yes= lib _LC_LIBDIRS.yes+= gnu/lib +_LC_LIBDIRS.yes+= usr.bin/lex/lib _LC_LIBDIRS.${MK_CDDL:tl}+= cddl/lib _LC_LIBDIRS.${MK_CRYPT:tl}+= secure/lib _LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib From owner-svn-src-head@freebsd.org Sat Jun 29 18:41:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1528D15E1EBD; Sat, 29 Jun 2019 18:41:43 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B668F867FB; Sat, 29 Jun 2019 18:41:42 +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 A48041A4EF; Sat, 29 Jun 2019 18:41:42 +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 x5TIfgO7099798; Sat, 29 Jun 2019 18:41:42 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5TIfep6099788; Sat, 29 Jun 2019 18:41:40 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201906291841.x5TIfep6099788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 29 Jun 2019 18:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349549 - in head: contrib/less usr.bin/less X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in head: contrib/less usr.bin/less X-SVN-Commit-Revision: 349549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B668F867FB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2019 18:41:43 -0000 Author: delphij Date: Sat Jun 29 18:41:40 2019 New Revision: 349549 URL: https://svnweb.freebsd.org/changeset/base/349549 Log: MFV r349535: less v551. MFC after: 2 weeks Relnotes: yes Modified: head/contrib/less/LICENSE head/contrib/less/NEWS head/contrib/less/README head/contrib/less/brac.c head/contrib/less/ch.c head/contrib/less/charset.c head/contrib/less/charset.h head/contrib/less/cmd.h head/contrib/less/cmdbuf.c head/contrib/less/command.c head/contrib/less/compose.uni head/contrib/less/cvt.c head/contrib/less/decode.c head/contrib/less/edit.c head/contrib/less/filename.c head/contrib/less/fmt.uni head/contrib/less/forwback.c head/contrib/less/funcs.h head/contrib/less/help.c head/contrib/less/ifile.c head/contrib/less/input.c head/contrib/less/jump.c head/contrib/less/less.h head/contrib/less/less.hlp head/contrib/less/less.nro head/contrib/less/lessecho.c head/contrib/less/lessecho.nro head/contrib/less/lesskey.c head/contrib/less/lesskey.h head/contrib/less/lesskey.nro head/contrib/less/lglob.h head/contrib/less/line.c head/contrib/less/linenum.c head/contrib/less/lsystem.c head/contrib/less/main.c head/contrib/less/mark.c head/contrib/less/mkutable head/contrib/less/optfunc.c head/contrib/less/option.c head/contrib/less/option.h head/contrib/less/opttbl.c head/contrib/less/os.c head/contrib/less/output.c head/contrib/less/pattern.c head/contrib/less/pattern.h head/contrib/less/pckeys.h head/contrib/less/position.c head/contrib/less/position.h head/contrib/less/prompt.c head/contrib/less/screen.c head/contrib/less/scrsize.c head/contrib/less/search.c head/contrib/less/signal.c head/contrib/less/tags.c head/contrib/less/ttyin.c head/contrib/less/ubin.uni head/contrib/less/version.c head/contrib/less/wide.uni head/usr.bin/less/defines.h Directory Properties: head/contrib/less/ (props changed) Modified: head/contrib/less/LICENSE ============================================================================== --- head/contrib/less/LICENSE Sat Jun 29 17:01:56 2019 (r349548) +++ head/contrib/less/LICENSE Sat Jun 29 18:41:40 2019 (r349549) @@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2016 Mark Nudelman +Copyright (C) 1984-2018 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: head/contrib/less/NEWS ============================================================================== --- head/contrib/less/NEWS Sat Jun 29 17:01:56 2019 (r349548) +++ head/contrib/less/NEWS Sat Jun 29 18:41:40 2019 (r349549) @@ -11,6 +11,38 @@ ====================================================================== + Major changes between "less" versions 530 and 551 + +* Add --mouse option. + +* Add --wheel-lines option. + +* Add --no-histdups option. + +* Add --save-marks option. + +* Support PCRE2 regular expression library. + +* Redraw screen on SIGWINCH even if screen size doesn't change. + +* Shell-escape filenames in history so they can be used again. + +* Ring bell if user enters invalid long option name. + +* Use PCRE_UTF8 flag for pcre regular expressions when in UTF-8 mode. + +* Windows: use wide-char string to set console title. + +* Don't count lines in initial screen if using -X with -F. + +* Support mingw build system. + +* Fix bug in v command on empty file. + +* Fix bug in v command when filename contains shell metacharacters. + +====================================================================== + Major changes between "less" versions 487 and 530 * Don't output terminal init sequence if using -F and file fits on one screen. Modified: head/contrib/less/README ============================================================================== --- head/contrib/less/README Sat Jun 29 17:01:56 2019 (r349548) +++ head/contrib/less/README Sat Jun 29 18:41:40 2019 (r349549) @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 530 + Less, version 551 - This is the distribution of less, version 530, released 05 Dec 2017. + This is the distribution of less, version 551, released 11 Jun 2019. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -56,6 +56,7 @@ INSTALLATION (Unix systems only): finds a regular expression library automatically. Other values are: gnu Use the GNU regex library. pcre Use the PCRE library. + pcre2 Use the PCRE2 library. posix Use the POSIX-compatible regcomp. regcmp Use the regcmp library. re_comp Use the re_comp library. @@ -63,6 +64,7 @@ INSTALLATION (Unix systems only): regcomp-local Use Henry Spencer's V8-compatible regcomp (source is supplied with less). none No regular expressions, only simple string matching. + --with-secure Builds a "secure" version of less, with some features disabled to prevent users from viewing other files, accessing shell Modified: head/contrib/less/brac.c ============================================================================== --- head/contrib/less/brac.c Sat Jun 29 17:01:56 2019 (r349548) +++ head/contrib/less/brac.c Sat Jun 29 18:41:40 2019 (r349549) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: head/contrib/less/ch.c ============================================================================== --- head/contrib/less/ch.c Sat Jun 29 17:01:56 2019 (r349548) +++ head/contrib/less/ch.c Sat Jun 29 18:41:40 2019 (r349549) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -144,7 +144,7 @@ static int ch_addbuf(); * Get the character pointed to by the read pointer. */ int -ch_get() +ch_get(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -392,7 +392,7 @@ ch_ungetchar(c) * If we haven't read all of standard input into it, do that now. */ public void -end_logfile() +end_logfile(VOID_PARAM) { static int tried = FALSE; @@ -417,7 +417,7 @@ end_logfile() * Write all the existing buffered data to the log file. */ public void -sync_logfile() +sync_logfile(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -515,7 +515,7 @@ ch_seek(pos) * Seek to the end of the file. */ public int -ch_end_seek() +ch_end_seek(VOID_PARAM) { POSITION len; @@ -542,7 +542,7 @@ ch_end_seek() * Seek to the last position in the file that is currently buffered. */ public int -ch_end_buffer_seek() +ch_end_buffer_seek(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -570,7 +570,7 @@ ch_end_buffer_seek() * beginning of the pipe is no longer buffered. */ public int -ch_beg_seek() +ch_beg_seek(VOID_PARAM) { struct bufnode *bn; struct bufnode *firstbn; @@ -602,7 +602,7 @@ ch_beg_seek() * Return the length of the file, if known. */ public POSITION -ch_length() +ch_length(VOID_PARAM) { if (thisfile == NULL) return (NULL_POSITION); @@ -619,7 +619,7 @@ ch_length() * Return the current position in the file. */ public POSITION -ch_tell() +ch_tell(VOID_PARAM) { if (thisfile == NULL) return (NULL_POSITION); @@ -630,7 +630,7 @@ ch_tell() * Get the current char and post-increment the read pointer. */ public int -ch_forw_get() +ch_forw_get(VOID_PARAM) { int c; @@ -653,7 +653,7 @@ ch_forw_get() * Pre-decrement the read pointer and get the new current char. */ public int -ch_back_get() +ch_back_get(VOID_PARAM) { if (thisfile == NULL) return (EOI); @@ -693,7 +693,7 @@ ch_setbufspace(bufspace) * Flush (discard) any saved file state, including buffer contents. */ public void -ch_flush() +ch_flush(VOID_PARAM) { struct bufnode *bn; @@ -760,7 +760,7 @@ ch_flush() * The buffer is added to the tail of the buffer chain. */ static int -ch_addbuf() +ch_addbuf(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -785,7 +785,7 @@ ch_addbuf() * */ static void -init_hashtbl() +init_hashtbl(VOID_PARAM) { int h; @@ -800,7 +800,7 @@ init_hashtbl() * Delete all buffers for this file. */ static void -ch_delbufs() +ch_delbufs(VOID_PARAM) { struct bufnode *bn; @@ -840,7 +840,7 @@ seekable(f) * This is used after an ignore_eof read, during which the EOF may change. */ public void -ch_set_eof() +ch_set_eof(VOID_PARAM) { ch_fsize = ch_fpos; } @@ -890,7 +890,7 @@ ch_init(f, flags) * Close a filestate. */ public void -ch_close() +ch_close(VOID_PARAM) { int keepstate = FALSE; @@ -933,7 +933,7 @@ ch_close() * Return ch_flags for the current file. */ public int -ch_getflags() +ch_getflags(VOID_PARAM) { if (thisfile == NULL) return (0); Modified: head/contrib/less/charset.c ============================================================================== --- head/contrib/less/charset.c Sat Jun 29 17:01:56 2019 (r349548) +++ head/contrib/less/charset.c Sat Jun 29 18:41:40 2019 (r349549) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -245,7 +245,7 @@ icharset(name, no_error) * Define a charset, given a locale name. */ static void -ilocale() +ilocale(VOID_PARAM) { int c; @@ -315,7 +315,7 @@ setfmt(s, fmtvarptr, attrptr, default_fmt) * */ static void -set_charset() +set_charset(VOID_PARAM) { char *s; @@ -338,7 +338,7 @@ set_charset() * LESSCHARSET is not defined: try LESSCHARDEF. */ s = lgetenv("LESSCHARDEF"); - if (s != NULL && *s != '\0') + if (!isnullenv(s)) { ichardef(s); return; @@ -395,7 +395,7 @@ set_charset() * Initialize charset data structures. */ public void -init_charset() +init_charset(VOID_PARAM) { char *s; Modified: head/contrib/less/charset.h ============================================================================== --- head/contrib/less/charset.h Sat Jun 29 17:01:56 2019 (r349548) +++ head/contrib/less/charset.h Sat Jun 29 18:41:40 2019 (r349549) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: head/contrib/less/cmd.h ============================================================================== --- head/contrib/less/cmd.h Sat Jun 29 17:01:56 2019 (r349548) +++ head/contrib/less/cmd.h Sat Jun 29 18:41:40 2019 (r349549) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -71,6 +71,13 @@ #define A_RRSHIFT 59 #define A_CLRMARK 62 #define A_SETMARKBOT 63 +#define A_X11MOUSE_IN 64 +#define A_X11MOUSE_IGNORE 65 +#define A_F_MOUSE 66 +#define A_B_MOUSE 67 +/* Note "X116" refers to extended (1006) X11 mouse reporting. */ +#define A_X116MOUSE_IN 68 +#define A_X116MOUSE_IGNORE 69 #define A_INVALID 100 #define A_NOACTION 101 Modified: head/contrib/less/cmdbuf.c ============================================================================== --- head/contrib/less/cmdbuf.c Sat Jun 29 17:01:56 2019 (r349548) +++ head/contrib/less/cmdbuf.c Sat Jun 29 18:41:40 2019 (r349549) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -22,6 +22,8 @@ extern int sc_width; extern int utf_mode; +extern int no_hist_dups; +extern int marks_modified; static char cmdbuf[CMDBUF_SIZE]; /* Buffer for holding a multi-char command */ static int cmd_col; /* Current column of the cursor */ @@ -58,6 +60,7 @@ public char closequote = '"'; #define HISTFILE_FIRST_LINE ".less-history-file:" #define HISTFILE_SEARCH_SECTION ".search" #define HISTFILE_SHELL_SECTION ".shell" +#define HISTFILE_MARK_SECTION ".mark" /* * A mlist structure represents a command history. @@ -114,7 +117,7 @@ static int cmd_mbc_buf_index; * Reset command buffer (to empty). */ public void -cmd_reset() +cmd_reset(VOID_PARAM) { cp = cmdbuf; *cp = '\0'; @@ -129,7 +132,7 @@ cmd_reset() * Clear command line. */ public void -clear_cmd() +clear_cmd(VOID_PARAM) { cmd_col = prompt_col = 0; cmd_mbc_buf_len = 0; @@ -169,7 +172,7 @@ cmd_putstr(s) * How many characters are in the command buffer? */ public int -len_cmdbuf() +len_cmdbuf(VOID_PARAM) { char *s = cmdbuf; char *endline = s + strlen(s); @@ -302,7 +305,7 @@ cmd_repaint(old_cp) * and set cp to the corresponding char in cmdbuf. */ static void -cmd_home() +cmd_home(VOID_PARAM) { while (cmd_col > prompt_col) { @@ -321,7 +324,7 @@ cmd_home() * Shift the cmdbuf display left a half-screen. */ static void -cmd_lshift() +cmd_lshift(VOID_PARAM) { char *s; char *save_cp; @@ -359,7 +362,7 @@ cmd_lshift() * Shift the cmdbuf display right a half-screen. */ static void -cmd_rshift() +cmd_rshift(VOID_PARAM) { char *s; char *save_cp; @@ -389,7 +392,7 @@ cmd_rshift() * Move cursor right one character. */ static int -cmd_right() +cmd_right(VOID_PARAM) { char *pr; char *ncp; @@ -424,7 +427,7 @@ cmd_right() * Move cursor left one character. */ static int -cmd_left() +cmd_left(VOID_PARAM) { char *ncp; int width = 0; @@ -492,7 +495,7 @@ cmd_ichar(cs, clen) * Delete the char to the left of the cursor. */ static int -cmd_erase() +cmd_erase(VOID_PARAM) { char *s; int clen; @@ -541,7 +544,7 @@ cmd_erase() * Delete the char under the cursor. */ static int -cmd_delete() +cmd_delete(VOID_PARAM) { if (*cp == '\0') { @@ -560,7 +563,7 @@ cmd_delete() * Delete the "word" to the left of the cursor. */ static int -cmd_werase() +cmd_werase(VOID_PARAM) { if (cp > cmdbuf && cp[-1] == ' ') { @@ -586,7 +589,7 @@ cmd_werase() * Delete the "word" under the cursor. */ static int -cmd_wdelete() +cmd_wdelete(VOID_PARAM) { if (*cp == ' ') { @@ -612,7 +615,7 @@ cmd_wdelete() * Delete all chars in the command buffer. */ static int -cmd_kill() +cmd_kill(VOID_PARAM) { if (cmdbuf[0] == '\0') { @@ -702,6 +705,7 @@ cmd_updown(action) s = ml->string; if (s == NULL) s = ""; + cmd_offset = 0; cmd_home(); clear_eol(); strcpy(cmdbuf, s); @@ -719,6 +723,31 @@ cmd_updown(action) #endif /* + * + */ + static void +ml_link(mlist, ml) + struct mlist *mlist; + struct mlist *ml; +{ + ml->next = mlist; + ml->prev = mlist->prev; + mlist->prev->next = ml; + mlist->prev = ml; +} + +/* + * + */ + static void +ml_unlink(ml) + struct mlist *ml; +{ + ml->prev->next = ml->next; + ml->next->prev = ml->prev; +} + +/* * Add a string to an mlist. */ public void @@ -736,6 +765,21 @@ cmd_addhist(mlist, cmd, modified) if (strlen(cmd) == 0) return; + if (no_hist_dups) + { + struct mlist *next = NULL; + for (ml = mlist->next; ml->string != NULL; ml = next) + { + next = ml->next; + if (strcmp(ml->string, cmd) == 0) + { + ml_unlink(ml); + free(ml->string); + free(ml); + } + } + } + /* * Save the command unless it's a duplicate of the * last command in the history. @@ -750,10 +794,7 @@ cmd_addhist(mlist, cmd, modified) ml = (struct mlist *) ecalloc(1, sizeof(struct mlist)); ml->string = save(cmd); ml->modified = modified; - ml->next = mlist; - ml->prev = mlist->prev; - mlist->prev->next = ml; - mlist->prev = ml; + ml_link(mlist, ml); } /* * Point to the cmd just after the just-accepted command. @@ -768,13 +809,13 @@ cmd_addhist(mlist, cmd, modified) * Add it to the currently selected history list. */ public void -cmd_accept() +cmd_accept(VOID_PARAM) { #if CMD_HISTORY /* * Nothing to do if there is no currently selected history list. */ - if (curr_mlist == NULL) + if (curr_mlist == NULL || curr_mlist == ml_examine) return; cmd_addhist(curr_mlist, cmdbuf, 1); curr_mlist->modified = 1; @@ -799,7 +840,7 @@ cmd_edit(c) #if TAB_COMPLETE_FILENAME #define not_in_completion() in_completion = 0 #else -#define not_in_completion() +#define not_in_completion(VOID_PARAM) #endif /* @@ -934,7 +975,7 @@ cmd_istr(str) * cursor at the end of the word. */ static char * -delimit_word() +delimit_word(VOID_PARAM) { char *word; #if SPACES_IN_FILENAMES @@ -1021,7 +1062,7 @@ delimit_word() * which start with that word, and set tk_text to that list. */ static void -init_compl() +init_compl(VOID_PARAM) { char *word; char c; @@ -1148,9 +1189,9 @@ cmd_complete(action) tk_trial = next_compl(action, tk_trial); } - /* - * Remove the original word, or the previous trial completion. - */ + /* + * Remove the original word, or the previous trial completion. + */ while (cp > tk_ipoint) (void) cmd_erase(); @@ -1323,7 +1364,7 @@ cmd_int(frac) * Return a pointer to the command buffer. */ public char * -get_cmdbuf() +get_cmdbuf(VOID_PARAM) { return (cmdbuf); } @@ -1333,7 +1374,7 @@ get_cmdbuf() * Return the last (most recent) string in the current command history. */ public char * -cmd_lastpattern() +cmd_lastpattern(VOID_PARAM) { if (curr_mlist == NULL) return (NULL); @@ -1358,7 +1399,7 @@ mlist_size(ml) * Get the name of the history file. */ static char * -histfile_name() +histfile_name(VOID_PARAM) { char *home; char *name; @@ -1366,7 +1407,7 @@ histfile_name() /* See if filename is explicitly specified by $LESSHISTFILE. */ name = lgetenv("LESSHISTFILE"); - if (name != NULL && *name != '\0') + if (!isnullenv(name)) { if (strcmp(name, "-") == 0 || strcmp(name, "/dev/null") == 0) /* $LESSHISTFILE == "-" means don't use a history file. */ @@ -1380,11 +1421,11 @@ histfile_name() /* Otherwise, file is in $HOME. */ home = lgetenv("HOME"); - if (home == NULL || *home == '\0') + if (isnullenv(home)) { #if OS2 home = lgetenv("INIT"); - if (home == NULL || *home == '\0') + if (isnullenv(home)) #endif return (NULL); } @@ -1447,6 +1488,9 @@ read_cmdhist2(action, uparam, skip_search, skip_shell) ml = NULL; skip = NULL; #endif + } else if (strcmp(line, HISTFILE_MARK_SECTION) == 0) + { + ml = NULL; } else if (*line == '"') { if (ml != NULL) @@ -1456,6 +1500,9 @@ read_cmdhist2(action, uparam, skip_search, skip_shell) else (*action)(uparam, ml, line+1); } + } else if (*line == 'm') + { + (*action)(uparam, NULL, line); } } fclose(f); @@ -1475,9 +1522,10 @@ read_cmdhist(action, uparam, skip_search, skip_shell) static void addhist_init(void *uparam, struct mlist *ml, char *string) { - if (ml == NULL || string == NULL) - return; - cmd_addhist(ml, string, 0); + if (ml != NULL) + cmd_addhist(ml, string, 0); + else if (string != NULL) + restore_mark(string); } #endif /* CMD_HISTORY */ @@ -1485,7 +1533,7 @@ addhist_init(void *uparam, struct mlist *ml, char *str * Initialize history from a .lesshist file. */ public void -init_cmdhist() +init_cmdhist(VOID_PARAM) { #if CMD_HISTORY read_cmdhist(&addhist_init, NULL, 0, 0); @@ -1558,7 +1606,7 @@ copy_hist(void *uparam, struct mlist *ml, char *string { struct save_ctx *ctx = (struct save_ctx *) uparam; - if (ml != ctx->mlist) { + if (ml != NULL && ml != ctx->mlist) { /* We're changing mlists. */ if (ctx->mlist) /* Append any new entries to the end of the current mlist. */ @@ -1567,13 +1615,9 @@ copy_hist(void *uparam, struct mlist *ml, char *string ctx->mlist = ml; write_mlist_header(ctx->mlist, ctx->fout); } - if (string != NULL) + + if (string == NULL) /* End of file */ { - /* Copy the entry. */ - fprintf(ctx->fout, "\"%s\n", string); - } - if (ml == NULL) /* End of file */ - { /* Write any sections that were not in the original file. */ if (mlist_search.modified) { @@ -1587,7 +1631,12 @@ copy_hist(void *uparam, struct mlist *ml, char *string write_mlist(&mlist_shell, ctx->fout); } #endif + } else if (ml != NULL) + { + /* Copy mlist entry. */ + fprintf(ctx->fout, "\"%s\n", string); } + /* Skip marks */ } #endif /* CMD_HISTORY */ @@ -1616,7 +1665,7 @@ make_file_private(f) * Does the history file need to be updated? */ static int -histfile_modified() +histfile_modified(VOID_PARAM) { if (mlist_search.modified) return 1; @@ -1624,6 +1673,10 @@ histfile_modified() if (mlist_shell.modified) return 1; #endif +#if CMD_HISTORY + if (marks_modified) + return 1; +#endif return 0; } @@ -1631,7 +1684,7 @@ histfile_modified() * Update the .lesshst file. */ public void -save_cmdhist() +save_cmdhist(VOID_PARAM) { #if CMD_HISTORY char *histname; @@ -1665,7 +1718,8 @@ save_cmdhist() fprintf(fout, "%s\n", HISTFILE_FIRST_LINE); ctx.fout = fout; ctx.mlist = NULL; - read_cmdhist(copy_hist, &ctx, skip_search, skip_shell); + read_cmdhist(©_hist, &ctx, skip_search, skip_shell); + save_marks(fout, HISTFILE_MARK_SECTION); fclose(fout); #if MSDOS_COMPILER==WIN32C /* Modified: head/contrib/less/command.c ============================================================================== --- head/contrib/less/command.c Sat Jun 29 17:01:56 2019 (r349548) +++ head/contrib/less/command.c Sat Jun 29 18:41:40 2019 (r349549) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -49,6 +49,7 @@ extern struct scrpos initial_scrpos; extern IFILE curr_ifile; extern void *ml_search; extern void *ml_examine; +extern int wheel_lines; #if SHELL_ESCAPE || PIPEC extern void *ml_shell; #endif @@ -60,6 +61,9 @@ extern int screen_trashed; /* The screen has been over extern int shift_count; extern int oldbot; extern int forw_prompt; +#if MSDOS_COMPILER==WIN32C +extern int utf_mode; +#endif #if SHELL_ESCAPE static char *shellcmd = NULL; /* For holding last shell command for "!!" */ @@ -94,14 +98,39 @@ static void multi_search(); * updating the screen. */ static void -cmd_exec() +cmd_exec(VOID_PARAM) { - clear_attn(); + clear_attn(); clear_bot(); flush(); } /* + * Indicate we are reading a multi-character command. + */ + static void +set_mca(action) + int action; +{ + mca = action; + deinit_mouse(); /* we don't want mouse events while entering a cmd */ + clear_bot(); + clear_cmd(); +} + +/* + * Indicate we are not reading a multi-character command. + */ + static void +clear_mca(VOID_PARAM) +{ + if (mca == 0) + return; + mca = 0; + init_mouse(); +} + +/* * Set up the display to start a new multi-character command. */ static void @@ -111,15 +140,13 @@ start_mca(action, prompt, mlist, cmdflags) void *mlist; int cmdflags; { - mca = action; - clear_bot(); - clear_cmd(); + set_mca(action); cmd_putstr(prompt); set_mlist(mlist, cmdflags); } public int -in_mca() +in_mca(VOID_PARAM) { return (mca != 0 && mca != A_PREFIX); } @@ -128,21 +155,18 @@ in_mca() * Set up the display to start a new search command. */ static void -mca_search() +mca_search(VOID_PARAM) { #if HILITE_SEARCH if (search_type & SRCH_FILTER) - mca = A_FILTER; + set_mca(A_FILTER); else #endif if (search_type & SRCH_FORW) - mca = A_F_SEARCH; + set_mca(A_F_SEARCH); else - mca = A_B_SEARCH; + set_mca(A_B_SEARCH); - clear_bot(); - clear_cmd(); - if (search_type & SRCH_NO_MATCH) cmd_putstr("Non-match "); if (search_type & SRCH_FIRST_FILE) @@ -171,7 +195,7 @@ mca_search() * Set up the display to start a new toggle-option command. */ static void -mca_opt_toggle() +mca_opt_toggle(VOID_PARAM) { int no_prompt; int flag; @@ -181,9 +205,7 @@ mca_opt_toggle() flag = (optflag & ~OPT_NO_PROMPT); dash = (flag == OPT_NO_TOGGLE) ? "_" : "-"; - mca = A_OPT_TOGGLE; - clear_bot(); - clear_cmd(); + set_mca(A_OPT_TOGGLE); cmd_putstr(dash); if (optgetname) cmd_putstr(dash); @@ -206,7 +228,7 @@ mca_opt_toggle() * Execute a multicharacter command. */ static void -exec_mca() +exec_mca(VOID_PARAM) { char *cbuf; @@ -373,6 +395,7 @@ mca_opt_nonfirst_char(c) { char *p; char *oname; + int err; if (curropt != NULL) { @@ -392,7 +415,8 @@ mca_opt_nonfirst_char(c) return (MCA_DONE); p = get_cmdbuf(); opt_lower = ASCII_IS_LOWER(p[0]); - curropt = findopt_name(&p, &oname, NULL); + err = 0; + curropt = findopt_name(&p, &oname, &err); if (curropt != NULL) { /* @@ -410,6 +434,9 @@ mca_opt_nonfirst_char(c) if (cmd_char(c) != CC_OK) return (MCA_DONE); } + } else if (err != OPT_AMBIG) + { + bell(); } return (MCA_MORE); } @@ -461,6 +488,7 @@ mca_opt_char(c) error("There is no %s option", &parg); return (MCA_DONE); } + opt_lower = ASCII_IS_LOWER(c); } /* * If the option which was entered does not take a @@ -470,7 +498,7 @@ mca_opt_char(c) if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE || !opt_has_param(curropt)) { - toggle_option(curropt, ASCII_IS_LOWER(c), "", optflag); + toggle_option(curropt, opt_lower, "", optflag); return (MCA_DONE); } /* @@ -577,7 +605,7 @@ mca_char(c) * as a normal command character. */ number = cmd_int(&fraction); - mca = 0; + clear_mca(); cmd_accept(); return (NO_MCA); } @@ -644,7 +672,7 @@ mca_char(c) * Discard any buffered file data. */ static void -clear_buffers() +clear_buffers(VOID_PARAM) { if (!(ch_getflags() & CH_CANSEEK)) return; @@ -659,7 +687,7 @@ clear_buffers() * Make sure the screen is displayed. */ static void -make_display() +make_display(VOID_PARAM) { /* * If nothing is displayed yet, display starting from initial_scrpos. @@ -699,7 +727,7 @@ make_display() * Display the appropriate prompt. */ static void -prompt() +prompt(VOID_PARAM) { constant char *p; @@ -739,8 +767,14 @@ prompt() * In Win32, display the file name in the window title. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***